/** * 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)); }
if ($_SESSION['login'] == "true") { $opc = addslashes(trim($_GET['opc'])); if ($opc != "Remover") { $nomeCor = addslashes(trim($_POST['nome'])); } if ($opc == "Editar") { $cod = addslashes(trim($_GET['cod'])); $cor = Cor::listaCor($cod); $cor->setNome_cor($nomeCor); Cor::editaCor($cor); header("location:../controller/controllerCor.php"); } else { if ($opc == "Incluir") { $cor = Cor::listaCor($cod); $cor->setNome_cor($nomeCor); Cor::insereCor($cor); header("location:../controller/controllerCor.php"); } else { $cod = addslashes(trim($_GET['cod'])); $escolha = addslashes(trim($_GET['escolha'])); if ($escolha == "Sim") { Cor::deletaCor($cod); header("location:../controller/controllerCor.php"); } else { header("location:../controller/controllerCor.php"); } } } } else { header("location:../index.php?&erro=\"Login\""); }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ include_once '../configs/sm.php'; include_once '../model/Joia.php'; include_once '../model/Tipo.php'; include_once '../model/Loja.php'; include_once '../model/Cor.php'; include_once '../model/Pedra.php'; include_once '../model/Usuario.php'; session_start(); if ($_SESSION['login'] == "true") { $usuario = Usuario::listaUsuario($_SESSION['usuario']); $sm->assign("usuario", $usuario); $tipo = Tipo::listaTipos(); $cor = Cor::listaCores(); $loja = Loja::listaLojas(); $pedra = Pedra::listaPedras(); $sm->assign("tipos", $tipo); $sm->assign("cores", $cor); $sm->assign("pedras", $pedra); $sm->assign("lojas", $loja); $sm->display("../view/manterJoia.html"); } else { header("location:../index.php?&erro=\"Login\""); }
?> <option value="<?php echo $tamanho; ?> "><?php echo $tamanho; ?> </option> <?php } ?> </select> <br/> <label>Cor*</label> <?php $cores = Cor::todas(); ?> <br/><select id="<?php echo Proxy::encrypt('cor'); ?> " name="<?php echo Proxy::encrypt('cor'); ?> "> <?php foreach ($cores as $cor) { ?> <option value="<?php echo $cor; ?> "><?php
$sm->assign("vendedores", $vendedor); $dados = Transita::listaTransitas(); $joias = array(); $tipos = array(); $texto = ""; $precoTotal = 0.0; if ($dados) { foreach ($dados as $dado) { $joia = Joia::listaJoiaQR($dado->getNome_transita(), 1); array_push($joias, $joia); if ($joia != null) { $precoTotal += $joia->getPreco_venda(); $texto = "-------------------------"; $texto = $texto . "\nProduto: " . Tipo::listaTipo($joia->getTipo())->getNome_tipo() . "\n"; $texto = $texto . "Pedra: " . Pedra::listaPedra($joia->getPedra())->getNome_pedra() . "\n"; $texto = $texto . "Cor: " . Cor::listaCor($joia->getCor())->getNome_cor() . "\n"; $texto = $texto . "Fornecedor: " . Loja::listaLoja($joia->getLoja())->getNome_loja(); array_push($tipos, $texto); $texto = ''; } } } if (!isset($pastaParametro)) { $nome = Vendedor::listaVendedor(1); } else { $pastaParametro = $_GET['pastaParametro']; $nome = $pastaParametro; } $path = "../vendedores/" . $nome->getPasta(); $diretorio = dir($path); $i = 1;
/** * 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 Cor the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Cor::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ include_once '../configs/sm.php'; include_once '../model/Cor.php'; include_once '../model/Usuario.php'; session_start(); if ($_SESSION['login'] == "true") { $usuario = Usuario::listaUsuario($_SESSION['usuario']); $sm->assign("usuario", $usuario); $opc = addslashes(trim($_GET['opc'])); if ($opc == "Editar") { $cod = addslashes(trim($_GET['cod'])); $cor = Cor::listaCor($cod); $sm->assign("nomeCor", $cor->getNome_Cor()); $sm->assign("cod", $cod); $sm->assign("opc", $opc); $sm->display("../view/manterCor.html"); } else { if ($opc == "Incluir") { $sm->assign("opc", $opc); $sm->display("../view/manterCor.html"); } else { $cod = addslashes(trim($_GET['cod'])); $sm->assign("cod", $cod); $sm->assign("tipo", "Cor"); $sm->display("../view/remover.html"); } }
include_once '../configs/sm.php'; include_once '../model/Joia.php'; include_once '../model/Tipo.php'; include_once '../model/Cor.php'; include_once '../model/Pedra.php'; include_once '../model/Loja.php'; include_once '../model/Usuario.php'; session_start(); if ($_SESSION['login'] == "true") { $usuario = Usuario::listaUsuario($_SESSION['usuario']); $sm->assign("usuario", $usuario); $getId = $_GET['id']; $getTipo = $_GET['tipo']; $getLoja = $_GET['loja']; $getCor = $_GET['cor']; $getPedra = $_GET['pedra']; $joia = Joia::listaJoia($getId); $tipo = Tipo::listaTipo($getTipo); $cor = Cor::listaCor($getCor); $loja = Loja::listaLoja($getLoja); $pedra = Pedra::listaPedra($getPedra); $sm->assign("joia", $joia); $sm->assign("tipo", $tipo); $sm->assign("cor", $cor); $sm->assign("loja", $loja); $sm->assign("pedra", $pedra); $sm->display("../view/ListaJoiaIndividual.html"); } else { header("location:../index.php?&erro=\"Login\""); }