Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Grupa::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(['grupa_id' => $this->grupa_id]);
     $query->andFilterWhere(['like', 'grupa_name', $this->grupa_name]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Finds the Grupa model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Grupa the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Grupa::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 public static function VariablesValues($attribute, $value = NULL)
 {
     $values = ['mol_id_build' => [$value => Build::getBuildByID($value)], 'mol_fullname_material' => [$value => Authuser::getAuthuserByID($value)], 'material_writeoff' => Material::VariablesValues($attribute), 'mat_id_grupa' => [$value => Grupa::getGrupaByID($value)]];
     return isset($values[$attribute]) ? $values[$attribute] : NULL;
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdgrupa()
 {
     return $this->hasOne(Grupa::className(), ['grupa_id' => 'id_grupa'])->from(['idgrupa' => Grupa::tableName()]);
 }
Example #5
0
 /**
  * @depends loadData
  */
 public function destroyData()
 {
     Grupavid::deleteAll();
     Grupa::deleteAll();
     Matvid::deleteAll();
 }