public function edit()
 {
     //die();
     $id = $this->getParam('id');
     $modelevento = new eventoModel();
     $resevento = $modelevento->getEvento('e.codigo=' . $id);
     $this->smarty->assign('registro', $resevento[0]);
     $model_statuseventos = new statuseventoModel();
     $statuseventos_res = $model_statuseventos->getStatusEvento();
     //Full table Scan :( or :)
     //send the records to template sytem
     $this->smarty->assign('liststatusevento', $statuseventos_res);
     //list all records
     $model_cidade = new cidadeModel();
     $cidade_res = $model_cidade->getCidade();
     //Full table Scan :( or :)
     //send the records to template sytem
     $this->smarty->assign('listscidade', $cidade_res);
     $this->smarty->assign('title', 'Detalhes dos Eventos');
     //call the smarty
     $this->smarty->display('evento/edit.tpl');
 }
 public function mostraGrid()
 {
     $total_reg = "10";
     // número de registros por página
     $pagina = $_SESSION['pagina'];
     if (!$pagina) {
         $pc = "1";
     } else {
         $pc = $pagina;
     }
     $inicio = $pc - 1;
     $inicio = $inicio * $total_reg;
     //Busca os registros para o Grid
     $cidadeModel = new cidadeModel();
     $qry_limitada = $cidadeModel->getCidadeEstado("SELECT id_cidade,des_cidade,e.id_estado,des_estado FROM cidade c inner join estado e on (c.id_estado=e.id_estado AND c.stat<>0) LIMIT {$inicio},{$total_reg}");
     $this->smarty->assign('listcidade', $qry_limitada);
     // Total de Registros na tabela
     $qry_total = $cidadeModel->readSQL("SELECT count(*)as total FROM cidade WHERE stat<>0");
     $total_registros = $qry_total[0]['total'];
     //pega o valor
     $html = $this->paginador($pc, $total_registros, 'cidade');
     return $html;
 }
示例#3
0
 public function buscaCidadePorId($id)
 {
     $cidade = new cidadeModel();
     $cidade->extras_select = "WHERE id='" . $id . "'";
     $cidade->buscaCidade($cidade);
     if ($cidade->linhasafetadas > 0) {
         return $cidade->retornaDados('assoc');
     }
     return array();
 }
 public function edit()
 {
     $model_estado = new estadoModel();
     $model_cidade = new cidadeModel();
     $model = new clienteModel();
     $id = $this->getParam('id_cliente');
     $res = $model->getCliente('id_cliente=' . $id . ' AND stat<>0');
     $resEstado = $model_estado->getEstado('stat<>0');
     $resCidade = $model_cidade->getCidade('stat<>0');
     $this->smarty->assign('cliente', $res[0]);
     $this->smarty->assign('cidade', $resCidade);
     $this->smarty->assign('estado', $resEstado);
     $this->smarty->assign('id_choosen_cidade', $res[0]['id_cidade']);
     $this->smarty->assign('id_choosen_estado', $res[0]['id_estado']);
     $this->smarty->assign('title', 'Atualizar cliente');
     //call the smarty
     $this->smarty->display('cliente/update.tpl');
 }
 public function mostraGrid()
 {
     $total_reg = "10";
     // número de registros por página
     $pagina = $_SESSION['pagina'];
     if (!$pagina) {
         $pc = "1";
     } else {
         $pc = $pagina;
     }
     $inicio = $pc - 1;
     $inicio = $inicio * $total_reg;
     //list all records
     $model_cidade = new cidadeModel();
     $cidades_res = $model_cidade->getCidadeLimit(null, $inicio, $total_reg);
     //var_dump($cidades_res);die();
     //send the records to template sytem
     $this->smarty->assign('listcidade', $cidades_res);
     $query_total = $model_cidade->getCountCidade('');
     $total_registros = $query_total[0]['total'];
     //pega o valor
     $html = $this->paginador($pc, $total_registros, 'cidade');
     return $html;
 }
 public function edit()
 {
     $cidadeModel = new cidadeModel();
     $id = $this->getParam('id_evento');
     $model = new model();
     $modelCidade = new cidadeModel();
     $resCidade = $modelCidade->getCidade('stat<>0');
     $res = $model->readSQL('SELECT e.*,c.des_cidade FROM evento e LEFT JOIN cidade c ON (c.id_cidade=e.id_cidade) WHERE e.stat<>0 AND e.id_evento=' . $id);
     $this->smarty->assign('evento', $res[0]);
     $this->smarty->assign('title', 'Atualizar evento');
     $this->smarty->assign('cidade', $resCidade);
     //call the smarty
     $this->smarty->display('evento/update.tpl');
 }
示例#7
0
 private function buscaIdCidade($nome, $id_uf)
 {
     $cidade = new cidadeModel();
     $cidade->extras_select = "  WHERE nome='" . $nome . "' AND id_estados='" . $id_uf . "'";
     $cidade->buscaCidade($cidade);
     if ($cidade->linhasafetadas > 0) {
         return $cidade->retornaDados('assoc');
     }
     return FALSE;
 }