public function renderDefault() { // vyhledavani if ($this->q) { $this->places->where("subject.name LIKE ? OR user.email LIKE ?", "%" . $this->q . "%", "%" . $this->q . "%"); $this['search']['q']->setDefaultValue($this->q); $this->template->search = TRUE; } else { $this->template->search = FALSE; } switch ($this->what) { case self::UPDATED: $this->places->group('subject.id')->having('DATEDIFF(NOW(), subject.changed) < ' . self::TIME_UPDATED); $this->template->what = self::UPDATED; break; case self::RECENT: $this->places->group('subject.id')->having('DATEDIFF(NOW(), subject.created) < ' . self::TIME_RECENT); $this->template->what = self::RECENT; break; case self::TOREVIEW: $this->places->group('subject.id')->having('subject.reviewed = 0 && subject.deleted = 0 '); $this->template->what = self::TOREVIEW; break; case self::DELETED: $this->template->what = self::DELETED; $this->places->fetchDeleted(); break; default: $this->template->what = self::ALL; } if (!$this->what == self::DELETED) { $this->places->fetchUnDeleted(); } if ($this->orderBy == '' && $this->user->isInRole('administrator')) { $this->orderBy = self::MODIFICATION; } switch ($this->orderBy) { case self::MODIFICATION: $this->places->order('changed DESC, created DESC'); $this->template->orderBy = self::MODIFICATION; break; case self::ALPHABET: default: $this->places->order('name'); $this->template->orderBy = self::ALPHABET; break; } // strankovani $this->pagerPlaces->itemCount = $this->places->count(); $this->places->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset()); // vypis $this->template->places = $this->places; }