/**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionSetting()
 {
     $model = SupportMailSetting::model()->findByPk(1);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['SupportMailSetting'])) {
         $model->attributes = $_POST['SupportMailSetting'];
         $jsonError = CActiveForm::validate($model);
         if (strlen($jsonError) > 2) {
             $errors = $model->getErrors();
             $summary['msg'] = "<div class='errorSummary'><strong>" . Yii::t('phrase', 'Please fix the following input errors:') . "</strong>";
             $summary['msg'] .= "<ul>";
             foreach ($errors as $key => $value) {
                 $summary['msg'] .= "<li>{$value[0]}</li>";
             }
             $summary['msg'] .= "</ul></div>";
             $message = json_decode($jsonError, true);
             $merge = array_merge_recursive($summary, $message);
             $encode = json_encode($merge);
             echo $encode;
         } else {
             if (isset($_GET['enablesave']) && $_GET['enablesave'] == 1) {
                 if ($model->save()) {
                     echo CJSON::encode(array('type' => 0, 'msg' => '<div class="errorSummary success"><strong>' . Yii::t('phrase', 'Mail Setting success updated.') . '</strong></div>'));
                 } else {
                     print_r($model->getErrors());
                 }
             }
         }
         Yii::app()->end();
     } else {
         $this->pageTitle = Yii::t('phrase', 'Mail Settings');
         $this->pageDescription = '';
         $this->pageMeta = '';
         $this->render('admin_setting', array('model' => $model));
     }
 }