/** * the getList method is used to * pupolate the listing table */ public function getList($id = "", $pg) { $purl = array(); if (isset($_GET['url'])) { $purl = $_GET['url']; $purl = rtrim($purl); $purl = explode('/', $_GET['url']); } else { $purl = null; } if (!isset($purl['2'])) { $pn = 1; } else { $pn = $purl['2']; } global $database; $resultEmployee = $database->db_query("SELECT * FROM subarea"); $pagin = new Pagination(); //create the pagination object; $pagin->nr = $database->dbNumRows($resultEmployee); $pagin->itemsPerPage = 20; $myitems = Subarea::find_by_sql("SELECT * FROM subarea ORDER BY id DESC " . $pagin->pgLimit($pn)); $index_array = array("regions" => $myitems, "mypagin" => $pagin->render($pg)); return $index_array; }
/** * use with jquery to porpulate the region * listitem in form */ public function lga($area_id) { if (!empty($area_id)) { return Subarea::find_by_sql("SELECT * FROM subarea WHERE area_id=" . $area_id); } }