phpDocumentor jqGrid
[ class tree: jqGrid ] [ index: jqGrid ] [ all elements ]

Class: jqGrid

Source Location: /jqGrid.php

Class jqGrid

Class Overview

Located in /jqGrid.php [line 46]



		
				Author(s):
		
  • Tony Tomov, (tony@trirand.com)
API Tags:
Abstract:  

A PHP class to work with jqGrid jQuery plugin. The main purpose of this class is to provide the data from database to jqGrid, simple subgrid and export to excel. Also can be used for search provided from toolbarFilter and searchGrid methods

How to use

Using table

require_once 'jqGridPdo.php'; $dsn = "mysql:host=localhost;dbname=griddemo"; $db = new PDO($dsn, 'username', 'password');

$mygrid = new jqGrid($db); $mygrid->table = "invoices"; $mygrid->queryGrid();

Using custom SQL

$mygrid = new jqGrid($db); $mygrid->SelectCommand ="SELECT * FROM invoices"; $mygrid->queryGrid();

Using xml file where the sql commands are stored

$mygrid = new jqGrid($db); $mygrid->readFromXML = true $mygrid->SelectCommand ="xmlfile.getInvoiceTable"; $mygrid->queryGrid();

Using summary fields. Note that in this case in jqGrid footerrow and userDataOnFooter should be set

