Ejemplo n.º 1
0
 public function categoryAction()
 {
     $request = $this->getRequest();
     $category = Modules_Category_Services_Category::factory();
     if (null == $category) {
         Modules_Core_Services_Exception::error('ROUTE_NOT_FOUND');
     }
     $this->view->category = $category;
     if ($category['meta']) {
         $this->view->headMeta($category['meta']);
     }
     $perPage = 30;
     $pageIndex = (int) $request->getParam('page_index');
     if (null == $pageIndex || '' == $pageIndex || $pageIndex < 0) {
         $pageIndex = 1;
     }
     $start = ($pageIndex - 1) * $perPage;
     $this->view->pageIndex = $pageIndex;
     $this->view->articleDao = new Modules_News_Models_Mysql_Article();
     $condition = array('status' => 'active', 'category_id' => $category['category_id']);
     $articles = Modules_News_Services_Article::find($start, $perPage, $condition);
     $numArticles = Modules_News_Services_Article::count($condition);
     $this->view->articles = $articles;
     $this->view->topArticle = $articles ? $articles[0] : null;
     // Pager
     require_once LIB_DIR . DS . 'PEAR' . DS . 'Pager' . DS . 'Sliding.php';
     $pagerPath = $this->view->url('news_article_category', $category);
     $pagerOptions = array('mode' => 'Sliding', 'append' => false, 'perPage' => $perPage, 'delta' => 3, 'urlVar' => 'page', 'path' => $pagerPath, 'fileName' => 'page-%d', 'separator' => '', 'nextImg' => '<small class="icon arrow_right"></small>', 'prevImg' => '<small class="icon arrow_left"></small>', 'altNext' => '', 'altPrev' => '', 'altPage' => '', 'totalItems' => $numArticles, 'currentPage' => $pageIndex, 'urlSeparator' => '/', 'spacesBeforeSeparator' => 0, 'spacesAfterSeparator' => 0, 'curPageSpanPre' => '<a href="javascript: void();" class="current">', 'curPageSpanPost' => '</a>');
     $pager = new Pager_Sliding($pagerOptions);
     $this->view->pager = $pager;
     $linkTagsRaw = $pager->linkTagsRaw;
     $this->view->linkTagsRaw = $linkTagsRaw;
 }
Ejemplo n.º 2
0
 public function showAction()
 {
     $request = $this->getRequest();
     $category = Modules_Category_Services_Category::factory();
     if (null == $category) {
         return;
     }
     $categories = Modules_Category_Services_Category::getParents($category['category_id']);
     $this->view->categories = $categories;
 }
Ejemplo n.º 3
0
 public function showAction()
 {
     $request = $this->getRequest();
     $lang = $request->getParam('lang');
     $category = Modules_Category_Services_Category::factory();
     $categories = Modules_Category_Services_Category::getTree($lang, 'news');
     $this->view->categories = $categories;
     $this->view->uuid = uniqid();
     $this->view->currentCategory = $category;
 }