PHP Classes

File: Readme.txt

Recommend this page to a friend!
  Classes of kai   Report   Readme.txt   Download  
File: Readme.txt
Role: Documentation
Content type: text/plain
Description: readme
Class: Report
Show MySQL results in pages updated using AJAX
Author: By
Last change:
Date: 14 years ago
Size: 4,576 bytes
 

Contents

Class file image Download
Please run testData.sql against a database and change the example files to point to that database to view the examples. 1 CONSTRUCTION call __Construct($query,$interval) to create the report with the query you want and the number of records on a page or __Construct($query) with all records on the page or __Construct($query,"",$order,$direction) __Construct($query,$interval,$order,$direction) to order your report by default on a column $query is the mysql query the class will use to generate your report $order is the name of a column in the database you want to order by $direction can be ASC or DESC 2 ADDING FIELDS TO THE REPORT 2.1 adding a normal field call addDisplayField($name,$display,$sizeOfField) or addDisplayField($name,$display) $name is the name of the field in the databases and must be in the query you constructed with $display is the heading of the field displayed to the user $sizeOfField is the minimum width or the table column for this field 2.2 adding a special field here you can create a field with special attributes, eg. a link field or running javascripts on the field call addSpecialDisplayField($name,$display,$text,$sizeOfField=50) or addSpecialDisplayField($name,$display,$text,$sizeOfField=50) $name is the name of the field in the database. this is only used for sorting purposes. if the user sorts on this field this field in the database will be used. $display is the heading of the field displayed to the user $text this is the special text that will be used as the field, anything in {} will be replaced by a field in the database eg. if name is a field in the database use <a href="javascript:alert('you clicked on {name}')">{name}</a> $sizeOfField is the minimum width or the table column for this field 3 ENABLING AJAX This allows the report to refreshes its data, when a link is clicked on the navigation bar, or when sorting on a column, without refreshing the entire page. (Not recommended for pages that requires search engine friendliness) call enableAjax($database_host,$database_user,$database_password,$database_name) the database details is required when data is refreshed 4 SETTING THE LOOK AND FEEL all the following methods are optional enableNavigationalNumbers($variance) call to show page numbers on the navigation that can be used as links $variance is the number of pages shown from the current page in both directions setAjaxLoadingText($text) The text that displays while data is refreshed with ajax getNumberOfResultsSelectorGoLink($text) getNumberOfResultsPerPageSelector($interval,$maximum) these should be used together getNumberOfResultsSelectorGoLink gets a selector for the user to select the number of records he wants per page getNumberOfResultsPerPageSelector gets a link to click to refresh the data according to the above selection $text will be displayed as the link $interval in the selection every <$interval>the number will be displayed eg $interval=10 then 10,20,30 will be the options $maximum the maximum number of records the user can choose from. setLeftImage($loc) Call to set an image to be used as the "previous page" link setRightImage($loc) Call to set an image to be used as the "next page" link setLeftJumpImage($loc) Call to set an image to be used as the "first page" link setRightJumpImage($loc) Call to set an image to be used as the "last page" link setLeftText($text) Call to set text to be used as the "previous page" link setRightText($text) Call to set text to be used as the "next page" link function setLeftJumpText($text) Call to set text to be used as the "first page" link setRightJumpText($text) Call to set text to be used as the "last page" link setSortASCPicture($loc) Call to set an image displayed with a column heading when that column is sorted ascending setSortDESCPicture($loc) Call to set an image displayed with a column heading when that column is sorted descending setTableClassName($name) sets the css-class of the table that contains the data setNavigationTableClassName($name) sets the css-class of the table that contains the navigation links setSortLinkClassName($name) sets the css-class of a link that orders the data on a column setNavigationLinkClass($name) sets the css-class of the navigation links