Skip to content

Instantly share code, notes, and snippets.

View shannah's full-sized avatar

Steve Hannah shannah

View GitHub Profile
//require <jquery.packed.js>
//require <xatajax.form.core.js>
//require <ckeditor.js>
(function(){
var $ = jQuery;
var findField = XataJax.form.findField;
registerXatafaceDecorator(function(node){
var importBtn = $('button.import-job-posting-instructions', node);
var fields = {
<?php
class tables_section_schedule_items {
function getRoles(&$record){
if ( isAdmin() ) return null;
if ( isUser() ){
return 'READ ONLY';
}
return null;
}
@shannah
shannah / home.php
Created May 28, 2014 16:25
Xataface home action
<?php
class actions_home {
function handle(&$params){
// Get the featured items
$indexItems = df_get_records_array('featured', array('active'=>1, '-sort'=>'effectiveDate desc'));
$ii = array();
foreach ($indexItems as $item){
$ii[] = $item->strvals();
d142-58-249-174:depselect shannah$ svn diff -r 5010:5022 .
Index: js/xataface/widgets/depselect.js
===================================================================
--- js/xataface/widgets/depselect.js (revision 5010)
+++ js/xataface/widgets/depselect.js (revision 5022)
@@ -24,6 +24,7 @@
//require <jquery-ui.min.js>
//require-css <jquery-ui/jquery-ui.css>
//require <RecordDialog/RecordDialog.js>
+//require <xatajax.form.core.js>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ca.weblite.comiccl.view;
import ca.weblite.comiccl.model.Collection;
import ca.weblite.comiccl.model.Issue;
__sql__ = "select c.*,
cc.num_calls,
(select call_result from calls where contact_id=c.contact_id order by time_of_call desc limit 1) as last_call_result,
(select max(time_of_call) from calls where contact_id=c.contact_id) as last_call_time,
(select student_decision from calls where contact_id=c.contact_id order by time_of_call desc limit 1) as last_student_decision,
(select mentor_preference_id from calls where contact_id=c.contact_id order by time_of_call desc limit 1) as last_mentor_pref,
(select group_concat(caller_comments) from calls where contact_id=c.contact_id) as combined_caller_comments
from current_call_list c
left join call_counts cc on cc.contact_id=c.contact_id
create view contact_call_info as select c.contact_id,
(select count(*) from calls where contact_id=c.contact_id) as num_calls,
(select call_result from calls where contact_id=c.contact_id order by time_of_call desc limit 1) as last_call_result,
(select max(time_of_call) from calls where contact_id=c.contact_id) as last_call_time,
(select student_decision from calls where contact_id=c.contact_id order by time_of_call desc limit 1) as last_student_decision,
(select mentor_preference_id from calls where contact_id=c.contact_id order by time_of_call desc limit 1) as last_mentor_pref,
(select group_concat(caller_comments) from calls where contact_id=c.contact_id) as combined_caller_comments
from current_call_list c
__sql__ = "select c.*,
ci.num_calls,
ci.last_call_result,
ci.last_call_time,
ci.last_student_decision,
ci.last_mentor_pref,
ci.combined_caller_comments
from current_call_list c left join contact_call_info ci on c.contact_id=ci.contact_id"
import('xf/db/DynamicTable.php');
$contact_call_info = new \xf\db\DynamicTable("contact_call_info",
array(
"create table contact_call_info (
contact_id INT(11) NOT NULL PRIMARY KEY,
num_calls INT(5),
last_call_result VARCHAR(100),
last_call_time DATETIME,
last_student_decision INT(11),
last_mentor_pref INT(11),
function beforeLoadResultSet(){
$contact_call_info = new \xf\db\DynamicTable("contact_call_info",
array(
"create table contact_call_info (
contact_id INT(11) NOT NULL PRIMARY KEY,
num_calls INT(5),
last_call_result VARCHAR(100),
last_call_time DATETIME,
last_student_decision INT(11),
last_mentor_pref INT(11),