Skip to content

Instantly share code, notes, and snippets.

View shannah's full-sized avatar

Steve Hannah shannah

View GitHub Profile
<?php
class tables_mytable {
function beforeSave(Dataface_Record $record){
if ( $record->valueChanged('status') and $record->val('status') === 'Broken' ){
$record->pouch['send_broken_email'] = true;
}
}
function afterSave(Dataface_Record $record){
if ( @$record->pouch['send_broken_email'] ){
<?php
class tables_mytable {
function beforeSave(Dataface_Record $record){
if ( $record->valueChanged('status') and $record->val('status') === 'Broken' ){
$callbacks = array();
$callbacks[] = function(Dataface_Record $record){
mail(...);
};
$record->pouch['afterSave_callbacks'] = $callbacks;
<?php
class tables_issues {
...
function status__renderCell(Dataface_Record $record){
$options = array(
'Select...',
'Open',
'Closed',
);
$currVal = $record->val('status');
[status]
widget:type=select
vocabulary=statuses
noLinkFromListView=1
alert('here');
<?php
class tables_issues {
...
function status__renderCell(Dataface_Record $record){
Dataface_JavascriptTool::getInstance()
->import('editable_status.js');
$options = array(
'Select...',
// A closure: An anonymous javascript function, that is called
// immediately after creation.
(function(){
// Enter javascript code here.
})();
//require <jquery.packed.js>
//require <xataface/IO.js>
(function(){
// Get a short handle to the jQuery object
var $ = jQuery;
//.. rest of javascript here
})();
//require <jquery.packed.js>
//require <xataface/IO.js>
(function(){
var $ = jQuery;
//registerXatafaceDecorator() is like $(document).ready() except that it may also be called
// when a node is loaded via ajax.
registerXatafaceDecorator(function(node){
$('select.status-drop-down[data-record-id]', node).change(function(){
var recordId = $(this).attr('data-record-id');
function block__before_instructions_widget(){
Dataface_JavascriptTool::getInstance()
->import('tables/job_postings/import_instructions.js');
echo '<button class="import-job-posting-instructions">Copy Instructions from Prev. Semester</button>';
}