Beispiel #1
0
 public function actionPhotos($id)
 {
     if (!($model = Category::findOne($id))) {
         return $this->redirect(['/populac/' . $this->module->id]);
     }
     return $this->render('photos', ['model' => $model]);
 }
Beispiel #2
0
 public function photos($options = [])
 {
     if (!$this->_photos) {
         $this->_photos = [];
         $query = Photo::find()->where(['class' => Category::className(), 'item_id' => $this->id])->sort();
         if (!empty($options['where'])) {
             $query->andFilterWhere($options['where']);
         }
         $this->_adp = new ActiveDataProvider(['query' => $query, 'pagination' => !empty($options['pagination']) ? $options['pagination'] : []]);
         foreach ($this->_adp->models as $model) {
             $this->_photos[] = new PhotoObject($model);
         }
     }
     return $this->_photos;
 }
Beispiel #3
0
 private function findCategory($id_slug)
 {
     $category = Category::find()->where(['or', 'category_id=:id_slug', 'slug=:id_slug'], [':id_slug' => $id_slug])->status(Category::STATUS_ON)->one();
     return $category ? new CategoryObject($category) : null;
 }