Class miViewRecords

Description

Manage the representation in table format of data, which is readed from miModelSQLRecordset object

  • copyright: Mirchev Ideas Ltd. © 2003, 2004

Located in /view/ViewRecords.inc (line 25)


	
			
Method Summary
 miViewRecords miViewRecords (object $recordset)
 void addMainUiElements (object &$t)
 void addUiElements (array &$rows)
 void assign (string $name, mixed $value)
 void &getViewParams ()
 void Parse (string $mainTemplate, string $rowsTemplate, string $msg)
 void setMainPageElements (array $mainPageElements)
 void setPage (int $page, int $recordsPerPage)
 void setPager (mixed $pager, object $u)
 void setViewParams (mixed &$viewParamsObj)
 void Show (string $mainTemplate, string $rowsTemplate, string $msg)
 void ShowPage (string $mainTemplate, string $rowsTemplate, string $page, string $msg, [string $recordsPerPage = MI_RECORDS_PER_PAGE])
 array &transposeRows (array &$rows)
Methods
Constructor miViewRecords (line 65)

miViewRecords constructor. It takes one parameter - object of class miModelSQLRecordset or its subclasses

Example:


1 <?php
2 $recordset = new miModelSQLRecordset('tableName');
3 $ViewRecords = new miViewRecords($recordset);
4 ?>

  • access: public
miViewRecords miViewRecords (object $recordset)
  • object $recordset: object of class miModelSQLRecordset or its subclasses
addMainUiElements (line 336)

In this function subclasses will add specific elements to the main template page

  • access: protected
void addMainUiElements (object &$t)
  • object $t: of class miTemplateParser() or its subclasses
addUiElements (line 323)

In this function subclasses will add table specific processing

  • access: protected
void addUiElements (array &$rows)
  • array $rows: readed rows from the database
assign (line 291)

Assigns a value to a specify main page element

  • access: public
void assign (string $name, mixed $value)
  • string $name: name of the main page element
  • mixed $value: value of the main page element
getViewParams (line 89)

Gets the view params object

  • access: public
void &getViewParams ()
Parse (line 183)

Parse data in template files.

  • access: protected
void Parse (string $mainTemplate, string $rowsTemplate, string $msg)
  • string $mainTemplate: name of the main template file
  • string $rowsTemplate: name of the template which represent each table row
  • string $msg: information message which will be shown in the page
setMainPageElements (line 142)

Sets main page elements

  • access: public
void setMainPageElements (array $mainPageElements)
  • array $mainPageElements: array with the main page elements
setPage (line 102)

Sets the current page to show and the number of records per page

  • access: public
void setPage (int $page, int $recordsPerPage)
  • int $page: current page to show
  • int $recordsPerPage: define how many rows to show in each page
setPager (line 130)

Sets Object of class miDefaultRecordsetPager or its subclasses.

miDefaultRecordsetPager object is needed to manage the movement between pages. miViewRecords class sets an object of miDefaultRecordsetPager in it's constructor. Example:


1 <?php
2 $recordset = new miModelSQLRecordset('tableName');
3 $ViewRecords = new miViewRecords($recordset);
4 $pager = new miDefaultRecordsetPager;
5 $ViewRecords->setPager($pager);
6 ?>

  • access: public
void setPager (mixed $pager, object $u)
  • object $u: Object of class iDefaultRecordsetPager or its subclasses
setViewParams (line 78)

Sets the view params object

  • access: public
void setViewParams (mixed &$viewParamsObj)
Show (line 165)

Shows page with data in table format.

Example:


1 <?php
2 $recordset = new miModelSQLRecordset('tableName');
3 $ViewRecords = new miViewRecords($recordset);
4 $ViewRecords->Show($mainTemplate, $rowsTemplate, $msg)
5 ?>

  • access: public
void Show (string $mainTemplate, string $rowsTemplate, string $msg)
  • string $mainTemplate: name of the main template file
  • string $rowsTemplate: name of the template which represent each table row
  • string $msg: information message which will be shown in the page
ShowPage (line 236)

Shows specify page

Example:


1 <?php
2 $recordset = new miModelSQLRecordset('tableName');
3 $ViewRecords = new miViewRecords($recordset);
4 $ViewRecords->ShowPage($mainTemplate, $rowsTemplate, $msg)
5 ?>

  • access: public
void ShowPage (string $mainTemplate, string $rowsTemplate, string $page, string $msg, [string $recordsPerPage = MI_RECORDS_PER_PAGE])
  • string $mainTemplate: name of the main template file
  • string $rowsTemplate: name of the template which represent each table row
  • string $page: which page to show
  • string $msg: information message which will be shown in the page
  • string $recordsPerPage: define how many rows per page to show
transposeRows (line 254)

Transposes the $rows array from array of hashes into a hash of arrays. All values are escaped with htmlentities(), except the values for keys starting with HTML_

  • return: array with the new transposed rows
  • access: public
array &transposeRows (array &$rows)
  • array $rows: readed rows from the database

Documentation generated on Mon, 18 Oct 2004 14:58:33 +0300 by phpDocumentor 1.2.3