Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Papka::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
 public function actionMap()
 {
     $sett = new Papka();
     $list = new Pages();
     $r = $sett->find()->all();
     $name = '';
     $show = '';
     $all = '';
     foreach ($r as $page) {
         $show = $list->find()->where(['status' => '1', 'id_papka' => $page->id]);
         $listrows = $show->where(['status' => '1', 'id_papka' => $page->id])->all();
         $all = $show->count('*');
         $name .= '<li class="theme">' . $page->title . ' Всего: ' . $all . '</li>';
         $numpage = 0;
         foreach ($listrows as $rows) {
             $name .= '<li class="item"><a class="map" href="/' . $rows->id_papka . '/' . ++$numpage . '">' . $rows->title . '</a></li>';
         }
     }
     return $this->render('map', ['model' => $name]);
 }