PHP Classes
elePHPant
Icontem

File: bnkMstr02.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Prakash Khanchandani  >  Table Maintenance  >  bnkMstr02.php  >  Download  
File: bnkMstr02.php
Role: Example script
Content type: text/plain
Description: 5th level example
Class: Table Maintenance
Manage forms for CRUD MySQL table records
Author: By
Last change:
Date: 1 year ago
Size: 1,685 bytes
 

Contents

Class file image Download
<?php

/**
 * @author Prakash Khanchandani
 * @copyright 2013
 * @program bnkMstr02.php
 * @description bank master maintenance
 * @specialities - explicitly define foreign keys if schema defn does not exist
 * - use explicit defn to decide whether a record can be delete
 */


session_start();
require_once (
"classes.php");


function
createTableObject()
{
   
$obj = new bnkMstrTbl;
    if (
$obj->getListAndColumns() === false)
        return
false;
    else
        return
$obj;
}


#
#
#
#
#


class bnkMstrTbl extends mstrTable
{
    function
getListAndColumns()
    {
       
$this->tableName = 'bnkMstr';

       
$this->orderByClause = 'bank';
       
/*
        create delete references. There is no foreign reference established between bnkMstr
        and brnchMstr. In such a situation, if you know that there is in fact a reference
        although not explicityly defined, you can provided it yourself. The format is an
        array with:
        [1]=>the first element giving the table name of the other table
        [2]=>giving a relationship between the other table and this one as
        otherTable.columnName = thisTable.columnName
        */
       
$this->explicitDltRef[] = array("brnchMstr", "bank=bank");
       
/*
        generate the list with auto determined columns, ie., dont pass any parameters. */
       
$result = parent::getListAndColumns();
        return
$result;
    }
}


#
#
#
#
#


if (!isset($_REQUEST['actn'])) {
   
$obj = createTableObject();
} else {
   
/* if the user has taken some action, handle it. */
   
$obj = handleRequestOption();
}


$form = new mstrFH($obj);
$form->setDemoNotes(bnk02Notes());
$form->displayForm();
?>