public function actionWorks($year = NULL, $award = NULL, $type = NULL, $grade = NULL, $category = NULL)
 {
     $filter = NULL;
     if ($year) {
         $this->where['year'] = $year;
         $filter = "Chytrá palice " . $year;
     }
     if ($award) {
         $this->where['award'] = $award;
         $filter = "Získané ocenění - " . $award;
     }
     if ($type) {
         $this->where['type'] = $type;
         $filter = "Typ práce - " . $type;
     }
     if ($grade) {
         $this->grade = array_search($grade, Model::rocniky());
         $filter = "Napsány v ročníku - " . $grade;
     }
     if ($category) {
         if ($category == "palice") {
             $this->palice = true;
             $filter = "Chytrá palice";
         } else {
             if ($category == "palicka") {
                 $this->celaPalicka = true;
                 $filter = "Chytrá palička";
             } else {
                 $this->palicka = array_search($category, Model::palicky());
                 $filter = "Chytrá palička, kategorie: " . $category;
             }
         }
     }
     $this->template->filter = $filter;
 }
Example #2
0
 public function beforeRender()
 {
     $filters = $this->getUniqueValues(array('works' => array('year', 'award', 'type'), 'authors' => array('class')));
     $temp = $filters['authors'];
     unset($filters['authors']);
     //$filters['works']['category'] = Model::palicky();// + array(5=>'palice');    // 'category'=>'Kategorie',
     $filters['works']['grade'] = Model::rocniky();
     $filters['palicka']['category'] = Model::palicky();
     $filters['authors'] = $temp;
     //{link :Front:Default:works "category"=>palicka}
     $this->template->filters = $filters;
     $this->template->schoolYear = Model::getSchoolYear();
     $newest = dibi::query('SELECT
       url,
       title,
       CONCAT_WS(" ", name, surname) as authorName          
       FROM [works] 
       join [authors] on author = authorId', 'ORDER BY %by', array('added' => 'desc'), 'LIMIT %i', 2)->fetchAll();
     $this->template->newest = $newest;
     $mostread = dibi::query('SELECT
       url,
       title,
       CONCAT_WS(" ", name, surname) as authorName          
       FROM [works] 
       join [authors] on author = authorId', 'ORDER BY %by', array('read' => 'desc'), 'LIMIT %i', 3)->fetchAll();
     $this->template->mostread = $mostread;
     $user = Environment::getUser();
     if ($user->isLoggedIn()) {
         $this->template->adminMode = true;
     }
 }