public function last($arg = null) { $http = new Http(); if ($http->isActive('to_delete')) { $to_delete = $http->post('to_delete'); foreach ($to_delete as $del) { $detail = new Order_details(); $detail->deleteOrder($del); } Location::To(URL . 'user/last'); } $orders = new \Models\Orders(\lib\Register::get('id')); $pag = new \lib\Pagination(10, $orders->getUserNumberOfOrders()); $orders_array = $orders->getOrders(10, $pag->page($arg[0])); $next = $pag->next(); $prev = $pag->prev(); $num_pages = $pag->getPages(); $selected = $pag->getSelected(); $data = array(); if (!empty($orders_array)) { foreach ($orders_array as $key => $or) { $id = $or->getOrderDetailsId(); $detail = new Order_details($id); $data[$key]['id'] = $id; $data[$key]['state'] = $detail->getStatus(); $data[$key]['date'] = $detail->getDate(); $data[$key]['nr'] = $detail->getOrderNr(); } } $this->render('last', array('categories' => $this->categories, 'd_product' => $this->d_product, 'orders' => $data, 'ids' => $this->category_ids, 'next' => $next, 'prev' => $prev, 'num_pages' => $num_pages, 'selected' => $selected)); }