public function ActivationList($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'];
     }
     $statusfield = "";
     $clientidfield = "";
     $prodnamefield = "";
     $issuefield = "";
     $locationfield = "";
     $datefield = "";
     /**
      * of all the filter fields if only one field is set
      */
     $filterResult = "";
     if (isset($_REQUEST['status']) && !empty($_REQUEST['status'])) {
         if (strtolower($_REQUEST['status']) == "pending") {
             $statusfield .= " AND status = 'Admin Reply' OR status ='Customer Reply'";
         } else {
             $statusfield .= " AND status = '" . $_REQUEST['status'] . "' ";
         }
     }
     if (isset($_REQUEST['clientid']) && !empty($_REQUEST['clientid'])) {
         $clientidfield .= " AND client_id='" . $_REQUEST['clientid'] . "' ";
     }
     if (isset($_REQUEST['prodid']) && !empty($_REQUEST['prodid'])) {
         $prodnamefield .= " AND prod_id = '" . $_REQUEST['prodid'] . "' ";
     }
     if (isset($_REQUEST['location']) && !empty($_REQUEST['location'])) {
         $locationfield .= " AND location LIKE '%" . $_REQUEST['location'] . "%' ";
     }
     if (isset($_REQUEST['issue']) && !empty($_REQUEST['issue'])) {
         $issuefield .= " AND issue LIKE '%" . $_REQUEST['issue'] . "%' ";
     }
     if (!empty($_REQUEST['fdate']) && !empty($_REQUEST['tdate'])) {
         $datefield .= " AND datecreated BETWEEN  '" . $_REQUEST['fdate'] . "' AND '" . $_REQUEST['tdate'] . "' ";
     }
     if (empty($_REQUEST['fdate']) && !empty($_REQUEST['tdate'])) {
         $datefield .= " AND datecreated < '" . $_REQUEST['tdate'] . "' ";
     }
     if (!empty($_REQUEST['fdate']) && empty($_REQUEST['tdate'])) {
         $datefield .= " AND datecreated >  '" . $_REQUEST['fdate'] . "'  ";
     }
     $filterResult .= " WHERE id !=''" . $statusfield . $clientidfield . $prodnamefield . $locationfield . $issuefield . $datefield;
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM activation ");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Activation::find_by_sql("SELECT * FROM activation " . $filterResult . " ORDER BY id DESC " . $pagin->pgLimit($pn));
     //print_r($myitems);
     $index_array = array("activations" => $myitems, "mypagin" => $pagin->render($pg, "ticketlist"));
     return $index_array;
 }
 public function getListActivation($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'];
     }
     $statusfield = "";
     /**
      * of all the filter fields if only one field is set
      */
     $filterResult = "";
     if (isset($_REQUEST['status']) && !empty($_REQUEST['status'])) {
         if ($_REQUEST['status'] != "Pending") {
             $statusfield .= " AND status = '" . $_REQUEST['status'] . "' ";
         } else {
             $statusfield .= " AND status = 'Admin Reply' OR status = 'Customer Reply'";
         }
     }
     $filterResult .= " WHERE client_id ='" . $_SESSION['client_ident'] . "' " . $statusfield;
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM activation WHERE client_id='" . $_SESSION["client_ident"] . "'");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Activation::find_by_sql("SELECT * FROM activation " . $filterResult . "  ORDER BY id DESC " . $pagin->pgLimit($pn) . "");
     $index_array = array("supportticket" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
     return $index_array;
 }