Пример #1
0
 public function actionAdmin()
 {
     /* used in the refnum selection */
     if (isset($_POST['Settings'])) {
         if (isset($_POST['ajax'])) {
             $model = new Settings();
             return $model->Tmvalidate($_POST['Settings']);
         }
         //$this->performAjaxValidation($_POST['Settings']);
         foreach ($_POST['Settings'] as $key => $value) {
             $model = Settings::findOne($key);
             $model->value = $value['value'];
             //will stop
             $model->save();
         }
         //$comp = Company::findOne($this->company);
         //$comp->loadSettings();
         \Yii::$app->getSession()->setFlash('success', Yii::t("app", "Saved"));
     }
     $models = Settings::find()->where(array("hidden" => "0"))->all();
     //->addOrderBy(['priority'=>'desc'])
     return $this->render('view', array('models' => $models));
 }