public function search($params)
 {
     $query = AuthItemChild::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'parent', $this->parent])->andFilterWhere(['like', 'child', $this->child]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * Callback for $this->menuWidget() method.
  * @param array $data data to process.
  * @return array processed data.
  */
 public function menuCallback($data)
 {
     $contextMenu = ARTreeMenuWidget::this()->commonOptions()['contextmenu'];
     $contextMenu['items'] = ['create' => $contextMenu['items']['create'], 'delete' => $contextMenu['items']['delete']];
     $data['options'] = ['types' => $this->types, 'contextmenu' => $contextMenu];
     $items = AuthItem::find()->where(['type' => \yii\rbac\Item::TYPE_ROLE])->indexBy('name')->all();
     $relations = AuthItemChild::find()->all();
     $data['items'] = $this->generateTree($items, $relations);
     return $data;
 }