예제 #1
0
 public function indexAction()
 {
     $pages_module = new Model_Pages();
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     $this->view->page_num = $page = $this->getRequest()->getRequest('page', 1);
     $this->view->sub_of = $sub_of = $this->getRequest()->getRequest('sub_of', 0);
     if ($sub_of) {
         $category_info = $pages_module->getPagePath($sub_of);
         if (!$category_info) {
             $this->redirect($this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/pages/');
         }
         $this->view->parent_name = $category_info['name'];
         $this->view->parent_href = $this->getRequest()->getModule() . '/pages/?sub_of=' . $category_info['sub_of'];
     }
     $data = array('filter_sub_of' => $sub_of);
     $this->view->pages = $pages_module->getPages($data);
     //		$total_records = $pages_module->getTotalPages();
     //
     //		$this->view->total_pages = ceil($total_records / JO_Registry::get('admin_limit'));
     //		$this->view->total_rows = $total_records;
     //
     //		$pagination = new Model_Pagination;
     //		$pagination->setLimit(JO_Registry::get('admin_limit'));
     //		$pagination->setPage($page);
     //		$pagination->setTotal($total_records);
     //		$pagination->setUrl($this->getRequest()->getModule() . '/pages/?page={page}');
     //		$this->view->pagination = $pagination->render();
 }
예제 #2
0
 public function left_partAction()
 {
     $request = $this->getRequest();
     $pages = Model_Pages::getPages(array('parent_id' => 0));
     $this->view->pages = array();
     if ($pages) {
         foreach ($pages as $page) {
             $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=pages&action=read&page_id=' . $page['page_id']), 'active' => $page['page_id'] == $request->getRequest('active_page_id'));
         }
     }
 }
예제 #3
0
 public function indexAction()
 {
     $request = $this->getRequest();
     $pages_module = new Model_Pages();
     if ($this->session->get('successfu_edite')) {
         $this->view->successfu_edite = true;
         $this->session->clear('successfu_edite');
     }
     if ($this->session->get('error_permision')) {
         $this->view->error_permision = $this->session->get('error_permision');
         $this->session->clear('error_permision');
     }
     $this->session->set('come_from_index', true);
     $parent_id = (int) $request->getQuery('parent_id');
     $page_info = Model_Pages::getPage($parent_id);
     if ($page_info) {
         $this->view->parent_title = $page_info['title'];
         $this->view->back_url = $request->getModule() . '/pages/' . ($page_info['parent_id'] ? '?parent_id=' . $page_info['parent_id'] : '');
     } else {
         $parent_id = 0;
     }
     $this->view->new_record_url = $request->getModule() . '/pages/create/' . ($parent_id ? '?parent_id=' . $parent_id : '');
     $this->view->about_url = $request->getModule() . '/pages/about/';
     $page_num = $this->getRequest()->getRequest('page', 1);
     $data = array('start' => $page_num * Helper_Config::get('config_admin_limit') - Helper_Config::get('config_admin_limit'), 'limit' => Helper_Config::get('config_admin_limit'), 'parent_id' => $parent_id);
     $this->view->pages = array();
     $pages = $pages_module->getPages($data);
     if ($pages) {
         foreach ($pages as $page) {
             $page['href'] = WM_Router::create(JO_Request::getInstance()->getBaseUrl() . '?page_id=' . $page['page_id']);
             $page['edit'] = $request->getModule() . '/pages/edit/?id=' . $page['page_id'] . ($parent_id ? '&parent_id=' . $parent_id : '');
             $page['childrens'] = $request->getModule() . '/pages/?parent_id=' . $page['page_id'];
             $this->view->pages[] = $page;
         }
     }
     $total_records = $pages_module->getTotalPages($data);
     $total_pages = ceil($total_records / Helper_Config::get('config_admin_limit'));
     $pagination = new Model_Pagination();
     $pagination->setLimit(Helper_Config::get('config_admin_limit'));
     $pagination->setPage($page_num);
     $pagination->setTotal($total_records);
     $pagination->setUrl($this->getRequest()->getModule() . '/pages/?page={page}' . ($parent_id ? '&parent_id=' . $parent_id : ''));
     $this->view->pagination = $pagination->render();
     $this->view->pagination_text = str_replace(array('{$page}', '{$total_pages}', '{$total_records}'), array($page_num, $total_pages, $total_records), $this->translate('Page {$page} from {$total_pages} ({$total_records} records)'));
 }