Skip to content

Instantly share code, notes, and snippets.

View shannah's full-sized avatar

Steve Hannah shannah

View GitHub Profile
function __sql__(){
$userid = 0;
$agency_id=0;
$user = getUser();
if ( $user ){
$userid = $user->val('user_id');
$agency_id = $user->val('organization_id');
} else {
$agency_id = Dataface_Application::getInstance()->getDelegate()->organizationID;
}
@shannah
shannah / OfflineMapsDemo.java
Created March 19, 2014 17:04
Demo application for CN1OfflineMaps
package ca.weblite.offlinemaps.demo;
import ca.weblite.codename1.mapbox.MBTilesProvider;
import com.codename1.io.ConnectionRequest;
import com.codename1.io.Log;
import com.codename1.io.NetworkManager;
import com.codename1.maps.MapComponent;
import com.codename1.ui.Button;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
@shannah
shannah / ApplicationDelegate.php
Created April 12, 2014 16:04
Adding a custom stylesheet to xataface app
<?php
class conf_ApplicationDelegate {
function beforeHandleRequest(){
Dataface_Application::getInstance()
->addHeadContent('<link rel="stylesheet" type="text/css" href="style.css"/>');
}
}
@shannah
shannah / style.css
Last active August 29, 2015 13:59
Sample css file to hide top search form in g2 theme of xataface.
div#top-search-form {display:none;}
@shannah
shannah / ApplicationDelegate.php
Created April 12, 2014 16:18
Custom stylesheet included only for dashboard table.
<?php
class conf_ApplicationDelegate {
function beforeHandleRequest(){
$app = Dataface_Application::getInstance();
$query = $app->getQuery();
$app->addHeadContent('<link rel="stylesheet" type="text/css" href="style.css"/>');
if ( $query['-table'] == 'dashboard' ){
$app->addHeadContent('<link rel="stylesheet" type="text/css" href="dashboard.css"/>');
}
}
@shannah
shannah / ApplicationDelegate.php
Created April 12, 2014 16:25
Adding custom CSS classes to <body> tag
<?php
class conf_ApplicationDelegate {
function beforeHandleRequest(){
$app = Dataface_Application::getInstance();
$query = $app->getQuery();
$app->addHeadContent('<link rel="stylesheet" type="text/css" href="style.css"/>');
}
function block__body_atts(){
$css_classes = array();
body.table-dashboard div#top-search-form,
body.table-foobar div#top-search-form
{ display:none;}
<?php
class tables_mytable {
function afterSave(Dataface_Record $record){
if ( $record->val('status') === 'Broken' ){
mail(ADMIN_EMAIL, 'Something is broken', '...');
}
}
}
<?php
class tables_mytable {
function afterSave(Dataface_Record $record){
if ( $record->valueChanged('status') and $record->val('status') === 'Broken' ){
mail(...);
}
}
}
<?php
class tables_mytable {
function beforeSave(Dataface_Record $record){
if ( $record->valueChanged('status') and $record->val('status') === 'Broken' ){
mail(...);
}
}
}