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

Class: jqGridEdit

Source Location: /jqGrid.php

Class jqGridEdit

Class Overview

Located in /jqGrid.php [line 1903]

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

This class extend the main jqGrid class and is used for CRUD operations. Can work on table. Also the table should have one primary key.

Usage:

1.Suppose the table has a primary key and this key is serial (autoincrement)

$mygrid new jqGridEdit($db); $mygrid->setTable('invoices'); $mygrid->editGrid();

In this case the parameter names - i.e names with : should correspond to the names in colModel in jqGrid definition.


Information Tags:
Version:  4.1.1.0
Copyright:  TriRand Ltd

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From jqGrid

jqGrid::$cacheCount
jqGrid::$customClass
jqGrid::$customFunc
jqGrid::$dataType
jqGrid::$datearray
jqGrid::$dbdateformat
jqGrid::$dbtimeformat
jqGrid::$dbtype
jqGrid::$debug
jqGrid::$encoding
jqGrid::$errorMesage
jqGrid::$ExportCommand
jqGrid::$getLastInsert
jqGrid::$GridParams
jqGrid::$gSQLMaxRows
jqGrid::$I
jqGrid::$jsonencode
jqGrid::$lastId
jqGrid::$logtofile
jqGrid::$mongofields
jqGrid::$mongointegers
jqGrid::$optimizeSearch
jqGrid::$PDF
jqGrid::$pdo
jqGrid::$performcount
jqGrid::$queryLog
jqGrid::$readFromXML
jqGrid::$select
jqGrid::$SelectCommand
jqGrid::$showError
jqGrid::$SubgridCommand
jqGrid::$table
jqGrid::$tmpvar
jqGrid::$userdata
jqGrid::$userdateformat
jqGrid::$usertimeformat
jqGrid::$version
jqGrid::$xmlCDATA

Inherited From jqGrid

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

[ Top ]
Property Summary
boolean   $add   Enables/disables adding of record into the table
boolean   $buildfields   Tell the class if the fields should be get from the query.
booolen   $decodeinput   Decodes the input for update and insert opeartions using the html_entity_decode
boolean   $del   Enables/disables deleting of record into the table
boolean   $edit   Enables/disables updating of record into the table
array   $fields   Field names and data types from the table
string   $mtype   Determines the type of accepting the input data. Can be POST or GET
string   $primaryKey   Holds the primary key for the table
boolean   $serialKey   Defines if the primary key is serial (autoincrement)
string   $successmsg   Stores the message which will be send to client grid in case of succesfull
boolean   $trans   If true every CRUD is enclosed within begin transaction - commit/rollback
array   $_addarray   Stores all the dataa need to perform SQL command after add is succesfull
mixed   $_addarrayb  
array   $_delarray   Stores all the dataa need to perform SQL command after delete is succesfull
mixed   $_delarrayb  
array   $_editarray   Stores all the dataa need to perform SQL command after edit is succesfull
mixed   $_editarrayb  

[ Top ]
Method Summary
boolean   checkPrimary()   Check for primary key and if not set try to obtain it Return true on success
boolean   delete()   Delete the data into the database according the table element
void   editGrid()   Perform the all CRUD operations depending on the oper param send from the grid and the table element If the primaryKey is not set we try to obtain it using jqGridDB::getPrimaryKey If the primary key is not set or can not be obtained the operation is aborted.
array   getFields()   Return the fields generated for CRUD operations
string   getPrimaryKeyId()   Return the primary key of the table
boolean   insert()   Insert the data array into the database according to the table element.
void   setAfterCrudAction()   Run a sql command(s) after the operation from the CRUD is succefull.
void   setBeforeCrudAction()   Run a sql command(s) before the operation from the CRUD.
void   setPrimaryKeyId()   Set a primary key for the table
void   setSuccessMsg()   Set the message which will be send to client side grid when succefull CRUD operation is performed. Usually afterSubmit event should be used in this case.
void   setTable()   Set table for CRUD and build the fields
boolean   update()   Update the data into the database according the table element
true   _actionsCRUDGrid()   Executes the sql command after the crud is succefull
boolen   _buildFields()   Build the fields array with a database fields from the table.

[ Top ]
Properties
boolean   $add = true [line 1954]

Enables/disables adding of record into the table

API Tags:
Access:  public


[ Top ]
boolean   $buildfields = false [line 1944]

Tell the class if the fields should be get from the query.

If set to false the $fields array should be set manually in type $fields = array("dbfield1" => array("type"=>"integer")...);

API Tags:
Access:  protected


[ Top ]
booolen   $decodeinput = false [line 1974]

Decodes the input for update and insert opeartions using the html_entity_decode

API Tags:
Access:  public


[ Top ]
boolean   $del = true [line 1964]

Enables/disables deleting of record into the table

API Tags:
Access:  public


[ Top ]
boolean   $edit = true [line 1959]

Enables/disables updating of record into the table

API Tags:
Access:  public


[ Top ]
array   $fields = array() [line 1909]

Field names and data types from the table

API Tags:
Access:  protected


[ Top ]
string   $mtype = "POST" [line 1969]

Determines the type of accepting the input data. Can be POST or GET

API Tags:
Access:  public


[ Top ]
string   $primaryKey [line 1914]

Holds the primary key for the table

API Tags:
Access:  protected


[ Top ]
boolean   $serialKey = true [line 1936]

Defines if the primary key is serial (autoincrement)

API Tags:
Access:  public


