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

Class: jqGridEdit

Source Location: /jqGrid.php

Class jqGridEdit

Class Overview

Located in /jqGrid.php [line 1165]

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:  3.8.0.1
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::$ExportCommand
jqGrid::$GridParams
jqGrid::$gSQLMaxRows
jqGrid::$I
jqGrid::$jsonencode
jqGrid::$logtofile
jqGrid::$optimizeSearch
jqGrid::$pdo
jqGrid::$queryLog
jqGrid::$readFromXML
jqGrid::$select
jqGrid::$SelectCommand
jqGrid::$SubgridCommand
jqGrid::$table
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::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::exportToExcel()
Export the recordset to excel xml 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::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::selectLimit()
Will select, getting rows from $offset (1-based), for $nrows.
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::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::_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)
boolean   $trans   If true every CRUD is enclosed within begin transaction - commit/rollback

[ Top ]
Method Summary
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   setPrimaryKeyId()   Set a primary key for the table
void   setTable()   Set table for CRUD and build the fields
boolean   update()   Update the data into the database according the table element
boolen   _buildFields()   Build the fields array with a database fields from the table.

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

Enables/disables adding of record into the table

API Tags:
Access:  public


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

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 1219]

Decodes the input for update and insert opeartions using the html_entity_decode

API Tags:
Access:  public


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

Enables/disables deleting of record into the table

API Tags:
Access:  public


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

Enables/disables updating of record into the table

API Tags:
Access:  public


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

Field names and data types from the table

API Tags:
Access:  protected


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

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

API Tags:
Access:  public


[ Top ]
string   $primaryKey [line 1176]

Holds the primary key for the table

API Tags:
Access:  protected


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

Defines if the primary key is serial (autoincrement)

API Tags:
Access:  public


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

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

API Tags:
Access:  public


[ Top ]
Methods
delete  [line 1476]

  boolean delete( $data  )

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

API Tags:
Access:  public

Information Tags:
Todo:  possibility to set additional where clause

[ Top ]
editGrid  [line 1546]

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

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.

API Tags:
Access:  public


[ Top ]
getFields  [line 1281]

  array getFields( )

Return the fields generated for CRUD operations


API Tags:
Access:  public


[ Top ]
getPrimaryKeyId  [line 1224]

  string getPrimaryKeyId( )

Return the primary key of the table


API Tags:
Access:  public


[ Top ]
insert  [line 1296]

  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 ]
setPrimaryKeyId  [line 1232]

  void setPrimaryKeyId( string $keyid  )

Set a primary key for the table

Parameters:
string   $keyid: 

API Tags:
Access:  public


[ Top ]
setTable  [line 1241]

  void setTable( string $_newtable  )

Set table for CRUD and build the fields

Parameters:
string   $_newtable: 

API Tags:
Access:  public


[ Top ]
update  [line 1385]

  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 ]
_buildFields  [line 1251]

  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 Thu, 16 Sep 2010 11:18:56 +0300 by phpDocumentor 1.4.3