Example #1
0
 public function postIndex(FormConfigurationRequest $request)
 {
     if (!empty($request)) {
         $dataConfiguration = $request->all();
         if ($request->id) {
             $obj = Configuration::find($request->id);
             $obj->update($dataConfiguration);
         }
         return redirect('admpanel/' . self::NAMEC)->with('messageSuccess', 'Caracteristicas Guardado');
     }
     return redirect('admpanel')->with('messageError', 'Error al guardar la configuraciĆ³n');
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Configuration::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, 'attach_size' => $this->attach_size, 'create_time' => $this->create_time, 'update_time' => $this->update_time]);
     $query->andFilterWhere(['like', 'web_name', $this->web_name])->andFilterWhere(['like', 'contact_email', $this->contact_email])->andFilterWhere(['like', 'keyword', $this->keyword])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'copyright', $this->copyright])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'contact_phone', $this->contact_phone])->andFilterWhere(['like', 'icp', $this->icp])->andFilterWhere(['like', 'create_user', $this->create_user])->andFilterWhere(['like', 'update_user', $this->update_user]);
     return $dataProvider;
 }
Example #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Configuration::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['configuration_id' => $this->configuration_id, 'sort_order' => $this->sort_order, 'created' => $this->created, 'last_updated' => $this->last_updated, 'configuration_group_id' => $this->configuration_group_id]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'type', $this->type]);
     return $dataProvider;
 }
Example #4
0
 public function actionApplication()
 {
     $model = new Application();
     $model_contacts[] = new ApplicationContact();
     $model_jobs[] = new ApplicationJob();
     $user = \Yii::$app->user->getIdentity();
     if ($user != null && $user->getCompany()->one() == null) {
         $this->render('fair/application_fail', ['error' => Yii::t('app', 'Students can not sign up for a fair.')]);
     } elseif ($user != null) {
         $model->name = $user->name;
         $model->address = $user->address;
         $model->email = $user->email;
         $model->website = $user->getCompany()->one()->website;
         $model->info_email = $user->email;
         $model->contact_name = $user->getCompany()->one()->contact_name;
         $model->idCompany = $user->id;
     }
     $model->fair_number = Configuration::find()->where(['name' => 'fair_number'])->one()->value;
     return $this->render('application', ['model' => $model, 'model_contacts' => $model_contacts, 'model_jobs' => $model_jobs]);
 }
 public function get($key, $default = null)
 {
     # SEARCH FROM AUTOLOADED CONFIG
     if (isset($this->autoloaded[$key])) {
         if (empty($this->autoloaded[$key])) {
             return (string) $default;
         } else {
             return $this->autoloaded[$key];
         }
     } else {
         $config = Configuration::find($key);
         if ($config) {
             if (empty($config->value)) {
                 return (string) $default;
             } else {
                 return (string) $config->value;
             }
         }
     }
     return '';
 }