A lot of people is asking me about how to use this class
For you all folks, here it is:
First you need to include two files in yhe page you want the datarid to be shown:
1.- estilo.css
2.- classDatagrid.php
1.- This is the Css file which will handle the makeup of the dataGrid, colors, fonts, backgrounds.
2.- This is the class file
Now we have to create an object like this
$oDataGrid= new classDatagrid;
At this point an object classDatagrid has been created with the following methods:
-set_query($pSQLquery,$pPrimaryKey)
-set_title($ptitle)
-show_checkbox($pShow)
-set_tool($pType,$pShow,$pLink)
-set_col_name($dbField,$colName)
-set_col_type($dbField,$colType,$p1="",$p2="")
-set_page_size($pPageSize)
-build_pager()
-display()
METHOD: set_query()
PARAMS: $pSQLquery This is the query
$pPrimaryKey This is the primary key of the used table
OUTPUT: nothing, this method only defines the query
METHOD: set_title()
PARAMS: $ptitle This is the title of the table
OUTPUT: nothing, this method only defines the title
METHOD: show_checkbox
PARAMS: $pShow If this is 1, a checkbox will apperar next every record of the table
OUTPUT: nothing, this method only defines the configuration
METHOD: set_tool() Everytime you call this method, a tool is added to the tool column
PARAMS: $pType This can be TXT or nothing. If TXT,the text in $pShow will be shown. If nothing, the image in $pShow will be shown
$pShow This is the text or the image path you want to show
$pLink This is the page that will process the action
OUTPUT:nothing, this method only defines the configuration of tools
METHOD: set_col_name()
PARAMS: $dbField This is the name of the field as shown in the database
$colName This is the text you want to show as column header instead of $dbfield
OUTPUT: nothing, this method only defines the configuration
METHOD: set_col_type() changes the mode a field is displayed
PARAMS: $dbField This is the field name as shown in the database
$colType IMG if $dbfield has an image path and you want to show and image instead if the image path.
LNK if $dbfield is a link, it shows the text in $dbfield as a link. The href of this link is define in $p1 and the text shown is $p2
DATE if $dbfield is a datetime field and you want to display in a special format. This format is set in the $p1
$p1="" Its use depends on the $colType
$p2="" Its use depends on the $colType
OUTPUT: nothing, this method only defines the configuration
METHOD: set_page_size()
PARAMS: $pPageSize This is the number of records displayed in a page
OUTPUT: nothing, this method only defines the configuration
METHOD: display()
PARAMS: none
OUTPUT: this returns the datagrid.
METHOD: -build_pager()
PARAMS:
OUTPUT: nothing, this method only defines the configuration
|