Commit e82e740adc6c6b8f79a32e59290fb9df19a3f97d
1 parent
7e87cc73
Exists in
master
#47 #46 Adicionando módulo de transporte escolar
Showing
64 changed files
with
10838 additions
and
0 deletions
Show diff stats
ieducar/intranet/include/modules/clsModulesEmpresaTransporteEscolar.inc.php
0 → 100644
| ... | ... | @@ -0,0 +1,428 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * clsModulesEmpresaTransporteEscolar class. | |
| 35 | + * | |
| 36 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 37 | + * @category i-Educar | |
| 38 | + * @license @@license@@ | |
| 39 | + * @package Module | |
| 40 | + * @since 07/2013 | |
| 41 | + * @version @@package_version@@ | |
| 42 | + */ | |
| 43 | +class clsModulesEmpresaTransporteEscolar | |
| 44 | +{ | |
| 45 | + var $cod_empresa_transporte_escolar; | |
| 46 | + var $ref_idpes; | |
| 47 | + var $ref_resp_idpes; | |
| 48 | + var $observacao; | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
| 52 | + * @var int | |
| 53 | + */ | |
| 54 | + var $_total; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * Nome do schema. | |
| 58 | + * @var string | |
| 59 | + */ | |
| 60 | + var $_schema; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Nome da tabela. | |
| 64 | + * @var string | |
| 65 | + */ | |
| 66 | + var $_tabela; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
| 70 | + * próxima chamado ao método lista(). | |
| 71 | + * @var string | |
| 72 | + */ | |
| 73 | + var $_campos_lista; | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
| 77 | + * seleção no método lista. | |
| 78 | + * @var string | |
| 79 | + */ | |
| 80 | + var $_todos_campos; | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
| 84 | + * @var int | |
| 85 | + */ | |
| 86 | + var $_limite_quantidade; | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * Define o valor de offset no retorno dos registros no método lista(). | |
| 90 | + * @var int | |
| 91 | + */ | |
| 92 | + var $_limite_offset; | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
| 96 | + * @var string | |
| 97 | + */ | |
| 98 | + var $_campo_order_by; | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * Construtor. | |
| 102 | + */ | |
| 103 | + function clsModulesEmpresaTransporteEscolar($cod_empresa_transporte_escolar = NULL, | |
| 104 | + $ref_idpes = NULL, $ref_resp_idpes = NULL, | |
| 105 | + $observacao = NULL) | |
| 106 | + { | |
| 107 | + $db = new clsBanco(); | |
| 108 | + $this->_schema = "modules."; | |
| 109 | + $this->_tabela = "{$this->_schema}empresa_transporte_escolar"; | |
| 110 | + | |
| 111 | + $this->_campos_lista = $this->_todos_campos = " cod_empresa_transporte_escolar, ref_idpes, ref_resp_idpes, observacao "; | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + if (is_numeric($cod_empresa_transporte_escolar)) { | |
| 116 | + $this->cod_empresa_transporte_escolar = $cod_empresa_transporte_escolar; | |
| 117 | + } | |
| 118 | + | |
| 119 | + if (is_numeric($ref_idpes)) { | |
| 120 | + $this->ref_idpes = $ref_idpes; | |
| 121 | + } | |
| 122 | + | |
| 123 | + if (is_numeric($ref_resp_idpes)) { | |
| 124 | + $this->ref_resp_idpes = $ref_resp_idpes; | |
| 125 | + } | |
| 126 | + | |
| 127 | + if (is_string($observacao)) { | |
| 128 | + $this->observacao = $observacao; | |
| 129 | + } | |
| 130 | + | |
| 131 | + } | |
| 132 | + | |
| 133 | + /** | |
| 134 | + * Cria um novo registro. | |
| 135 | + * @return bool | |
| 136 | + */ | |
| 137 | + function cadastra() | |
| 138 | + { | |
| 139 | + if (is_numeric($this->ref_idpes) && is_numeric($this->ref_resp_idpes)) | |
| 140 | + { | |
| 141 | + $db = new clsBanco(); | |
| 142 | + | |
| 143 | + $campos = ''; | |
| 144 | + $valores = ''; | |
| 145 | + $gruda = ''; | |
| 146 | + | |
| 147 | + if (is_numeric($this->ref_idpes)) { | |
| 148 | + $campos .= "{$gruda}ref_idpes"; | |
| 149 | + $valores .= "{$gruda}'{$this->ref_idpes}'"; | |
| 150 | + $gruda = ", "; | |
| 151 | + } | |
| 152 | + | |
| 153 | + if (is_numeric($this->ref_resp_idpes)) { | |
| 154 | + $campos .= "{$gruda}ref_resp_idpes"; | |
| 155 | + $valores .= "{$gruda}'{$this->ref_resp_idpes}'"; | |
| 156 | + $gruda = ", "; | |
| 157 | + } | |
| 158 | + | |
| 159 | + if (is_string($this->observacao)) { | |
| 160 | + $campos .= "{$gruda}observacao"; | |
| 161 | + $valores .= "{$gruda}'{$this->observacao}'"; | |
| 162 | + $gruda = ", "; | |
| 163 | + } | |
| 164 | + | |
| 165 | + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); | |
| 166 | + return $db->InsertId("{$this->_tabela}_seq"); | |
| 167 | + } | |
| 168 | + | |
| 169 | + return FALSE; | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * Edita os dados de um registro. | |
| 174 | + * @return bool | |
| 175 | + */ | |
| 176 | + function edita() | |
| 177 | + { | |
| 178 | + if (is_numeric($this->cod_empresa_transporte_escolar)) { | |
| 179 | + $db = new clsBanco(); | |
| 180 | + $set = ''; | |
| 181 | + | |
| 182 | + if (is_numeric($this->ref_idpes)) { | |
| 183 | + $set .= "{$gruda}ref_idpes = '{$this->ref_idpes}'"; | |
| 184 | + $gruda = ", "; | |
| 185 | + } | |
| 186 | + | |
| 187 | + if (is_numeric($this->ref_resp_idpes)) { | |
| 188 | + $set .= "{$gruda}ref_resp_idpes = '{$this->ref_resp_idpes}'"; | |
| 189 | + $gruda = ", "; | |
| 190 | + } | |
| 191 | + | |
| 192 | + if (is_string($this->observacao)) { | |
| 193 | + $set .= "{$gruda}observacao = '{$this->observacao}'"; | |
| 194 | + $gruda = ", "; | |
| 195 | + } | |
| 196 | + if ($set) { | |
| 197 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'"); | |
| 198 | + return TRUE; | |
| 199 | + } | |
| 200 | + } | |
| 201 | + | |
| 202 | + return FALSE; | |
| 203 | + } | |
| 204 | + | |
| 205 | + /** | |
| 206 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
| 207 | + * @return array | |
| 208 | + */ | |
| 209 | + function lista($cod_empresa_transporte_escolar = NULL, $ref_idpes = NULL, | |
| 210 | + $ref_resp_idpes = NULL, $nm_idpes = NULL, | |
| 211 | + $nm_resp_idpes = NULL) | |
| 212 | + { | |
| 213 | + $sql = "SELECT {$this->_campos_lista}, ( | |
| 214 | + SELECT | |
| 215 | + nome | |
| 216 | + FROM | |
| 217 | + cadastro.pessoa | |
| 218 | + WHERE | |
| 219 | + idpes = ref_idpes | |
| 220 | + ) AS nome_empresa , (SELECT nome FROM cadastro.pessoa WHERE idpes = ref_resp_idpes) AS nome_responsavel, ( | |
| 221 | + SELECT | |
| 222 | + nome | |
| 223 | + FROM | |
| 224 | + cadastro.pessoa | |
| 225 | + WHERE | |
| 226 | + idpes = ref_idpes | |
| 227 | + ) AS nome_empresa , (SELECT '(' || ddd || ')' || fone FROM cadastro.fone_pessoa WHERE idpes = ref_idpes limit 1) AS telefone FROM {$this->_tabela}"; | |
| 228 | + $filtros = ""; | |
| 229 | + | |
| 230 | + $whereAnd = " WHERE "; | |
| 231 | + | |
| 232 | + if (is_numeric($cod_empresa_transporte_escolar)) { | |
| 233 | + $filtros .= "{$whereAnd} cod_empresa_transporte_escolar = '{$cod_empresa_transporte_escolar}'"; | |
| 234 | + $whereAnd = " AND "; | |
| 235 | + } | |
| 236 | + | |
| 237 | + if (is_numeric($ref_idpes)) { | |
| 238 | + $filtros .= "{$whereAnd} ref_idpes = '{$ref_idpes}'"; | |
| 239 | + $whereAnd = " AND "; | |
| 240 | + } | |
| 241 | + | |
| 242 | + if (is_numeric($ref_resp_idpes)) { | |
| 243 | + $filtros .= "{$whereAnd} ref_resp_idpes = '{$ref_resp_idpes}'"; | |
| 244 | + $whereAnd = " AND "; | |
| 245 | + } | |
| 246 | + | |
| 247 | + if (is_string($nm_idpes)) { | |
| 248 | + $filtros .= " | |
| 249 | + {$whereAnd} exists ( | |
| 250 | + SELECT | |
| 251 | + 1 | |
| 252 | + FROM | |
| 253 | + cadastro.pessoa | |
| 254 | + WHERE | |
| 255 | + cadastro.pessoa.idpes = ref_idpes | |
| 256 | + AND TO_ASCII(LOWER(nome)) LIKE TO_ASCII(LOWER('%{$nm_idpes}%')) | |
| 257 | + )"; | |
| 258 | + | |
| 259 | + $whereAnd = ' AND '; | |
| 260 | + } | |
| 261 | + | |
| 262 | + if (is_string($nm_resp_idpes)) { | |
| 263 | + $filtros .= " | |
| 264 | + {$whereAnd} exists ( | |
| 265 | + SELECT | |
| 266 | + 1 | |
| 267 | + FROM | |
| 268 | + cadastro.pessoa | |
| 269 | + WHERE | |
| 270 | + cadastro.pessoa.idpes = ref_resp_idpes | |
| 271 | + AND TO_ASCII(LOWER(nome)) LIKE TO_ASCII(LOWER('%{$nm_resp_idpes}%')) | |
| 272 | + )"; | |
| 273 | + | |
| 274 | + $whereAnd = ' AND '; | |
| 275 | + } | |
| 276 | + | |
| 277 | + $db = new clsBanco(); | |
| 278 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 279 | + $resultado = array(); | |
| 280 | + | |
| 281 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
| 282 | + | |
| 283 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 284 | + | |
| 285 | + $db->Consulta($sql); | |
| 286 | + | |
| 287 | + if ($countCampos > 1) { | |
| 288 | + while ($db->ProximoRegistro()) { | |
| 289 | + $tupla = $db->Tupla(); | |
| 290 | + $tupla["_total"] = $this->_total; | |
| 291 | + $resultado[] = $tupla; | |
| 292 | + } | |
| 293 | + } | |
| 294 | + else { | |
| 295 | + while ($db->ProximoRegistro()) { | |
| 296 | + $tupla = $db->Tupla(); | |
| 297 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 298 | + } | |
| 299 | + } | |
| 300 | + if (count($resultado)) { | |
| 301 | + return $resultado; | |
| 302 | + } | |
| 303 | + | |
| 304 | + return FALSE; | |
| 305 | + } | |
| 306 | + | |
| 307 | + /** | |
| 308 | + * Retorna um array com os dados de um registro. | |
| 309 | + * @return array | |
| 310 | + */ | |
| 311 | + function detalhe() | |
| 312 | + { | |
| 313 | + if (is_numeric($this->cod_empresa_transporte_escolar)) { | |
| 314 | + $db = new clsBanco(); | |
| 315 | + $db->Consulta("SELECT {$this->_todos_campos}, ( | |
| 316 | + SELECT | |
| 317 | + nome | |
| 318 | + FROM | |
| 319 | + cadastro.pessoa | |
| 320 | + WHERE | |
| 321 | + idpes = ref_idpes | |
| 322 | + ) AS nome_empresa , (SELECT nome FROM cadastro.pessoa WHERE idpes = ref_resp_idpes) AS nome_responsavel FROM {$this->_tabela} WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'"); | |
| 323 | + $db->ProximoRegistro(); | |
| 324 | + return $db->Tupla(); | |
| 325 | + } | |
| 326 | + | |
| 327 | + return FALSE; | |
| 328 | + } | |
| 329 | + | |
| 330 | + /** | |
| 331 | + * Retorna um array com os dados de um registro. | |
| 332 | + * @return array | |
| 333 | + */ | |
| 334 | + function existe() | |
| 335 | + { | |
| 336 | + if (is_numeric($this->cod_empresa_transporte_escolar)) { | |
| 337 | + $db = new clsBanco(); | |
| 338 | + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'"); | |
| 339 | + $db->ProximoRegistro(); | |
| 340 | + return $db->Tupla(); | |
| 341 | + } | |
| 342 | + | |
| 343 | + return FALSE; | |
| 344 | + } | |
| 345 | + | |
| 346 | + /** | |
| 347 | + * Exclui um registro. | |
| 348 | + * @return bool | |
| 349 | + */ | |
| 350 | + function excluir() | |
| 351 | + { | |
| 352 | + if (is_numeric($this->cod_empresa_transporte_escolar)) { | |
| 353 | + $sql = "DELETE FROM {$this->_tabela} WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'"; | |
| 354 | + $db = new clsBanco(); | |
| 355 | + $db->Consulta($sql); | |
| 356 | + return true; | |
| 357 | + } | |
| 358 | + | |
| 359 | + return FALSE; | |
| 360 | + } | |
| 361 | + | |
| 362 | + /** | |
| 363 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
| 364 | + */ | |
| 365 | + function setCamposLista($str_campos) | |
| 366 | + { | |
| 367 | + $this->_campos_lista = $str_campos; | |
| 368 | + } | |
| 369 | + | |
| 370 | + /** | |
| 371 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
| 372 | + */ | |
| 373 | + function resetCamposLista() | |
| 374 | + { | |
| 375 | + $this->_campos_lista = $this->_todos_campos; | |
| 376 | + } | |
| 377 | + | |
| 378 | + /** | |
| 379 | + * Define limites de retorno para o método Lista(). | |
| 380 | + */ | |
| 381 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
| 382 | + { | |
| 383 | + $this->_limite_quantidade = $intLimiteQtd; | |
| 384 | + $this->_limite_offset = $intLimiteOffset; | |
| 385 | + } | |
| 386 | + | |
| 387 | + /** | |
| 388 | + * Retorna a string com o trecho da query responsável pelo limite de | |
| 389 | + * registros retornados/afetados. | |
| 390 | + * | |
| 391 | + * @return string | |
| 392 | + */ | |
| 393 | + function getLimite() | |
| 394 | + { | |
| 395 | + if (is_numeric($this->_limite_quantidade)) { | |
| 396 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
| 397 | + if (is_numeric($this->_limite_offset)) { | |
| 398 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
| 399 | + } | |
| 400 | + return $retorno; | |
| 401 | + } | |
| 402 | + return ''; | |
| 403 | + } | |
| 404 | + | |
| 405 | + /** | |
| 406 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
| 407 | + */ | |
| 408 | + function setOrderby($strNomeCampo) | |
| 409 | + { | |
| 410 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
| 411 | + $this->_campo_order_by = $strNomeCampo; | |
| 412 | + } | |
| 413 | + } | |
| 414 | + | |
| 415 | + /** | |
| 416 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
| 417 | + * registros. | |
| 418 | + * | |
| 419 | + * @return string | |
| 420 | + */ | |
| 421 | + function getOrderby() | |
| 422 | + { | |
| 423 | + if (is_string($this->_campo_order_by)) { | |
| 424 | + return " ORDER BY {$this->_campo_order_by} "; | |
| 425 | + } | |
| 426 | + return ''; | |
| 427 | + } | |
| 428 | +} | |
| 0 | 429 | \ No newline at end of file | ... | ... |
ieducar/intranet/include/modules/clsModulesItinerarioTransporteEscolar.inc.php
0 → 100644
| ... | ... | @@ -0,0 +1,540 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * clsModulesItinerarioTransporteEscolar class. | |
| 35 | + * | |
| 36 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 37 | + * @category i-Educar | |
| 38 | + * @license @@license@@ | |
| 39 | + * @package Module | |
| 40 | + * @since 07/2013 | |
| 41 | + * @version @@package_version@@ | |
| 42 | + */ | |
| 43 | +class clsModulesItinerarioTransporteEscolar | |
| 44 | +{ | |
| 45 | + var $cod_itinerario_transporte_escolar; | |
| 46 | + var $ref_cod_rota_transporte_escolar; | |
| 47 | + var $seq; | |
| 48 | + var $ref_cod_ponto_transporte_escolar; | |
| 49 | + var $ref_cod_veiculo; | |
| 50 | + var $hora; | |
| 51 | + var $tipo; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
| 55 | + * @var int | |
| 56 | + */ | |
| 57 | + var $_total; | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * Nome do schema. | |
| 61 | + * @var string | |
| 62 | + */ | |
| 63 | + var $_schema; | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * Nome da tabela. | |
| 67 | + * @var string | |
| 68 | + */ | |
| 69 | + var $_tabela; | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
| 73 | + * próxima chamado ao método lista(). | |
| 74 | + * @var string | |
| 75 | + */ | |
| 76 | + var $_campos_lista; | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
| 80 | + * seleção no método lista. | |
| 81 | + * @var string | |
| 82 | + */ | |
| 83 | + var $_todos_campos; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
| 87 | + * @var int | |
| 88 | + */ | |
| 89 | + var $_limite_quantidade; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * Define o valor de offset no retorno dos registros no método lista(). | |
| 93 | + * @var int | |
| 94 | + */ | |
| 95 | + var $_limite_offset; | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
| 99 | + * @var string | |
| 100 | + */ | |
| 101 | + var $_campo_order_by; | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * Construtor. | |
| 105 | + */ | |
| 106 | + function clsModulesItinerarioTransporteEscolar($cod_itinerario_transporte_escolar = NULL, $ref_cod_rota_transporte_escolar = NULL | |
| 107 | + , $seq = NULL, $ref_cod_ponto_transporte_escolar = NULL, $ref_cod_veiculo = NULL, | |
| 108 | + $hora = NULL, $tipo = NULL) | |
| 109 | + { | |
| 110 | + | |
| 111 | + $db = new clsBanco(); | |
| 112 | + $this->_schema = "modules."; | |
| 113 | + $this->_tabela = "{$this->_schema}itinerario_transporte_escolar"; | |
| 114 | + | |
| 115 | + $this->_campos_lista = $this->_todos_campos = " cod_itinerario_transporte_escolar, ref_cod_rota_transporte_escolar, ref_cod_ponto_transporte_escolar, ref_cod_veiculo, seq, hora, tipo"; | |
| 116 | + | |
| 117 | + if (is_numeric($cod_itinerario_transporte_escolar)) { | |
| 118 | + $this->cod_itinerario_transporte_escolar = $cod_itinerario_transporte_escolar; | |
| 119 | + } | |
| 120 | + | |
| 121 | + if (is_numeric($ref_cod_rota_transporte_escolar)) { | |
| 122 | + $this->ref_cod_rota_transporte_escolar = $ref_cod_rota_transporte_escolar; | |
| 123 | + } | |
| 124 | + | |
| 125 | + if (is_numeric($seq)) { | |
| 126 | + $this->seq = $seq; | |
| 127 | + } | |
| 128 | + | |
| 129 | + if (is_numeric($ref_cod_ponto_transporte_escolar)) { | |
| 130 | + $this->ref_cod_ponto_transporte_escolar = $ref_cod_ponto_transporte_escolar; | |
| 131 | + } | |
| 132 | + | |
| 133 | + if (is_numeric($ref_cod_veiculo)) { | |
| 134 | + $this->ref_cod_veiculo = $ref_cod_veiculo; | |
| 135 | + } | |
| 136 | + | |
| 137 | + if (is_string($hora)) { | |
| 138 | + $this->hora = $hora; | |
| 139 | + } | |
| 140 | + | |
| 141 | + if (is_string($tipo)) { | |
| 142 | + $this->tipo = $tipo; | |
| 143 | + } | |
| 144 | + } | |
| 145 | + | |
| 146 | + /** | |
| 147 | + * Cria um novo registro. | |
| 148 | + * @return bool | |
| 149 | + */ | |
| 150 | + function cadastra() | |
| 151 | + { | |
| 152 | + | |
| 153 | + if ( is_numeric($this->ref_cod_rota_transporte_escolar) | |
| 154 | + && is_numeric($this->seq) && is_numeric($this->ref_cod_ponto_transporte_escolar) | |
| 155 | + && is_string($this->tipo)) | |
| 156 | + { | |
| 157 | + $db = new clsBanco(); | |
| 158 | + | |
| 159 | + $campos = ''; | |
| 160 | + $valores = ''; | |
| 161 | + $gruda = ''; | |
| 162 | + | |
| 163 | + if (is_numeric($this->ref_cod_rota_transporte_escolar)) { | |
| 164 | + $campos .= "{$gruda}ref_cod_rota_transporte_escolar"; | |
| 165 | + $valores .= "{$gruda}'{$this->ref_cod_rota_transporte_escolar}'"; | |
| 166 | + $gruda = ", "; | |
| 167 | + } | |
| 168 | + | |
| 169 | + if (is_numeric($this->seq)) { | |
| 170 | + $campos .= "{$gruda}seq"; | |
| 171 | + $valores .= "{$gruda}'{$this->seq}'"; | |
| 172 | + $gruda = ", "; | |
| 173 | + } | |
| 174 | + | |
| 175 | + if (is_numeric($this->ref_cod_ponto_transporte_escolar)) { | |
| 176 | + $campos .= "{$gruda}ref_cod_ponto_transporte_escolar"; | |
| 177 | + $valores .= "{$gruda}'{$this->ref_cod_ponto_transporte_escolar}'"; | |
| 178 | + $gruda = ", "; | |
| 179 | + } | |
| 180 | + | |
| 181 | + if (is_numeric($this->ref_cod_veiculo)) { | |
| 182 | + $campos .= "{$gruda}ref_cod_veiculo"; | |
| 183 | + $valores .= "{$gruda}'{$this->ref_cod_veiculo}'"; | |
| 184 | + $gruda = ", "; | |
| 185 | + } | |
| 186 | + | |
| 187 | + if ($this->checktime($this->hora)) { | |
| 188 | + $campos .= "{$gruda}hora"; | |
| 189 | + $valores .= "{$gruda}'{$this->hora}'"; | |
| 190 | + $gruda = ", "; | |
| 191 | + } | |
| 192 | + | |
| 193 | + if (is_string($this->tipo)) { | |
| 194 | + $campos .= "{$gruda}tipo"; | |
| 195 | + $valores .= "{$gruda}'{$this->tipo}'"; | |
| 196 | + $gruda = ", "; | |
| 197 | + } | |
| 198 | + | |
| 199 | + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); | |
| 200 | + return $db->InsertId("{$this->_tabela}_seq"); | |
| 201 | + } | |
| 202 | + | |
| 203 | + return FALSE; | |
| 204 | + } | |
| 205 | + | |
| 206 | + /** | |
| 207 | + * Edita os dados de um registro. | |
| 208 | + * @return bool | |
| 209 | + */ | |
| 210 | + function edita() | |
| 211 | + { | |
| 212 | + | |
| 213 | + if (is_string($this->cod_itinerario_transporte_escolar)) { | |
| 214 | + $db = new clsBanco(); | |
| 215 | + $set = ''; | |
| 216 | + $gruda = ''; | |
| 217 | + | |
| 218 | + if (is_numeric($this->cod_itinerario_transporte_escolar)) { | |
| 219 | + $set .= "{$gruda}cod_itinerario_transporte_escolar = '{$this->cod_itinerario_transporte_escolar}'"; | |
| 220 | + $gruda = ", "; | |
| 221 | + } | |
| 222 | + | |
| 223 | + if (is_numeric($this->ref_cod_rota_transporte_escolar)) { | |
| 224 | + $set .= "{$gruda}ref_cod_rota_transporte_escolar = '{$this->ref_cod_rota_transporte_escolar}'"; | |
| 225 | + $gruda = ", "; | |
| 226 | + } | |
| 227 | + | |
| 228 | + if (is_numeric($this->seq)) { | |
| 229 | + $set .= "{$gruda}seq = '{$this->seq}'"; | |
| 230 | + $gruda = ", "; | |
| 231 | + } | |
| 232 | + | |
| 233 | + if (is_numeric($this->ref_cod_ponto_transporte_escolar)) { | |
| 234 | + $set .= "{$gruda}ref_cod_ponto_transporte_escolar = '{$this->ref_cod_ponto_transporte_escolar}'"; | |
| 235 | + $gruda = ", "; | |
| 236 | + } | |
| 237 | + | |
| 238 | + if (is_numeric($this->ref_cod_veiculo)) { | |
| 239 | + $set .= "{$gruda}ref_cod_veiculo = '{$this->ref_cod_veiculo}'"; | |
| 240 | + $gruda = ", "; | |
| 241 | + } | |
| 242 | + | |
| 243 | + if (is_string($this->hora)) { | |
| 244 | + $set .= "{$gruda}hora = '{$this->hora}'"; | |
| 245 | + $gruda = ", "; | |
| 246 | + } | |
| 247 | + | |
| 248 | + if (is_string($this->tipo)) { | |
| 249 | + $set .= "{$gruda}tipo = '{$this->tipo}'"; | |
| 250 | + $gruda = ", "; | |
| 251 | + } | |
| 252 | + if ($set) { | |
| 253 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_itinerario_transporte_escolar = '{$this->cod_itinerario_transporte_escolar}'"); | |
| 254 | + return TRUE; | |
| 255 | + } | |
| 256 | + } | |
| 257 | + return FALSE; | |
| 258 | + } | |
| 259 | + | |
| 260 | + /** | |
| 261 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
| 262 | + * @return array | |
| 263 | + */ | |
| 264 | + function lista($cod_itinerario_transporte_escolar = NULL, $ref_cod_rota_transporte_escolar = NULL, | |
| 265 | + $seq = NULL , $ref_cod_veiculo = NULL, $tipo = NULL, $ref_cod_ponto_transporte_escolar = NULL) | |
| 266 | + { | |
| 267 | + $sql = "SELECT {$this->_campos_lista}, | |
| 268 | + (SELECT descricao | |
| 269 | + FROM modules.ponto_transporte_escolar | |
| 270 | + WHERE ref_cod_ponto_transporte_escolar = cod_ponto_transporte_escolar) as descricao, | |
| 271 | + (SELECT descricao || ', Placa: ' || placa | |
| 272 | + FROM modules.veiculo | |
| 273 | + WHERE ref_cod_veiculo = cod_veiculo) as nome_onibus FROM {$this->_tabela}"; | |
| 274 | + $filtros = ""; | |
| 275 | + | |
| 276 | + $whereAnd = " WHERE "; | |
| 277 | + | |
| 278 | + if (is_numeric($cod_itinerario_transporte_escolar)) { | |
| 279 | + $filtros .= "{$whereAnd} cod_itinerario_transporte_escolar = '{$cod_itinerario_transporte_escolar}'"; | |
| 280 | + $whereAnd = " AND "; | |
| 281 | + } | |
| 282 | + | |
| 283 | + if (is_numeric($ref_cod_rota_transporte_escolar)) { | |
| 284 | + $filtros .= "{$whereAnd} ref_cod_rota_transporte_escolar = '{$ref_cod_rota_transporte_escolar}'"; | |
| 285 | + $whereAnd = " AND "; | |
| 286 | + } | |
| 287 | + | |
| 288 | + if (is_numeric($seq)) { | |
| 289 | + $filtros .= "{$whereAnd} seq = '{$seq}'"; | |
| 290 | + $whereAnd = " AND "; | |
| 291 | + } | |
| 292 | + if (is_numeric($ref_cod_veiculo)){ | |
| 293 | + $filtros .= "{$whereAnd} ref_cod_veiculo = '{$ref_cod_veiculo}'"; | |
| 294 | + $whereAnd = " AND "; | |
| 295 | + } | |
| 296 | + | |
| 297 | + if (is_string($tipo)){ | |
| 298 | + $filtros .= "{$whereAnd} tipo = '{$tipo}'"; | |
| 299 | + $whereAnd = " AND "; | |
| 300 | + } | |
| 301 | + | |
| 302 | + if (is_numeric($ref_cod_ponto_transporte_escolar)){ | |
| 303 | + $filtros .= "{$whereAnd} ref_cod_ponto_transporte_escolar = '{$ref_cod_ponto_transporte_escolar}'"; | |
| 304 | + $whereAnd = " AND "; | |
| 305 | + } | |
| 306 | + | |
| 307 | + $db = new clsBanco(); | |
| 308 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 309 | + $resultado = array(); | |
| 310 | + | |
| 311 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
| 312 | + | |
| 313 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 314 | + | |
| 315 | + $db->Consulta($sql); | |
| 316 | + | |
| 317 | + if ($countCampos > 1) { | |
| 318 | + while ($db->ProximoRegistro()) { | |
| 319 | + $tupla = $db->Tupla(); | |
| 320 | + $tupla["_total"] = $this->_total; | |
| 321 | + $resultado[] = $tupla; | |
| 322 | + } | |
| 323 | + } | |
| 324 | + else { | |
| 325 | + while ($db->ProximoRegistro()) { | |
| 326 | + $tupla = $db->Tupla(); | |
| 327 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 328 | + } | |
| 329 | + } | |
| 330 | + if (count($resultado)) { | |
| 331 | + return $resultado; | |
| 332 | + } | |
| 333 | + | |
| 334 | + return FALSE; | |
| 335 | + } | |
| 336 | + | |
| 337 | + | |
| 338 | + function listaPontos($ref_cod_rota_transporte_escolar = NULL) | |
| 339 | + { | |
| 340 | + $sql = "SELECT ref_cod_ponto_transporte_escolar, | |
| 341 | + (SELECT descricao | |
| 342 | + FROM modules.ponto_transporte_escolar | |
| 343 | + WHERE ref_cod_ponto_transporte_escolar = cod_ponto_transporte_escolar) as descricao, | |
| 344 | + (SELECT tipo | |
| 345 | + FROM modules.ponto_transporte_escolar | |
| 346 | + WHERE ref_cod_ponto_transporte_escolar = cod_ponto_transporte_escolar) as tipo FROM {$this->_tabela}"; | |
| 347 | + $filtros = ""; | |
| 348 | + | |
| 349 | + $whereAnd = " WHERE "; | |
| 350 | + | |
| 351 | + if (is_numeric($ref_cod_rota_transporte_escolar)) { | |
| 352 | + $filtros .= "{$whereAnd} ref_cod_rota_transporte_escolar = '{$ref_cod_rota_transporte_escolar}'"; | |
| 353 | + $whereAnd = " AND "; | |
| 354 | + } | |
| 355 | + | |
| 356 | + $db = new clsBanco(); | |
| 357 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 358 | + $resultado = array(); | |
| 359 | + | |
| 360 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
| 361 | + | |
| 362 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 363 | + | |
| 364 | + $db->Consulta($sql); | |
| 365 | + | |
| 366 | + if ($countCampos > 1) { | |
| 367 | + while ($db->ProximoRegistro()) { | |
| 368 | + $tupla = $db->Tupla(); | |
| 369 | + $tupla["_total"] = $this->_total; | |
| 370 | + $resultado[] = $tupla; | |
| 371 | + } | |
| 372 | + } | |
| 373 | + else { | |
| 374 | + while ($db->ProximoRegistro()) { | |
| 375 | + $tupla = $db->Tupla(); | |
| 376 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 377 | + } | |
| 378 | + } | |
| 379 | + if (count($resultado)) { | |
| 380 | + return $resultado; | |
| 381 | + } | |
| 382 | + | |
| 383 | + return FALSE; | |
| 384 | + } | |
| 385 | + | |
| 386 | + /** | |
| 387 | + * Retorna um array com os dados de um registro. | |
| 388 | + * @return array | |
| 389 | + */ | |
| 390 | + function detalhe() | |
| 391 | + { | |
| 392 | + if (is_numeric($this->cod_rota_transporte_escolar)) { | |
| 393 | + $db = new clsBanco(); | |
| 394 | + $db->Consulta("SELECT {$this->_todos_campos}, ( | |
| 395 | + SELECT | |
| 396 | + nome | |
| 397 | + FROM | |
| 398 | + cadastro.pessoa | |
| 399 | + WHERE | |
| 400 | + idpes = ref_idpes_destino | |
| 401 | + ) AS nome_destino , ( | |
| 402 | + SELECT | |
| 403 | + nome | |
| 404 | + FROM | |
| 405 | + cadastro.pessoa, modules.empresa_transporte_escolar | |
| 406 | + WHERE | |
| 407 | + idpes = ref_idpes and cod_empresa_transporte_escolar = ref_cod_empresa_transporte_escolar | |
| 408 | + ) AS nome_empresa FROM {$this->_tabela} WHERE cod_rota_transporte_escolar = '{$this->cod_rota_transporte_escolar}'"); | |
| 409 | + $db->ProximoRegistro(); | |
| 410 | + return $db->Tupla(); | |
| 411 | + } | |
| 412 | + return FALSE; | |
| 413 | + } | |
| 414 | + | |
| 415 | + /** | |
| 416 | + * Retorna um array com os dados de um registro. | |
| 417 | + * @return array | |
| 418 | + */ | |
| 419 | + function existe() | |
| 420 | + { | |
| 421 | + if (is_numeric($this->cod_rota_transporte_escolar)) { | |
| 422 | + $db = new clsBanco(); | |
| 423 | + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_rota_transporte_escolar = '{$this->cod_rota_transporte_escolar}'"); | |
| 424 | + $db->ProximoRegistro(); | |
| 425 | + return $db->Tupla(); | |
| 426 | + } | |
| 427 | + | |
| 428 | + return FALSE; | |
| 429 | + } | |
| 430 | + | |
| 431 | + /** | |
| 432 | + * Exclui um registro. | |
| 433 | + * @return bool | |
| 434 | + */ | |
| 435 | + function excluir() | |
| 436 | + { | |
| 437 | + if (is_numeric($this->cod_rota_transporte_escolar)) { | |
| 438 | + $sql = "DELETE FROM {$this->_tabela} WHERE ref_cod_rota_transporte_escolar = '{$this->ref_cod_rota_transporte_escolar}'"; | |
| 439 | + $db = new clsBanco(); | |
| 440 | + $db->Consulta($sql); | |
| 441 | + return true; | |
| 442 | + } | |
| 443 | + | |
| 444 | + return FALSE; | |
| 445 | + } | |
| 446 | + | |
| 447 | + /** | |
| 448 | + * Exclui todos registros. | |
| 449 | + * @return bool | |
| 450 | + */ | |
| 451 | + function excluirTodos($ref_cod_rota_transporte_escolar) | |
| 452 | + { | |
| 453 | + if (is_numeric($ref_cod_rota_transporte_escolar)) { | |
| 454 | + $sql = "DELETE FROM {$this->_tabela} WHERE ref_cod_rota_transporte_escolar = '{$ref_cod_rota_transporte_escolar}'"; | |
| 455 | + $db = new clsBanco(); | |
| 456 | + $db->Consulta($sql); | |
| 457 | + return true; | |
| 458 | + } | |
| 459 | + | |
| 460 | + return FALSE; | |
| 461 | + } | |
| 462 | + | |
| 463 | + function checktime($time) | |
| 464 | + { | |
| 465 | + list($hour,$minute) = explode(':',$time); | |
| 466 | + | |
| 467 | + if ($hour > -1 && $hour < 24 && $minute > -1 && $minute < 60 && is_numeric($hour) && is_numeric($minute)) | |
| 468 | + { | |
| 469 | + return true; | |
| 470 | + } else | |
| 471 | + return false; | |
| 472 | + } | |
| 473 | + | |
| 474 | + /** | |
| 475 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
| 476 | + */ | |
| 477 | + function setCamposLista($str_campos) | |
| 478 | + { | |
| 479 | + $this->_campos_lista = $str_campos; | |
| 480 | + } | |
| 481 | + | |
| 482 | + /** | |
| 483 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
| 484 | + */ | |
| 485 | + function resetCamposLista() | |
| 486 | + { | |
| 487 | + $this->_campos_lista = $this->_todos_campos; | |
| 488 | + } | |
| 489 | + | |
| 490 | + /** | |
| 491 | + * Define limites de retorno para o método Lista(). | |
| 492 | + */ | |
| 493 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
| 494 | + { | |
| 495 | + $this->_limite_quantidade = $intLimiteQtd; | |
| 496 | + $this->_limite_offset = $intLimiteOffset; | |
| 497 | + } | |
| 498 | + | |
| 499 | + /** | |
| 500 | + * Retorna a string com o trecho da query responsável pelo limite de | |
| 501 | + * registros retornados/afetados. | |
| 502 | + * | |
| 503 | + * @return string | |
| 504 | + */ | |
| 505 | + function getLimite() | |
| 506 | + { | |
| 507 | + if (is_numeric($this->_limite_quantidade)) { | |
| 508 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
| 509 | + if (is_numeric($this->_limite_offset)) { | |
| 510 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
| 511 | + } | |
| 512 | + return $retorno; | |
| 513 | + } | |
| 514 | + return ''; | |
| 515 | + } | |
| 516 | + | |
| 517 | + /** | |
| 518 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
| 519 | + */ | |
| 520 | + function setOrderby($strNomeCampo) | |
| 521 | + { | |
| 522 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
| 523 | + $this->_campo_order_by = $strNomeCampo; | |
| 524 | + } | |
| 525 | + } | |
| 526 | + | |
| 527 | + /** | |
| 528 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
| 529 | + * registros. | |
| 530 | + * | |
| 531 | + * @return string | |
| 532 | + */ | |
| 533 | + function getOrderby() | |
| 534 | + { | |
| 535 | + if (is_string($this->_campo_order_by)) { | |
| 536 | + return " ORDER BY {$this->_campo_order_by} "; | |
| 537 | + } | |
| 538 | + return ''; | |
| 539 | + } | |
| 540 | +} | |
| 0 | 541 | \ No newline at end of file | ... | ... |
ieducar/intranet/include/modules/clsModulesMotorista.inc.php
0 → 100644
| ... | ... | @@ -0,0 +1,481 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | + | |
| 30 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * clsModulesMotorista class. | |
| 34 | + * | |
| 35 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 36 | + * @category i-Educar | |
| 37 | + * @license @@license@@ | |
| 38 | + * @package Module | |
| 39 | + * @since 07/2013 | |
| 40 | + * @version @@package_version@@ | |
| 41 | + */ | |
| 42 | +class clsModulesMotorista | |
| 43 | +{ | |
| 44 | + var $cod_motorista; | |
| 45 | + var $ref_idpes; | |
| 46 | + var $cnh; | |
| 47 | + var $tipo_cnh; | |
| 48 | + var $dt_habilitacao; | |
| 49 | + var $vencimento_cnh; | |
| 50 | + var $ref_cod_empresa_transporte_escolar; | |
| 51 | + var $observacao; | |
| 52 | + /** | |
| 53 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
| 54 | + * @var int | |
| 55 | + */ | |
| 56 | + var $_total; | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * Nome do schema. | |
| 60 | + * @var string | |
| 61 | + */ | |
| 62 | + var $_schema; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * Nome da tabela. | |
| 66 | + * @var string | |
| 67 | + */ | |
| 68 | + var $_tabela; | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
| 72 | + * próxima chamado ao método lista(). | |
| 73 | + * @var string | |
| 74 | + */ | |
| 75 | + var $_campos_lista; | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
| 79 | + * seleção no método lista. | |
| 80 | + * @var string | |
| 81 | + */ | |
| 82 | + var $_todos_campos; | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
| 86 | + * @var int | |
| 87 | + */ | |
| 88 | + var $_limite_quantidade; | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * Define o valor de offset no retorno dos registros no método lista(). | |
| 92 | + * @var int | |
| 93 | + */ | |
| 94 | + var $_limite_offset; | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
| 98 | + * @var string | |
| 99 | + */ | |
| 100 | + var $_campo_order_by; | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * Construtor. | |
| 104 | + */ | |
| 105 | + function clsModulesMotorista( $cod_motorista = NULL, $ref_idpes = NULL, $cnh = NULL, | |
| 106 | + $tipo_cnh = NULL, $dt_habilitacao = NULL, $vencimento_cnh = NULL, $ref_cod_empresa_transporte_escolar = NULL, | |
| 107 | + $observacao = NULL) | |
| 108 | + { | |
| 109 | + $db = new clsBanco(); | |
| 110 | + $this->_schema = "modules."; | |
| 111 | + $this->_tabela = "{$this->_schema}motorista"; | |
| 112 | + | |
| 113 | + $this->_campos_lista = $this->_todos_campos = " cod_motorista, ref_idpes, cnh, tipo_cnh, dt_habilitacao, vencimento_cnh, ref_cod_empresa_transporte_escolar, | |
| 114 | + observacao"; | |
| 115 | + | |
| 116 | + if (is_numeric($cod_motorista)) { | |
| 117 | + $this->cod_motorista = $cod_motorista; | |
| 118 | + } | |
| 119 | + | |
| 120 | + if (is_numeric($ref_idpes)) { | |
| 121 | + $this->ref_idpes = $ref_idpes; | |
| 122 | + } | |
| 123 | + | |
| 124 | + if (is_string($cnh)) { | |
| 125 | + $this->cnh = $cnh; | |
| 126 | + } | |
| 127 | + | |
| 128 | + if (is_string($tipo_cnh)) { | |
| 129 | + $this->tipo_cnh = $tipo_cnh; | |
| 130 | + } | |
| 131 | + | |
| 132 | + if (is_string($dt_habilitacao)) { | |
| 133 | + $this->dt_habilitacao = $dt_habilitacao; | |
| 134 | + } | |
| 135 | + | |
| 136 | + if (is_string($vencimento_cnh)) { | |
| 137 | + $this->vencimento_cnh = $vencimento_cnh; | |
| 138 | + } | |
| 139 | + | |
| 140 | + if (is_numeric($ref_cod_empresa_transporte_escolar)) { | |
| 141 | + $this->ref_cod_empresa_transporte_escolar = $ref_cod_empresa_transporte_escolar; | |
| 142 | + } | |
| 143 | + | |
| 144 | + if (is_string($observacao)) { | |
| 145 | + $this->observacao = $observacao; | |
| 146 | + } | |
| 147 | + | |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * Cria um novo registro. | |
| 152 | + * @return bool | |
| 153 | + */ | |
| 154 | + function cadastra() | |
| 155 | + { | |
| 156 | + | |
| 157 | + if (is_string($this->cnh) && is_string($this->tipo_cnh) && is_numeric($this->ref_cod_empresa_transporte_escolar) | |
| 158 | + && is_numeric($this->ref_idpes) ) | |
| 159 | + { | |
| 160 | + | |
| 161 | + $db = new clsBanco(); | |
| 162 | + $campos = ''; | |
| 163 | + $valores = ''; | |
| 164 | + $gruda = ''; | |
| 165 | + | |
| 166 | + if (is_numeric($this->cod_motorista)) { | |
| 167 | + $campos .= "{$gruda}cod_motorista"; | |
| 168 | + $valores .= "{$gruda}'{$this->cod_motorista}'"; | |
| 169 | + $gruda = ", "; | |
| 170 | + } | |
| 171 | + | |
| 172 | + if (is_numeric($this->ref_idpes)) { | |
| 173 | + $campos .= "{$gruda}ref_idpes"; | |
| 174 | + $valores .= "{$gruda}'{$this->ref_idpes}'"; | |
| 175 | + $gruda = ", "; | |
| 176 | + } | |
| 177 | + | |
| 178 | + if (is_string($this->cnh)) { | |
| 179 | + $campos .= "{$gruda}cnh"; | |
| 180 | + $valores .= "{$gruda}'{$this->cnh}'"; | |
| 181 | + $gruda = ", "; | |
| 182 | + } | |
| 183 | + | |
| 184 | + if (is_string($this->tipo_cnh)) { | |
| 185 | + $campos .= "{$gruda}tipo_cnh"; | |
| 186 | + $valores .= "{$gruda}'{$this->tipo_cnh}'"; | |
| 187 | + $gruda = ", "; | |
| 188 | + } | |
| 189 | + | |
| 190 | + if (is_string($this->dt_habilitacao) && trim($this->dt_habilitacao)!='') { | |
| 191 | + $campos .= "{$gruda}dt_habilitacao"; | |
| 192 | + $valores .= "{$gruda}'{$this->dt_habilitacao}'"; | |
| 193 | + $gruda = ", "; | |
| 194 | + } | |
| 195 | + | |
| 196 | + if (is_string($this->vencimento_cnh) && trim($this->vencimento_cnh)!='') { | |
| 197 | + $campos .= "{$gruda}vencimento_cnh"; | |
| 198 | + $valores .= "{$gruda}'{$this->vencimento_cnh}'"; | |
| 199 | + $gruda = ", "; | |
| 200 | + } | |
| 201 | + | |
| 202 | + if (is_numeric($this->ref_cod_empresa_transporte_escolar)) { | |
| 203 | + $campos .= "{$gruda}ref_cod_empresa_transporte_escolar"; | |
| 204 | + $valores .= "{$gruda}'{$this->ref_cod_empresa_transporte_escolar}'"; | |
| 205 | + $gruda = ", "; | |
| 206 | + } | |
| 207 | + | |
| 208 | + if (is_string($this->observacao)) { | |
| 209 | + $campos .= "{$gruda}observacao"; | |
| 210 | + $valores .= "{$gruda}'{$this->observacao}'"; | |
| 211 | + $gruda = ", "; | |
| 212 | + } | |
| 213 | + | |
| 214 | + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); | |
| 215 | + return $db->InsertId("{$this->_tabela}_seq"); | |
| 216 | + } | |
| 217 | + | |
| 218 | + return FALSE; | |
| 219 | + } | |
| 220 | + | |
| 221 | + /** | |
| 222 | + * Edita os dados de um registro. | |
| 223 | + * @return bool | |
| 224 | + */ | |
| 225 | + function edita() | |
| 226 | + { | |
| 227 | + | |
| 228 | + if (is_numeric($this->cod_motorista)) { | |
| 229 | + | |
| 230 | + $db = new clsBanco(); | |
| 231 | + $set = ''; | |
| 232 | + | |
| 233 | + if (is_numeric($this->cod_motorista)) { | |
| 234 | + $set .= "{$gruda}cod_motorista = '{$this->cod_motorista}'"; | |
| 235 | + $gruda = ", "; | |
| 236 | + } | |
| 237 | + | |
| 238 | + if (is_numeric($this->ref_idpes)) { | |
| 239 | + $set .= "{$gruda}ref_idpes = '{$this->ref_idpes}'"; | |
| 240 | + $gruda = ", "; | |
| 241 | + } | |
| 242 | + | |
| 243 | + if (is_string($this->cnh)) { | |
| 244 | + $set .= "{$gruda}cnh = '{$this->cnh}'"; | |
| 245 | + $gruda = ", "; | |
| 246 | + } | |
| 247 | + | |
| 248 | + if (is_string($this->tipo_cnh)) { | |
| 249 | + $set .= "{$gruda}tipo_cnh = '{$this->tipo_cnh}'"; | |
| 250 | + $gruda = ", "; | |
| 251 | + } | |
| 252 | + | |
| 253 | + if (is_string($this->dt_habilitacao) && trim($this->dt_habilitacao)!='') { | |
| 254 | + | |
| 255 | + $set .= "{$gruda}dt_habilitacao = '{$this->dt_habilitacao}'"; | |
| 256 | + $gruda = ", "; | |
| 257 | + } | |
| 258 | + | |
| 259 | + if (is_string($this->vencimento_cnh) && trim($this->vencimento_cnh)!='') { | |
| 260 | + $set .= "{$gruda}vencimento_cnh = '{$this->vencimento_cnh}'"; | |
| 261 | + $gruda = ", "; | |
| 262 | + } | |
| 263 | + | |
| 264 | + if (is_numeric($this->ref_cod_empresa_transporte_escolar)) { | |
| 265 | + $set .= "{$gruda}ref_cod_empresa_transporte_escolar = '{$this->ref_cod_empresa_transporte_escolar}'"; | |
| 266 | + $gruda = ", "; | |
| 267 | + } | |
| 268 | + | |
| 269 | + if (is_string($this->observacao)) { | |
| 270 | + $set .= "{$gruda}observacao = '{$this->observacao}'"; | |
| 271 | + $gruda = ", "; | |
| 272 | + } | |
| 273 | + | |
| 274 | + if ($set) { | |
| 275 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_motorista = '{$this->cod_motorista}'"); | |
| 276 | + return TRUE; | |
| 277 | + } | |
| 278 | + } | |
| 279 | + | |
| 280 | + return FALSE; | |
| 281 | + } | |
| 282 | + | |
| 283 | + /** | |
| 284 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
| 285 | + * @return array | |
| 286 | + */ | |
| 287 | + function lista($cod_motorista = NULL, $nome_motorista = NULL, | |
| 288 | + $cnh = NULL, $tipo_cnh = NULL, | |
| 289 | + $ref_cod_empresa_transporte_escolar = NULL) | |
| 290 | + { | |
| 291 | + | |
| 292 | + $sql = "SELECT {$this->_campos_lista}, ( | |
| 293 | + SELECT | |
| 294 | + nome | |
| 295 | + FROM | |
| 296 | + modules.empresa_transporte_escolar emp,cadastro.pessoa p | |
| 297 | + WHERE | |
| 298 | + ref_cod_empresa_transporte_escolar = cod_empresa_transporte_escolar AND p.idpes = emp.ref_idpes | |
| 299 | + ) AS nome_empresa , (SELECT nome FROM cadastro.pessoa WHERE idpes = ref_idpes) AS nome_motorista FROM {$this->_tabela}"; | |
| 300 | + $filtros = ""; | |
| 301 | + | |
| 302 | + $whereAnd = " WHERE "; | |
| 303 | + if (is_numeric($cod_motorista)) { | |
| 304 | + $filtros .= "{$whereAnd} cod_motorista = '{$cod_motorista}'"; | |
| 305 | + $whereAnd = " AND "; | |
| 306 | + } | |
| 307 | + | |
| 308 | + if (is_string($nome_motorista)) { | |
| 309 | + $filtros .= " | |
| 310 | + {$whereAnd} TO_ASCII(LOWER((SELECT nome FROM cadastro.pessoa WHERE idpes = ref_idpes))) LIKE TO_ASCII(LOWER('%{$nome_motorista}%')) "; | |
| 311 | + | |
| 312 | + $whereAnd = ' AND '; | |
| 313 | + } | |
| 314 | + | |
| 315 | + if (is_string($cnh)) { | |
| 316 | + $filtros .= "{$whereAnd} cnh = '{$cnh}'"; | |
| 317 | + $whereAnd = " AND "; | |
| 318 | + } | |
| 319 | + | |
| 320 | + if (is_string($tipo_cnh)) { | |
| 321 | + $filtros .= "{$whereAnd} tipo_cnh = '{$tipo_cnh}'"; | |
| 322 | + $whereAnd = " AND "; | |
| 323 | + } | |
| 324 | + | |
| 325 | + if (is_numeric($ref_cod_empresa_transporte_escolar)) { | |
| 326 | + $filtros .= "{$whereAnd} ref_cod_empresa_transporte_escolar = '{$ref_cod_empresa_transporte_escolar}'"; | |
| 327 | + $whereAnd = " AND "; | |
| 328 | + } | |
| 329 | + | |
| 330 | + $db = new clsBanco(); | |
| 331 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 332 | + $resultado = array(); | |
| 333 | + | |
| 334 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
| 335 | + | |
| 336 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 337 | + | |
| 338 | + $db->Consulta($sql); | |
| 339 | + | |
| 340 | + if ($countCampos > 1) { | |
| 341 | + while ($db->ProximoRegistro()) { | |
| 342 | + $tupla = $db->Tupla(); | |
| 343 | + $tupla["_total"] = $this->_total; | |
| 344 | + $resultado[] = $tupla; | |
| 345 | + } | |
| 346 | + } | |
| 347 | + else { | |
| 348 | + while ($db->ProximoRegistro()) { | |
| 349 | + $tupla = $db->Tupla(); | |
| 350 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 351 | + } | |
| 352 | + } | |
| 353 | + if (count($resultado)) { | |
| 354 | + return $resultado; | |
| 355 | + } | |
| 356 | + | |
| 357 | + return FALSE; | |
| 358 | + } | |
| 359 | + | |
| 360 | + /** | |
| 361 | + * Retorna um array com os dados de um registro. | |
| 362 | + * @return array | |
| 363 | + */ | |
| 364 | + function detalhe() | |
| 365 | + { | |
| 366 | + | |
| 367 | + if (is_numeric($this->cod_motorista)) { | |
| 368 | + $db = new clsBanco(); | |
| 369 | + $db->Consulta("SELECT {$this->_todos_campos}, ( | |
| 370 | + SELECT | |
| 371 | + nome | |
| 372 | + FROM | |
| 373 | + modules.empresa_transporte_escolar emp,cadastro.pessoa p | |
| 374 | + WHERE | |
| 375 | + ref_cod_empresa_transporte_escolar = cod_empresa_transporte_escolar AND p.idpes = emp.ref_idpes | |
| 376 | + ) AS nome_empresa , (SELECT nome FROM cadastro.pessoa WHERE idpes = ref_idpes) AS nome_motorista FROM {$this->_tabela} WHERE cod_motorista = '{$this->cod_motorista}'"); | |
| 377 | + $db->ProximoRegistro(); | |
| 378 | + return $db->Tupla(); | |
| 379 | + } | |
| 380 | + | |
| 381 | + return FALSE; | |
| 382 | + } | |
| 383 | + | |
| 384 | + /** | |
| 385 | + * Retorna um array com os dados de um registro. | |
| 386 | + * @return array | |
| 387 | + */ | |
| 388 | + function existe() | |
| 389 | + { | |
| 390 | + if (is_numeric($this->cod_motorista)) { | |
| 391 | + $db = new clsBanco(); | |
| 392 | + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_motorista = '{$this->cod_motorista}'"); | |
| 393 | + $db->ProximoRegistro(); | |
| 394 | + return $db->Tupla(); | |
| 395 | + } | |
| 396 | + return FALSE; | |
| 397 | + } | |
| 398 | + | |
| 399 | + /** | |
| 400 | + * Exclui um registro. | |
| 401 | + * @return bool | |
| 402 | + */ | |
| 403 | + function excluir() | |
| 404 | + { | |
| 405 | + | |
| 406 | + if (is_numeric($this->cod_motorista)) { | |
| 407 | + $sql = "DELETE FROM {$this->_tabela} WHERE cod_motorista = '{$this->cod_motorista}'"; | |
| 408 | + $db = new clsBanco(); | |
| 409 | + $db->Consulta($sql); | |
| 410 | + return true; | |
| 411 | + } | |
| 412 | + return FALSE; | |
| 413 | + } | |
| 414 | + | |
| 415 | + /** | |
| 416 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
| 417 | + */ | |
| 418 | + function setCamposLista($str_campos) | |
| 419 | + { | |
| 420 | + $this->_campos_lista = $str_campos; | |
| 421 | + } | |
| 422 | + | |
| 423 | + /** | |
| 424 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
| 425 | + */ | |
| 426 | + function resetCamposLista() | |
| 427 | + { | |
| 428 | + $this->_campos_lista = $this->_todos_campos; | |
| 429 | + } | |
| 430 | + | |
| 431 | + /** | |
| 432 | + * Define limites de retorno para o método Lista(). | |
| 433 | + */ | |
| 434 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
| 435 | + { | |
| 436 | + $this->_limite_quantidade = $intLimiteQtd; | |
| 437 | + $this->_limite_offset = $intLimiteOffset; | |
| 438 | + } | |
| 439 | + | |
| 440 | + /** | |
| 441 | + * Retorna a string com o trecho da query responsável pelo limite de | |
| 442 | + * registros retornados/afetados. | |
| 443 | + * | |
| 444 | + * @return string | |
| 445 | + */ | |
| 446 | + function getLimite() | |
| 447 | + { | |
| 448 | + if (is_numeric($this->_limite_quantidade)) { | |
| 449 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
| 450 | + if (is_numeric($this->_limite_offset)) { | |
| 451 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
| 452 | + } | |
| 453 | + return $retorno; | |
| 454 | + } | |
| 455 | + return ''; | |
| 456 | + } | |
| 457 | + | |
| 458 | + /** | |
| 459 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
| 460 | + */ | |
| 461 | + function setOrderby($strNomeCampo) | |
| 462 | + { | |
| 463 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
| 464 | + $this->_campo_order_by = $strNomeCampo; | |
| 465 | + } | |
| 466 | + } | |
| 467 | + | |
| 468 | + /** | |
| 469 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
| 470 | + * registros. | |
| 471 | + * | |
| 472 | + * @return string | |
| 473 | + */ | |
| 474 | + function getOrderby() | |
| 475 | + { | |
| 476 | + if (is_string($this->_campo_order_by)) { | |
| 477 | + return " ORDER BY {$this->_campo_order_by} "; | |
| 478 | + } | |
| 479 | + return ''; | |
| 480 | + } | |
| 481 | +} | |
| 0 | 482 | \ No newline at end of file | ... | ... |
ieducar/intranet/include/modules/clsModulesPessoaTransporte.inc.php
0 → 100644
| ... | ... | @@ -0,0 +1,529 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | + | |
| 30 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 31 | + | |
| 32 | +/** | |
| 33 | + * clsModulesPessoaTransporte class. | |
| 34 | + * | |
| 35 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 36 | + * @category i-Educar | |
| 37 | + * @license @@license@@ | |
| 38 | + * @package Module | |
| 39 | + * @since 07/2013 | |
| 40 | + * @version @@package_version@@ | |
| 41 | + */ | |
| 42 | +class clsModulesPessoaTransporte | |
| 43 | +{ | |
| 44 | + var $cod_pessoa_transporte; | |
| 45 | + var $ref_idpes; | |
| 46 | + var $ref_cod_rota_transporte_escolar; | |
| 47 | + var $ref_cod_ponto_transporte_escolar; | |
| 48 | + var $ref_idpes_destino; | |
| 49 | + var $observacao; | |
| 50 | + /** | |
| 51 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
| 52 | + * @var int | |
| 53 | + */ | |
| 54 | + var $_total; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * Nome do schema. | |
| 58 | + * @var string | |
| 59 | + */ | |
| 60 | + var $_schema; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Nome da tabela. | |
| 64 | + * @var string | |
| 65 | + */ | |
| 66 | + var $_tabela; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
| 70 | + * próxima chamado ao método lista(). | |
| 71 | + * @var string | |
| 72 | + */ | |
| 73 | + var $_campos_lista; | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
| 77 | + * seleção no método lista. | |
| 78 | + * @var string | |
| 79 | + */ | |
| 80 | + var $_todos_campos; | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
| 84 | + * @var int | |
| 85 | + */ | |
| 86 | + var $_limite_quantidade; | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * Define o valor de offset no retorno dos registros no método lista(). | |
| 90 | + * @var int | |
| 91 | + */ | |
| 92 | + var $_limite_offset; | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
| 96 | + * @var string | |
| 97 | + */ | |
| 98 | + var $_campo_order_by; | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * Construtor. | |
| 102 | + */ | |
| 103 | + function clsModulesPessoaTransporte( $cod_pessoa_transporte = NULL, $ref_cod_rota_transporte_escolar = NULL, | |
| 104 | + $ref_idpes = null ,$ref_cod_ponto_transporte_escolar = NULL, $ref_idpes_destino = NULL, | |
| 105 | + $observacao = NULL) | |
| 106 | + { | |
| 107 | + $db = new clsBanco(); | |
| 108 | + $this->_schema = "modules."; | |
| 109 | + $this->_tabela = "{$this->_schema}pessoa_transporte"; | |
| 110 | + | |
| 111 | + $this->_campos_lista = $this->_todos_campos = "cod_pessoa_transporte, ref_cod_rota_transporte_escolar, | |
| 112 | + ref_idpes, ref_cod_ponto_transporte_escolar, ref_idpes_destino, observacao"; | |
| 113 | + | |
| 114 | + if (is_numeric($cod_pessoa_transporte)) { | |
| 115 | + $this->cod_pessoa_transporte = $cod_pessoa_transporte; | |
| 116 | + } | |
| 117 | + | |
| 118 | + if (is_numeric($ref_cod_rota_transporte_escolar)) { | |
| 119 | + $this->ref_idpes = $ref_idpes; | |
| 120 | + } | |
| 121 | + | |
| 122 | + if (is_numeric($ref_idpes)) { | |
| 123 | + $this->ref_idpes = $ref_idpes; | |
| 124 | + } | |
| 125 | + | |
| 126 | + if (is_numeric($ref_cod_ponto_transporte_escolar)) { | |
| 127 | + $this->ref_cod_ponto_transporte_escolar = $ref_cod_ponto_transporte_escolar; | |
| 128 | + } | |
| 129 | + | |
| 130 | + if (is_numeric($ref_idpes_destino)) { | |
| 131 | + $this->ref_idpes_destino = $ref_idpes_destino; | |
| 132 | + } | |
| 133 | + | |
| 134 | + if (is_string($observacao)) { | |
| 135 | + $this->observacao = $observacao; | |
| 136 | + } | |
| 137 | + | |
| 138 | + } | |
| 139 | + | |
| 140 | + /** | |
| 141 | + * Cria um novo registro. | |
| 142 | + * @return bool | |
| 143 | + */ | |
| 144 | + function cadastra() | |
| 145 | + { | |
| 146 | + | |
| 147 | + if (is_numeric($this->ref_idpes) && is_numeric($this->ref_cod_rota_transporte_escolar)) | |
| 148 | + { | |
| 149 | + | |
| 150 | + $db = new clsBanco(); | |
| 151 | + $campos = ''; | |
| 152 | + $valores = ''; | |
| 153 | + $gruda = ''; | |
| 154 | + | |
| 155 | + if (is_numeric($this->cod_pessoa_transporte)) { | |
| 156 | + $campos .= "{$gruda}cod_pessoa_transporte"; | |
| 157 | + $valores .= "{$gruda}'{$this->cod_pessoa_transporte}'"; | |
| 158 | + $gruda = ", "; | |
| 159 | + } | |
| 160 | + | |
| 161 | + if (is_numeric($this->ref_cod_rota_transporte_escolar)) { | |
| 162 | + $campos .= "{$gruda}ref_cod_rota_transporte_escolar"; | |
| 163 | + $valores .= "{$gruda}'{$this->ref_cod_rota_transporte_escolar}'"; | |
| 164 | + $gruda = ", "; | |
| 165 | + } | |
| 166 | + | |
| 167 | + if (is_numeric($this->ref_idpes)) { | |
| 168 | + $campos .= "{$gruda}ref_idpes"; | |
| 169 | + $valores .= "{$gruda}'{$this->ref_idpes}'"; | |
| 170 | + $gruda = ", "; | |
| 171 | + } | |
| 172 | + | |
| 173 | + if (is_numeric($this->ref_cod_ponto_transporte_escolar)) { | |
| 174 | + $campos .= "{$gruda}ref_cod_ponto_transporte_escolar"; | |
| 175 | + $valores .= "{$gruda}'{$this->ref_cod_ponto_transporte_escolar}'"; | |
| 176 | + $gruda = ", "; | |
| 177 | + } | |
| 178 | + | |
| 179 | + if (is_numeric($this->ref_idpes_destino)) { | |
| 180 | + $campos .= "{$gruda}ref_idpes_destino"; | |
| 181 | + $valores .= "{$gruda}'{$this->ref_idpes_destino}'"; | |
| 182 | + $gruda = ", "; | |
| 183 | + } | |
| 184 | + | |
| 185 | + if (is_string($this->observacao)) { | |
| 186 | + $campos .= "{$gruda}observacao"; | |
| 187 | + $valores .= "{$gruda}'{$this->observacao}'"; | |
| 188 | + $gruda = ", "; | |
| 189 | + } | |
| 190 | + | |
| 191 | + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); | |
| 192 | + return $db->InsertId("{$this->_tabela}_seq"); | |
| 193 | + } | |
| 194 | + | |
| 195 | + return FALSE; | |
| 196 | + } | |
| 197 | + | |
| 198 | + /** | |
| 199 | + * Edita os dados de um registro. | |
| 200 | + * @return bool | |
| 201 | + */ | |
| 202 | + function edita() | |
| 203 | + { | |
| 204 | + | |
| 205 | + if (is_numeric($this->cod_pessoa_transporte)) { | |
| 206 | + | |
| 207 | + $db = new clsBanco(); | |
| 208 | + $set = ''; | |
| 209 | + | |
| 210 | + if (is_numeric($this->ref_cod_rota_transporte_escolar)) { | |
| 211 | + $set .= "{$gruda}ref_cod_rota_transporte_escolar = '{$this->ref_cod_rota_transporte_escolar}'"; | |
| 212 | + $gruda = ", "; | |
| 213 | + } | |
| 214 | + | |
| 215 | + if (is_numeric($this->ref_idpes)) { | |
| 216 | + $set .= "{$gruda}ref_idpes = '{$this->ref_idpes}'"; | |
| 217 | + $gruda = ", "; | |
| 218 | + } | |
| 219 | + | |
| 220 | + if (is_numeric($this->ref_cod_ponto_transporte_escolar)) { | |
| 221 | + $set .= "{$gruda}ref_cod_ponto_transporte_escolar = '{$this->ref_cod_ponto_transporte_escolar}'"; | |
| 222 | + $gruda = ", "; | |
| 223 | + }else{ | |
| 224 | + $set .= "{$gruda}ref_cod_ponto_transporte_escolar = null"; | |
| 225 | + $gruda = ", "; | |
| 226 | + } | |
| 227 | + | |
| 228 | + if (is_numeric($this->ref_idpes_destino)) { | |
| 229 | + $set .= "{$gruda}ref_idpes_destino = '{$this->ref_idpes_destino}'"; | |
| 230 | + $gruda = ", "; | |
| 231 | + }else{ | |
| 232 | + $set .= "{$gruda}ref_idpes_destino = null"; | |
| 233 | + $gruda = ", "; | |
| 234 | + } | |
| 235 | + | |
| 236 | + if (is_string($this->observacao)) { | |
| 237 | + $set .= "{$gruda}observacao = '{$this->observacao}'"; | |
| 238 | + $gruda = ", "; | |
| 239 | + } | |
| 240 | + | |
| 241 | + if ($set) { | |
| 242 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_pessoa_transporte = '{$this->cod_pessoa_transporte}'"); | |
| 243 | + return TRUE; | |
| 244 | + } | |
| 245 | + } | |
| 246 | + | |
| 247 | + return FALSE; | |
| 248 | + } | |
| 249 | + | |
| 250 | + /** | |
| 251 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
| 252 | + * @return array | |
| 253 | + */ | |
| 254 | + function lista($cod_pessoa_transporte = NULL, $ref_idpes = NULL, | |
| 255 | + $ref_cod_rota_transporte_escolar = NULL, | |
| 256 | + $ref_cod_ponto_transporte_escolar = NULL, $ref_idpes_destino = NULL, $nome_pessoa = NULL, $nome_destino = NULL) | |
| 257 | + { | |
| 258 | + | |
| 259 | + $sql = "SELECT {$this->_campos_lista}, ( | |
| 260 | + SELECT | |
| 261 | + nome | |
| 262 | + FROM | |
| 263 | + cadastro.pessoa | |
| 264 | + WHERE | |
| 265 | + idpes = ref_idpes_destino | |
| 266 | + ) AS nome_destino, ( | |
| 267 | + SELECT | |
| 268 | + nome | |
| 269 | + FROM | |
| 270 | + cadastro.pessoa | |
| 271 | + WHERE | |
| 272 | + idpes = ref_idpes | |
| 273 | + ) AS nome_pessoa, ( | |
| 274 | + SELECT | |
| 275 | + descricao | |
| 276 | + FROM | |
| 277 | + modules.rota_transporte_escolar | |
| 278 | + WHERE | |
| 279 | + ref_cod_rota_transporte_escolar = cod_rota_transporte_escolar | |
| 280 | + ) AS nome_rota, ( | |
| 281 | + SELECT | |
| 282 | + descricao | |
| 283 | + FROM | |
| 284 | + modules.ponto_transporte_escolar | |
| 285 | + WHERE | |
| 286 | + ref_cod_ponto_transporte_escolar = cod_ponto_transporte_escolar | |
| 287 | + ) AS nome_ponto, ( | |
| 288 | + SELECT | |
| 289 | + nome | |
| 290 | + FROM | |
| 291 | + cadastro.pessoa p, modules.rota_transporte_escolar rt | |
| 292 | + WHERE | |
| 293 | + p.idpes = rt.ref_idpes_destino and ref_cod_rota_transporte_escolar = rt.cod_rota_transporte_escolar | |
| 294 | + ) AS nome_destino2 FROM {$this->_tabela}"; | |
| 295 | + $filtros = ""; | |
| 296 | + | |
| 297 | + $whereAnd = " WHERE "; | |
| 298 | + $whereNomes = ''; | |
| 299 | + if (is_numeric($cod_pessoa_transporte)) { | |
| 300 | + $filtros .= "{$whereAnd} cod_pessoa_transporte = '{$cod_pessoa_transporte}'"; | |
| 301 | + $whereAnd = " AND "; | |
| 302 | + } | |
| 303 | + | |
| 304 | + | |
| 305 | + if (is_numeric($ref_idpes)) { | |
| 306 | + $filtros .= "{$whereAnd} ref_idpes = '{$ref_idpes}'"; | |
| 307 | + $whereAnd = " AND "; | |
| 308 | + } | |
| 309 | + | |
| 310 | + if (is_numeric($ref_cod_rota_transporte_escolar)) { | |
| 311 | + $filtros .= "{$whereAnd} ref_cod_rota_transporte_escolar = '{$ref_cod_rota_transporte_escolar}'"; | |
| 312 | + $whereAnd = " AND "; | |
| 313 | + } | |
| 314 | + | |
| 315 | + if (is_numeric($ref_cod_ponto_transporte_escolar)) { | |
| 316 | + $filtros .= "{$whereAnd} ref_cod_ponto_transporte_escolar = '{$ref_cod_ponto_transporte_escolar}'"; | |
| 317 | + $whereAnd = " AND "; | |
| 318 | + } | |
| 319 | + | |
| 320 | + if (is_numeric($ref_idpes_destino)) { | |
| 321 | + $filtros .= "{$whereAnd} ref_idpes_destino = '{$ref_idpes_destino}'"; | |
| 322 | + $whereAnd = " AND "; | |
| 323 | + } | |
| 324 | + | |
| 325 | + if (is_string($nome_pessoa)) { | |
| 326 | + $filtros .= " | |
| 327 | + {$whereAnd} TO_ASCII(LOWER(( | |
| 328 | + SELECT | |
| 329 | + nome | |
| 330 | + FROM | |
| 331 | + cadastro.pessoa | |
| 332 | + WHERE | |
| 333 | + idpes = ref_idpes | |
| 334 | + ))) LIKE TO_ASCII(LOWER('%{$nome_pessoa}%')) "; | |
| 335 | + $whereAnd = " AND "; | |
| 336 | + } | |
| 337 | + | |
| 338 | + if (is_string($nome_destino)) { | |
| 339 | + $filtros .= " | |
| 340 | + {$whereAnd} TO_ASCII(LOWER(( | |
| 341 | + SELECT | |
| 342 | + nome | |
| 343 | + FROM | |
| 344 | + cadastro.pessoa | |
| 345 | + WHERE | |
| 346 | + idpes = ref_idpes_destino | |
| 347 | + ))) LIKE TO_ASCII(LOWER('%{$nome_destino}%')) "; | |
| 348 | + $whereAnd = " AND "; | |
| 349 | + } | |
| 350 | + | |
| 351 | + $db = new clsBanco(); | |
| 352 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 353 | + $resultado = array(); | |
| 354 | + | |
| 355 | + $sql .= $filtros . $whereNomes. $this->getOrderby() . $this->getLimite(); | |
| 356 | + | |
| 357 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 358 | + | |
| 359 | + $db->Consulta($sql); | |
| 360 | + | |
| 361 | + if ($countCampos > 1) { | |
| 362 | + while ($db->ProximoRegistro()) { | |
| 363 | + $tupla = $db->Tupla(); | |
| 364 | + $tupla["_total"] = $this->_total; | |
| 365 | + $resultado[] = $tupla; | |
| 366 | + } | |
| 367 | + } | |
| 368 | + else { | |
| 369 | + while ($db->ProximoRegistro()) { | |
| 370 | + $tupla = $db->Tupla(); | |
| 371 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 372 | + } | |
| 373 | + } | |
| 374 | + if (count($resultado)) { | |
| 375 | + return $resultado; | |
| 376 | + } | |
| 377 | + | |
| 378 | + return FALSE; | |
| 379 | + } | |
| 380 | + | |
| 381 | + /** | |
| 382 | + * Retorna um array com os dados de um registro. | |
| 383 | + * @return array | |
| 384 | + */ | |
| 385 | + function detalhe() | |
| 386 | + { | |
| 387 | + | |
| 388 | + if (is_numeric($this->cod_pessoa_transporte)) { | |
| 389 | + | |
| 390 | + $db = new clsBanco(); | |
| 391 | + $db->Consulta("SELECT {$this->_todos_campos}, ( | |
| 392 | + SELECT | |
| 393 | + nome | |
| 394 | + FROM | |
| 395 | + cadastro.pessoa | |
| 396 | + WHERE | |
| 397 | + idpes = ref_idpes_destino | |
| 398 | + ) AS nome_destino, ( | |
| 399 | + SELECT | |
| 400 | + nome | |
| 401 | + FROM | |
| 402 | + cadastro.pessoa | |
| 403 | + WHERE | |
| 404 | + idpes = ref_idpes | |
| 405 | + ) AS nome_pessoa, ( | |
| 406 | + SELECT | |
| 407 | + descricao | |
| 408 | + FROM | |
| 409 | + modules.rota_transporte_escolar | |
| 410 | + WHERE | |
| 411 | + ref_cod_rota_transporte_escolar = cod_rota_transporte_escolar | |
| 412 | + ) AS nome_rota, ( | |
| 413 | + SELECT | |
| 414 | + descricao | |
| 415 | + FROM | |
| 416 | + modules.ponto_transporte_escolar | |
| 417 | + WHERE | |
| 418 | + ref_cod_ponto_transporte_escolar = cod_ponto_transporte_escolar | |
| 419 | + ) AS nome_ponto, ( | |
| 420 | + SELECT | |
| 421 | + nome | |
| 422 | + FROM | |
| 423 | + cadastro.pessoa p, modules.rota_transporte_escolar rt | |
| 424 | + WHERE | |
| 425 | + p.idpes = rt.ref_idpes_destino and ref_cod_rota_transporte_escolar = rt.cod_rota_transporte_escolar | |
| 426 | + ) AS nome_destino2 FROM {$this->_tabela} WHERE cod_pessoa_transporte = '{$this->cod_pessoa_transporte}'"); | |
| 427 | + $db->ProximoRegistro(); | |
| 428 | + return $db->Tupla(); | |
| 429 | + } | |
| 430 | + return FALSE; | |
| 431 | + } | |
| 432 | + | |
| 433 | + /** | |
| 434 | + * Retorna um array com os dados de um registro. | |
| 435 | + * @return array | |
| 436 | + */ | |
| 437 | + function existe() | |
| 438 | + { | |
| 439 | + if (is_numeric($this->cod_pessoa_transporte)) { | |
| 440 | + $db = new clsBanco(); | |
| 441 | + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_pessoa_transporte = '{$this->cod_pessoa_transporte}'"); | |
| 442 | + $db->ProximoRegistro(); | |
| 443 | + return $db->Tupla(); | |
| 444 | + } | |
| 445 | + return FALSE; | |
| 446 | + } | |
| 447 | + | |
| 448 | + /** | |
| 449 | + * Exclui um registro. | |
| 450 | + * @return bool | |
| 451 | + */ | |
| 452 | + function excluir() | |
| 453 | + { | |
| 454 | + if (is_numeric($this->cod_pessoa_transporte)) { | |
| 455 | + $sql = "DELETE FROM {$this->_tabela} WHERE cod_pessoa_transporte = '{$this->cod_pessoa_transporte}'"; | |
| 456 | + $db = new clsBanco(); | |
| 457 | + $db->Consulta($sql); | |
| 458 | + return true; | |
| 459 | + } | |
| 460 | + return FALSE; | |
| 461 | + } | |
| 462 | + | |
| 463 | + /** | |
| 464 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
| 465 | + */ | |
| 466 | + function setCamposLista($str_campos) | |
| 467 | + { | |
| 468 | + $this->_campos_lista = $str_campos; | |
| 469 | + } | |
| 470 | + | |
| 471 | + /** | |
| 472 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
| 473 | + */ | |
| 474 | + function resetCamposLista() | |
| 475 | + { | |
| 476 | + $this->_campos_lista = $this->_todos_campos; | |
| 477 | + } | |
| 478 | + | |
| 479 | + /** | |
| 480 | + * Define limites de retorno para o método Lista(). | |
| 481 | + */ | |
| 482 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
| 483 | + { | |
| 484 | + $this->_limite_quantidade = $intLimiteQtd; | |
| 485 | + $this->_limite_offset = $intLimiteOffset; | |
| 486 | + } | |
| 487 | + | |
| 488 | + /** | |
| 489 | + * Retorna a string com o trecho da query responsável pelo limite de | |
| 490 | + * registros retornados/afetados. | |
| 491 | + * | |
| 492 | + * @return string | |
| 493 | + */ | |
| 494 | + function getLimite() | |
| 495 | + { | |
| 496 | + if (is_numeric($this->_limite_quantidade)) { | |
| 497 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
| 498 | + if (is_numeric($this->_limite_offset)) { | |
| 499 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
| 500 | + } | |
| 501 | + return $retorno; | |
| 502 | + } | |
| 503 | + return ''; | |
| 504 | + } | |
| 505 | + | |
| 506 | + /** | |
| 507 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
| 508 | + */ | |
| 509 | + function setOrderby($strNomeCampo) | |
| 510 | + { | |
| 511 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
| 512 | + $this->_campo_order_by = $strNomeCampo; | |
| 513 | + } | |
| 514 | + } | |
| 515 | + | |
| 516 | + /** | |
| 517 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
| 518 | + * registros. | |
| 519 | + * | |
| 520 | + * @return string | |
| 521 | + */ | |
| 522 | + function getOrderby() | |
| 523 | + { | |
| 524 | + if (is_string($this->_campo_order_by)) { | |
| 525 | + return " ORDER BY {$this->_campo_order_by} "; | |
| 526 | + } | |
| 527 | + return ''; | |
| 528 | + } | |
| 529 | +} | |
| 0 | 530 | \ No newline at end of file | ... | ... |
ieducar/intranet/include/modules/clsModulesPontoTransporteEscolar.inc.php
0 → 100644
| ... | ... | @@ -0,0 +1,339 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * clsModulesPontoTransporteEscolar class. | |
| 35 | + * | |
| 36 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 37 | + * @category i-Educar | |
| 38 | + * @license @@license@@ | |
| 39 | + * @package Module | |
| 40 | + * @since 07/2013 | |
| 41 | + * @version @@package_version@@ | |
| 42 | + */ | |
| 43 | +class clsModulesPontoTransporteEscolar | |
| 44 | +{ | |
| 45 | + var $cod_ponto_transporte_escolar; | |
| 46 | + var $descricao; | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
| 50 | + * @var int | |
| 51 | + */ | |
| 52 | + var $_total; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Nome do schema. | |
| 56 | + * @var string | |
| 57 | + */ | |
| 58 | + var $_schema; | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Nome da tabela. | |
| 62 | + * @var string | |
| 63 | + */ | |
| 64 | + var $_tabela; | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
| 68 | + * próxima chamado ao método lista(). | |
| 69 | + * @var string | |
| 70 | + */ | |
| 71 | + var $_campos_lista; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
| 75 | + * seleção no método lista. | |
| 76 | + * @var string | |
| 77 | + */ | |
| 78 | + var $_todos_campos; | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
| 82 | + * @var int | |
| 83 | + */ | |
| 84 | + var $_limite_quantidade; | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Define o valor de offset no retorno dos registros no método lista(). | |
| 88 | + * @var int | |
| 89 | + */ | |
| 90 | + var $_limite_offset; | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
| 94 | + * @var string | |
| 95 | + */ | |
| 96 | + var $_campo_order_by; | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * Construtor. | |
| 100 | + */ | |
| 101 | + function clsModulesPontoTransporteEscolar($cod_ponto_transporte_escolar = NULL, $descricao = NULL) | |
| 102 | + { | |
| 103 | + | |
| 104 | + $db = new clsBanco(); | |
| 105 | + $this->_schema = "modules."; | |
| 106 | + $this->_tabela = "{$this->_schema}ponto_transporte_escolar"; | |
| 107 | + | |
| 108 | + $this->_campos_lista = $this->_todos_campos = " cod_ponto_transporte_escolar, descricao"; | |
| 109 | + | |
| 110 | + if (is_numeric($cod_ponto_transporte_escolar)) { | |
| 111 | + $this->cod_ponto_transporte_escolar = $cod_ponto_transporte_escolar; | |
| 112 | + } | |
| 113 | + | |
| 114 | + if (is_string($descricao)) { | |
| 115 | + $this->descricao = $descricao; | |
| 116 | + } | |
| 117 | + | |
| 118 | + } | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * Cria um novo registro. | |
| 122 | + * @return bool | |
| 123 | + */ | |
| 124 | + function cadastra() | |
| 125 | + { | |
| 126 | + | |
| 127 | + if (is_string($this->descricao)) | |
| 128 | + { | |
| 129 | + $db = new clsBanco(); | |
| 130 | + | |
| 131 | + $campos = ''; | |
| 132 | + $valores = ''; | |
| 133 | + $gruda = ''; | |
| 134 | + | |
| 135 | + if (is_string($this->descricao)) { | |
| 136 | + $campos .= "{$gruda}descricao"; | |
| 137 | + $valores .= "{$gruda}'{$this->descricao}'"; | |
| 138 | + $gruda = ", "; | |
| 139 | + } | |
| 140 | + | |
| 141 | + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); | |
| 142 | + return $db->InsertId("{$this->_tabela}_seq"); | |
| 143 | + } | |
| 144 | + | |
| 145 | + return FALSE; | |
| 146 | + } | |
| 147 | + | |
| 148 | + /** | |
| 149 | + * Edita os dados de um registro. | |
| 150 | + * @return bool | |
| 151 | + */ | |
| 152 | + function edita() | |
| 153 | + { | |
| 154 | + | |
| 155 | + if (is_string($this->cod_ponto_transporte_escolar)) { | |
| 156 | + $db = new clsBanco(); | |
| 157 | + $set = ''; | |
| 158 | + $gruda = ''; | |
| 159 | + | |
| 160 | + if (is_string($this->descricao)) { | |
| 161 | + $set .= "{$gruda}descricao = '{$this->descricao}'"; | |
| 162 | + $gruda = ", "; | |
| 163 | + } | |
| 164 | + | |
| 165 | + if ($set) { | |
| 166 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_ponto_transporte_escolar = '{$this->cod_ponto_transporte_escolar}'"); | |
| 167 | + return TRUE; | |
| 168 | + } | |
| 169 | + } | |
| 170 | + | |
| 171 | + return FALSE; | |
| 172 | + } | |
| 173 | + | |
| 174 | + /** | |
| 175 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
| 176 | + * @return array | |
| 177 | + */ | |
| 178 | + function lista($cod_ponto_transporte_escolar = NULL, $descricao = NULL) | |
| 179 | + { | |
| 180 | + $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}"; | |
| 181 | + $filtros = ""; | |
| 182 | + | |
| 183 | + $whereAnd = " WHERE "; | |
| 184 | + | |
| 185 | + if (is_numeric($cod_ponto_transporte_escolar)) { | |
| 186 | + $filtros .= "{$whereAnd} cod_ponto_transporte_escolar = '{$cod_ponto_transporte_escolar}'"; | |
| 187 | + $whereAnd = " AND "; | |
| 188 | + } | |
| 189 | + | |
| 190 | + if (is_string($descricao)) { | |
| 191 | + $filtros .= "{$whereAnd} TO_ASCII(LOWER(descricao)) LIKE TO_ASCII(LOWER('%{$descricao}%'))"; | |
| 192 | + $whereAnd = " AND "; | |
| 193 | + } | |
| 194 | + | |
| 195 | + $db = new clsBanco(); | |
| 196 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 197 | + $resultado = array(); | |
| 198 | + | |
| 199 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
| 200 | + | |
| 201 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 202 | + | |
| 203 | + $db->Consulta($sql); | |
| 204 | + | |
| 205 | + if ($countCampos > 1) { | |
| 206 | + while ($db->ProximoRegistro()) { | |
| 207 | + $tupla = $db->Tupla(); | |
| 208 | + $tupla["_total"] = $this->_total; | |
| 209 | + $resultado[] = $tupla; | |
| 210 | + } | |
| 211 | + } | |
| 212 | + else { | |
| 213 | + while ($db->ProximoRegistro()) { | |
| 214 | + $tupla = $db->Tupla(); | |
| 215 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 216 | + } | |
| 217 | + } | |
| 218 | + if (count($resultado)) { | |
| 219 | + return $resultado; | |
| 220 | + } | |
| 221 | + | |
| 222 | + return FALSE; | |
| 223 | + } | |
| 224 | + | |
| 225 | + /** | |
| 226 | + * Retorna um array com os dados de um registro. | |
| 227 | + * @return array | |
| 228 | + */ | |
| 229 | + function detalhe() | |
| 230 | + { | |
| 231 | + | |
| 232 | + if (is_numeric($this->cod_ponto_transporte_escolar)) { | |
| 233 | + $db = new clsBanco(); | |
| 234 | + $db->Consulta("SELECT {$this->_todos_campos} FROM {$this->_tabela} WHERE cod_ponto_transporte_escolar = '{$this->cod_ponto_transporte_escolar}'"); | |
| 235 | + $db->ProximoRegistro(); | |
| 236 | + return $db->Tupla(); | |
| 237 | + } | |
| 238 | + return FALSE; | |
| 239 | + } | |
| 240 | + | |
| 241 | + /** | |
| 242 | + * Retorna um array com os dados de um registro. | |
| 243 | + * @return array | |
| 244 | + */ | |
| 245 | + function existe() | |
| 246 | + { | |
| 247 | + if (is_numeric($this->cod_ponto_transporte_escolar)) { | |
| 248 | + $db = new clsBanco(); | |
| 249 | + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_ponto_transporte_escolar = '{$this->cod_ponto_transporte_escolar}'"); | |
| 250 | + $db->ProximoRegistro(); | |
| 251 | + return $db->Tupla(); | |
| 252 | + } | |
| 253 | + | |
| 254 | + return FALSE; | |
| 255 | + } | |
| 256 | + | |
| 257 | + /** | |
| 258 | + * Exclui um registro. | |
| 259 | + * @return bool | |
| 260 | + */ | |
| 261 | + function excluir() | |
| 262 | + { | |
| 263 | + if (is_numeric($this->cod_ponto_transporte_escolar)) { | |
| 264 | + $sql = "DELETE FROM {$this->_tabela} WHERE cod_ponto_transporte_escolar = '{$this->cod_ponto_transporte_escolar}'"; | |
| 265 | + $db = new clsBanco(); | |
| 266 | + $db->Consulta($sql); | |
| 267 | + return true; | |
| 268 | + } | |
| 269 | + | |
| 270 | + return FALSE; | |
| 271 | + } | |
| 272 | + | |
| 273 | + /** | |
| 274 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
| 275 | + */ | |
| 276 | + function setCamposLista($str_campos) | |
| 277 | + { | |
| 278 | + $this->_campos_lista = $str_campos; | |
| 279 | + } | |
| 280 | + | |
| 281 | + /** | |
| 282 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
| 283 | + */ | |
| 284 | + function resetCamposLista() | |
| 285 | + { | |
| 286 | + $this->_campos_lista = $this->_todos_campos; | |
| 287 | + } | |
| 288 | + | |
| 289 | + /** | |
| 290 | + * Define limites de retorno para o método Lista(). | |
| 291 | + */ | |
| 292 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
| 293 | + { | |
| 294 | + $this->_limite_quantidade = $intLimiteQtd; | |
| 295 | + $this->_limite_offset = $intLimiteOffset; | |
| 296 | + } | |
| 297 | + | |
| 298 | + /** | |
| 299 | + * Retorna a string com o trecho da query responsável pelo limite de | |
| 300 | + * registros retornados/afetados. | |
| 301 | + * | |
| 302 | + * @return string | |
| 303 | + */ | |
| 304 | + function getLimite() | |
| 305 | + { | |
| 306 | + if (is_numeric($this->_limite_quantidade)) { | |
| 307 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
| 308 | + if (is_numeric($this->_limite_offset)) { | |
| 309 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
| 310 | + } | |
| 311 | + return $retorno; | |
| 312 | + } | |
| 313 | + return ''; | |
| 314 | + } | |
| 315 | + | |
| 316 | + /** | |
| 317 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
| 318 | + */ | |
| 319 | + function setOrderby($strNomeCampo) | |
| 320 | + { | |
| 321 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
| 322 | + $this->_campo_order_by = $strNomeCampo; | |
| 323 | + } | |
| 324 | + } | |
| 325 | + | |
| 326 | + /** | |
| 327 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
| 328 | + * registros. | |
| 329 | + * | |
| 330 | + * @return string | |
| 331 | + */ | |
| 332 | + function getOrderby() | |
| 333 | + { | |
| 334 | + if (is_string($this->_campo_order_by)) { | |
| 335 | + return " ORDER BY {$this->_campo_order_by} "; | |
| 336 | + } | |
| 337 | + return ''; | |
| 338 | + } | |
| 339 | +} | |
| 0 | 340 | \ No newline at end of file | ... | ... |
ieducar/intranet/include/modules/clsModulesRotaTransporteEscolar.inc.php
0 → 100644
| ... | ... | @@ -0,0 +1,530 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * clsModulesRotaTransporteEscolar class. | |
| 35 | + * | |
| 36 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 37 | + * @category i-Educar | |
| 38 | + * @license @@license@@ | |
| 39 | + * @package Module | |
| 40 | + * @since 07/2013 | |
| 41 | + * @version @@package_version@@ | |
| 42 | + */ | |
| 43 | +class clsModulesRotaTransporteEscolar | |
| 44 | +{ | |
| 45 | + var $cod_rota_transporte_escolar; | |
| 46 | + var $ref_idpes_destino; | |
| 47 | + var $descricao; | |
| 48 | + var $ano; | |
| 49 | + var $tipo_rota; | |
| 50 | + var $km_pav; | |
| 51 | + var $km_npav; | |
| 52 | + var $ref_cod_empresa_transporte_escolar; | |
| 53 | + var $tercerizado; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
| 57 | + * @var int | |
| 58 | + */ | |
| 59 | + var $_total; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * Nome do schema. | |
| 63 | + * @var string | |
| 64 | + */ | |
| 65 | + var $_schema; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * Nome da tabela. | |
| 69 | + * @var string | |
| 70 | + */ | |
| 71 | + var $_tabela; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
| 75 | + * próxima chamado ao método lista(). | |
| 76 | + * @var string | |
| 77 | + */ | |
| 78 | + var $_campos_lista; | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
| 82 | + * seleção no método lista. | |
| 83 | + * @var string | |
| 84 | + */ | |
| 85 | + var $_todos_campos; | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
| 89 | + * @var int | |
| 90 | + */ | |
| 91 | + var $_limite_quantidade; | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Define o valor de offset no retorno dos registros no método lista(). | |
| 95 | + * @var int | |
| 96 | + */ | |
| 97 | + var $_limite_offset; | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
| 101 | + * @var string | |
| 102 | + */ | |
| 103 | + var $_campo_order_by; | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * Construtor. | |
| 107 | + */ | |
| 108 | + function clsModulesRotaTransporteEscolar($cod_rota_transporte_escolar = NULL, $ref_idpes_destino = NULL, $descricao = NULL, $ano = NULL, $tipo_rota = NULL, $km_pav = NULL, $km_npav = NULL, $ref_cod_empresa_transporte_escolar=NULL, $tercerizado = NULL) | |
| 109 | + { | |
| 110 | + | |
| 111 | + $db = new clsBanco(); | |
| 112 | + $this->_schema = "modules."; | |
| 113 | + $this->_tabela = "{$this->_schema}rota_transporte_escolar"; | |
| 114 | + | |
| 115 | + $this->_campos_lista = $this->_todos_campos = " cod_rota_transporte_escolar, ref_idpes_destino, descricao, ano, tipo_rota, km_pav, km_npav, ref_cod_empresa_transporte_escolar, tercerizado"; | |
| 116 | + | |
| 117 | + if (is_numeric($cod_rota_transporte_escolar)) { | |
| 118 | + $this->cod_rota_transporte_escolar = $cod_rota_transporte_escolar; | |
| 119 | + } | |
| 120 | + | |
| 121 | + if (is_numeric($ref_idpes_destino)) { | |
| 122 | + $this->ref_idpes_destino = $ref_idpes_destino; | |
| 123 | + } | |
| 124 | + | |
| 125 | + if (is_string($descricao)) { | |
| 126 | + $this->descricao = $descricao; | |
| 127 | + } | |
| 128 | + | |
| 129 | + if (is_numeric($ano)) { | |
| 130 | + $this->ano = $ano; | |
| 131 | + } | |
| 132 | + | |
| 133 | + if (is_string($tipo_rota)) { | |
| 134 | + $this->tipo_rota = $tipo_rota; | |
| 135 | + } | |
| 136 | + | |
| 137 | + if (is_numeric($km_pav)) { | |
| 138 | + $this->km_pav = $km_pav; | |
| 139 | + } | |
| 140 | + | |
| 141 | + if (is_numeric($km_npav)) { | |
| 142 | + $this->km_npav = $km_npav; | |
| 143 | + } | |
| 144 | + | |
| 145 | + if (is_numeric($ref_cod_empresa_transporte_escolar)) { | |
| 146 | + $this->ref_cod_empresa_transporte_escolar = $ref_cod_empresa_transporte_escolar; | |
| 147 | + } | |
| 148 | + | |
| 149 | + if (is_string($tercerizado)) { | |
| 150 | + $this->tercerizado = $tercerizado; | |
| 151 | + } | |
| 152 | + } | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * Cria um novo registro. | |
| 156 | + * @return bool | |
| 157 | + */ | |
| 158 | + function cadastra() | |
| 159 | + { | |
| 160 | + | |
| 161 | + if (is_numeric($this->ref_idpes_destino) && is_numeric($this->ano) && is_string($this->descricao) | |
| 162 | + && is_string($this->tipo_rota) && is_numeric($this->ref_cod_empresa_transporte_escolar) | |
| 163 | + && is_string($this->tercerizado)) | |
| 164 | + { | |
| 165 | + $db = new clsBanco(); | |
| 166 | + | |
| 167 | + $campos = ''; | |
| 168 | + $valores = ''; | |
| 169 | + $gruda = ''; | |
| 170 | + | |
| 171 | + if (is_numeric($this->ref_idpes_destino)) { | |
| 172 | + $campos .= "{$gruda}ref_idpes_destino"; | |
| 173 | + $valores .= "{$gruda}'{$this->ref_idpes_destino}'"; | |
| 174 | + $gruda = ", "; | |
| 175 | + } | |
| 176 | + | |
| 177 | + if (is_string($this->descricao)) { | |
| 178 | + $campos .= "{$gruda}descricao"; | |
| 179 | + $valores .= "{$gruda}'{$this->descricao}'"; | |
| 180 | + $gruda = ", "; | |
| 181 | + } | |
| 182 | + | |
| 183 | + if (is_numeric($this->ano)) { | |
| 184 | + $campos .= "{$gruda}ano"; | |
| 185 | + $valores .= "{$gruda}'{$this->ano}'"; | |
| 186 | + $gruda = ", "; | |
| 187 | + } | |
| 188 | + | |
| 189 | + if (is_string($this->tipo_rota)) { | |
| 190 | + $campos .= "{$gruda}tipo_rota"; | |
| 191 | + $valores .= "{$gruda}'{$this->tipo_rota}'"; | |
| 192 | + $gruda = ", "; | |
| 193 | + } | |
| 194 | + | |
| 195 | + if (is_numeric($this->km_pav)) { | |
| 196 | + $campos .= "{$gruda}km_pav"; | |
| 197 | + $valores .= "{$gruda}'{$this->km_pav}'"; | |
| 198 | + $gruda = ", "; | |
| 199 | + } | |
| 200 | + | |
| 201 | + if (is_numeric($this->km_npav)) { | |
| 202 | + $campos .= "{$gruda}km_npav"; | |
| 203 | + $valores .= "{$gruda}'{$this->km_npav}'"; | |
| 204 | + $gruda = ", "; | |
| 205 | + } | |
| 206 | + | |
| 207 | + if (is_numeric($this->ref_cod_empresa_transporte_escolar)) { | |
| 208 | + $campos .= "{$gruda}ref_cod_empresa_transporte_escolar"; | |
| 209 | + $valores .= "{$gruda}'{$this->ref_cod_empresa_transporte_escolar}'"; | |
| 210 | + $gruda = ", "; | |
| 211 | + } | |
| 212 | + | |
| 213 | + if (is_string($this->tercerizado)) { | |
| 214 | + $campos .= "{$gruda}tercerizado"; | |
| 215 | + $valores .= "{$gruda}'{$this->tercerizado}'"; | |
| 216 | + $gruda = ", "; | |
| 217 | + } | |
| 218 | + | |
| 219 | + | |
| 220 | + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); | |
| 221 | + return $db->InsertId("{$this->_tabela}_seq"); | |
| 222 | + } | |
| 223 | + | |
| 224 | + return FALSE; | |
| 225 | + } | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * Edita os dados de um registro. | |
| 229 | + * @return bool | |
| 230 | + */ | |
| 231 | + function edita() | |
| 232 | + { | |
| 233 | + | |
| 234 | + if (is_string($this->cod_rota_transporte_escolar)) { | |
| 235 | + $db = new clsBanco(); | |
| 236 | + $set = ''; | |
| 237 | + $gruda = ''; | |
| 238 | + | |
| 239 | + if (is_numeric($this->ref_idpes_destino)) { | |
| 240 | + $set .= "{$gruda}ref_idpes_destino = '{$this->ref_idpes_destino}'"; | |
| 241 | + $gruda = ", "; | |
| 242 | + } | |
| 243 | + | |
| 244 | + if (is_string($this->descricao)) { | |
| 245 | + $set .= "{$gruda}descricao = '{$this->descricao}'"; | |
| 246 | + $gruda = ", "; | |
| 247 | + } | |
| 248 | + | |
| 249 | + if (is_numeric($this->ano)) { | |
| 250 | + $set .= "{$gruda}ano = '{$this->ano}'"; | |
| 251 | + $gruda = ", "; | |
| 252 | + } | |
| 253 | + | |
| 254 | + if (is_string($this->tipo_rota)) { | |
| 255 | + $set .= "{$gruda}tipo_rota = '{$this->tipo_rota}'"; | |
| 256 | + $gruda = ", "; | |
| 257 | + } | |
| 258 | + | |
| 259 | + if (is_numeric($this->km_pav)) { | |
| 260 | + $set .= "{$gruda}km_pav = '{$this->km_pav}'"; | |
| 261 | + $gruda = ", "; | |
| 262 | + } | |
| 263 | + | |
| 264 | + if (is_numeric($this->km_npav)) { | |
| 265 | + $set .= "{$gruda}km_npav = '{$this->km_npav}'"; | |
| 266 | + $gruda = ", "; | |
| 267 | + } | |
| 268 | + | |
| 269 | + if (is_numeric($this->ref_cod_empresa_transporte_escolar)) { | |
| 270 | + $set .= "{$gruda}ref_cod_empresa_transporte_escolar = '{$this->ref_cod_empresa_transporte_escolar}'"; | |
| 271 | + $gruda = ", "; | |
| 272 | + } | |
| 273 | + | |
| 274 | + if (is_string($this->tercerizado)) { | |
| 275 | + $set .= "{$gruda}tercerizado = '{$this->tercerizado}'"; | |
| 276 | + $gruda = ", "; | |
| 277 | + } | |
| 278 | + | |
| 279 | + if ($set) { | |
| 280 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_rota_transporte_escolar = '{$this->cod_rota_transporte_escolar}'"); | |
| 281 | + return TRUE; | |
| 282 | + } | |
| 283 | + } | |
| 284 | + | |
| 285 | + return FALSE; | |
| 286 | + } | |
| 287 | + | |
| 288 | + /** | |
| 289 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
| 290 | + * @return array | |
| 291 | + */ | |
| 292 | + function lista($cod_rota_transporte_escolar = NULL, $descricao = NULL, $ref_idpes_destino = NULL , $nome_destino = NULL, | |
| 293 | + $ano = NULL, $ref_cod_empresa_transporte_escolar = NULL, $nome_empresa = NULL, $tercerizado = NULL) | |
| 294 | + { | |
| 295 | + | |
| 296 | + $sql = "SELECT {$this->_campos_lista}, ( | |
| 297 | + SELECT | |
| 298 | + nome | |
| 299 | + FROM | |
| 300 | + cadastro.pessoa | |
| 301 | + WHERE | |
| 302 | + idpes = ref_idpes_destino | |
| 303 | + ) AS nome_destino , ( | |
| 304 | + SELECT | |
| 305 | + nome | |
| 306 | + FROM | |
| 307 | + cadastro.pessoa, modules.empresa_transporte_escolar | |
| 308 | + WHERE | |
| 309 | + idpes = ref_idpes and cod_empresa_transporte_escolar = ref_cod_empresa_transporte_escolar | |
| 310 | + ) AS nome_empresa FROM {$this->_tabela}"; | |
| 311 | + $filtros = ""; | |
| 312 | + | |
| 313 | + $whereAnd = " WHERE "; | |
| 314 | + | |
| 315 | + if (is_numeric($cod_rota_transporte_escolar)) { | |
| 316 | + $filtros .= "{$whereAnd} cod_rota_transporte_escolar = '{$cod_rota_transporte_escolar}'"; | |
| 317 | + $whereAnd = " AND "; | |
| 318 | + } | |
| 319 | + | |
| 320 | + if (is_string($descricao)) { | |
| 321 | + $filtros .= "{$whereAnd} TO_ASCII(LOWER(descricao)) LIKE TO_ASCII(LOWER('%{$descricao}%'))"; | |
| 322 | + $whereAnd = " AND "; | |
| 323 | + } | |
| 324 | + | |
| 325 | + if (is_numeric($ref_idpes_destino)) { | |
| 326 | + $filtros .= "{$whereAnd} ref_idpes_destino = '{$ref_idpes_destino}'"; | |
| 327 | + $whereAnd = " AND "; | |
| 328 | + } | |
| 329 | + if (is_string($nome_destino)) { | |
| 330 | + $filtros .= " | |
| 331 | + {$whereAnd} exists ( | |
| 332 | + SELECT | |
| 333 | + 1 | |
| 334 | + FROM | |
| 335 | + cadastro.pessoa | |
| 336 | + WHERE | |
| 337 | + cadastro.pessoa.idpes = ref_idpes_destino | |
| 338 | + AND TO_ASCII(LOWER(nome)) LIKE TO_ASCII(LOWER('%{$nome_destino}%')) | |
| 339 | + )"; | |
| 340 | + | |
| 341 | + $whereAnd = ' AND '; | |
| 342 | + } | |
| 343 | + | |
| 344 | + if (is_numeric($ano)) { | |
| 345 | + $filtros .= "{$whereAnd} ano = '{$ano}'"; | |
| 346 | + $whereAnd = " AND "; | |
| 347 | + } | |
| 348 | + if (is_string($ref_cod_empresa_transporte_escolar)){ | |
| 349 | + $filtros .= "{$whereAnd} ref_cod_empresa_transporte_escolar = '{$ref_cod_empresa_transporte_escolar}'"; | |
| 350 | + $whereAnd = " AND "; | |
| 351 | + } | |
| 352 | + | |
| 353 | + if (is_string($nome_empresa)) { | |
| 354 | + $filtros .= " | |
| 355 | + {$whereAnd} exists ( | |
| 356 | + SELECT | |
| 357 | + nome | |
| 358 | + FROM | |
| 359 | + cadastro.pessoa, modules.empresa_transporte_escolar | |
| 360 | + WHERE | |
| 361 | + idpes = ref_idpes and cod_empresa_transporte_escolar = ref_cod_empresa_transporte_escolar | |
| 362 | + AND TO_ASCII(LOWER(nome)) LIKE TO_ASCII(LOWER('%{$nome_empresa}%')) | |
| 363 | + )"; | |
| 364 | + | |
| 365 | + $whereAnd = ' AND '; | |
| 366 | + } | |
| 367 | + | |
| 368 | + if (is_string($tercerizado)){ | |
| 369 | + $filtros .= "{$whereAnd} tercerizado = '{$tercerizado}'"; | |
| 370 | + $whereAnd = " AND "; | |
| 371 | + } | |
| 372 | + | |
| 373 | + $db = new clsBanco(); | |
| 374 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 375 | + $resultado = array(); | |
| 376 | + | |
| 377 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
| 378 | + | |
| 379 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 380 | + | |
| 381 | + $db->Consulta($sql); | |
| 382 | + | |
| 383 | + if ($countCampos > 1) { | |
| 384 | + while ($db->ProximoRegistro()) { | |
| 385 | + $tupla = $db->Tupla(); | |
| 386 | + $tupla["_total"] = $this->_total; | |
| 387 | + $resultado[] = $tupla; | |
| 388 | + } | |
| 389 | + } | |
| 390 | + else { | |
| 391 | + while ($db->ProximoRegistro()) { | |
| 392 | + $tupla = $db->Tupla(); | |
| 393 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 394 | + } | |
| 395 | + } | |
| 396 | + if (count($resultado)) { | |
| 397 | + return $resultado; | |
| 398 | + } | |
| 399 | + | |
| 400 | + return FALSE; | |
| 401 | + } | |
| 402 | + | |
| 403 | + /** | |
| 404 | + * Retorna um array com os dados de um registro. | |
| 405 | + * @return array | |
| 406 | + */ | |
| 407 | + function detalhe() | |
| 408 | + { | |
| 409 | + if (is_numeric($this->cod_rota_transporte_escolar)) { | |
| 410 | + $db = new clsBanco(); | |
| 411 | + $db->Consulta("SELECT {$this->_todos_campos}, ( | |
| 412 | + SELECT | |
| 413 | + nome | |
| 414 | + FROM | |
| 415 | + cadastro.pessoa | |
| 416 | + WHERE | |
| 417 | + idpes = ref_idpes_destino | |
| 418 | + ) AS nome_destino , ( | |
| 419 | + SELECT | |
| 420 | + nome | |
| 421 | + FROM | |
| 422 | + cadastro.pessoa, modules.empresa_transporte_escolar | |
| 423 | + WHERE | |
| 424 | + idpes = ref_idpes and cod_empresa_transporte_escolar = ref_cod_empresa_transporte_escolar | |
| 425 | + ) AS nome_empresa FROM {$this->_tabela} WHERE cod_rota_transporte_escolar = '{$this->cod_rota_transporte_escolar}'"); | |
| 426 | + $db->ProximoRegistro(); | |
| 427 | + return $db->Tupla(); | |
| 428 | + } | |
| 429 | + return FALSE; | |
| 430 | + } | |
| 431 | + | |
| 432 | + /** | |
| 433 | + * Retorna um array com os dados de um registro. | |
| 434 | + * @return array | |
| 435 | + */ | |
| 436 | + function existe() | |
| 437 | + { | |
| 438 | + if (is_numeric($this->cod_rota_transporte_escolar)) { | |
| 439 | + $db = new clsBanco(); | |
| 440 | + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_rota_transporte_escolar = '{$this->cod_rota_transporte_escolar}'"); | |
| 441 | + $db->ProximoRegistro(); | |
| 442 | + return $db->Tupla(); | |
| 443 | + } | |
| 444 | + | |
| 445 | + return FALSE; | |
| 446 | + } | |
| 447 | + | |
| 448 | + /** | |
| 449 | + * Exclui um registro. | |
| 450 | + * @return bool | |
| 451 | + */ | |
| 452 | + function excluir() | |
| 453 | + { | |
| 454 | + if (is_numeric($this->cod_rota_transporte_escolar)) { | |
| 455 | + $sql = "DELETE FROM {$this->_tabela} WHERE cod_rota_transporte_escolar = '{$this->cod_rota_transporte_escolar}'"; | |
| 456 | + $db = new clsBanco(); | |
| 457 | + $db->Consulta($sql); | |
| 458 | + return true; | |
| 459 | + } | |
| 460 | + | |
| 461 | + return FALSE; | |
| 462 | + } | |
| 463 | + | |
| 464 | + /** | |
| 465 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
| 466 | + */ | |
| 467 | + function setCamposLista($str_campos) | |
| 468 | + { | |
| 469 | + $this->_campos_lista = $str_campos; | |
| 470 | + } | |
| 471 | + | |
| 472 | + /** | |
| 473 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
| 474 | + */ | |
| 475 | + function resetCamposLista() | |
| 476 | + { | |
| 477 | + $this->_campos_lista = $this->_todos_campos; | |
| 478 | + } | |
| 479 | + | |
| 480 | + /** | |
| 481 | + * Define limites de retorno para o método Lista(). | |
| 482 | + */ | |
| 483 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
| 484 | + { | |
| 485 | + $this->_limite_quantidade = $intLimiteQtd; | |
| 486 | + $this->_limite_offset = $intLimiteOffset; | |
| 487 | + } | |
| 488 | + | |
| 489 | + /** | |
| 490 | + * Retorna a string com o trecho da query responsável pelo limite de | |
| 491 | + * registros retornados/afetados. | |
| 492 | + * | |
| 493 | + * @return string | |
| 494 | + */ | |
| 495 | + function getLimite() | |
| 496 | + { | |
| 497 | + if (is_numeric($this->_limite_quantidade)) { | |
| 498 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
| 499 | + if (is_numeric($this->_limite_offset)) { | |
| 500 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
| 501 | + } | |
| 502 | + return $retorno; | |
| 503 | + } | |
| 504 | + return ''; | |
| 505 | + } | |
| 506 | + | |
| 507 | + /** | |
| 508 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
| 509 | + */ | |
| 510 | + function setOrderby($strNomeCampo) | |
| 511 | + { | |
| 512 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
| 513 | + $this->_campo_order_by = $strNomeCampo; | |
| 514 | + } | |
| 515 | + } | |
| 516 | + | |
| 517 | + /** | |
| 518 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
| 519 | + * registros. | |
| 520 | + * | |
| 521 | + * @return string | |
| 522 | + */ | |
| 523 | + function getOrderby() | |
| 524 | + { | |
| 525 | + if (is_string($this->_campo_order_by)) { | |
| 526 | + return " ORDER BY {$this->_campo_order_by} "; | |
| 527 | + } | |
| 528 | + return ''; | |
| 529 | + } | |
| 530 | +} | |
| 0 | 531 | \ No newline at end of file | ... | ... |
ieducar/intranet/include/modules/clsModulesTipoVeiculo.inc.php
0 → 100644
| ... | ... | @@ -0,0 +1,341 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * clsModulesTipoVeiculo class. | |
| 35 | + * | |
| 36 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 37 | + * @category i-Educar | |
| 38 | + * @license @@license@@ | |
| 39 | + * @package Module | |
| 40 | + * @since 07/2013 | |
| 41 | + * @version @@package_version@@ | |
| 42 | + */ | |
| 43 | +class clsModulesTipoVeiculo | |
| 44 | +{ | |
| 45 | + var $cod_tipo_veiculo; | |
| 46 | + var $descricao; | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
| 50 | + * @var int | |
| 51 | + */ | |
| 52 | + var $_total; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Nome do schema. | |
| 56 | + * @var string | |
| 57 | + */ | |
| 58 | + var $_schema; | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Nome da tabela. | |
| 62 | + * @var string | |
| 63 | + */ | |
| 64 | + var $_tabela; | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
| 68 | + * próxima chamado ao método lista(). | |
| 69 | + * @var string | |
| 70 | + */ | |
| 71 | + var $_campos_lista; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
| 75 | + * seleção no método lista. | |
| 76 | + * @var string | |
| 77 | + */ | |
| 78 | + var $_todos_campos; | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
| 82 | + * @var int | |
| 83 | + */ | |
| 84 | + var $_limite_quantidade; | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Define o valor de offset no retorno dos registros no método lista(). | |
| 88 | + * @var int | |
| 89 | + */ | |
| 90 | + var $_limite_offset; | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
| 94 | + * @var string | |
| 95 | + */ | |
| 96 | + var $_campo_order_by; | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * Construtor. | |
| 100 | + */ | |
| 101 | + function clsModulesTipoVeiculo($cod_tipo_veiculo = NULL, $descricao = NULL ) | |
| 102 | + { | |
| 103 | + $db = new clsBanco(); | |
| 104 | + $this->_schema = "modules."; | |
| 105 | + $this->_tabela = "{$this->_schema}tipo_veiculo"; | |
| 106 | + | |
| 107 | + $this->_campos_lista = $this->_todos_campos = " cod_tipo_veiculo, descricao"; | |
| 108 | + | |
| 109 | + if (is_numeric($cod_tipo_veiculo)) { | |
| 110 | + $this->cod_tipo_veiculo = $cod_tipo_veiculo; | |
| 111 | + } | |
| 112 | + | |
| 113 | + if (is_string($descricao)) { | |
| 114 | + $this->descricao = $descricao; | |
| 115 | + } | |
| 116 | + | |
| 117 | + } | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * Cria um novo registro. | |
| 121 | + * @return bool | |
| 122 | + */ | |
| 123 | + function cadastra() | |
| 124 | + { | |
| 125 | + if (is_string($this->descricao)) | |
| 126 | + { | |
| 127 | + $db = new clsBanco(); | |
| 128 | + | |
| 129 | + $campos = ''; | |
| 130 | + $valores = ''; | |
| 131 | + $gruda = ''; | |
| 132 | + | |
| 133 | + | |
| 134 | + $campos .= "{$gruda}descricao"; | |
| 135 | + $valores .= "{$gruda}'{$this->descricao}'"; | |
| 136 | + $gruda = ", "; | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); | |
| 141 | + return $db->InsertId("{$this->_tabela}_seq"); | |
| 142 | + } | |
| 143 | + | |
| 144 | + return FALSE; | |
| 145 | + } | |
| 146 | + | |
| 147 | + /** | |
| 148 | + * Edita os dados de um registro. | |
| 149 | + * @return bool | |
| 150 | + */ | |
| 151 | + function edita() | |
| 152 | + { | |
| 153 | + if (is_string($this->descricao)) { | |
| 154 | + $db = new clsBanco(); | |
| 155 | + $set = ''; | |
| 156 | + | |
| 157 | + $set .= "descricao = '{$this->descricao}'"; | |
| 158 | + | |
| 159 | + if ($set) { | |
| 160 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'"); | |
| 161 | + return TRUE; | |
| 162 | + } | |
| 163 | + } | |
| 164 | + | |
| 165 | + return FALSE; | |
| 166 | + } | |
| 167 | + | |
| 168 | + /** | |
| 169 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
| 170 | + * @return array | |
| 171 | + */ | |
| 172 | + function lista($cod_tipo_veiculo = NULL, $descricao = NULL) | |
| 173 | + { | |
| 174 | + $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}"; | |
| 175 | + $filtros = ""; | |
| 176 | + | |
| 177 | + $whereAnd = " WHERE "; | |
| 178 | + | |
| 179 | + if (is_numeric($cod_tipo_veiculo)) { | |
| 180 | + $filtros .= "{$whereAnd} cod_tipo_veiculo = '{$cod_tipo_veiculo}'"; | |
| 181 | + $whereAnd = " AND "; | |
| 182 | + } | |
| 183 | + | |
| 184 | + if (is_string($descricao)) { | |
| 185 | + $filtros .= "{$whereAnd} TO_ASCII(LOWER(descricao)) LIKE TO_ASCII(LOWER('%{$descricao}%'))"; | |
| 186 | + $whereAnd = " AND "; | |
| 187 | + } | |
| 188 | + | |
| 189 | + | |
| 190 | + $db = new clsBanco(); | |
| 191 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 192 | + $resultado = array(); | |
| 193 | + | |
| 194 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
| 195 | + | |
| 196 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 197 | + | |
| 198 | + $db->Consulta($sql); | |
| 199 | + | |
| 200 | + if ($countCampos > 1) { | |
| 201 | + while ($db->ProximoRegistro()) { | |
| 202 | + $tupla = $db->Tupla(); | |
| 203 | + $tupla["_total"] = $this->_total; | |
| 204 | + $resultado[] = $tupla; | |
| 205 | + } | |
| 206 | + } | |
| 207 | + else { | |
| 208 | + while ($db->ProximoRegistro()) { | |
| 209 | + $tupla = $db->Tupla(); | |
| 210 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 211 | + } | |
| 212 | + } | |
| 213 | + if (count($resultado)) { | |
| 214 | + return $resultado; | |
| 215 | + } | |
| 216 | + | |
| 217 | + return FALSE; | |
| 218 | + } | |
| 219 | + | |
| 220 | + /** | |
| 221 | + * Retorna um array com os dados de um registro. | |
| 222 | + * @return array | |
| 223 | + */ | |
| 224 | + function detalhe() | |
| 225 | + { | |
| 226 | + if (is_numeric($this->cod_empresa_transporte_escolar)) { | |
| 227 | + $db = new clsBanco(); | |
| 228 | + $db->Consulta("SELECT {$this->_todos_campos}, ( | |
| 229 | + SELECT | |
| 230 | + nome | |
| 231 | + FROM | |
| 232 | + cadastro.pessoa | |
| 233 | + WHERE | |
| 234 | + idpes = ref_idpes | |
| 235 | + ) AS nome_empresa , (SELECT nome FROM cadastro.pessoa WHERE idpes = ref_resp_idpes) AS nome_responsavel FROM {$this->_tabela} WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'"); | |
| 236 | + $db->ProximoRegistro(); | |
| 237 | + return $db->Tupla(); | |
| 238 | + } | |
| 239 | + | |
| 240 | + return FALSE; | |
| 241 | + } | |
| 242 | + | |
| 243 | + /** | |
| 244 | + * Retorna um array com os dados de um registro. | |
| 245 | + * @return array | |
| 246 | + */ | |
| 247 | + function existe() | |
| 248 | + { | |
| 249 | + if (is_numeric($this->cod_empresa_transporte_escolar)) { | |
| 250 | + $db = new clsBanco(); | |
| 251 | + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'"); | |
| 252 | + $db->ProximoRegistro(); | |
| 253 | + return $db->Tupla(); | |
| 254 | + } | |
| 255 | + | |
| 256 | + return FALSE; | |
| 257 | + } | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * Exclui um registro. | |
| 261 | + * @return bool | |
| 262 | + */ | |
| 263 | + function excluir() | |
| 264 | + { | |
| 265 | + if (is_numeric($this->cod_empresa_transporte_escolar)) { | |
| 266 | + $sql = "DELETE FROM {$this->_tabela} WHERE cod_empresa_transporte_escolar = '{$this->cod_empresa_transporte_escolar}'"; | |
| 267 | + $db = new clsBanco(); | |
| 268 | + $db->Consulta($sql); | |
| 269 | + return true; | |
| 270 | + } | |
| 271 | + | |
| 272 | + return FALSE; | |
| 273 | + } | |
| 274 | + | |
| 275 | + /** | |
| 276 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
| 277 | + */ | |
| 278 | + function setCamposLista($str_campos) | |
| 279 | + { | |
| 280 | + $this->_campos_lista = $str_campos; | |
| 281 | + } | |
| 282 | + | |
| 283 | + /** | |
| 284 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
| 285 | + */ | |
| 286 | + function resetCamposLista() | |
| 287 | + { | |
| 288 | + $this->_campos_lista = $this->_todos_campos; | |
| 289 | + } | |
| 290 | + | |
| 291 | + /** | |
| 292 | + * Define limites de retorno para o método Lista(). | |
| 293 | + */ | |
| 294 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
| 295 | + { | |
| 296 | + $this->_limite_quantidade = $intLimiteQtd; | |
| 297 | + $this->_limite_offset = $intLimiteOffset; | |
| 298 | + } | |
| 299 | + | |
| 300 | + /** | |
| 301 | + * Retorna a string com o trecho da query responsável pelo limite de | |
| 302 | + * registros retornados/afetados. | |
| 303 | + * | |
| 304 | + * @return string | |
| 305 | + */ | |
| 306 | + function getLimite() | |
| 307 | + { | |
| 308 | + if (is_numeric($this->_limite_quantidade)) { | |
| 309 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
| 310 | + if (is_numeric($this->_limite_offset)) { | |
| 311 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
| 312 | + } | |
| 313 | + return $retorno; | |
| 314 | + } | |
| 315 | + return ''; | |
| 316 | + } | |
| 317 | + | |
| 318 | + /** | |
| 319 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
| 320 | + */ | |
| 321 | + function setOrderby($strNomeCampo) | |
| 322 | + { | |
| 323 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
| 324 | + $this->_campo_order_by = $strNomeCampo; | |
| 325 | + } | |
| 326 | + } | |
| 327 | + | |
| 328 | + /** | |
| 329 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
| 330 | + * registros. | |
| 331 | + * | |
| 332 | + * @return string | |
| 333 | + */ | |
| 334 | + function getOrderby() | |
| 335 | + { | |
| 336 | + if (is_string($this->_campo_order_by)) { | |
| 337 | + return " ORDER BY {$this->_campo_order_by} "; | |
| 338 | + } | |
| 339 | + return ''; | |
| 340 | + } | |
| 341 | +} | |
| 0 | 342 | \ No newline at end of file | ... | ... |
ieducar/intranet/include/modules/clsModulesVeiculo.inc.php
0 → 100644
| ... | ... | @@ -0,0 +1,679 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * clsModulesVeiculo class. | |
| 35 | + * | |
| 36 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 37 | + * @category i-Educar | |
| 38 | + * @license @@license@@ | |
| 39 | + * @package Module | |
| 40 | + * @since 07/2013 | |
| 41 | + * @version @@package_version@@ | |
| 42 | + */ | |
| 43 | +class clsModulesVeiculo | |
| 44 | +{ | |
| 45 | + var $cod_veiculo; | |
| 46 | + var $descricao; | |
| 47 | + var $placa; | |
| 48 | + var $renavam; | |
| 49 | + var $chassi; | |
| 50 | + var $marca; | |
| 51 | + var $ano_fabricacao; | |
| 52 | + var $ano_modelo; | |
| 53 | + var $passageiros; | |
| 54 | + var $malha; | |
| 55 | + var $ref_cod_tipo_veiculo; | |
| 56 | + var $exclusivo_transporte_escolar; | |
| 57 | + var $adaptado_necessidades_especiais; | |
| 58 | + var $ativo; | |
| 59 | + var $descricao_inativo; | |
| 60 | + var $ref_cod_empresa_transporte_escolar; | |
| 61 | + var $ref_cod_motorista; | |
| 62 | + var $observacao; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * Armazena o total de resultados obtidos na última chamada ao método lista(). | |
| 66 | + * @var int | |
| 67 | + */ | |
| 68 | + var $_total; | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Nome do schema. | |
| 72 | + * @var string | |
| 73 | + */ | |
| 74 | + var $_schema; | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * Nome da tabela. | |
| 78 | + * @var string | |
| 79 | + */ | |
| 80 | + var $_tabela; | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * Lista separada por vírgula, com os campos que devem ser selecionados na | |
| 84 | + * próxima chamado ao método lista(). | |
| 85 | + * @var string | |
| 86 | + */ | |
| 87 | + var $_campos_lista; | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * Lista com todos os campos da tabela separados por vírgula, padrão para | |
| 91 | + * seleção no método lista. | |
| 92 | + * @var string | |
| 93 | + */ | |
| 94 | + var $_todos_campos; | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Valor que define a quantidade de registros a ser retornada pelo método lista(). | |
| 98 | + * @var int | |
| 99 | + */ | |
| 100 | + var $_limite_quantidade; | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * Define o valor de offset no retorno dos registros no método lista(). | |
| 104 | + * @var int | |
| 105 | + */ | |
| 106 | + var $_limite_offset; | |
| 107 | + | |
| 108 | + /** | |
| 109 | + * Define o campo para ser usado como padrão de ordenação no método lista(). | |
| 110 | + * @var string | |
| 111 | + */ | |
| 112 | + var $_campo_order_by; | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * Construtor. | |
| 116 | + */ | |
| 117 | + function clsModulesVeiculo($cod_veiculo = NULL, $descricao = NULL, $placa = NULL, $renavam = NULL, | |
| 118 | + $chassi = NULL, $marca = NULL, $ano_fabricacao = NULL, | |
| 119 | + $ano_modelo = NULL, $passageiros = NULL, $malha = NULL, $ref_cod_tipo_veiculo = NULL, | |
| 120 | + $exclusivo_transporte_escolar = NULL, $adaptado_necessidades_especiais = NULL, | |
| 121 | + $ativo = NULL, $descricao_inativo = NULL, $ref_cod_empresa_transporte_escolar = NULL, | |
| 122 | + $ref_cod_motorista = NULL, $observacao = NULL ) | |
| 123 | + { | |
| 124 | + $db = new clsBanco(); | |
| 125 | + $this->_schema = "modules."; | |
| 126 | + $this->_tabela = "{$this->_schema}veiculo"; | |
| 127 | + | |
| 128 | + $this->_campos_lista = $this->_todos_campos = " cod_veiculo, descricao, placa, renavam, chassi, marca, ano_fabricacao, | |
| 129 | + ano_modelo, passageiros, malha, ref_cod_tipo_veiculo, exclusivo_transporte_escolar, | |
| 130 | + adaptado_necessidades_especiais, ativo, descricao_inativo, ref_cod_empresa_transporte_escolar, | |
| 131 | + ref_cod_motorista, observacao"; | |
| 132 | + | |
| 133 | + if (is_numeric($cod_veiculo)) { | |
| 134 | + $this->cod_veiculo = $cod_veiculo; | |
| 135 | + } | |
| 136 | + | |
| 137 | + if (is_string($descricao)) { | |
| 138 | + $this->descricao = $descricao; | |
| 139 | + } | |
| 140 | + | |
| 141 | + if (is_string($placa)) { | |
| 142 | + $this->placa = $placa; | |
| 143 | + } | |
| 144 | + | |
| 145 | + if (is_string($renavam)) { | |
| 146 | + $this->renavam = $renavam; | |
| 147 | + } | |
| 148 | + | |
| 149 | + if (is_string($marca)) { | |
| 150 | + $this->marca = $marca; | |
| 151 | + } | |
| 152 | + | |
| 153 | + if (is_string($ano_fabricacao)) { | |
| 154 | + $this->marca = $marca; | |
| 155 | + } | |
| 156 | + | |
| 157 | + if (is_string($ano_modelo)) { | |
| 158 | + $this->marca = $marca; | |
| 159 | + } | |
| 160 | + | |
| 161 | + if (is_numeric($passageiros)) { | |
| 162 | + $this->passageiros = $passageiros; | |
| 163 | + } | |
| 164 | + | |
| 165 | + if (is_string($malha)) { | |
| 166 | + $this->malha = $malha; | |
| 167 | + } | |
| 168 | + | |
| 169 | + | |
| 170 | + if (is_numeric($ref_cod_tipo_veiculo)) { | |
| 171 | + $this->ref_cod_tipo_veiculo = $ref_cod_tipo_veiculo; | |
| 172 | + } | |
| 173 | + | |
| 174 | + if (is_string($exclusivo_transporte_escolar)) { | |
| 175 | + $this->exclusivo_transporte_escolar = $exclusivo_transporte_escolar; | |
| 176 | + } | |
| 177 | + | |
| 178 | + if (is_string($adaptado_necessidades_especiais)) { | |
| 179 | + $this->adaptado_necessidades_especiais = $adaptado_necessidades_especiais; | |
| 180 | + } | |
| 181 | + | |
| 182 | + if (is_string($ativo)) { | |
| 183 | + $this->ativo = $ativo; | |
| 184 | + } | |
| 185 | + | |
| 186 | + if (is_string($descricao_inativo)) { | |
| 187 | + $this->descricao_inativo = $descricao_inativo; | |
| 188 | + } | |
| 189 | + | |
| 190 | + if (is_numeric($ref_cod_empresa_transporte_escolar)) { | |
| 191 | + $this->ref_cod_empresa_transporte_escolar = $ref_cod_empresa_transporte_escolar; | |
| 192 | + } | |
| 193 | + | |
| 194 | + if (is_numeric($ref_cod_motorista)) { | |
| 195 | + $this->ref_cod_motorista = $ref_cod_motorista; | |
| 196 | + } | |
| 197 | + | |
| 198 | + if (is_string($observacao)) { | |
| 199 | + $this->observacao = $observacao; | |
| 200 | + } | |
| 201 | + | |
| 202 | + } | |
| 203 | + | |
| 204 | + /** | |
| 205 | + * Cria um novo registro. | |
| 206 | + * @return bool | |
| 207 | + */ | |
| 208 | + function cadastra() | |
| 209 | + { | |
| 210 | + | |
| 211 | + | |
| 212 | + if (is_string($this->descricao) && is_string($this->placa) && is_string($this->renavam) | |
| 213 | + && is_numeric($this->passageiros) && is_string($this->malha) && is_string($this->adaptado_necessidades_especiais) | |
| 214 | + && is_string($this->exclusivo_transporte_escolar) && is_numeric($this->ref_cod_empresa_transporte_escolar) | |
| 215 | + && is_numeric($this->ref_cod_motorista)) | |
| 216 | + { | |
| 217 | + | |
| 218 | + $db = new clsBanco(); | |
| 219 | + | |
| 220 | + $campos = ''; | |
| 221 | + $valores = ''; | |
| 222 | + $gruda = ''; | |
| 223 | + | |
| 224 | + | |
| 225 | + if (is_numeric($this->cod_veiculo)) { | |
| 226 | + $campos .= "{$gruda}cod_veiculo"; | |
| 227 | + $valores .= "{$gruda}'{$this->cod_veiculo}'"; | |
| 228 | + $gruda = ", "; | |
| 229 | + } | |
| 230 | + | |
| 231 | + if (is_string($this->descricao)) { | |
| 232 | + $campos .= "{$gruda}descricao"; | |
| 233 | + $valores .= "{$gruda}'{$this->descricao}'"; | |
| 234 | + $gruda = ", "; | |
| 235 | + } | |
| 236 | + | |
| 237 | + if (is_string($this->placa)) { | |
| 238 | + $campos .= "{$gruda}placa"; | |
| 239 | + $valores .= "{$gruda}'{$this->placa}'"; | |
| 240 | + $gruda = ", "; | |
| 241 | + } | |
| 242 | + | |
| 243 | + if (is_string($this->renavam)) { | |
| 244 | + $campos .= "{$gruda}renavam"; | |
| 245 | + $valores .= "{$gruda}'{$this->renavam}'"; | |
| 246 | + $gruda = ", "; | |
| 247 | + } | |
| 248 | + | |
| 249 | + if (is_string($this->marca)) { | |
| 250 | + $campos .= "{$gruda}marca"; | |
| 251 | + $valores .= "{$gruda}'{$this->marca}'"; | |
| 252 | + $gruda = ", "; | |
| 253 | + } | |
| 254 | + | |
| 255 | + if (is_string($this->chassi)) { | |
| 256 | + $campos .= "{$gruda}chassi"; | |
| 257 | + $valores .= "{$gruda}'{$this->chassi}'"; | |
| 258 | + $gruda = ", "; | |
| 259 | + } | |
| 260 | + | |
| 261 | + if (is_numeric($this->ano_fabricacao)) { | |
| 262 | + $campos .= "{$gruda}ano_fabricacao"; | |
| 263 | + $valores .= "{$gruda}'{$this->ano_fabricacao}'"; | |
| 264 | + $gruda = ", "; | |
| 265 | + } | |
| 266 | + | |
| 267 | + if (is_numeric($this->ano_modelo)) { | |
| 268 | + $campos .= "{$gruda}ano_modelo"; | |
| 269 | + $valores .= "{$gruda}'{$this->ano_modelo}'"; | |
| 270 | + $gruda = ", "; | |
| 271 | + } | |
| 272 | + | |
| 273 | + if (is_numeric($this->passageiros)) { | |
| 274 | + $campos .= "{$gruda}passageiros"; | |
| 275 | + $valores .= "{$gruda}'{$this->passageiros}'"; | |
| 276 | + $gruda = ", "; | |
| 277 | + } | |
| 278 | + | |
| 279 | + if (is_string($this->malha)) { | |
| 280 | + $campos .= "{$gruda}malha"; | |
| 281 | + $valores .= "{$gruda}'{$this->malha}'"; | |
| 282 | + $gruda = ", "; | |
| 283 | + } | |
| 284 | + | |
| 285 | + | |
| 286 | + if (is_numeric($this->ref_cod_tipo_veiculo)) { | |
| 287 | + $campos .= "{$gruda}ref_cod_tipo_veiculo"; | |
| 288 | + $valores .= "{$gruda}'{$this->ref_cod_tipo_veiculo}'"; | |
| 289 | + $gruda = ", "; | |
| 290 | + } | |
| 291 | + | |
| 292 | + if (is_string($this->exclusivo_transporte_escolar)) { | |
| 293 | + $campos .= "{$gruda}exclusivo_transporte_escolar"; | |
| 294 | + $valores .= "{$gruda}'{$this->exclusivo_transporte_escolar}'"; | |
| 295 | + $gruda = ", "; | |
| 296 | + } | |
| 297 | + | |
| 298 | + if (is_string($this->adaptado_necessidades_especiais)) { | |
| 299 | + $campos .= "{$gruda}adaptado_necessidades_especiais"; | |
| 300 | + $valores .= "{$gruda}'{$this->adaptado_necessidades_especiais}'"; | |
| 301 | + $gruda = ", "; | |
| 302 | + } | |
| 303 | + | |
| 304 | + if (is_string($this->ativo)) { | |
| 305 | + $campos .= "{$gruda}ativo"; | |
| 306 | + $valores .= "{$gruda}'{$this->ativo}'"; | |
| 307 | + $gruda = ", "; | |
| 308 | + } | |
| 309 | + | |
| 310 | + if (is_string($this->descricao_inativo)) { | |
| 311 | + $campos .= "{$gruda}descricao_inativo"; | |
| 312 | + $valores .= "{$gruda}'{$this->descricao_inativo}'"; | |
| 313 | + $gruda = ", "; | |
| 314 | + } | |
| 315 | + | |
| 316 | + if (is_numeric($this->ref_cod_empresa_transporte_escolar)) { | |
| 317 | + $campos .= "{$gruda}ref_cod_empresa_transporte_escolar"; | |
| 318 | + $valores .= "{$gruda}'{$this->ref_cod_empresa_transporte_escolar}'"; | |
| 319 | + $gruda = ", "; | |
| 320 | + } | |
| 321 | + | |
| 322 | + if (is_numeric($this->ref_cod_motorista)) { | |
| 323 | + $campos .= "{$gruda}ref_cod_motorista"; | |
| 324 | + $valores .= "{$gruda}'{$this->ref_cod_motorista}'"; | |
| 325 | + $gruda = ", "; | |
| 326 | + } | |
| 327 | + | |
| 328 | + if (is_string($this->observacao)) { | |
| 329 | + $campos .= "{$gruda}observacao"; | |
| 330 | + $valores .= "{$gruda}'{$this->observacao}'"; | |
| 331 | + $gruda = ", "; | |
| 332 | + } | |
| 333 | + | |
| 334 | + $db->Consulta("INSERT INTO {$this->_tabela} ( $campos ) VALUES( $valores )"); | |
| 335 | + return $db->InsertId("{$this->_tabela}_seq"); | |
| 336 | + } | |
| 337 | + | |
| 338 | + return FALSE; | |
| 339 | + } | |
| 340 | + | |
| 341 | + /** | |
| 342 | + * Edita os dados de um registro. | |
| 343 | + * @return bool | |
| 344 | + */ | |
| 345 | + function edita() | |
| 346 | + { | |
| 347 | + | |
| 348 | + if (is_numeric($this->cod_veiculo)) { | |
| 349 | + $db = new clsBanco(); | |
| 350 | + $set = ''; | |
| 351 | + | |
| 352 | + if (is_numeric($this->cod_veiculo)) { | |
| 353 | + $set .= "{$gruda}cod_veiculo = '{$this->cod_veiculo}'"; | |
| 354 | + $gruda = ", "; | |
| 355 | + } | |
| 356 | + | |
| 357 | + if (is_string($this->descricao)) { | |
| 358 | + $set .= "{$gruda}descricao = '{$this->descricao}'"; | |
| 359 | + $gruda = ", "; | |
| 360 | + } | |
| 361 | + | |
| 362 | + if (is_string($this->placa)) { | |
| 363 | + $set .= "{$gruda}placa = '{$this->placa}'"; | |
| 364 | + $gruda = ", "; | |
| 365 | + } | |
| 366 | + | |
| 367 | + if (is_string($this->renavam)) { | |
| 368 | + $set .= "{$gruda}renavam = '{$this->renavam}'"; | |
| 369 | + $gruda = ", "; | |
| 370 | + } | |
| 371 | + | |
| 372 | + if (is_string($this->marca)) { | |
| 373 | + $set .= "{$gruda}marca = '{$this->marca}'"; | |
| 374 | + $gruda = ", "; | |
| 375 | + } | |
| 376 | + | |
| 377 | + if (is_numeric($this->ano_fabricacao)) { | |
| 378 | + $set .= "{$gruda}ano_fabricacao = '{$this->ano_fabricacao}'"; | |
| 379 | + $gruda = ", "; | |
| 380 | + } | |
| 381 | + | |
| 382 | + if (is_numeric($this->ano_modelo)) { | |
| 383 | + $set .= "{$gruda}ano_modelo = '{$this->ano_modelo}'"; | |
| 384 | + $gruda = ", "; | |
| 385 | + } | |
| 386 | + | |
| 387 | + if (is_numeric($this->this->passageiros)) { | |
| 388 | + $set .= "{$gruda}passageiros = '{$this->passageiros}'"; | |
| 389 | + $gruda = ", "; | |
| 390 | + } | |
| 391 | + | |
| 392 | + if (is_string($this->malha)) { | |
| 393 | + $set .= "{$gruda}malha = '{$this->malha}'"; | |
| 394 | + $gruda = ", "; | |
| 395 | + } | |
| 396 | + | |
| 397 | + | |
| 398 | + if (is_numeric($this->ref_cod_tipo_veiculo)) { | |
| 399 | + $set .= "{$gruda}ref_cod_tipo_veiculo = '{$this->ref_cod_tipo_veiculo}'"; | |
| 400 | + $gruda = ", "; | |
| 401 | + } | |
| 402 | + | |
| 403 | + if (is_string($this->exclusivo_transporte_escolar)) { | |
| 404 | + $set .= "{$gruda}exclusivo_transporte_escolar = '{$this->exclusivo_transporte_escolar}'"; | |
| 405 | + $gruda = ", "; | |
| 406 | + } | |
| 407 | + | |
| 408 | + if (is_string($this->adaptado_necessidades_especiais)) { | |
| 409 | + $set .= "{$gruda}adaptado_necessidades_especiais = '{$this->adaptado_necessidades_especiais}'"; | |
| 410 | + $gruda = ", "; | |
| 411 | + } | |
| 412 | + | |
| 413 | + if (is_string($this->ativo)) { | |
| 414 | + $set .= "{$gruda}ativo = '{$this->ativo}'"; | |
| 415 | + $gruda = ", "; | |
| 416 | + } | |
| 417 | + | |
| 418 | + if (is_string($this->descricao_inativo)) { | |
| 419 | + $set .= "{$gruda}descricao_inativo = '{$this->descricao_inativo}'"; | |
| 420 | + $gruda = ", "; | |
| 421 | + } | |
| 422 | + | |
| 423 | + if (is_numeric($this->ref_cod_empresa_transporte_escolar)) { | |
| 424 | + $set .= "{$gruda}ref_cod_empresa_transporte_escolar = '{$this->ref_cod_empresa_transporte_escolar}'"; | |
| 425 | + $gruda = ", "; | |
| 426 | + } | |
| 427 | + | |
| 428 | + if (is_numeric($this->ref_cod_motorista)) { | |
| 429 | + $set .= "{$gruda}ref_cod_motorista = '{$this->ref_cod_motorista}'"; | |
| 430 | + $gruda = ", "; | |
| 431 | + } | |
| 432 | + | |
| 433 | + if (is_string($this->observacao)) { | |
| 434 | + $set .= "{$gruda}observacao = '{$this->observacao}'"; | |
| 435 | + $gruda = ", "; | |
| 436 | + } | |
| 437 | + if ($set) { | |
| 438 | + $db->Consulta("UPDATE {$this->_tabela} SET $set WHERE cod_veiculo = '{$this->cod_veiculo}'"); | |
| 439 | + return TRUE; | |
| 440 | + } | |
| 441 | + } | |
| 442 | + | |
| 443 | + return FALSE; | |
| 444 | + } | |
| 445 | + | |
| 446 | + /** | |
| 447 | + * Retorna uma lista de registros filtrados de acordo com os parâmetros. | |
| 448 | + * @return array | |
| 449 | + */ | |
| 450 | + function lista($cod_veiculo = NULL, $descricao = NULL, | |
| 451 | + $placa = NULL, $renavam = NULL, | |
| 452 | + $nome_motorista = NULL, $ref_cod_empresa_transporte_escolar = NULL, $marca = null, $ativo = null, $ref_cod_motorista = NULL) | |
| 453 | + { | |
| 454 | + $sql = "SELECT {$this->_campos_lista}, ( | |
| 455 | + SELECT | |
| 456 | + nome | |
| 457 | + FROM | |
| 458 | + modules.empresa_transporte_escolar emp,cadastro.pessoa p | |
| 459 | + WHERE | |
| 460 | + ref_cod_empresa_transporte_escolar = cod_empresa_transporte_escolar AND p.idpes = emp.ref_idpes | |
| 461 | + ) AS nome_empresa FROM {$this->_tabela}"; | |
| 462 | + $filtros = ""; | |
| 463 | + $whereNomes = ''; | |
| 464 | + $whereAnd = " WHERE "; | |
| 465 | + | |
| 466 | + if (is_numeric($cod_veiculo)) { | |
| 467 | + $filtros .= "{$whereAnd} cod_veiculo = '{$cod_veiculo}'"; | |
| 468 | + $whereAnd = " AND "; | |
| 469 | + } | |
| 470 | + | |
| 471 | + if (is_string($descricao)) { | |
| 472 | + $filtros .= " | |
| 473 | + {$whereAnd} TO_ASCII(LOWER(descricao)) LIKE TO_ASCII(LOWER('%{$descricao}%')) "; | |
| 474 | + | |
| 475 | + $whereAnd = ' AND '; | |
| 476 | + } | |
| 477 | + | |
| 478 | + if (is_string($placa)) { | |
| 479 | + $filtros .= "{$whereAnd} placa = '{$placa}'"; | |
| 480 | + $whereAnd = " AND "; | |
| 481 | + } | |
| 482 | + | |
| 483 | + if (is_string($renavam)) { | |
| 484 | + $filtros .= "{$whereAnd} renavam = '{$renavam}'"; | |
| 485 | + $whereAnd = " AND "; | |
| 486 | + } | |
| 487 | + | |
| 488 | + if (is_string($nome_motorista)) { | |
| 489 | + $whereNomes .= " | |
| 490 | + {$whereAnd} TO_ASCII(LOWER((SELECT | |
| 491 | + nome | |
| 492 | + FROM | |
| 493 | + modules.motorista m,cadastro.pessoa p | |
| 494 | + WHERE | |
| 495 | + ref_cod_motorista = cod_motorista AND p.idpes = m.ref_idpes))) LIKE TO_ASCII(LOWER('%{$nome_motorista}%')) "; | |
| 496 | + | |
| 497 | + $whereAnd = ' AND '; | |
| 498 | + } | |
| 499 | + | |
| 500 | + if (is_numeric($ref_cod_empresa_transporte_escolar)) { | |
| 501 | + $filtros .= "{$whereAnd} ref_cod_empresa_transporte_escolar = '{$ref_cod_empresa_transporte_escolar}'"; | |
| 502 | + $whereAnd = " AND "; | |
| 503 | + } | |
| 504 | + | |
| 505 | + if (is_numeric($ref_cod_motorista)) { | |
| 506 | + $filtros .= "{$whereAnd} ref_cod_motorista = '{$ref_cod_motorista}'"; | |
| 507 | + $whereAnd = " AND "; | |
| 508 | + } | |
| 509 | + | |
| 510 | + if (is_string($ativo)) { | |
| 511 | + $filtros .= "{$whereAnd} ativo = '{$ativo}'"; | |
| 512 | + $whereAnd = " AND "; | |
| 513 | + } | |
| 514 | + | |
| 515 | + if (is_string($marca)) { | |
| 516 | + $filtros .= " | |
| 517 | + {$whereAnd} TO_ASCII(LOWER(marca)) LIKE TO_ASCII(LOWER('%{$marca}%')) "; | |
| 518 | + $whereAnd = " AND "; | |
| 519 | + } | |
| 520 | + | |
| 521 | + $db = new clsBanco(); | |
| 522 | + $countCampos = count(explode(',', $this->_campos_lista))+2; | |
| 523 | + $resultado = array(); | |
| 524 | + | |
| 525 | + $sql .= $filtros.$whereNomes.$this->getOrderby() . $this->getLimite(); | |
| 526 | + | |
| 527 | + $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}"); | |
| 528 | + | |
| 529 | + $db->Consulta($sql); | |
| 530 | + | |
| 531 | + if ($countCampos > 1) { | |
| 532 | + while ($db->ProximoRegistro()) { | |
| 533 | + $tupla = $db->Tupla(); | |
| 534 | + $tupla["_total"] = $this->_total; | |
| 535 | + $resultado[] = $tupla; | |
| 536 | + } | |
| 537 | + } | |
| 538 | + else { | |
| 539 | + while ($db->ProximoRegistro()) { | |
| 540 | + $tupla = $db->Tupla(); | |
| 541 | + $resultado[] = $tupla[$this->_campos_lista]; | |
| 542 | + } | |
| 543 | + } | |
| 544 | + if (count($resultado)) { | |
| 545 | + return $resultado; | |
| 546 | + } | |
| 547 | + | |
| 548 | + return FALSE; | |
| 549 | + } | |
| 550 | + | |
| 551 | + /** | |
| 552 | + * Retorna um array com os dados de um registro. | |
| 553 | + * @return array | |
| 554 | + */ | |
| 555 | + function detalhe() | |
| 556 | + { | |
| 557 | + if (is_numeric($this->cod_veiculo)) { | |
| 558 | + $db = new clsBanco(); | |
| 559 | + $db->Consulta("SELECT {$this->_todos_campos},( | |
| 560 | + SELECT | |
| 561 | + nome | |
| 562 | + FROM | |
| 563 | + modules.empresa_transporte_escolar emp,cadastro.pessoa p | |
| 564 | + WHERE | |
| 565 | + ref_cod_empresa_transporte_escolar = cod_empresa_transporte_escolar AND p.idpes = emp.ref_idpes | |
| 566 | + ) AS nome_empresa, ( | |
| 567 | + SELECT | |
| 568 | + nome | |
| 569 | + FROM | |
| 570 | + modules.motorista m,cadastro.pessoa p | |
| 571 | + WHERE | |
| 572 | + ref_cod_motorista = cod_motorista AND p.idpes = m.ref_idpes | |
| 573 | + ) AS nome_motorista,(SELECT descricao FROM modules.tipo_veiculo where cod_tipo_veiculo = ref_cod_tipo_veiculo) AS descricao_tipo FROM {$this->_tabela} WHERE cod_veiculo = '{$this->cod_veiculo}'"); | |
| 574 | + $db->ProximoRegistro(); | |
| 575 | + return $db->Tupla(); | |
| 576 | + } | |
| 577 | + | |
| 578 | + return FALSE; | |
| 579 | + } | |
| 580 | + | |
| 581 | + /** | |
| 582 | + * Retorna um array com os dados de um registro. | |
| 583 | + * @return array | |
| 584 | + */ | |
| 585 | + function existe() | |
| 586 | + { | |
| 587 | + if (is_numeric($this->cod_veiculo)) { | |
| 588 | + $db = new clsBanco(); | |
| 589 | + $db->Consulta("SELECT 1 FROM {$this->_tabela} WHERE cod_veiculo = '{$this->cod_veiculo}'"); | |
| 590 | + $db->ProximoRegistro(); | |
| 591 | + return $db->Tupla(); | |
| 592 | + } | |
| 593 | + | |
| 594 | + return FALSE; | |
| 595 | + } | |
| 596 | + | |
| 597 | + /** | |
| 598 | + * Exclui um registro. | |
| 599 | + * @return bool | |
| 600 | + */ | |
| 601 | + function excluir() | |
| 602 | + { | |
| 603 | + if (is_numeric($this->cod_veiculo)) { | |
| 604 | + $sql = "DELETE FROM {$this->_tabela} WHERE cod_veiculo = '{$this->cod_veiculo}'"; | |
| 605 | + $db = new clsBanco(); | |
| 606 | + $db->Consulta($sql); | |
| 607 | + return true; | |
| 608 | + } | |
| 609 | + | |
| 610 | + return FALSE; | |
| 611 | + } | |
| 612 | + | |
| 613 | + /** | |
| 614 | + * Define quais campos da tabela serão selecionados no método Lista(). | |
| 615 | + */ | |
| 616 | + function setCamposLista($str_campos) | |
| 617 | + { | |
| 618 | + $this->_campos_lista = $str_campos; | |
| 619 | + } | |
| 620 | + | |
| 621 | + /** | |
| 622 | + * Define que o método Lista() deverpa retornar todos os campos da tabela. | |
| 623 | + */ | |
| 624 | + function resetCamposLista() | |
| 625 | + { | |
| 626 | + $this->_campos_lista = $this->_todos_campos; | |
| 627 | + } | |
| 628 | + | |
| 629 | + /** | |
| 630 | + * Define limites de retorno para o método Lista(). | |
| 631 | + */ | |
| 632 | + function setLimite($intLimiteQtd, $intLimiteOffset = NULL) | |
| 633 | + { | |
| 634 | + $this->_limite_quantidade = $intLimiteQtd; | |
| 635 | + $this->_limite_offset = $intLimiteOffset; | |
| 636 | + } | |
| 637 | + | |
| 638 | + /** | |
| 639 | + * Retorna a string com o trecho da query responsável pelo limite de | |
| 640 | + * registros retornados/afetados. | |
| 641 | + * | |
| 642 | + * @return string | |
| 643 | + */ | |
| 644 | + function getLimite() | |
| 645 | + { | |
| 646 | + if (is_numeric($this->_limite_quantidade)) { | |
| 647 | + $retorno = " LIMIT {$this->_limite_quantidade}"; | |
| 648 | + if (is_numeric($this->_limite_offset)) { | |
| 649 | + $retorno .= " OFFSET {$this->_limite_offset} "; | |
| 650 | + } | |
| 651 | + return $retorno; | |
| 652 | + } | |
| 653 | + return ''; | |
| 654 | + } | |
| 655 | + | |
| 656 | + /** | |
| 657 | + * Define o campo para ser utilizado como ordenação no método Lista(). | |
| 658 | + */ | |
| 659 | + function setOrderby($strNomeCampo) | |
| 660 | + { | |
| 661 | + if (is_string($strNomeCampo) && $strNomeCampo ) { | |
| 662 | + $this->_campo_order_by = $strNomeCampo; | |
| 663 | + } | |
| 664 | + } | |
| 665 | + | |
| 666 | + /** | |
| 667 | + * Retorna a string com o trecho da query responsável pela Ordenação dos | |
| 668 | + * registros. | |
| 669 | + * | |
| 670 | + * @return string | |
| 671 | + */ | |
| 672 | + function getOrderby() | |
| 673 | + { | |
| 674 | + if (is_string($this->_campo_order_by)) { | |
| 675 | + return " ORDER BY {$this->_campo_order_by} "; | |
| 676 | + } | |
| 677 | + return ''; | |
| 678 | + } | |
| 679 | +} | |
| 0 | 680 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,58 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package TransporteEscolar | |
| 27 | + * @subpackage Modules | |
| 28 | + * @since Arquivo disponível desde a versão ? | |
| 29 | + * @version $Id$ | |
| 30 | + */ | |
| 31 | + | |
| 32 | +require_once 'include/modules/clsModulesItinerarioTransporteEscolar.inc.php'; | |
| 33 | + | |
| 34 | +// Id do país na tabela public.pais | |
| 35 | +$id = isset($_GET['rota']) ? $_GET['rota'] : NULL; | |
| 36 | + | |
| 37 | +header('Content-type: text/xml; charset=iso-8859-1'); | |
| 38 | + | |
| 39 | +require_once 'Portabilis/Utils/DeprecatedXmlApi.php'; | |
| 40 | +Portabilis_Utils_DeprecatedXmlApi::returnEmptyQueryUnlessUserIsLoggedIn(); | |
| 41 | + | |
| 42 | +print '<?xml version="1.0" encoding="iso-8859-1"?>' . PHP_EOL; | |
| 43 | +print '<query>' . PHP_EOL; | |
| 44 | + | |
| 45 | +if ($id == strval(intval($id))) { | |
| 46 | + | |
| 47 | + $obj = new clsModulesItinerarioTransporteEscolar(); | |
| 48 | + $obj->setOrderBy(' seq asc '); | |
| 49 | + $pontos = $obj->listaPontos($id); | |
| 50 | + | |
| 51 | + $c=0; | |
| 52 | + foreach ($pontos as $reg) { | |
| 53 | + print sprintf(' <ponto cod_ponto="%s">%s</ponto>' . PHP_EOL, | |
| 54 | + $reg['ref_cod_ponto_transporte_escolar'], $reg['descricao'].' - '.($reg['tipo']=='I'?'Ida':'Volta')); | |
| 55 | + } | |
| 56 | +} | |
| 57 | + | |
| 58 | +print '</query>'; | |
| 0 | 59 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,140 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package iEd_Pmieducar | |
| 27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/clsBase.inc.php'; | |
| 32 | +require_once 'include/clsDetalhe.inc.php'; | |
| 33 | +require_once 'include/clsBanco.inc.php'; | |
| 34 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 35 | +require_once 'include/modules/clsModulesEmpresaTransporteEscolar.inc.php'; | |
| 36 | + | |
| 37 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 38 | + | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * clsIndexBase class. | |
| 42 | + * | |
| 43 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 44 | + * @category i-Educar | |
| 45 | + * @license @@license@@ | |
| 46 | + * @package iEd_Pmieducar | |
| 47 | + * @since Classe disponível desde a versão 1.0.0 | |
| 48 | + * @version @@package_version@@ | |
| 49 | + */ | |
| 50 | +class clsIndexBase extends clsBase | |
| 51 | +{ | |
| 52 | + function Formular() | |
| 53 | + { | |
| 54 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Empresas'); | |
| 55 | + $this->processoAp = 21235; | |
| 56 | + } | |
| 57 | +} | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * indice class. | |
| 61 | + * | |
| 62 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 63 | + * @category i-Educar | |
| 64 | + * @license @@license@@ | |
| 65 | + * @package iEd_Pmieducar | |
| 66 | + * @since Classe disponível desde a versão 1.0.0 | |
| 67 | + * @version @@package_version@@ | |
| 68 | + */ | |
| 69 | +class indice extends clsDetalhe | |
| 70 | +{ | |
| 71 | + var $titulo; | |
| 72 | + | |
| 73 | + function Gerar() | |
| 74 | + { | |
| 75 | + @session_start(); | |
| 76 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 77 | + session_write_close(); | |
| 78 | + | |
| 79 | + // Verificação de permissão para cadastro. | |
| 80 | + $this->obj_permissao = new clsPermissoes(); | |
| 81 | + | |
| 82 | + $this->nivel_usuario = $this->obj_permissao->nivel_acesso($this->pessoa_logada); | |
| 83 | + | |
| 84 | + $this->titulo = 'Empresa transporte escolar - Detalhe'; | |
| 85 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | |
| 86 | + | |
| 87 | + $cod_empresa_transporte_escolar = $_GET['cod_empresa']; | |
| 88 | + | |
| 89 | + $tmp_obj = new clsModulesEmpresaTransporteEscolar($cod_empresa_transporte_escolar); | |
| 90 | + $registro = $tmp_obj->detalhe(); | |
| 91 | + | |
| 92 | + if (! $registro) { | |
| 93 | + header('Location: transporte_empresa_lst.php'); | |
| 94 | + die(); | |
| 95 | + } | |
| 96 | + | |
| 97 | + $objPessoaJuridica = new clsPessoaJuridica(); | |
| 98 | + list ($id_federal, $endereco, $cep, $nm_bairro, $cidade, $ddd_telefone_1, $telefone_1, $ddd_telefone_2, $telefone_2, $ddd_telefone_mov, $telefone_mov, $ddd_telefone_fax, $telefone_fax, $email, $ins_est) = $objPessoaJuridica->queryRapida($registro['ref_idpes'], "cnpj","logradouro","cep","bairro","cidade", "ddd_1","fone_1","ddd_2","fone_2","ddd_mov","fone_mov","ddd_fax","fone_fax", "email","insc_estadual"); | |
| 99 | + | |
| 100 | + $this->addDetalhe( array("Código da empresa", $cod_empresa_transporte_escolar)); | |
| 101 | + $this->addDetalhe( array("Nome fantasia", $registro['nome_empresa']) ); | |
| 102 | + $this->addDetalhe( array("Nome do responsável", $registro['nome_responsavel']) ); | |
| 103 | + $this->addDetalhe( array("CNPJ", int2CNPJ($id_federal)) ); | |
| 104 | + $this->addDetalhe( array("Endereço", $endereco) ); | |
| 105 | + $this->addDetalhe( array("CEP", $cep) ); | |
| 106 | + $this->addDetalhe( array("Bairro", $nm_bairro) ); | |
| 107 | + $this->addDetalhe( array("Cidade", $cidade) ); | |
| 108 | + if (trim($telefone_1)!='') | |
| 109 | + $this->addDetalhe( array("Telefone 1", "({$ddd_telefone_1}) {$telefone_1}") ); | |
| 110 | + if (trim($telefone_2)!='') | |
| 111 | + $this->addDetalhe( array("Telefone 2", "({$ddd_telefone_2}) {$telefone_2}") ); | |
| 112 | + if (trim($telefone_mov)!='') | |
| 113 | + $this->addDetalhe( array("Celular", "({$ddd_telefone_mov}) {$telefone_mov}") ); | |
| 114 | + if (trim($telefone_fax)!='') | |
| 115 | + $this->addDetalhe( array("Fax", "({$ddd_telefone_fax}) {$telefone_fax}") ); | |
| 116 | + | |
| 117 | + $this->addDetalhe( array("E-mail", $email) ); | |
| 118 | + | |
| 119 | + if( ! $ins_est ) $ins_est = "isento"; | |
| 120 | + $this->addDetalhe( array("Inscrição estadual", $ins_est) ); | |
| 121 | + $this->addDetalhe( array("Observação", $registro['observacao'])); | |
| 122 | + $this->url_novo = "../module/TransporteEscolar/Empresa"; | |
| 123 | + $this->url_editar = "../module/TransporteEscolar/Empresa?id={$cod_empresa_transporte_escolar}"; | |
| 124 | + $this->url_cancelar = "transporte_empresa_lst.php"; | |
| 125 | + | |
| 126 | + $this->largura = "100%"; | |
| 127 | + } | |
| 128 | +} | |
| 129 | + | |
| 130 | +// Instancia o objeto da página | |
| 131 | +$pagina = new clsIndexBase(); | |
| 132 | + | |
| 133 | +// Instancia o objeto de conteúdo | |
| 134 | +$miolo = new indice(); | |
| 135 | + | |
| 136 | +// Passa o conteúdo para a página | |
| 137 | +$pagina->addForm($miolo); | |
| 138 | + | |
| 139 | +// Gera o HTML | |
| 140 | +$pagina->MakeAll(); | ... | ... |
| ... | ... | @@ -0,0 +1,146 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | +require_once 'include/clsBase.inc.php'; | |
| 30 | +require_once 'include/clsListagem.inc.php'; | |
| 31 | +require_once 'include/clsBanco.inc.php'; | |
| 32 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 33 | +require_once 'include/modules/clsModulesEmpresaTransporteEscolar.inc.php'; | |
| 34 | + | |
| 35 | +class clsIndexBase extends clsBase | |
| 36 | +{ | |
| 37 | + function Formular() | |
| 38 | + { | |
| 39 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Empresas" ); | |
| 40 | + $this->processoAp = "21235"; | |
| 41 | + } | |
| 42 | +} | |
| 43 | + | |
| 44 | +class indice extends clsListagem | |
| 45 | +{ | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Referencia pega da session para o idpes do usuario atual | |
| 49 | + * | |
| 50 | + * @var int | |
| 51 | + */ | |
| 52 | + var $pessoa_logada; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Titulo no topo da pagina | |
| 56 | + * | |
| 57 | + * @var int | |
| 58 | + */ | |
| 59 | + var $titulo; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * Quantidade de registros a ser apresentada em cada pagina | |
| 63 | + * | |
| 64 | + * @var int | |
| 65 | + */ | |
| 66 | + var $limite; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Inicio dos registros a serem exibidos (limit) | |
| 70 | + * | |
| 71 | + * @var int | |
| 72 | + */ | |
| 73 | + var $offset; | |
| 74 | + | |
| 75 | + var $cod_empresa; | |
| 76 | + var $nome_empresa; | |
| 77 | + var $nome_responsavel; | |
| 78 | + | |
| 79 | + function Gerar() | |
| 80 | + { | |
| 81 | + | |
| 82 | + @session_start(); | |
| 83 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 84 | + session_write_close(); | |
| 85 | + | |
| 86 | + $this->titulo = "Empresas de transporte escolar - Listagem"; | |
| 87 | + | |
| 88 | + foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto | |
| 89 | + $this->$var = ( $val === "" ) ? null: $val; | |
| 90 | + | |
| 91 | + $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
| 92 | + | |
| 93 | + $this->campoNumero("cod_empresa","Código da empresa",$this->cod_empresa,20,255,false); | |
| 94 | + $this->campoTexto("nome_empresa","Nome fantasia", $this->nome_empresa,50,255,false); | |
| 95 | + $this->campoTexto("nome_responsavel","Nome do responsável", $this->nome_responsavel,50,255,false); | |
| 96 | + | |
| 97 | + $obj_permissoes = new clsPermissoes(); | |
| 98 | + | |
| 99 | + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); | |
| 100 | + | |
| 101 | + $this->addCabecalhos( array( | |
| 102 | + "Código da empresa", | |
| 103 | + "Nome fantasia", | |
| 104 | + "Nome do responsável", | |
| 105 | + "Telefone" | |
| 106 | + ) ); | |
| 107 | + | |
| 108 | + // Paginador | |
| 109 | + $this->limite = 20; | |
| 110 | + $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; | |
| 111 | + | |
| 112 | + | |
| 113 | + $obj_empresa = new clsModulesEmpresaTransporteEscolar(); | |
| 114 | + $obj_empresa->setLimite($this->limite,$this->offset); | |
| 115 | + | |
| 116 | + $empresas = $obj_empresa->lista($this->cod_empresa,null,null,$this->nome_empresa, $this->nome_responsavel); | |
| 117 | + $total = $empresas->_total; | |
| 118 | + | |
| 119 | + foreach ( $empresas AS $registro ) { | |
| 120 | + | |
| 121 | + $this->addLinhas( array( | |
| 122 | + "<a href=\"transporte_empresa_det.php?cod_empresa={$registro["cod_empresa_transporte_escolar"]}\">{$registro["cod_empresa_transporte_escolar"]}</a>", | |
| 123 | + "<a href=\"transporte_empresa_det.php?cod_empresa={$registro["cod_empresa_transporte_escolar"]}\">{$registro["nome_empresa"]}</a>", | |
| 124 | + "<a href=\"transporte_empresa_det.php?cod_empresa={$registro["cod_empresa_transporte_escolar"]}\">{$registro["nome_responsavel"]}</a>", | |
| 125 | + "<a href=\"transporte_empresa_det.php?cod_empresa={$registro["cod_empresa_transporte_escolar"]}\">{$registro["telefone"]}</a>" | |
| 126 | + ) ); | |
| 127 | + } | |
| 128 | + | |
| 129 | + $this->addPaginador2( "transporte_empresa_lst.php", $total, $_GET, $this->nome, $this->limite ); | |
| 130 | + | |
| 131 | + $this->acao = "go(\"../module/TransporteEscolar/Empresa\")"; | |
| 132 | + $this->nome_acao = "Novo"; | |
| 133 | + | |
| 134 | + //** | |
| 135 | + $this->largura = "100%"; | |
| 136 | + } | |
| 137 | +} | |
| 138 | +// cria uma extensao da classe base | |
| 139 | +$pagina = new clsIndexBase(); | |
| 140 | +// cria o conteudo | |
| 141 | +$miolo = new indice(); | |
| 142 | +// adiciona o conteudo na clsBase | |
| 143 | +$pagina->addForm( $miolo ); | |
| 144 | +// gera o html | |
| 145 | +$pagina->MakeAll(); | |
| 146 | +?> | ... | ... |
| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | +<?php | |
| 2 | +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 3 | + * * | |
| 4 | + * @author Prefeitura Municipal de Itajaí * | |
| 5 | + * @updated 29/03/2007 * | |
| 6 | + * Pacote: i-PLB Software Público Livre e Brasileiro * | |
| 7 | + * * | |
| 8 | + * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | |
| 9 | + * ctima@itajai.sc.gov.br * | |
| 10 | + * * | |
| 11 | + * Este programa é software livre, você pode redistribuí-lo e/ou * | |
| 12 | + * modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | |
| 13 | + * publicada pela Free Software Foundation, tanto a versão 2 da * | |
| 14 | + * Licença como (a seu critério) qualquer versão mais nova. * | |
| 15 | + * * | |
| 16 | + * Este programa é distribuído na expectativa de ser útil, mas SEM * | |
| 17 | + * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | |
| 18 | + * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | |
| 19 | + * sulte a Licença Pública Geral GNU para obter mais detalhes. * | |
| 20 | + * * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU * | |
| 22 | + * junto com este programa. Se não, escreva para a Free Software * | |
| 23 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | |
| 24 | + * 02111-1307, USA. * | |
| 25 | + * * | |
| 26 | + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
| 27 | + | |
| 28 | +$desvio_diretorio = ""; | |
| 29 | +require_once ("include/clsBase.inc.php"); | |
| 30 | +require_once ("include/clsBanco.inc.php"); | |
| 31 | + | |
| 32 | +class clsIndex extends clsBase | |
| 33 | +{ | |
| 34 | + | |
| 35 | + function Formular() | |
| 36 | + { | |
| 37 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Transporte Escolar" ); | |
| 38 | + $this->processoAp = "21234"; | |
| 39 | + } | |
| 40 | +} | |
| 41 | + | |
| 42 | +class indice | |
| 43 | +{ | |
| 44 | + function RenderHTML() | |
| 45 | + { | |
| 46 | + return " | |
| 47 | + <table width='100%' style='height: 100%;'> | |
| 48 | + <tr align=center valign='top'><td></td></tr> | |
| 49 | + </table> | |
| 50 | + "; | |
| 51 | + } | |
| 52 | +} | |
| 53 | + | |
| 54 | + | |
| 55 | +$pagina = new clsIndex(); | |
| 56 | + | |
| 57 | +$miolo = new indice(); | |
| 58 | +$pagina->addForm( $miolo ); | |
| 59 | + | |
| 60 | +$pagina->MakeAll(); | |
| 61 | + | |
| 62 | +?> | |
| 0 | 63 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,325 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | + | |
| 30 | +require_once 'include/clsBase.inc.php'; | |
| 31 | +require_once 'include/clsCadastro.inc.php'; | |
| 32 | +require_once 'include/clsBanco.inc.php'; | |
| 33 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 34 | +require_once 'lib/Portabilis/View/Helper/Application.php'; | |
| 35 | + | |
| 36 | +require_once 'include/modules/clsModulesRotaTransporteEscolar.inc.php'; | |
| 37 | +require_once 'include/modules/clsModulesItinerarioTransporteEscolar.inc.php'; | |
| 38 | + | |
| 39 | +class clsIndexBase extends clsBase | |
| 40 | +{ | |
| 41 | + function Formular() | |
| 42 | + { | |
| 43 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Itinerário" ); | |
| 44 | + $this->processoAp = "21238"; | |
| 45 | + } | |
| 46 | +} | |
| 47 | + | |
| 48 | +class indice extends clsCadastro | |
| 49 | +{ | |
| 50 | + /** | |
| 51 | + * Referencia pega da session para o idpes do usuario atual | |
| 52 | + * | |
| 53 | + * @var int | |
| 54 | + */ | |
| 55 | + var $pessoa_logada; | |
| 56 | + | |
| 57 | + var $cod_rota; | |
| 58 | + var $descricao; | |
| 59 | + | |
| 60 | +// INCLUI NOVO | |
| 61 | + var $pontos; | |
| 62 | + var $ref_cod_ponto_transporte_escolar; | |
| 63 | + var $hora; | |
| 64 | + var $tipo; | |
| 65 | + var $ref_cod_veiculo; | |
| 66 | + | |
| 67 | + function Inicializar() | |
| 68 | + { | |
| 69 | + $retorno = "Editar"; | |
| 70 | + @session_start(); | |
| 71 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 72 | + @session_write_close(); | |
| 73 | + | |
| 74 | + $this->cod_rota=$_GET["cod_rota"]; | |
| 75 | + | |
| 76 | + $obj_permissoes = new clsPermissoes(); | |
| 77 | + $obj_permissoes->permissao_cadastra( 21238, $this->pessoa_logada, 7, "transporte_rota_det.php?cod_rota={$this->cod_rota}" ); | |
| 78 | + $volta = false; | |
| 79 | + if( is_numeric( $this->cod_rota )) | |
| 80 | + { | |
| 81 | + $obj = new clsModulesRotaTransporteEscolar( $this->cod_rota ); | |
| 82 | + $registro = $obj->detalhe(); | |
| 83 | + if( $registro ) | |
| 84 | + $this->descricao = $registro['descricao']; | |
| 85 | + else | |
| 86 | + $volta = true; | |
| 87 | + }else | |
| 88 | + $volta = true; | |
| 89 | + | |
| 90 | + | |
| 91 | + if ($volta){ | |
| 92 | + header('Location: transporte_rota_lst.php'); | |
| 93 | + die(); | |
| 94 | + } | |
| 95 | + $this->url_cancelar = "transporte_rota_det.php?cod_rota={$this->cod_rota}"; | |
| 96 | + $this->nome_url_cancelar = "Cancelar"; | |
| 97 | + | |
| 98 | + return $retorno; | |
| 99 | + } | |
| 100 | + | |
| 101 | + function Gerar() | |
| 102 | + { | |
| 103 | + | |
| 104 | + if( $_POST ) | |
| 105 | + foreach( $_POST AS $campo => $val ) | |
| 106 | + $this->$campo = ( !$this->$campo ) ? $val : $this->$campo ; | |
| 107 | + | |
| 108 | + $this->campoRotulo("cod_rota","Código da rota" ,$this->cod_rota); | |
| 109 | + $this->campoRotulo("descricao","Rota", $this->descricao ); | |
| 110 | + | |
| 111 | + $this->campoQuebra(); | |
| 112 | + | |
| 113 | + if( is_numeric( $this->cod_rota) && !$_POST) | |
| 114 | + { | |
| 115 | + $obj = new clsModulesItinerarioTransporteEscolar(); | |
| 116 | + $obj->setOrderby(" seq ASC"); | |
| 117 | + $registros = $obj->lista(null, $this->cod_rota); | |
| 118 | + $qtd_pontos = 0; | |
| 119 | + if( $registros ) | |
| 120 | + { | |
| 121 | + foreach ( $registros AS $campo ) | |
| 122 | + { | |
| 123 | + $this->pontos[$qtd_pontos][] = $campo["ref_cod_ponto_transporte_escolar"].' - '.$campo["descricao"]; | |
| 124 | + $this->pontos[$qtd_pontos][] = $campo["hora"]; | |
| 125 | + $this->pontos[$qtd_pontos][] = $campo["tipo"]; | |
| 126 | + $this->pontos[$qtd_pontos][] = $campo["ref_cod_veiculo"].' - '.$campo["nome_onibus"]; | |
| 127 | + $qtd_pontos++; | |
| 128 | + } | |
| 129 | + } | |
| 130 | + } | |
| 131 | + | |
| 132 | + $this->campoTabelaInicio("pontos","Itinerário",array("Ponto (Requer pré-cadastro)<br/> <spam style=\" font-weight: normal; font-size: 10px;\">Digite o código ou nome do ponto e selecione o desejado</spam>","Hora","Tipo","Veículo (Requer pré-cadastro)<br/> <spam style=\" font-weight: normal; font-size: 10px;\">Digite o código, nome ou placa do veículo e selecione o desejado</spam>" ),$this->pontos); | |
| 133 | + | |
| 134 | + $this->campoTexto( "ref_cod_ponto_transporte_escolar", "Ponto (Requer pré-cadastro)", $this->ref_cod_ponto_transporte_escolar, 50, 255, false, true, false, '', '', '', 'onfocus' ); | |
| 135 | + | |
| 136 | + $this->campoHora( "hora", "Hora", $this->hora); | |
| 137 | + $this->campoLista( "tipo", "Tipo", array( '' => "Selecione", 'I' => 'Ida', 'V' => 'Volta'),$this->tipo ); | |
| 138 | + $this->campoTexto( "ref_cod_veiculo", "Veículo", $this->ref_cod_veiculo, 50, 255, false, false, false, '', '', '', 'onfocus' ); | |
| 139 | + $this->campoTabelaFim(); | |
| 140 | + | |
| 141 | + $this->campoQuebra(); | |
| 142 | + | |
| 143 | + $style = "/modules/Portabilis/Assets/Stylesheets/Frontend.css"; | |
| 144 | + Portabilis_View_Helper_Application::loadStylesheet($this, $style); | |
| 145 | + | |
| 146 | + | |
| 147 | + Portabilis_View_Helper_Application::loadJQueryLib($this); | |
| 148 | + Portabilis_View_Helper_Application::loadJQueryUiLib($this); | |
| 149 | + | |
| 150 | + Portabilis_View_Helper_Application::loadJavascript( | |
| 151 | + $this, | |
| 152 | + array('/modules/Portabilis/Assets/Javascripts/Utils.js', | |
| 153 | + '/modules/Portabilis/Assets/Javascripts/Frontend/Inputs/SimpleSearch.js', | |
| 154 | + '/modules/Portabilis/Assets/Javascripts/Validator.js') | |
| 155 | + ); | |
| 156 | + $this->addBotao('Excluir todos',"transporte_itinerario_del.php?cod_rota={$this->cod_rota}"); | |
| 157 | + | |
| 158 | + } | |
| 159 | + | |
| 160 | + function Novo() | |
| 161 | + { | |
| 162 | + return true; | |
| 163 | + } | |
| 164 | + | |
| 165 | + function Editar() | |
| 166 | + { | |
| 167 | + | |
| 168 | + | |
| 169 | + @session_start(); | |
| 170 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 171 | + @session_write_close(); | |
| 172 | + $obj_permissoes = new clsPermissoes(); | |
| 173 | + $obj_permissoes->permissao_cadastra( 21238, $this->pessoa_logada, 7, "transporte_rota_det.php?cod_rota={$this->cod_rota}" ); | |
| 174 | + | |
| 175 | + if ($this->ref_cod_ponto_transporte_escolar) | |
| 176 | + { | |
| 177 | + | |
| 178 | + $obj = new clsModulesItinerarioTransporteEscolar(); | |
| 179 | + $excluiu = $obj->excluirTodos( $this->cod_rota ); | |
| 180 | + if ( $excluiu ) | |
| 181 | + { | |
| 182 | + $sequencial = 1; | |
| 183 | + foreach ( $this->ref_cod_ponto_transporte_escolar AS $key => $ponto ) | |
| 184 | + { | |
| 185 | + | |
| 186 | + $obj = new clsModulesItinerarioTransporteEscolar(NULL, $this->cod_rota, $sequencial, $this->retornaCodigo($ponto), $this->retornaCodigo($this->ref_cod_veiculo[$key]), | |
| 187 | + $this->hora[$key], $this->tipo[$key]); | |
| 188 | + $cadastrou1 = $obj->cadastra(); | |
| 189 | + if( !$cadastrou1 ) | |
| 190 | + { | |
| 191 | + $this->mensagem = "Cadastro não realizado.<br>"; | |
| 192 | + return false; | |
| 193 | + } | |
| 194 | + $sequencial++; | |
| 195 | + | |
| 196 | + } | |
| 197 | + } | |
| 198 | + $this->mensagem .= "Edição efetuada com sucesso.<br>"; | |
| 199 | + header( "Location: transporte_rota_det.php?cod_rota={$this->cod_rota}" ); | |
| 200 | + die(); | |
| 201 | + return true; | |
| 202 | + | |
| 203 | + } | |
| 204 | + | |
| 205 | + } | |
| 206 | + | |
| 207 | + function Excluir() | |
| 208 | + { | |
| 209 | + return true; | |
| 210 | + } | |
| 211 | + | |
| 212 | + protected function retornaCodigo($palavra){ | |
| 213 | + | |
| 214 | + return substr($palavra, 0, strpos($palavra, " -")); | |
| 215 | + } | |
| 216 | + | |
| 217 | + protected function fixupFrequencia($frequencia) { | |
| 218 | + if (strpos($frequencia, ',')) { | |
| 219 | + $frequencia = str_replace('.', '', $frequencia); | |
| 220 | + $frequencia = str_replace(',', '.', $frequencia); | |
| 221 | + } | |
| 222 | + | |
| 223 | + return $frequencia; | |
| 224 | + } | |
| 225 | +} | |
| 226 | + | |
| 227 | +// cria uma extensao da classe base | |
| 228 | +$pagina = new clsIndexBase(); | |
| 229 | +// cria o conteudo | |
| 230 | +$miolo = new indice(); | |
| 231 | +// adiciona o conteudo na clsBase | |
| 232 | +$pagina->addForm( $miolo ); | |
| 233 | +// gera o html | |
| 234 | +$pagina->MakeAll(); | |
| 235 | + | |
| 236 | +?> | |
| 237 | + | |
| 238 | +<script type="text/javascript"> | |
| 239 | + | |
| 240 | + // autocomplete disciplina fields | |
| 241 | + | |
| 242 | + var handleSelect = function(event, ui){ | |
| 243 | + $j(event.target).val(ui.item.label); | |
| 244 | + return false; | |
| 245 | + }; | |
| 246 | + | |
| 247 | + var search = function(request, response) { | |
| 248 | + var searchPath = '/module/Api/Ponto?oper=get&resource=ponto-search'; | |
| 249 | + var params = { query : request.term }; | |
| 250 | + | |
| 251 | + $j.get(searchPath, params, function(dataResponse) { | |
| 252 | + simpleSearch.handleSearch(dataResponse, response); | |
| 253 | + }); | |
| 254 | + }; | |
| 255 | + | |
| 256 | + var searchV = function(request, response) { | |
| 257 | + var searchPath = '/module/Api/Veiculo?oper=get&resource=veiculo-search'; | |
| 258 | + var params = { query : request.term }; | |
| 259 | + | |
| 260 | + $j.get(searchPath, params, function(dataResponse) { | |
| 261 | + simpleSearch.handleSearch(dataResponse, response); | |
| 262 | + }); | |
| 263 | + }; | |
| 264 | + | |
| 265 | + function setAutoComplete() { | |
| 266 | + $j.each($j('input[id^="ref_cod_ponto_transporte_escolar"]'), function(index, field) { | |
| 267 | + | |
| 268 | + $j(field).autocomplete({ | |
| 269 | + source : search, | |
| 270 | + select : handleSelect, | |
| 271 | + minLength : 1, | |
| 272 | + autoFocus : true | |
| 273 | + }); | |
| 274 | + | |
| 275 | + }); | |
| 276 | + $j.each($j('input[id^="ref_cod_veiculo"]'), function(index, field) { | |
| 277 | + | |
| 278 | + $j(field).autocomplete({ | |
| 279 | + source : searchV, | |
| 280 | + select : handleSelect, | |
| 281 | + minLength : 1, | |
| 282 | + autoFocus : true | |
| 283 | + }); | |
| 284 | + | |
| 285 | + }); | |
| 286 | + } | |
| 287 | + | |
| 288 | + setAutoComplete(); | |
| 289 | + | |
| 290 | + document.onclick = function(event) { | |
| 291 | + var targetElement = event.target; | |
| 292 | + if ( targetElement.value == " Cancelar " ) { | |
| 293 | + | |
| 294 | + var cod_rota = $j('#cod_rota').val(); | |
| 295 | + location.href="transporte_rota_det.php?cod_rota="+cod_rota; | |
| 296 | + } else if(targetElement.value == "Excluir todos"){ | |
| 297 | + var cod_rota = $j('#cod_rota').val(); | |
| 298 | + if(confirm('Este procedimento irá excluir todos os pontos do itinerário. Tem certeza que deseja continuar?')){ | |
| 299 | + location.href="transporte_itinerario_del.php?cod_rota="+cod_rota; | |
| 300 | + } | |
| 301 | + } | |
| 302 | + }; | |
| 303 | + | |
| 304 | + var submitForm = function(event) { | |
| 305 | + formUtils.submit(); | |
| 306 | + } | |
| 307 | + | |
| 308 | + | |
| 309 | + // bind events | |
| 310 | + | |
| 311 | + var $addPontosButton = $j('#btn_add_tab_add_1'); | |
| 312 | + | |
| 313 | + $addPontosButton.click(function(){ | |
| 314 | + setAutoComplete(); | |
| 315 | + }); | |
| 316 | + | |
| 317 | + | |
| 318 | + // submit button | |
| 319 | + | |
| 320 | + var $submitButton = $j('#btn_enviar'); | |
| 321 | + | |
| 322 | + $submitButton.removeAttr('onclick'); | |
| 323 | + $submitButton.click(submitForm); | |
| 324 | + | |
| 325 | +</script> | |
| 0 | 326 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,99 @@ |
| 1 | +<?php | |
| 2 | +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 3 | + * * | |
| 4 | + * @author Prefeitura Municipal de Itajaí * | |
| 5 | + * @updated 29/03/2007 * | |
| 6 | + * Pacote: i-PLB Software Público Livre e Brasileiro * | |
| 7 | + * * | |
| 8 | + * Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí * | |
| 9 | + * ctima@itajai.sc.gov.br * | |
| 10 | + * * | |
| 11 | + * Este programa é software livre, você pode redistribuí-lo e/ou * | |
| 12 | + * modificá-lo sob os termos da Licença Pública Geral GNU, conforme * | |
| 13 | + * publicada pela Free Software Foundation, tanto a versão 2 da * | |
| 14 | + * Licença como (a seu critério) qualquer versão mais nova. * | |
| 15 | + * * | |
| 16 | + * Este programa é distribuído na expectativa de ser útil, mas SEM * | |
| 17 | + * QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI- * | |
| 18 | + * ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con- * | |
| 19 | + * sulte a Licença Pública Geral GNU para obter mais detalhes. * | |
| 20 | + * * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU * | |
| 22 | + * junto com este programa. Se não, escreva para a Free Software * | |
| 23 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * | |
| 24 | + * 02111-1307, USA. * | |
| 25 | + * * | |
| 26 | + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
| 27 | +require_once ("include/clsBase.inc.php"); | |
| 28 | +require_once ("include/clsCadastro.inc.php"); | |
| 29 | +require_once ("include/clsBanco.inc.php"); | |
| 30 | +require_once( "include/pmieducar/geral.inc.php" ); | |
| 31 | +require_once 'include/modules/clsModulesItinerarioTransporteEscolar.inc.php'; | |
| 32 | + | |
| 33 | +class clsIndexBase extends clsBase | |
| 34 | +{ | |
| 35 | + function Formular() | |
| 36 | + { | |
| 37 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Itinerário" ); | |
| 38 | + $this->processoAp = "21238"; | |
| 39 | + } | |
| 40 | +} | |
| 41 | + | |
| 42 | +class indice extends clsCadastro | |
| 43 | +{ | |
| 44 | + | |
| 45 | + var $cod_rota; | |
| 46 | + | |
| 47 | + | |
| 48 | + function Inicializar() | |
| 49 | + { | |
| 50 | + $retorno = "Novo"; | |
| 51 | + @session_start(); | |
| 52 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 53 | + @session_write_close(); | |
| 54 | + | |
| 55 | + $this->cod_rota=$_GET["cod_rota"]; | |
| 56 | + | |
| 57 | + $obj_permissoes = new clsPermissoes(); | |
| 58 | + $obj_permissoes->permissao_cadastra( 578, $this->pessoa_logada, 7, "transporte_itinerario_cad.php?cod_rota={$this->cod_rota}" ); | |
| 59 | + | |
| 60 | + $obj = new clsModulesItinerarioTransporteEscolar(); | |
| 61 | + $excluiu = $obj->excluirTodos( $this->cod_rota ); | |
| 62 | + | |
| 63 | + if($excluiu) | |
| 64 | + { | |
| 65 | + echo "<script> | |
| 66 | + window.location='transporte_rota_det.php?cod_rota={$this->cod_rota}'; | |
| 67 | + </script>"; | |
| 68 | + } | |
| 69 | + | |
| 70 | + | |
| 71 | + die(); | |
| 72 | + return; | |
| 73 | + } | |
| 74 | + | |
| 75 | + function Gerar() | |
| 76 | + { | |
| 77 | + | |
| 78 | + } | |
| 79 | + | |
| 80 | + function Novo() | |
| 81 | + { | |
| 82 | + | |
| 83 | + } | |
| 84 | + | |
| 85 | + function Excluir() | |
| 86 | + { | |
| 87 | + | |
| 88 | + } | |
| 89 | +} | |
| 90 | + | |
| 91 | +// cria uma extensao da classe base | |
| 92 | +$pagina = new clsIndexBase(); | |
| 93 | +// cria o conteudo | |
| 94 | +$miolo = new indice(); | |
| 95 | +// adiciona o conteudo na clsBase | |
| 96 | +$pagina->addForm( $miolo ); | |
| 97 | +// gera o html | |
| 98 | +$pagina->MakeAll(); | |
| 99 | +?> | ... | ... |
| ... | ... | @@ -0,0 +1,126 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/clsBase.inc.php'; | |
| 32 | +require_once 'include/clsDetalhe.inc.php'; | |
| 33 | +require_once 'include/clsBanco.inc.php'; | |
| 34 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 35 | +require_once 'include/modules/clsModulesMotorista.inc.php'; | |
| 36 | + | |
| 37 | +require_once 'Portabilis/Date/Utils.php'; | |
| 38 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 39 | + | |
| 40 | + | |
| 41 | +/** | |
| 42 | + * clsIndexBase class. | |
| 43 | + * | |
| 44 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 45 | + * @category i-Educar | |
| 46 | + * @license @@license@@ | |
| 47 | + * @package iEd_Pmieducar | |
| 48 | + * @since Classe disponível desde a versão 1.0.0 | |
| 49 | + * @version @@package_version@@ | |
| 50 | + */ | |
| 51 | +class clsIndexBase extends clsBase | |
| 52 | +{ | |
| 53 | + function Formular() | |
| 54 | + { | |
| 55 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Motoristas'); | |
| 56 | + $this->processoAp = 21236; | |
| 57 | + } | |
| 58 | +} | |
| 59 | + | |
| 60 | +/** | |
| 61 | + * indice class. | |
| 62 | + * | |
| 63 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 64 | + * @category i-Educar | |
| 65 | + * @license @@license@@ | |
| 66 | + * @package iEd_Pmieducar | |
| 67 | + * @since Classe disponível desde a versão 1.0.0 | |
| 68 | + * @version @@package_version@@ | |
| 69 | + */ | |
| 70 | +class indice extends clsDetalhe | |
| 71 | +{ | |
| 72 | + var $titulo; | |
| 73 | + | |
| 74 | + function Gerar() | |
| 75 | + { | |
| 76 | + @session_start(); | |
| 77 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 78 | + session_write_close(); | |
| 79 | + | |
| 80 | + // Verificação de permissão para cadastro. | |
| 81 | + $this->obj_permissao = new clsPermissoes(); | |
| 82 | + | |
| 83 | + $this->nivel_usuario = $this->obj_permissao->nivel_acesso($this->pessoa_logada); | |
| 84 | + | |
| 85 | + $this->titulo = 'Motorista - Detalhe'; | |
| 86 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | |
| 87 | + | |
| 88 | + $cod_motorista = $_GET['cod_motorista']; | |
| 89 | + | |
| 90 | + $tmp_obj = new clsModulesMotorista($cod_motorista); | |
| 91 | + $registro = $tmp_obj->detalhe(); | |
| 92 | + | |
| 93 | + if (! $registro) { | |
| 94 | + header('Location: transporte_motorista_lst.php'); | |
| 95 | + die(); | |
| 96 | + } | |
| 97 | + | |
| 98 | + $this->addDetalhe( array("Código do motorista", $cod_motorista)); | |
| 99 | + $this->addDetalhe( array("Nome", $registro['nome_motorista'].'<br/> <a target=\'_blank\' style=\' text-decoration: underline;\' href=\'atendidos_det.php?cod_pessoa='.$registro['ref_idpes'].'\'>Visualizar pessoa</a>') ); | |
| 100 | + $this->addDetalhe( array("CNH", $registro['cnh']) ); | |
| 101 | + $this->addDetalhe( array("Categoria", $registro['tipo_cnh']) ); | |
| 102 | + if (trim($registro['dt_habilitacao'])!='') | |
| 103 | + $this->addDetalhe( array("Data da habilitação", Portabilis_Date_Utils::pgSQLToBr($registro['dt_habilitacao']) )); | |
| 104 | + if (trim($registro['vencimento_cnh'])!='') | |
| 105 | + $this->addDetalhe( array("Vencimento da habilitação", Portabilis_Date_Utils::pgSQLToBr($registro['vencimento_cnh']) ) ); | |
| 106 | + | |
| 107 | + $this->addDetalhe( array("Observação", $registro['observacao'])); | |
| 108 | + $this->url_novo = "../module/TransporteEscolar/Motorista"; | |
| 109 | + $this->url_editar = "../module/TransporteEscolar/motorista?id={$cod_motorista}"; | |
| 110 | + $this->url_cancelar = "transporte_motorista_lst.php"; | |
| 111 | + | |
| 112 | + $this->largura = "100%"; | |
| 113 | + } | |
| 114 | +} | |
| 115 | + | |
| 116 | +// Instancia o objeto da página | |
| 117 | +$pagina = new clsIndexBase(); | |
| 118 | + | |
| 119 | +// Instancia o objeto de conteúdo | |
| 120 | +$miolo = new indice(); | |
| 121 | + | |
| 122 | +// Passa o conteúdo para a página | |
| 123 | +$pagina->addForm($miolo); | |
| 124 | + | |
| 125 | +// Gera o HTML | |
| 126 | +$pagina->MakeAll(); | ... | ... |
| ... | ... | @@ -0,0 +1,175 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | +require_once ("include/clsBase.inc.php"); | |
| 30 | +require_once ("include/clsListagem.inc.php"); | |
| 31 | +require_once ("include/clsBanco.inc.php"); | |
| 32 | +require_once( "include/public/geral.inc.php" ); | |
| 33 | + | |
| 34 | +require_once("include/modules/clsModulesEmpresaTransporteEscolar.inc.php"); | |
| 35 | +require_once("include/modules/clsModulesMotorista.inc.php"); | |
| 36 | + | |
| 37 | +class clsIndexBase extends clsBase | |
| 38 | +{ | |
| 39 | + function Formular() | |
| 40 | + { | |
| 41 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Motoristas" ); | |
| 42 | + $this->processoAp = "21236"; | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +class indice extends clsListagem | |
| 47 | +{ | |
| 48 | + /** | |
| 49 | + * Referencia pega da session para o idpes do usuario atual | |
| 50 | + * | |
| 51 | + * @var int | |
| 52 | + */ | |
| 53 | + var $__pessoa_logada; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Titulo no topo da pagina | |
| 57 | + * | |
| 58 | + * @var int | |
| 59 | + */ | |
| 60 | + var $__titulo; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Quantidade de registros a ser apresentada em cada pagina | |
| 64 | + * | |
| 65 | + * @var int | |
| 66 | + */ | |
| 67 | + var $__limite; | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * Inicio dos registros a serem exibidos (limit) | |
| 71 | + * | |
| 72 | + * @var int | |
| 73 | + */ | |
| 74 | + var $__offset; | |
| 75 | + | |
| 76 | + var $cod_motorista; | |
| 77 | + var $nome_motorista; | |
| 78 | + var $cod_empresa; | |
| 79 | + var $cnh; | |
| 80 | + var $tipo_cnh; | |
| 81 | + | |
| 82 | + function Gerar() | |
| 83 | + { | |
| 84 | + @session_start(); | |
| 85 | + $this->__pessoa_logada = $_SESSION['id_pessoa']; | |
| 86 | + session_write_close(); | |
| 87 | + | |
| 88 | + $this->__titulo = "Motoristas - Listagem"; | |
| 89 | + | |
| 90 | + foreach( $_GET AS $var => $val ) | |
| 91 | + $this->$var = ( $val === "" ) ? null: $val; | |
| 92 | + | |
| 93 | + $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
| 94 | + | |
| 95 | + $this->addCabecalhos( array( | |
| 96 | + "Código motorista", | |
| 97 | + "Nome", | |
| 98 | + "CNH", | |
| 99 | + "Categoria CNH", | |
| 100 | + "Empresa" | |
| 101 | + ) ); | |
| 102 | + | |
| 103 | + // Filtros de Foreign Keys | |
| 104 | + $opcoes = array( "" => "Selecione" ); | |
| 105 | + | |
| 106 | + $objTemp = new clsModulesEmpresaTransporteEscolar(); | |
| 107 | + $objTemp->setOrderby(' nome_empresa ASC'); | |
| 108 | + $lista = $objTemp->lista(); | |
| 109 | + if ( is_array( $lista ) && count( $lista ) ) | |
| 110 | + { | |
| 111 | + foreach ( $lista as $registro ) | |
| 112 | + { | |
| 113 | + $opcoes["{$registro['cod_empresa_transporte_escolar']}"] = "{$registro['nome_empresa']}"; | |
| 114 | + } | |
| 115 | + }else{ | |
| 116 | + $opcoes = array( "" => "Sem empresas cadastradas" ); | |
| 117 | + } | |
| 118 | + | |
| 119 | + $this->campoLista( "cod_empresa", "Empresa", $opcoes, $this->cod_empresa, "", false, "", "", false, false ); | |
| 120 | + $this->campoNumero('cod_motorista','Código do motorista',$this->cod_motorista,29,15); | |
| 121 | + $this->campoNumero('cnh','CNH',$this->cnh,29,15); | |
| 122 | + $this->campoTexto( "tipo_cnh", "Categoria", $this->tipo_cnh, 2, 2, false ); | |
| 123 | + $this->campoTexto( "nome_motorista", "Nome", $this->nome_motorista, 29, 30, false ); | |
| 124 | + | |
| 125 | + | |
| 126 | + // Paginador | |
| 127 | + $this->__limite = 20; | |
| 128 | + $this->__offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->__limite-$this->__limite: 0; | |
| 129 | + | |
| 130 | + $obj_uf = new clsModulesMotorista(); | |
| 131 | + $obj_uf->setOrderby( " nome_motorista ASC" ); | |
| 132 | + $obj_uf->setLimite( $this->__limite, $this->__offset ); | |
| 133 | + | |
| 134 | + $lista = $obj_uf->lista( | |
| 135 | + $this->cod_motorista, | |
| 136 | + $this->nome_motorista, | |
| 137 | + $this->cnh, | |
| 138 | + $this->tipo_cnh, | |
| 139 | + $this->cod_empresa | |
| 140 | + ); | |
| 141 | + | |
| 142 | + $total = $obj_uf->_total; | |
| 143 | + | |
| 144 | + // monta a lista | |
| 145 | + if( is_array( $lista ) && count( $lista ) ) | |
| 146 | + { | |
| 147 | + foreach ( $lista AS $registro ) | |
| 148 | + { | |
| 149 | + $this->addLinhas( array( | |
| 150 | + "<a href=\"transporte_motorista_det.php?cod_motorista={$registro["cod_motorista"]}\">{$registro["cod_motorista"]}</a>", | |
| 151 | + "<a href=\"transporte_motorista_det.php?cod_motorista={$registro["cod_motorista"]}\">{$registro["nome_motorista"]}</a>", | |
| 152 | + "<a href=\"transporte_motorista_det.php?cod_motorista={$registro["cod_motorista"]}\">{$registro["cnh"]}</a>", | |
| 153 | + "<a href=\"transporte_motorista_det.php?cod_motorista={$registro["cod_motorista"]}\">{$registro["tipo_cnh"]}</a>", | |
| 154 | + "<a href=\"transporte_motorista_det.php?cod_motorista={$registro["cod_motorista"]}\">{$registro["nome_empresa"]}</a>" | |
| 155 | + ) ); | |
| 156 | + } | |
| 157 | + } | |
| 158 | + | |
| 159 | + $this->addPaginador2( "transporte_motorista_lst.php", $total, $_GET, $this->nome, $this->__limite ); | |
| 160 | + | |
| 161 | + $this->acao = "go(\"/module/TransporteEscolar/Motorista\")"; | |
| 162 | + $this->nome_acao = "Novo"; | |
| 163 | + | |
| 164 | + $this->largura = "100%"; | |
| 165 | + } | |
| 166 | +} | |
| 167 | +// cria uma extensao da classe base | |
| 168 | +$pagina = new clsIndexBase(); | |
| 169 | +// cria o conteudo | |
| 170 | +$miolo = new indice(); | |
| 171 | +// adiciona o conteudo na clsBase | |
| 172 | +$pagina->addForm( $miolo ); | |
| 173 | +// gera o html | |
| 174 | +$pagina->MakeAll(); | |
| 175 | +?> | |
| 0 | 176 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,122 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package iEd_Pmieducar | |
| 27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/clsBase.inc.php'; | |
| 32 | +require_once 'include/clsDetalhe.inc.php'; | |
| 33 | +require_once 'include/clsBanco.inc.php'; | |
| 34 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 35 | +require_once 'include/modules/clsModulesPessoaTransporte.inc.php'; | |
| 36 | + | |
| 37 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 38 | + | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * clsIndexBase class. | |
| 42 | + * | |
| 43 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 44 | + * @category i-Educar | |
| 45 | + * @license @@license@@ | |
| 46 | + * @package iEd_Pmieducar | |
| 47 | + * @since Classe disponível desde a versão 1.0.0 | |
| 48 | + * @version @@package_version@@ | |
| 49 | + */ | |
| 50 | +class clsIndexBase extends clsBase | |
| 51 | +{ | |
| 52 | + function Formular() | |
| 53 | + { | |
| 54 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Usuários de transporte'); | |
| 55 | + $this->processoAp = 21240; | |
| 56 | + } | |
| 57 | +} | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * indice class. | |
| 61 | + * | |
| 62 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 63 | + * @category i-Educar | |
| 64 | + * @license @@license@@ | |
| 65 | + * @package iEd_Pmieducar | |
| 66 | + * @since Classe disponível desde a versão 1.0.0 | |
| 67 | + * @version @@package_version@@ | |
| 68 | + */ | |
| 69 | +class indice extends clsDetalhe | |
| 70 | +{ | |
| 71 | + var $titulo; | |
| 72 | + | |
| 73 | + function Gerar() | |
| 74 | + { | |
| 75 | + @session_start(); | |
| 76 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 77 | + session_write_close(); | |
| 78 | + | |
| 79 | + // Verificação de permissão para cadastro. | |
| 80 | + $this->obj_permissao = new clsPermissoes(); | |
| 81 | + | |
| 82 | + $this->nivel_usuario = $this->obj_permissao->nivel_acesso($this->pessoa_logada); | |
| 83 | + | |
| 84 | + $this->titulo = 'Usuário de transporte - Detalhe'; | |
| 85 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | |
| 86 | + | |
| 87 | + $cod_pt = $_GET['cod_pt']; | |
| 88 | + | |
| 89 | + $tmp_obj = new clsModulesPessoaTransporte($cod_pt); | |
| 90 | + $registro = $tmp_obj->detalhe(); | |
| 91 | + | |
| 92 | + if (! $registro) { | |
| 93 | + header('Location: transporte_empresa_lst.php'); | |
| 94 | + die(); | |
| 95 | + } | |
| 96 | + | |
| 97 | + $this->addDetalhe( array("Código", $cod_pt)); | |
| 98 | + $this->addDetalhe( array("Pessoa", $registro['nome_pessoa']) ); | |
| 99 | + $this->addDetalhe( array("Rota", $registro['nome_rota']) ); | |
| 100 | + $this->addDetalhe( array("Destino", (trim($registro['nome_destino'])=='' ? $registro['nome_destino2'] : $registro['nome_destino'])) ); | |
| 101 | + $this->addDetalhe( array("Ponto de embarque", $registro['nome_ponto'] )); | |
| 102 | + $this->addDetalhe( array("Observação", $registro['observacao']) ); | |
| 103 | + | |
| 104 | + $this->url_novo = "../module/TransporteEscolar/Pessoatransporte"; | |
| 105 | + $this->url_editar = "../module/TransporteEscolar/Pessoatransporte?id={$cod_pt}"; | |
| 106 | + $this->url_cancelar = "transporte_pessoa_lst.php"; | |
| 107 | + | |
| 108 | + $this->largura = "100%"; | |
| 109 | + } | |
| 110 | +} | |
| 111 | + | |
| 112 | +// Instancia o objeto da página | |
| 113 | +$pagina = new clsIndexBase(); | |
| 114 | + | |
| 115 | +// Instancia o objeto de conteúdo | |
| 116 | +$miolo = new indice(); | |
| 117 | + | |
| 118 | +// Passa o conteúdo para a página | |
| 119 | +$pagina->addForm($miolo); | |
| 120 | + | |
| 121 | +// Gera o HTML | |
| 122 | +$pagina->MakeAll(); | ... | ... |
| ... | ... | @@ -0,0 +1,162 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | +require_once 'include/clsBase.inc.php'; | |
| 30 | +require_once 'include/clsListagem.inc.php'; | |
| 31 | +require_once 'include/clsBanco.inc.php'; | |
| 32 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 33 | +require_once 'include/modules/clsModulesRotaTransporteEscolar.inc.php'; | |
| 34 | +require_once 'include/modules/clsModulesPessoaTransporte.inc.php'; | |
| 35 | + | |
| 36 | +class clsIndexBase extends clsBase | |
| 37 | +{ | |
| 38 | + function Formular() | |
| 39 | + { | |
| 40 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Usuários de transporte" ); | |
| 41 | + $this->processoAp = "21240"; | |
| 42 | + } | |
| 43 | +} | |
| 44 | + | |
| 45 | +class indice extends clsListagem | |
| 46 | +{ | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * Referencia pega da session para o idpes do usuario atual | |
| 50 | + * | |
| 51 | + * @var int | |
| 52 | + */ | |
| 53 | + var $pessoa_logada; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Titulo no topo da pagina | |
| 57 | + * | |
| 58 | + * @var int | |
| 59 | + */ | |
| 60 | + var $titulo; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Quantidade de registros a ser apresentada em cada pagina | |
| 64 | + * | |
| 65 | + * @var int | |
| 66 | + */ | |
| 67 | + var $limite; | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * Inicio dos registros a serem exibidos (limit) | |
| 71 | + * | |
| 72 | + * @var int | |
| 73 | + */ | |
| 74 | + var $offset; | |
| 75 | + | |
| 76 | + var $cod_pessoa_transporte; | |
| 77 | + var $ref_cod_rota_transporte_escolar; | |
| 78 | + var $nome_pessoa; | |
| 79 | + var $nome_destino; | |
| 80 | + | |
| 81 | + function Gerar() | |
| 82 | + { | |
| 83 | + | |
| 84 | + @session_start(); | |
| 85 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 86 | + session_write_close(); | |
| 87 | + | |
| 88 | + $this->titulo = "Usuário de transporte - Listagem"; | |
| 89 | + | |
| 90 | + foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto | |
| 91 | + $this->$var = ( $val === "" ) ? null: $val; | |
| 92 | + | |
| 93 | + $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
| 94 | + | |
| 95 | + // Cria lista de rotas | |
| 96 | + $obj_rota = new clsModulesRotaTransporteEscolar(); | |
| 97 | + $obj_rota->setOrderBy(' descricao asc '); | |
| 98 | + $lista_rota = $obj_rota->lista(); | |
| 99 | + $select_rota = array("" => "Selecione uma rota" ); | |
| 100 | + foreach ($lista_rota as $reg) { | |
| 101 | + $select_rota["{$reg['cod_rota_transporte_escolar']}"] = "{$reg['descricao']}"; | |
| 102 | + } | |
| 103 | + | |
| 104 | + $this->campoNumero("cod_pessoa_transporte","Código",$this->cod_pessoa_transporte,20,255,false); | |
| 105 | + $this->campoTexto("nome_pessoa","Nome da pessoa", $this->nome_pessoa,50,255,false); | |
| 106 | + $this->campoTexto("nome_destino","Nome do destino", $this->nome_destino,70,255,false); | |
| 107 | + $this->campoLista( "ref_cod_rota_transporte_escolar", "Rota", $select_rota, $this->ref_cod_rota_transporte_escolar, "", false, "", "", false, false ); | |
| 108 | + | |
| 109 | + $obj_permissoes = new clsPermissoes(); | |
| 110 | + | |
| 111 | + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); | |
| 112 | + | |
| 113 | + $this->addCabecalhos( array( | |
| 114 | + "Código", | |
| 115 | + "Nome da pessoa", | |
| 116 | + "Rota", | |
| 117 | + "Destino", | |
| 118 | + "Ponto de embarque" | |
| 119 | + ) ); | |
| 120 | + | |
| 121 | + // Paginador | |
| 122 | + $this->limite = 20; | |
| 123 | + $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; | |
| 124 | + | |
| 125 | + | |
| 126 | + $obj = new clsModulesPessoaTransporte(); | |
| 127 | + $obj->setLimite($this->limite,$this->offset); | |
| 128 | + | |
| 129 | + $lista = $obj->lista($this->cod_pessoa_transporte, null, | |
| 130 | + $this->ref_cod_rota_transporte_escolar,null, null,$this->nome_pessoa,$this->nome_destino | |
| 131 | + ); | |
| 132 | + $total = $lista->_total; | |
| 133 | + | |
| 134 | + foreach ( $lista AS $registro ) { | |
| 135 | + | |
| 136 | + $this->addLinhas( array( | |
| 137 | + "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">{$registro["cod_pessoa_transporte"]}</a>", | |
| 138 | + "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">{$registro["nome_pessoa"]}</a>", | |
| 139 | + "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">{$registro["nome_rota"]}</a>", | |
| 140 | + "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">".(trim($registro["nome_destino"])=='' ? $registro["nome_destino2"] : $registro["nome_destino"])."</a>", | |
| 141 | + "<a href=\"transporte_pessoa_det.php?cod_pt={$registro["cod_pessoa_transporte"]}\">{$registro["nome_ponto"]}</a>" | |
| 142 | + ) ); | |
| 143 | + } | |
| 144 | + | |
| 145 | + $this->addPaginador2( "transporte_pessoa_lst.php", $total, $_GET, $this->nome, $this->limite ); | |
| 146 | + | |
| 147 | + $this->acao = "go(\"../module/TransporteEscolar/Pessoatransporte\")"; | |
| 148 | + $this->nome_acao = "Novo"; | |
| 149 | + | |
| 150 | + //** | |
| 151 | + $this->largura = "100%"; | |
| 152 | + } | |
| 153 | +} | |
| 154 | +// cria uma extensao da classe base | |
| 155 | +$pagina = new clsIndexBase(); | |
| 156 | +// cria o conteudo | |
| 157 | +$miolo = new indice(); | |
| 158 | +// adiciona o conteudo na clsBase | |
| 159 | +$pagina->addForm( $miolo ); | |
| 160 | +// gera o html | |
| 161 | +$pagina->MakeAll(); | |
| 162 | +?> | |
| 0 | 163 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,117 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package iEd_Pmieducar | |
| 27 | + * @since Arquivo disponível desde a versão 1.0.0 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/clsBase.inc.php'; | |
| 32 | +require_once 'include/clsDetalhe.inc.php'; | |
| 33 | +require_once 'include/clsBanco.inc.php'; | |
| 34 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 35 | +require_once 'include/modules/clsModulesPontoTransporteEscolar.inc.php'; | |
| 36 | + | |
| 37 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 38 | + | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * clsIndexBase class. | |
| 42 | + * | |
| 43 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 44 | + * @category i-Educar | |
| 45 | + * @license @@license@@ | |
| 46 | + * @package iEd_Pmieducar | |
| 47 | + * @since Classe disponível desde a versão 1.0.0 | |
| 48 | + * @version @@package_version@@ | |
| 49 | + */ | |
| 50 | +class clsIndexBase extends clsBase | |
| 51 | +{ | |
| 52 | + function Formular() | |
| 53 | + { | |
| 54 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Pontos'); | |
| 55 | + $this->processoAp = 21239; | |
| 56 | + } | |
| 57 | +} | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * indice class. | |
| 61 | + * | |
| 62 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.scclsModulesPontoTransporteEscolar.gov.br> | |
| 63 | + * @category i-Educar | |
| 64 | + * @license @@license@@ | |
| 65 | + * @package iEd_Pmieducar | |
| 66 | + * @since Classe disponível desde a versão 1.0.0 | |
| 67 | + * @version @@package_version@@ | |
| 68 | + */ | |
| 69 | +class indice extends clsDetalhe | |
| 70 | +{ | |
| 71 | + var $titulo; | |
| 72 | + | |
| 73 | + function Gerar() | |
| 74 | + { | |
| 75 | + @session_start(); | |
| 76 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 77 | + session_write_close(); | |
| 78 | + | |
| 79 | + // Verificação de permissão para cadastro. | |
| 80 | + $this->obj_permissao = new clsPermissoes(); | |
| 81 | + | |
| 82 | + $this->nivel_usuario = $this->obj_permissao->nivel_acesso($this->pessoa_logada); | |
| 83 | + | |
| 84 | + $this->titulo = 'Ponto - Detalhe'; | |
| 85 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | |
| 86 | + | |
| 87 | + $cod_ponto_transporte_escolar = $_GET['cod_ponto']; | |
| 88 | + $tmp_obj = new clsModulesPontoTransporteEscolar($cod_ponto_transporte_escolar); | |
| 89 | + $registro = $tmp_obj->detalhe(); | |
| 90 | + | |
| 91 | + if (! $registro) { | |
| 92 | + header('Location: transporte_ponto_lst.php'); | |
| 93 | + die(); | |
| 94 | + } | |
| 95 | + | |
| 96 | + $this->addDetalhe( array("Código do ponto", $cod_ponto_transporte_escolar)); | |
| 97 | + $this->addDetalhe( array("Descrição", $registro['descricao']) ); | |
| 98 | + | |
| 99 | + $this->url_novo = "../module/TransporteEscolar/Ponto"; | |
| 100 | + $this->url_editar = "../module/TransporteEscolar/Ponto?id={$cod_ponto_transporte_escolar}"; | |
| 101 | + $this->url_cancelar = "transporte_ponto_lst.php"; | |
| 102 | + | |
| 103 | + $this->largura = "100%"; | |
| 104 | + } | |
| 105 | +} | |
| 106 | + | |
| 107 | +// Instancia o objeto da página | |
| 108 | +$pagina = new clsIndexBase(); | |
| 109 | + | |
| 110 | +// Instancia o objeto de conteúdo | |
| 111 | +$miolo = new indice(); | |
| 112 | + | |
| 113 | +// Passa o conteúdo para a página | |
| 114 | +$pagina->addForm($miolo); | |
| 115 | + | |
| 116 | +// Gera o HTML | |
| 117 | +$pagina->MakeAll(); | ... | ... |
| ... | ... | @@ -0,0 +1,141 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | +require_once 'include/clsBase.inc.php'; | |
| 30 | +require_once 'include/clsListagem.inc.php'; | |
| 31 | +require_once 'include/clsBanco.inc.php'; | |
| 32 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 33 | +require_once 'include/modules/clsModulesPontoTransporteEscolar.inc.php'; | |
| 34 | + | |
| 35 | +class clsIndexBase extends clsBase | |
| 36 | +{ | |
| 37 | + function Formular() | |
| 38 | + { | |
| 39 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Pontos" ); | |
| 40 | + $this->processoAp = "21239"; | |
| 41 | + } | |
| 42 | +} | |
| 43 | + | |
| 44 | +class indice extends clsListagem | |
| 45 | +{ | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Referencia pega da session para o idpes do usuario atual | |
| 49 | + * | |
| 50 | + * @var int | |
| 51 | + */ | |
| 52 | + var $pessoa_logada; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * Titulo no topo da pagina | |
| 56 | + * | |
| 57 | + * @var int | |
| 58 | + */ | |
| 59 | + var $titulo; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * Quantidade de registros a ser apresentada em cada pagina | |
| 63 | + * | |
| 64 | + * @var int | |
| 65 | + */ | |
| 66 | + var $limite; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Inicio dos registros a serem exibidos (limit) | |
| 70 | + * | |
| 71 | + * @var int | |
| 72 | + */ | |
| 73 | + var $offset; | |
| 74 | + | |
| 75 | + var $cod_ponto; | |
| 76 | + var $descricao; | |
| 77 | + | |
| 78 | + function Gerar() | |
| 79 | + { | |
| 80 | + | |
| 81 | + @session_start(); | |
| 82 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 83 | + session_write_close(); | |
| 84 | + | |
| 85 | + $this->titulo = "Pontos - Listagem"; | |
| 86 | + | |
| 87 | + foreach( $_GET AS $var => $val ) // passa todos os valores obtidos no GET para atributos do objeto | |
| 88 | + $this->$var = ( $val === "" ) ? null: $val; | |
| 89 | + | |
| 90 | + $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
| 91 | + | |
| 92 | + $this->campoNumero("cod_ponto","Código do ponto",$this->cod_ponto,20,255,false); | |
| 93 | + $this->campoTexto("descricao","Descrição", $this->descricao,50,255,false); | |
| 94 | + | |
| 95 | + | |
| 96 | + $obj_permissoes = new clsPermissoes(); | |
| 97 | + | |
| 98 | + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada); | |
| 99 | + | |
| 100 | + $this->addCabecalhos( array( | |
| 101 | + "Código do ponto", | |
| 102 | + "Descrição" | |
| 103 | + ) ); | |
| 104 | + | |
| 105 | + // Paginador | |
| 106 | + $this->limite = 20; | |
| 107 | + $this->offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->limite-$this->limite: 0; | |
| 108 | + | |
| 109 | + | |
| 110 | + $obj_ponto = new clsModulesPontoTransporteEscolar(); | |
| 111 | + $obj_ponto->setOrderBy(' descricao asc '); | |
| 112 | + $obj_ponto->setLimite($this->limite,$this->offset); | |
| 113 | + | |
| 114 | + $pontos = $obj_ponto->lista($this->cod_ponto,$this->descricao); | |
| 115 | + $total = $pontos->_total; | |
| 116 | + | |
| 117 | + foreach ( $pontos AS $registro ) { | |
| 118 | + | |
| 119 | + $this->addLinhas( array( | |
| 120 | + "<a href=\"transporte_ponto_det.php?cod_ponto={$registro["cod_ponto_transporte_escolar"]}\">{$registro["cod_ponto_transporte_escolar"]}</a>", | |
| 121 | + "<a href=\"transporte_ponto_det.php?cod_ponto={$registro["cod_ponto_transporte_escolar"]}\">{$registro["descricao"]}</a>" | |
| 122 | + ) ); | |
| 123 | + } | |
| 124 | + | |
| 125 | + $this->addPaginador2( "transporte_ponto_lst.php", $total, $_GET, $this->nome, $this->limite ); | |
| 126 | + | |
| 127 | + $this->acao = "go(\"../module/TransporteEscolar/Ponto\")"; | |
| 128 | + $this->nome_acao = "Novo"; | |
| 129 | + | |
| 130 | + $this->largura = "100%"; | |
| 131 | + } | |
| 132 | +} | |
| 133 | +// cria uma extensao da classe base | |
| 134 | +$pagina = new clsIndexBase(); | |
| 135 | +// cria o conteudo | |
| 136 | +$miolo = new indice(); | |
| 137 | +// adiciona o conteudo na clsBase | |
| 138 | +$pagina->addForm( $miolo ); | |
| 139 | +// gera o html | |
| 140 | +$pagina->MakeAll(); | |
| 141 | +?> | ... | ... |
| ... | ... | @@ -0,0 +1,191 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/clsBase.inc.php'; | |
| 32 | +require_once 'include/clsDetalhe.inc.php'; | |
| 33 | +require_once 'include/clsBanco.inc.php'; | |
| 34 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 35 | +require_once 'include/modules/clsModulesRotaTransporteEscolar.inc.php'; | |
| 36 | +require_once 'include/modules/clsModulesItinerarioTransporteEscolar.inc.php'; | |
| 37 | +require_once 'include/modules/clsModulesPontoTransporteEscolar.inc.php'; | |
| 38 | +require_once 'include/modules/clsModulesVeiculo.inc.php'; | |
| 39 | + | |
| 40 | +require_once 'Portabilis/Date/Utils.php'; | |
| 41 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 42 | + | |
| 43 | + | |
| 44 | +/** | |
| 45 | + * clsIndexBase class. | |
| 46 | + * | |
| 47 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 48 | + * @category i-Educar | |
| 49 | + * @license @@license@@ | |
| 50 | + * @package iEd_Pmieducar | |
| 51 | + * @since Classe disponível desde a versão 1.0.0 | |
| 52 | + * @version @@package_version@@ | |
| 53 | + */ | |
| 54 | +class clsIndexBase extends clsBase | |
| 55 | +{ | |
| 56 | + function Formular() | |
| 57 | + { | |
| 58 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Rotas'); | |
| 59 | + $this->processoAp = 21238; | |
| 60 | + } | |
| 61 | +} | |
| 62 | + | |
| 63 | +/** | |
| 64 | + * indice class. | |
| 65 | + * | |
| 66 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 67 | + * @category i-Educar | |
| 68 | + * @license @@license@@ | |
| 69 | + * @package iEd_Pmieducar | |
| 70 | + * @since Classe disponível desde a versão 1.0.0 | |
| 71 | + * @version @@package_version@@ | |
| 72 | + */ | |
| 73 | +class indice extends clsDetalhe | |
| 74 | +{ | |
| 75 | + var $titulo; | |
| 76 | + | |
| 77 | + function Gerar() | |
| 78 | + { | |
| 79 | + @session_start(); | |
| 80 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 81 | + session_write_close(); | |
| 82 | + | |
| 83 | + // Verificação de permissão para cadastro. | |
| 84 | + $this->obj_permissao = new clsPermissoes(); | |
| 85 | + | |
| 86 | + $this->nivel_usuario = $this->obj_permissao->nivel_acesso($this->pessoa_logada); | |
| 87 | + | |
| 88 | + $this->titulo = 'Rota - Detalhe'; | |
| 89 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | |
| 90 | + | |
| 91 | + $cod_rota_transporte_escolar = $_GET['cod_rota']; | |
| 92 | + | |
| 93 | + $tmp_obj = new clsModulesRotaTransporteEscolar($cod_rota_transporte_escolar); | |
| 94 | + $registro = $tmp_obj->detalhe(); | |
| 95 | + | |
| 96 | + if (! $registro) { | |
| 97 | + header('Location: transporte_rota_lst.php'); | |
| 98 | + die(); | |
| 99 | + } | |
| 100 | + | |
| 101 | + $this->addDetalhe( array("Ano", $registro['ano']) ); | |
| 102 | + $this->addDetalhe( array("Código da rota", $cod_rota_transporte_escolar)); | |
| 103 | + $this->addDetalhe( array("Descrição", $registro['descricao']) ); | |
| 104 | + $this->addDetalhe( array("Destino", $registro['nome_destino'])); | |
| 105 | + $this->addDetalhe( array("Empresa", $registro['nome_empresa'])); | |
| 106 | + $this->addDetalhe( array("Tipo da rota", ($registro['tipo_rota'] == 'U' ? 'Urbana' : 'Rural' ))); | |
| 107 | + if (trim($registro['km_pav'])!='') | |
| 108 | + $this->addDetalhe( array("Percurso pavimentado", $registro['km_pav'].' km')); | |
| 109 | + if (trim($registro['km_npav'])!='') | |
| 110 | + $this->addDetalhe( array("Percurso não pavimentado", $registro['km_npav'].' km')); | |
| 111 | + | |
| 112 | + $this->addDetalhe( array("Terceirizado", ($registro['tercerizado'] == 'S' ? 'Sim' : 'Não' ))); | |
| 113 | + | |
| 114 | + // Itinerário | |
| 115 | + | |
| 116 | + $obj = new clsModulesItinerarioTransporteEscolar(); | |
| 117 | + $obj->setOrderby('seq ASC'); | |
| 118 | + $lst = $obj->lista(null, $cod_rota_transporte_escolar ); | |
| 119 | + | |
| 120 | + if ($lst) { | |
| 121 | + $tabela = ' | |
| 122 | + <table> | |
| 123 | + <tr colspan=\'5\'><td><a style=\' text-decoration: underline;\' href=\'/intranet/transporte_itinerario_cad.php?cod_rota='.$cod_rota_transporte_escolar.'\'>Editar itinerário</a></td></tr> | |
| 124 | + <tr align="center"> | |
| 125 | + <td bgcolor="#A1B3BD"><b>Sequencial</b></td> | |
| 126 | + <td bgcolor="#A1B3BD"><b>Ponto</b></td> | |
| 127 | + <td bgcolor="#A1B3BD"><b>Hora</b></td> | |
| 128 | + <td bgcolor="#A1B3BD"><b>Tipo</b></td> | |
| 129 | + <td bgcolor="#A1B3BD"><b>Veículo</b></td> | |
| 130 | + </tr>'; | |
| 131 | + | |
| 132 | + $cont = 0; | |
| 133 | + | |
| 134 | + foreach ($lst as $valor) { | |
| 135 | + if (($cont % 2) == 0) { | |
| 136 | + $color = ' bgcolor="#E4E9ED" '; | |
| 137 | + } | |
| 138 | + else { | |
| 139 | + $color = ' bgcolor="#FFFFFF" '; | |
| 140 | + } | |
| 141 | + | |
| 142 | + $obj_veiculo = new clsModulesVeiculo($valor['ref_cod_veiculo']); | |
| 143 | + $obj_veiculo = $obj_veiculo->detalhe(); | |
| 144 | + $valor_veiculo = $obj_veiculo['descricao']==''?'':$obj_veiculo['descricao'].' - Placa: '.$obj_veiculo['placa']; | |
| 145 | + | |
| 146 | + $obj_ponto = new clsModulesPontoTransporteEscolar($valor['ref_cod_ponto_transporte_escolar']); | |
| 147 | + $obj_ponto = $obj_ponto->detalhe(); | |
| 148 | + $valor_ponto = $obj_ponto['descricao']; | |
| 149 | + | |
| 150 | + $tabela .= sprintf(' | |
| 151 | + <tr> | |
| 152 | + <td %s align=left>%s</td> | |
| 153 | + <td %s align=left>%s</td> | |
| 154 | + <td %s align=left>%s</td> | |
| 155 | + <td %s align=left>%s</td> | |
| 156 | + <td %s align=left>%s</td> | |
| 157 | + </tr>', | |
| 158 | + $color, $valor['seq'], $color, $valor_ponto, $color, $valor['hora'],$color, ($valor['tipo'] == 'V' ? 'Volta' : 'Ida'),$color, $valor_veiculo | |
| 159 | + ); | |
| 160 | + | |
| 161 | + $cont++; | |
| 162 | + } | |
| 163 | + | |
| 164 | + $tabela .= '</table>'; | |
| 165 | + | |
| 166 | + | |
| 167 | + } | |
| 168 | + if ($tabela) { | |
| 169 | + $this->addDetalhe(array('Itinerário', $tabela)); | |
| 170 | + } else{ | |
| 171 | + $this->addDetalhe(array('Itinerário', '<a style=\' text-decoration: underline; font-size: 12px;\' href=\'/intranet/transporte_itinerario_cad.php?cod_rota='.$cod_rota_transporte_escolar.'\'>Editar itinerário</a>')); | |
| 172 | + } | |
| 173 | + $this->url_novo = "../module/TransporteEscolar/Rota"; | |
| 174 | + $this->url_editar = "../module/TransporteEscolar/Rota?id={$cod_rota_transporte_escolar}"; | |
| 175 | + $this->url_cancelar = "transporte_rota_lst.php"; | |
| 176 | + | |
| 177 | + $this->largura = "100%"; | |
| 178 | + } | |
| 179 | +} | |
| 180 | + | |
| 181 | +// Instancia o objeto da página | |
| 182 | +$pagina = new clsIndexBase(); | |
| 183 | + | |
| 184 | +// Instancia o objeto de conteúdo | |
| 185 | +$miolo = new indice(); | |
| 186 | + | |
| 187 | +// Passa o conteúdo para a página | |
| 188 | +$pagina->addForm($miolo); | |
| 189 | + | |
| 190 | +// Gera o HTML | |
| 191 | +$pagina->MakeAll(); | ... | ... |
| ... | ... | @@ -0,0 +1,181 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | +require_once ("include/clsBase.inc.php"); | |
| 30 | +require_once ("include/clsListagem.inc.php"); | |
| 31 | +require_once ("include/clsBanco.inc.php"); | |
| 32 | +require_once( "include/public/geral.inc.php" ); | |
| 33 | + | |
| 34 | +require_once("include/modules/clsModulesRotaTransporteEscolar.inc.php"); | |
| 35 | +require_once("include/modules/clsModulesEmpresaTransporteEscolar.inc.php"); | |
| 36 | + | |
| 37 | +class clsIndexBase extends clsBase | |
| 38 | +{ | |
| 39 | + function Formular() | |
| 40 | + { | |
| 41 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Rotas" ); | |
| 42 | + $this->processoAp = "21238"; | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +class indice extends clsListagem | |
| 47 | +{ | |
| 48 | + /** | |
| 49 | + * Referencia pega da session para o idpes do usuario atual | |
| 50 | + * | |
| 51 | + * @var int | |
| 52 | + */ | |
| 53 | + var $__pessoa_logada; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Titulo no topo da pagina | |
| 57 | + * | |
| 58 | + * @var int | |
| 59 | + */ | |
| 60 | + var $__titulo; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Quantidade de registros a ser apresentada em cada pagina | |
| 64 | + * | |
| 65 | + * @var int | |
| 66 | + */ | |
| 67 | + var $__limite; | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * Inicio dos registros a serem exibidos (limit) | |
| 71 | + * | |
| 72 | + * @var int | |
| 73 | + */ | |
| 74 | + var $__offset; | |
| 75 | + | |
| 76 | + var $descricao; | |
| 77 | + var $ref_idpes_destino; | |
| 78 | + var $ano; | |
| 79 | + var $tipo_rota; | |
| 80 | + var $km_pav; | |
| 81 | + var $km_npav; | |
| 82 | + var $ref_cod_empresa_transporte_escolar; | |
| 83 | + var $tercerizado; | |
| 84 | + var $nome_destino; | |
| 85 | + | |
| 86 | + function Gerar() | |
| 87 | + { | |
| 88 | + @session_start(); | |
| 89 | + $this->__pessoa_logada = $_SESSION['id_pessoa']; | |
| 90 | + session_write_close(); | |
| 91 | + | |
| 92 | + $this->__titulo = "Rotas - Listagem"; | |
| 93 | + | |
| 94 | + foreach( $_GET AS $var => $val ) | |
| 95 | + $this->$var = ( $val === "" ) ? null: $val; | |
| 96 | + | |
| 97 | + $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
| 98 | + | |
| 99 | + $this->addCabecalhos( array( | |
| 100 | + "Ano", | |
| 101 | + "Código da rota", | |
| 102 | + "Descrição", | |
| 103 | + "Destino", | |
| 104 | + "Empresa", | |
| 105 | + "Terceirizado" | |
| 106 | + ) ); | |
| 107 | + | |
| 108 | + // Filtros de Foreign Keys | |
| 109 | + $opcoes = array( "" => "Selecione" ); | |
| 110 | + | |
| 111 | + $objTemp = new clsModulesEmpresaTransporteEscolar(); | |
| 112 | + $objTemp->setOrderby(' nome_empresa ASC'); | |
| 113 | + $lista = $objTemp->lista(); | |
| 114 | + if ( is_array( $lista ) && count( $lista ) ) | |
| 115 | + { | |
| 116 | + foreach ( $lista as $registro ) | |
| 117 | + { | |
| 118 | + $opcoes["{$registro['cod_empresa_transporte_escolar']}"] = "{$registro['nome_empresa']}"; | |
| 119 | + } | |
| 120 | + }else{ | |
| 121 | + $opcoes = array( "" => "Sem empresas cadastradas" ); | |
| 122 | + } | |
| 123 | + | |
| 124 | + $this->campoLista( "ref_cod_empresa_transporte_escolar", "Empresa", $opcoes, $this->ref_cod_empresa_transporte_escolar, "", false, "", "", false, false ); | |
| 125 | + $this->campoTexto('descricao','Descrição',$this->descricao,50,30); | |
| 126 | + $this->campoNumero('ano','Ano',$this->cnh,4,5); | |
| 127 | + $this->campoTexto('nome_destino','Destino',$this->nome_destino,50,30); | |
| 128 | + | |
| 129 | + | |
| 130 | + // Paginador | |
| 131 | + $this->__limite = 20; | |
| 132 | + $this->__offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->__limite-$this->__limite: 0; | |
| 133 | + | |
| 134 | + $obj_rota = new clsModulesRotaTransporteEscolar(); | |
| 135 | + $obj_rota->setOrderby( " descricao ASC" ); | |
| 136 | + $obj_rota->setLimite( $this->__limite, $this->__offset ); | |
| 137 | + | |
| 138 | + $lista = $obj_rota->lista( | |
| 139 | + null, | |
| 140 | + $this->descricao, | |
| 141 | + null, | |
| 142 | + $this->nome_destino, | |
| 143 | + $this->ano, | |
| 144 | + $this->ref_cod_empresa_transporte_escolar | |
| 145 | + ); | |
| 146 | + | |
| 147 | + $total = $obj_rota->_total; | |
| 148 | + | |
| 149 | + // monta a lista | |
| 150 | + if( is_array( $lista ) && count( $lista ) ) | |
| 151 | + { | |
| 152 | + foreach ( $lista AS $registro ) | |
| 153 | + { | |
| 154 | + $this->addLinhas( array( | |
| 155 | + "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["ano"]}</a>", | |
| 156 | + "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["cod_rota_transporte_escolar"]}</a>", | |
| 157 | + "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["descricao"]}</a>", | |
| 158 | + "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["nome_destino"]}</a>", | |
| 159 | + "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">{$registro["nome_empresa"]}</a>", | |
| 160 | + "<a href=\"transporte_rota_det.php?cod_rota={$registro["cod_rota_transporte_escolar"]}\">".($registro["tercerizado"] == 'S'? 'Sim' : 'Não')."</a>" | |
| 161 | + ) ); | |
| 162 | + } | |
| 163 | + } | |
| 164 | + | |
| 165 | + $this->addPaginador2( "transporte_rota_lst.php", $total, $_GET, $this->nome, $this->__limite ); | |
| 166 | + | |
| 167 | + $this->acao = "go(\"/module/TransporteEscolar/Rota\")"; | |
| 168 | + $this->nome_acao = "Novo"; | |
| 169 | + | |
| 170 | + $this->largura = "100%"; | |
| 171 | + } | |
| 172 | +} | |
| 173 | +// cria uma extensao da classe base | |
| 174 | +$pagina = new clsIndexBase(); | |
| 175 | +// cria o conteudo | |
| 176 | +$miolo = new indice(); | |
| 177 | +// adiciona o conteudo na clsBase | |
| 178 | +$pagina->addForm( $miolo ); | |
| 179 | +// gera o html | |
| 180 | +$pagina->MakeAll(); | |
| 181 | +?> | |
| 0 | 182 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,147 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * i-Educar - Sistema de gestão escolar | |
| 5 | + * | |
| 6 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 7 | + * <ctima@itajai.sc.gov.br> | |
| 8 | + * | |
| 9 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 10 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 11 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 12 | + * qualquer versão posterior. | |
| 13 | + * | |
| 14 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 15 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 16 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 17 | + * do GNU para mais detalhes. | |
| 18 | + * | |
| 19 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 20 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 21 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 22 | + * | |
| 23 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 24 | + * @category i-Educar | |
| 25 | + * @license @@license@@ | |
| 26 | + * @package Module | |
| 27 | + * @since 07/2013 | |
| 28 | + * @version $Id$ | |
| 29 | + */ | |
| 30 | + | |
| 31 | +require_once 'include/clsBase.inc.php'; | |
| 32 | +require_once 'include/clsDetalhe.inc.php'; | |
| 33 | +require_once 'include/clsBanco.inc.php'; | |
| 34 | +require_once 'include/pmieducar/geral.inc.php'; | |
| 35 | +require_once 'include/modules/clsModulesVeiculo.inc.php'; | |
| 36 | + | |
| 37 | +require_once 'Portabilis/Date/Utils.php'; | |
| 38 | +require_once 'Portabilis/View/Helper/Application.php'; | |
| 39 | + | |
| 40 | + | |
| 41 | +/** | |
| 42 | + * clsIndexBase class.21239 | |
| 43 | + * | |
| 44 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 45 | + * @category i-Educar | |
| 46 | + * @license @@license@@ | |
| 47 | + * @package iEd_Pmieducar | |
| 48 | + * @since Classe disponível desde a versão 1.0.0 | |
| 49 | + * @version @@package_version@@ | |
| 50 | + */ | |
| 51 | +class clsIndexBase extends clsBase | |
| 52 | +{ | |
| 53 | + function Formular() | |
| 54 | + { | |
| 55 | + $this->SetTitulo($this->_instituicao . ' i-Educar - Veiculos'); | |
| 56 | + $this->processoAp = 21237; | |
| 57 | + } | |
| 58 | +} | |
| 59 | + | |
| 60 | +/** | |
| 61 | + * indice class. | |
| 62 | + * | |
| 63 | + * @author Prefeitura Municipal de Itajaí <ctima@itajai.sc.gov.br> | |
| 64 | + * @category i-Educar | |
| 65 | + * @license @@license@@ | |
| 66 | + * @package iEd_Pmieducar | |
| 67 | + * @since Classe disponível desde a versão 1.0.0 | |
| 68 | + * @version @@package_version@@ | |
| 69 | + */ | |
| 70 | +class indice extends clsDetalhe | |
| 71 | +{ | |
| 72 | + var $titulo; | |
| 73 | + | |
| 74 | + function Gerar() | |
| 75 | + { | |
| 76 | + @session_start(); | |
| 77 | + $this->pessoa_logada = $_SESSION['id_pessoa']; | |
| 78 | + session_write_close(); | |
| 79 | + | |
| 80 | + // Verificação de permissão para cadastro. | |
| 81 | + $this->obj_permissao = new clsPermissoes(); | |
| 82 | + | |
| 83 | + $this->nivel_usuario = $this->obj_permissao->nivel_acesso($this->pessoa_logada); | |
| 84 | + | |
| 85 | + $this->titulo = 'Veiculo - Detalhe'; | |
| 86 | + $this->addBanner('imagens/nvp_top_intranet.jpg', 'imagens/nvp_vert_intranet.jpg', 'Intranet'); | |
| 87 | + | |
| 88 | + $cod_veiculo = $_GET['cod_veiculo']; | |
| 89 | + | |
| 90 | + $tmp_obj = new clsModulesVeiculo($cod_veiculo); | |
| 91 | + $registro = $tmp_obj->detalhe(); | |
| 92 | + | |
| 93 | + if (! $registro) { | |
| 94 | + header('Location: transporte_veiculo_lst.php'); | |
| 95 | + die(); | |
| 96 | + } | |
| 97 | + | |
| 98 | + $this->addDetalhe( array("Código do veículo", $cod_veiculo)); | |
| 99 | + $this->addDetalhe( array("Descrição", $registro['descricao']) ); | |
| 100 | + $this->addDetalhe( array("Placa", $registro['placa']) ); | |
| 101 | + $this->addDetalhe( array("Renavam", $registro['renavam']) ); | |
| 102 | + $this->addDetalhe( array("Chassi", $registro['chassi']) ); | |
| 103 | + $this->addDetalhe( array("Marca", $registro['marca']) ); | |
| 104 | + $this->addDetalhe( array("Ano fabricação", $registro['ano_fabricacao']) ); | |
| 105 | + $this->addDetalhe( array("Ano modelo", $registro['ano_modelo']) ); | |
| 106 | + $this->addDetalhe( array("Limite de passageiros", $registro['passageiros']) ); | |
| 107 | + $malha =''; | |
| 108 | + switch ($registro['malha']){ | |
| 109 | + case 'A': | |
| 110 | + $malha = 'Aquática/Embarcação'; | |
| 111 | + break; | |
| 112 | + case 'F': | |
| 113 | + $malha = 'Ferroviária'; | |
| 114 | + break; | |
| 115 | + case 'R': | |
| 116 | + $malha = 'Rodoviária'; | |
| 117 | + break; | |
| 118 | + } | |
| 119 | + $this->addDetalhe( array("Malha", $malha) ); | |
| 120 | + $this->addDetalhe( array("Categoria", $registro['descricao_tipo']) ); | |
| 121 | + $this->addDetalhe( array("Exclusivo para transporte escolar", ($registro['exclusivo_transporte_escolar'] == 'S' ? 'Sim' : 'Não')) ); | |
| 122 | + $this->addDetalhe( array("Adaptado para pessoas com necessidades especiais", ($registro['adaptado_necessidades_especiais'] == 'S' ? 'Sim' : 'Não')) ); | |
| 123 | + $this->addDetalhe( array("Ativo", ($registro['ativo'] == 'S' ? 'Sim' : 'Não')) ); | |
| 124 | + if ($registro['ativo']=='N') | |
| 125 | + $this->addDetalhe( array("Descrição inativo", $registro['descricao_inativo']) ); | |
| 126 | + $this->addDetalhe( array("Empresa", $registro['nome_empresa']) ); | |
| 127 | + $this->addDetalhe( array("Motorista responsável", $registro['nome_motorista']) ); | |
| 128 | + $this->addDetalhe( array("Observação", $registro['observacao'])); | |
| 129 | + $this->url_novo = "../module/TransporteEscolar/Veiculo"; | |
| 130 | + $this->url_editar = "../module/TransporteEscolar/Veiculo?id={$cod_veiculo}"; | |
| 131 | + $this->url_cancelar = "transporte_veiculo_lst.php"; | |
| 132 | + | |
| 133 | + $this->largura = "100%"; | |
| 134 | + } | |
| 135 | +} | |
| 136 | + | |
| 137 | +// Instancia o objeto da página | |
| 138 | +$pagina = new clsIndexBase(); | |
| 139 | + | |
| 140 | +// Instancia o objeto de conteúdo | |
| 141 | +$miolo = new indice(); | |
| 142 | + | |
| 143 | +// Passa o conteúdo para a página | |
| 144 | +$pagina->addForm($miolo); | |
| 145 | + | |
| 146 | +// Gera o HTML | |
| 147 | +$pagina->MakeAll(); | ... | ... |
| ... | ... | @@ -0,0 +1,188 @@ |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * i-Educar - Sistema de gestão escolar | |
| 4 | + * | |
| 5 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 6 | + * <ctima@itajai.sc.gov.br> | |
| 7 | + * | |
| 8 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 9 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 10 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 11 | + * qualquer versão posterior. | |
| 12 | + * | |
| 13 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 14 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 15 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 16 | + * do GNU para mais detalhes. | |
| 17 | + * | |
| 18 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 19 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 20 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 21 | + * | |
| 22 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 23 | + * @category i-Educar | |
| 24 | + * @license @@license@@ | |
| 25 | + * @package Module | |
| 26 | + * @since 07/2013 | |
| 27 | + * @version $Id$ | |
| 28 | + */ | |
| 29 | +require_once ("include/clsBase.inc.php"); | |
| 30 | +require_once ("include/clsListagem.inc.php"); | |
| 31 | +require_once ("include/clsBanco.inc.php"); | |
| 32 | +require_once( "include/public/geral.inc.php" ); | |
| 33 | + | |
| 34 | +require_once("include/modules/clsModulesEmpresaTransporteEscolar.inc.php"); | |
| 35 | +require_once("include/modules/clsModulesVeiculo.inc.php"); | |
| 36 | + | |
| 37 | +class clsIndexBase extends clsBase | |
| 38 | +{ | |
| 39 | + function Formular() | |
| 40 | + { | |
| 41 | + $this->SetTitulo( "{$this->_instituicao} i-Educar - Veículos" ); | |
| 42 | + $this->processoAp = "21237"; | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +class indice extends clsListagem | |
| 47 | +{ | |
| 48 | + /** | |
| 49 | + * Referencia pega da session para o idpes do usuario atual | |
| 50 | + * | |
| 51 | + * @var int | |
| 52 | + */ | |
| 53 | + var $__pessoa_logada; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Titulo no topo da pagina | |
| 57 | + * | |
| 58 | + * @var int | |
| 59 | + */ | |
| 60 | + var $__titulo; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Quantidade de registros a ser apresentada em cada pagina | |
| 64 | + * | |
| 65 | + * @var int | |
| 66 | + */ | |
| 67 | + var $__limite; | |
| 68 | + | |
| 69 | + /** | |
| 70 | + * Inicio dos registros a serem exibidos (limit) | |
| 71 | + * | |
| 72 | + * @var int | |
| 73 | + */ | |
| 74 | + var $__offset; | |
| 75 | + | |
| 76 | + var $cod_veiculo; | |
| 77 | + var $descricao; | |
| 78 | + var $placa; | |
| 79 | + var $renavam; | |
| 80 | + var $marca; | |
| 81 | + var $ativo; | |
| 82 | + var $cod_empresa; | |
| 83 | + var $nome_motorista; | |
| 84 | + | |
| 85 | + function Gerar() | |
| 86 | + { | |
| 87 | + @session_start(); | |
| 88 | + $this->__pessoa_logada = $_SESSION['id_pessoa']; | |
| 89 | + session_write_close(); | |
| 90 | + | |
| 91 | + $this->__titulo = "Veículos - Listagem"; | |
| 92 | + | |
| 93 | + foreach( $_GET AS $var => $val ) | |
| 94 | + $this->$var = ( $val === "" ) ? null: $val; | |
| 95 | + | |
| 96 | + $this->addBanner( "imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet" ); | |
| 97 | + | |
| 98 | + $this->addCabecalhos( array( | |
| 99 | + "Código do veículo", | |
| 100 | + "Descrição", | |
| 101 | + "Placa", | |
| 102 | + "Marca", | |
| 103 | + "Empresa", | |
| 104 | + "Motorista responsável" | |
| 105 | + ) ); | |
| 106 | + | |
| 107 | + // Filtros de Foreign Keys | |
| 108 | + $opcoes = array( "" => "Selecione" ); | |
| 109 | + | |
| 110 | + $objTemp = new clsModulesEmpresaTransporteEscolar(); | |
| 111 | + $objTemp->setOrderby(' nome_empresa ASC'); | |
| 112 | + $lista = $objTemp->lista(); | |
| 113 | + if ( is_array( $lista ) && count( $lista ) ) | |
| 114 | + { | |
| 115 | + foreach ( $lista as $registro ) | |
| 116 | + { | |
| 117 | + $opcoes["{$registro['cod_empresa_transporte_escolar']}"] = "{$registro['nome_empresa']}"; | |
| 118 | + } | |
| 119 | + }else{ | |
| 120 | + $opcoes = array( "" => "Sem empresas cadastradas" ); | |
| 121 | + } | |
| 122 | + | |
| 123 | + $this->campoNumero('cod_veiculo','Código do veículo',$this->cod_veiculo,29,15); | |
| 124 | + $this->campoTexto( "descricao", "Descrição", $this->descricao, 29, 50, false ); | |
| 125 | + $this->campoTexto( "placa", "Placa", $this->placa, 29, 10, false ); | |
| 126 | + $this->campoTexto( "renavam", "Renavam", $this->renavam, 29, 30, false ); | |
| 127 | + $this->campoTexto( "marca", "Marca", $this->marca, 29, 50, false ); | |
| 128 | + | |
| 129 | + $this->campoLista( "ativo", "Ativo", array( null => 'Selecione', 'S' => 'Ativo', 'N' => 'Inativo'), $this->ativo, "", false, "", "", false, false ); | |
| 130 | + $this->campoLista( "cod_empresa", "Empresa", $opcoes, $this->cod_empresa, "", false, "", "", false, false ); | |
| 131 | + $this->campoTexto( "nome_motorista", "Motorista responsável", $this->nome_motorista, 29, 30, false ); | |
| 132 | + | |
| 133 | + | |
| 134 | + // Paginador | |
| 135 | + $this->__limite = 20; | |
| 136 | + $this->__offset = ( $_GET["pagina_{$this->nome}"] ) ? $_GET["pagina_{$this->nome}"]*$this->__limite-$this->__limite: 0; | |
| 137 | + | |
| 138 | + $obj = new clsModulesVeiculo(); | |
| 139 | + $obj->setOrderby( " descricao ASC" ); | |
| 140 | + $obj->setLimite( $this->__limite, $this->__offset ); | |
| 141 | + | |
| 142 | + $lista = $obj->lista( | |
| 143 | + $this->cod_veiculo, | |
| 144 | + $this->descricao, | |
| 145 | + $this->placa, | |
| 146 | + $this->renavam, | |
| 147 | + $this->nome_motorista, | |
| 148 | + $this->cod_empresa, | |
| 149 | + $this->marca, | |
| 150 | + $this->ativo | |
| 151 | + | |
| 152 | + ); | |
| 153 | + | |
| 154 | + $total = $obj->_total; | |
| 155 | + | |
| 156 | + // monta a lista | |
| 157 | + if( is_array( $lista ) && count( $lista ) ) | |
| 158 | + { | |
| 159 | + foreach ( $lista AS $registro ) | |
| 160 | + { | |
| 161 | + $this->addLinhas( array( | |
| 162 | + "<a href=\"transporte_veiculo_det.php?cod_veiculo={$registro["cod_veiculo"]}\">{$registro["cod_veiculo"]}</a>", | |
| 163 | + "<a href=\"transporte_veiculo_det.php?cod_veiculo={$registro["cod_veiculo"]}\">{$registro["descricao"]}</a>", | |
| 164 | + "<a href=\"transporte_veiculo_det.php?cod_veiculo={$registro["cod_veiculo"]}\">{$registro["placa"]}</a>", | |
| 165 | + "<a href=\"transporte_veiculo_det.php?cod_veiculo={$registro["cod_veiculo"]}\">{$registro["marca"]}</a>", | |
| 166 | + "<a href=\"transporte_veiculo_det.php?cod_veiculo={$registro["cod_veiculo"]}\">{$registro["nome_empresa"]}</a>", | |
| 167 | + "<a href=\"transporte_veiculo_det.php?cod_veiculo={$registro["cod_veiculo"]}\">{$registro["nome_motorista"]}</a>" | |
| 168 | + ) ); | |
| 169 | + } | |
| 170 | + } | |
| 171 | + | |
| 172 | + $this->addPaginador2( "transporte_veiculo_lst.php", $total, $_GET, $this->nome, $this->__limite ); | |
| 173 | + | |
| 174 | + $this->acao = "go(\"/module/TransporteEscolar/Veiculo\")"; | |
| 175 | + $this->nome_acao = "Novo"; | |
| 176 | + | |
| 177 | + $this->largura = "100%"; | |
| 178 | + } | |
| 179 | +} | |
| 180 | +// cria uma extensao da classe base | |
| 181 | +$pagina = new clsIndexBase(); | |
| 182 | +// cria o conteudo | |
| 183 | +$miolo = new indice(); | |
| 184 | +// adiciona o conteudo na clsBase | |
| 185 | +$pagina->addForm( $miolo ); | |
| 186 | +// gera o html | |
| 187 | +$pagina->MakeAll(); | |
| 188 | +?> | |
| 0 | 189 | \ No newline at end of file | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/Resource/SimpleSearchEmpresa.php
0 → 100644
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | +/** | |
| 5 | + * i-Educar - Sistema de gestão escolar | |
| 6 | + * | |
| 7 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 8 | + * <ctima@itajai.sc.gov.br> | |
| 9 | + * | |
| 10 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 11 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 12 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 13 | + * qualquer versão posterior. | |
| 14 | + * | |
| 15 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 16 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 17 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 18 | + * do GNU para mais detalhes. | |
| 19 | + * | |
| 20 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 21 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 22 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 23 | + * | |
| 24 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 25 | + * @category i-Educar | |
| 26 | + * @license @@license@@ | |
| 27 | + * @package Portabilis | |
| 28 | + * @since 07/2013 | |
| 29 | + * @version @@package_version@@ | |
| 30 | + */ | |
| 31 | + | |
| 32 | +require_once 'lib/Portabilis/View/Helper/Input/SimpleSearch.php'; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * Portabilis_View_Helper_Input_SimpleSearchEmpresa class. | |
| 36 | + * | |
| 37 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 38 | + * @category i-Educar | |
| 39 | + * @license @@license@@ | |
| 40 | + * @package Portabilis | |
| 41 | + * @since 07/2013 | |
| 42 | + * @version @@package_version@@ | |
| 43 | + */ | |
| 44 | +class Portabilis_View_Helper_Input_Resource_SimpleSearchEmpresa extends Portabilis_View_Helper_Input_SimpleSearch { | |
| 45 | + | |
| 46 | + protected function resourceValue($id) { | |
| 47 | + if ($id) { | |
| 48 | + $sql = "select nome from modules.empresa_transporte_escolar, cadastro.pessoa where ref_idpes = idpes and cod_empresa_transporte_escolar = $1"; | |
| 49 | + $options = array('params' => $id, 'return_only' => 'first-field'); | |
| 50 | + $nome = Portabilis_Utils_Database::fetchPreparedQuery($sql, $options); | |
| 51 | + | |
| 52 | + return Portabilis_String_Utils::toLatin1($nome, array('transform' => true, 'escape' => false)); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + public function simpleSearchEmpresa($attrName = '', $options = array()) { | |
| 57 | + $defaultOptions = array('objectName' => 'empresa', | |
| 58 | + 'apiController' => 'Empresa', | |
| 59 | + 'apiResource' => 'empresa-search'); | |
| 60 | + | |
| 61 | + $options = $this->mergeOptions($options, $defaultOptions); | |
| 62 | + | |
| 63 | + parent::simpleSearch($options['objectName'], $attrName, $options); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function inputPlaceholder($inputOptions) { | |
| 67 | + return 'Informe o código ou nome da empresa'; | |
| 68 | + } | |
| 69 | + | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/Resource/SimpleSearchMotorista.php
0 → 100644
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | +/** | |
| 5 | + * i-Educar - Sistema de gestão escolar | |
| 6 | + * | |
| 7 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 8 | + * <ctima@itajai.sc.gov.br> | |
| 9 | + * | |
| 10 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 11 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 12 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 13 | + * qualquer versão posterior. | |
| 14 | + * | |
| 15 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 16 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 17 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 18 | + * do GNU para mais detalhes. | |
| 19 | + * | |
| 20 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 21 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 22 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 23 | + * | |
| 24 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 25 | + * @category i-Educar | |
| 26 | + * @license @@license@@ | |
| 27 | + * @package Portabilis | |
| 28 | + * @since 07/2013 | |
| 29 | + * @version @@package_version@@ | |
| 30 | + */ | |
| 31 | + | |
| 32 | +require_once 'lib/Portabilis/View/Helper/Input/SimpleSearch.php'; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * Portabilis_View_Helper_Input_SimpleSearchMotorista class. | |
| 36 | + * | |
| 37 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 38 | + * @category i-Educar | |
| 39 | + * @license @@license@@ | |
| 40 | + * @package Portabilis | |
| 41 | + * @since 07/2013 | |
| 42 | + * @version @@package_version@@ | |
| 43 | + */ | |
| 44 | +class Portabilis_View_Helper_Input_Resource_SimpleSearchMotorista extends Portabilis_View_Helper_Input_SimpleSearch { | |
| 45 | + | |
| 46 | + protected function resourceValue($id) { | |
| 47 | + if ($id) { | |
| 48 | + $sql = "select nome from modules.motorista, cadastro.pessoa where ref_idpes = idpes and cod_motorista = $1"; | |
| 49 | + $options = array('params' => $id, 'return_only' => 'first-field'); | |
| 50 | + $nome = Portabilis_Utils_Database::fetchPreparedQuery($sql, $options); | |
| 51 | + | |
| 52 | + return Portabilis_String_Utils::toLatin1($nome, array('transform' => true, 'escape' => false)); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + public function simpleSearchMotorista($attrName = '', $options = array()) { | |
| 57 | + $defaultOptions = array('objectName' => 'motorista', | |
| 58 | + 'apiController' => 'Motorista', | |
| 59 | + 'apiResource' => 'motorista-search'); | |
| 60 | + | |
| 61 | + $options = $this->mergeOptions($options, $defaultOptions); | |
| 62 | + | |
| 63 | + parent::simpleSearch($options['objectName'], $attrName, $options); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function inputPlaceholder($inputOptions) { | |
| 67 | + return 'Informe o código ou nome do motorista'; | |
| 68 | + } | |
| 69 | + | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/Resource/SimpleSearchPessoaj.php
0 → 100644
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | +/** | |
| 5 | + * i-Educar - Sistema de gestão escolar | |
| 6 | + * | |
| 7 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 8 | + * <ctima@itajai.sc.gov.br> | |
| 9 | + * | |
| 10 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 11 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 12 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 13 | + * qualquer versão posterior. | |
| 14 | + * | |
| 15 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 16 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 17 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 18 | + * do GNU para mais detalhes. | |
| 19 | + * | |
| 20 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 21 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 22 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 23 | + * | |
| 24 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 25 | + * @category i-Educar | |
| 26 | + * @license @@license@@ | |
| 27 | + * @package Portabilis | |
| 28 | + * @since 07/2013 | |
| 29 | + * @version @@package_version@@ | |
| 30 | + */ | |
| 31 | + | |
| 32 | +require_once 'lib/Portabilis/View/Helper/Input/SimpleSearch.php'; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * Portabilis_View_Helper_Input_SimpleSearchEmpresa class. | |
| 36 | + * | |
| 37 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 38 | + * @category i-Educar | |
| 39 | + * @license @@license@@ | |
| 40 | + * @package Portabilis | |
| 41 | + * @since 07/2013 | |
| 42 | + * @version @@package_version@@ | |
| 43 | + */ | |
| 44 | +class Portabilis_View_Helper_Input_Resource_SimpleSearchPessoaj extends Portabilis_View_Helper_Input_SimpleSearch { | |
| 45 | + | |
| 46 | + protected function resourceValue($id) { | |
| 47 | + if ($id) { | |
| 48 | + $sql = "select nome from cadastro.pessoa where idpes = $1 and tipo='J'"; | |
| 49 | + $options = array('params' => $id, 'return_only' => 'first-field'); | |
| 50 | + $nome = Portabilis_Utils_Database::fetchPreparedQuery($sql, $options); | |
| 51 | + | |
| 52 | + return Portabilis_String_Utils::toLatin1($nome, array('transform' => true, 'escape' => false)); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + public function simpleSearchPessoaj($attrName = '', $options = array()) { | |
| 57 | + $defaultOptions = array('objectName' => 'pessoaj', | |
| 58 | + 'apiController' => 'Pessoaj', | |
| 59 | + 'apiResource' => 'pessoaj-search'); | |
| 60 | + | |
| 61 | + $options = $this->mergeOptions($options, $defaultOptions); | |
| 62 | + | |
| 63 | + parent::simpleSearch($options['objectName'], $attrName, $options); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function inputPlaceholder($inputOptions) { | |
| 67 | + return 'Informe o código ou nome da pessoa jurídica'; | |
| 68 | + } | |
| 69 | + | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/Resource/SimpleSearchPonto.php
0 → 100644
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | +/** | |
| 5 | + * i-Educar - Sistema de gestão escolar | |
| 6 | + * | |
| 7 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 8 | + * <ctima@itajai.sc.gov.br> | |
| 9 | + * | |
| 10 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 11 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 12 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 13 | + * qualquer versão posterior. | |
| 14 | + * | |
| 15 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 16 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 17 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 18 | + * do GNU para mais detalhes. | |
| 19 | + * | |
| 20 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 21 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 22 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 23 | + * | |
| 24 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 25 | + * @category i-Educar | |
| 26 | + * @license @@license@@ | |
| 27 | + * @package Portabilis | |
| 28 | + * @since 07/2013 | |
| 29 | + * @version @@package_version@@ | |
| 30 | + */ | |
| 31 | + | |
| 32 | +require_once 'lib/Portabilis/View/Helper/Input/SimpleSearch.php'; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * Portabilis_View_Helper_Input_SimpleSearchMotorista class. | |
| 36 | + * | |
| 37 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 38 | + * @category i-Educar | |
| 39 | + * @license @@license@@ | |
| 40 | + * @package Portabilis | |
| 41 | + * @since 07/2013 | |
| 42 | + * @version @@package_version@@ | |
| 43 | + */ | |
| 44 | +class Portabilis_View_Helper_Input_Resource_SimpleSearchPonto extends Portabilis_View_Helper_Input_SimpleSearch { | |
| 45 | + | |
| 46 | + protected function resourceValue($id) { | |
| 47 | + if ($id) { | |
| 48 | + $sql = "select descricao from modules.ponto_transporte_escolar where cod_ponto_transporte_escolar = $1"; | |
| 49 | + $options = array('params' => $id, 'return_only' => 'first-field'); | |
| 50 | + $nome = Portabilis_Utils_Database::fetchPreparedQuery($sql, $options); | |
| 51 | + | |
| 52 | + return Portabilis_String_Utils::toLatin1($nome, array('transform' => true, 'escape' => false)); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + public function simpleSearchPonto($attrName = '', $options = array()) { | |
| 57 | + $defaultOptions = array('objectName' => 'ponto', | |
| 58 | + 'apiController' => 'Ponto', | |
| 59 | + 'apiResource' => 'ponto-search'); | |
| 60 | + | |
| 61 | + $options = $this->mergeOptions($options, $defaultOptions); | |
| 62 | + | |
| 63 | + parent::simpleSearch($options['objectName'], $attrName, $options); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function inputPlaceholder($inputOptions) { | |
| 67 | + return 'Informe o código ou a descrição do ponto'; | |
| 68 | + } | |
| 69 | + | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/Resource/SimpleSearchRota.php
0 → 100644
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | +/** | |
| 5 | + * i-Educar - Sistema de gestão escolar | |
| 6 | + * | |
| 7 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 8 | + * <ctima@itajai.sc.gov.br> | |
| 9 | + * | |
| 10 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 11 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 12 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 13 | + * qualquer versão posterior. | |
| 14 | + * | |
| 15 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 16 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 17 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 18 | + * do GNU para mais detalhes. | |
| 19 | + * | |
| 20 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 21 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 22 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 23 | + * | |
| 24 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 25 | + * @category i-Educar | |
| 26 | + * @license @@license@@ | |
| 27 | + * @package Portabilis | |
| 28 | + * @since 07/2013 | |
| 29 | + * @version @@package_version@@ | |
| 30 | + */ | |
| 31 | + | |
| 32 | +require_once 'lib/Portabilis/View/Helper/Input/SimpleSearch.php'; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * Portabilis_View_Helper_Input_SimpleSearchMotorista class. | |
| 36 | + * | |
| 37 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 38 | + * @category i-Educar | |
| 39 | + * @license @@license@@ | |
| 40 | + * @package Portabilis | |
| 41 | + * @since 07/2013 | |
| 42 | + * @version @@package_version@@ | |
| 43 | + */ | |
| 44 | +class Portabilis_View_Helper_Input_Resource_SimpleSearchRota extends Portabilis_View_Helper_Input_SimpleSearch { | |
| 45 | + | |
| 46 | + protected function resourceValue($id) { | |
| 47 | + if ($id) { | |
| 48 | + $sql = "select descricao from modules.rota_transporte_escolar where cod_rota_transporte_escolar = $1"; | |
| 49 | + $options = array('params' => $id, 'return_only' => 'first-field'); | |
| 50 | + $nome = Portabilis_Utils_Database::fetchPreparedQuery($sql, $options); | |
| 51 | + | |
| 52 | + return Portabilis_String_Utils::toLatin1($nome, array('transform' => true, 'escape' => false)); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + public function simpleSearchRota($attrName = '', $options = array()) { | |
| 57 | + $defaultOptions = array('objectName' => 'rota', | |
| 58 | + 'apiController' => 'Rota', | |
| 59 | + 'apiResource' => 'rota-search'); | |
| 60 | + | |
| 61 | + $options = $this->mergeOptions($options, $defaultOptions); | |
| 62 | + | |
| 63 | + parent::simpleSearch($options['objectName'], $attrName, $options); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function inputPlaceholder($inputOptions) { | |
| 67 | + return 'Informe o código ou a descrição da rota'; | |
| 68 | + } | |
| 69 | + | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
ieducar/lib/Portabilis/View/Helper/Input/Resource/SimpleSearchVeiculo.php
0 → 100644
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | +/** | |
| 5 | + * i-Educar - Sistema de gestão escolar | |
| 6 | + * | |
| 7 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 8 | + * <ctima@itajai.sc.gov.br> | |
| 9 | + * | |
| 10 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 11 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 12 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 13 | + * qualquer versão posterior. | |
| 14 | + * | |
| 15 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 16 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 17 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 18 | + * do GNU para mais detalhes. | |
| 19 | + * | |
| 20 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 21 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 22 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 23 | + * | |
| 24 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 25 | + * @category i-Educar | |
| 26 | + * @license @@license@@ | |
| 27 | + * @package Portabilis | |
| 28 | + * @since 07/2013 | |
| 29 | + * @version @@package_version@@ | |
| 30 | + */ | |
| 31 | + | |
| 32 | +require_once 'lib/Portabilis/View/Helper/Input/SimpleSearch.php'; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * Portabilis_View_Helper_Input_SimpleSearchMotorista class. | |
| 36 | + * | |
| 37 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 38 | + * @category i-Educar | |
| 39 | + * @license @@license@@ | |
| 40 | + * @package Portabilis | |
| 41 | + * @since 07/2013 | |
| 42 | + * @version @@package_version@@ | |
| 43 | + */ | |
| 44 | +class Portabilis_View_Helper_Input_Resource_SimpleSearchVeiculo extends Portabilis_View_Helper_Input_SimpleSearch { | |
| 45 | + | |
| 46 | + protected function resourceValue($id) { | |
| 47 | + if ($id) { | |
| 48 | + $sql = "select (descricao || ',Placa: ' || placa) from modules.veiculo where cod_veiculo = $1"; | |
| 49 | + $options = array('params' => $id, 'return_only' => 'first-field'); | |
| 50 | + $nome = Portabilis_Utils_Database::fetchPreparedQuery($sql, $options); | |
| 51 | + | |
| 52 | + return Portabilis_String_Utils::toLatin1($nome, array('transform' => true, 'escape' => false)); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + public function simpleSearchVeiculo($attrName = '', $options = array()) { | |
| 57 | + $defaultOptions = array('objectName' => 'veiculo', | |
| 58 | + 'apiController' => 'Veiculo', | |
| 59 | + 'apiResource' => 'veiculo-search'); | |
| 60 | + | |
| 61 | + $options = $this->mergeOptions($options, $defaultOptions); | |
| 62 | + | |
| 63 | + parent::simpleSearch($options['objectName'], $attrName, $options); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function inputPlaceholder($inputOptions) { | |
| 67 | + return 'Informe o código ou a descrição do veiculo'; | |
| 68 | + } | |
| 69 | + | |
| 70 | +} | |
| 0 | 71 | \ No newline at end of file | ... | ... |
ieducar/lib/Portabilis/View/Helper/Inputs.php
| ... | ... | @@ -169,6 +169,38 @@ class Portabilis_View_Helper_Inputs { |
| 169 | 169 | $this->simpleSearchResourceInput('simpleSearchAluno', $attrName, $inputOptions, $helperOptions); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | + public function simpleSearchEmpresa($attrName, $inputOptions = array(), $helperOptions = array()) { | |
| 173 | + $this->simpleSearchResourceInput('simpleSearchEmpresa', $attrName, $inputOptions, $helperOptions); | |
| 174 | + } | |
| 175 | + | |
| 176 | + public function simpleSearchPessoaj($attrName, $inputOptions = array(), $helperOptions = array()) { | |
| 177 | + $this->simpleSearchResourceInput('simpleSearchPessoaj', $attrName, $inputOptions, $helperOptions); | |
| 178 | + } | |
| 179 | + | |
| 180 | + public function simpleSearchMotorista($attrName, $inputOptions = array(), $helperOptions = array()) { | |
| 181 | + | |
| 182 | + $this->simpleSearchResourceInput('simpleSearchMotorista', $attrName, $inputOptions, $helperOptions); | |
| 183 | + | |
| 184 | + } | |
| 185 | + | |
| 186 | + public function simpleSearchPonto($attrName, $inputOptions = array(), $helperOptions = array()) { | |
| 187 | + | |
| 188 | + $this->simpleSearchResourceInput('simpleSearchPonto', $attrName, $inputOptions, $helperOptions); | |
| 189 | + | |
| 190 | + } | |
| 191 | + | |
| 192 | + public function simpleSearchRota($attrName, $inputOptions = array(), $helperOptions = array()) { | |
| 193 | + | |
| 194 | + $this->simpleSearchResourceInput('simpleSearchRota', $attrName, $inputOptions, $helperOptions); | |
| 195 | + | |
| 196 | + } | |
| 197 | + | |
| 198 | + public function simpleSearchVeiculo($attrName, $inputOptions = array(), $helperOptions = array()) { | |
| 199 | + | |
| 200 | + $this->simpleSearchResourceInput('simpleSearchVeiculo', $attrName, $inputOptions, $helperOptions); | |
| 201 | + | |
| 202 | + } | |
| 203 | + | |
| 172 | 204 | // multiple search resource input helper |
| 173 | 205 | |
| 174 | 206 | |
| ... | ... | @@ -217,13 +249,18 @@ class Portabilis_View_Helper_Inputs { |
| 217 | 249 | } |
| 218 | 250 | |
| 219 | 251 | protected function simpleSearchResourceInput($helperName, $attrName, $inputOptions = array(), $helperOptions = array()) { |
| 252 | + | |
| 220 | 253 | $options = $this->mergeInputOptions($inputOptions, $helperOptions); |
| 221 | 254 | |
| 222 | 255 | $helperClassName = 'Portabilis_View_Helper_Input_Resource_' . ucfirst($helperName); |
| 256 | + | |
| 223 | 257 | $this->includeHelper($helperClassName); |
| 224 | 258 | |
| 225 | 259 | $helper = new $helperClassName($this->viewInstance, $this); |
| 260 | + | |
| 226 | 261 | $helper->$helperName($attrName, $options); |
| 262 | + | |
| 263 | + | |
| 227 | 264 | } |
| 228 | 265 | |
| 229 | 266 | protected function multipleSearchResourceInput($helperName, $attrName, $inputOptions = array(), $helperOptions = array()) { | ... | ... |
ieducar/misc/database/deltas/portabilis/55_controle_de_empresas_transporte_escolar.sql
0 → 100644
| ... | ... | @@ -0,0 +1,157 @@ |
| 1 | + -- // | |
| 2 | + | |
| 3 | + -- | |
| 4 | + -- Cria tabelas e squenciais para controle de empresas | |
| 5 | + -- | |
| 6 | + -- @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 7 | + -- @license @@license@@ | |
| 8 | + -- @version $Id$ | |
| 9 | + | |
| 10 | + | |
| 11 | + CREATE SEQUENCE modules.empresa_transporte_escolar_seq | |
| 12 | + INCREMENT 1 | |
| 13 | + MINVALUE 1 | |
| 14 | + MAXVALUE 9223372036854775807 | |
| 15 | + START 1 | |
| 16 | + CACHE 1; | |
| 17 | + ALTER TABLE modules.empresa_transporte_escolar_seq | |
| 18 | + OWNER TO ieducar; | |
| 19 | + | |
| 20 | + CREATE TABLE modules.empresa_transporte_escolar | |
| 21 | + ( | |
| 22 | + cod_empresa_transporte_escolar integer NOT NULL DEFAULT nextval('modules.empresa_transporte_escolar_seq'::regclass), | |
| 23 | + ref_idpes integer NOT NULL, | |
| 24 | + ref_resp_idpes integer NOT NULL, | |
| 25 | + observacao character varying(255), | |
| 26 | + CONSTRAINT empresa_transporte_escolar_cod_empresa_transporte_escolar_pkey PRIMARY KEY (cod_empresa_transporte_escolar ), | |
| 27 | + CONSTRAINT empresa_transporte_escolar_ref_idpes_fkey FOREIGN KEY (ref_idpes) | |
| 28 | + REFERENCES cadastro.juridica (idpes) MATCH SIMPLE, | |
| 29 | + CONSTRAINT empresa_transporte_escolar_ref_resp_idpes_fkey FOREIGN KEY (ref_resp_idpes) | |
| 30 | + REFERENCES cadastro.fisica (idpes) MATCH SIMPLE | |
| 31 | + ON UPDATE RESTRICT ON DELETE RESTRICT | |
| 32 | + ) | |
| 33 | + WITH ( | |
| 34 | + OIDS=TRUE | |
| 35 | + ); | |
| 36 | + | |
| 37 | + CREATE SEQUENCE modules.motorista_seq | |
| 38 | + INCREMENT 1 | |
| 39 | + MINVALUE 1 | |
| 40 | + MAXVALUE 9223372036854775807 | |
| 41 | + START 1 | |
| 42 | + CACHE 1; | |
| 43 | + ALTER TABLE modules.motorista_seq | |
| 44 | + OWNER TO ieducar; | |
| 45 | + | |
| 46 | + | |
| 47 | + CREATE TABLE modules.motorista | |
| 48 | + ( | |
| 49 | + cod_motorista integer NOT NULL DEFAULT nextval('modules.motorista_seq'::regclass), | |
| 50 | + ref_idpes integer NOT NULL, | |
| 51 | + cnh character varying(15) NOT NULL, | |
| 52 | + tipo_cnh character varying(2) NOT NULL, | |
| 53 | + dt_habilitacao date, | |
| 54 | + vencimento_cnh date, | |
| 55 | + ref_cod_empresa_transporte_escolar integer NOT NULL, | |
| 56 | + observacao character varying(255), | |
| 57 | + CONSTRAINT motorista_pkey PRIMARY KEY (cod_motorista), | |
| 58 | + CONSTRAINT motorista_ref_idpes_fkey FOREIGN KEY (ref_idpes) | |
| 59 | + REFERENCES cadastro.fisica (idpes) MATCH SIMPLE | |
| 60 | + ON UPDATE RESTRICT ON DELETE RESTRICT, | |
| 61 | + CONSTRAINT motorista_ref_cod_empresa_transporte_escolar_fkey FOREIGN KEY (ref_cod_empresa_transporte_escolar) | |
| 62 | + REFERENCES modules.empresa_transporte_escolar(cod_empresa_transporte_escolar) MATCH SIMPLE ON UPDATE RESTRICT ON DELETE RESTRICT | |
| 63 | + ) | |
| 64 | + WITH ( | |
| 65 | + OIDS=TRUE | |
| 66 | + ); | |
| 67 | + | |
| 68 | + CREATE SEQUENCE modules.tipo_veiculo_seq | |
| 69 | + INCREMENT 1 | |
| 70 | + MINVALUE 1 | |
| 71 | + MAXVALUE 9223372036854775807 | |
| 72 | + START 1 | |
| 73 | + CACHE 1; | |
| 74 | + ALTER TABLE modules.tipo_veiculo_seq | |
| 75 | + OWNER TO ieducar; | |
| 76 | + | |
| 77 | + CREATE TABLE modules.tipo_veiculo | |
| 78 | + ( | |
| 79 | + cod_tipo_veiculo integer NOT NULL DEFAULT nextval('modules.tipo_veiculo_seq'::regclass), | |
| 80 | + descricao character varying(60), | |
| 81 | + CONSTRAINT tipo_veiculo_pkey PRIMARY KEY (cod_tipo_veiculo) | |
| 82 | + ) | |
| 83 | + WITH ( | |
| 84 | + OIDS=TRUE | |
| 85 | + ); | |
| 86 | + | |
| 87 | + | |
| 88 | + CREATE SEQUENCE modules.veiculo_seq | |
| 89 | + INCREMENT 1 | |
| 90 | + MINVALUE 1 | |
| 91 | + MAXVALUE 9223372036854775807 | |
| 92 | + START 1 | |
| 93 | + CACHE 1; | |
| 94 | + ALTER TABLE modules.veiculo_seq | |
| 95 | + OWNER TO ieducar; | |
| 96 | + | |
| 97 | + CREATE TABLE modules.veiculo | |
| 98 | + ( | |
| 99 | + cod_veiculo integer NOT NULL DEFAULT nextval('modules.veiculo_seq'::regclass), | |
| 100 | + descricao character varying(255) NOT NULL, | |
| 101 | + placa character varying(10) NOT NULL, | |
| 102 | + renavam character varying(15) NOT NULL, | |
| 103 | + chassi character varying(30), | |
| 104 | + marca character varying(50), | |
| 105 | + ano_fabricacao integer, | |
| 106 | + ano_modelo integer, | |
| 107 | + passageiros integer NOT NULL, | |
| 108 | + malha char(1) NOT NULL, | |
| 109 | + ref_cod_tipo_veiculo integer NOT NULL, | |
| 110 | + exclusivo_transporte_escolar char(1) NOT NULL, | |
| 111 | + adaptado_necessidades_especiais char(1) NOT NULL, | |
| 112 | + ativo char(1), | |
| 113 | + descricao_inativo char(155), | |
| 114 | + ref_cod_empresa_transporte_escolar integer NOT NULL, | |
| 115 | + ref_cod_motorista integer NOT NULL, | |
| 116 | + observacao character varying(255), | |
| 117 | + CONSTRAINT veiculo_pkey PRIMARY KEY (cod_veiculo), | |
| 118 | + CONSTRAINT veiculo_ref_cod_empresa_transporte_escolar_fkey FOREIGN KEY (ref_cod_empresa_transporte_escolar) | |
| 119 | + REFERENCES modules.empresa_transporte_escolar(cod_empresa_transporte_escolar) MATCH SIMPLE, | |
| 120 | + CONSTRAINT veiculo_ref_cod_tipo_veiculo_fkey FOREIGN KEY (ref_cod_tipo_veiculo) | |
| 121 | + REFERENCES modules.tipo_veiculo(cod_tipo_veiculo) MATCH SIMPLE | |
| 122 | + ON UPDATE RESTRICT ON DELETE RESTRICT | |
| 123 | + ) | |
| 124 | + WITH ( | |
| 125 | + OIDS=TRUE | |
| 126 | + ); | |
| 127 | + | |
| 128 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (1,'Vans/Kombis'); | |
| 129 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (2,'Microônibus'); | |
| 130 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (3,'Ônibus'); | |
| 131 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (4,'Bicicleta'); | |
| 132 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (5,'Tração Animal'); | |
| 133 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (6,'Outro'); | |
| 134 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (7,'Capacidade de até 5 Alunos'); | |
| 135 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (8,'Capacidade entre 5 a 15 Alunos'); | |
| 136 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (9,'Capacidade entre 15 a 35 Alunos'); | |
| 137 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (10,'Capacidade acima de 35 Alunos'); | |
| 138 | + INSERT INTO modules.tipo_veiculo (cod_tipo_veiculo,descricao) values (11,'Trem/Metrô'); | |
| 139 | + | |
| 140 | + -- //@UNDO | |
| 141 | + | |
| 142 | + DROP TABLE modules.veiculo; | |
| 143 | + DROP SEQUENCE modules.veiculo_seq; | |
| 144 | + DROP TABLE modules.tipo_veiculo; | |
| 145 | + DROP SEQUENCE modules.tipo_veiculo_seq; | |
| 146 | + DROP TABLE modules.motorista; | |
| 147 | + DROP SEQUENCE modules.motorista_seq; | |
| 148 | + DROP TABLE modules.empresa_transporte_escolar; | |
| 149 | + DROP SEQUENCE modules.empresa_transporte_escolar_seq; | |
| 150 | + | |
| 151 | + DELETE FROM modules.tipo_veiculo WHERE cod_tipo_veiculo IN (1,2,3,4,5,6,7,8,9,10,11); | |
| 152 | + | |
| 153 | + | |
| 154 | + -- // | |
| 155 | + | |
| 156 | + | |
| 157 | + | ... | ... |
ieducar/misc/database/deltas/portabilis/56_controle_das_rotas_transporte_escolar.sql
0 → 100644
| ... | ... | @@ -0,0 +1,154 @@ |
| 1 | + -- // | |
| 2 | + | |
| 3 | + -- | |
| 4 | + -- Cria tabelas e squenciais para controle de rotas | |
| 5 | + -- | |
| 6 | + -- @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 7 | + -- @license @@license@@ | |
| 8 | + -- @version $Id$ | |
| 9 | + | |
| 10 | + --Criar a tabela de rota | |
| 11 | + | |
| 12 | + -- Sequence: modules.empresa_transporte_escolar_seq | |
| 13 | + CREATE SEQUENCE modules.rota_transporte_escolar_seq | |
| 14 | + INCREMENT 1 | |
| 15 | + MINVALUE 1 | |
| 16 | + MAXVALUE 9223372036854775807 | |
| 17 | + START 1 | |
| 18 | + CACHE 1; | |
| 19 | + ALTER TABLE modules.rota_transporte_escolar_seq | |
| 20 | + OWNER TO ieducar; | |
| 21 | + | |
| 22 | + | |
| 23 | + -- Table: modules.rota_transporte_escolar | |
| 24 | + CREATE TABLE modules.rota_transporte_escolar | |
| 25 | + ( | |
| 26 | + cod_rota_transporte_escolar integer NOT NULL DEFAULT nextval('modules.rota_transporte_escolar_seq'::regclass), | |
| 27 | + ref_idpes_destino integer NOT NULL, | |
| 28 | + descricao character varying(50) NOT NULL, | |
| 29 | + ano integer NOT NULL, | |
| 30 | + tipo_rota char(1) NOT NULL, | |
| 31 | + km_pav float, | |
| 32 | + km_npav float, | |
| 33 | + ref_cod_empresa_transporte_escolar integer, | |
| 34 | + tercerizado character(1) not null, | |
| 35 | + CONSTRAINT rota_transporte_escolar_cod_rota_transporte_escolar_pkey PRIMARY KEY (cod_rota_transporte_escolar ), | |
| 36 | + CONSTRAINT rota_transporte_escolar_ref_idpes_destino_fkey FOREIGN KEY (ref_idpes_destino) | |
| 37 | + REFERENCES cadastro.juridica (idpes) MATCH SIMPLE, | |
| 38 | + CONSTRAINT rota_transporte_escolar_ref_cod_empresa_transporte_escolar_fkey FOREIGN KEY (ref_cod_empresa_transporte_escolar) | |
| 39 | + REFERENCES modules.empresa_transporte_escolar (cod_empresa_transporte_escolar) MATCH SIMPLE | |
| 40 | + ON UPDATE RESTRICT ON DELETE RESTRICT | |
| 41 | + ) | |
| 42 | + WITH ( | |
| 43 | + OIDS=TRUE | |
| 44 | + ); | |
| 45 | + | |
| 46 | + | |
| 47 | + -- Sequence: modules.itinerario_transporte_escolar_seq | |
| 48 | + CREATE SEQUENCE modules.itinerario_transporte_escolar_seq | |
| 49 | + INCREMENT 1 | |
| 50 | + MINVALUE 1 | |
| 51 | + MAXVALUE 9223372036854775807 | |
| 52 | + START 1 | |
| 53 | + CACHE 1; | |
| 54 | + ALTER TABLE modules.itinerario_transporte_escolar_seq | |
| 55 | + OWNER TO ieducar; | |
| 56 | + | |
| 57 | + | |
| 58 | + -- Table: modules.itinerario_transporte_escolar | |
| 59 | + CREATE TABLE modules.itinerario_transporte_escolar | |
| 60 | + ( | |
| 61 | + cod_itinerario_transporte_escolar integer NOT NULL DEFAULT nextval('modules.itinerario_transporte_escolar_seq'::regclass), | |
| 62 | + ref_cod_rota_transporte_escolar integer not null, | |
| 63 | + seq integer not null, | |
| 64 | + ref_cod_ponto_transporte_escolar integer not null, | |
| 65 | + ref_cod_veiculo integer, | |
| 66 | + hora time without time zone, | |
| 67 | + tipo character(1) not null, | |
| 68 | + CONSTRAINT itinerario_transporte_escolar_cod_itinerario_transporte_escolar_pkey PRIMARY KEY (cod_itinerario_transporte_escolar), | |
| 69 | + CONSTRAINT itinerario_transporte_escolar_ref_cod_rota_transporte_escolar_fkey FOREIGN KEY (ref_cod_rota_transporte_escolar) | |
| 70 | + REFERENCES modules.rota_transporte_escolar (cod_rota_transporte_escolar) MATCH SIMPLE, | |
| 71 | + CONSTRAINT ponto_transporte_escolar_ref_cod_veiculo_fkey FOREIGN KEY (ref_cod_veiculo) | |
| 72 | + REFERENCES modules.veiculo (cod_veiculo) MATCH SIMPLE | |
| 73 | + ON UPDATE RESTRICT ON DELETE RESTRICT | |
| 74 | + ) | |
| 75 | + WITH ( | |
| 76 | + OIDS=TRUE | |
| 77 | + ); | |
| 78 | + | |
| 79 | + -- Sequence: modules.ponto_transporte_escolar_seq | |
| 80 | + CREATE SEQUENCE modules.ponto_transporte_escolar_seq | |
| 81 | + INCREMENT 1 | |
| 82 | + MINVALUE 1 | |
| 83 | + MAXVALUE 9223372036854775807 | |
| 84 | + START 1 | |
| 85 | + CACHE 1; | |
| 86 | + ALTER TABLE modules.ponto_transporte_escolar_seq | |
| 87 | + OWNER TO ieducar; | |
| 88 | + | |
| 89 | + | |
| 90 | + -- Table: modules.ponto_transporte_escolar | |
| 91 | + CREATE TABLE modules.ponto_transporte_escolar | |
| 92 | + ( | |
| 93 | + cod_ponto_transporte_escolar integer NOT NULL DEFAULT nextval('modules.ponto_transporte_escolar_seq'::regclass), | |
| 94 | + descricao varchar(70) not null, | |
| 95 | + CONSTRAINT ponto_transporte_escolar_cod_ponto_transporte_escolar_pkey PRIMARY KEY (cod_ponto_transporte_escolar ) | |
| 96 | + ) | |
| 97 | + WITH ( | |
| 98 | + OIDS=TRUE | |
| 99 | + ); | |
| 100 | + | |
| 101 | + | |
| 102 | + -- Sequence: modules.pessoa_transporte_seq | |
| 103 | + CREATE SEQUENCE modules.pessoa_transporte_seq | |
| 104 | + INCREMENT 1 | |
| 105 | + MINVALUE 1 | |
| 106 | + MAXVALUE 9223372036854775807 | |
| 107 | + START 1 | |
| 108 | + CACHE 1; | |
| 109 | + ALTER TABLE modules.pessoa_transporte_seq | |
| 110 | + OWNER TO ieducar; | |
| 111 | + | |
| 112 | + | |
| 113 | + -- Table: modules.pessoa_transporte | |
| 114 | + CREATE TABLE modules.pessoa_transporte | |
| 115 | + ( | |
| 116 | + cod_pessoa_transporte integer NOT NULL DEFAULT nextval('modules.pessoa_transporte_seq'::regclass), | |
| 117 | + ref_idpes integer not null, | |
| 118 | + ref_cod_rota_transporte_escolar integer not null, | |
| 119 | + ref_cod_ponto_transporte_escolar integer, | |
| 120 | + ref_idpes_destino integer, | |
| 121 | + observacao varchar(255), | |
| 122 | + CONSTRAINT pessoa_transporte_cod_pessoa_transporte_pkey PRIMARY KEY (cod_pessoa_transporte ), | |
| 123 | + CONSTRAINT pessoa_transporte_ref_cod_rota_transporte_escolar_fkey FOREIGN KEY (ref_cod_rota_transporte_escolar) | |
| 124 | + REFERENCES modules.rota_transporte_escolar (cod_rota_transporte_escolar) MATCH SIMPLE, | |
| 125 | + CONSTRAINT pessoa_transporte_ref_cod_ponto_transporte_escolar_fkey FOREIGN KEY (ref_cod_ponto_transporte_escolar) | |
| 126 | + REFERENCES modules.ponto_transporte_escolar (cod_ponto_transporte_escolar) MATCH SIMPLE, | |
| 127 | + CONSTRAINT pessoa_transporte_ref_idpes_destino_fkey FOREIGN KEY (ref_idpes_destino) | |
| 128 | + REFERENCES cadastro.juridica (idpes) MATCH SIMPLE, | |
| 129 | + CONSTRAINT pessoa_transporte_ref_idpes_fkey FOREIGN KEY (ref_idpes) | |
| 130 | + REFERENCES cadastro.fisica (idpes) MATCH SIMPLE | |
| 131 | + ON UPDATE RESTRICT ON DELETE RESTRICT | |
| 132 | + ) | |
| 133 | + WITH ( | |
| 134 | + OIDS=TRUE | |
| 135 | + ); | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + -- //@UNDO | |
| 140 | + | |
| 141 | + DROP TABLE modules.pessoa_transporte; | |
| 142 | + DROP SEQUENCE modules.pessoa_transporte_seq; | |
| 143 | + DROP TABLE modules.ponto_transporte_escolar; | |
| 144 | + DROP SEQUENCE modules.ponto_transporte_escolar_seq; | |
| 145 | + DROP TABLE modules.itinerario_transporte_escolar; | |
| 146 | + DROP SEQUENCE modules.itinerario_transporte_escolar_seq; | |
| 147 | + DROP SEQUENCE modules.rotas_transporte_escolar_seq; | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + -- // | |
| 152 | + | |
| 153 | + | |
| 154 | + | ... | ... |
ieducar/misc/database/deltas/portabilis/57_menus_sql_modulo_transporte_escolar.sql
0 → 100644
| ... | ... | @@ -0,0 +1,72 @@ |
| 1 | + -- // | |
| 2 | + | |
| 3 | + -- | |
| 4 | + -- Cria o menu lateral e o menu suspenso para o módulo transporte escolar | |
| 5 | + -- | |
| 6 | + -- @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 7 | + -- @author Ricardo Bortolotto <ricardo@portabilis.com.br> | |
| 8 | + -- @license @@license@@ | |
| 9 | + -- @version $Id$ | |
| 10 | + | |
| 11 | + INSERT INTO portal.menu_menu (cod_menu_menu, nm_menu) | |
| 12 | + VALUES (69,'Transporte Escolar'); | |
| 13 | + | |
| 14 | + INSERT INTO portal.menu_submenu (cod_menu_submenu, ref_cod_menu_menu, cod_sistema, nm_submenu, arquivo, nivel) | |
| 15 | + VALUES (21234, 69, 2, 'Apresentação', 'transporte_index.php', '2'); | |
| 16 | + | |
| 17 | + INSERT INTO pmicontrolesis.tutormenu (cod_tutormenu,nm_tutormenu) | |
| 18 | + VALUES (17,'Transporte Escolar'); | |
| 19 | + | |
| 20 | + INSERT INTO pmicontrolesis.menu (cod_menu,tt_menu,ord_menu,alvo,suprime_menu,ref_cod_tutormenu,ref_cod_ico) | |
| 21 | + VALUES(20710,'Cadastros',1,'_self',1,17,1); | |
| 22 | + | |
| 23 | + INSERT INTO pmicontrolesis.menu (cod_menu,tt_menu,ord_menu,alvo,suprime_menu,ref_cod_tutormenu,ref_cod_ico) | |
| 24 | + VALUES(20711,'Movimentação',2,'_self',1,17,1); | |
| 25 | + | |
| 26 | + INSERT INTO pmicontrolesis.menu (cod_menu,tt_menu,ord_menu,alvo,suprime_menu,ref_cod_tutormenu,ref_cod_ico) | |
| 27 | + VALUES(20712,'Relatórios',3,'_self',1,17,1); | |
| 28 | + | |
| 29 | + INSERT INTO portal.menu_submenu | |
| 30 | + VALUES (21235, 69, 2, 'Empresas', 'transporte_empresa_lst.php',null,3); | |
| 31 | + | |
| 32 | + INSERT INTO portal.menu_submenu | |
| 33 | + VALUES (21236, 69, 2, 'Motoristas', 'transporte_motorista_lst.php',null,3); | |
| 34 | + | |
| 35 | + INSERT INTO portal.menu_submenu | |
| 36 | + VALUES (21237, 69, 2, 'Veículos', 'transporte_veiculo_lst.php',null,3); | |
| 37 | + | |
| 38 | + INSERT INTO portal.menu_submenu | |
| 39 | + VALUES (21238, 69, 2, 'Rotas', 'transporte_rota_lst.php',null,3); | |
| 40 | + | |
| 41 | + INSERT INTO portal.menu_submenu | |
| 42 | + VALUES (21239, 69, 2, 'Pontos', 'transporte_ponto_lst.php',null,3); | |
| 43 | + | |
| 44 | + INSERT INTO pmicontrolesis.menu | |
| 45 | + VALUES(21235,21235,20710,'Empresas',1,'transporte_empresa_lst.php','_self',1,17,192); | |
| 46 | + | |
| 47 | + INSERT INTO pmicontrolesis.menu | |
| 48 | + VALUES(21236,21236,20710,'Motoristas',2,'transporte_motorista_lst.php','_self',1,17,192); | |
| 49 | + | |
| 50 | + INSERT INTO pmicontrolesis.menu | |
| 51 | + VALUES(21237,21237,20710,'Veículos',3,'transporte_veiculo_lst.php','_self',1,17,192); | |
| 52 | + | |
| 53 | + INSERT INTO pmicontrolesis.menu | |
| 54 | + VALUES(21238,21238,20710,'Pontos',4,'transporte_ponto_lst.php','_self',1,17,192); | |
| 55 | + | |
| 56 | + INSERT INTO pmicontrolesis.menu | |
| 57 | + VALUES(21239,21239,20710,'Rotas',5,'transporte_rota_lst.php','_self',1,17,192); | |
| 58 | + | |
| 59 | + -- //@UNDO | |
| 60 | + | |
| 61 | + DELETE FROM pmicontrolesis.menu where cod_menu in (21235,21236,21237,21238,21239); | |
| 62 | + DELETE FROM portal.menu_submenu where cod_menu_submenu in (21234,21235,21236,21237,21238,21239); | |
| 63 | + DELETE FROM pmicontrolesis.menu where cod_menu in (20710,20711,20712); | |
| 64 | + DELETE FROM pmicontrolesis.tutormenu where cod_tutormenu in (17); | |
| 65 | + DELETE FROM menu_submenu where ref_cod_menu_menu = 69; | |
| 66 | + DELETE FROM menu_menu where cod_menu_menu = 69; | |
| 67 | + | |
| 68 | + | |
| 69 | + -- // | |
| 70 | + | |
| 71 | + | |
| 72 | + | ... | ... |
| ... | ... | @@ -0,0 +1,261 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * i-Educar - Sistema de gestão escolar | |
| 8 | + * | |
| 9 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 10 | + * <ctima@itajai.sc.gov.br> | |
| 11 | + * | |
| 12 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 13 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 14 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 15 | + * qualquer versão posterior. | |
| 16 | + * | |
| 17 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 18 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 19 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 20 | + * do GNU para mais detalhes. | |
| 21 | + * | |
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 23 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 24 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 25 | + * | |
| 26 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 27 | + * @category i-Educar | |
| 28 | + * @license @@license@@ | |
| 29 | + * @package Api | |
| 30 | + * @subpackage Modules | |
| 31 | + * @since Arquivo disponível desde a versão ? | |
| 32 | + * @version $Id$ | |
| 33 | + */ | |
| 34 | + | |
| 35 | +require_once 'include/modules/clsModulesEmpresaTransporteEscolar.inc.php'; | |
| 36 | +require_once 'include/modules/clsModulesRotaTransporteEscolar.inc.php'; | |
| 37 | +require_once 'include/modules/clsModulesMotorista.inc.php'; | |
| 38 | + | |
| 39 | +require_once 'Portabilis/Controller/ApiCoreController.php'; | |
| 40 | +require_once 'Portabilis/Array/Utils.php'; | |
| 41 | +require_once 'Portabilis/String/Utils.php'; | |
| 42 | +require_once 'Portabilis/Array/Utils.php'; | |
| 43 | +require_once 'Portabilis/Date/Utils.php'; | |
| 44 | + | |
| 45 | +class EmpresaController extends ApiCoreController | |
| 46 | +{ | |
| 47 | + protected $_processoAp = 578; //verificar | |
| 48 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; // verificar | |
| 49 | + | |
| 50 | + // validation | |
| 51 | + | |
| 52 | + protected function validatePessoaJuridica($id){ | |
| 53 | + | |
| 54 | + | |
| 55 | + } | |
| 56 | + | |
| 57 | + // load resources | |
| 58 | + | |
| 59 | + protected function loadNomePessoa($id) { | |
| 60 | + $sql = "select nome from cadastro.pessoa, modules.empresa_transporte_escolar where idpes = ref_idpes and cod_empresa_transporte_escolar = $1"; | |
| 61 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 62 | + | |
| 63 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function loadNomePessoaj($id) { | |
| 67 | + $sql = "select nome from cadastro.pessoa, modules.empresa_transporte_escolar emp where idpes = emp.ref_idpes and cod_empresa_transporte_escolar = $1"; | |
| 68 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 69 | + | |
| 70 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + protected function createOrUpdateEmpresa($id = null){ | |
| 76 | + | |
| 77 | + | |
| 78 | + $empresa = new clsModulesEmpresaTransporteEscolar(); | |
| 79 | + $empresa->cod_empresa_transporte_escolar = $id; | |
| 80 | + | |
| 81 | + | |
| 82 | + $empresa->ref_resp_idpes = $this->getRequest()->pessoa_id; | |
| 83 | + $empresa->ref_idpes = $this->getRequest()->pessoaj_id; | |
| 84 | + $empresa->observacao = Portabilis_String_Utils::toLatin1($this->getRequest()->observacao); | |
| 85 | + | |
| 86 | + return (is_null($id) ? $empresa->cadastra() : $empresa->edita()); | |
| 87 | + } | |
| 88 | + | |
| 89 | + | |
| 90 | + protected function get() { | |
| 91 | + if ($this->canGet()){ | |
| 92 | + $id = $this->getRequest()->id; | |
| 93 | + $empresa = new clsModulesEmpresaTransporteEscolar(); | |
| 94 | + $empresa->cod_empresa_transporte_escolar = $id; | |
| 95 | + $empresa = $empresa->detalhe(); | |
| 96 | + | |
| 97 | + $attrs = array( | |
| 98 | + 'cod_empresa_transporte_escolar' => 'id', | |
| 99 | + 'ref_idpes' => 'pessoaj', | |
| 100 | + 'observacao' => 'observacao', | |
| 101 | + 'ref_resp_idpes' => 'pessoa' | |
| 102 | + ); | |
| 103 | + | |
| 104 | + $empresa = Portabilis_Array_Utils::filter($empresa, $attrs); | |
| 105 | + | |
| 106 | + $empresa['nome'] = $this->loadNomePessoa($id); | |
| 107 | + $empresa['pessoajnome'] = $this->loadNomePessoaj($id); | |
| 108 | + $empresa['observacao'] = Portabilis_String_Utils::toUtf8($empresa['observacao']); | |
| 109 | + return $empresa; | |
| 110 | + } | |
| 111 | + | |
| 112 | + } | |
| 113 | + | |
| 114 | + protected function validateIfEmpresaIsNotInUse(){ | |
| 115 | + | |
| 116 | + $id = $this->getRequest()->id; | |
| 117 | + | |
| 118 | + $pt = new clsModulesRotaTransporteEscolar(); | |
| 119 | + $lista = $pt->lista(null,null,null,null,null,$id ); | |
| 120 | + if(is_array($lista) && count($lista)>0){ | |
| 121 | + $this->messenger->append('Não é possível excluir uma empresa que está vinculada a uma rota.', | |
| 122 | + 'error', false, 'error'); | |
| 123 | + return false; | |
| 124 | + }else{ | |
| 125 | + $motorista = new clsModulesMotorista(); | |
| 126 | + $lst = $motorista->lista(null,null,null,null,$id ); | |
| 127 | + | |
| 128 | + if(is_array($lst) && count($lst)>0){ | |
| 129 | + $this->messenger->append('Não é possível excluir uma empresa que está vinculada a um motorista.', | |
| 130 | + 'error', false, 'error'); | |
| 131 | + return false; | |
| 132 | + }else | |
| 133 | + return true; | |
| 134 | + } | |
| 135 | + } | |
| 136 | + | |
| 137 | + protected function sqlsForNumericSearch() { | |
| 138 | + | |
| 139 | + $sqls[] = "select distinct cod_empresa_transporte_escolar as id, nome as name from | |
| 140 | + modules.empresa_transporte_escolar, cadastro.pessoa where idpes = ref_idpes | |
| 141 | + and cod_empresa_transporte_escolar like $1||'%'"; | |
| 142 | + | |
| 143 | + return $sqls; | |
| 144 | + } | |
| 145 | + | |
| 146 | + | |
| 147 | + protected function sqlsForStringSearch() { | |
| 148 | + | |
| 149 | + $sqls[] = "select distinct cod_empresa_transporte_escolar as id, nome as name from | |
| 150 | + modules.empresa_transporte_escolar, cadastro.pessoa where idpes = ref_idpes | |
| 151 | + and lower(to_ascii(nome)) like '%'||lower(to_ascii($1))||'%'"; | |
| 152 | + | |
| 153 | + return $sqls; | |
| 154 | + } | |
| 155 | + | |
| 156 | + protected function canGet(){ | |
| 157 | + | |
| 158 | + $id = $this->getRequest()->id; | |
| 159 | + $empresa = new clsModulesEmpresaTransporteEscolar(); | |
| 160 | + $empresa->cod_empresa_transporte_escolar = $id; | |
| 161 | + if ($empresa->existe()) | |
| 162 | + return true; | |
| 163 | + else | |
| 164 | + return false; | |
| 165 | + } | |
| 166 | + | |
| 167 | + protected function validateSizeOfObservacao(){ | |
| 168 | + | |
| 169 | + if (strlen($this->getRequest()->observacao)<=255) | |
| 170 | + return true; | |
| 171 | + else{ | |
| 172 | + $this->messenger->append('O campo Observações não pode ter mais que 255 caracteres.'); | |
| 173 | + return false; | |
| 174 | + } | |
| 175 | + | |
| 176 | + | |
| 177 | + } | |
| 178 | + | |
| 179 | + protected function post() { | |
| 180 | + | |
| 181 | + | |
| 182 | + if ($this->validateSizeOfObservacao()){ | |
| 183 | + | |
| 184 | + $id = $this->createOrUpdateEmpresa(); | |
| 185 | + | |
| 186 | + if (is_numeric($id)) { | |
| 187 | + | |
| 188 | + $this->messenger->append('Cadastro realizado com sucesso', 'success', false, 'error'); | |
| 189 | + } | |
| 190 | + else | |
| 191 | + $this->messenger->append('Aparentemente a empresa não pode ser cadastrada, por favor, verifique.'); | |
| 192 | + } | |
| 193 | + | |
| 194 | + | |
| 195 | + return array('id' => $id); | |
| 196 | + } | |
| 197 | + | |
| 198 | + protected function put() { | |
| 199 | + | |
| 200 | + if ($this->validateSizeOfObservacao()){ | |
| 201 | + $id = $this->getRequest()->id; | |
| 202 | + $editou = $this->createOrUpdateEmpresa($id); | |
| 203 | + | |
| 204 | + if ($editou) { | |
| 205 | + | |
| 206 | + $this->messenger->append('Alteração realizada com sucesso', 'success', false, 'error'); | |
| 207 | + } | |
| 208 | + else | |
| 209 | + $this->messenger->append('Aparentemente a empresa não pode ser alterado, por favor, verifique.'); | |
| 210 | + } | |
| 211 | + | |
| 212 | + | |
| 213 | + return array('id' => $id); | |
| 214 | + } | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + protected function delete() { | |
| 219 | + $id = $this->getRequest()->id; | |
| 220 | + | |
| 221 | + | |
| 222 | + $empresa = new clsModulesEmpresaTransporteEscolar(); | |
| 223 | + $empresa->cod_empresa_transporte_escolar = $id; | |
| 224 | + | |
| 225 | + | |
| 226 | + if($empresa->excluir()){ | |
| 227 | + $this->messenger->append('Cadastro removido com sucesso', 'success', false, 'error'); | |
| 228 | + }else | |
| 229 | + $this->messenger->append('Aparentemente o cadastro não pode ser removido, por favor, verifique.', | |
| 230 | + 'error', false, 'error'); | |
| 231 | + | |
| 232 | + return array('id' => $id); | |
| 233 | + } | |
| 234 | + | |
| 235 | + | |
| 236 | + public function Gerar() { | |
| 237 | + if ($this->isRequestFor('get', 'empresa')) | |
| 238 | + $this->appendResponse($this->get()); | |
| 239 | + elseif($this->isRequestFor('get', 'empresa-search')) | |
| 240 | + $this->appendResponse($this->search()); | |
| 241 | + // create | |
| 242 | + elseif ($this->isRequestFor('post', 'empresa')) | |
| 243 | + $this->appendResponse($this->post()); | |
| 244 | + | |
| 245 | + // update | |
| 246 | + elseif ($this->isRequestFor('put', 'empresa')) | |
| 247 | + $this->appendResponse($this->put()); | |
| 248 | + | |
| 249 | + elseif ($this->isRequestFor('delete', 'empresa')){ | |
| 250 | + if ($this->validateIfEmpresaIsNotInUse()){ | |
| 251 | + $this->appendResponse($this->delete()); | |
| 252 | + echo "<script language= \"JavaScript\"> | |
| 253 | + location.href=\"intranet/transporte_empresa_lst.php\"; | |
| 254 | + </script>"; | |
| 255 | + die(); | |
| 256 | + } | |
| 257 | + | |
| 258 | + }else | |
| 259 | + $this->notImplementedOperationError(); | |
| 260 | + } | |
| 261 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,245 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * i-Educar - Sistema de gestão escolar | |
| 8 | + * | |
| 9 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 10 | + * <ctima@itajai.sc.gov.br> | |
| 11 | + * | |
| 12 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 13 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 14 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 15 | + * qualquer versão posterior. | |
| 16 | + * | |
| 17 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 18 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 19 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 20 | + * do GNU para mais detalhes. | |
| 21 | + * | |
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 23 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 24 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 25 | + * | |
| 26 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 27 | + * @category i-Educar | |
| 28 | + * @license @@license@@ | |
| 29 | + * @package Api | |
| 30 | + * @subpackage Modules | |
| 31 | + * @since 07/2013 | |
| 32 | + * @version $Id$ | |
| 33 | + */ | |
| 34 | + | |
| 35 | +require_once 'include/modules/clsModulesMotorista.inc.php'; | |
| 36 | +require_once 'include/modules/clsModulesVeiculo.inc.php'; | |
| 37 | + | |
| 38 | +require_once 'Portabilis/Controller/ApiCoreController.php'; | |
| 39 | +require_once 'Portabilis/Array/Utils.php'; | |
| 40 | +require_once 'Portabilis/String/Utils.php'; | |
| 41 | +require_once 'Portabilis/Array/Utils.php'; | |
| 42 | +require_once 'Portabilis/Date/Utils.php'; | |
| 43 | + | |
| 44 | +class MotoristaController extends ApiCoreController | |
| 45 | +{ | |
| 46 | + protected $_processoAp = 578; //verificar | |
| 47 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; // verificar | |
| 48 | + | |
| 49 | + // load resources | |
| 50 | + | |
| 51 | + protected function loadNomePessoa($id) { | |
| 52 | + $sql = "select nome from cadastro.pessoa, modules.motorista where idpes = ref_idpes and cod_motorista = $1"; | |
| 53 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 54 | + | |
| 55 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 56 | + } | |
| 57 | + | |
| 58 | + protected function loadNomeEmpresa($id) { | |
| 59 | + $sql = "select nome from cadastro.pessoa, modules.motorista ,modules.empresa_transporte_escolar emp where idpes = emp.ref_idpes and cod_empresa_transporte_escolar = ref_cod_empresa_transporte_escolar and cod_motorista = $1"; | |
| 60 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 61 | + | |
| 62 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 63 | + } | |
| 64 | + | |
| 65 | + protected function sqlsForNumericSearch() { | |
| 66 | + | |
| 67 | + $sqls[] = "select distinct cod_motorista as id, nome as name from | |
| 68 | + modules.motorista, cadastro.pessoa where idpes = ref_idpes | |
| 69 | + and cod_motorista like $1||'%'"; | |
| 70 | + | |
| 71 | + return $sqls; | |
| 72 | + } | |
| 73 | + | |
| 74 | + | |
| 75 | + protected function sqlsForStringSearch() { | |
| 76 | + | |
| 77 | + $sqls[] = "select distinct cod_motorista as id, nome as name from | |
| 78 | + modules.motorista, cadastro.pessoa where idpes = ref_idpes | |
| 79 | + and lower(to_ascii(nome)) like '%'||lower(to_ascii($1))||'%'"; | |
| 80 | + | |
| 81 | + return $sqls; | |
| 82 | + } | |
| 83 | + | |
| 84 | + | |
| 85 | + protected function createOrUpdateMotorista($id = null){ | |
| 86 | + | |
| 87 | + | |
| 88 | + $motorista = new clsModulesMotorista(); | |
| 89 | + $motorista->cod_motorista = $id; | |
| 90 | + // após cadastro não muda mais id pessoa | |
| 91 | + $motorista->ref_idpes = $this->getRequest()->pessoa_id; | |
| 92 | + $motorista->cnh = $this->getRequest()->cnh; | |
| 93 | + $motorista->tipo_cnh = Portabilis_String_Utils::toLatin1($this->getRequest()->tipo_cnh); | |
| 94 | + $motorista->dt_habilitacao = Portabilis_Date_Utils::brToPgSQL($this->getRequest()->dt_habilitacao); | |
| 95 | + $motorista->vencimento_cnh = Portabilis_Date_Utils::brToPgSQL($this->getRequest()->vencimento_cnh); | |
| 96 | + $motorista->ref_cod_empresa_transporte_escolar = $this->getRequest()->empresa_id; | |
| 97 | + $motorista->observacao = Portabilis_String_Utils::toLatin1($this->getRequest()->observacao); | |
| 98 | + | |
| 99 | + | |
| 100 | + return (is_null($id) ? $motorista->cadastra() : $motorista->edita()); | |
| 101 | + } | |
| 102 | + | |
| 103 | + protected function get() { | |
| 104 | + | |
| 105 | + $id = $this->getRequest()->id; | |
| 106 | + $motorista = new clsModulesMotorista(); | |
| 107 | + $motorista->cod_motorista = $id; | |
| 108 | + $motorista = $motorista->detalhe(); | |
| 109 | + | |
| 110 | + $attrs = array( | |
| 111 | + 'cod_motorista' => 'id', | |
| 112 | + 'ref_idpes' => 'pessoa', | |
| 113 | + 'tipo_cnh' => 'tipo_cnh', | |
| 114 | + 'ref_cod_empresa_transporte_escolar' => 'ref_cod_empresa_transporte_escolar', | |
| 115 | + 'cnh' => 'cnh', | |
| 116 | + 'observacao' => 'observacao', | |
| 117 | + 'dt_habilitacao' => 'dt_habilitacao', | |
| 118 | + 'vencimento_cnh' => 'vencimento_cnh' | |
| 119 | + ); | |
| 120 | + | |
| 121 | + $motorista = Portabilis_Array_Utils::filter($motorista, $attrs); | |
| 122 | + | |
| 123 | + $motorista['nome'] = Portabilis_String_Utils::toUtf8($this->loadNomePessoa($id)); | |
| 124 | + $motorista['empresa'] = Portabilis_String_Utils::toUtf8($this->loadNomeEmpresa($id)); | |
| 125 | + $motorista['dt_habilitacao'] = Portabilis_Date_Utils::pgSQLToBr($motorista['dt_habilitacao']); | |
| 126 | + $motorista['vencimento_cnh'] = Portabilis_Date_Utils::pgSQLToBr($motorista['vencimento_cnh']); | |
| 127 | + $motorista['cnh'] = Portabilis_String_Utils::toUtf8($motorista['cnh']); | |
| 128 | + $motorista['observacao'] = Portabilis_String_Utils::toUtf8($motorista['observacao']); | |
| 129 | + return $motorista; | |
| 130 | + | |
| 131 | + } | |
| 132 | + | |
| 133 | + protected function validateSizeOfObservacao(){ | |
| 134 | + if (strlen($this->getRequest()->observacao)<=255) | |
| 135 | + return true; | |
| 136 | + else{ | |
| 137 | + $this->messenger->append('O campo Observações não pode ter mais que 255 caracteres.'); | |
| 138 | + return false; | |
| 139 | + } | |
| 140 | + | |
| 141 | + } | |
| 142 | + | |
| 143 | + protected function validateIfMotoristaIsNotInUse(){ | |
| 144 | + | |
| 145 | + $v = new clsModulesVeiculo(); | |
| 146 | + $lista = $v->lista(null,null,null,null,null,null,null,null,$this->getRequest()->id); | |
| 147 | + if(is_array($lista) && count($lista)>0){ | |
| 148 | + $this->messenger->append('Não é possível excluir uma motorista responsável por um veículo.', | |
| 149 | + 'error', false, 'error'); | |
| 150 | + return false; | |
| 151 | + }else{ | |
| 152 | + return true; | |
| 153 | + } | |
| 154 | + } | |
| 155 | + | |
| 156 | + protected function canGet(){ | |
| 157 | +/* | |
| 158 | + $id = $this->getRequest()->id; | |
| 159 | + $empresa = new clsModulesEmpresaTransporteEscolar(); | |
| 160 | + $empresa->cod_empresa_transporte_escolar = $id; | |
| 161 | + if ($empresa->existe()) | |
| 162 | + return true; | |
| 163 | + else | |
| 164 | + return false;*/ | |
| 165 | + } | |
| 166 | + | |
| 167 | + protected function post() { | |
| 168 | + | |
| 169 | + if ($this->validateSizeOfObservacao()){ | |
| 170 | + | |
| 171 | + $id = $this->createOrUpdateMotorista(); | |
| 172 | + | |
| 173 | + if (is_numeric($id)) { | |
| 174 | + | |
| 175 | + $this->messenger->append('Cadastro realizado com sucesso', 'success', false, 'error'); | |
| 176 | + } | |
| 177 | + else | |
| 178 | + $this->messenger->append('Aparentemente o motorista não pode ser cadastrado, por favor, verifique.'); | |
| 179 | + } | |
| 180 | + | |
| 181 | + | |
| 182 | + return array('id' => $id); | |
| 183 | + } | |
| 184 | + | |
| 185 | + protected function put() { | |
| 186 | + | |
| 187 | + if ($this->validateSizeOfObservacao()){ | |
| 188 | + $id = $this->getRequest()->id; | |
| 189 | + $editou = $this->createOrUpdateMotorista($id); | |
| 190 | + | |
| 191 | + if ($editou) { | |
| 192 | + $this->messenger->append('Alteração realizada com sucesso', 'success', false, 'error'); | |
| 193 | + } | |
| 194 | + else | |
| 195 | + $this->messenger->append('Aparentemente o aluno não pode ser alterado, por favor, verifique.'); | |
| 196 | + } | |
| 197 | + | |
| 198 | + return array('id' => $id); | |
| 199 | + } | |
| 200 | + | |
| 201 | + protected function delete() { | |
| 202 | + $id = $this->getRequest()->id; | |
| 203 | + | |
| 204 | + | |
| 205 | + $motorista = new clsModulesMotorista(); | |
| 206 | + $motorista->cod_motorista = $id; | |
| 207 | + | |
| 208 | + if($motorista->excluir()){ | |
| 209 | + $this->messenger->append('Cadastro removido com sucesso', 'success', false, 'error'); | |
| 210 | + }else | |
| 211 | + $this->messenger->append('Aparentemente o cadastro não pode ser removido, por favor, verifique.','error', false, 'error'); | |
| 212 | + | |
| 213 | + return array('id' => $id); | |
| 214 | + } | |
| 215 | + | |
| 216 | + | |
| 217 | + public function Gerar() { | |
| 218 | + | |
| 219 | + if ($this->isRequestFor('get', 'motorista')) | |
| 220 | + $this->appendResponse($this->get()); | |
| 221 | + | |
| 222 | + elseif ($this->isRequestFor('get', 'motorista-search')) | |
| 223 | + $this->appendResponse($this->search()); | |
| 224 | + | |
| 225 | + // create | |
| 226 | + elseif ($this->isRequestFor('post', 'motorista')) | |
| 227 | + $this->appendResponse($this->post()); | |
| 228 | + | |
| 229 | + // update | |
| 230 | + elseif ($this->isRequestFor('put', 'motorista')) | |
| 231 | + $this->appendResponse($this->put()); | |
| 232 | + | |
| 233 | + elseif ($this->isRequestFor('delete', 'motorista')){ | |
| 234 | + if ($this->validateIfMotoristaIsNotInUse()){ | |
| 235 | + $this->appendResponse($this->delete()); | |
| 236 | + echo "<script language= \"JavaScript\"> | |
| 237 | + location.href=\"intranet/transporte_motorista_lst.php\"; | |
| 238 | + </script>"; | |
| 239 | + die(); | |
| 240 | + } | |
| 241 | + | |
| 242 | + }else | |
| 243 | + $this->notImplementedOperationError(); | |
| 244 | + } | |
| 245 | +} | |
| 0 | 246 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,64 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * i-Educar - Sistema de gestão escolar | |
| 8 | + * | |
| 9 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 10 | + * <ctima@itajai.sc.gov.br> | |
| 11 | + * | |
| 12 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 13 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 14 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 15 | + * qualquer versão posterior. | |
| 16 | + * | |
| 17 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 18 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 19 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 20 | + * do GNU para mais detalhes. | |
| 21 | + * | |
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 23 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 24 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 25 | + * | |
| 26 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 27 | + * @category i-Educar | |
| 28 | + * @license @@license@@ | |
| 29 | + * @package Api | |
| 30 | + * @subpackage Modules | |
| 31 | + * @since 07/2013 | |
| 32 | + * @version $Id$ | |
| 33 | + */ | |
| 34 | + | |
| 35 | +require_once 'lib/Portabilis/Controller/ApiCoreController.php'; | |
| 36 | +require_once 'lib/Portabilis/Array/Utils.php'; | |
| 37 | +require_once 'lib/Portabilis/String/Utils.php'; | |
| 38 | + | |
| 39 | +class PessoajController extends ApiCoreController | |
| 40 | +{ | |
| 41 | + | |
| 42 | + protected function sqlsForNumericSearch() { | |
| 43 | + | |
| 44 | + $sqls[] = "select distinct idpes as id, nome as name from | |
| 45 | + cadastro.pessoa where tipo='J' and idpes like $1||'%'"; | |
| 46 | + | |
| 47 | + return $sqls; | |
| 48 | + } | |
| 49 | + | |
| 50 | + protected function sqlsForStringSearch() { | |
| 51 | + | |
| 52 | + $sqls[] = "select distinct idpes as id, nome as name from | |
| 53 | + cadastro.pessoa where tipo='J' and lower(to_ascii(nome)) like '%'||lower(to_ascii($1))||'%'"; | |
| 54 | + | |
| 55 | + return $sqls; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public function Gerar() { | |
| 59 | + if ($this->isRequestFor('get', 'pessoaj-search')) | |
| 60 | + $this->appendResponse($this->search()); | |
| 61 | + else | |
| 62 | + $this->notImplementedOperationError(); | |
| 63 | + } | |
| 64 | +} | ... | ... |
ieducar/modules/Api/Views/PessoatransporteController.php
0 → 100644
| ... | ... | @@ -0,0 +1,189 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * i-Educar - Sistema de gestão escolar | |
| 8 | + * | |
| 9 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 10 | + * <ctima@itajai.sc.gov.br> | |
| 11 | + * | |
| 12 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 13 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 14 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 15 | + * qualquer versão posterior. | |
| 16 | + * | |
| 17 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 18 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 19 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 20 | + * do GNU para mais detalhes. | |
| 21 | + * | |
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 23 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 24 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 25 | + * | |
| 26 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 27 | + * @category i-Educar | |
| 28 | + * @license @@license@@ | |
| 29 | + * @package Api | |
| 30 | + * @subpackage Modules | |
| 31 | + * @since Arquivo disponível desde a versão ? | |
| 32 | + * @version $Id$ | |
| 33 | + */ | |
| 34 | + | |
| 35 | +require_once 'include/modules/clsModulesPessoaTransporte.inc.php'; | |
| 36 | +require_once 'include/modules/clsModulesItinerarioTransporteEscolar.inc.php'; | |
| 37 | + | |
| 38 | +require_once 'Portabilis/Controller/ApiCoreController.php'; | |
| 39 | +require_once 'Portabilis/Array/Utils.php'; | |
| 40 | +require_once 'Portabilis/String/Utils.php'; | |
| 41 | +require_once 'Portabilis/Date/Utils.php'; | |
| 42 | + | |
| 43 | +class PessoatransporteController extends ApiCoreController | |
| 44 | +{ | |
| 45 | + protected $_processoAp = 21240; //verificar | |
| 46 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; // verificar | |
| 47 | + | |
| 48 | + protected function loadNomePessoaj($id) { | |
| 49 | + $sql = "select nome from cadastro.pessoa, modules.pessoa_transporte where idpes = ref_idpes_destino and cod_pessoa_transporte = $1"; | |
| 50 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 51 | + | |
| 52 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 53 | + } | |
| 54 | + | |
| 55 | + protected function loadNomePessoa($id) { | |
| 56 | + $sql = "select nome from cadastro.pessoa, modules.pessoa_transporte where idpes = ref_idpes and cod_pessoa_transporte = $1"; | |
| 57 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 58 | + | |
| 59 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 60 | + } | |
| 61 | + | |
| 62 | + protected function createOrUpdatePessoaTransporte($id = null){ | |
| 63 | + | |
| 64 | + $pt = new clsModulesPessoaTransporte(); | |
| 65 | + $pt->cod_pessoa_transporte = $id; | |
| 66 | + | |
| 67 | + // após cadastro não muda mais id pessoa | |
| 68 | + $pt->ref_idpes = $this->getRequest()->pessoa_id; | |
| 69 | + $pt->ref_idpes_destino = $this->getRequest()->pessoaj_id; | |
| 70 | + $pt->ref_cod_ponto_transporte_escolar = $this->getRequest()->ponto; | |
| 71 | + $pt->ref_cod_rota_transporte_escolar = $this->getRequest()->rota; | |
| 72 | + $pt->observacao = Portabilis_String_Utils::toLatin1($this->getRequest()->observacao); | |
| 73 | + | |
| 74 | + return (is_null($id) ? $pt->cadastra() : $pt->edita()); | |
| 75 | + } | |
| 76 | + | |
| 77 | + | |
| 78 | + protected function get() { | |
| 79 | + | |
| 80 | + $id = $this->getRequest()->id; | |
| 81 | + $pt = new clsModulesPessoaTransporte(); | |
| 82 | + $pt->cod_pessoa_transporte = $id; | |
| 83 | + $pt = $pt->detalhe(); | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + $attrs = array( | |
| 88 | + 'cod_pessoa_transporte' => 'id', | |
| 89 | + 'ref_cod_rota_transporte_escolar' => 'rota', | |
| 90 | + 'ref_cod_ponto_transporte_escolar' => 'ponto', | |
| 91 | + 'ref_idpes_destino' => 'pessoaj', | |
| 92 | + 'ref_idpes' => 'pessoa', | |
| 93 | + 'observacao' => 'observacao' | |
| 94 | + ); | |
| 95 | + | |
| 96 | + $pt = Portabilis_Array_Utils::filter($pt, $attrs); | |
| 97 | + $pt['pessoaj_nome'] = $this->loadNomePessoaj($id); | |
| 98 | + $pt['pessoa_nome'] = $this->loadNomePessoa($id); | |
| 99 | + | |
| 100 | + return $pt; | |
| 101 | + } | |
| 102 | + | |
| 103 | + protected function validateSizeOfObservacao(){ | |
| 104 | + | |
| 105 | + if (strlen($this->getRequest()->observacao)<=255) | |
| 106 | + return true; | |
| 107 | + else{ | |
| 108 | + $this->messenger->append('O campo Observações não pode ter mais que 255 caracteres.'); | |
| 109 | + return false; | |
| 110 | + } | |
| 111 | + | |
| 112 | + } | |
| 113 | + | |
| 114 | + protected function post() { | |
| 115 | + | |
| 116 | + if ($this->validateSizeOfObservacao()){ | |
| 117 | + $id = $this->createOrUpdatePessoaTransporte(); | |
| 118 | + if (is_numeric($id)) { | |
| 119 | + $this->messenger->append('Cadastro realizado com sucesso', 'success', false, 'error'); | |
| 120 | + } | |
| 121 | + else | |
| 122 | + $this->messenger->append('Aparentemente o vinculo não pode ser cadastrada, por favor, verifique.'); | |
| 123 | + } | |
| 124 | + | |
| 125 | + return array('id' => $id); | |
| 126 | + } | |
| 127 | + | |
| 128 | + protected function put() { | |
| 129 | + | |
| 130 | + if ($this->validateSizeOfObservacao()){ | |
| 131 | + | |
| 132 | + $id = $this->getRequest()->id; | |
| 133 | + $editou = $this->createOrUpdatePessoaTransporte($id); | |
| 134 | + | |
| 135 | + if ($editou) { | |
| 136 | + | |
| 137 | + $this->messenger->append('Alteração realizada com sucesso', 'success', false, 'error'); | |
| 138 | + } | |
| 139 | + else | |
| 140 | + $this->messenger->append('Aparentemente o vinculo não pode ser alterado, por favor, verifique.'); | |
| 141 | + | |
| 142 | + } | |
| 143 | + | |
| 144 | + return array('id' => $id); | |
| 145 | + } | |
| 146 | + | |
| 147 | + protected function delete() { | |
| 148 | + $id = $this->getRequest()->id; | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + $pt = new clsModulesPessoaTransporte(); | |
| 153 | + $pt->cod_pessoa_transporte = $id; | |
| 154 | + | |
| 155 | + if($pt->excluir()){ | |
| 156 | + | |
| 157 | + $this->messenger->append('Cadastro removido com sucesso', 'success', false, 'error'); | |
| 158 | + }else | |
| 159 | + $this->messenger->append('Aparentemente o cadastro não pode ser removido, por favor, verifique.', | |
| 160 | + 'error', false, 'error'); | |
| 161 | + | |
| 162 | + | |
| 163 | + return array('id' => $id); | |
| 164 | + } | |
| 165 | + | |
| 166 | + | |
| 167 | + public function Gerar() { | |
| 168 | + | |
| 169 | + if ($this->isRequestFor('get', 'pessoatransporte')) | |
| 170 | + $this->appendResponse($this->get()); | |
| 171 | + | |
| 172 | + // create | |
| 173 | + elseif ($this->isRequestFor('post', 'pessoatransporte')) | |
| 174 | + $this->appendResponse($this->post()); | |
| 175 | + | |
| 176 | + // update | |
| 177 | + elseif ($this->isRequestFor('put', 'pessoatransporte')) | |
| 178 | + $this->appendResponse($this->put()); | |
| 179 | + | |
| 180 | + elseif ($this->isRequestFor('delete', 'pessoatransporte')){ | |
| 181 | + $this->appendResponse($this->delete()); | |
| 182 | + echo "<script language= \"JavaScript\"> | |
| 183 | + location.href=\"intranet/transporte_pessoa_lst.php\"; | |
| 184 | + </script>"; | |
| 185 | + die(); | |
| 186 | + }else | |
| 187 | + $this->notImplementedOperationError(); | |
| 188 | + } | |
| 189 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,189 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * i-Educar - Sistema de gestão escolar | |
| 8 | + * | |
| 9 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 10 | + * <ctima@itajai.sc.gov.br> | |
| 11 | + * | |
| 12 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 13 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 14 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 15 | + * qualquer versão posterior. | |
| 16 | + * | |
| 17 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 18 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 19 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 20 | + * do GNU para mais detalhes. | |
| 21 | + * | |
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 23 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 24 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 25 | + * | |
| 26 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 27 | + * @category i-Educar | |
| 28 | + * @license @@license@@ | |
| 29 | + * @package Api | |
| 30 | + * @subpackage Modules | |
| 31 | + * @since Arquivo disponível desde a versão ? | |
| 32 | + * @version $Id$ | |
| 33 | + */ | |
| 34 | + | |
| 35 | +require_once 'include/modules/clsModulesPessoaTransporte.inc.php'; | |
| 36 | +require_once 'include/modules/clsModulesItinerarioTransporteEscolar.inc.php'; | |
| 37 | +require_once 'include/modules/clsModulesPontoTransporteEscolar.inc.php'; | |
| 38 | + | |
| 39 | +require_once 'Portabilis/Controller/ApiCoreController.php'; | |
| 40 | +require_once 'Portabilis/Array/Utils.php'; | |
| 41 | +require_once 'Portabilis/String/Utils.php'; | |
| 42 | +require_once 'Portabilis/Date/Utils.php'; | |
| 43 | + | |
| 44 | +class PontoController extends ApiCoreController | |
| 45 | +{ | |
| 46 | + protected $_processoAp = 578; //verificar | |
| 47 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; // verificar | |
| 48 | + | |
| 49 | + protected function createOrUpdatePonto($id = null){ | |
| 50 | + | |
| 51 | + $ponto = new clsModulesPontoTransporteEscolar(); | |
| 52 | + $ponto->cod_ponto_transporte_escolar = $id; | |
| 53 | + | |
| 54 | + // após cadastro não muda mais id pessoa | |
| 55 | + $ponto->descricao = Portabilis_String_Utils::toLatin1($this->getRequest()->desc); | |
| 56 | + | |
| 57 | + return (is_null($id) ? $ponto->cadastra() : $ponto->edita()); | |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + protected function get() { | |
| 62 | + | |
| 63 | + $id = $this->getRequest()->id; | |
| 64 | + $ponto = new clsModulesPontoTransporteEscolar(); | |
| 65 | + $ponto->cod_ponto_transporte_escolar = $id; | |
| 66 | + $ponto = $ponto->detalhe(); | |
| 67 | + | |
| 68 | + $attrs = array( | |
| 69 | + 'cod_ponto_transporte_escolar' => 'id', | |
| 70 | + ); | |
| 71 | + | |
| 72 | + $pt = Portabilis_Array_Utils::filter($ponto, $attrs); | |
| 73 | + $pt['desc'] = Portabilis_String_Utils::toUtf8($ponto['descricao']); | |
| 74 | + | |
| 75 | + return $pt; | |
| 76 | + } | |
| 77 | + | |
| 78 | + protected function validateIfPontoIsNotInUse(){ | |
| 79 | + $itinerario = new clsModulesItinerarioTransporteEscolar(); | |
| 80 | + $lista = $itinerario->lista(NULL,NULL,NULL,NULL,NULL,$this->getRequest()->id); | |
| 81 | + if(is_array($lista) && count($lista)>0){ | |
| 82 | + $this->messenger->append('Não é possível excluir um ponto que está vinculado a um itinerário.', | |
| 83 | + 'error', false, 'error'); | |
| 84 | + return false; | |
| 85 | + }else{ | |
| 86 | + return true; | |
| 87 | + } | |
| 88 | + } | |
| 89 | + | |
| 90 | + | |
| 91 | + protected function post() { | |
| 92 | + | |
| 93 | + $id = $this->createOrUpdatePonto(); | |
| 94 | + if (is_numeric($id)) { | |
| 95 | + $this->messenger->append('Cadastro realizado com sucesso', 'success', false, 'error'); | |
| 96 | + } | |
| 97 | + else | |
| 98 | + $this->messenger->append('Aparentemente o ponto não pode ser cadastrada, por favor, verifique.'); | |
| 99 | + | |
| 100 | + return array('id' => $id); | |
| 101 | + } | |
| 102 | + | |
| 103 | + protected function sqlsForNumericSearch() { | |
| 104 | + | |
| 105 | + $sqls[] = "select distinct cod_ponto_transporte_escolar as id, descricao as name from | |
| 106 | + modules.ponto_transporte_escolar where cod_ponto_transporte_escolar like $1||'%'"; | |
| 107 | + | |
| 108 | + return $sqls; | |
| 109 | + } | |
| 110 | + | |
| 111 | + | |
| 112 | + protected function sqlsForStringSearch() { | |
| 113 | + | |
| 114 | + $sqls[] = "select distinct cod_ponto_transporte_escolar as id, descricao as name from | |
| 115 | + modules.ponto_transporte_escolar where lower(to_ascii(descricao)) like '%'||lower(to_ascii($1))||'%'"; | |
| 116 | + | |
| 117 | + return $sqls; | |
| 118 | + } | |
| 119 | + | |
| 120 | + protected function put() { | |
| 121 | + $id = $this->getRequest()->id; | |
| 122 | + $editou = $this->createOrUpdatePonto($id); | |
| 123 | + | |
| 124 | + if ($editou) { | |
| 125 | + | |
| 126 | + $this->messenger->append('Alteração realizada com sucesso', 'success', false, 'error'); | |
| 127 | + } | |
| 128 | + else | |
| 129 | + $this->messenger->append('Aparentemente o ponto não pode ser alterado, por favor, verifique.'); | |
| 130 | + | |
| 131 | + | |
| 132 | + return array('id' => $id); | |
| 133 | + } | |
| 134 | + | |
| 135 | + protected function delete() { | |
| 136 | + $id = $this->getRequest()->id; | |
| 137 | + | |
| 138 | + $pessoas = new clsModulesPessoaTransporte(); | |
| 139 | + $lista = $pessoas->lista(NULL,NULL,NULL,$id); | |
| 140 | + | |
| 141 | + foreach($lista as $registro){ | |
| 142 | + $editaPessoa = new clsModulesPessoaTransporte($registro['cod_pessoa_transporte'], | |
| 143 | + $registro['ref_cod_rota_transporte_escolar'],$registro['ref_idpes'], | |
| 144 | + null,$registro['ref_idpes_destino'],$registro['observacao']); | |
| 145 | + $editaPessoa->edita(); | |
| 146 | + } | |
| 147 | + | |
| 148 | + $ponto = new clsModulesPontoTransporteEscolar(); | |
| 149 | + $ponto->cod_ponto_transporte_escolar = $id; | |
| 150 | + | |
| 151 | + if($ponto->excluir()){ | |
| 152 | + $this->messenger->append('Cadastro removido com sucesso', 'success', false, 'error'); | |
| 153 | + }else | |
| 154 | + $this->messenger->append('Aparentemente o cadastro não pode ser removido, por favor, verifique.', | |
| 155 | + 'error', false, 'error'); | |
| 156 | + | |
| 157 | + | |
| 158 | + return array('id' => $id); | |
| 159 | + } | |
| 160 | + | |
| 161 | + | |
| 162 | + public function Gerar() { | |
| 163 | + | |
| 164 | + if ($this->isRequestFor('get', 'ponto')) | |
| 165 | + $this->appendResponse($this->get()); | |
| 166 | + | |
| 167 | + elseif ($this->isRequestFor('get', 'ponto-search')) | |
| 168 | + $this->appendResponse($this->search()); | |
| 169 | + | |
| 170 | + // create | |
| 171 | + elseif ($this->isRequestFor('post', 'ponto')) | |
| 172 | + $this->appendResponse($this->post()); | |
| 173 | + | |
| 174 | + // update | |
| 175 | + elseif ($this->isRequestFor('put', 'ponto')) | |
| 176 | + $this->appendResponse($this->put()); | |
| 177 | + | |
| 178 | + elseif ($this->isRequestFor('delete', 'ponto')){ | |
| 179 | + if($this->validateIfPontoIsNotInUse()){ | |
| 180 | + $this->appendResponse($this->delete()); | |
| 181 | + echo "<script language= \"JavaScript\"> | |
| 182 | + location.href=\"intranet/transporte_ponto_lst.php\"; | |
| 183 | + </script>"; | |
| 184 | + die(); | |
| 185 | + } | |
| 186 | + }else | |
| 187 | + $this->notImplementedOperationError(); | |
| 188 | + } | |
| 189 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,222 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * i-Educar - Sistema de gestão escolar | |
| 8 | + * | |
| 9 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 10 | + * <ctima@itajai.sc.gov.br> | |
| 11 | + * | |
| 12 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 13 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 14 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 15 | + * qualquer versão posterior. | |
| 16 | + * | |
| 17 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 18 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 19 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 20 | + * do GNU para mais detalhes. | |
| 21 | + * | |
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 23 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 24 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 25 | + * | |
| 26 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 27 | + * @category i-Educar | |
| 28 | + * @license @@license@@ | |
| 29 | + * @package Api | |
| 30 | + * @subpackage Modules | |
| 31 | + * @since Arquivo disponível desde a versão ? | |
| 32 | + * @version $Id$ | |
| 33 | + */ | |
| 34 | +require_once 'include/modules/clsModulesPessoaTransporte.inc.php'; | |
| 35 | +require_once 'include/modules/clsModulesRotaTransporteEscolar.inc.php'; | |
| 36 | +require_once 'include/modules/clsModulesItinerarioTransporteEscolar.inc.php'; | |
| 37 | + | |
| 38 | +require_once 'Portabilis/Controller/ApiCoreController.php'; | |
| 39 | +require_once 'Portabilis/Array/Utils.php'; | |
| 40 | +require_once 'Portabilis/String/Utils.php'; | |
| 41 | +require_once 'Portabilis/Date/Utils.php'; | |
| 42 | + | |
| 43 | +class RotaController extends ApiCoreController | |
| 44 | +{ | |
| 45 | + protected $_processoAp = 21238; //verificar | |
| 46 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; // verificar | |
| 47 | + | |
| 48 | + protected function loadNomePessoaj($id) { | |
| 49 | + $sql = "select nome from cadastro.pessoa, modules.rota_transporte_escolar rt where idpes = rt.ref_idpes_destino and cod_rota_transporte_escolar = $1"; | |
| 50 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 51 | + | |
| 52 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 53 | + } | |
| 54 | + | |
| 55 | + protected function loadNomeEmpresa($id) { | |
| 56 | + $sql = "select nome from cadastro.pessoa, modules.empresa_transporte_escolar emp, modules.rota_transporte_escolar rt where idpes = emp.ref_idpes and emp.cod_empresa_transporte_escolar = rt.ref_cod_empresa_transporte_escolar and rt.cod_rota_transporte_escolar = $1"; | |
| 57 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 58 | + | |
| 59 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 60 | + } | |
| 61 | + | |
| 62 | + protected function validatesValueIsNumeric($value){ | |
| 63 | + return (is_numeric($value) || empty($value)); | |
| 64 | + } | |
| 65 | + | |
| 66 | + protected function createOrUpdateRota($id = null){ | |
| 67 | + | |
| 68 | + $rota = new clsModulesRotaTransporteEscolar(); | |
| 69 | + $rota->cod_rota_transporte_escolar = $id; | |
| 70 | + | |
| 71 | + // após cadastro não muda mais id pessoa | |
| 72 | + $rota->descricao = Portabilis_String_Utils::toLatin1($this->getRequest()->desc); | |
| 73 | + $rota->ref_idpes_destino = $this->getRequest()->pessoaj_id; | |
| 74 | + $rota->ano = $this->getRequest()->ano; | |
| 75 | + $rota->tipo_rota = $this->getRequest()->tipo_rota; | |
| 76 | + $rota->km_pav = $this->getRequest()->km_pav; | |
| 77 | + $rota->km_npav = $this->getRequest()->km_npav; | |
| 78 | + $rota->ref_cod_empresa_transporte_escolar = $this->getRequest()->empresa_id; | |
| 79 | + $rota->tercerizado = ($this->getRequest()->tercerizado == 'on' ? 'S' : 'N'); | |
| 80 | + | |
| 81 | + return (is_null($id) ? $rota->cadastra() : $rota->edita()); | |
| 82 | + } | |
| 83 | + | |
| 84 | + protected function sqlsForNumericSearch() { | |
| 85 | + | |
| 86 | + $sqls[] = "select distinct cod_rota_transporte_escolar as id, descricao as name from | |
| 87 | + modules.rota_transporte_escolar where cod_rota_transporte_escolar like $1||'%'"; | |
| 88 | + | |
| 89 | + return $sqls; | |
| 90 | + } | |
| 91 | + | |
| 92 | + | |
| 93 | + protected function sqlsForStringSearch() { | |
| 94 | + | |
| 95 | + $sqls[] = "select distinct cod_rota_transporte_escolar as id, descricao as name from | |
| 96 | + modules.rota_transporte_escolar where lower(to_ascii(descricao)) like '%'||lower(to_ascii($1))||'%'"; | |
| 97 | + | |
| 98 | + return $sqls; | |
| 99 | + } | |
| 100 | + | |
| 101 | + protected function get() { | |
| 102 | + | |
| 103 | + $id = $this->getRequest()->id; | |
| 104 | + $rota = new clsModulesRotaTransporteEscolar(); | |
| 105 | + $rota->cod_rota_transporte_escolar = $id; | |
| 106 | + $rota = $rota->detalhe(); | |
| 107 | + | |
| 108 | + $attrs = array( | |
| 109 | + 'cod_rota_transporte_escolar' => 'id', | |
| 110 | + 'descricao' => 'desc', | |
| 111 | + 'ref_idpes_destino' => 'ref_idpes_destino', | |
| 112 | + 'ano' => 'ano', | |
| 113 | + 'tipo_rota' => 'tipo_rota', | |
| 114 | + 'km_pav' => 'km_pav', | |
| 115 | + 'km_npav' => 'km_npav', | |
| 116 | + 'ref_cod_empresa_transporte_escolar' => 'ref_cod_empresa_transporte_escolar', | |
| 117 | + 'tercerizado' => 'tercerizado' | |
| 118 | + ); | |
| 119 | + | |
| 120 | + $rota = Portabilis_Array_Utils::filter($rota, $attrs); | |
| 121 | + | |
| 122 | + $rota['nomeEmpresa'] = Portabilis_String_Utils::toUtf8($this->loadNomeEmpresa($id)); | |
| 123 | + $rota['nomeDestino'] = Portabilis_String_Utils::toUtf8($this->loadNomePessoaj($id)); | |
| 124 | + $rota['desc'] = Portabilis_String_Utils::toUtf8($rota['desc']); | |
| 125 | + return $rota; | |
| 126 | + } | |
| 127 | + | |
| 128 | + protected function validateIfRotaIsNotInUse(){ | |
| 129 | + | |
| 130 | + $pt = new clsModulesPessoaTransporte(); | |
| 131 | + $lista = $pt->lista(null,null,$this->getRequest()->id); | |
| 132 | + if(is_array($lista) && count($lista)>0){ | |
| 133 | + $this->messenger->append('Não é possível excluir uma rota que está vinculada a uma pessoa.', | |
| 134 | + 'error', false, 'error'); | |
| 135 | + return false; | |
| 136 | + }else{ | |
| 137 | + return true; | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + protected function post() { | |
| 142 | + | |
| 143 | + if ($this->validatesValueIsNumeric($this->getRequest()->km_pav) && $this->validatesValueIsNumeric($this->getRequest()->km_npav)){ | |
| 144 | + | |
| 145 | + $id = $this->createOrUpdateRota(); | |
| 146 | + if (is_numeric($id)) { | |
| 147 | + | |
| 148 | + $this->messenger->append('Cadastro realizado com sucesso', 'success', false, 'error'); | |
| 149 | + } | |
| 150 | + else | |
| 151 | + $this->messenger->append('Aparentemente a rota não pode ser cadastrada, por favor, verifique.'); | |
| 152 | + | |
| 153 | + | |
| 154 | + return array('id' => $id); | |
| 155 | + }else{ | |
| 156 | + $this->messenger->append('Os dados para Km devem ser númericos (ex: 23.3 ou 55)'); | |
| 157 | + } | |
| 158 | + } | |
| 159 | + | |
| 160 | + protected function put() { | |
| 161 | + $id = $this->getRequest()->id; | |
| 162 | + $editou = $this->createOrUpdateRota($id); | |
| 163 | + | |
| 164 | + if ($editou) { | |
| 165 | + | |
| 166 | + $this->messenger->append('Alteração realizada com sucesso', 'success', false, 'error'); | |
| 167 | + } | |
| 168 | + else | |
| 169 | + $this->messenger->append('Aparentemente a rota não pode ser alterado, por favor, verifique.'); | |
| 170 | + | |
| 171 | + | |
| 172 | + return array('id' => $id); | |
| 173 | + } | |
| 174 | + | |
| 175 | + protected function delete() { | |
| 176 | + $id = $this->getRequest()->id; | |
| 177 | + | |
| 178 | + $itinerario = new clsModulesItinerarioTransporteEscolar(); | |
| 179 | + $itinerario->excluirTodos($id); | |
| 180 | + | |
| 181 | + $rota = new clsModulesRotaTransporteEscolar(); | |
| 182 | + $rota->cod_rota_transporte_escolar = $id; | |
| 183 | + | |
| 184 | + if($rota->excluir()){ | |
| 185 | + $this->messenger->append('Cadastro removido com sucesso', 'success', false, 'error'); | |
| 186 | + }else | |
| 187 | + $this->messenger->append('Aparentemente o cadastro não pode ser removido, por favor, verifique.', | |
| 188 | + 'error', false, 'error'); | |
| 189 | + | |
| 190 | + return array('id' => $id); | |
| 191 | + } | |
| 192 | + | |
| 193 | + | |
| 194 | + public function Gerar() { | |
| 195 | + | |
| 196 | + if ($this->isRequestFor('get', 'rota')) | |
| 197 | + $this->appendResponse($this->get()); | |
| 198 | + | |
| 199 | + elseif ($this->isRequestFor('get', 'rota-search')) | |
| 200 | + $this->appendResponse($this->search()); | |
| 201 | + | |
| 202 | + // create | |
| 203 | + elseif ($this->isRequestFor('post', 'rota')) | |
| 204 | + $this->appendResponse($this->post()); | |
| 205 | + | |
| 206 | + // update | |
| 207 | + elseif ($this->isRequestFor('put', 'rota')) | |
| 208 | + $this->appendResponse($this->put()); | |
| 209 | + | |
| 210 | + elseif ($this->isRequestFor('delete', 'rota')){ | |
| 211 | + if ($this->validateIfRotaIsNotInUse()){ | |
| 212 | + $this->appendResponse($this->delete()); | |
| 213 | + echo "<script language= \"JavaScript\"> | |
| 214 | + location.href=\"intranet/transporte_rota_lst.php\"; | |
| 215 | + </script>"; | |
| 216 | + die(); | |
| 217 | + } | |
| 218 | + | |
| 219 | + }else | |
| 220 | + $this->notImplementedOperationError(); | |
| 221 | + } | |
| 222 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,262 @@ |
| 1 | +<?php | |
| 2 | + | |
| 3 | +#error_reporting(E_ALL); | |
| 4 | +#ini_set("display_errors", 1); | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * i-Educar - Sistema de gestão escolar | |
| 8 | + * | |
| 9 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 10 | + * <ctima@itajai.sc.gov.br> | |
| 11 | + * | |
| 12 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 13 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 14 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 15 | + * qualquer versão posterior. | |
| 16 | + * | |
| 17 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 18 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 19 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 20 | + * do GNU para mais detalhes. | |
| 21 | + * | |
| 22 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 23 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 24 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 25 | + * | |
| 26 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 27 | + * @category i-Educar | |
| 28 | + * @license @@license@@ | |
| 29 | + * @package Api | |
| 30 | + * @subpackage Modules | |
| 31 | + * @since 07/2013 | |
| 32 | + * @version $Id$ | |
| 33 | + */ | |
| 34 | + | |
| 35 | +require_once 'include/modules/clsModulesItinerarioTransporteEscolar.inc.php'; | |
| 36 | +require_once 'include/modules/clsModulesVeiculo.inc.php'; | |
| 37 | + | |
| 38 | +require_once 'Portabilis/Controller/ApiCoreController.php'; | |
| 39 | +require_once 'Portabilis/Array/Utils.php'; | |
| 40 | +require_once 'Portabilis/String/Utils.php'; | |
| 41 | +require_once 'Portabilis/Array/Utils.php'; | |
| 42 | +require_once 'Portabilis/Date/Utils.php'; | |
| 43 | + | |
| 44 | +class VeiculoController extends ApiCoreController | |
| 45 | +{ | |
| 46 | + protected $_processoAp = 578; //verificar | |
| 47 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; // verificar | |
| 48 | + | |
| 49 | + protected function loadNomeEmpresa($id) { | |
| 50 | + $sql = "select nome from cadastro.pessoa, modules.empresa_transporte_escolar emp where idpes = emp.ref_idpes and emp.cod_empresa_transporte_escolar = $1"; | |
| 51 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 52 | + | |
| 53 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 54 | + } | |
| 55 | + | |
| 56 | + protected function loadNomeMotorista($id) { | |
| 57 | + $sql = "select nome from cadastro.pessoa, modules.motorista where idpes = ref_idpes and cod_motorista = $1"; | |
| 58 | + $nome = $this->fetchPreparedQuery($sql, $id, false, 'first-field'); | |
| 59 | + | |
| 60 | + return $this->toUtf8($nome, array('transform' => true)); | |
| 61 | + } | |
| 62 | + | |
| 63 | + protected function createOrUpdateVeiculo($id = null){ | |
| 64 | + | |
| 65 | + | |
| 66 | + $veiculo = new clsModulesVeiculo(); | |
| 67 | + $veiculo->cod_veiculo = $id; | |
| 68 | + // após cadastro não muda mais id pessoa | |
| 69 | + | |
| 70 | + $veiculo->descricao = Portabilis_String_Utils::toLatin1($this->getRequest()->descricao); | |
| 71 | + $veiculo->placa = Portabilis_String_Utils::toLatin1($this->getRequest()->placa); | |
| 72 | + $veiculo->renavam = $this->getRequest()->renavam; | |
| 73 | + $veiculo->chassi = $this->getRequest()->chassi; | |
| 74 | + $veiculo->marca = Portabilis_String_Utils::toLatin1($this->getRequest()->marca); | |
| 75 | + $veiculo->passageiros = $this->getRequest()->passageiros; | |
| 76 | + $veiculo->ano_fabricacao = $this->getRequest()->ano_fabricacao; | |
| 77 | + $veiculo->ano_modelo = $this->getRequest()->ano_modelo; | |
| 78 | + $veiculo->malha = $this->getRequest()->malha; | |
| 79 | + $veiculo->ref_cod_tipo_veiculo = $this->getRequest()->tipo; | |
| 80 | + $veiculo->exclusivo_transporte_escolar = ($this->getRequest()->exclusivo_transporte_escolar == 'on' ? 'S' : 'N'); | |
| 81 | + $veiculo->adaptado_necessidades_especiais = ($this->getRequest()->adaptado_necessidades_especiais == 'on' ? 'S' : 'N'); | |
| 82 | + $veiculo->ativo = ($this->getRequest()->ativo == 'on' ? 'S' : 'N'); | |
| 83 | + $veiculo->descricao_inativo = Portabilis_String_Utils::toLatin1($this->getRequest()->descricao_inativo); | |
| 84 | + $veiculo->ref_cod_empresa_transporte_escolar = $this->getRequest()->empresa_id; | |
| 85 | + $veiculo->ref_cod_motorista = $this->getRequest()->motorista_id; | |
| 86 | + $veiculo->observacao = Portabilis_String_Utils::toLatin1($this->getRequest()->observacao); | |
| 87 | + | |
| 88 | + return (is_null($id) ? $veiculo->cadastra() : $veiculo->edita()); | |
| 89 | + } | |
| 90 | + | |
| 91 | + protected function sqlsForNumericSearch() { | |
| 92 | + | |
| 93 | + $sqls[] = "select distinct cod_veiculo as id, (descricao || ', Placa: ' || placa) as name from | |
| 94 | + modules.veiculo where (cod_veiculo like $1||'%') OR (lower(to_ascii(placa)) like '%'||lower(to_ascii($1))||'%')"; | |
| 95 | + | |
| 96 | + return $sqls; | |
| 97 | + } | |
| 98 | + | |
| 99 | + | |
| 100 | + protected function sqlsForStringSearch() { | |
| 101 | + | |
| 102 | + $sqls[] = "select distinct cod_veiculo as id, (descricao || ', Placa: ' || placa ) as name from | |
| 103 | + modules.veiculo where (lower(to_ascii(descricao)) like '%'||lower(to_ascii($1))||'%') OR (lower(to_ascii(placa)) like '%'||lower(to_ascii($1))||'%')"; | |
| 104 | + | |
| 105 | + return $sqls; | |
| 106 | + } | |
| 107 | + | |
| 108 | + protected function validateSizeOfObservacao(){ | |
| 109 | + if (strlen($this->getRequest()->observacao)<=255) | |
| 110 | + return true; | |
| 111 | + else{ | |
| 112 | + $this->messenger->append('O campo Observações não pode ter mais que 255 caracteres.'); | |
| 113 | + return false; | |
| 114 | + } | |
| 115 | + | |
| 116 | + } | |
| 117 | + | |
| 118 | + protected function validateSizeOfDescricaoInativo(){ | |
| 119 | + if (strlen($this->getRequest()->descricao_inativo)<=255) | |
| 120 | + return true; | |
| 121 | + else{ | |
| 122 | + $this->messenger->append('O campo Descrição de inatividade não pode ter mais que 255 caracteres.'); | |
| 123 | + return false; | |
| 124 | + } | |
| 125 | + | |
| 126 | + } | |
| 127 | + | |
| 128 | + protected function validateIfVeiculoIsNotInUse(){ | |
| 129 | + | |
| 130 | + $it = new clsModulesItinerarioTransporteEscolar(); | |
| 131 | + $lista = $it->lista(null,null,null,$this->getRequest()->id); | |
| 132 | + if(is_array($lista) && count($lista)>0){ | |
| 133 | + $this->messenger->append('Não é possível excluir um veículo que está vinculada a um itinerário.', | |
| 134 | + 'error', false, 'error'); | |
| 135 | + return false; | |
| 136 | + }else{ | |
| 137 | + return true; | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + protected function get() { | |
| 142 | + | |
| 143 | + $id = $this->getRequest()->id; | |
| 144 | + $veiculo = new clsModulesVeiculo(); | |
| 145 | + $veiculo->cod_veiculo = $id; | |
| 146 | + $veiculo = $veiculo->detalhe(); | |
| 147 | + | |
| 148 | + $attrs = array( | |
| 149 | + 'cod_veiculo' => 'id', | |
| 150 | + 'descricao' => 'descricao', | |
| 151 | + 'placa' => 'placa', | |
| 152 | + 'renavam' => 'renavam', | |
| 153 | + 'chassi' => 'chassi', | |
| 154 | + 'marca' => 'marca', | |
| 155 | + 'ano_fabricacao' => 'ano_fabricacao', | |
| 156 | + 'ano_modelo' => 'ano_modelo', | |
| 157 | + 'passageiros' => 'passageiros', | |
| 158 | + 'malha' => 'malha', | |
| 159 | + 'ref_cod_tipo_veiculo' => 'tipo', | |
| 160 | + 'exclusivo_transporte_escolar' => 'exclusivo_transporte_escolar', | |
| 161 | + 'adaptado_necessidades_especiais' => 'adaptado_necessidades_especiais', | |
| 162 | + 'ativo' => 'ativo', | |
| 163 | + 'descricao_inativo' => 'descricao_inativo', | |
| 164 | + 'ref_cod_empresa_transporte_escolar' => 'empresa', | |
| 165 | + 'ref_cod_motorista' => 'motorista', | |
| 166 | + 'observacao' => 'observacao' | |
| 167 | + ); | |
| 168 | + | |
| 169 | + $veiculo = Portabilis_Array_Utils::filter($veiculo, $attrs); | |
| 170 | + | |
| 171 | + $veiculo['empresaNome'] = Portabilis_String_Utils::toUtf8($this->loadNomeEmpresa($veiculo['empresa'])); | |
| 172 | + | |
| 173 | + $veiculo['motoristaNome'] = Portabilis_String_Utils::toUtf8($this->loadNomeMotorista($veiculo['motorista'])); | |
| 174 | + $veiculo['descricao'] = Portabilis_String_Utils::toUtf8($veiculo['descricao']); | |
| 175 | + $veiculo['marca'] = Portabilis_String_Utils::toUtf8($veiculo['marca']); | |
| 176 | + $veiculo['placa'] = Portabilis_String_Utils::toUtf8($veiculo['placa']); | |
| 177 | + $veiculo['chassi'] = Portabilis_String_Utils::toUtf8($veiculo['chassi']); | |
| 178 | + $veiculo['descricao_inativo'] = Portabilis_String_Utils::toUtf8($veiculo['descricao_inativo']); | |
| 179 | + $veiculo['observacao'] = Portabilis_String_Utils::toUtf8($veiculo['observacao']); | |
| 180 | + | |
| 181 | + return $veiculo; | |
| 182 | + | |
| 183 | + } | |
| 184 | + | |
| 185 | + protected function post() { | |
| 186 | + | |
| 187 | + if ($this->validateSizeOfDescricaoInativo() && $this->validateSizeOfObservacao()){ | |
| 188 | + $id = $this->createOrUpdateVeiculo(); | |
| 189 | + | |
| 190 | + if (is_numeric($id)) { | |
| 191 | + | |
| 192 | + $this->messenger->append('Cadastro realizado com sucesso', 'success', false, 'error'); | |
| 193 | + } | |
| 194 | + else | |
| 195 | + $this->messenger->append('Aparentemente o veículo não pode ser cadastrado, por favor, verifique.'); | |
| 196 | + } | |
| 197 | + | |
| 198 | + return array('id' => $id); | |
| 199 | + } | |
| 200 | + | |
| 201 | + protected function put() { | |
| 202 | + | |
| 203 | + if ($this->validateSizeOfDescricaoInativo() && $this->validateSizeOfObservacao()){ | |
| 204 | + $id = $this->getRequest()->id; | |
| 205 | + $editou = $this->createOrUpdateVeiculo($id); | |
| 206 | + | |
| 207 | + if ($editou) { | |
| 208 | + $this->messenger->append('Alteração realizada com sucesso', 'success', false, 'error'); | |
| 209 | + } | |
| 210 | + else | |
| 211 | + $this->messenger->append('Aparentemente o cadastro não pode ser alterado, por favor, verifique.'); | |
| 212 | + } | |
| 213 | + | |
| 214 | + | |
| 215 | + return array('id' => $id); | |
| 216 | + } | |
| 217 | + | |
| 218 | + protected function delete() { | |
| 219 | + $id = $this->getRequest()->id; | |
| 220 | + | |
| 221 | + | |
| 222 | + $veiculo = new clsModulesVeiculo(); | |
| 223 | + $veiculo->cod_veiculo = $id; | |
| 224 | + | |
| 225 | + if($veiculo->excluir()){ | |
| 226 | + $this->messenger->append('Cadastro removido com sucesso', 'success', false, 'error'); | |
| 227 | + }else | |
| 228 | + $this->messenger->append('Aparentemente o cadastro não pode ser removido, por favor, verifique.','error', false, 'error'); | |
| 229 | + | |
| 230 | + return array('id' => $id); | |
| 231 | + } | |
| 232 | + | |
| 233 | + | |
| 234 | + public function Gerar() { | |
| 235 | + | |
| 236 | + if ($this->isRequestFor('get', 'veiculo')) | |
| 237 | + $this->appendResponse($this->get()); | |
| 238 | + | |
| 239 | + elseif ($this->isRequestFor('get', 'veiculo-search')) | |
| 240 | + $this->appendResponse($this->search()); | |
| 241 | + | |
| 242 | + // create | |
| 243 | + elseif ($this->isRequestFor('post', 'veiculo')) | |
| 244 | + $this->appendResponse($this->post()); | |
| 245 | + | |
| 246 | + elseif ($this->isRequestFor('delete', 'veiculo')){ | |
| 247 | + if($this->validateIfVeiculoIsNotInUse()){ | |
| 248 | + $this->appendResponse($this->delete()); | |
| 249 | + echo "<script language= \"JavaScript\"> | |
| 250 | + location.href=\"intranet/transporte_veiculo_lst.php\"; | |
| 251 | + </script>"; | |
| 252 | + | |
| 253 | + die(); | |
| 254 | + } | |
| 255 | + // update | |
| 256 | + }elseif ($this->isRequestFor('put', 'veiculo')) | |
| 257 | + $this->appendResponse($this->put()); | |
| 258 | + | |
| 259 | + else | |
| 260 | + $this->notImplementedOperationError(); | |
| 261 | + } | |
| 262 | +} | |
| 0 | 263 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Javascripts/Empresa.js
0 → 100644
| ... | ... | @@ -0,0 +1,160 @@ |
| 1 | +// before page is ready | |
| 2 | + | |
| 3 | +$deleteButton = $j('<input value=" Excluir " type="button" style="display: inline; margin-left: 6px;">').html('') | |
| 4 | + .addClass('botaolistagem').insertAfter('#btn_enviar'); | |
| 5 | + | |
| 6 | +var $idField = $j('#id'); | |
| 7 | +var $nomeField = $j('#pessoa_nome'); | |
| 8 | + | |
| 9 | +var $resourceNotice = $j('<span>').html('') | |
| 10 | + .addClass('error resource-notice') | |
| 11 | + .hide() | |
| 12 | + .width($nomeField.outerWidth() - 12) | |
| 13 | + .insertBefore($idField.parent()); | |
| 14 | + | |
| 15 | +var $pessoaNotice = $resourceNotice.clone() | |
| 16 | + .appendTo($nomeField.parent()); | |
| 17 | + | |
| 18 | +// ajax | |
| 19 | + | |
| 20 | +resourceOptions.handlePost = function(dataResponse) { | |
| 21 | + $nomeField.attr('disabled', 'disabled'); | |
| 22 | + $j('.pessoa-links .cadastrar-pessoa').hide(); | |
| 23 | + | |
| 24 | + if (! dataResponse.any_error_msg) | |
| 25 | + window.setTimeout(function() { document.location = '/intranet/transporte_empresa_det.php?cod_empresa=' + resource.id(); }, 500); | |
| 26 | + else | |
| 27 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 28 | +} | |
| 29 | + | |
| 30 | +resourceOptions.handlePut = function(dataResponse) { | |
| 31 | + if (! dataResponse.any_error_msg) | |
| 32 | + window.setTimeout(function() { document.location = '/intranet/transporte_empresa_det.php?cod_empresa=' + resource.id(); }, 500); | |
| 33 | + else | |
| 34 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 35 | +} | |
| 36 | + | |
| 37 | +resourceOptions.handleGet = function(dataResponse) { | |
| 38 | + handleMessages(dataResponse.msgs); | |
| 39 | + $resourceNotice.hide(); | |
| 40 | + | |
| 41 | + $deleteButton.removeAttr('disabled').show(); | |
| 42 | + | |
| 43 | + if (dataResponse.pessoa) | |
| 44 | + getPersonDetails(dataResponse.pessoa); | |
| 45 | + | |
| 46 | + $idField.val(dataResponse.id); | |
| 47 | + $j('#observacao').val(dataResponse.observacao); | |
| 48 | + | |
| 49 | + $j('#pessoaj_pessoaj').val(dataResponse.pessoaj+' - '+dataResponse.pessoajnome); | |
| 50 | + $j('#pessoaj_id').val(dataResponse.pessoaj); | |
| 51 | + | |
| 52 | +}; | |
| 53 | + | |
| 54 | +var handleGetPersonDetails = function(dataResponse) { | |
| 55 | + handleMessages(dataResponse.msgs); | |
| 56 | + $pessoaNotice.hide(); | |
| 57 | + | |
| 58 | + var alunoId = dataResponse.aluno_id; | |
| 59 | + | |
| 60 | + $j('.pessoa-links .editar-pessoa').attr('href', '/intranet/atendidos_cad.php?cod_pessoa_fj=' + dataResponse.id) | |
| 61 | + .show().css('display', 'inline'); | |
| 62 | + | |
| 63 | + $submitButton.removeAttr('disabled').show(); | |
| 64 | + | |
| 65 | + | |
| 66 | + $j('#pessoa_id').val(dataResponse.id); | |
| 67 | + $nomeField.val(dataResponse.id + ' - ' + dataResponse.nome); | |
| 68 | + | |
| 69 | + | |
| 70 | +} | |
| 71 | + | |
| 72 | +var getPersonDetails = function(personId) { | |
| 73 | + var additionalVars = { | |
| 74 | + id : personId | |
| 75 | + }; | |
| 76 | + | |
| 77 | + var options = { | |
| 78 | + url : getResourceUrlBuilder.buildUrl('/module/Api/pessoa', 'pessoa', additionalVars), | |
| 79 | + dataType : 'json', | |
| 80 | + data : {}, | |
| 81 | + success : handleGetPersonDetails | |
| 82 | + }; | |
| 83 | + | |
| 84 | + getResource(options); | |
| 85 | +} | |
| 86 | + | |
| 87 | +var updatePersonDetails = function() { | |
| 88 | + if ($j('#pessoa_nome').val() && $j('#pessoa_id').val()) | |
| 89 | + getPersonDetails($j('#pessoa_id').val()); | |
| 90 | + else | |
| 91 | + clearPersonDetails(); | |
| 92 | +} | |
| 93 | + | |
| 94 | +var clearPersonDetails = function() { | |
| 95 | + $j('#pessoa_id').val(''); | |
| 96 | + $j('.pessoa-links .editar-pessoa').hide(); | |
| 97 | +} | |
| 98 | + | |
| 99 | +// simple search options | |
| 100 | + | |
| 101 | +var simpleSearchPessoaOptions = { | |
| 102 | + autocompleteOptions : { close : updatePersonDetails /*, change : updatePersonDetails*/ } | |
| 103 | +}; | |
| 104 | + | |
| 105 | + | |
| 106 | +// children callbacks | |
| 107 | + | |
| 108 | +function afterChangePessoa(targetWindow, pessoaId) { | |
| 109 | + targetWindow.close(); | |
| 110 | + | |
| 111 | + // timeout para usuario perceber mudança | |
| 112 | + window.setTimeout(function() { | |
| 113 | + messageUtils.success('Pessoa alterada com sucesso', $nomeField); | |
| 114 | + | |
| 115 | + $j('#pessoa_id').val(pessoaId); | |
| 116 | + getPersonDetails(pessoaId); | |
| 117 | + | |
| 118 | + if ($nomeField.is(':active')) | |
| 119 | + $nomeField.focus(); | |
| 120 | + | |
| 121 | + }, 500); | |
| 122 | +} | |
| 123 | + | |
| 124 | + | |
| 125 | +// when page is ready | |
| 126 | + | |
| 127 | +(function($) { | |
| 128 | + $(document).ready(function() { | |
| 129 | + | |
| 130 | + // pessoa | |
| 131 | + | |
| 132 | + var $pessoaActionBar = $j('<span>').html('') | |
| 133 | + .addClass('pessoa-links') | |
| 134 | + .width($nomeField.outerWidth() - 12) | |
| 135 | + .appendTo($nomeField.parent()); | |
| 136 | + | |
| 137 | + $j('<a>').hide() | |
| 138 | + .addClass('cadastrar-pessoa decorated') | |
| 139 | + .attr('href', '/intranet/atendidos_cad.php') | |
| 140 | + .attr('target', '_blank') | |
| 141 | + .html('Cadastrar pessoa') | |
| 142 | + .appendTo($pessoaActionBar); | |
| 143 | + | |
| 144 | + $j('<a>').hide() | |
| 145 | + .addClass('editar-pessoa decorated') | |
| 146 | + .attr('href', '#') | |
| 147 | + .attr('target', '_blank') | |
| 148 | + .html('Editar pessoa') | |
| 149 | + .appendTo($pessoaActionBar); | |
| 150 | + | |
| 151 | + if (resource.isNew()) { | |
| 152 | + $nomeField.focus(); | |
| 153 | + $j('.pessoa-links .cadastrar-pessoa').show().css('display', 'inline'); | |
| 154 | + } | |
| 155 | + else | |
| 156 | + $nomeField.attr('disabled', 'disabled'); | |
| 157 | + | |
| 158 | + | |
| 159 | + }); // ready | |
| 160 | +})(jQuery); | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Javascripts/Empresa.js~
0 → 100644
| ... | ... | @@ -0,0 +1,123 @@ |
| 1 | +// before page is ready | |
| 2 | + | |
| 3 | +$deleteButton = $j('<input value=" Excluir " type="button" style="display: inline; margin-left: 6px;">').html('') | |
| 4 | + .addClass('botaolistagem').insertAfter('#btn_enviar'); | |
| 5 | + | |
| 6 | +var $idField = $j('#id'); | |
| 7 | +var $nomeField = $j('#pessoa_nome'); | |
| 8 | + | |
| 9 | +var $resourceNotice = $j('<span>').html('') | |
| 10 | + .addClass('error resource-notice') | |
| 11 | + .hide() | |
| 12 | + .width($nomeField.outerWidth() - 12) | |
| 13 | + .insertBefore($idField.parent()); | |
| 14 | + | |
| 15 | +var $pessoaNotice = $resourceNotice.clone() | |
| 16 | + .appendTo($nomeField.parent()); | |
| 17 | + | |
| 18 | +// ajax | |
| 19 | + | |
| 20 | +resourceOptions.handlePost = function(dataResponse) { | |
| 21 | + $nomeField.attr('disabled', 'disabled'); | |
| 22 | + $j('.pessoa-links .cadastrar-pessoa').hide(); | |
| 23 | + | |
| 24 | + if (! dataResponse.any_error_msg) | |
| 25 | + window.setTimeout(function() { document.location = '/intranet/transporte_empresa_det.php?cod_empresa=' + resource.id(); }, 500); | |
| 26 | + else | |
| 27 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 28 | +} | |
| 29 | + | |
| 30 | +resourceOptions.handlePut = function(dataResponse) { | |
| 31 | + if (! dataResponse.any_error_msg) | |
| 32 | + window.setTimeout(function() { document.location = '/intranet/transporte_empresa_det.php?cod_empresa=' + resource.id(); }, 500); | |
| 33 | + else | |
| 34 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 35 | +} | |
| 36 | + | |
| 37 | +resourceOptions.handleGet = function(dataResponse) { | |
| 38 | + handleMessages(dataResponse.msgs); | |
| 39 | + $resourceNotice.hide(); | |
| 40 | + | |
| 41 | + $deleteButton.removeAttr('disabled').show(); | |
| 42 | + | |
| 43 | + if (dataResponse.pessoa) | |
| 44 | + getPersonDetails(dataResponse.pessoa); | |
| 45 | + | |
| 46 | + $idField.val(dataResponse.id); | |
| 47 | + $j('#observacao').val(dataResponse.observacao); | |
| 48 | + | |
| 49 | + $j('#pessoaj_pessoaj').val(dataResponse.pessoaj+' - '+dataResponse.pessoajnome); | |
| 50 | + $j('#pessoaj_id').val(dataResponse.pessoaj); | |
| 51 | + | |
| 52 | +}; | |
| 53 | + | |
| 54 | +var handleGetPersonDetails = function(dataResponse) { | |
| 55 | + handleMessages(dataResponse.msgs); | |
| 56 | + $pessoaNotice.hide(); | |
| 57 | + | |
| 58 | + var alunoId = dataResponse.aluno_id; | |
| 59 | + | |
| 60 | + $j('.pessoa-links .editar-pessoa').attr('href', '/intranet/atendidos_cad.php?cod_pessoa_fj=' + dataResponse.id) | |
| 61 | + .show().css('display', 'inline'); | |
| 62 | + | |
| 63 | + $submitButton.removeAttr('disabled').show(); | |
| 64 | + | |
| 65 | + | |
| 66 | + $j('#pessoa_id').val(dataResponse.id); | |
| 67 | + $nomeField.val(dataResponse.id + ' - ' + dataResponse.nome); | |
| 68 | + | |
| 69 | + | |
| 70 | +} | |
| 71 | + | |
| 72 | +var getPersonDetails = function(personId) { | |
| 73 | + var additionalVars = { | |
| 74 | + id : personId | |
| 75 | + }; | |
| 76 | + | |
| 77 | + var options = { | |
| 78 | + url : getResourceUrlBuilder.buildUrl('/module/Api/pessoa', 'pessoa', additionalVars), | |
| 79 | + dataType : 'json', | |
| 80 | + data : {}, | |
| 81 | + success : handleGetPersonDetails | |
| 82 | + }; | |
| 83 | + | |
| 84 | + getResource(options); | |
| 85 | +} | |
| 86 | + | |
| 87 | +var updatePersonDetails = function() { | |
| 88 | + if ($j('#pessoa_nome').val() && $j('#pessoa_id').val()) | |
| 89 | + getPersonDetails($j('#pessoa_id').val()); | |
| 90 | + else | |
| 91 | + clearPersonDetails(); | |
| 92 | +} | |
| 93 | + | |
| 94 | +var clearPersonDetails = function() { | |
| 95 | + $j('#pessoa_id').val(''); | |
| 96 | + $j('.pessoa-links .editar-pessoa').hide(); | |
| 97 | +} | |
| 98 | + | |
| 99 | +// simple search options | |
| 100 | + | |
| 101 | +var simpleSearchPessoaOptions = { | |
| 102 | + autocompleteOptions : { close : updatePersonDetails /*, change : updatePersonDetails*/ } | |
| 103 | +}; | |
| 104 | + | |
| 105 | + | |
| 106 | +// children callbacks | |
| 107 | + | |
| 108 | +function afterChangePessoa(targetWindow, pessoaId) { | |
| 109 | + targetWindow.close(); | |
| 110 | + | |
| 111 | + // timeout para usuario perceber mudança | |
| 112 | + window.setTimeout(function() { | |
| 113 | + messageUtils.success('Pessoa alterada com sucesso', $nomeField); | |
| 114 | + | |
| 115 | + $j('#pessoa_id').val(pessoaId); | |
| 116 | + getPersonDetails(pessoaId); | |
| 117 | + | |
| 118 | + if ($nomeField.is(':active')) | |
| 119 | + $nomeField.focus(); | |
| 120 | + | |
| 121 | + }, 500); | |
| 122 | +} | |
| 123 | + | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Javascripts/Motorista.js
0 → 100644
| ... | ... | @@ -0,0 +1,166 @@ |
| 1 | +// before page is ready | |
| 2 | + | |
| 3 | +$deleteButton = $j('<input value=" Excluir " type="button" style="display: inline; margin-left: 6px;">').html('') | |
| 4 | + .addClass('botaolistagem').insertAfter('#btn_enviar'); | |
| 5 | +var $idField = $j('#id'); | |
| 6 | +var $nomeField = $j('#pessoa_nome'); | |
| 7 | + | |
| 8 | +var $resourceNotice = $j('<span>').html('') | |
| 9 | + .addClass('error resource-notice') | |
| 10 | + .hide() | |
| 11 | + .width($nomeField.outerWidth() - 12) | |
| 12 | + .insertBefore($idField.parent()); | |
| 13 | + | |
| 14 | +var $pessoaNotice = $resourceNotice.clone() | |
| 15 | + .appendTo($nomeField.parent()); | |
| 16 | + | |
| 17 | +// ajax | |
| 18 | + | |
| 19 | +resourceOptions.handlePost = function(dataResponse) { | |
| 20 | + $nomeField.attr('disabled', 'disabled'); | |
| 21 | + $j('.pessoa-links .cadastrar-pessoa').hide(); | |
| 22 | + | |
| 23 | + if (! dataResponse.any_error_msg) | |
| 24 | + window.setTimeout(function() { document.location = '/intranet/transporte_motorista_det.php?cod_motorista=' + resource.id(); }, 500); | |
| 25 | + else | |
| 26 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 27 | +} | |
| 28 | + | |
| 29 | +resourceOptions.handlePut = function(dataResponse) { | |
| 30 | + if (! dataResponse.any_error_msg) | |
| 31 | + window.setTimeout(function() { document.location = '/intranet/transporte_motorista_det.php?cod_motorista=' + resource.id(); }, 500); | |
| 32 | + else | |
| 33 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 34 | +} | |
| 35 | + | |
| 36 | +resourceOptions.handleGet = function(dataResponse) { | |
| 37 | + handleMessages(dataResponse.msgs); | |
| 38 | + $resourceNotice.hide(); | |
| 39 | + | |
| 40 | + $deleteButton.removeAttr('disabled').show(); | |
| 41 | + | |
| 42 | + if (dataResponse.pessoa) | |
| 43 | + getPersonDetails(dataResponse.pessoa); | |
| 44 | + | |
| 45 | + $idField.val(dataResponse.id); | |
| 46 | + $j('#cnh').val(dataResponse.cnh); | |
| 47 | + $j('#tipo_cnh').val(dataResponse.tipo_cnh); | |
| 48 | + | |
| 49 | + $j('#dt_habilitacao').val(dataResponse.dt_habilitacao); | |
| 50 | + $j('#vencimento_cnh').val(dataResponse.vencimento_cnh); | |
| 51 | + $j('#observacao').val(dataResponse.observacao); | |
| 52 | + | |
| 53 | + $j('#empresa_ref_cod_empresa_transporte_escolarf').val(dataResponse.ref_cod_empresa_transporte_escolar+' - '+dataResponse.empresa); | |
| 54 | + $j('#empresa_id').val(dataResponse.ref_cod_empresa_transporte_escolar); | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | +}; | |
| 59 | + | |
| 60 | +var handleGetPersonDetails = function(dataResponse) { | |
| 61 | + handleMessages(dataResponse.msgs); | |
| 62 | + $pessoaNotice.hide(); | |
| 63 | + | |
| 64 | + var alunoId = dataResponse.aluno_id; | |
| 65 | + | |
| 66 | + $j('.pessoa-links .editar-pessoa').attr('href', '/intranet/atendidos_cad.php?cod_pessoa_fj=' + dataResponse.id) | |
| 67 | + .show().css('display', 'inline'); | |
| 68 | + | |
| 69 | + $submitButton.removeAttr('disabled').show(); | |
| 70 | + | |
| 71 | + | |
| 72 | + $j('#pessoa_id').val(dataResponse.id); | |
| 73 | + $nomeField.val(dataResponse.id + ' - ' + dataResponse.nome); | |
| 74 | + | |
| 75 | + | |
| 76 | +} | |
| 77 | + | |
| 78 | +var getPersonDetails = function(personId) { | |
| 79 | + var additionalVars = { | |
| 80 | + id : personId | |
| 81 | + }; | |
| 82 | + | |
| 83 | + var options = { | |
| 84 | + url : getResourceUrlBuilder.buildUrl('/module/Api/pessoa', 'pessoa', additionalVars), | |
| 85 | + dataType : 'json', | |
| 86 | + data : {}, | |
| 87 | + success : handleGetPersonDetails | |
| 88 | + }; | |
| 89 | + | |
| 90 | + getResource(options); | |
| 91 | +} | |
| 92 | + | |
| 93 | +var updatePersonDetails = function() { | |
| 94 | + if ($j('#pessoa_nome').val() && $j('#pessoa_id').val()) | |
| 95 | + getPersonDetails($j('#pessoa_id').val()); | |
| 96 | + else | |
| 97 | + clearPersonDetails(); | |
| 98 | +} | |
| 99 | + | |
| 100 | +var clearPersonDetails = function() { | |
| 101 | + $j('#pessoa_id').val(''); | |
| 102 | + $j('.pessoa-links .editar-pessoa').hide(); | |
| 103 | +} | |
| 104 | + | |
| 105 | +// simple search options | |
| 106 | + | |
| 107 | +var simpleSearchPessoaOptions = { | |
| 108 | + autocompleteOptions : { close : updatePersonDetails /*, change : updatePersonDetails*/ } | |
| 109 | +}; | |
| 110 | + | |
| 111 | + | |
| 112 | +// children callbacks | |
| 113 | + | |
| 114 | +function afterChangePessoa(targetWindow, pessoaId) { | |
| 115 | + targetWindow.close(); | |
| 116 | + | |
| 117 | + // timeout para usuario perceber mudança | |
| 118 | + window.setTimeout(function() { | |
| 119 | + messageUtils.success('Pessoa alterada com sucesso', $nomeField); | |
| 120 | + | |
| 121 | + $j('#pessoa_id').val(pessoaId); | |
| 122 | + getPersonDetails(pessoaId); | |
| 123 | + | |
| 124 | + if ($nomeField.is(':active')) | |
| 125 | + $nomeField.focus(); | |
| 126 | + | |
| 127 | + }, 500); | |
| 128 | +} | |
| 129 | + | |
| 130 | + | |
| 131 | +// when page is ready | |
| 132 | + | |
| 133 | +(function($) { | |
| 134 | + $(document).ready(function() { | |
| 135 | + | |
| 136 | + // pessoa | |
| 137 | + | |
| 138 | + var $pessoaActionBar = $j('<span>').html('') | |
| 139 | + .addClass('pessoa-links') | |
| 140 | + .width($nomeField.outerWidth() - 12) | |
| 141 | + .appendTo($nomeField.parent()); | |
| 142 | + | |
| 143 | + $j('<a>').hide() | |
| 144 | + .addClass('cadastrar-pessoa decorated') | |
| 145 | + .attr('href', '/intranet/atendidos_cad.php') | |
| 146 | + .attr('target', '_blank') | |
| 147 | + .html('Cadastrar pessoa') | |
| 148 | + .appendTo($pessoaActionBar); | |
| 149 | + | |
| 150 | + $j('<a>').hide() | |
| 151 | + .addClass('editar-pessoa decorated') | |
| 152 | + .attr('href', '#') | |
| 153 | + .attr('target', '_blank') | |
| 154 | + .html('Editar pessoa') | |
| 155 | + .appendTo($pessoaActionBar); | |
| 156 | + | |
| 157 | + if (resource.isNew()) { | |
| 158 | + $nomeField.focus(); | |
| 159 | + $j('.pessoa-links .cadastrar-pessoa').show().css('display', 'inline'); | |
| 160 | + } | |
| 161 | + else | |
| 162 | + $nomeField.attr('disabled', 'disabled'); | |
| 163 | + | |
| 164 | + | |
| 165 | + }); // ready | |
| 166 | +})(jQuery); | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Javascripts/Pessoatransporte.js
0 → 100644
| ... | ... | @@ -0,0 +1,221 @@ |
| 1 | +document.getElementById('rota').onchange = function() | |
| 2 | +{ | |
| 3 | + chamaGetPonto(); | |
| 4 | +} | |
| 5 | + | |
| 6 | +var valPonto = 0; | |
| 7 | + | |
| 8 | +function chamaGetPonto(){ | |
| 9 | + | |
| 10 | + var campoRota = document.getElementById('rota').value; | |
| 11 | + var campoPonto= document.getElementById('ponto'); | |
| 12 | + | |
| 13 | + if (campoRota==''){ | |
| 14 | + campoPonto.length = 1; | |
| 15 | + campoPonto.options[0].text = 'Selecione uma rota acima'; | |
| 16 | + | |
| 17 | + }else{ | |
| 18 | + | |
| 19 | + campoPonto.length = 1; | |
| 20 | + campoPonto.disabled = true; | |
| 21 | + campoPonto.options[0].text = 'Carregando pontos...'; | |
| 22 | + | |
| 23 | + var xml_ponto = new ajax( getPonto ); | |
| 24 | + xml_ponto.envia( "ponto_xml.php?rota="+campoRota ); | |
| 25 | + } | |
| 26 | +} | |
| 27 | + | |
| 28 | +function getPonto( xml_ponto ) | |
| 29 | +{ | |
| 30 | + var campoPonto = document.getElementById('ponto'); | |
| 31 | + var DOM_array = xml_ponto.getElementsByTagName( "ponto" ); | |
| 32 | + | |
| 33 | + if(DOM_array.length) | |
| 34 | + { | |
| 35 | + campoPonto.length = 1; | |
| 36 | + campoPonto.options[0].text = 'Selecione um ponto'; | |
| 37 | + campoPonto.disabled = false; | |
| 38 | + | |
| 39 | + for( var i = 0; i < DOM_array.length; i++ ) | |
| 40 | + { | |
| 41 | + campoPonto.options[campoPonto.options.length] = new Option( DOM_array[i].firstChild.data, DOM_array[i].getAttribute("cod_ponto"),false,false); | |
| 42 | + } | |
| 43 | + $j('#ponto').val(valPonto); | |
| 44 | + } | |
| 45 | + else | |
| 46 | + campoPonto.options[0].text = 'Rota sem pontos'; | |
| 47 | + | |
| 48 | + | |
| 49 | +} | |
| 50 | + | |
| 51 | +// before page is ready | |
| 52 | + | |
| 53 | +$deleteButton = $j('<input value=" Excluir " type="button" style="display: inline; margin-left: 6px;">').html('') | |
| 54 | + .addClass('botaolistagem').insertAfter('#btn_enviar'); | |
| 55 | +var $idField = $j('#id'); | |
| 56 | +var $nomeField = $j('#pessoa_nome'); | |
| 57 | + | |
| 58 | +var $resourceNotice = $j('<span>').html('') | |
| 59 | + .addClass('error resource-notice') | |
| 60 | + .hide() | |
| 61 | + .width($nomeField.outerWidth() - 12) | |
| 62 | + .insertBefore($idField.parent()); | |
| 63 | + | |
| 64 | +var $pessoaNotice = $resourceNotice.clone() | |
| 65 | + .appendTo($nomeField.parent()); | |
| 66 | + | |
| 67 | +// ajax | |
| 68 | + | |
| 69 | +resourceOptions.handlePost = function(dataResponse) { | |
| 70 | + $nomeField.attr('disabled', 'disabled'); | |
| 71 | + $j('.pessoa-links .cadastrar-pessoa').hide(); | |
| 72 | + | |
| 73 | + if (! dataResponse.any_error_msg) | |
| 74 | + window.setTimeout(function() { document.location = '/intranet/transporte_pessoa_det.php?cod_pt=' + resource.id(); }, 500); | |
| 75 | + else | |
| 76 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 77 | +} | |
| 78 | + | |
| 79 | +resourceOptions.handlePut = function(dataResponse) { | |
| 80 | + if (! dataResponse.any_error_msg) | |
| 81 | + window.setTimeout(function() { document.location = '/intranet/transporte_pessoa_det.php?cod_pt=' + resource.id(); }, 500); | |
| 82 | + else | |
| 83 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 84 | +} | |
| 85 | + | |
| 86 | +resourceOptions.handleGet = function(dataResponse) { | |
| 87 | + valPonto = dataResponse.ponto; | |
| 88 | + handleMessages(dataResponse.msgs); | |
| 89 | + $resourceNotice.hide(); | |
| 90 | + | |
| 91 | + $deleteButton.removeAttr('disabled').show(); | |
| 92 | + | |
| 93 | + $('<input>'); | |
| 94 | + if (dataResponse.pessoa) | |
| 95 | + getPersonDetails(dataResponse.pessoa); | |
| 96 | + | |
| 97 | + $idField.val(dataResponse.id); | |
| 98 | + | |
| 99 | + $j('#rota').val(dataResponse.rota); | |
| 100 | + chamaGetPonto(); | |
| 101 | + | |
| 102 | + $j('#observacao').val(dataResponse.observacao); | |
| 103 | + | |
| 104 | + $j('#nome').val(dataResponse.pessoa+' - '+dataResponse.pessoa_nome); | |
| 105 | + $j('#pessoa_id').val(dataResponse.pessoa); | |
| 106 | + | |
| 107 | + if (dataResponse.pessoaj){ | |
| 108 | + $j('#pessoaj_destino').val(dataResponse.pessoaj+' - '+dataResponse.pessoaj_nome); | |
| 109 | + $j('#pessoaj_id').val(dataResponse.pessoaj); | |
| 110 | + } | |
| 111 | + | |
| 112 | + | |
| 113 | +}; | |
| 114 | + | |
| 115 | +var handleGetPersonDetails = function(dataResponse) { | |
| 116 | + handleMessages(dataResponse.msgs); | |
| 117 | + $pessoaNotice.hide(); | |
| 118 | + | |
| 119 | + var alunoId = dataResponse.aluno_id; | |
| 120 | + | |
| 121 | + $j('.pessoa-links .editar-pessoa').attr('href', '/intranet/atendidos_cad.php?cod_pessoa_fj=' + dataResponse.id) | |
| 122 | + .show().css('display', 'inline'); | |
| 123 | + | |
| 124 | + $submitButton.removeAttr('disabled').show(); | |
| 125 | + | |
| 126 | + | |
| 127 | + $j('#pessoa_id').val(dataResponse.id); | |
| 128 | + $nomeField.val(dataResponse.id + ' - ' + dataResponse.nome); | |
| 129 | + | |
| 130 | + | |
| 131 | +} | |
| 132 | + | |
| 133 | +var getPersonDetails = function(personId) { | |
| 134 | + var additionalVars = { | |
| 135 | + id : personId | |
| 136 | + }; | |
| 137 | + | |
| 138 | + var options = { | |
| 139 | + url : getResourceUrlBuilder.buildUrl('/module/Api/pessoa', 'pessoa', additionalVars), | |
| 140 | + dataType : 'json', | |
| 141 | + data : {}, | |
| 142 | + success : handleGetPersonDetails | |
| 143 | + }; | |
| 144 | + | |
| 145 | + getResource(options); | |
| 146 | +} | |
| 147 | + | |
| 148 | +var updatePersonDetails = function() { | |
| 149 | + if ($j('#pessoa_nome').val() && $j('#pessoa_id').val()) | |
| 150 | + getPersonDetails($j('#pessoa_id').val()); | |
| 151 | + else | |
| 152 | + clearPersonDetails(); | |
| 153 | +} | |
| 154 | + | |
| 155 | +var clearPersonDetails = function() { | |
| 156 | + $j('#pessoa_id').val(''); | |
| 157 | + $j('.pessoa-links .editar-pessoa').hide(); | |
| 158 | +} | |
| 159 | + | |
| 160 | +// simple search options | |
| 161 | + | |
| 162 | +var simpleSearchPessoaOptions = { | |
| 163 | + autocompleteOptions : { close : updatePersonDetails /*, change : updatePersonDetails*/ } | |
| 164 | +}; | |
| 165 | + | |
| 166 | + | |
| 167 | +// children callbacks | |
| 168 | + | |
| 169 | +function afterChangePessoa(targetWindow, pessoaId) { | |
| 170 | + targetWindow.close(); | |
| 171 | + | |
| 172 | + // timeout para usuario perceber mudança | |
| 173 | + window.setTimeout(function() { | |
| 174 | + messageUtils.success('Pessoa alterada com sucesso', $nomeField); | |
| 175 | + | |
| 176 | + $j('#pessoa_id').val(pessoaId); | |
| 177 | + getPersonDetails(pessoaId); | |
| 178 | + | |
| 179 | + if ($nomeField.is(':active')) | |
| 180 | + $nomeField.focus(); | |
| 181 | + | |
| 182 | + }, 500); | |
| 183 | +} | |
| 184 | + | |
| 185 | + | |
| 186 | +// when page is ready | |
| 187 | + | |
| 188 | +(function($) { | |
| 189 | + $(document).ready(function() { | |
| 190 | + | |
| 191 | + // pessoa | |
| 192 | + | |
| 193 | + var $pessoaActionBar = $j('<span>').html('') | |
| 194 | + .addClass('pessoa-links') | |
| 195 | + .width($nomeField.outerWidth() - 12) | |
| 196 | + .appendTo($nomeField.parent()); | |
| 197 | + | |
| 198 | + $j('<a>').hide() | |
| 199 | + .addClass('cadastrar-pessoa decorated') | |
| 200 | + .attr('href', '/intranet/atendidos_cad.php') | |
| 201 | + .attr('target', '_blank') | |
| 202 | + .html('Cadastrar pessoa') | |
| 203 | + .appendTo($pessoaActionBar); | |
| 204 | + | |
| 205 | + $j('<a>').hide() | |
| 206 | + .addClass('editar-pessoa decorated') | |
| 207 | + .attr('href', '#') | |
| 208 | + .attr('target', '_blank') | |
| 209 | + .html('Editar pessoa') | |
| 210 | + .appendTo($pessoaActionBar); | |
| 211 | + | |
| 212 | + if (resource.isNew()) { | |
| 213 | + $nomeField.focus(); | |
| 214 | + $j('.pessoa-links .cadastrar-pessoa').show().css('display', 'inline'); | |
| 215 | + } | |
| 216 | + else | |
| 217 | + $nomeField.attr('disabled', 'disabled'); | |
| 218 | + | |
| 219 | + | |
| 220 | + }); // ready | |
| 221 | +})(jQuery); | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Javascripts/Ponto.js
0 → 100644
| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | +// before page is ready | |
| 2 | + | |
| 3 | +$deleteButton = $j('<input value=" Excluir " type="button" style="display: inline; margin-left: 6px;">').html('') | |
| 4 | + .addClass('botaolistagem').insertAfter('#btn_enviar'); | |
| 5 | + | |
| 6 | +var $idField = $j('#id'); | |
| 7 | + | |
| 8 | +// ajax | |
| 9 | + | |
| 10 | +resourceOptions.handlePost = function(dataResponse) { | |
| 11 | + | |
| 12 | + if (! dataResponse.any_error_msg) | |
| 13 | + window.setTimeout(function() { document.location = '/intranet/transporte_ponto_det.php?cod_ponto=' + resource.id(); }, 500); | |
| 14 | + else | |
| 15 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 16 | +} | |
| 17 | + | |
| 18 | +resourceOptions.handlePut = function(dataResponse) { | |
| 19 | + if (! dataResponse.any_error_msg) | |
| 20 | + window.setTimeout(function() { document.location = '/intranet/transporte_ponto_det.php?cod_ponto=' + resource.id(); }, 500); | |
| 21 | + else | |
| 22 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 23 | +} | |
| 24 | + | |
| 25 | +resourceOptions.handleGet = function(dataResponse) { | |
| 26 | + handleMessages(dataResponse.msgs); | |
| 27 | + | |
| 28 | + $deleteButton.removeAttr('disabled').show(); | |
| 29 | + | |
| 30 | + $idField.val(dataResponse.id); | |
| 31 | + $j('#desc').val(dataResponse.desc); | |
| 32 | +}; | |
| 0 | 33 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Javascripts/Ponto.js~
0 → 100644
| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | +s// before page is ready | |
| 2 | + | |
| 3 | +$deleteButton = $j('<input value=" Excluir " type="button" style="display: inline; margin-left: 6px;">').html('') | |
| 4 | + .addClass('botaolistagem').insertAfter('#btn_enviar'); | |
| 5 | + | |
| 6 | +var $idField = $j('#id'); | |
| 7 | + | |
| 8 | +// ajax | |
| 9 | + | |
| 10 | +resourceOptions.handlePost = function(dataResponse) { | |
| 11 | + | |
| 12 | + if (! dataResponse.any_error_msg) | |
| 13 | + window.setTimeout(function() { document.location = '/intranet/transporte_ponto_det.php?cod_ponto=' + resource.id(); }, 500); | |
| 14 | + else | |
| 15 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 16 | +} | |
| 17 | + | |
| 18 | +resourceOptions.handlePut = function(dataResponse) { | |
| 19 | + if (! dataResponse.any_error_msg) | |
| 20 | + window.setTimeout(function() { document.location = '/intranet/transporte_ponto_det.php?cod_ponto=' + resource.id(); }, 500); | |
| 21 | + else | |
| 22 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 23 | +} | |
| 24 | + | |
| 25 | +resourceOptions.handleGet = function(dataResponse) { | |
| 26 | + handleMessages(dataResponse.msgs); | |
| 27 | + $resourceNotice.hide(); | |
| 28 | + | |
| 29 | + $deleteButton.removeAttr('disabled').show(); | |
| 30 | + | |
| 31 | + if (dataResponse.pessoa) | |
| 32 | + getPersonDetails(dataResponse.pessoa); | |
| 33 | + | |
| 34 | + $idField.val(dataResponse.id); | |
| 35 | + $j('#desc').val(dataResponse.desc); | |
| 36 | + | |
| 37 | +}; | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Javascripts/Rota.js
0 → 100644
| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | +// before page is ready | |
| 2 | + | |
| 3 | +$deleteButton = $j('<input value=" Excluir " type="button" style="display: inline; margin-left: 6px;">').html('') | |
| 4 | + .addClass('botaolistagem').insertAfter('#btn_enviar'); | |
| 5 | +var $idField = $j('#id'); | |
| 6 | + | |
| 7 | +// ajax | |
| 8 | + | |
| 9 | +resourceOptions.handlePost = function(dataResponse) { | |
| 10 | + | |
| 11 | + if (! dataResponse.any_error_msg) | |
| 12 | + window.setTimeout(function() { document.location = '/intranet/transporte_rota_det.php?cod_rota=' + resource.id(); }, 500); | |
| 13 | + else | |
| 14 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 15 | +} | |
| 16 | + | |
| 17 | +resourceOptions.handlePut = function(dataResponse) { | |
| 18 | + if (! dataResponse.any_error_msg) | |
| 19 | + window.setTimeout(function() { document.location = '/intranet/transporte_rota_det.php?cod_rota=' + resource.id(); }, 500); | |
| 20 | + else | |
| 21 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 22 | +} | |
| 23 | + | |
| 24 | +resourceOptions.handleGet = function(dataResponse) { | |
| 25 | + handleMessages(dataResponse.msgs); | |
| 26 | + | |
| 27 | + $deleteButton.removeAttr('disabled').show(); | |
| 28 | + | |
| 29 | + $idField.val(dataResponse.id); | |
| 30 | + $j('#desc').val(dataResponse.desc); | |
| 31 | + $j('#pessoaj_id').val(dataResponse.ref_idpes_destino); | |
| 32 | + $j('#pessoaj_ref_idpes_destino').val(dataResponse.ref_idpes_destino+' - '+dataResponse.nomeDestino); | |
| 33 | + $j('#empresa_id').val(dataResponse.ref_cod_empresa_transporte_escolar); | |
| 34 | + $j('#empresa_ref_cod_empresa_transporte_escolar').val(dataResponse.ref_cod_empresa_transporte_escolar+' - '+dataResponse.nomeEmpresa); | |
| 35 | + $j('#ano').val(dataResponse.ano); | |
| 36 | + $j('#tipo_rota').val(dataResponse.tipo_rota); | |
| 37 | + $j('#km_pav').val(dataResponse.km_pav); | |
| 38 | + $j('#km_npav').val(dataResponse.km_npav); | |
| 39 | + $j('#km_npav').val(dataResponse.km_npav); | |
| 40 | + if (dataResponse.tercerizado == 'S'){ | |
| 41 | + $j('#tercerizado').attr('checked',true); | |
| 42 | + $j('#tercerizado').val('on'); | |
| 43 | + } | |
| 44 | + | |
| 45 | +}; | |
| 0 | 46 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Javascripts/Veiculo.js
0 → 100644
| ... | ... | @@ -0,0 +1,189 @@ |
| 1 | +// before page is ready | |
| 2 | + | |
| 3 | +$deleteButton = $j('<input value=" Excluir " type="button" style="display: inline; margin-left: 6px;">').html('') | |
| 4 | + .addClass('botaolistagem').insertAfter('#btn_enviar'); | |
| 5 | +var $idField = $j('#id'); | |
| 6 | +var $nomeField = $j('#pessoa_nome'); | |
| 7 | + | |
| 8 | +var $resourceNotice = $j('<span>').html('') | |
| 9 | + .addClass('error resource-notice') | |
| 10 | + .hide() | |
| 11 | + .width($nomeField.outerWidth() - 12) | |
| 12 | + .insertBefore($idField.parent()); | |
| 13 | + | |
| 14 | +var $pessoaNotice = $resourceNotice.clone() | |
| 15 | + .appendTo($nomeField.parent()); | |
| 16 | + | |
| 17 | +// ajax | |
| 18 | + | |
| 19 | +resourceOptions.handlePost = function(dataResponse) { | |
| 20 | + $nomeField.attr('disabled', 'disabled'); | |
| 21 | + $j('.pessoa-links .cadastrar-pessoa').hide(); | |
| 22 | + | |
| 23 | + if (! dataResponse.any_error_msg) | |
| 24 | + window.setTimeout(function() { document.location = '/intranet/transporte_veiculo_det.php?cod_veiculo=' + resource.id(); }, 500); | |
| 25 | + else | |
| 26 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 27 | +} | |
| 28 | + | |
| 29 | +resourceOptions.handlePut = function(dataResponse) { | |
| 30 | + if (! dataResponse.any_error_msg) | |
| 31 | + window.setTimeout(function() { document.location = '/intranet/transporte_veiculo_det.php?cod_veiculo=' + resource.id(); }, 500); | |
| 32 | + else | |
| 33 | + $submitButton.removeAttr('disabled').val('Gravar'); | |
| 34 | +} | |
| 35 | + | |
| 36 | +resourceOptions.handleGet = function(dataResponse) { | |
| 37 | + handleMessages(dataResponse.msgs); | |
| 38 | + $resourceNotice.hide(); | |
| 39 | + | |
| 40 | + $deleteButton.removeAttr('disabled').show(); | |
| 41 | + | |
| 42 | + if (dataResponse.pessoa) | |
| 43 | + getPersonDetails(dataResponse.pessoa); | |
| 44 | + | |
| 45 | + $idField.val(dataResponse.id); | |
| 46 | + $j('#descricao').val(dataResponse.descricao); | |
| 47 | + $j('#placa').val(dataResponse.placa); | |
| 48 | + $j('#renavam').val(dataResponse.renavam); | |
| 49 | + $j('#chassi').val(dataResponse.chassi); | |
| 50 | + $j('#marca').val(dataResponse.marca); | |
| 51 | + $j('#ano_fabricacao').val(dataResponse.ano_fabricacao); | |
| 52 | + $j('#ano_modelo').val(dataResponse.ano_modelo); | |
| 53 | + $j('#passageiros').val(dataResponse.passageiros); | |
| 54 | + $j('#malha').val(dataResponse.malha); | |
| 55 | + $j('#tipo').val(dataResponse.tipo); | |
| 56 | + if (dataResponse.exclusivo_transporte_escolar == 'S'){ | |
| 57 | + $j('#exclusivo_transporte_escolar').attr('checked',true); | |
| 58 | + $j('#exclusivo_transporte_escolar').val('on'); | |
| 59 | + } | |
| 60 | + if (dataResponse.adaptado_necessidades_especiais == 'S'){ | |
| 61 | + $j('#adaptado_necessidades_especiais').attr('checked',true); | |
| 62 | + $j('#adaptado_necessidades_especiais').val('on'); | |
| 63 | + } | |
| 64 | + | |
| 65 | + if (dataResponse.ativo == 'N'){ | |
| 66 | + $j('#ativo').attr('checked',false); | |
| 67 | + $j('#ativo').val(''); | |
| 68 | + } | |
| 69 | + | |
| 70 | + $j('#motorista_motorista').val(dataResponse.motorista+' - '+dataResponse.motoristaNome); | |
| 71 | + $j('#motorista_id').val(dataResponse.motorista); | |
| 72 | + | |
| 73 | + $j('#descricao_ativo').val(dataResponse.descricao_ativo); | |
| 74 | + $j('#empresa_empresa').val(dataResponse.empresa+' - '+dataResponse.empresaNome); | |
| 75 | + $j('#empresa_id').val(dataResponse.empresa); | |
| 76 | + $j('#observacao').val(dataResponse.observacao); | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | +}; | |
| 82 | + | |
| 83 | +var handleGetPersonDetails = function(dataResponse) { | |
| 84 | + handleMessages(dataResponse.msgs); | |
| 85 | + $pessoaNotice.hide(); | |
| 86 | + | |
| 87 | + var alunoId = dataResponse.aluno_id; | |
| 88 | + | |
| 89 | + $j('.pessoa-links .editar-pessoa').attr('href', '/intranet/atendidos_cad.php?cod_pessoa_fj=' + dataResponse.id) | |
| 90 | + .show().css('display', 'inline'); | |
| 91 | + | |
| 92 | + $submitButton.removeAttr('disabled').show(); | |
| 93 | + | |
| 94 | + | |
| 95 | + $j('#pessoa_id').val(dataResponse.id); | |
| 96 | + $nomeField.val(dataResponse.id + ' - ' + dataResponse.nome); | |
| 97 | + | |
| 98 | + | |
| 99 | +} | |
| 100 | + | |
| 101 | +var getPersonDetails = function(personId) { | |
| 102 | + var additionalVars = { | |
| 103 | + id : personId | |
| 104 | + }; | |
| 105 | + | |
| 106 | + var options = { | |
| 107 | + url : getResourceUrlBuilder.buildUrl('/module/Api/pessoa', 'pessoa', additionalVars), | |
| 108 | + dataType : 'json', | |
| 109 | + data : {}, | |
| 110 | + success : handleGetPersonDetails | |
| 111 | + }; | |
| 112 | + | |
| 113 | + getResource(options); | |
| 114 | +} | |
| 115 | + | |
| 116 | +var updatePersonDetails = function() { | |
| 117 | + if ($j('#pessoa_nome').val() && $j('#pessoa_id').val()) | |
| 118 | + getPersonDetails($j('#pessoa_id').val()); | |
| 119 | + else | |
| 120 | + clearPersonDetails(); | |
| 121 | +} | |
| 122 | + | |
| 123 | +var clearPersonDetails = function() { | |
| 124 | + $j('#pessoa_id').val(''); | |
| 125 | + $j('.pessoa-links .editar-pessoa').hide(); | |
| 126 | +} | |
| 127 | + | |
| 128 | +// simple search options | |
| 129 | + | |
| 130 | +var simpleSearchPessoaOptions = { | |
| 131 | + autocompleteOptions : { close : updatePersonDetails /*, change : updatePersonDetails*/ } | |
| 132 | +}; | |
| 133 | + | |
| 134 | + | |
| 135 | +// children callbacks | |
| 136 | + | |
| 137 | +function afterChangePessoa(targetWindow, pessoaId) { | |
| 138 | + targetWindow.close(); | |
| 139 | + | |
| 140 | + // timeout para usuario perceber mudança | |
| 141 | + window.setTimeout(function() { | |
| 142 | + messageUtils.success('Pessoa alterada com sucesso', $nomeField); | |
| 143 | + | |
| 144 | + $j('#pessoa_id').val(pessoaId); | |
| 145 | + getPersonDetails(pessoaId); | |
| 146 | + | |
| 147 | + if ($nomeField.is(':active')) | |
| 148 | + $nomeField.focus(); | |
| 149 | + | |
| 150 | + }, 500); | |
| 151 | +} | |
| 152 | + | |
| 153 | + | |
| 154 | +// when page is ready | |
| 155 | + | |
| 156 | +(function($) { | |
| 157 | + $(document).ready(function() { | |
| 158 | + | |
| 159 | + // pessoa | |
| 160 | + | |
| 161 | + var $pessoaActionBar = $j('<span>').html('') | |
| 162 | + .addClass('pessoa-links') | |
| 163 | + .width($nomeField.outerWidth() - 12) | |
| 164 | + .appendTo($nomeField.parent()); | |
| 165 | + | |
| 166 | + $j('<a>').hide() | |
| 167 | + .addClass('cadastrar-pessoa decorated') | |
| 168 | + .attr('href', '/intranet/atendidos_cad.php') | |
| 169 | + .attr('target', '_blank') | |
| 170 | + .html('Cadastrar pessoa') | |
| 171 | + .appendTo($pessoaActionBar); | |
| 172 | + | |
| 173 | + $j('<a>').hide() | |
| 174 | + .addClass('editar-pessoa decorated') | |
| 175 | + .attr('href', '#') | |
| 176 | + .attr('target', '_blank') | |
| 177 | + .html('Editar pessoa') | |
| 178 | + .appendTo($pessoaActionBar); | |
| 179 | + | |
| 180 | + if (resource.isNew()) { | |
| 181 | + $nomeField.focus(); | |
| 182 | + $j('.pessoa-links .cadastrar-pessoa').show().css('display', 'inline'); | |
| 183 | + } | |
| 184 | + else | |
| 185 | + $nomeField.attr('disabled', 'disabled'); | |
| 186 | + | |
| 187 | + | |
| 188 | + }); // ready | |
| 189 | +})(jQuery); | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Stylesheets/Empresa.css
0 → 100644
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +.pessoa-links { | |
| 2 | + display: block; | |
| 3 | + padding: 5px; | |
| 4 | + margin: 2px; | |
| 5 | +} | |
| 6 | + | |
| 7 | +.pessoa-links a { | |
| 8 | + /* | |
| 9 | + obs: no firefox, ao mostrar o elemento (.show, jquery), é setado display como block, | |
| 10 | + para reparar isto, após chamar .show(), chamar .css('display', 'inline'); | |
| 11 | + */ | |
| 12 | + | |
| 13 | + margin-right: 5px; | |
| 14 | +} | |
| 15 | + | |
| 16 | +#deficiencias_chzn ul { | |
| 17 | + width: 307px; | |
| 18 | +} | |
| 0 | 19 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Stylesheets/Motorista.css
0 → 100644
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +.pessoa-links { | |
| 2 | + display: block; | |
| 3 | + padding: 5px; | |
| 4 | + margin: 2px; | |
| 5 | +} | |
| 6 | + | |
| 7 | +.pessoa-links a { | |
| 8 | + /* | |
| 9 | + obs: no firefox, ao mostrar o elemento (.show, jquery), é setado display como block, | |
| 10 | + para reparar isto, após chamar .show(), chamar .css('display', 'inline'); | |
| 11 | + */ | |
| 12 | + | |
| 13 | + margin-right: 5px; | |
| 14 | +} | |
| 15 | + | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Stylesheets/Motorista.css~
0 → 100644
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +.pessoa-links { | |
| 2 | + display: block; | |
| 3 | + padding: 5px; | |
| 4 | + margin: 2px; | |
| 5 | +} | |
| 6 | + | |
| 7 | +.pessoa-links a { | |
| 8 | + /* | |
| 9 | + obs: no firefox, ao mostrar o elemento (.show, jquery), é setado display como block, | |
| 10 | + para reparar isto, após chamar .show(), chamar .css('display', 'inline'); | |
| 11 | + */ | |
| 12 | + | |
| 13 | + margin-right: 5px; | |
| 14 | +} | |
| 15 | + | |
| 16 | +#deficiencias_chzn ul { | |
| 17 | + width: 307px; | |
| 18 | +} | |
| 0 | 19 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Stylesheets/PessoaFisica.css
0 → 100644
| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | +/* Por alguma razão, no chrome ao mudar o width dos elementos eles recuam 2px */ | |
| 2 | +@media screen and (-webkit-min-device-pixel-ratio:0) { | |
| 3 | + select, | |
| 4 | + #data_emissao_certidao_civil, | |
| 5 | + #termo_certidao_civil, | |
| 6 | + #certidao_nascimento, | |
| 7 | + #carteira_trabalho, | |
| 8 | + #data_emissao_carteira_trabalho, | |
| 9 | + #titulo_eleitor, | |
| 10 | + #data_nasc, | |
| 11 | + #complemento { | |
| 12 | + margin-left: 2px; | |
| 13 | + } | |
| 14 | +} | |
| 15 | + | |
| 16 | +select { | |
| 17 | + width: 184px !important; | |
| 18 | +} | |
| 19 | + | |
| 20 | +#estado_civil_id { | |
| 21 | + width: 133px !important; | |
| 22 | +} | |
| 23 | + | |
| 24 | +#data_emissao_rg, #uf_emissao_rg { | |
| 25 | + width: 135px !important; | |
| 26 | +} | |
| 27 | + | |
| 28 | +#data_emissao_certidao_civil, #data_emissao_carteira_trabalho, #data_nasc { | |
| 29 | + width: 98px; | |
| 30 | +} | |
| 31 | + | |
| 32 | +#termo_certidao_civil { | |
| 33 | + width: 121px !important; | |
| 34 | +} | |
| 35 | + | |
| 36 | +#carteira_trabalho, #titulo_eleitor, #complemento { | |
| 37 | + width: 170px; | |
| 38 | +} | |
| 39 | + | |
| 40 | +#zona_localizacao { | |
| 41 | + width: 182px !important; | |
| 42 | +} | |
| 43 | + | |
| 44 | +.pessoa-links { | |
| 45 | + display: block; | |
| 46 | + padding: 5px; | |
| 47 | + margin: 2px; | |
| 48 | +} | |
| 49 | + | |
| 50 | +.pessoa-links a { | |
| 51 | + /* | |
| 52 | + obs: no firefox, ao mostrar o elemento (.show, jquery), é setado display como block, | |
| 53 | + para reparar isto, após chamar .show(), chamar .css('display', 'inline'); | |
| 54 | + */ | |
| 55 | + | |
| 56 | + margin-right: 5px; | |
| 57 | +} | |
| 0 | 58 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Stylesheets/Pessoatransporte.css
0 → 100644
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +.pessoa-links { | |
| 2 | + display: block; | |
| 3 | + padding: 5px; | |
| 4 | + margin: 2px; | |
| 5 | +} | |
| 6 | + | |
| 7 | +.pessoa-links a { | |
| 8 | + /* | |
| 9 | + obs: no firefox, ao mostrar o elemento (.show, jquery), é setado display como block, | |
| 10 | + para reparar isto, após chamar .show(), chamar .css('display', 'inline'); | |
| 11 | + */ | |
| 12 | + | |
| 13 | + margin-right: 5px; | |
| 14 | +} | |
| 15 | + | |
| 16 | +#deficiencias_chzn ul { | |
| 17 | + width: 307px; | |
| 18 | +} | |
| 0 | 19 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Stylesheets/Rota.css
0 → 100644
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +.pessoa-links { | |
| 2 | + display: block; | |
| 3 | + padding: 5px; | |
| 4 | + margin: 2px; | |
| 5 | +} | |
| 6 | + | |
| 7 | +.pessoa-links a { | |
| 8 | + /* | |
| 9 | + obs: no firefox, ao mostrar o elemento (.show, jquery), é setado display como block, | |
| 10 | + para reparar isto, após chamar .show(), chamar .css('display', 'inline'); | |
| 11 | + */ | |
| 12 | + | |
| 13 | + margin-right: 5px; | |
| 14 | +} | |
| 15 | + | |
| 16 | +#deficiencias_chzn ul { | |
| 17 | + width: 307px; | |
| 18 | +} | |
| 0 | 19 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Assets/Stylesheets/Veiculo.css
0 → 100644
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +.pessoa-links { | |
| 2 | + display: block; | |
| 3 | + padding: 5px; | |
| 4 | + margin: 2px; | |
| 5 | +} | |
| 6 | + | |
| 7 | +.pessoa-links a { | |
| 8 | + /* | |
| 9 | + obs: no firefox, ao mostrar o elemento (.show, jquery), é setado display como block, | |
| 10 | + para reparar isto, após chamar .show(), chamar .css('display', 'inline'); | |
| 11 | + */ | |
| 12 | + | |
| 13 | + margin-right: 5px; | |
| 14 | +} | |
| 15 | + | |
| 16 | +#deficiencias_chzn ul { | |
| 17 | + width: 307px; | |
| 18 | +} | |
| 0 | 19 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Views/EmpresaController.php
0 → 100644
| ... | ... | @@ -0,0 +1,111 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * i-Educar - Sistema de gestão escolar | |
| 7 | + * | |
| 8 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 9 | + * <ctima@itajai.sc.gov.br> | |
| 10 | + * | |
| 11 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 12 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 13 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 14 | + * qualquer versão posterior. | |
| 15 | + * | |
| 16 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 17 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 18 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 19 | + * do GNU para mais detalhes. | |
| 20 | + * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 22 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 23 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 24 | + * | |
| 25 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 26 | + * @category i-Educar | |
| 27 | + * @license @@license@@ | |
| 28 | + * @package TransporteEscolar | |
| 29 | + * @subpackage Modules | |
| 30 | + * @since Arquivo disponível desde a versão ? | |
| 31 | + * @version $Id$ | |
| 32 | + */ | |
| 33 | + | |
| 34 | +require_once 'lib/Portabilis/Controller/Page/EditController.php'; | |
| 35 | +require_once 'Usuario/Model/FuncionarioDataMapper.php'; | |
| 36 | + | |
| 37 | +class EmpresaController extends Portabilis_Controller_Page_EditController | |
| 38 | +{ | |
| 39 | + protected $_dataMapper = 'Usuario_Model_FuncionarioDataMapper'; | |
| 40 | + protected $_titulo = 'i-Educar - Empresas'; | |
| 41 | + | |
| 42 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; | |
| 43 | + protected $_processoAp = 21235; | |
| 44 | + | |
| 45 | + protected $_formMap = array( | |
| 46 | + 'pessoa' => array( | |
| 47 | + 'label' => 'Pessoa responsável', | |
| 48 | + 'help' => '', | |
| 49 | + ), | |
| 50 | + | |
| 51 | + 'observacao' => array( | |
| 52 | + 'label' => 'Observações', | |
| 53 | + 'help' => '', | |
| 54 | + ), | |
| 55 | + | |
| 56 | + 'id' => array( | |
| 57 | + 'label' => 'Código da empresa', | |
| 58 | + 'help' => '', | |
| 59 | + ), | |
| 60 | + | |
| 61 | + 'pessoaj' => array( | |
| 62 | + 'label' => 'Pessoa jurídica', | |
| 63 | + 'help' => '', | |
| 64 | + ) | |
| 65 | + ); | |
| 66 | + | |
| 67 | + | |
| 68 | + protected function _preConstruct() | |
| 69 | + { | |
| 70 | + $this->_options = $this->mergeOptions(array('edit_success' => '/intranet/transporte_empresa_lst.php','delete_success' => '/intranet/transporte_empresa_lst.php'), $this->_options); | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + protected function _initNovo() { | |
| 75 | + return false; | |
| 76 | + } | |
| 77 | + | |
| 78 | + | |
| 79 | + protected function _initEditar() { | |
| 80 | + return false; | |
| 81 | + } | |
| 82 | + | |
| 83 | + | |
| 84 | + public function Gerar() | |
| 85 | + { | |
| 86 | + $this->url_cancelar = '/intranet/transporte_empresa_lst.php'; | |
| 87 | + | |
| 88 | + // Código da empresa | |
| 89 | + $options = array('label' => $this->_getLabel('id'), 'disabled' => true, | |
| 90 | + 'required' => false, 'size' => 25); | |
| 91 | + $this->inputsHelper()->integer('id', $options); | |
| 92 | + | |
| 93 | + | |
| 94 | + $options = array('label' => $this->_getLabel('pessoaj'), 'required' => true); | |
| 95 | +// $this->inputsHelper()->integer('pessoaj', $options); | |
| 96 | + $this->inputsHelper()->simpleSearchPessoaj('pessoaj', $options); | |
| 97 | + | |
| 98 | + // nome | |
| 99 | + $options = array('label' => $this->_getLabel('pessoa'), 'size' => 68); | |
| 100 | + $this->inputsHelper()->simpleSearchPessoa('nome', $options); | |
| 101 | + | |
| 102 | + | |
| 103 | + // observações | |
| 104 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('observacao')), 'required' => false, 'size' => 50, 'max_length' => 253); | |
| 105 | + $this->inputsHelper()->textArea('observacao', $options); | |
| 106 | + | |
| 107 | + $this->loadResourceAssets($this->getDispatcher()); | |
| 108 | + } | |
| 109 | + | |
| 110 | +} | |
| 111 | +?> | |
| 0 | 112 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Views/ItinerarioController.php
0 → 100644
| ... | ... | @@ -0,0 +1,156 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * i-Educar - Sistema de gestão escolar | |
| 7 | + * | |
| 8 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 9 | + * <ctima@itajai.sc.gov.br> | |
| 10 | + * | |
| 11 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 12 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 13 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 14 | + * qualquer versão posterior. | |
| 15 | + * | |
| 16 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 17 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 18 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 19 | + * do GNU para mais detalhes. | |
| 20 | + * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 22 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 23 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 24 | + * | |
| 25 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 26 | + * @category i-Educar | |
| 27 | + * @license @@license@@ | |
| 28 | + * @package TransporteEscolar | |
| 29 | + * @subpackage Modules | |
| 30 | + * @since Arquivo disponível desde a versão ? | |
| 31 | + * @version $Id$ | |
| 32 | + */ | |
| 33 | + | |
| 34 | +require_once 'include/modules/clsModulesRotaTransporteEscolar.inc.php'; | |
| 35 | +require_once 'lib/Portabilis/Controller/Page/EditController.php'; | |
| 36 | +require_once 'Usuario/Model/FuncionarioDataMapper.php'; | |
| 37 | + | |
| 38 | +class ItinerarioController extends Portabilis_Controller_Page_EditController | |
| 39 | +{ | |
| 40 | + protected $_dataMapper = 'Usuario_Model_FuncionarioDataMapper'; | |
| 41 | + protected $_titulo = 'Cadastro de Rota'; | |
| 42 | + | |
| 43 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; | |
| 44 | + protected $_processoAp = 578; | |
| 45 | + protected $_deleteOption = false; | |
| 46 | + | |
| 47 | + protected $_formMap = array( | |
| 48 | + | |
| 49 | + 'id' => array( | |
| 50 | + 'label' => 'Código da rota', | |
| 51 | + 'help' => '', | |
| 52 | + ), | |
| 53 | + 'descricao' => array( | |
| 54 | + 'label' => 'Descrição', | |
| 55 | + 'help' => '', | |
| 56 | + ) | |
| 57 | + ); | |
| 58 | + | |
| 59 | + | |
| 60 | + protected function _preConstruct() | |
| 61 | + { | |
| 62 | + $this->_options = $this->mergeOptions(array('edit_success' => '/intranet/transporte_rota_lst.php','delete_sucess' => '/intranet/transporte_rota_lst.php'), $this->_options); | |
| 63 | + } | |
| 64 | + | |
| 65 | + | |
| 66 | + protected function _initNovo() { | |
| 67 | + return false; | |
| 68 | + } | |
| 69 | + | |
| 70 | + | |
| 71 | + protected function _initEditar() { | |
| 72 | + return false; | |
| 73 | + } | |
| 74 | + | |
| 75 | + | |
| 76 | + public function Gerar() | |
| 77 | + { | |
| 78 | + $id = (isset($_GET['id']) ? $_GET['id'] : 0) ; | |
| 79 | + if ($id==0 || !$this->verificaIdRota($id)) | |
| 80 | + header('Location: /intranet/transporte_rota_lst.php'); | |
| 81 | + | |
| 82 | + $this->url_cancelar = '/intranet/transporte_rota_det.php?cod_rota='.$id.''; | |
| 83 | + | |
| 84 | + // Código da rota | |
| 85 | + $options = array('label' => $this->_getLabel('id'), 'disabled' => true, | |
| 86 | + 'required' => false, 'size' => 25); | |
| 87 | + $this->inputsHelper()->integer('id', $options); | |
| 88 | + | |
| 89 | + // descricao | |
| 90 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('descricao')), 'disabled' => true, 'size' => 50, 'max_length' => 50); | |
| 91 | + $this->inputsHelper()->text('descricao', $options); | |
| 92 | + $resourceOptionsTable = " | |
| 93 | + <table id='disciplinas-manual'> | |
| 94 | + <tr> | |
| 95 | + <th>Ponto</th> | |
| 96 | + <th>Hora</th> | |
| 97 | + <th>Tipo</th> | |
| 98 | + <th>Veiculo</th> | |
| 99 | + | |
| 100 | + <th>Ação</th> | |
| 101 | + </tr> | |
| 102 | + <tr class='ponto'> | |
| 103 | + <td><input class='nome obrigatorio disable-on-search change-state-with-parent'></input></td> | |
| 104 | + <td><input class='nota' ></input></td> | |
| 105 | + <td> | |
| 106 | + <select id='disciplinas' name='disciplinas' class='obrigatorio disable-on-search'> | |
| 107 | + <option value=''>Selecione</option> | |
| 108 | + <option value='I'>Ida</option> | |
| 109 | + <option value='V'>Volta</option> | |
| 110 | + </select> | |
| 111 | + </td> | |
| 112 | + <td> | |
| 113 | + <input class='nome obrigatorio disable-on-search change-state-with-parent'></input> | |
| 114 | + </td> | |
| 115 | + | |
| 116 | + <td> | |
| 117 | + <a class='remove-disciplina-line' href='#'>Remover</a> | |
| 118 | + </td> | |
| 119 | + </tr> | |
| 120 | +<tr class='disciplina'> | |
| 121 | + <td><input class='nome obrigatorio disable-on-search change-state-with-parent'></input></td> | |
| 122 | + <td><input class='nota' ></input></td> | |
| 123 | + <td> | |
| 124 | + <select id='disciplinas' name='disciplinas' class='obrigatorio disable-on-search'> | |
| 125 | + <option value=''>Selecione</option> | |
| 126 | + <option value='I'>Ida</option> | |
| 127 | + <option value='V'>Volta</option> | |
| 128 | + </select> | |
| 129 | + </td> | |
| 130 | + <td> | |
| 131 | + <input class='nome obrigatorio disable-on-search change-state-with-parent'></input> | |
| 132 | + </td> | |
| 133 | + | |
| 134 | + <td> | |
| 135 | + <a class='remove-disciplina-line' href='#'>Remover</a> | |
| 136 | + </td> | |
| 137 | + </tr> | |
| 138 | + <tr class='actions'> | |
| 139 | + <td colspan='4'> | |
| 140 | + <input type='button' class='action' id='new-disciplina-line' name='new-line' value='Adicionar ponto'></input> | |
| 141 | + </td> | |
| 142 | + </tr> | |
| 143 | + </table>"; | |
| 144 | + | |
| 145 | + $this->appendOutput($resourceOptionsTable); | |
| 146 | + | |
| 147 | + //$this->loadResourceAssets($this->getDispatcher()); | |
| 148 | + } | |
| 149 | + | |
| 150 | + function verificaIdRota($id){ | |
| 151 | + $obj = new clsModulesRotaTransporteEscolar($id); | |
| 152 | + return $obj->existe(); | |
| 153 | + } | |
| 154 | + | |
| 155 | +} | |
| 156 | +?> | |
| 0 | 157 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Views/MotoristaController.php
0 → 100644
| ... | ... | @@ -0,0 +1,146 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * i-Educar - Sistema de gestão escolar | |
| 7 | + * | |
| 8 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 9 | + * <ctima@itajai.sc.gov.br> | |
| 10 | + * | |
| 11 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 12 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 13 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 14 | + * qualquer versão posterior. | |
| 15 | + * | |
| 16 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 17 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 18 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 19 | + * do GNU para mais detalhes. | |
| 20 | + * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 22 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 23 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 24 | + * | |
| 25 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 26 | + * @category i-Educar | |
| 27 | + * @license @@license@@ | |
| 28 | + * @package TransporteEscolar | |
| 29 | + * @subpackage Modules | |
| 30 | + * @since Arquivo disponível desde a versão ? | |
| 31 | + * @version $Id$ | |
| 32 | + */ | |
| 33 | +require_once 'lib/Portabilis/Controller/Page/EditController.php'; | |
| 34 | +require_once 'Usuario/Model/FuncionarioDataMapper.php'; | |
| 35 | + | |
| 36 | +class MotoristaController extends Portabilis_Controller_Page_EditController | |
| 37 | +{ | |
| 38 | + protected $_dataMapper = 'Usuario_Model_FuncionarioDataMapper'; | |
| 39 | + protected $_titulo = 'i-Educar - Motoristas'; | |
| 40 | + | |
| 41 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; | |
| 42 | + protected $_processoAp = 21236; | |
| 43 | + protected $_deleteOption = true; | |
| 44 | + | |
| 45 | + protected $_formMap = array( | |
| 46 | + 'id' => array( | |
| 47 | + 'label' => 'Código do motorista', | |
| 48 | + 'help' => '', | |
| 49 | + ), | |
| 50 | + | |
| 51 | + 'pessoa' => array( | |
| 52 | + 'label' => 'Pessoa', | |
| 53 | + 'help' => '', | |
| 54 | + ), | |
| 55 | + | |
| 56 | + 'cnh' => array( | |
| 57 | + 'label' => 'CNH', | |
| 58 | + 'help' => '', | |
| 59 | + ), | |
| 60 | + | |
| 61 | + 'tipo_cnh' =>array( | |
| 62 | + 'label' => 'Categoria CNH', | |
| 63 | + 'help' => '', | |
| 64 | + ), | |
| 65 | + | |
| 66 | + 'dt_habilitacao' =>array( | |
| 67 | + 'label' => 'Data da habilitação', | |
| 68 | + 'help' => '', | |
| 69 | + ), | |
| 70 | + | |
| 71 | + 'vencimento_cnh' =>array( | |
| 72 | + 'label' => 'Vencimento da habilitação', | |
| 73 | + 'help' => '', | |
| 74 | + ), | |
| 75 | + | |
| 76 | + 'ref_cod_empresa_transporte_escolar' =>array( | |
| 77 | + 'label' => 'Empresa', | |
| 78 | + 'help' => '', | |
| 79 | + ), | |
| 80 | + | |
| 81 | + 'observacao' =>array( | |
| 82 | + 'label' => 'Observações', | |
| 83 | + 'help' => '', | |
| 84 | + ) | |
| 85 | + | |
| 86 | + ); | |
| 87 | + | |
| 88 | + | |
| 89 | + protected function _preConstruct() | |
| 90 | + { | |
| 91 | + $this->_options = $this->mergeOptions(array('edit_success' => '/intranet/transporte_motorista_lst.php','delete_success' => '/intranet/transporte_motorista_lst.php'), $this->_options); | |
| 92 | + } | |
| 93 | + | |
| 94 | + | |
| 95 | + protected function _initNovo() { | |
| 96 | + return false; | |
| 97 | + } | |
| 98 | + | |
| 99 | + | |
| 100 | + protected function _initEditar() { | |
| 101 | + return false; | |
| 102 | + } | |
| 103 | + | |
| 104 | + | |
| 105 | + public function Gerar() | |
| 106 | + { | |
| 107 | + $this->url_cancelar = '/intranet/transporte_motorista_lst.php'; | |
| 108 | + | |
| 109 | + // Código do Motorista | |
| 110 | + $options = array('label' => $this->_getLabel('id'), 'disabled' => true, | |
| 111 | + 'required' => false, 'size' => 25); | |
| 112 | + $this->inputsHelper()->integer('id', $options); | |
| 113 | + | |
| 114 | + // nome | |
| 115 | + $options = array('label' => $this->_getLabel('pessoa'), 'size' => 50); | |
| 116 | + $this->inputsHelper()->simpleSearchPessoa('nome', $options); | |
| 117 | + | |
| 118 | + //número da CNH | |
| 119 | + $options = array('label' => $this->_getLabel('cnh'), 'max_length' => 15, 'size' => 15, 'placeholder' => Portabilis_String_Utils::toLatin1('Número da CNH'), 'required' => true); | |
| 120 | + $this->inputsHelper()->integer('cnh',$options); | |
| 121 | + | |
| 122 | + //Categoria da CNH | |
| 123 | + $options = array('label' => $this->_getLabel('tipo_cnh'), 'max_length' => 2, 'size' => 1, 'placeholder' => '', 'required' => true); | |
| 124 | + $this->inputsHelper()->text('tipo_cnh',$options); | |
| 125 | + | |
| 126 | + // Vencimento | |
| 127 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('dt_habilitacao')), 'required' => false, 'size' => 10, 'placeholder' => ''); | |
| 128 | + $this->inputsHelper()->date('dt_habilitacao',$options); | |
| 129 | + | |
| 130 | + // Habilitação | |
| 131 | + $options = array('label' =>Portabilis_String_Utils::toLatin1($this->_getLabel('vencimento_cnh')), 'required' => false, 'size' => 10,'placeholder' => ''); | |
| 132 | + $this->inputsHelper()->date('vencimento_cnh',$options); | |
| 133 | + | |
| 134 | + // Codigo da empresa | |
| 135 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('ref_cod_empresa_transporte_escolar')), 'required' => true); | |
| 136 | + $this->inputsHelper()->simpleSearchEmpresa('ref_cod_empresa_transporte_escolarf', $options); | |
| 137 | + | |
| 138 | + // observações | |
| 139 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('observacao')), 'required' => false, 'size' => 50, 'max_length' => 255); | |
| 140 | + $this->inputsHelper()->textArea('observacao', $options); | |
| 141 | + | |
| 142 | + $this->loadResourceAssets($this->getDispatcher()); | |
| 143 | + } | |
| 144 | + | |
| 145 | +} | |
| 146 | +?> | |
| 0 | 147 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Views/PessoatransporteController.php
0 → 100644
| ... | ... | @@ -0,0 +1,141 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * i-Educar - Sistema de gestão escolar | |
| 7 | + * | |
| 8 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 9 | + * <ctima@itajai.sc.gov.br> | |
| 10 | + * | |
| 11 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 12 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 13 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 14 | + * qualquer versão posterior. | |
| 15 | + * | |
| 16 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 17 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 18 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 19 | + * do GNU para mais detalhes. | |
| 20 | + * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 22 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 23 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 24 | + * | |
| 25 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 26 | + * @category i-Educar | |
| 27 | + * @license @@license@@ | |
| 28 | + * @package TransporteEscolar | |
| 29 | + * @subpackage Modules | |
| 30 | + * @since Arquivo disponível desde a versão ? | |
| 31 | + * @version $Id$ | |
| 32 | + */ | |
| 33 | + | |
| 34 | +require_once 'lib/Portabilis/Controller/Page/EditController.php'; | |
| 35 | +require_once 'Usuario/Model/FuncionarioDataMapper.php'; | |
| 36 | +require_once 'include/modules/clsModulesRotaTransporteEscolar.inc.php'; | |
| 37 | +require_once ("include/clsBanco.inc.php"); | |
| 38 | + | |
| 39 | +class PessoatransporteController extends Portabilis_Controller_Page_EditController | |
| 40 | +{ | |
| 41 | + protected $_dataMapper = 'Usuario_Model_FuncionarioDataMapper'; | |
| 42 | + protected $_titulo = 'i-Educar - Usuários de transporte'; | |
| 43 | + | |
| 44 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; | |
| 45 | + protected $_processoAp = 21240; | |
| 46 | + protected $_deleteOption = true; | |
| 47 | + | |
| 48 | + protected $_formMap = array( | |
| 49 | + | |
| 50 | + 'id' => array( | |
| 51 | + 'label' => 'Código', | |
| 52 | + 'help' => '', | |
| 53 | + ), | |
| 54 | + 'pessoa' => array( | |
| 55 | + 'label' => 'Pessoa', | |
| 56 | + 'help' => '', | |
| 57 | + ), | |
| 58 | + 'rota' => array( | |
| 59 | + 'label' => 'Rota', | |
| 60 | + 'help' => '', | |
| 61 | + ), | |
| 62 | + 'ponto' => array( | |
| 63 | + 'label' => 'Ponto de embarque', | |
| 64 | + 'help' => '', | |
| 65 | + ), | |
| 66 | + 'destino' => array( | |
| 67 | + 'label' => 'Destino (Caso for diferente da rota)', | |
| 68 | + 'help' => '', | |
| 69 | + ), | |
| 70 | + 'observacao' => array( | |
| 71 | + 'label' => 'Observações', | |
| 72 | + 'help' => '', | |
| 73 | + ), | |
| 74 | + ); | |
| 75 | + | |
| 76 | + | |
| 77 | + protected function _preConstruct() | |
| 78 | + { | |
| 79 | + $this->_options = $this->mergeOptions(array('edit_success' => '/intranet/transporte_pessoa_lst.php','delete_success' => '/intranet/transporte_pessoa_lst.php'), $this->_options); | |
| 80 | + } | |
| 81 | + | |
| 82 | + | |
| 83 | + protected function _initNovo() { | |
| 84 | + return false; | |
| 85 | + } | |
| 86 | + | |
| 87 | + | |
| 88 | + protected function _initEditar() { | |
| 89 | + return false; | |
| 90 | + } | |
| 91 | + | |
| 92 | + | |
| 93 | + public function Gerar() | |
| 94 | + { | |
| 95 | + $this->url_cancelar = '/intranet/transporte_pessoa_lst.php'; | |
| 96 | + | |
| 97 | + // Código do vinculo | |
| 98 | + $options = array('label' => $this->_getLabel('id'), 'disabled' => true, | |
| 99 | + 'required' => false, 'size' => 25); | |
| 100 | + $this->inputsHelper()->integer('id', $options); | |
| 101 | + | |
| 102 | + // Pessoa | |
| 103 | + $options = array('label' =>Portabilis_String_Utils::toLatin1($this->_getLabel('pessoa')), 'required' => true); | |
| 104 | + $this->inputsHelper()->simpleSearchPessoa('nome',$options); | |
| 105 | + | |
| 106 | + // Montar o inputsHelper->select \/ | |
| 107 | + // Cria lista de rotas | |
| 108 | + $obj_rota = new clsModulesRotaTransporteEscolar(); | |
| 109 | + $obj_rota->setOrderBy(' descricao asc '); | |
| 110 | + $lista_rota = $obj_rota->lista(); | |
| 111 | + $rota_resources = array("" => "Selecione uma rota" ); | |
| 112 | + foreach ($lista_rota as $reg) { | |
| 113 | + $rota_resources["{$reg['cod_rota_transporte_escolar']}"] = "{$reg['descricao']}"; | |
| 114 | + } | |
| 115 | + | |
| 116 | + // Rota | |
| 117 | + $options = array('label' =>Portabilis_String_Utils::toLatin1($this->_getLabel('rota')), 'required' => true, 'resources' => $rota_resources); | |
| 118 | + $this->inputsHelper()->select('rota',$options); | |
| 119 | + | |
| 120 | + // Ponto de Embarque | |
| 121 | + $options = array('label' =>Portabilis_String_Utils::toLatin1($this->_getLabel('ponto')), 'required' => false, 'resources' => array("" => "Selecione uma rota acima")); | |
| 122 | + $this->inputsHelper()->select('ponto',$options); | |
| 123 | + | |
| 124 | + // Destino | |
| 125 | + $options = array('label' =>Portabilis_String_Utils::toLatin1($this->_getLabel('destino')), 'required' => false); | |
| 126 | + $this->inputsHelper()->simpleSearchPessoaj('destino',$options); | |
| 127 | + | |
| 128 | + // observacoes | |
| 129 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('observacao')), 'required' => false, 'size' => 50, 'max_length' => 255); | |
| 130 | + $this->inputsHelper()->textArea('observacao', $options); | |
| 131 | + | |
| 132 | + | |
| 133 | + $this->loadResourceAssets($this->getDispatcher()); | |
| 134 | + } | |
| 135 | + | |
| 136 | + function Excluir(){ | |
| 137 | + die( $this->getOption('delete_success') ); | |
| 138 | + } | |
| 139 | + | |
| 140 | +} | |
| 141 | +?> | |
| 0 | 142 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Views/PontoController.php
0 → 100644
| ... | ... | @@ -0,0 +1,92 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * i-Educar - Sistema de gestão escolar | |
| 7 | + * | |
| 8 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 9 | + * <ctima@itajai.sc.gov.br> | |
| 10 | + * | |
| 11 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 12 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 13 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 14 | + * qualquer versão posterior. | |
| 15 | + * | |
| 16 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 17 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 18 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 19 | + * do GNU para mais detalhes. | |
| 20 | + * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 22 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 23 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 24 | + * | |
| 25 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 26 | + * @category i-Educar | |
| 27 | + * @license @@license@@ | |
| 28 | + * @package TransporteEscolar | |
| 29 | + * @subpackage Modules | |
| 30 | + * @since Arquivo disponível desde a versão ? | |
| 31 | + * @version $Id$ | |
| 32 | + */ | |
| 33 | + | |
| 34 | +require_once 'lib/Portabilis/Controller/Page/EditController.php'; | |
| 35 | +require_once 'Usuario/Model/FuncionarioDataMapper.php'; | |
| 36 | + | |
| 37 | +class PontoController extends Portabilis_Controller_Page_EditController | |
| 38 | +{ | |
| 39 | + protected $_dataMapper = 'Usuario_Model_FuncionarioDataMapper'; | |
| 40 | + protected $_titulo = 'i-Educar - Pontos'; | |
| 41 | + | |
| 42 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; | |
| 43 | + protected $_processoAp = 21239; | |
| 44 | + | |
| 45 | + protected $_formMap = array( | |
| 46 | + | |
| 47 | + 'id' => array( | |
| 48 | + 'label' => 'Código do ponto', | |
| 49 | + 'help' => '', | |
| 50 | + ), | |
| 51 | + 'desc' => array( | |
| 52 | + 'label' => 'Descrição', | |
| 53 | + 'help' => '', | |
| 54 | + ) | |
| 55 | + ); | |
| 56 | + | |
| 57 | + | |
| 58 | + protected function _preConstruct() | |
| 59 | + { | |
| 60 | + $this->_options = $this->mergeOptions(array('edit_success' => '/intranet/transporte_ponto_lst.php','delete_success' => '/intranet/transporte_ponto_lst.php'), $this->_options); | |
| 61 | + } | |
| 62 | + | |
| 63 | + | |
| 64 | + protected function _initNovo() { | |
| 65 | + return false; | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + protected function _initEditar() { | |
| 70 | + return false; | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + public function Gerar() | |
| 75 | + { | |
| 76 | + $this->url_cancelar = '/intranet/transporte_ponto_lst.php'; | |
| 77 | + | |
| 78 | + // Código do ponto | |
| 79 | + $options = array('label' => $this->_getLabel('id'), 'disabled' => true, | |
| 80 | + 'required' => false, 'size' => 25); | |
| 81 | + $this->inputsHelper()->integer('id', $options); | |
| 82 | + | |
| 83 | + // descricao | |
| 84 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('desc')), 'required' => true, 'size' => 50, 'max_length' => 70); | |
| 85 | + $this->inputsHelper()->text('desc', $options); | |
| 86 | + | |
| 87 | + | |
| 88 | + $this->loadResourceAssets($this->getDispatcher()); | |
| 89 | + } | |
| 90 | + | |
| 91 | +} | |
| 92 | +?> | |
| 0 | 93 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Views/ProcessoController.php
0 → 100644
| ... | ... | @@ -0,0 +1,112 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * i-Educar - Sistema de gestão escolar | |
| 7 | + * | |
| 8 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 9 | + * <ctima@itajai.sc.gov.br> | |
| 10 | + * | |
| 11 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 12 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 13 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 14 | + * qualquer versão posterior. | |
| 15 | + * | |
| 16 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 17 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 18 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 19 | + * do GNU para mais detalhes. | |
| 20 | + * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 22 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 23 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 24 | + * | |
| 25 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 26 | + * @category i-Educar | |
| 27 | + * @license @@license@@ | |
| 28 | + * @package TransporteEscolar | |
| 29 | + * @subpackage Modules | |
| 30 | + * @since Arquivo disponível desde a versão ? | |
| 31 | + * @version $Id$ | |
| 32 | + */ | |
| 33 | +require_once 'lib/Portabilis/Controller/Page/EditController.php'; | |
| 34 | +require_once 'Usuario/Model/FuncionarioDataMapper.php'; | |
| 35 | +require_once 'Avaliacao/Views/DiarioApiController.php'; | |
| 36 | +require_once 'include/pmieducar/clsPmieducarMatriculaTurma.inc.php'; | |
| 37 | +require_once 'include/pmieducar/clsPmieducarEscola.inc.php'; | |
| 38 | + | |
| 39 | +class ProcessoController extends Portabilis_Controller_Page_EditController | |
| 40 | +{ | |
| 41 | + protected $_dataMapper = 'Usuario_Model_FuncionarioDataMapper'; | |
| 42 | + protected $_titulo = 'i-Educar - Processo'; | |
| 43 | + | |
| 44 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; | |
| 45 | + protected $_processoAp = 21236; | |
| 46 | + protected $_deleteOption = true; | |
| 47 | + | |
| 48 | + protected $_formMap = array( | |
| 49 | + ); | |
| 50 | + | |
| 51 | + | |
| 52 | + protected function _preConstruct() | |
| 53 | + { | |
| 54 | + } | |
| 55 | + | |
| 56 | + | |
| 57 | + protected function _initNovo() { | |
| 58 | + return false; | |
| 59 | + } | |
| 60 | + | |
| 61 | + | |
| 62 | + protected function _initEditar() { | |
| 63 | + return false; | |
| 64 | + } | |
| 65 | + | |
| 66 | + | |
| 67 | + public function Gerar() | |
| 68 | + { | |
| 69 | + | |
| 70 | + | |
| 71 | + /* $objEscola = new clsPmieducarEscola(); | |
| 72 | + | |
| 73 | + $listaEscola = $objEscola->lista($int_cod_escola = NULL, $int_ref_usuario_cad = NULL, | |
| 74 | + $int_ref_usuario_exc = NULL, $int_ref_cod_instituicao = NULL, | |
| 75 | + $int_ref_cod_escola_localizacao = NULL, $int_ref_cod_escola_rede_ensino = NULL, | |
| 76 | + $int_ref_idpes = NULL, $str_sigla = NULL, $date_data_cadastro = NULL, | |
| 77 | + $date_data_exclusao = NULL, $int_ativo = 1, $str_nome = NULL, | |
| 78 | + $escola_sem_avaliacao = NULL); | |
| 79 | + | |
| 80 | + foreach ($listaEscola as $regEscola) { | |
| 81 | + */ | |
| 82 | + $objMat = new clsPmieducarMatriculaTurma(); | |
| 83 | + $objMat->setOrderBy(' ref_cod_turma ASC '); | |
| 84 | + $lista = $objMat->lista($int_ref_cod_matricula = NULL, $int_ref_cod_turma = NULL, | |
| 85 | + $int_ref_usuario_exc = NULL, $int_ref_usuario_cad = NULL, | |
| 86 | + $date_data_cadastro_ini = NULL, $date_data_cadastro_fim = NULL, | |
| 87 | + $date_data_exclusao_ini = NULL, $date_data_exclusao_fim = NULL, $int_ativo = 1, | |
| 88 | + $int_ref_cod_serie = NULL, $int_ref_cod_curso = NULL, $int_ref_cod_escola = 13170, //$regEscola['cod_escola'], | |
| 89 | + $int_ref_cod_instituicao = NULL, $int_ref_cod_aluno = NULL, $mes = NULL, | |
| 90 | + $aprovado = 3, $mes_menor_que = NULL, $int_sequencial = NULL, | |
| 91 | + $int_ano_matricula = 2013, $tem_avaliacao = NULL, $bool_get_nome_aluno = FALSE, | |
| 92 | + $bool_aprovados_reprovados = NULL, $int_ultima_matricula = 1, | |
| 93 | + $bool_matricula_ativo = TRUE, $bool_escola_andamento = TRUE, | |
| 94 | + $mes_matricula_inicial = FALSE, $get_serie_mult = FALSE, | |
| 95 | + $int_ref_cod_serie_mult = NULL, $int_semestre = NULL, | |
| 96 | + $pegar_ano_em_andamento = TRUE, $parar=NULL); | |
| 97 | + | |
| 98 | + foreach ($lista as $reg) { | |
| 99 | + $objDiario = null; | |
| 100 | + $objDiario = new DiarioApiController(); | |
| 101 | + $objDiario->_currentMatriculaId = $reg['ref_cod_matricula']; | |
| 102 | + $objDiario->processaNotasNecessarias($reg['ref_cod_matricula']); | |
| 103 | + } | |
| 104 | + | |
| 105 | + die('lol fez todas de uma escola *_*'); | |
| 106 | + //} | |
| 107 | + die('Notas de exame de todas as matrículas processadas.'); | |
| 108 | + | |
| 109 | + } | |
| 110 | + | |
| 111 | +} | |
| 112 | +?> | |
| 0 | 113 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Views/RotaController.php
0 → 100644
| ... | ... | @@ -0,0 +1,157 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * i-Educar - Sistema de gestão escolar | |
| 7 | + * | |
| 8 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 9 | + * <ctima@itajai.sc.gov.br> | |
| 10 | + * | |
| 11 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 12 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 13 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 14 | + * qualquer versão posterior. | |
| 15 | + * | |
| 16 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 17 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 18 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 19 | + * do GNU para mais detalhes. | |
| 20 | + * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 22 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 23 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 24 | + * | |
| 25 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 26 | + * @category i-Educar | |
| 27 | + * @license @@license@@ | |
| 28 | + * @package TransporteEscolar | |
| 29 | + * @subpackage Modules | |
| 30 | + * @since Arquivo disponível desde a versão ?21238 | |
| 31 | + * @version $Id$ | |
| 32 | + */ | |
| 33 | + | |
| 34 | +require_once 'lib/Portabilis/Controller/Page/EditController.php'; | |
| 35 | +require_once 'Usuario/Model/FuncionarioDataMapper.php'; | |
| 36 | + | |
| 37 | +class RotaController extends Portabilis_Controller_Page_EditController | |
| 38 | +{ | |
| 39 | + protected $_dataMapper = 'Usuario_Model_FuncionarioDataMapper'; | |
| 40 | + protected $_titulo = 'i-Educar - Rotas'; | |
| 41 | + | |
| 42 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; | |
| 43 | + protected $_processoAp = 21238; | |
| 44 | + | |
| 45 | + protected $_formMap = array( | |
| 46 | + | |
| 47 | + 'id' => array( | |
| 48 | + 'label' => 'Código da rota', | |
| 49 | + 'help' => '', | |
| 50 | + ), | |
| 51 | + 'desc' => array( | |
| 52 | + 'label' => 'Descrição', | |
| 53 | + 'help' => '', | |
| 54 | + ), | |
| 55 | + 'ref_idpes_destino' => array( | |
| 56 | + 'label' => 'Instituição destino', | |
| 57 | + 'help' => '', | |
| 58 | + ), | |
| 59 | + 'ano' => array( | |
| 60 | + 'label' => 'Ano', | |
| 61 | + 'help' => '', | |
| 62 | + ), | |
| 63 | + 'tipo_rota' => array( | |
| 64 | + 'label' => 'Tipo da rota', | |
| 65 | + 'help' => '', | |
| 66 | + ), | |
| 67 | + 'km_pav' => array( | |
| 68 | + 'label' => 'Km pavimentados', | |
| 69 | + 'help' => '', | |
| 70 | + ), | |
| 71 | + 'km_npav' => array( | |
| 72 | + 'label' => 'Km não pavimentados', | |
| 73 | + 'help' => '', | |
| 74 | + ), | |
| 75 | + 'ref_cod_empresa_transporte_escolar' => array( | |
| 76 | + 'label' => 'Empresa', | |
| 77 | + 'help' => '', | |
| 78 | + ), | |
| 79 | + 'tercerizado' => array( | |
| 80 | + 'label' => 'Terceirizado', | |
| 81 | + 'help' => '', | |
| 82 | + ) | |
| 83 | + ); | |
| 84 | + | |
| 85 | + | |
| 86 | + protected function _preConstruct() | |
| 87 | + { | |
| 88 | + $this->_options = $this->mergeOptions(array('edit_success' => '/intranet/transporte_rota_lst.php','delete_success' => '/intranet/transporte_rota_lst.php'), $this->_options); | |
| 89 | + } | |
| 90 | + | |
| 91 | + | |
| 92 | + protected function _initNovo() { | |
| 93 | + return false; | |
| 94 | + } | |
| 95 | + | |
| 96 | + | |
| 97 | + protected function _initEditar() { | |
| 98 | + return false; | |
| 99 | + } | |
| 100 | + | |
| 101 | + | |
| 102 | + public function Gerar() | |
| 103 | + { | |
| 104 | + $this->url_cancelar = '/intranet/transporte_rota_lst.php'; | |
| 105 | + | |
| 106 | + // ano | |
| 107 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('ano')), 'required' => true, 'size' => 5, 'max_length' => 4); | |
| 108 | + $this->inputsHelper()->integer('ano', $options); | |
| 109 | + | |
| 110 | + // Código da rota | |
| 111 | + $options = array('label' => $this->_getLabel('id'), 'disabled' => true, | |
| 112 | + 'required' => false, 'size' => 25); | |
| 113 | + $this->inputsHelper()->integer('id', $options); | |
| 114 | + | |
| 115 | + // descricao | |
| 116 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('desc')), 'required' => true, 'size' => 50, 'max_length' => 50); | |
| 117 | + $this->inputsHelper()->text('desc', $options); | |
| 118 | + | |
| 119 | + // Destino | |
| 120 | + $options = array('label' => $this->_getLabel('ref_idpes_destino'), 'required' => true, 'size' => 50); | |
| 121 | + $this->inputsHelper()->simpleSearchPessoaj('ref_idpes_destino', $options); | |
| 122 | + | |
| 123 | + | |
| 124 | + // Empresa rota | |
| 125 | + $options = array('label' => $this->_getLabel('ref_cod_empresa_transporte_escolar'), 'required' => true, 'size' => 50); | |
| 126 | + $this->inputsHelper()->simpleSearchEmpresa('ref_cod_empresa_transporte_escolar', $options); | |
| 127 | + | |
| 128 | + // Tipo | |
| 129 | + $tipos = array(null => 'Selecione um tipo', 'U' => 'Urbana', | |
| 130 | + 'R' => 'Rural'); | |
| 131 | + | |
| 132 | + $options = array('label' => $this->_getLabel('tipo_rota'), | |
| 133 | + 'resources' => $tipos, | |
| 134 | + 'required' => true); | |
| 135 | + | |
| 136 | + $this->inputsHelper()->select('tipo_rota', $options); | |
| 137 | + | |
| 138 | + // km pavimentados | |
| 139 | + $options = array('label' => $this->_getLabel('km_pav'), 'required' => false, 'size' => 9, 'max_length' => 10, 'placeholder' => ''); | |
| 140 | + $this->inputsHelper()->numeric('km_pav', $options); | |
| 141 | + | |
| 142 | + // km não pavimentados | |
| 143 | + $options = array('label' => $this->_getLabel('km_npav'), 'required' => false, 'size' => 9, 'max_length' => 10, 'placeholder' => ''); | |
| 144 | + $this->inputsHelper()->numeric('km_npav', $options); | |
| 145 | + | |
| 146 | + // Tercerizado | |
| 147 | + $options = array('label' => $this->_getLabel('tercerizado')); | |
| 148 | + $this->inputsHelper()->checkbox('tercerizado', $options); | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + $this->loadResourceAssets($this->getDispatcher()); | |
| 154 | + } | |
| 155 | + | |
| 156 | +} | |
| 157 | +?> | |
| 0 | 158 | \ No newline at end of file | ... | ... |
ieducar/modules/TransporteEscolar/Views/VeiculoController.php
0 → 100644
| ... | ... | @@ -0,0 +1,269 @@ |
| 1 | +<?php | |
| 2 | +#error_reporting(E_ALL); | |
| 3 | +#ini_set("display_errors", 1); | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * i-Educar - Sistema de gestão escolar | |
| 7 | + * | |
| 8 | + * Copyright (C) 2006 Prefeitura Municipal de Itajaí | |
| 9 | + * <ctima@itajai.sc.gov.br> | |
| 10 | + * | |
| 11 | + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo | |
| 12 | + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free | |
| 13 | + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) | |
| 14 | + * qualquer versão posterior. | |
| 15 | + * | |
| 16 | + * Este programa é distribuído na expectativa de que seja útil, porém, SEM | |
| 17 | + * NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE OU | |
| 18 | + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral | |
| 19 | + * do GNU para mais detalhes. | |
| 20 | + * | |
| 21 | + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto | |
| 22 | + * com este programa; se não, escreva para a Free Software Foundation, Inc., no | |
| 23 | + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 24 | + * | |
| 25 | + * @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | |
| 26 | + * @category i-Educar | |
| 27 | + * @license @@license@@ | |
| 28 | + * @package TransporteEscolar | |
| 29 | + * @subpackage Modules | |
| 30 | + * @since Arquivo disponível desde a versão ? | |
| 31 | + * @version $Id$ | |
| 32 | + */ | |
| 33 | +require_once 'lib/Portabilis/Controller/Page/EditController.php'; | |
| 34 | +require_once 'Usuario/Model/FuncionarioDataMapper.php'; | |
| 35 | +require_once 'include/modules/clsModulesTipoVeiculo.inc.php'; | |
| 36 | + | |
| 37 | +class VeiculoController extends Portabilis_Controller_Page_EditController | |
| 38 | +{ | |
| 39 | + protected $_dataMapper = 'Usuario_Model_FuncionarioDataMapper'; | |
| 40 | + protected $_titulo = 'i-Educar - Motoristas'; | |
| 41 | + | |
| 42 | + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; | |
| 43 | + protected $_processoAp = 21237; | |
| 44 | + | |
| 45 | + protected $_formMap = array( | |
| 46 | + 'id' => array( | |
| 47 | + 'label' => 'Código do veículo', | |
| 48 | + 'help' => '', | |
| 49 | + ), | |
| 50 | + | |
| 51 | + 'descricao' => array( | |
| 52 | + 'label' => 'Descrição', | |
| 53 | + 'help' => '', | |
| 54 | + ), | |
| 55 | + | |
| 56 | + 'placa' => array( | |
| 57 | + 'label' => 'Placa', | |
| 58 | + 'help' => '', | |
| 59 | + ), | |
| 60 | + | |
| 61 | + 'renavam' => array( | |
| 62 | + 'label' => 'Renavam', | |
| 63 | + 'help' => '', | |
| 64 | + ), | |
| 65 | + | |
| 66 | + 'chassi' => array( | |
| 67 | + 'label' => 'Chassi', | |
| 68 | + 'help' => '', | |
| 69 | + ), | |
| 70 | + | |
| 71 | + 'marca' => array( | |
| 72 | + 'label' => 'Marca', | |
| 73 | + 'help' => '', | |
| 74 | + ), | |
| 75 | + | |
| 76 | + 'ano_fabricacao' => array( | |
| 77 | + 'label' => 'Ano fabricação', | |
| 78 | + 'help' => '', | |
| 79 | + ), | |
| 80 | + | |
| 81 | + 'ano_modelo' => array( | |
| 82 | + 'label' => 'Ano modelo', | |
| 83 | + 'help' => '', | |
| 84 | + ), | |
| 85 | + | |
| 86 | + 'passageiros' => array( | |
| 87 | + 'label' => 'Limite de passageiros', | |
| 88 | + 'help' => '', | |
| 89 | + ), | |
| 90 | + | |
| 91 | + 'tipo' => array( | |
| 92 | + 'label' => 'Categoria', | |
| 93 | + 'help' => '', | |
| 94 | + ), | |
| 95 | + | |
| 96 | + | |
| 97 | + 'malha' => array( | |
| 98 | + 'label' => 'Malha', | |
| 99 | + 'help' => '', | |
| 100 | + ), | |
| 101 | + | |
| 102 | + 'abrangencia' => array( | |
| 103 | + 'label' => 'Abrangência', | |
| 104 | + 'help' => '', | |
| 105 | + ), | |
| 106 | + | |
| 107 | + 'exclusivo_transporte_escolar' => array( | |
| 108 | + 'label' => 'Exclusivo para transporte escolar', | |
| 109 | + 'help' => '', | |
| 110 | + ), | |
| 111 | + | |
| 112 | + 'adaptado_necessidades_especiais' => array( | |
| 113 | + 'label' => 'Adaptado para pessoas com necessidades especiais', | |
| 114 | + 'help' => '', | |
| 115 | + ), | |
| 116 | + | |
| 117 | + 'tercerizado' => array( | |
| 118 | + 'label' => 'Tercerizado', | |
| 119 | + 'help' => '', | |
| 120 | + ), | |
| 121 | + | |
| 122 | + 'ativo' =>array( | |
| 123 | + 'label' => 'Ativo', | |
| 124 | + 'help' => '', | |
| 125 | + ), | |
| 126 | + | |
| 127 | + 'descricao_inativo' =>array( | |
| 128 | + 'label' => 'Descrição de inatividade', | |
| 129 | + 'help' => '', | |
| 130 | + ), | |
| 131 | + | |
| 132 | + 'empresa' =>array( | |
| 133 | + 'label' => 'Empresa', | |
| 134 | + 'help' => '', | |
| 135 | + ), | |
| 136 | + | |
| 137 | + 'motorista' =>array( | |
| 138 | + 'label' => 'Motorista responsável', | |
| 139 | + 'help' => '', | |
| 140 | + ), | |
| 141 | + | |
| 142 | + 'observacao' =>array( | |
| 143 | + 'label' => 'Observações', | |
| 144 | + 'help' => '', | |
| 145 | + ) | |
| 146 | + | |
| 147 | + ); | |
| 148 | + | |
| 149 | + | |
| 150 | + protected function _preConstruct() | |
| 151 | + { | |
| 152 | + $this->_options = $this->mergeOptions(array('edit_success' => '/intranet/transporte_veiculo_lst.php','delete_success' => '/intranet/transporte_veiculo_lst.php'), $this->_options); | |
| 153 | + } | |
| 154 | + | |
| 155 | + | |
| 156 | + protected function _initNovo() { | |
| 157 | + return false; | |
| 158 | + } | |
| 159 | + | |
| 160 | + | |
| 161 | + protected function _initEditar() { | |
| 162 | + return false; | |
| 163 | + } | |
| 164 | + | |
| 165 | + | |
| 166 | + public function Gerar() | |
| 167 | + { | |
| 168 | + $this->url_cancelar = '/intranet/transporte_veiculo_lst.php'; | |
| 169 | + | |
| 170 | + // Código do Motorista | |
| 171 | + $options = array('label' => $this->_getLabel('id'), 'disabled' => true, | |
| 172 | + 'required' => false, 'size' => 25); | |
| 173 | + $this->inputsHelper()->integer('id', $options); | |
| 174 | + | |
| 175 | + // descrição | |
| 176 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('descricao')), 'required' => true, 'size' => 50, 'max_length' => 255); | |
| 177 | + $this->inputsHelper()->text('descricao', $options); | |
| 178 | + | |
| 179 | + //placa | |
| 180 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('placa')), 'required' => true, 'size' => 10, 'max_length' => 10); | |
| 181 | + $this->inputsHelper()->text('placa', $options); | |
| 182 | + | |
| 183 | + //renavam | |
| 184 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('renavam')), 'required' => false, 'size' => 15, 'max_length' => 15); | |
| 185 | + $this->inputsHelper()->integer('renavam', $options); | |
| 186 | + | |
| 187 | + //chassi | |
| 188 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('chassi')), 'required' => false, 'size' => 30, 'max_length' => 30); | |
| 189 | + $this->inputsHelper()->text('chassi', $options); | |
| 190 | + | |
| 191 | + //marca | |
| 192 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('marca')), 'required' => true, 'size' => 50, 'max_length' => 50); | |
| 193 | + $this->inputsHelper()->text('marca', $options); | |
| 194 | + | |
| 195 | + //Ano de fabricacao | |
| 196 | + $options = array('label' => $this->_getLabel('ano_fabricacao'), 'max_length' => 4, 'size' => 5, 'required' => false, 'placeholder' => ''); | |
| 197 | + $this->inputsHelper()->integer('ano_fabricacao',$options); | |
| 198 | + | |
| 199 | + // Ano do modelo | |
| 200 | + $options = array('label' => $this->_getLabel('ano_modelo'), 'max_length' => 4, 'size' => 5, 'required' => false, 'placeholder' => ''); | |
| 201 | + $this->inputsHelper()->integer('ano_modelo',$options); | |
| 202 | + | |
| 203 | + // Passageiros | |
| 204 | + $options = array('label' => $this->_getLabel('passageiros'), 'max_length' => 3, 'size' => 5, 'required' => true, 'placeholder' => ''); | |
| 205 | + $this->inputsHelper()->integer('passageiros',$options); | |
| 206 | + | |
| 207 | + // Malha | |
| 208 | + $malhas = array(null => 'Selecione uma Malha', 'A' => Portabilis_String_Utils::toLatin1('Aquaviária/Embarcação'), | |
| 209 | + 'F' => Portabilis_String_Utils::toLatin1('Ferroviária'), 'R' => Portabilis_String_Utils::toLatin1('Rodoviária')); | |
| 210 | + | |
| 211 | + $options = array('label' => $this->_getLabel('malha'), | |
| 212 | + 'resources' => $malhas, | |
| 213 | + 'required' => true); | |
| 214 | + | |
| 215 | + $this->inputsHelper()->select('malha', $options); | |
| 216 | + | |
| 217 | + // Tipo de veículo | |
| 218 | + $tiposVeiculo = array( null => 'Selecione um Tipo'); | |
| 219 | + | |
| 220 | + $objTipo = new clsModulesTipoVeiculo(); | |
| 221 | + $lista = $objTipo->lista(); | |
| 222 | + if ( is_array( $lista ) && count( $lista ) ) | |
| 223 | + { | |
| 224 | + foreach ( $lista as $registro ) | |
| 225 | + { | |
| 226 | + $tiposVeiculo["{$registro['cod_tipo_veiculo']}"] = "{$registro['descricao']}"; | |
| 227 | + } | |
| 228 | + } | |
| 229 | + | |
| 230 | + $options = array('label' => $this->_getLabel('tipo'), | |
| 231 | + 'resources' => $tiposVeiculo, | |
| 232 | + 'required' => true); | |
| 233 | + | |
| 234 | + $this->inputsHelper()->select('tipo', $options); | |
| 235 | + | |
| 236 | + // Exclusivo transporte escolar | |
| 237 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('exclusivo_transporte_escolar'))); | |
| 238 | + $this->inputsHelper()->checkbox('exclusivo_transporte_escolar', $options); | |
| 239 | + | |
| 240 | + // Adaptado a necessidades especiais | |
| 241 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('adaptado_necessidades_especiais'))); | |
| 242 | + $this->inputsHelper()->checkbox('adaptado_necessidades_especiais', $options); | |
| 243 | + | |
| 244 | + // Ativo | |
| 245 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('ativo')), 'value' => 'on'); | |
| 246 | + $this->inputsHelper()->checkbox('ativo', $options); | |
| 247 | + | |
| 248 | + // descricao_inativo | |
| 249 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('descricao_inativo')), 'required' => false, 'size' => 50, 'max_length' => 155); | |
| 250 | + $this->inputsHelper()->textArea('descricao_inativo', $options); | |
| 251 | + | |
| 252 | + | |
| 253 | + // Codigo da empresa | |
| 254 | + $options = array('label' =>Portabilis_String_Utils::toLatin1($this->_getLabel('empresa')), 'required' => true); | |
| 255 | + $this->inputsHelper()->simpleSearchEmpresa('empresa',$options); | |
| 256 | + | |
| 257 | + // Codigo do motorista | |
| 258 | + $options = array('label' =>Portabilis_String_Utils::toLatin1($this->_getLabel('motorista')), 'required' => true); | |
| 259 | + $this->inputsHelper()->simpleSearchMotorista('motorista',$options); | |
| 260 | + | |
| 261 | + // observações | |
| 262 | + $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('observacao')), 'required' => false, 'size' => 50, 'max_length' => 255); | |
| 263 | + $this->inputsHelper()->textArea('observacao', $options); | |
| 264 | + | |
| 265 | + $this->loadResourceAssets($this->getDispatcher()); | |
| 266 | + } | |
| 267 | + | |
| 268 | +} | |
| 269 | +?> | |
| 0 | 270 | \ No newline at end of file | ... | ... |