Example #1
0
 public function pagesettingstore()
 {
     session_start();
     $pagesetting = new pagesettings();
     $pagesetting->delete($_SESSION['tablename']);
     $count = $_POST['checkbox'];
     $N = count($count);
     for ($i = 0; $i < $N; $i++) {
         $pagesetting->addnew($count[$i], $_SESSION['tablename'], '1');
     }
     $pagesetting->addnew($_POST['rows'], $_SESSION['tablename'], '0');
     if ($_SESSION['tablename'] == "contacts") {
         return redirect("contact");
     } elseif ($_SESSION['tablename'] == "accounts") {
         return redirect("account");
     } elseif ($_SESSION['tablename'] == "sales") {
         return redirect("sale");
     }
     return redirect($_SESSION['tablename']);
 }
Example #2
0
 public function search()
 {
     session_start();
     unset($_SESSION['contact_report_to']);
     //create a session for location
     $_SESSION['loc'] = "ticket";
     //creating objects
     $pagesettings = new functions\pagesettings();
     //get selected columns
     $selected_columns = $pagesettings->fname('ticket', '1');
     //get select columns names
     foreach ($selected_columns as $result) {
         $column_comment = $pagesettings->viewcolumncomment($result->column_name, 'ticket');
         foreach ($column_comment as $result_2) {
             $table_headings[] = $result_2->column_comment;
         }
     }
     $_SESSION['sort'] = "DESC";
     //get data for call log
     $result = $this->view_tickets_all(1000, 0);
     //Get current page form url e.g. &page=6
     $currentPage = LengthAwarePaginator::resolveCurrentPage();
     //pagination starting form 0. e.g. &page=1 mean page=0
     if ($currentPage != NULL) {
         $currentPage = $currentPage - 1;
     }
     //Create a new Laravel collection from the array data
     $collection = new Collection($result);
     //Define how many items we want to be visible in each page
     $perPage = 1000000;
     //Slice the collection to get the items to display in current page
     $currentPageSearchResults = $collection->slice($currentPage * $perPage, $perPage)->all();
     //Create our paginator and pass it to the view
     $result = new LengthAwarePaginator($currentPageSearchResults, count($collection), $perPage);
     //return this data to the view
     return View::make('ticket.ticket', compact('table_headings', 'selected_columns', 'result'));
 }