/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Item::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'status' => $this->status]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'handler_class', $this->handler_class])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'version', $this->version])->andFilterWhere(['like', 'text', $this->text])->andFilterWhere(['like', 'author', $this->author])->andFilterWhere(['like', 'author_url', $this->author_url]); return $dataProvider; }
/** * Get Activated Plugins * Get all activated plugins from the database * */ protected function getActivatedPlugins() { // Only plugins in the database are active ones $plugins = Item::find()->all(); if ($plugins) { // For every plugin, store it //var_dump($plugins); foreach ($plugins as $plugin) { self::$plugins_active[$plugin->handler_class] = ['plugin' => $plugin->name, 'class' => $plugin->handler_class]; if ($plugin->events) { foreach ($plugin->events as $event) { if ($event->data) { self::$plugins_active[$plugin->handler_class]['events'][$event->trigger_class] = [$event->trigger_event => [$event->handler_method, json_decode($event->data, true)]]; } else { self::$plugins_active[$plugin->handler_class]['events'][$event->trigger_class] = [$event->trigger_event => $event->handler_method]; } } } } } else { return true; } }