/**
  * 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 product2");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Product::find_by_sql("SELECT * FROM product2 ORDER BY prod_id DESC " . $pagin->pgLimit($pn));
     $index_array = array("products" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
 }
 /**
  * this section is used to get auto complete
  * feature for the product 
  * textbox
  */
 public function prodID_AutoComplete($id = "")
 {
     return Product::find_by_sql("SELECT * FROM product WHERE prod_name LIKE '%" . $_POST['input'] . "%'");
 }
Example #3
0
// Find all photos
// use pagination instead
//$photos = Photograph::find_all();
$pagination = new Pagination($page, $per_page, $total_count);
// Instead of finding all records, just find the records
// for this page
if (isset($_GET['category'])) {
    $sql = "SELECT * FROM products WHERE cat_id = " . $_GET['category'];
    $sql .= " LIMIT {$per_page} ";
    $sql .= "OFFSET {$pagination->offset()}";
    $products = Product::find_by_sql($sql);
} else {
    $sql = "SELECT * FROM products ";
    $sql .= "LIMIT {$per_page} ";
    $sql .= "OFFSET {$pagination->offset()}";
    $products = Product::find_by_sql($sql);
}
// Need to add ?page=$page to all links we want to
// maintain the current page (or store $page in $session)
?>
<div id="content">
    <section class="sidebar"> 
      <!-- This adds a sidebar with 1 searchbox,2 menusets, each with 4 links -->
      <input type="text"  id="search" placeholder="Search" onkeyup="search(this.value)" >
      <div id="txtHint"></div>
      <div id="menubar">
        <nav class="menu">
          <h2><!-- Title for menuset 1 -->Category </h2>
          <hr>
          <ul>
            <!-- List of links under menuset 1 -->