예제 #1
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);
     $oMarcas = Marca::model()->naoExcluido()->findAll();
     if (isset($_POST['Modelo'])) {
         $model->attributes = $_POST['Modelo'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'oMarcas' => $oMarcas));
 }
예제 #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);
     $oModelos = Modelo::model()->ordenarTitulo()->naoExcluido()->findAll();
     $oMarcas = Marca::model()->ordenarTitulo()->naoExcluido()->findAll();
     $oTiposProduto = TipoProduto::model()->ordenarTitulo()->naoExcluido()->findAll();
     if (isset($_POST['Produto'])) {
         $model->attributes = $_POST['Produto'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'oModelos' => $oModelos, 'oMarcas' => $oMarcas, 'oTiposProduto' => $oTiposProduto));
 }
예제 #3
0
 public function actionFindAllMarca()
 {
     $parametros = Util::getParametrosJSON();
     $condition = " petshop=:petshop ";
     $params = array(':petshop' => Yii::app()->user->petatual);
     $criteria = new CDbCriteria();
     $criteria->condition = $condition;
     $criteria->params = $params;
     $criteria->together = true;
     $criteria->order = 'nome asc';
     $marcas = Marca::model()->findAll($criteria);
     $jsons = array();
     foreach ($marcas as $key => $marca) {
         $jsons[] = $marca;
     }
     Util::setParametrosJSON($jsons);
 }
예제 #4
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);
     $oMarcas = Marca::model()->naoExcluido()->ordenarTitulo()->findAll();
     $oCliente = Cliente::model()->findByPk($_GET['clienteId']);
     $oCores = Cor::model()->naoExcluido()->ordenarTitulo()->findAll();
     if (isset($_POST['ClienteCarro'])) {
         $model->attributes = $_POST['ClienteCarro'];
         if ($model->save()) {
             if ($_POST['abrir_os'] == "true") {
                 $this->redirect(array('ordemServico/create', 'clienteId' => $model->cliente_id, 'clienteCarroId' => $model->id));
             } else {
                 $this->redirect(array('cliente/view', 'id' => $model->cliente_id));
             }
         }
     }
     $this->render('update', array('model' => $model, 'oMarcas' => $oMarcas, 'oCliente' => $oCliente, 'oCores' => $oCores));
 }
예제 #5
0
 public function actionAjaxAgregarMarca()
 {
     $nomMarca = $_POST['nomMarca'];
     $respuesta = Marca::model()->agregarMarca($nomMarca);
     header('Content-Type: application/json; charset="UTF-8"');
     echo CJSON::encode(array('output' => $respuesta));
 }
예제 #6
0
 /**
  * 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 Marca the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Marca::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }