/** * 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)); }
/** * 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)); }
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); }
/** * 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)); }
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)); }
/** * 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; }