Esempio n. 1
0
 public function getAvailablePDFs($member)
 {
     $pdfs = Pdfs::find()->where(['is_active' => 1])->orderBy('order, name');
     foreach ($pdfs->all() as $_pdf) {
         $pdf_rules_match_count = $this->getPdfRule($member, $_pdf);
         if ($pdf_rules_match_count) {
             $this->pdfs[] = $_pdf;
         }
     }
     return $this->pdfs;
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pdfs::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, 'order' => $this->order, 'is_active' => $this->is_active, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'file', $this->file]);
     return $dataProvider;
 }
Esempio n. 3
0
 /**
  * Finds the Pdfs model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Pdfs the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Pdfs::find()->where(['id' => $id])->multilingual()->one()) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }