Ejemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Promocao();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Promocao'])) {
         $model->attributes = $_POST['Promocao'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Ejemplo n.º 2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Promocao();
     $modelTamanhoSabor = new TamanhoSabor();
     $modelProduto = new Produto();
     $this->tituloManual = "Cadastrar promoção";
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Promocao'])) {
         $model->attributes = $_POST['Promocao'];
         $model->_pizzaPromocao = isset($_POST['Promocao']['_pizzaPromocao']) ? $_POST['Promocao']['_pizzaPromocao'] : array();
         $model->_produtoPromocao = isset($_POST['Promocao']['_produtoPromocao']) ? $_POST['Promocao']['_produtoPromocao'] : array();
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('modelTamanhoSabor' => $modelTamanhoSabor->getArraySimplesFormatado(), 'modelProduto' => $modelProduto->getArraySimplesFormatado(), 'model' => $model));
 }