/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Links();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Links'])) {
         $model->attributes = $_POST['Links'];
         $model->id_creator = Yii::app()->user->id;
         if ($model->save()) {
             $linkTranslation = new LinksTranslation();
             $linkTranslation->id_language = 1;
             $linkTranslation->name = $model->name;
             $linkTranslation->link_to = $model->link_to;
             $linkTranslation->id_links = $model->id_links;
             $linkTranslation->save();
             $this->redirect(array('view', 'id' => $model->id_links));
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * 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 LinksTranslation the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = LinksTranslation::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }