Example #1
0
<?php

require_once $libpath = substr(str_replace('\\', '/', __DIR__), 0, -29) . 'library/initialize.php';
// 1. the current page number ($current_page)
$page = !empty($_GET['page']) ? (int) htmlspecialchars($_GET['page']) : 1;
// 2. records per page ($per_page)
$per_page = 6;
// 3. total record count ($total_count)
$total_count = Product::count_all();
$pagination = new Pagination($page, $per_page, $total_count);
$products = Product::find_all(["limit" => $per_page, "offset" => $pagination->offset()]);
include $dir_public . 'index.php';
 public function getList()
 {
     $all = Product::find_all();
     return $all;
 }
 public function getData()
 {
     global $database;
     $depts = Department::find_all();
     $role = Roles::find_all();
     $products = Product::find_all();
     $country = Country::find_all();
     $services = Cproduct::find_by_client($_SESSION["client_ident"]);
     $countAcc = count(Cproduct::find_by_client($_SESSION["client_ident"]));
     $schedule = Cproduct::getNextSchedule($_SESSION["client_ident"]);
     $countTic = count(Ticket::find_by_client($_SESSION['client_ident']));
     $zone = Zone::find_by_sql("SELECT * FROM zone");
     $startups = array("departs" => $depts, "country" => $country, "zone" => $zone, "role" => $role, "countProd" => $countAcc, "countTick" => $countTic, "Schel" => $schedule, "products" => $products);
     return $startups;
 }
 /**
  * load initail data for employee form needed during 
  * creating and editing employee
  * data 
  */
 public function getData()
 {
     global $database;
     $depts = Department::find_all();
     $role = Roles::find_all();
     $country = Country::find_all();
     $vendors = Vendor::find_all();
     $products = Product::find_all();
     $myproducts = Cproduct::find_by_client($_SESSION['client_ident']);
     $zone = Zone::find_by_sql("SELECT * FROM zone");
     $issues = Issue::find_all();
     $startups = array("departs" => $depts, "country" => $country, "zone" => $zone, "vendors" => $vendors, "role" => $role, "myproducts" => $myproducts, "issues" => $issues, "products" => $products);
     return $startups;
 }
 public function getAllProducts()
 {
     $allProducts = Product::find_all();
     return $allProducts;
 }