Last active
September 19, 2018 07:23
-
-
Save BrandonDyer64/c8eb2e3d3f03c1b442f6eadfabf8f908 to your computer and use it in GitHub Desktop.
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 | |
include("../../bin/do_not_change/standard_validation_regex.php"); | |
unset($field); unset($index); | |
// TODO: Table Name | |
$table = "sample_table"; | |
/* Table Plural * | |
$table_plural = "sample_tables"; /*/ | |
$table_plural = $table . 's'; /**/ | |
$denote_edit_changes = TRUE; | |
$have_list_things_action_checkboxes = TRUE; | |
// TODO: Slave Tables | |
/* Note * | |
$is_master_table_for[] = "${table}_note"; | |
$dont_show_in_vert_table[] = "${table}_note"; | |
$show_count_and_latest[] = "${table}_note"; | |
/**/ | |
/* Document * | |
$is_master_table_for[] = "${table}_document"; | |
$dont_show_in_vert_table[] = "${table}_document"; | |
$show_count_and_latest[] = "${table}_document"; | |
/**/ | |
/* Status * | |
$is_master_table_for[] = "${table}_status_update"; | |
$dont_show_in_vert_table[] = "${table}_status_update"; | |
/**/ | |
// Create Displays | |
$thing_display = preg_replace('/_+/', ' ', $table); | |
$Thing_display = ucfirst($thing_display); | |
$things_display = preg_replace('/_+/', ' ', $table_plural); | |
$Things_display = ucfirst($things_display); | |
$indefinite_article = 'a'; | |
$display_name_as = "name"; | |
/* Sorting * | |
$default_sort_order = "id asc";/**/ | |
//$dont_list_unless_filter = TRUE; | |
// Base Field Types | |
$f_base = array( | |
'not_null' => FALSE, 'display_in_table_list_column' => TRUE, | |
'display_field_in_vertical_table' => TRUE, | |
'field_is_required_in_form' => FALSE, | |
'filterable' => TRUE, 'filter_operator' => '=' | |
); | |
$f_string = array_merge($f_base, array('type' => 'VARCHAR', 'size' => 255)); | |
$f_int = array_merge($f_base, array('type' => 'INT')); | |
$f_uint = array_merge($f_base, array('type' => 'INT UNSIGNED')); | |
$f_bool = array_merge($f_base, array('type' => 'ENUM', 'enum_option' => array('n','y'))); | |
$f_dec102 = array_merge($f_base, array('type' => 'DECIMAL (10,2)', 'totalable' => TRUE)); | |
$f_date = array_merge($f_base, array('type' => 'DATE')); | |
$f_datetime = array_merge($f_base, array('type' => 'DATETIME')); | |
$field[] = array_merge($f_uint, array( | |
'name'=>'id', | |
'not_null' => TRUE, | |
'auto_increment' => TRUE, | |
'human_display' => 'ID' | |
)); | |
// TODO: Fields | |
$field[] = array_merge($f_string, array( | |
'name'=>'name', | |
'human_display' => 'Name' | |
)); | |
$field[] = array_merge($f_bool, array( | |
'name'=>'checkbox', | |
'human_display' => 'Checkbox' | |
)); | |
$field[] = array_merge($f_uint, array( | |
'name'=>'siteuser_id', | |
'human_display' => 'Site User' | |
)); | |
$field[] = array_merge($f_uint, array( | |
'name'=>'other_siteuser_id', | |
'select_from'=>'siteuser', | |
'human_display' => 'Other Site User', | |
)); | |
include("../../bin/do_not_change/standard_config_files/STANDARD_TABLE_FIELDS"); | |
$index[] = array("type"=>"PRIMARY KEY", | |
"name"=>array("id") | |
); | |
/* Indexing * | |
$index[] = array("type"=>"INDEX", | |
"name"=>array("something_id") | |
); | |
/**/ | |
$startup_sql[] = "INSERT IGNORE INTO thing (id, name, active, date_added) VALUES ('$table','$Thing_display','y',NOW())"; | |
// give admin group read/write permissions | |
$startup_sql[] = "INSERT IGNORE INTO jusergroup_thing (usergroup_id, thing_id, read_access, write_access, active, date_added) VALUES ('2','$table','all','all','y',NOW())"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment