public function Gerar() { $this->url_cancelar = '/intranet/transporte_pessoa_lst.php'; // Código do vinculo $options = array('label' => $this->_getLabel('id'), 'disabled' => true, 'required' => false, 'size' => 25); $this->inputsHelper()->integer('id', $options); // Pessoa $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('pessoa')), 'required' => true); $this->inputsHelper()->simpleSearchPessoa('nome', $options); // Montar o inputsHelper->select \/ // Cria lista de rotas $obj_rota = new clsModulesRotaTransporteEscolar(); $obj_rota->setOrderBy(' descricao asc '); $lista_rota = $obj_rota->lista(); $rota_resources = array("" => "Selecione uma rota"); foreach ($lista_rota as $reg) { $rota_resources["{$reg['cod_rota_transporte_escolar']}"] = "{$reg['descricao']}"; } // Rota $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('rota')), 'required' => true, 'resources' => $rota_resources); $this->inputsHelper()->select('rota', $options); // Ponto de Embarque $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('ponto')), 'required' => false, 'resources' => array("" => "Selecione uma rota acima")); $this->inputsHelper()->select('ponto', $options); // Destino $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('destino')), 'required' => false); $this->inputsHelper()->simpleSearchPessoaj('destino', $options); // observacoes $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('observacao')), 'required' => false, 'size' => 50, 'max_length' => 255); $this->inputsHelper()->textArea('observacao', $options); $this->loadResourceAssets($this->getDispatcher()); }
function Gerar() { @session_start(); $this->pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->titulo = "Usuário de transporte - Listagem"; foreach ($_GET as $var => $val) { // passa todos os valores obtidos no GET para atributos do objeto $this->{$var} = $val === "" ? null : $val; } // Cria lista de rotas $obj_rota = new clsModulesRotaTransporteEscolar(); $obj_rota->setOrderBy(' descricao asc '); $lista_rota = $obj_rota->lista(); $select_rota = array("" => "Selecione uma rota"); foreach ($lista_rota as $reg) { $select_rota["{$reg['cod_rota_transporte_escolar']}"] = "{$reg['descricao']}"; } $this->campoNumero("cod_pessoa_transporte", "Código", $this->cod_pessoa_transporte, 20, 255, false); $this->campoTexto("nome_pessoa", "Nome da pessoa", $this->nome_pessoa, 50, 255, false); $this->campoTexto("nome_destino", "Nome do destino", $this->nome_destino, 70, 255, false); $this->campoLista("ref_cod_rota_transporte_escolar", "Rota", $select_rota, $this->ref_cod_rota_transporte_escolar, "", false, "", "", false, false); $obj_permissoes = new clsPermissoes(); $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); $this->addCabecalhos(array("Código", "Nome da pessoa", "Rota", "Destino", "Ponto de embarque")); // Paginador $this->limite = 20; $this->offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->limite - $this->limite : 0; $obj = new clsModulesPessoaTransporte(); $obj->setLimite($this->limite, $this->offset); $lista = $obj->lista($this->cod_pessoa_transporte, null, $this->ref_cod_rota_transporte_escolar, null, null, $this->nome_pessoa, $this->nome_destino); $total = $lista->_total; foreach ($lista as $registro) { $this->addLinhas(array("<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">{$registro["cod_pessoa_transporte"]}</a>", "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">{$registro["nome_pessoa"]}</a>", "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">{$registro["nome_rota"]}</a>", "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">" . (trim($registro["nome_destino"]) == '' ? $registro["nome_destino2"] : $registro["nome_destino"]) . "</a>", "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">{$registro["nome_ponto"]}</a>")); } $this->addPaginador2("transporte_pessoa_lst.php", $total, $_GET, $this->nome, $this->limite); $this->acao = "go(\"../module/TransporteEscolar/Pessoatransporte\")"; $this->nome_acao = "Novo"; //** $this->largura = "100%"; $localizacao = new LocalizacaoSistema(); $localizacao->entradaCaminhos(array($_SERVER['SERVER_NAME'] . "/intranet" => "Início", "educar_index.php" => "i-Educar - Escola", "" => "Listagem de usuários de tranposrte")); $this->enviaLocalizacao($localizacao->montar()); }
protected function validateIfEmpresaIsNotInUse() { $id = $this->getRequest()->id; $pt = new clsModulesRotaTransporteEscolar(); $lista = $pt->lista(null, null, null, null, null, $id); if (is_array($lista) && count($lista) > 0) { $this->messenger->append('Não é possível excluir uma empresa que está vinculada a uma rota.', 'error', false, 'error'); return false; } else { $motorista = new clsModulesMotorista(); $lst = $motorista->lista(null, null, null, null, $id); if (is_array($lst) && count($lst) > 0) { $this->messenger->append('Não é possível excluir uma empresa que está vinculada a um motorista.', 'error', false, 'error'); return false; } else { return true; } } }
function Gerar() { @session_start(); $this->__pessoa_logada = $_SESSION['id_pessoa']; session_write_close(); $this->__titulo = "Rotas - Listagem"; foreach ($_GET as $var => $val) { $this->{$var} = $val === "" ? null : $val; } $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet"); $this->addCabecalhos(array("Ano", "Código da rota", "Descrição", "Destino", "Empresa", "Terceirizado")); // Filtros de Foreign Keys $opcoes = array("" => "Selecione"); $objTemp = new clsModulesEmpresaTransporteEscolar(); $objTemp->setOrderby(' nome_empresa ASC'); $lista = $objTemp->lista(); if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { $opcoes["{$registro['cod_empresa_transporte_escolar']}"] = "{$registro['nome_empresa']}"; } } else { $opcoes = array("" => "Sem empresas cadastradas"); } $this->campoLista("ref_cod_empresa_transporte_escolar", "Empresa", $opcoes, $this->ref_cod_empresa_transporte_escolar, "", false, "", "", false, false); $this->campoTexto('descricao', 'Descrição', $this->descricao, 50, 30); $this->campoNumero('ano', 'Ano', $this->cnh, 4, 5); $this->campoTexto('nome_destino', 'Destino', $this->nome_destino, 50, 30); // Paginador $this->__limite = 20; $this->__offset = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $this->__limite - $this->__limite : 0; $obj_rota = new clsModulesRotaTransporteEscolar(); $obj_rota->setOrderby(" descricao ASC"); $obj_rota->setLimite($this->__limite, $this->__offset); $lista = $obj_rota->lista(null, $this->descricao, null, $this->nome_destino, $this->ano, $this->ref_cod_empresa_transporte_escolar); $total = $obj_rota->_total; // monta a lista if (is_array($lista) && count($lista)) { foreach ($lista as $registro) { $this->addLinhas(array("<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["ano"]}</a>", "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["cod_rota_transporte_escolar"]}</a>", "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["descricao"]}</a>", "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["nome_destino"]}</a>", "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["nome_empresa"]}</a>", "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">" . ($registro["tercerizado"] == 'S' ? 'Sim' : 'Não') . "</a>")); } } $this->addPaginador2("transporte_rota_lst.php", $total, $_GET, $this->nome, $this->__limite); $this->acao = "go(\"/module/TransporteEscolar/Rota\")"; $this->nome_acao = "Novo"; $this->largura = "100%"; }