-
-
Save AppGiniCourse/dcd609202f93d6dfbf66609de3e4f51c to your computer and use it in GitHub Desktop.
Customizing AppGini web application - Section 5 - Lesson 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.