Ejemplo n.º 1
0
 /**
  * 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 $id the ID of the model to be loaded
  * @return Modals the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Modals::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 2
0
 public function actionGetModal()
 {
     if (isset($_POST)) {
         if ($_POST['username'] == 'online') {
             $model = Modals::model()->findByPk(2);
             $array = Yii::app()->language == 'ru' ? array('title' => $model->title_ru, 'text' => $model->description_ru) : array('title' => $model->title_uk, 'text' => $model->description_uk);
             $array['TextareaFiled'] = Yii::app()->language == 'ru' ? 'Ваш вопрос' : 'Ваше питання';
             echo json_encode($array);
             Yii::app()->end();
         } else {
             $model = Modals::model()->findByPk(1);
             $array = Yii::app()->language == 'ru' ? array('title' => $model->title_ru, 'text' => $model->description_ru) : array('title' => $model->title_uk, 'text' => $model->description_uk);
             $array['TextareaFiled'] = Yii::app()->language == 'ru' ? 'Комментарий' : 'Коментар';
             echo json_encode($array);
             Yii::app()->end();
         }
     }
 }