/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Blocks();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Blocks'])) {
         $model->attributes = $_POST['Blocks'];
         if ($model->save()) {
             $this->redirect('index.php?r=added&view=index');
         }
     }
     $this->render('create', array('model' => $model));
 }
Esempio n. 2
0
 public function doaddblock()
 {
     $contentBlocks = Block::getContentBlocks();
     $contentBlock = $contentBlocks[Input::get('block_title')];
     $ev = array_keys($contentBlock['events_to_fire']);
     $vp = array_keys($contentBlock['views_path']);
     $block = new Blocks();
     $block->grids_id = Input::get('gridid');
     $block->block_position = Input::get('block_position');
     $block->block_title = $contentBlock['block_title'];
     $block->block_name = Input::get('block_title');
     $block->event_to_fire = reset($ev);
     $block->view_path = reset($vp);
     $block->sort = 0;
     $block->save();
     return Redirect::to('backend/gridmanager/')->withMessage($this->notifyView(Lang::get('grid_manager::messages.block_added'), 'success'));
 }