private array $dbdef
>> <<
Contains a reference to the db definition array
The db definition array contains all information used to produce data editingpages by generic_admin.The structure is the following:
$dbdef["TableName"] = TableDefinitions Defines the TableName "TableName", which is actually an alias to areal database table.
Tabledefinitions = array( "tablename" => "phys_tablename", "selecttablename" => "phys_readonly_tablename", "nicename_sing" => "nicename_in_singular" , "nicename_plur" => "nicename_in_plural" , "accessrole" => Connection data , "linkname" => Linkname , "pk" => Primary Key, "firstdispcol" => "first disp col", "letteranchors" => "anchor col", "actions" => TableActions, "rowfuncs" => RowFunctions, "coloring" => Coloring, "changetext" => "Changetext", "detailtext" => "Detailtext", "deletetext" => "Deletetext", "nochangebuttin" => "yes", "nodetailbutton" => "yes", "nodeletebuttun" => "yes", "fields" => TableFields "sort_order" => SortOrder "filter" => TableFilter ) - tablename specifies the physical (seen from the databaseabstraction layer) table, which is used for the TableName. - phys_readonly_tablename specifies the table name, which isused in the tabular view and the details view. This can contain fieldsfrom other tables. If not set, the normal tablename will be used. - nicename_in_singular specifies a name of the table to displayto the user. This is the singular form. ,- nicename_in_plural this is the plural form. ,- Linkname Use this link to the database. If it doesn't exist,connect to the database again. ,- firstdispcol specifies the field, which will be used, if thevalue of a field has to be displayed, but there is none specified(eg. for a referencing foreign key) - letteranchors specifies to put an Anchor with the first letterof the specified column into the first field of the row in thetable view where a new letter begins. Works with letters at themoment only. - changetext is the text of the Change Button in the tabularview,which leads to the form block display. You can specify a picturehere for example. - detailtext does the same for the detail view. - deletetext does the same for the detail action. - nochangebutton prevents the change button from being displayed.Of course "changetext" is ignored then. - nodetailbutton does the same with the detail button - nodeletebutton does the same with the delete button
Connection data = array( "dbtype" => Database Type (MSSQL, IFX) "dbhost" => Database Host name "dbname" => Database Name "dbuser" => User Name "dbpass" => Password
- Specifies all data to connect to a database. This can also be used to connect withdifferent user names.
Primary Key = "column" or Primary Key = array("column1", "column2", ...) - Specifies a primary key in one column, or a composite key overmultiple columns. This is used to identify rows with the databaseabstraction layer.
TableActions = array("actionname1" => "actionfunction1", ...) - specifies to call the function "actionfunction1", if generic_admin iscalled with the action "action1". This can be used to call external functionalitylike resetting passwords, or displaying more complex confirmation messages.Appropriate links must be assembled in the function.
RowFunctions = array("rowfunction1", ...) - specifies a function to be called for every row of the table views as well asonce for the detail/form views.
Coloring = array("row_odd" => odd_color,"row_even" => even_color,"row_highlight" => hl_color) - specifies colors to be attached to the template in the table view, when aodd or even row is displayed. The highlight-color can be used to have a differentone for highlighting the row with javascript.
SortOrder = array("sortcol1", "sortcol2",...) - Specifies the table view to be sorted by the specified columns, based on theunformatted data. This is passed to the database abstraction layer. Descendingorder can be specified by adding " desc" to the column name. " asc" will work as well. <br/ >TableFilter = array("col1" => "cond1", ...) - Specifies the table data to be filtered by column "col1" with "cond1". The conditionin "cond1" must cobtain the operator and the value of the condition, ie."<> 1" or "< 'a'". This functionality can be used to implement views on the php level.
TableFields = array("fieldname1" => array(FieldData), "fieldname2" => array(FieldData)) - this specifies the columns of the table, which are used in the display.
FieldData = array( "dispname" => "Display Text", "datatype" => "datatype value", "disptype" => "display type", "tplparse" => TemplateData, "length" => "field length", "watchedupdate" => "yes", "omitintable" => "yes", "omitindetail" => "yes", "omitinform" => "yes", "dbignore" => "yes", "dbselect" => "yes", "sqlpackage" => "Package string", "filter" => FilterSetup, "inputfuncs" => FunctionList, "ip2dbfuncs" => FunctionList, "db2topfuncs" => FunctionList, "db2fopfuncs" => FunctionList, "db2dopfuncs" => FunctionList, "insert" => FunctionList, "update" => FunctionList, "delete" => FunctionList, "commands" => Command ) - dispname specifies the description of the column in the headerof the table views and the description of the row in thedetail/form views. - datatype defines the data this column contains. This can either be: "str": for strings. This will be enclosed with '' in the db layer.(also default) "int": for integers. The value will be casted to int by the db layer. "float": for float values. The value will be casted to float. - disptype is used to determine the kind of html to handle this field in the form block.See build_form_block() for details. - length specifies the length of the field. This is used when building forms from thedata specification. - watchedupdate specifies to update the row only, if it has been changed. This is at themoment only supported for tabularedit. - omitintable prevents the column from being displayed in the table views. - omitindetail does the same for detail view. This will most be used for big tables,together with "omitintable" to show the most important information. - omitinform does the same for form view. - dbignore if set, lets the database layer ignore this field. This can be used todisplay action buttons for each field. - dbselect if set, the database layer uses this field in select queries only. This is used tohave fields from other tables in the table view - sqlpackage used to pack a fieldname in an expression in SQL. This can be used to run functionson fields, before requesting them, like CAST or CONVERT - inputfuncs This functions will be called, when checking the input of a submittedform view, either inserting or updating. - filterinputfuncs This functions will be called, when checking the input of a submittedfilter block. - db2topfuncs Called, when data is displayed in a tabular view, after the Rowfunctions.- db2dopfuncs Called, when data is displayed in the detail view, after the Rowfunctions.- db2fopfuncs Called, when data is displayed in the form view, after the Rowfunctions.- ip2dbfuncs Called, before inserting into or update on the database. This can be used fordata, which is displayed differently than it is stored in the database, eg. timestamps. - insert Called, after data is inserted into the database. This can be used to do somethingwith a newly created autonumber - update Called, before data is inserted into the database. - delete Called, after data is deleted from the database.
TemplateData = array("TPLNAME1" => "value1",...) - specifies key-value combinations which are handed trough to the templatesystem each time this field is displayed. This can be used to specify a fixedwidth of a table column or a css class.
FunctionList = array("function1",...) - specifies functions which are called at certain points (see before). The actualfunction name has a "gadm_" as preceeding characters.
FilterSetup = array( operator => "operator", display => "display",) - This array sets up a filter field in the filter block. operator specifies the operator used in the query. Can be ofarray("=", "<>", "<", "<=", ">", ">=", "contains"). "contains" istranslated into a "like" statement. display Is used to display the meaning of the operator to the user.Use values like "equals", "contains", "smaller than", "before"
Command = array( "type" => "commandtype", "otherinfo1" => "data1",... ) - this Array contains specifications for high level commands. - type specifies the class of the command. The command is thenimplemented with the classname defined in gadmcommand as adescendent of gadmcommand. All other info is command type specific.
|