/** * this is for the omnigrid table management * * @access public * @return boolean True on success */ function getPageList() { if ($page = eRequest::getVar("page", 0)) { $page = true; $page = intval(eRequest::getVar("page")); $perpage = intval(eRequest::getVar("perpage")); $n = ($page - 1) * $perpage; } //setting pagination query $limit = ""; if ($page) { $limit = " LIMIT {$n}, {$perpage}"; } // this variables Omnigrid will send only if serverSort option is true $sorton = eRequest::getVar("sorton", false); $sortby = eRequest::getVar("sortby"); //setting pagination query $where = ""; if ($sorton) { $where = " ORDER BY {$sorton} {$sortby} "; } //set the query $query = "SELECT * FROM " . $this->_tbl . $where . $limit; //set and run the query $this->_db->setQuery($query); $this->_db->query(); $results = $this->_db->loadAssocList(); //set the query $query = "SELECT * FROM " . $this->_tbl; //set and run the query $this->_db->setQuery($query); $this->_db->query(); $total = $this->_db->getNumRows(); // return the json results $return = array("page" => $page, "total" => $total, "data" => $results); echo json_encode($return); return; }