/** * * @param type $queryRaw * @return null */ public function getJson($queryRaw) { $rows = $this->webPage->getRequestValue('rows'); if ($rows) { header("Content-type: application/json"); if ($rows[strlen($rows) - 1] == ',') { $rows = substr($rows, 0, -1); } if ($this->order) { $order = ' ORDER BY ' . $this->order; } else { $order = ''; } $transactions = $this->handledObejct->myDbLink->queryToArray($queryRaw . ' WHERE `' . $this->handledObejct->myKeyColumn . '` IN(' . $rows . ')' . $order, $this->handledObejct->getmyKeyColumn()); $total = count(explode(',', $rows)); } else { $total = $this->getTotal($queryRaw . $this->getWhere()); $transactions = $this->getListing($queryRaw, 'html'); } $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; $jsonData = array('page' => $page, 'total' => $total, 'rows' => array()); if (count($transactions)) { foreach ($transactions as $row) { $entry = array('id' => current($row), 'cell' => $row); $jsonData['rows'][] = $entry; } } return json_encode($jsonData); }