Example #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     try {
         $model = new Layouts('create');
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         if (isset($_POST['Layouts'])) {
             $model->attributes = $_POST['Layouts'];
             if ($model->save()) {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
         $this->render('create', array('model' => $model, 'actions' => $this->listActionsCanAccess));
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }
Example #2
0
 /**
  * Insere os dados do layout no banco de dados
  * @return boolean verdadeiro caso sucesso ou falso caso ocorra algum erro
  */
 public function createLayout()
 {
     $layout = new Layouts();
     //Caso não seja passado os dados do layout, cria um padrão
     $layout->layout_banner = '';
     $layout->layout_subtitle = addslashes(htmlentities('Page Heading<small>Secondary Text</small>'));
     $layout->layout_menu1 = "Home";
     $layout->layout_menu2 = "Sobre";
     $layout->layout_menu3 = "Contato";
     $layout->layout_searchbar = addslashes(htmlentities('<h4>Buscar</h4>
                                 <div class="input-group">
                                     <input type="text" id="data-search" name="data-search" class="form-control">
                                     <span class="input-group-btn">
                                     <button id="search" class="btn btn-default" type="button">
                                     <span class="glyphicon glyphicon-search"></span>
                                     </button>
                                     </span>
                                 </div>'));
     $layout->layout_lateralbar = addslashes(htmlentities('<h4>Side Widget Well</h4>
         <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore, perspiciatis adipisci accusamus laudantium odit aliquam repellat tempore quos aspernatur vero.</p>'));
     $layout->layout_footer = addslashes(htmlentities("<p>Copyright &copy; Your Website " . date('Y') . "</p>"));
     $layout->save();
     return $layout->layout_id;
 }