/**
  * 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 actionEdit($id)
 {
     $model = $this->loadModel($id);
     $language = OmmuLanguages::model()->findAll();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['OmmuSystemPhrase'])) {
         $model->attributes = $_POST['OmmuSystemPhrase'];
         $jsonError = CActiveForm::validate($model);
         if (strlen($jsonError) > 2) {
             echo $jsonError;
         } else {
             if (isset($_GET['enablesave']) && $_GET['enablesave'] == 1) {
                 if ($model->save()) {
                     echo CJSON::encode(array('type' => 5, 'get' => Yii::app()->controller->createUrl('manage'), 'id' => 'partial-ommu-system-phrase', 'msg' => '<div class="errorSummary success"><strong>' . Yii::t('phrase', '{phrase} Front Phrase success updated.', array('{phrase}' => $model->phrase_id)) . '</strong></div>'));
                 } else {
                     print_r($model->getErrors());
                 }
             }
         }
         Yii::app()->end();
     } else {
         $this->dialogDetail = true;
         $this->dialogGroundUrl = Yii::app()->controller->createUrl('manage');
         $this->dialogWidth = 600;
         $this->pageTitle = Yii::t('phrase', 'Update Front Phrase');
         $this->pageDescription = '';
         $this->pageMeta = '';
         $this->render('admin_edit', array('model' => $model, 'language' => $language));
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = OmmuLanguages::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.'));
     }
     return $model;
 }