Skip to content

Instantly share code, notes, and snippets.

@AppGiniCourse
Last active October 17, 2018 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AppGiniCourse/dcd609202f93d6dfbf66609de3e4f51c to your computer and use it in GitHub Desktop.
Save AppGiniCourse/dcd609202f93d6dfbf66609de3e4f51c to your computer and use it in GitHub Desktop.
Customizing AppGini web application - Section 5 - Lesson 2
<?php
// For help on using hooks, please refer to http://bigprof.com/appgini/help/working-with-generated-web-database-application/hooks
function suppliers_init(&$options, $memberInfo, &$args){
return TRUE;
}
function suppliers_header($contentType, $memberInfo, &$args){
$header='';
switch($contentType){
case 'tableview':
$header='';
break;
case 'detailview':
$header='';
break;
case 'tableview+detailview':
$header='';
break;
case 'print-tableview':
$header='';
break;
case 'print-detailview':
$header='';
break;
case 'filters':
$header='';
break;
}
return $header;
}
function suppliers_footer($contentType, $memberInfo, &$args){
$footer='';
switch($contentType){
case 'tableview':
$footer='';
break;
case 'detailview':
$footer='';
break;
case 'tableview+detailview':
$footer='';
break;
case 'print-tableview':
$footer='';
break;
case 'print-detailview':
$footer='';
break;
case 'filters':
$footer='';
break;
}
return $footer;
}
function suppliers_before_insert(&$data, $memberInfo, &$args){
return TRUE;
}
function suppliers_after_insert($data, $memberInfo, &$args){
return TRUE;
}
function suppliers_before_update(&$data, $memberInfo, &$args){
return TRUE;
}
function suppliers_after_update($data, $memberInfo, &$args){
return TRUE;
}
function suppliers_before_delete($selectedID, &$skipChecks, $memberInfo, &$args){
return TRUE;
}
function suppliers_after_delete($selectedID, $memberInfo, &$args){
}
function suppliers_dv($selectedID, $memberInfo, &$html, &$args){
/* change the layout only if this is not the print preview */
if(isset($_REQUEST['dvprint_x'])) return;
ob_start(); ?>
<script>
$j(function(){
$j('fieldset.form-horizontal').removeClass('form-horizontal').addClass('form-inline');
/* Fix for a bug with lookup drop-downs and date fields to set their correct width */
setInterval(function() {
$j('.select2-container')
.parents('.form-control-static')
.removeClass('form-control-static');
$j('table.form-control-static').removeClass('form-control-static');
}, 1000);
})
</script>
<style>
@media (min-width: 768px){
.form-inline .form-group{
width: 48%;
margin-bottom: 0.75em;
vertical-align: top;
}
}
/* fixing width of input fields */
.form-inline .form-control {
width: 100% !important;
}
</style>
<?php
$new_layout = ob_get_contents();
ob_end_clean();
$html .= $new_layout;
}
function suppliers_csv($query, $memberInfo, &$args){
return $query;
}
function suppliers_batch_actions(&$args){
return array();
}
@AppGiniCourse
Copy link
Author

I updated this gist to fix some issues with form element widths that appeared when applying the gist to AppGini apps generated by recent versions of AppGini.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment