<?php
/**
* @author Prakash Khanchandani
* @copyright 2013
* @program basicDemo.php
* basic demo for the list processor:
* given an array, generate an html table with the contents from the array
*/
require_once "listPrcsr.php"; // the list processor class
require_once "getData.php"; // functions to generate data for the demo
$data = getLimitedData(); // get the data to be displayed
/*
create a descriptive array for the data. The contents of the descriptive
array are as follows:
[0]=>Title to be displayed on the header row
[1]=>Left or Right justified - L or R
[2]=>to be output? Y or N
[3]=>include in get? Y or N
[4]=>include var name
[5]=>number of digits for money formatting, optional
*/
/*
the following descriptive array will display all elements of each row of the list. */
$des[] = array("Branch", "L", "Y", "N", "");
$des[] = array("Product Type", "L", "Y", "N", "");
$des[] = array("Account No", "L", "Y", "N", "");
$des[] = array("Title", "L", "Y", "N", "");
$des[] = array("Available Balance", "R", "Y", "N", "", 2);
$des[] = array("Ledger Balance", "R", "Y", "N", "", 2);
/*
the following descriptive array suppress display of the first and second elements
in each row. Note the "N" in the third element of branch and product descriptor. */
$shortDes[] = array("Branch", "L", "N", "N", "");
$shortDes[] = array("Product Type", "L", "N", "N", "");
$shortDes[] = array("Account No", "L", "Y", "N", "");
$shortDes[] = array("Title", "L", "Y", "N", "");
$shortDes[] = array("Available Balance", "R", "Y", "N", "", 2);
$shortDes[] = array("Ledger Balance", "R", "Y", "N", "", 2);
$lp = new listPrcsr(); // instantiate the class
$lp->data = $data; // put in the data to be displayed
$lp->des = $des; // supply the descriptor for the data
$lp->opt = "N"; // this is a plain display, without any hyperlinks
$lp->max = 0; // display the full list, without any pagination
$lp->moneyFormat = "R";
/* "R" is for ruppee type formatting as in 1,23,456.78. The other option
is "T" for thousands formatting as in 123,456.78 */
$out = $lp->gnrtOutput(); // generate the output
/* now generate a different output using the same data - with the shorter
description and with Thousands formatting. */
$lp->des = $shortDes;
$lp->moneyFormat = "T";
$outShort = $lp->gnrtOutput();
include "inc1.php";
?>
|