protected function search() { if ($this->input['first_name']) { throw new jqGrid_Exception('You cannot use filter for field "first_name"'); } parent::search(); }
protected function addRow($orig_row, $parent = 0, $level = 0) { #Set new condition for query builder $this->where = array('object.parent_id=' . intval($orig_row['id'])); $this->where[] = 'object.type_id = type.id'; if (isset($_GET['place']) && is_numeric($_GET['place'])) { $this->where[] = 'place.id = ' . $_GET['place']; } if (isset($_GET['group']) && is_numeric($_GET['group'])) { $this->where[] = 'group.id = ' . $_GET['group']; $this->where[] = 'place.id = group.place_id'; } #Get children of current node $query = $this->buildQueryRows($this->query); $result = $this->DB->query($query); #Add current node $orig_row['level'] = $level; $orig_row['parent'] = $parent ? $parent : null; $orig_row['isLeaf'] = $this->DB->rowCount($result) ? false : true; $orig_row['expanded'] = $this->input('expanded') ? true : false; $orig_row['expanded'] = $level >= 2 ? false : true; $orig_row['loaded'] = true; parent::addRow($orig_row); #Add children nodes recursively while ($r = $this->DB->fetch($result)) { $this->addRow($r, $orig_row['id'], $level + 1); } }
protected function initColumn($k, $c) { $c = parent::initColumn($k, $c); $classes = 'cell-align-' . $c['align']; $c['classes'] .= ($c['classes'] ? ' ' : '') . $classes; return $c; }
protected function renderComplete($data) { if (!isset($data['foo_bar'])) { throw new jqGrid_Exception_Render('Not enough data to render grid'); } parent::renderComplete($data); }
protected function buildOrderBy($sidx, $sord) { #Special sorting for column 'discount' if ($sidx == 'discount') { return "\r\n\t\t\t\tORDER BY\r\n\t\t\t\t\t(CASE WHEN discount = 0.1 THEN 0 ELSE 1 END) {$sord},\r\n\t\t\t\t\t{$sidx} {$sord},\r\n\t\t\t\t\tfirst_name {$sord},\r\n\t\t\t\t\tlast_name {$sord}\r\n\t\t\t"; } return parent::buildOrderBy($sidx, $sord); }
protected function searchOpBook($c, $val) { #If numeric input -> search by book id if (is_numeric($val)) { return "b.id='{$val}'"; } else { return parent::searchOpLike($c, $val); } }
protected function buildQueryRows($q) { $query = parent::buildQueryRows($q); if ($this->limit > -1) { $offset_min = max($this->page * $this->limit - $this->limit, 0) + 1; $offset_max = $offset_min + $this->limit; $query = "\n\t\t\t\tSELECT *\n\t\t\t\tFROM ({$query}) a\n\t\t\t\tWHERE _rownum BETWEEN {$offset_min} AND {$offset_max}\n\t\t\t"; } return $query; }
/** * редактирование объекта */ protected function opEdit($id, $upd) { // редактирование коммуникаций if (isset($upd['concertmasters'])) { $this->editConcertmasters($id, $upd['concertmasters']); unset($upd['concertmasters']); } $response = parent::opEdit($id, $upd); //cache::drop($id); // after oper $response['cache_dropped'] = 1; // modify original response return $response; }
protected function addRow($orig_row, $parent = 0, $level = 0) { #Set new condition for query builder $this->where = array('t.parent_id=' . intval($orig_row['id'])); #Get children of current node $query = $this->buildQueryRows($this->query); $result = $this->DB->query($query); #Add current node $orig_row['level'] = $level; $orig_row['parent'] = $parent ? $parent : null; $orig_row['isLeaf'] = $this->DB->rowCount($result) ? false : true; $orig_row['expanded'] = $this->input('expanded') ? true : false; $orig_row['loaded'] = true; parent::addRow($orig_row); #Add children nodes recursively while ($r = $this->DB->fetch($result)) { $this->addRow($r, $orig_row['id'], $level + 1); } }
<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH . "php/jqGrid.php"; // include the driver class require_once ABSPATH . "php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Get the needed parameters passed from the main grid $rowid = jqGridUtils::GetParam("id"); if (!$rowid) { die("Missed parameters"); } // Create the base jqGrid instance $grid = new jqGrid($conn); // Write the SQL Query $grid->SubgridCommand = "SELECT OrderID, RequiredDate, ShipName, ShipCity, Freight FROM orders WHERE CustomerID=? ORDER BY OrderID desc"; // set the ouput format to json $grid->dataType = 'json'; // Use the build in function for the simple subgrid $grid->querySubGrid(array(&$rowid)); $conn = null;
/** * Операция удаления * @param array $ins * @return boolean */ protected function opDel($id) { $this->eventDelete($id); parent::opDel($id); }
/** * Операция удаления * @param array $ins * @return boolean */ protected function opDel($id) { parent::opDel($id); }
<?php require_once "../../sample/jq-config.php"; // include the jqGrid Class require_once "../../sample/php/jqGrid.php"; // include the PDO driver class //require_once "php/jqGridPdo.php"; require_once "../../sample/php/jqGridSqlsrv.php"; // Connection to the server //$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); $connectionInfo = array("UID" => DB_USER, "PWD" => DB_PASSWORD, "Database" => DB, "ReturnDatesAsStrings" => true); $conn = sqlsrv_connect(DB_DSN, $connectionInfo); // Create the jqGrid instance $grid = new jqGrid($conn); // Write the SQL Query //$grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders'; $grid->SelectCommand = 'SELECT * FROM utilities'; $grid->dataType = "json"; $grid->queryGrid();
protected function opEdit($id, $upd) { $upd['version'] = new jqGrid_Data_Raw('version + 1'); return parent::opEdit($id, $upd); }