/**
  * Настройки комментариев
  */
 public function actionSettings()
 {
     //        $model = CommentSettings::load();
     $model = CommentSettings::find()->where(['id' => 1])->one();
     if (isset($_POST['CommentSettings'])) {
         $model->attributes = $_POST['CommentSettings'];
         if ($model->save()) {
             \Yii::$app->session->setFlash('settings_saved', \Yii::t('mickeyur\\commentator\\Module.main', 'Settings saved successfully'));
         }
     }
     return $this->render('settings', ['model' => $model]);
 }
Beispiel #2
0
 /**
  * Устанавливает настройки из БД
  */
 private function setSettingsFromDB()
 {
     //        $model = CommentSettings::load();
     $model = CommentSettings::find()->where(['id' => 1])->one();
     $this->dateFormat = $model->date_format;
     $this->margin = $model->margin;
     $this->levels = $model->levels;
     $this->editTime = $model->edit_time;
     $this->maxLengthAuthor = $model->max_length_author;
     $this->maxLengthContent = $model->max_length_content;
     $this->likesControl = $model->likes_control;
     $this->managePageSize = $model->manage_page_size;
     $this->premoderate = $model->premoderate;
     $this->notifyAdmin = $model->notify_admin;
     $this->fromEmail = $model->fromEmail;
     $this->adminEmail = $model->adminEmail;
 }