$mygrid = new jqGrid($db); $mygrid->table = "invoices"; $mygrid->queryGrid(array("amount"=>"amount");


Information Tags:
Version:  4.1.1.0
Copyright:  TriRand Ltd

Properties

Methods

[ Top ]
Descendants
Child Class Description
jqGridEdit

[ Top ]
Property Summary
static mixed   $queryLog  
boolean   $cacheCount  
mixed   $customClass   Custom call can be used again with custom function customFunc. We can call
function   $customFunc   Custom function which can be called to modify the grid output. Parameters
string   $dataType   The output format for the grid. Can be json or xml
array   $datearray   Store the names which are dates. The name should correspond of the name
string   $dbdateformat   Date format accepted in the database. See getDbDate
string   $dbtimeformat   Datetime format accepted in the database. See getDbTime
string   $dbtype   This is detected automatically from the passed connection. Used to
boolean   $debug   Enable disable debuging
string   $encoding   Default enconding passed to the browser
string   $errorMesage   Last error message from the server
string   $ExportCommand   Set the sql command for excel export. If not set a _setSQL
bolean   $getLastInsert   Allow a obtaining and sending the last id (in case of serial key) to the client.
array   $GridParams   Holds the parameters that are send from the grid to the connector.
integer   $gSQLMaxRows   Maximum number of rows to be exported for the excel export
string   $I   Used to perform case insensitive search in PostgreSQL. The variable is
boolean   $jsonencode   If set to true uses the PHP json_encode if available. If this is set to
mixed.   $lastId   Stores the last inserted id in case when getLastInsert is true
boolean   $logtofile   Determines if the log should be written to file or echoed.
array   $mongofields   Array which set which fields should be selected in case of mongodb.
array   $mongointegers   Store the names for the int fields when database is MongoDB. Used to perform
boolean   $optimizeSearch   Optimizes the search SQL when used in MySQL with big data sets.
array   $PDF   Holds the default settings for excel export
resourse   $pdo   Stores the connection passed to the constructor
boolean   $performcount   Internal set in queryGrid if we should use count query in order to set
boolean   $readFromXML   Obtain the SQL qurery from XML file.
string   $select   Holds the modified select command used into grid
string   $SelectCommand   In case if no table is set, this holds the sql command for
boolean   $showError   If set to true all errors from the server are shown in the client in a dialog. Curretly work only for grid and form edit.
string   $SubgridCommand   Set a sql command used for the simple subgrid
string   $table   set a table to display a data to the grid
mixed   $tmpvar   Temporary variable for internal use
   $userdata   Used to store the additional userdata which will be transported
string   $userdateformat   The date format used by the user when a search is performed and CRUD operation
string   $usertimeformat   The datetime format used by the user when a search is performed and CRUD operation
string   $version   Get te current version
boolean   $xmlCDATA   Defines if the xml otput should be enclosed in CDATA when xml output is enabled

[ Top ]
Method Summary
jqGrid   __construct()   Constructor
void   addUserData()   Add a custom data to the grid footer row if it is enabled.
mixed   buildSearch()   Build a search string from filter string posted from the grid
void   debugout()   Prints all executed SQL queries to file or console
boolean   execute()   Executes a prepared sql statement. Also if limit is set to true is used
string   exportToCsv()   Public method to export a grid data to csv data.
string   exportToExcel()   Export the recordset to excel xml file.
void   exportToPdf()   Export the recordset to pdf file.
string   getDbDate()   Return the current date format used in the undelayed database
string   getDbTime()   Return the current datetime format used in the undelayed database
array   getGridParams()   Return the associative array which contain the parameters that are sended from the grid to request, search, update delete data.
mixed   getSqlElement()   Read a xml file and the SelectCommand and return the sql string Return string if the query is found false if not.
array   getStringForGroup()   Recursivley build the sql query from a json object
string   getUserDate()   Return the current date format used from the client
string   getUserTime()   Return the current datetime format used from the client
void   logQuery()   Log query
string   parseSql()   Prepares a $sqlElement and binds a parameters $params
object   queryForObject()   Return the object from the query
mixed   queryGrid()   Return the result of the query to jqGrid. Support searching
void   querySubGrid()   Return the result of the query for the simple subgrid
string   rs2excel()   From a given recordset returns excel xml file. If the summary array is defined add summary formula at last row.
null   rs2pdf()   Convert a recordeset to pdf object
object   selectLimit()   Will select, getting rows from $offset (1-based), for $nrows.
void   sendErrorHeader()   Function to simulate 500 Internal error so that it sends the error to the client. It is activated only if $showError is true.
void   setDbDate()   Set a new database date format using PHP convensions
void   setDbTime()   Set a new database datetime format using PHP convensions
void   setGridParams()   Set a grid parameters to identify the action from the grid Note that these should be set in the grid - i.e the parameters from the grid should equal to the GridParams.
void   setPdfOptions()   Set options for PDF export.
void   setUserDate()   Set a new user date format using PHP convensions
void   setUserTime()   Set a new user datetime format using PHP convensions
array   _buildSearch()   Builds the search where clause when the user perform a search Return arrray the first element is a strinng with the where clause, the second element is array containing the value parameters passed to the sql.
object   _getcount()   Returns object which holds the total records in the query and optionally
void   _gridResponse()   Check in which format data should be returned to the grid based on dataType property
recordset   _rs()   Convert the query to record set and set the summary data if available
mixed   _setSQL()   Bulid the sql based on $readFromXML, $SelectCommand and $table variables

[ Top ]
Properties
static mixed   $queryLog = array() [line 112]
API Tags:
Access:  protected


[ Top ]
boolean   $cacheCount = false [line 356]
API Tags:
Access:  public


[ Top ]
mixed   $customClass = false [line 340]

Custom call can be used again with custom function customFunc. We can call

this using static defined functions in class customClass::customFunc - i.e $grid->customClass = Custom, $grid->customFunc = myfunc or $grid->customClass = new Custom(), $grid->customFunc = myfunc

API Tags:
Access:  public


[ Top ]
function   $customFunc = null [line 332]

Custom function which can be called to modify the grid output. Parameters

passed to this function are the response object and the db connection

API Tags:
Access:  public


[ Top ]
string   $dataType = "xml" [line 234]

The output format for the grid. Can be json or xml

API Tags:
Access:  public


[ Top ]
array   $datearray = array() [line 253]

Store the names which are dates. The name should correspond of the name

in colModel. Used to perform the conversion from userdate and dbdate

API Tags:
Access:  public


[ Top ]
string   $dbdateformat = 'Y-m-d' [line 85]

Date format accepted in the database. See getDbDate

and setDbDate and datearray. Also this format is used to automatically convert the date for CRUD and search operations

API Tags:
Access:  protected


[ Top ]
string   $dbtimeformat = 'Y-m-d H:i:s' [line 93]

Datetime format accepted in the database. See getDbTime

and setDbTime and datearray. Also this format is used to automatically convert the date for CRUD and search operations

API Tags:
Access:  protected


[ Top ]
string   $dbtype [line 71]

This is detected automatically from the passed connection. Used to

construct the appropriate pagging for the database and in case of PostgreSQL to set case insensitive search

API Tags:
Access:  protected


[ Top ]
boolean   $debug = false [line 142]

Enable disable debuging

API Tags:
Access:  public


[ Top ]
string   $encoding = "utf-8" [line 239]

Default enconding passed to the browser

API Tags:
Access:  public


[ Top ]
string   $errorMesage = '' [line 182]

Last error message from the server

API Tags:
Access:  public


[ Top ]
string   $ExportCommand = "" [line 280]

Set the sql command for excel export. If not set a _setSQL

function is used to set a sql for export

API Tags:
See:  jqGrid::_setSQL()
Access:  public


[ Top ]
bolean   $getLastInsert = false [line 196]

Allow a obtaining and sending the last id (in case of serial key) to the client.

API Tags:
Access:  protected


[ Top ]
array   $GridParams = array(
"page" => "page",
"rows" => "rows",
"sort" => "sidx",
"order" => "sord",
"search" => "_search",
"nd" => "nd",
"id" => "id",
"filter" => "filters",
"searchField" => "searchField",
"searchOper" => "searchOper",
"searchString" => "searchString",
"oper" => "oper",
"query" => "grid",
"addoper" => "add",
"editoper" => "edit",
"deloper" => "del",
"excel" => "excel",
"subgrid"=>"subgrid",
"totalrows" => "totalrows",
"autocomplete"=>"autocmpl"
)
[line 208]

Holds the parameters that are send from the grid to the connector.

Correspond to the prmNames in jqGrid Java Script lib

API Tags:
Access:  protected

Information Tags:
Todo:  these parameters should be changed according to the jqGrid js

[ Top ]
integer   $gSQLMaxRows = 1000 [line 285]

Maximum number of rows to be exported for the excel export

API Tags:
Access:  public


[ Top ]
string   $I = '' [line 64]

Used to perform case insensitive search in PostgreSQL. The variable is

detected automatically depending on the griver from jqGrid{driver}.php

API Tags:
Access:  protected


[ Top ]
boolean   $jsonencode = true [line 247]

If set to true uses the PHP json_encode if available. If this is set to

false a custom encode function in jqGrid is used. Also use this to false if the encoding of your database is not utf-8

API Tags:
Deprecated:  this not needed anymore also the related option is $encoding
Access:  public


[ Top ]
mixed.   $lastId = null [line 201]

Stores the last inserted id in case when getLastInsert is true

API Tags:
Access:  protected


[ Top ]
boolean   $logtofile = true [line 148]

Determines if the log should be written to file or echoed.

Ih set to created is a file jqGrid.log in the directory where the script is

API Tags:
Access:  public


[ Top ]
array   $mongofields = array() [line 266]

Array which set which fields should be selected in case of mongodb.

If the array is empty all fields will be selected from the collection.

API Tags:
Access:  public


[ Top ]
array   $mongointegers = array() [line 260]

Store the names for the int fields when database is MongoDB. Used to perform

right serach in MongoDB. The array should contain the right names as listed into the collection

API Tags:
Access:  public


[ Top ]
boolean   $optimizeSearch = false [line 351]

Optimizes the search SQL when used in MySQL with big data sets.

Use this option carefully on complex SQL

API Tags:
Access:  public


[ Top ]
array   $PDF = array(
"page_orientation" => "P",
"unit"=>"mm",
"page_format"=>"A4",
"creator"=>"jqGrid",
"author"=>"jqGrid",
"title"=>"jqGrid PDF",
"subject"=>"Subject",
"keywords"=>"table, grid",
"margin_left"=>15,
"margin_top"=>7,
"margin_right"=>15,
"margin_bottom"=>25,
"margin_header"=>5,
"margin_footer"=>10,
"font_name_main"=>"helvetica",
"font_size_main"=>10,
"header_logo"=>"",
"header_logo_width"=>0,
"header_title"=>"",
"header_string"=>"",
"header"=>false,
"footer"=>true,
"font_monospaced"=>"courier",
"font_name_data"=>"helvetica",
"font_size_data"=>8,
"margin_footer"=>10,
"image_scale_ratio"=>1.25,
"grid_head_color"=>"#dfeffc",
"grid_head_text_color"=>"#2e6e9e",
"grid_draw_color"=>"#5c9ccc",
"grid_header_height"=>6,
"grid_row_color"=>"#ffffff",
"grid_row_text_color"=>"#000000",
"grid_row_height"=>5,
"grid_alternate_rows"=>false,
"path_to_pdf_class"=>"tcpdf/tcpdf.php"
)
[line 1101]

Holds the default settings for excel export

API Tags:
Access:  protected


[ Top ]
resourse   $pdo [line 58]

Stores the connection passed to the constructor

API Tags:
Access:  protected


[ Top ]
boolean   $performcount = true [line 362]

Internal set in queryGrid if we should use count query in order to set

the grid output

API Tags:
Access:  public


[ Top ]
boolean   $readFromXML = false [line 320]

Obtain the SQL qurery from XML file.

In this case the SelectCommand should be set as xmlfile.sqlid. The xmlfile is the name of xml file where we store the sql commands, sqlid is the id of the required sql. The simple xml file can look like this < ?xml version="1.0" encoding="UTF-8"?> <queries> <sql Id="getUserById"> Select * From users Where Id = ? </sql> <sql Id="validateUser"> Select Count(Id) From users Where Email = ? AND Password = ? </sql> </queries> Important note: The class first look for readFromXML, then for selectCommand and last for a table.

API Tags:
Access:  public


[ Top ]
string   $select = "" [line 77]

Holds the modified select command used into grid

API Tags:
Access:  protected


[ Top ]
string   $SelectCommand = "" [line 272]

In case if no table is set, this holds the sql command for

retrieving the data from the db to the grid

API Tags:
Access:  public


[ Top ]
boolean   $showError = false [line 177]

If set to true all errors from the server are shown in the client in a dialog. Curretly work only for grid and form edit.

API Tags:
Access:  public


[ Top ]
string   $SubgridCommand = "" [line 290]

Set a sql command used for the simple subgrid

API Tags:
Access:  public


[ Top ]
string   $table = "" [line 295]

set a table to display a data to the grid

API Tags:
Access:  public


[ Top ]
mixed   $tmpvar = false [line 118]

Temporary variable for internal use

API Tags:
Access:  protected


[ Top ]
   $userdata = null [line 326]

Used to store the additional userdata which will be transported

to the grid when the request is made. Used in addRowData method

API Tags:
Access:  protected


[ Top ]
string   $userdateformat = 'd/m/Y' [line 100]

The date format used by the user when a search is performed and CRUD operation

See setUserDate and getUserDate. Also this format is used to automatically convert the date passed from grid to database. Used in CRUD operations and search

API Tags:
Access:  protected


[ Top ]
string   $usertimeformat = 'd/m/Y H:i:s' [line 108]

The datetime format used by the user when a search is performed and CRUD operation

See setUserTime and getUserTime. Also this format is used to automatically convert the datetime passed from grid to database. Used in CRUD operations and search

API Tags:
Access:  protected


[ Top ]
string   $version = '4.1.1.0' [line 52]

Get te current version

API Tags:
Access:  public


[ Top ]
boolean   $xmlCDATA = false [line 345]

Defines if the xml otput should be enclosed in CDATA when xml output is enabled

API Tags:
Access:  public


[ Top ]
Methods
Constructor __construct  [line 368]

  jqGrid __construct( [resource $db = null]  )

Constructor

Parameters:
resource   $db:  - $db the database connection passed to the constructor


[ Top ]
addUserData  [line 1878]

  void addUserData( array $adata  )

Add a custom data to the grid footer row if it is enabled.

Also can be used to transport additional data in userdata array to be used later at client side. The syntax is $grid->addUserData(array("Name1"=>"Data1",...)); The method is executed after the sumarry rows are executed, so it can overwrite some summary data which is palced on the footer.

Parameters:
array   $adata: 

API Tags:
Access:  public


[ Top ]
buildSearch  [line 673]

  mixed buildSearch( string $filter, [string $otype = 'str']  )

Build a search string from filter string posted from the grid

Usually use this functio separatley

Parameters:
string   $filter: 
string   $otype: 

API Tags:
Return:  - string or array depending on $otype param
Access:  public


[ Top ]
debugout  [line 153]

  void debugout( )

Prints all executed SQL queries to file or console


API Tags:
See:  jqGrid::$logtofile
Access:  public


[ Top ]
execute  [line 409]

  boolean execute( string $sqlId, array $params, &$sql, [boolean $limit = false], [integer $nrows = -1], [integer $offset = -1], [ $order = ''], [ $sort = ''], resource $sql  )

Executes a prepared sql statement. Also if limit is set to true is used

to return limited set of records Return true on success

Parameters:
string   $sqlId:  - sql to pe executed
array   $params:  - array of values which are passed as parameters to the sql
resource   $sql:  - pointer to the constructed sql
boolean   $limit:  - if set to true we use a pagging mechanizm
integer   $nrows:  - number of rows to return
integer   $offset:  - the offset from which the nrows should be returned
   &$sql: 
   $order: 
   $sort: 

API Tags:
Access:  protected


[ Top ]
exportToCsv  [line 1596]

  string exportToCsv( [ $summary = null], [ $params = null], [ $colmodel = null], [boolean $echo = true], [string $filename = 'exportdata.csv'], [string $sep = ';'], [string $sepreplace = ' ']  )

Public method to export a grid data to csv data.

Can use the ExportCommand. If this command is not set uses _setSQL to set the query. The number of rows exported is limited from gSQLMaxRows variable

Parameters:
array   $summary:  - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
array   $params:  parameter values passed to the sql array(value)
array   $colmodel:  - different description for the headers
boolean   $echo:  determines if the result should be returned or echoed
string   $filename:  the filename to which the sheet can be saved in case if $echo is true
string   $sep:  - the separator for the csv data
string   $sepreplace:  - with what to replace the separator if in data

API Tags:
See:  jqGrid::_setSQL()
See:  jqGrid::rs2excel()
Access:  public


[ Top ]
exportToExcel  [line 1013]

  string exportToExcel( [ $summary = null], [ $params = null], [ $colmodel = null], [boolean $echo = true], [string $filename = 'exportdata.xml']  )

Export the recordset to excel xml file.

Can use the ExportCommand. If this command is not set uses _setSQL to set the query. The number of rows exported is limited from gSQLMaxRows variable

Parameters:
array   $summary:  - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
array   $params:  parameter values passed to the sql array(value)
array   $colmodel:  - different description for the headers - see rs2excel
boolean   $echo:  determines if the result should be returned or echoed
string   $filename:  the filename to which the sheet can be saved in case if $echo is true

API Tags:
See:  jqGrid::_setSQL()
Access:  public


[ Top ]
exportToPdf  [line 1339]

  void exportToPdf( [ $summary = null], [ $params = null], [ $colmodel = null], [string $filename = 'exportdata.pdf']  )

Export the recordset to pdf file.

Can use the ExportCommand. If this command is not set uses _setSQL to set the query. The number of rows exported is limited from gSQLMaxRows variable

Parameters:
array   $summary:  - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
array   $params:  parameter values passed to the sql array(value)
array   $colmodel:  - different description for the headers - see rs2excel
string   $filename:  the filename to which the sheet can be saved in case if $echo is true

API Tags:
See:  jqGrid::_setSQL()
Access:  public


[ Top ]
getDbDate  [line 751]

  string getDbDate( )

Return the current date format used in the undelayed database


API Tags:
Access:  public


[ Top ]
getDbTime  [line 767]

  string getDbTime( )

Return the current datetime format used in the undelayed database


API Tags:
Access:  public


[ Top ]
getGridParams  [line 785]

  array getGridParams( )

Return the associative array which contain the parameters that are sended from the grid to request, search, update delete data.


API Tags:
Access:  public


[ Top ]
getSqlElement  [line 451]

  mixed getSqlElement( string $sqlId  )

Read a xml file and the SelectCommand and return the sql string Return string if the query is found false if not.

Parameters:
string   $sqlId:  the string of type xmlfile.sqlId

API Tags:
Access:  protected


[ Top ]
getStringForGroup  [line 538]

  array getStringForGroup( object $group, array $prm  )

Recursivley build the sql query from a json object

Parameters:
object   $group:  the object to parse
array   $prm:  parameters array

API Tags:
Return:  - first element is the where clause secon is the array of values to pass
Access:  protected


[ Top ]
getUserDate  [line 719]

  string getUserDate( )

Return the current date format used from the client


API Tags:
Access:  public


[ Top ]
getUserTime  [line 735]

  string getUserTime( )

Return the current datetime format used from the client


API Tags:
Access:  public


[ Top ]
logQuery  [line 126]

  void logQuery( string $sql, [array $data = null], [array $types = null], [ $input = null], [ $fld = null], [ $primary = '']  )

Log query

Parameters:
string   $sql: 
array   $data: 
array   $types: 
   $input: 
   $fld: 
   $primary: 

API Tags:
Access:  public


[ Top ]
parseSql  [line 391]

  string parseSql( string $sqlElement, array $params, [ $bind = true]  )

Prepares a $sqlElement and binds a parameters $params

Return prepared sql statement

Parameters:
string   $sqlElement:  sql to be prepared
array   $params:  - parameters passed to the sql
   $bind: 

API Tags:
Access:  protected


[ Top ]
queryForObject  [line 521]

  object queryForObject( string $sqlId, array $params, [boolean $fetchAll = false]  )

Return the object from the query

Parameters:
string   $sqlId:  the sql to be queried
array   $params:  - parameter values passed to the sql
boolean   $fetchAll:  - if set to true fetch all records

API Tags:
Access:  protected


[ Top ]
queryGrid  [line 842]

  mixed queryGrid( [ $summary = null], [ $params = null], [boolen $echo = true]  )

Return the result of the query to jqGrid. Support searching

Parameters:
array   $summary:  - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
array   $params:  - parameter values passed to the sql
boolen   $echo:  if set to false return the records as object, otherwiese json encoded or xml string depending on the dataType variable

API Tags:
Access:  public


[ Top ]
querySubGrid  [line 1616]

  void querySubGrid( array $params, [boolean $echo = true]  )

Return the result of the query for the simple subgrid

The format depend of dataType variable

Parameters:
array   $params:  parameters passed to the query
boolean   $echo:  if set to false return object containing the data

API Tags:
Access:  public


[ Top ]
rs2excel  [line 1689]

  string rs2excel( pdo $rs, [array $colmodel = false], [boolean $echo = true], [string $filename = 'exportdata.xls'], [array $summary = false]  )

From a given recordset returns excel xml file. If the summary array is defined add summary formula at last row.

Return well formated xml excel string

Parameters:
array   $colmodel:  diffrent descriptions for the headars, width, hidden cols This array is actually a colModel array in jqGrid. The array can look like Array( [0]=>Array("label"=>"Some label", "width"=>100, "hidden"=>true, "name"=>"client_id", "formatter"=>"select", editoptions=>...), [1]=>Array("label"=>"Other label", "width"=>80, "hidden"=>false, "name"=>"date",... ), ... )
boolean   $echo:  determines if the result should be send to browser or returned as string
string   $filename:  filename to which file can be saved
array   $summary:  - set which columns should be sumarized in order to be displayed to the grid By default this parameter uses SQL SUM function: array("colmodelname"=>"sqlname"); It can be set to use the other one this way array("colmodelname"=>array("sqlname"=>"AVG")); By default the first field correspond to the name of colModel the second to the database name
pdo   $rs:  recordset $rs recordset from pdo execute command

API Tags:
Access:  protected


[ Top ]
rs2pdf  [line 1159]

  null rs2pdf( object $rs, pdf &$pdf, [array $colmodel = false], [ $summary = null]  )

Convert a recordeset to pdf object

Parameters:
object   $rs:  the recorde set object from the query
array   $colmodel:  can be either manually created array see rs2excel or genereted from setColModel methd.
pdf   &$pdf:  created object $pdf
   $summary: 

API Tags:
Access:  protected


[ Top ]
selectLimit  [line 816]

  object selectLimit( [string $limsql = ''], [integer $nrows = -1], [integer $offset = -1], [ $params = null], [ $order = ''], [ $sort = '']  )

Will select, getting rows from $offset (1-based), for $nrows.

This simulates the MySQL "select * from table limit $offset,$nrows" , and the PostgreSQL "select * from table limit $nrows offset $offset". Note that MySQL and PostgreSQL parameter ordering is the opposite of the other. eg. Also supports Microsoft SQL Server SelectLimit('select * from table',3); will return rows 1 to 3 (1-based) SelectLimit('select * from table',3,2); will return rows 3 to 5 (1-based) Return object containing the limited record set

Parameters:
string   $limsql:  - optional sql clause
integer   $nrows:  is the number of rows to get
integer   $offset:  is the row to start calculations from (1-based)
array   $params:  array of bind variables
   $order: 
   $sort: 

API Tags:
Access:  public


[ Top ]
sendErrorHeader  [line 187]

  void sendErrorHeader( )

Function to simulate 500 Internal error so that it sends the error to the client. It is activated only if $showError is true.


API Tags:
Access:  public


[ Top ]
setDbDate  [line 759]

  void setDbDate( string $newformat  )

Set a new database date format using PHP convensions

Parameters:
string   $newformat:  - the new database format

API Tags:
Access:  public


[ Top ]
setDbTime  [line 775]

  void setDbTime( string $newformat  )

Set a new database datetime format using PHP convensions

Parameters:
string   $newformat:  - the new database format

API Tags:
Access:  public


[ Top ]
setGridParams  [line 795]

  void setGridParams( array $_aparams  )

Set a grid parameters to identify the action from the grid Note that these should be set in the grid - i.e the parameters from the grid should equal to the GridParams.

Parameters:
array   $_aparams:  set new parameter.

API Tags:
Access:  public


[ Top ]
setPdfOptions  [line 1144]

  void setPdfOptions( array $apdf  )

Set options for PDF export.

Parameters:
array   $apdf: 

API Tags:
Access:  public


[ Top ]
setUserDate  [line 727]

  void setUserDate( string $newformat  )

Set a new user date format using PHP convensions

Parameters:
string   $newformat:  - the new format

API Tags:
Access:  public


[ Top ]
setUserTime  [line 743]

  void setUserTime( string $newformat  )

Set a new user datetime format using PHP convensions

Parameters:
string   $newformat:  - the new format

API Tags:
Access:  public


[ Top ]
_buildSearch  [line 627]

  array _buildSearch( [ $prm = null], [ $str_filter = '']  )

Builds the search where clause when the user perform a search Return arrray the first element is a strinng with the where clause, the second element is array containing the value parameters passed to the sql.

Parameters:
array   $prm:  - parameters passed to the sql
   $str_filter: 

API Tags:
Access:  protected


[ Top ]
_getcount  [line 476]

  object _getcount( string $sql, [ $params = null], [ $sumcols = null]  )

Returns object which holds the total records in the query and optionally

the sum of the records determined in sumcols

Parameters:
string   $sql:  - string to be parsed
array   $params:  - parameters passed to the sql query
array   $sumcols:  - array which holds the sum of the setted rows. The array should be associative where the index corresponds to the names of colModel in the grid, and the value correspond to the actual name in the query

API Tags:
Access:  protected


[ Top ]
_gridResponse  [line 1633]

  void _gridResponse( string $response  )

Check in which format data should be returned to the grid based on dataType property

Add the appropriate headers and echo the result

Parameters:
string   $response:  can be xml or json

API Tags:
Access:  protected


[ Top ]
_rs  [line 1033]

  recordset _rs( [array $params = null], [array $summary = null], [boolean $excel = false]  )

Convert the query to record set and set the summary data if available

Parameters:
array   $params:  parameters to the qurery
array   $summary:  summary option
boolean   $excel:  excel

API Tags:
Return:  object
Access:  protected


[ Top ]
_setSQL  [line 696]

  mixed _setSQL( )

Bulid the sql based on $readFromXML, $SelectCommand and $table variables

The logic is: first we look if readFromXML is set to true, then we look for SelectCommand and at end if none of these we use the table varable Return string or false if the sql found


API Tags:
Access:  protected


[ Top ]

Documentation generated on Wed, 22 Jun 2011 14:57:48 +0300 by phpDocumentor 1.4.3