PHP Classes

File: indexFileHelp.htm

Recommend this page to a friend!
  Classes of Prakash Khanchandani   Table Maintenance   indexFileHelp.htm   Download  
File: indexFileHelp.htm
Role: Documentation
Content type: text/plain
Description: system description
Class: Table Maintenance
Manage forms for CRUD MySQL table records
Author: By
Last change:
Date: 10 years ago
Size: 4,029 bytes
 

Contents

Class file image Download
<style> ul { margin: 0 0 0 -2em; } p tt, li tt { font-size: 115%; } </style> <div style="float:left;width:49%;font-size:0.8em;color:rgb(0,90,0);"> <p>Add, Update, and Delete MySQL table records without programming for forms, general validations, etc. Useful for <tt>Master Maintenance</tt> of setup and parameter tables.</p> <p>All updates and deletions are automatically logged in an <tt>auditTrail</tt>.</p> <p>At its simplest, you pass the table name for which the system will generate a form in <tt>Add</tt> mode and display a list of existing records. The form and list are side by side as default; it can be over-ridden for the list to be below the form. The form <tt>title</tt> is the table name and the form <tt>labels</tt> are the column names; these can be over-ridden through a properties file.</p> <p>The form elements are in order of their definition in the table; this order can be over-ridden and you can even hide certain columns from the form. The record list is in default order and includes the first 4 columns; an <tt>order by</tt> clause can over-ride this default; you can also provide a set of columns that should be displayed. If the list has more than a defined no of records, navigation buttons are activated for the next and prev set of records.</p> <p>If a record is <tt>selected</tt> from the list, the form is populated with the record and the form goes into the <tt>Update</tt> mode and the <tt>index</tt> columns automatically become <tt>read only</tt>.</p> <p>Default validations include checks for:<ul> <li>blanks in <tt>NOT NULL</tt> columns (such fields are distinctly marked in the form), <li>date fields in <tt>DMY</tt> or <tt>MDY</tt> formats, (the format to be used is taken from a <tt>session variable</tt>). The date components can be separated by a comma, or a stop, or a dash, or a space or a slash. <li>for <tt>enum columns</tt> the data should be one of the defined options, <li>whether the record is duplicate for <tt>Add</tt>, <li>whether any field has been changed for <tt>Update</tt>, <li>foreign key references, and, <li>special characters, </ul></p> </div> <div style="float:right;width:49%;font-size:0.8em;color:rgb(0,90,0);"> <p>A method is provided to add user specific validations.</p> <p>The <tt>Add</tt>, <tt>Update</tt>, and <tt>Delete</tt> actions result in a <tt>read only</tt> confirmation page. For updates, this page shows the fields that have been changed.</p> <p>If the table has been defined with a <tt>foreign key reference</tt><ul> <li>data entered in the referencing column is automatically checked for validity, <li>the referenced record is populated and the client program can use data item(s) to display on the form for user feedback, <li><tt>referenced</tt> records are checked for cross references before the <tt>delete</tt> button is activated. </ul></p> <p>If tables <em>don&rsquo;t</em> have <tt>foreign key references</tt>, a method is available to define such references <em>explicitly</em>.</p> <p>If neither <em>implicit</em> nor <em>explicit</em> <tt>foreign references</tt> are given, the system provides an over-riding method to check for delete references and cross table validations programatically.</p> <p>At its most complex, one can one can over ride the default form totally, create tabs for very complex forms, create additional fields in a form for further processing, and so on. Go through the classes to understand the full capability of the system. Demo programs describing these additional capabilities will be available in the next release.</p> <p>There are 3 main classes - <tt>mstrTable</tt> to work with the database, <tt>mstrFH</tt> and <tt>header</tt> to handle the forms, buttons, &amp; lists, and <tt>mstrScripts</tt> to get the meta data, get the record list, insert a record, delete, and so on. There a couple of other supporting classes and functions as well.</p> </div>