Commit 6f07a95cafaa4b7eb13d393f8e37c0fe0bdb0e40
1 parent
ef6bda7c
Exists in
master
Adicionado módulo {{{TransporteEscolar}}}:
* Funcionalidade básica, apenas permite o cadastramento de alunos que usam transporte escolar * Possui apenas as opções "Estadual" e "Municipal" em "Responsável" pelo transporte * Informação útil ao Educacenso
Showing
7 changed files
with
353 additions
and
0 deletions
Show diff stats
ieducar/misc/database/deltas/26_cria_tabela_modules_transporte_aluno.sql
0 → 100644
... | ... | @@ -0,0 +1,31 @@ |
1 | +-- // | |
2 | + | |
3 | +-- | |
4 | +-- Cria a tabela transporte_aluno no schema modules. | |
5 | +-- | |
6 | +-- @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
7 | +-- @license @@license@@ | |
8 | +-- @version $Id$ | |
9 | +-- | |
10 | + | |
11 | +CREATE TABLE modules.transporte_aluno | |
12 | +( | |
13 | + aluno_id integer NOT NULL, | |
14 | + responsavel integer NOT NULL, | |
15 | + user_id integer NOT NULL, | |
16 | + created_at timestamp without time zone NOT NULL, | |
17 | + updated_at timestamp without time zone, | |
18 | + CONSTRAINT transporte_aluno_pk PRIMARY KEY (aluno_id) | |
19 | +) WITH (OIDS=FALSE); | |
20 | + | |
21 | +ALTER TABLE modules.transporte_aluno ADD | |
22 | + CONSTRAINT transporte_aluno_aluno_fk | |
23 | + FOREIGN KEY (aluno_id) | |
24 | + REFERENCES pmieducar.aluno (cod_aluno) | |
25 | + ON UPDATE NO ACTION ON DELETE CASCADE; | |
26 | + | |
27 | +-- //@UNDO | |
28 | + | |
29 | +DROP TABLE modules.transporte_aluno; | |
30 | + | |
31 | +-- // | |
0 | 32 | \ No newline at end of file | ... | ... |
ieducar/misc/database/ieducar.sql
... | ... | @@ -10831,6 +10831,19 @@ ALTER SEQUENCE tabela_arredondamento_valor_id_seq OWNED BY tabela_arredondamento |
10831 | 10831 | SELECT pg_catalog.setval('tabela_arredondamento_valor_id_seq', 1, false); |
10832 | 10832 | |
10833 | 10833 | |
10834 | +-- | |
10835 | +-- Name: transporte_aluno; Type: TABLE; Schema: modules; Owner: -; Tablespace: | |
10836 | +-- | |
10837 | + | |
10838 | +CREATE TABLE transporte_aluno ( | |
10839 | + aluno_id integer NOT NULL, | |
10840 | + responsavel integer NOT NULL, | |
10841 | + user_id integer NOT NULL, | |
10842 | + created_at timestamp without time zone NOT NULL, | |
10843 | + updated_at timestamp without time zone | |
10844 | +); | |
10845 | + | |
10846 | + | |
10834 | 10847 | SET search_path = pmiacoes, pg_catalog; |
10835 | 10848 | |
10836 | 10849 | -- |
... | ... | @@ -17816,6 +17829,12 @@ SET search_path = modules, pg_catalog; |
17816 | 17829 | |
17817 | 17830 | |
17818 | 17831 | |
17832 | +-- | |
17833 | +-- Data for Name: transporte_aluno; Type: TABLE DATA; Schema: modules; Owner: - | |
17834 | +-- | |
17835 | + | |
17836 | + | |
17837 | + | |
17819 | 17838 | SET search_path = pmiacoes, pg_catalog; |
17820 | 17839 | |
17821 | 17840 | -- |
... | ... | @@ -20139,6 +20158,7 @@ INSERT INTO changelog VALUES (22, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '22_cria |
20139 | 20158 | INSERT INTO changelog VALUES (23, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '23_cria_tabela_modules_componente_curricular_turma.sql'); |
20140 | 20159 | INSERT INTO changelog VALUES (24, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '24_altera_tipo_campo_carga_horaria_pmieducar_servidor_alocacao.sql'); |
20141 | 20160 | INSERT INTO changelog VALUES (25, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '25_adiciona_campo_zona_localizacao_tabelas_enderecamento.sql'); |
20161 | +INSERT INTO changelog VALUES (26, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '26_cria_tabela_modules_transporte_aluno.sql'); | |
20142 | 20162 | |
20143 | 20163 | |
20144 | 20164 | -- |
... | ... | @@ -27152,6 +27172,14 @@ ALTER TABLE ONLY tabela_arredondamento_valor |
27152 | 27172 | ADD CONSTRAINT tabela_arredondamento_valor_pkey PRIMARY KEY (id); |
27153 | 27173 | |
27154 | 27174 | |
27175 | +-- | |
27176 | +-- Name: transporte_aluno_pk; Type: CONSTRAINT; Schema: modules; Owner: -; Tablespace: | |
27177 | +-- | |
27178 | + | |
27179 | +ALTER TABLE ONLY transporte_aluno | |
27180 | + ADD CONSTRAINT transporte_aluno_pk PRIMARY KEY (aluno_id); | |
27181 | + | |
27182 | + | |
27155 | 27183 | SET search_path = pmiacoes, pg_catalog; |
27156 | 27184 | |
27157 | 27185 | -- |
... | ... | @@ -32944,6 +32972,14 @@ ALTER TABLE ONLY tabela_arredondamento_valor |
32944 | 32972 | ADD CONSTRAINT tabela_arredondamento_tabela_arredondamento_valor_fk FOREIGN KEY (tabela_arredondamento_id) REFERENCES tabela_arredondamento(id) ON UPDATE RESTRICT ON DELETE RESTRICT; |
32945 | 32973 | |
32946 | 32974 | |
32975 | +-- | |
32976 | +-- Name: transporte_aluno_aluno_fk; Type: FK CONSTRAINT; Schema: modules; Owner: - | |
32977 | +-- | |
32978 | + | |
32979 | +ALTER TABLE ONLY transporte_aluno | |
32980 | + ADD CONSTRAINT transporte_aluno_aluno_fk FOREIGN KEY (aluno_id) REFERENCES pmieducar.aluno(cod_aluno) ON DELETE CASCADE; | |
32981 | + | |
32982 | + | |
32947 | 32983 | SET search_path = pmiacoes, pg_catalog; |
32948 | 32984 | |
32949 | 32985 | -- | ... | ... |
... | ... | @@ -0,0 +1,82 @@ |
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 Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package Transporte | |
27 | + * @subpackage Modules | |
28 | + * @since Arquivo disponível desde a versão 1.2.0 | |
29 | + * @version $Id$ | |
30 | + */ | |
31 | + | |
32 | +require_once 'CoreExt/Entity.php'; | |
33 | + | |
34 | +/** | |
35 | + * Transporte_Model_Aluno class. | |
36 | + * | |
37 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
38 | + * @category i-Educar | |
39 | + * @license @@license@@ | |
40 | + * @package Transporte | |
41 | + * @subpackage Modules | |
42 | + * @since Classe disponível desde a versão 1.2.0 | |
43 | + * @version @@package_version@@ | |
44 | + */ | |
45 | +class Transporte_Model_Aluno extends CoreExt_Entity | |
46 | +{ | |
47 | + protected $_data = array( | |
48 | + 'aluno' => NULL, | |
49 | + 'responsavel' => NULL, | |
50 | + 'user' => NULL, | |
51 | + 'created_at' => NULL, | |
52 | + 'updated_at' => NULL | |
53 | + ); | |
54 | + | |
55 | + protected $_references = array( | |
56 | + 'responsavel' => array( | |
57 | + 'value' => NULL, | |
58 | + 'class' => 'Transporte_Model_Responsavel', | |
59 | + 'file' => 'Transporte/Model/Responsavel.php' | |
60 | + ) | |
61 | + ); | |
62 | + | |
63 | + public function __construct($options = array()) | |
64 | + { | |
65 | + parent::__construct($options); | |
66 | + unset($this->_data['id']); | |
67 | + } | |
68 | + | |
69 | + public function getDefaultValidatorCollection() | |
70 | + { | |
71 | + require_once 'Transporte/Model/Responsavel.php'; | |
72 | + $responsavel = Transporte_Model_Responsavel::getInstance(); | |
73 | + | |
74 | + return array( | |
75 | + 'aluno' => new CoreExt_Validate_Numeric(), | |
76 | + 'responsavel' => new CoreExt_Validate_Choice(array( | |
77 | + 'choices' => $responsavel->getKeys()) | |
78 | + ), | |
79 | + 'user' => new CoreExt_Validate_Numeric() | |
80 | + ); | |
81 | + } | |
82 | +} | |
0 | 83 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,61 @@ |
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 Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package Transporte | |
27 | + * @subpackage Modules | |
28 | + * @since Arquivo disponível desde a versão 1.2.0 | |
29 | + * @version $Id$ | |
30 | + */ | |
31 | + | |
32 | +require_once 'CoreExt/DataMapper.php'; | |
33 | +require_once 'Transporte/Model/Aluno.php'; | |
34 | + | |
35 | +/** | |
36 | + * Transporte_Model_AlunoDataMapper class. | |
37 | + * | |
38 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
39 | + * @category i-Educar | |
40 | + * @license @@license@@ | |
41 | + * @package Transporte | |
42 | + * @subpackage Modules | |
43 | + * @since Classe disponível desde a versão 1.2.0 | |
44 | + * @version @@package_version@@ | |
45 | + */ | |
46 | +class Transporte_Model_AlunoDataMapper extends CoreExt_DataMapper | |
47 | +{ | |
48 | + protected $_entityClass = 'Transporte_Model_Aluno'; | |
49 | + protected $_tableName = 'transporte_aluno'; | |
50 | + protected $_tableSchema = 'modules'; | |
51 | + | |
52 | + protected $_attributeMap = array( | |
53 | + 'aluno' => 'aluno_id', | |
54 | + 'responsavel' => 'responsavel', | |
55 | + 'user' => 'user_id', | |
56 | + 'created_at' => 'created_at', | |
57 | + 'updated_at' => 'updated_at' | |
58 | + ); | |
59 | + | |
60 | + protected $_primaryKey = array('aluno'); | |
61 | +} | |
0 | 62 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,59 @@ |
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 Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package Transporte | |
27 | + * @subpackage Modules | |
28 | + * @since Arquivo disponível desde a versão 1.2.0 | |
29 | + * @version $Id$ | |
30 | + */ | |
31 | + | |
32 | +require_once 'CoreExt/Enum.php'; | |
33 | + | |
34 | +/** | |
35 | + * Transporte_Model_Responsavel class. | |
36 | + * | |
37 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
38 | + * @category i-Educar | |
39 | + * @license @@license@@ | |
40 | + * @package Transporte | |
41 | + * @subpackage Modules | |
42 | + * @since Classe disponível desde a versão 1.2.0 | |
43 | + * @version @@package_version@@ | |
44 | + */ | |
45 | +class Transporte_Model_Responsavel extends CoreExt_Enum | |
46 | +{ | |
47 | + const ESTADUAL = 1; | |
48 | + const MUNICIPAL = 2; | |
49 | + | |
50 | + protected $_data = array( | |
51 | + self::ESTADUAL => 'Estadual', | |
52 | + self::MUNICIPAL => 'Municipal' | |
53 | + ); | |
54 | + | |
55 | + public static function getInstance() | |
56 | + { | |
57 | + return self::_getInstance(__CLASS__); | |
58 | + } | |
59 | +} | |
0 | 60 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | +CREATE TABLE modules.transporte_aluno | |
2 | +( | |
3 | + aluno_id integer NOT NULL, | |
4 | + responsavel integer NOT NULL, | |
5 | + user_id integer NOT NULL, | |
6 | + created_at timestamp without time zone NOT NULL, | |
7 | + updated_at timestamp without time zone, | |
8 | + CONSTRAINT transporte_aluno_pk PRIMARY KEY (aluno_id) | |
9 | +) WITH (OIDS=FALSE); | |
10 | + | |
11 | +ALTER TABLE modules.transporte_aluno ADD | |
12 | + CONSTRAINT transporte_aluno_aluno_fk | |
13 | + FOREIGN KEY (aluno_id) | |
14 | + REFERENCES pmieducar.aluno (cod_aluno) | |
15 | + ON UPDATE NO ACTION ON DELETE CASCADE; | |
0 | 16 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,69 @@ |
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 Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
24 | + * @category i-Educar | |
25 | + * @license @@license@@ | |
26 | + * @package Transporte | |
27 | + * @subpackage UnitTests | |
28 | + * @since Arquivo disponível desde a versão 1.2.0 | |
29 | + * @version $Id$ | |
30 | + */ | |
31 | + | |
32 | +require_once 'Transporte/Model/Aluno.php'; | |
33 | +require_once 'Transporte/Model/Responsavel.php'; | |
34 | + | |
35 | +/** | |
36 | + * Transporte_Model_AlunoTest class. | |
37 | + * | |
38 | + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br> | |
39 | + * @category i-Educar | |
40 | + * @license @@license@@ | |
41 | + * @package Transporte | |
42 | + * @subpackage UnitTests | |
43 | + * @since Classe disponível desde a versão 1.2.0 | |
44 | + * @version @@package_version@@ | |
45 | + */ | |
46 | +class Transporte_Model_AlunoTest extends UnitBaseTest | |
47 | +{ | |
48 | + protected $_entity = NULL; | |
49 | + | |
50 | + protected function setUp() | |
51 | + { | |
52 | + $this->_entity = new Transporte_Model_Aluno(); | |
53 | + } | |
54 | + | |
55 | + public function testEntityValidators() | |
56 | + { | |
57 | + // Recupera os objetos CoreExt_Validate | |
58 | + $validators = $this->_entity->getDefaultValidatorCollection(); | |
59 | + $this->assertType('CoreExt_Validate_Numeric', $validators['aluno']); | |
60 | + $this->assertType('CoreExt_Validate_Choice', $validators['responsavel']); | |
61 | + $this->assertType('CoreExt_Validate_Numeric', $validators['user']); | |
62 | + | |
63 | + // Verifica se a opção 'choices' corresponde aos valores do Enum Responsavel. | |
64 | + $responsavel = Transporte_Model_Responsavel::getInstance(); | |
65 | + $this->assertEquals( | |
66 | + $responsavel->getKeys(), $validators['responsavel']->getOption('choices') | |
67 | + ); | |
68 | + } | |
69 | +} | |
0 | 70 | \ No newline at end of file | ... | ... |