/**
  * Manages all models.
  */
 public function actionIndex()
 {
     $model = new SubCategoria('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['SubCategoria'])) {
         $model->attributes = $_GET['SubCategoria'];
     }
     $this->render('index', array('model' => $model, 'arrayCategoria' => SubCategoria::getArrayCategoria()));
 }
Exemplo n.º 2
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Produto'])) {
         $model->attributes = $_POST['Produto'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('update', array('model' => $model, 'arrayCategoria' => SubCategoria::getArrayCategoria(), 'arraySubCategoria' => CHtml::listData(SubCategoria::model()->validos()->findAll(), 'id', 'descricao')));
 }