[ Top ]
string   $successmsg = "" [line 1920]

Stores the message which will be send to client grid in case of succesfull

operation

API Tags:
Access:  protected


[ Top ]
boolean   $trans = true [line 1949]

If true every CRUD is enclosed within begin transaction - commit/rollback

API Tags:
Access:  public


[ Top ]
array   $_addarray = array() [line 2049]

Stores all the dataa need to perform SQL command after add is succesfull

API Tags:
Access:  protected


[ Top ]
mixed   $_addarrayb = array() [line 2050]
API Tags:
Access:  protected


[ Top ]
array   $_delarray = array() [line 2061]

Stores all the dataa need to perform SQL command after delete is succesfull

API Tags:
Access:  protected


[ Top ]
mixed   $_delarrayb = array() [line 2062]
API Tags:
Access:  protected


[ Top ]
array   $_editarray = array() [line 2055]

Stores all the dataa need to perform SQL command after edit is succesfull

API Tags:
Access:  protected


[ Top ]
mixed   $_editarrayb = array() [line 2056]
API Tags:
Access:  protected


[ Top ]
Methods
checkPrimary  [line 2596]

  boolean checkPrimary( )

Check for primary key and if not set try to obtain it Return true on success


API Tags:
Access:  protected


[ Top ]
delete  [line 2482]

  boolean delete( $data, [ $where = ''], [ $params = null]  )

Delete the data into the database according the table element

A primaryKey should be set. If the key is not set It can be obtained from jqGridDB::getPrimaryKey Return true on success, false when the operation is not succefull

Parameters:
array   $data:  associative array which key values correspond to the names in the delete command
   $where: 
array   $params: 

API Tags:
Access:  public

Information Tags:
Todo:  possibility to set additional where clause

[ Top ]
editGrid  [line 2631]

  void editGrid( [ $summary = null], [ $params = null], [string $oper = false], [ $echo = true]  )

Perform the all CRUD operations depending on the oper param send from the grid and the table element If the primaryKey is not set we try to obtain it using jqGridDB::getPrimaryKey If the primary key is not set or can not be obtained the operation is aborted.

Also the method call the queryGrid to perform the grid ouput

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:  additional parameters that can be passed to the query
string   $oper:  if set the requested oper operation is performed without to check the parameter sended from the grid.
   $echo: 

API Tags:
Access:  public


[ Top ]
getFields  [line 2192]

  array getFields( )

Return the fields generated for CRUD operations


API Tags:
Access:  public


[ Top ]
getPrimaryKeyId  [line 1979]

  string getPrimaryKeyId( )

Return the primary key of the table


API Tags:
Access:  public


[ Top ]
insert  [line 2207]

  boolean insert( array $data  )

Insert the data array into the database according to the table element.

A primaryKey should be set. If the key is not set It can be obtained from jqGridDB::getPrimaryKey Return true on succes, false otherwiese.

Parameters:
array   $data:  associative array which key values correspond to the names in the table.

API Tags:
Access:  public

Information Tags:
Todo:  in the future we should return the last insert id from the table

[ Top ]
setAfterCrudAction  [line 2172]

  void setAfterCrudAction( string $oper, string $sql, [array $params = null]  )

Run a sql command(s) after the operation from the CRUD is succefull.

Can run a unlimited

Parameters:
string   $oper:  - the operation after which the command should be run
string   $sql:  - the sql command
array   $params: 
  • parameters passed to the sql query.

API Tags:
Access:  public


[ Top ]
setBeforeCrudAction  [line 2148]

  void setBeforeCrudAction( string $oper, string $sql, [array $params = null]  )

Run a sql command(s) before the operation from the CRUD.

Can run a unlimited

Parameters:
string   $oper:  - the operation after which the command should be run
string   $sql:  - the sql command
array   $params: 
  • parameters passed to the sql query.

API Tags:
Access:  public


[ Top ]
setPrimaryKeyId  [line 1987]

  void setPrimaryKeyId( string $keyid  )

Set a primary key for the table

Parameters:
string   $keyid: 

API Tags:
Access:  public


[ Top ]
setSuccessMsg  [line 1926]

  void setSuccessMsg( string $msg  )

Set the message which will be send to client side grid when succefull CRUD operation is performed. Usually afterSubmit event should be used in this case.

Parameters:
string   $msg: 

API Tags:
Access:  public


[ Top ]
setTable  [line 1996]

  void setTable( string $_newtable  )

Set table for CRUD and build the fields

Parameters:
string   $_newtable: 

API Tags:
Access:  public


[ Top ]
update  [line 2351]

  boolean update( array $data  )

Update the data into the database according the table element

A primaryKey should be set. If the key is not set It can be obtained from jqGridDB::getPrimaryKey Return true on success, false when the operation is not succefull

Parameters:
array   $data:  associative array which key values correspond to the names in the table

API Tags:
Access:  public

Information Tags:
Todo:  possibility to set additional where clause

[ Top ]
_actionsCRUDGrid  [line 2068]

  true _actionsCRUDGrid( string $oper, $event  )

Executes the sql command after the crud is succefull

Parameters:
string   $oper:  can be add,edit,del
   $event: 

API Tags:
Return:  if ooperation is succefull.
Access:  protected


[ Top ]
_buildFields  [line 2006]

  boolen _buildFields( )

Build the fields array with a database fields from the table.

Also we get the fields types Return false if the fields can not be build.


API Tags:
Access:  protected


[ Top ]

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