PHP Classes

File: demoNotes.php

Recommend this page to a friend!
  Classes of Prakash Khanchandani   Table Maintenance   demoNotes.php   Download  
File: demoNotes.php
Role: Documentation
Content type: text/plain
Description: notes displayed for the demos
Class: Table Maintenance
Manage forms for CRUD MySQL table records
Author: By
Last change:
Date: 10 years ago
Size: 7,227 bytes
 

Contents

Class file image Download
<?php /** * @author Prakash Khanchandani * @copyright 2013 * @program demoNotes.php * @description demo notes */ function brnchMstrNotes() { $notes = " <ul style='margin:0 0 0 -30px;font-size:0.9em;'> <li>Form and list side by side - this is the default. <li>Default form in add mode, with cursor positioned in first text box. <li>Column name and table name labels are as defined in the create table statement. <li>Labels and text box styles for <tt>NOT NULL</tt> columns are distinct. <hr> <li>Default list consisting of columns in create table statement order. <li>Hyperlink on first column of list record for selection. <li>Form and List are in same horizontal level whether nav buttons present or not. <li>Max no of records to display in list set as define value in mstrFH.php. <hr> <li>Cancelling in Add mode, takes the user out. <li>Cancelling in Update mode, takes user to blank form. <hr> <li>If record selected, form populated and displayed with index columns in read only mode, cursor positioned in first text box, and update button activated. Depending on business logic, Delete button may also be activated. <li>Clicking in Update button checks if any update actually done. If not, suitable msg is generated and no updates take place. <li>If changes done, confirmation form has the modified columns labels in different style. <li>Clicking on Delete requires confirmation. <li>The position of the list is maintained regardless of add/delete/update operations. <hr> <li>Audit trail record maintained for deletions and updates. <hr> <li>For new record, default validation to check for duplicates. <li>All validations default - no special business logic for add, modify, or delete. </ul>"; return $notes; } function mnuItmNotes() { $notes = " <p>List of records below the form.</p> <p>List contents customised and not default.</p> <p>The column name <tt>\"isParent\"</tt> would have been used as a label but has been replaced by <tt>Is&nbsp;parent?</tt> through an entry in <tt>\"nmProperties.fl\"</tt> properties file.</p> <p>Since <tt>itemId</tt> column is <tt>auto_increment</tt>, it is automatically not a part of the form.</p> <p>The <tt>isParent</tt> column is defined as <tt>enum</tt> and given a default value. The form displays the enum options and the default value is pre-populated.</p> <p>Validation of enum columns is a part of the automatic default validations done by the <tt>generalValidations()</tt> function in mstrTable.php.</p> <p></p> "; return $notes; } function crncyNotes() { $notes = " <p>The column name <tt>\"currencyCode\"</tt> would have been used as a label also but has been replaced by <tt>\"Currency Code\"</tt> through an entry in <tt>\"nmProperties.fl\"</tt> properties file.</p> <p>The <tt>\"Delete\"</tt> button gets activated on selection of a record which is not referenced by the <tt>bankCurrencies</tt> table. <em>Such references are picked up from <tt>foreign key</tt> definitions</em>.</p> <p>Another method to define such relationships is demonstrated in <tt>bnkMstr02.php</tt>.</p> <hr> <p>The table definition contains a default value of 2 for the decimal places so the text box for <tt>Add</tt> blank form is pre-filled with the default.</p> "; return $notes; } function bnk01Notes() { $notes = " <p>The table name <tt>\"bnkMstr\"</tt> is replaced by the phrase <tt>\"Bank Master\"</tt> in the title by an entry in <tt>\"nmProperties.fl\"</tt> properties file.</p> <p>The bnkMstr table has no foreign keys. To detect references, therefore, the <tt>canDelete()</tt> function has been programmed in <tt>bnkMstr01.php</tt>. If the function returns a <tt>yes</tt> the <tt>Delete</tt> button gets activated.</p> <p>An alternative method to define such a business logic, without recourse to programming, is demonstrated in the next script, <tt>bnkMstr02.php</tt>.</p> "; return $notes; } function bnk02Notes() { $notes = " <p>The <tt>bnkMstr</tt> is linked with the <tt>brnchMstr</tt> by defining references explicitly, <i><b>as if</b> they have come from foreign key definitions</i>. The effect is the same as in the earlier demo.</p> "; return $notes; } function authRulesNotes() { $notes = " <p>The <tt>bank</tt> column is set as a constraint with a specific value. For such columns the form displays the value as read only. Entries are not permitted in add and modify screens.</p> <p>The database has records for 'bank=413' and 'bank=987' also which are not displayed due to the constraint.</p> <p>The constraint is displayed in the title.</p> <p>The cursor is positioned in the first available text box, which is after the constraint.</p> "; return $notes; } function bnkCrncyNotes() { $notes = " <p>Column <tt>comments</tt>, if any, are displayed adjacent to the text box in the entry and update forms (in green in this demo).</p> <p>Explicit foreign keys are defined <em>explicitly</em> for <tt>currencies</tt>, <tt>bnkPrmtrs</tt>, and <tt>generalLedgerMstr</tt> <em>as if they were defined in the schema</em>. With such definitions, validations of bankCode, currencyCode, and GL account number are handled automatically.</p> <p>If the above cross reference is valid, the reference record is made available and its attributes can be displayed on the form. Select any record from the list and see the bankName, currencyDescription, cashOnHandGLdescription get displayed.</p> <p>In this example, we also see how to apply additional programmatic validation - refer the code where minimum and maximum retention amounts are validated.</p> "; return $notes; } function prodTypesNotes() { $notes = " <p>The <tt>active</tt> column is hidden in the add and update forms.</p> <p>References:<ul> <li>The <tt>prodTypes</tt> table does not figure in any foreign key reference. <li>For demonstration purposes, I have chosen not to give any explicit references either. <li>The only option left to detect whether a record can be deleted is to program the <tt>canDelete()</tt> function (click on product#18 to see the Delete button becoming active). </ul></p> "; return $notes; } function userNotes() { $notes = " <p>The order of columns in the form can be rearranged. Need not specify all the columns but only those that should come on top.</p> <p>The <tt>passWrd</tt> column is <em>hidden</em>. Comment out line#63 and see the form again.</p> <p>Explicit references have been given for <tt>bnkPrmtrs</tt> and <tt>brnchPrmtrs</tt> tables. Refer the <tt>getListAndColumns()</tt> function.</p> <p>For demonstration purposes a foreign key reference is given for the <tt>groups</tt> table although in actual practice this would be illogical. Thus, we have a situation where there is a mix of explicit and implicit references working seamlessly.</p> <p>This example has columns where specific validation is required:<ul> <li>userType, <li>isCashTell, <li>isHC </ul> Refer the <tt>validateInput()</tt> function for details. </p> "; return $notes; } ?>