public function totalListAction() { if (Session::hasUser('admin')) { $menuModel = new MenuModel(); $menu_data = array(); foreach (Config::get('languages') as $v) { foreach ($menuModel->getMainMenu($v) as $val) { $t = $val['id_page']; $menu_data[$v][$t] = $val; } } // Debugger::PrintR($menu_data); $adminModel = new AdminModel(); $data_admin = $adminModel->getAdminPage(Router::getId()); $indexModel = new IndexModel(); $material_type = $this->totalListMaterialType(); $data_materials = $indexModel->getTotalList($material_type); foreach ($data_materials as $k => $v) { if ($v['status'] == 1) { $v['status'] = __t('yes'); } else { $v['status'] = __t('no'); } $data_materials[$k] = $v; } $items_count = $indexModel->getCount($material_type); $items_per_page = Config::get('materials_per_page'); $request = new Request(); $currentPage = $request->get('page') ? (int) $request->get('page') : 1; $data_pagination = self::getPagination($items_count, $items_per_page, $currentPage); if ($items_count) { $data_materials_page = array_chunk($data_materials, $items_per_page, true); if (isset($data_materials_page[$currentPage - 1])) { $data_materials_page = $data_materials_page[$currentPage - 1]; } else { throw new Exception('Page (' . Router::getUri() . ') not found', 404); } } else { $data_materials_page = null; } $data_url = explode('?', Router::getUri()); $type_of_materials = array(); foreach ($indexModel->getType_of_Materials() as $v) { $type_of_materials[] = strtolower($v['type_name']); } $system_doc = array('404' => Config::get('default_id_error_404'), '403' => Config::get('default_id_error_403'), '204' => Config::get('default_id_error_204'), '500' => Config::get('default_id_error_500'), 'default_page' => Config::get('default_id'), 'not_publish' => Config::get('not_publish'), 'contacts' => Config::get('contacts'), 'news' => Config::get('news'), 'search' => Config::get('search')); $system_doc_rev = array_flip($system_doc); $args = array('data_admin' => $data_admin[0], 'data_materials' => $data_materials_page, 'data_pagination' => $data_pagination, 'data_url' => $data_url[0], 'type_of_materials' => $type_of_materials, 'system_doc' => $system_doc_rev, 'menu_data' => $menu_data, 'items_per_page' => $items_per_page); return $this->render_admin($args); } else { throw new Exception('Access is forbidden', 403); } }