Example #1
0
 public function index($year = null)
 {
     $Article = new Article();
     $offset = $limit = null;
     $params = array();
     $params[] = 'Type = ' . $this->getArticleType();
     if ($year && is_numeric($year)) {
         $params[] = $Article->getParam('year', $year);
     } else {
         $offset = 0;
         $limit = 10;
     }
     $Tag = null;
     if (Request::get('tag')) {
         $Tag = new Tag();
         $Tag = $Tag->findItem(array('Name = ' . Request::get('tag')));
         $params[] = $Article->getParam('tag', Request::get('tag'));
     }
     $Paginator = new Paginator($Article->findSize($params), $this->getLimit(), $this->getPage());
     $this->getView()->set('Articles', $Article->findShortList($params, 'PostedAt desc, Id desc', $this->getOffset(), $this->getLimit()));
     $this->getView()->set('Paginator', $Paginator);
     $this->getView()->set('Current', $year);
     $this->getView()->set('Tag', $Tag);
     return $this->getView()->render();
 }