Commit 4fb058800c076b751dfb7b098bdf5314af0d2d65

Authored by Eriksen Costa
1 parent 5ad5c651
Exists in master

Adicionado novo módulo {{{Docente}}}:

 * Contém modelos para definir os cursos superiores/licenciaturas concluídas pelo docente
 * Adicionado delta e atualizado dump de criação de banco de dados
ieducar/misc/database/deltas/29_cria_tabela_modules_docente_licenciatura.sql 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +-- //
  2 +
  3 +--
  4 +-- Cria as tabelas modules.docente_licenciatura.
  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.docente_licenciatura
  12 +(
  13 + id serial,
  14 + servidor_id integer NOT NULL,
  15 + licenciatura integer NOT NULL,
  16 + curso_id integer,
  17 + ano_conclusao integer NOT NULL,
  18 + ies_id integer,
  19 + user_id integer NOT NULL,
  20 + created_at timestamp without time zone NOT NULL,
  21 + updated_at timestamp without time zone,
  22 + CONSTRAINT docente_licenciatura_pk PRIMARY KEY (id),
  23 + CONSTRAINT docente_licenciatura_curso_unique UNIQUE (servidor_id, curso_id, ies_id)
  24 +) WITH (OIDS=FALSE);
  25 +
  26 +
  27 +ALTER TABLE modules.docente_licenciatura ADD
  28 + CONSTRAINT docente_licenciatura_ies_fk
  29 + FOREIGN KEY (ies_id)
  30 + REFERENCES modules.educacenso_ies (id)
  31 + ON UPDATE NO ACTION ON DELETE RESTRICT;
  32 +
  33 +CREATE INDEX docente_licenciatura_ies_idx ON modules.docente_licenciatura(ies_id);
  34 +
  35 +-- //@UNDO
  36 +
  37 +ALTER TABLE modules.docente_licenciatura DROP
  38 + CONSTRAINT docente_licenciatura_ies_fk;
  39 +
  40 +DROP TABLE modules.docente_licenciatura;
  41 +
  42 +-- //
0 43 \ No newline at end of file
... ...
ieducar/misc/database/ieducar.sql
... ... @@ -10352,6 +10352,49 @@ CREATE TABLE componente_curricular_turma (
10352 10352  
10353 10353  
10354 10354 --
  10355 +-- Name: docente_licenciatura; Type: TABLE; Schema: modules; Owner: -; Tablespace:
  10356 +--
  10357 +
  10358 +CREATE TABLE docente_licenciatura (
  10359 + id integer NOT NULL,
  10360 + servidor_id integer NOT NULL,
  10361 + licenciatura integer NOT NULL,
  10362 + curso_id integer,
  10363 + ano_conclusao integer NOT NULL,
  10364 + ies_id integer,
  10365 + user_id integer NOT NULL,
  10366 + created_at timestamp without time zone NOT NULL,
  10367 + updated_at timestamp without time zone
  10368 +);
  10369 +
  10370 +
  10371 +--
  10372 +-- Name: docente_licenciatura_id_seq; Type: SEQUENCE; Schema: modules; Owner: -
  10373 +--
  10374 +
  10375 +CREATE SEQUENCE docente_licenciatura_id_seq
  10376 + START WITH 1
  10377 + INCREMENT BY 1
  10378 + NO MAXVALUE
  10379 + NO MINVALUE
  10380 + CACHE 1;
  10381 +
  10382 +
  10383 +--
  10384 +-- Name: docente_licenciatura_id_seq; Type: SEQUENCE OWNED BY; Schema: modules; Owner: -
  10385 +--
  10386 +
  10387 +ALTER SEQUENCE docente_licenciatura_id_seq OWNED BY docente_licenciatura.id;
  10388 +
  10389 +
  10390 +--
  10391 +-- Name: docente_licenciatura_id_seq; Type: SEQUENCE SET; Schema: modules; Owner: -
  10392 +--
  10393 +
  10394 +SELECT pg_catalog.setval('docente_licenciatura_id_seq', 1, false);
  10395 +
  10396 +
  10397 +--
10355 10398 -- Name: educacenso_cod_aluno; Type: TABLE; Schema: modules; Owner: -; Tablespace:
10356 10399 --
10357 10400  
... ... @@ -16932,6 +16975,13 @@ ALTER TABLE componente_curricular ALTER COLUMN id SET DEFAULT nextval(&#39;component
16932 16975 -- Name: id; Type: DEFAULT; Schema: modules; Owner: -
16933 16976 --
16934 16977  
  16978 +ALTER TABLE docente_licenciatura ALTER COLUMN id SET DEFAULT nextval('docente_licenciatura_id_seq'::regclass);
  16979 +
  16980 +
  16981 +--
  16982 +-- Name: id; Type: DEFAULT; Schema: modules; Owner: -
  16983 +--
  16984 +
16935 16985 ALTER TABLE educacenso_curso_superior ALTER COLUMN id SET DEFAULT nextval('educacenso_curso_superior_id_seq'::regclass);
16936 16986  
16937 16987  
... ... @@ -17876,6 +17926,12 @@ SET search_path = modules, pg_catalog;
17876 17926  
17877 17927  
17878 17928 --
  17929 +-- Data for Name: docente_licenciatura; Type: TABLE DATA; Schema: modules; Owner: -
  17930 +--
  17931 +
  17932 +
  17933 +
  17934 +--
17879 17935 -- Data for Name: educacenso_cod_aluno; Type: TABLE DATA; Schema: modules; Owner: -
17880 17936 --
17881 17937  
... ... @@ -25734,6 +25790,7 @@ INSERT INTO changelog VALUES (25, &#39;Main&#39;, &#39;NOW()&#39;, &#39;NOW()&#39;, &#39;dbdeploy&#39;, &#39;25_adic
25734 25790 INSERT INTO changelog VALUES (26, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '26_cria_tabela_modules_transporte_aluno.sql');
25735 25791 INSERT INTO changelog VALUES (27, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '27_cria_tabela_modules_educacenso_cod_aluno_e_docente.sql');
25736 25792 INSERT INTO changelog VALUES (28, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '28_cria_tabelas_modules_educacenso_ies_e_curso_superior.sql');
  25793 +INSERT INTO changelog VALUES (29, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '29_cria_tabela_modules_docente_licenciatura.sql');
25737 25794  
25738 25795  
25739 25796 --
... ... @@ -32644,6 +32701,22 @@ ALTER TABLE ONLY componente_curricular_turma
32644 32701  
32645 32702  
32646 32703 --
  32704 +-- Name: docente_licenciatura_curso_unique; Type: CONSTRAINT; Schema: modules; Owner: -; Tablespace:
  32705 +--
  32706 +
  32707 +ALTER TABLE ONLY docente_licenciatura
  32708 + ADD CONSTRAINT docente_licenciatura_curso_unique UNIQUE (servidor_id, curso_id, ies_id);
  32709 +
  32710 +
  32711 +--
  32712 +-- Name: docente_licenciatura_pk; Type: CONSTRAINT; Schema: modules; Owner: -; Tablespace:
  32713 +--
  32714 +
  32715 +ALTER TABLE ONLY docente_licenciatura
  32716 + ADD CONSTRAINT docente_licenciatura_pk PRIMARY KEY (id);
  32717 +
  32718 +
  32719 +--
32647 32720 -- Name: educacenso_cod_aluno_pk; Type: CONSTRAINT; Schema: modules; Owner: -; Tablespace:
32648 32721 --
32649 32722  
... ... @@ -34634,6 +34707,13 @@ CREATE INDEX componente_curricular_turma_turma_idx ON componente_curricular_turm
34634 34707  
34635 34708  
34636 34709 --
  34710 +-- Name: docente_licenciatura_ies_idx; Type: INDEX; Schema: modules; Owner: -; Tablespace:
  34711 +--
  34712 +
  34713 +CREATE INDEX docente_licenciatura_ies_idx ON docente_licenciatura USING btree (ies_id);
  34714 +
  34715 +
  34716 +--
34637 34717 -- Name: regra_avaliacao_id_key; Type: INDEX; Schema: modules; Owner: -; Tablespace:
34638 34718 --
34639 34719  
... ... @@ -38500,6 +38580,14 @@ ALTER TABLE ONLY componente_curricular_turma
38500 38580  
38501 38581  
38502 38582 --
  38583 +-- Name: docente_licenciatura_ies_fk; Type: FK CONSTRAINT; Schema: modules; Owner: -
  38584 +--
  38585 +
  38586 +ALTER TABLE ONLY docente_licenciatura
  38587 + ADD CONSTRAINT docente_licenciatura_ies_fk FOREIGN KEY (ies_id) REFERENCES educacenso_ies(id) ON DELETE RESTRICT;
  38588 +
  38589 +
  38590 +--
38503 38591 -- Name: educacenso_cod_aluno_cod_aluno_fk; Type: FK CONSTRAINT; Schema: modules; Owner: -
38504 38592 --
38505 38593  
... ...
ieducar/modules/Docente/Model/Licenciatura.php 0 → 100644
... ... @@ -0,0 +1,80 @@
  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 Docente
  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 + * Docente_Model_Licenciatura class.
  36 + *
  37 + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
  38 + * @category i-Educar
  39 + * @license @@license@@
  40 + * @package Docente
  41 + * @subpackage Modules
  42 + * @since Classe disponível desde a versão 1.2.0
  43 + * @version @@package_version@@
  44 + */
  45 +class Docente_Model_Licenciatura extends CoreExt_Entity
  46 +{
  47 + protected $_data = array(
  48 + 'servidor' => NULL,
  49 + 'licenciatura' => NULL,
  50 + 'curso' => NULL,
  51 + 'anoConclusao' => NULL,
  52 + 'ies' => NULL,
  53 + 'user' => NULL,
  54 + 'created_at' => NULL,
  55 + 'updated_at' => NULL
  56 + );
  57 +
  58 + protected $_references = array(
  59 + 'licenciatura' => array(
  60 + 'value' => NULL,
  61 + 'class' => 'App_Model_SimNao',
  62 + 'file' => 'App/Model/SimNao.php'
  63 + ),
  64 + 'ies' => array(
  65 + 'value' => NULL,
  66 + 'class' => 'Educacenso_Model_IesDataMapper',
  67 + 'file' => 'Educacenso/Model/IesDataMapper.php'
  68 + ),
  69 + 'curso' => array(
  70 + 'value' => NULL,
  71 + 'class' => 'Educacenso_Model_CursoSuperiorDataMapper',
  72 + 'file' => 'Educacenso/Model/CursoSuperiorDataMapper.php'
  73 + )
  74 + );
  75 +
  76 + public function getDefaultValidatorCollection()
  77 + {
  78 + return array();
  79 + }
  80 +}
0 81 \ No newline at end of file
... ...
ieducar/modules/Docente/Model/LicenciaturaDataMapper.php 0 → 100644
... ... @@ -0,0 +1,62 @@
  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 Docente
  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 'Docente/Model/Licenciatura.php';
  34 +
  35 +/**
  36 + * Docente_Model_LicenciaturaDataMapper class.
  37 + *
  38 + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
  39 + * @category i-Educar
  40 + * @license @@license@@
  41 + * @package Docente
  42 + * @subpackage Modules
  43 + * @since Classe disponível desde a versão 1.2.0
  44 + * @version @@package_version@@
  45 + */
  46 +class Docente_Model_LicenciaturaDataMapper extends CoreExt_DataMapper
  47 +{
  48 + protected $_entityClass = 'Docente_Model_Licenciatura';
  49 + protected $_tableName = 'docente_licenciatura';
  50 + protected $_tableSchema = 'modules';
  51 +
  52 + protected $_attributeMap = array(
  53 + 'servidor' => 'servidor_id',
  54 + 'licenciatura' => 'licenciatura',
  55 + 'curso' => 'curso_id',
  56 + 'anoConclusao' => 'ano_conclusao',
  57 + 'ies' => 'ies_id',
  58 + 'user' => 'user_id',
  59 + 'created_at' => 'created_at',
  60 + 'updated_at' => 'updated_at'
  61 + );
  62 +}
0 63 \ No newline at end of file
... ...
ieducar/modules/Docente/Views/EditController.php 0 → 100644
... ... @@ -0,0 +1,234 @@
  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 Docente
  27 + * @subpackage Modules
  28 + * @since Arquivo disponível desde a versão 1.1.0
  29 + * @version $Id$
  30 + */
  31 +
  32 +require_once 'Core/Controller/Page/EditController.php';
  33 +require_once 'Educacenso/Model/CursoSuperiorDataMapper.php';
  34 +require_once 'Educacenso/Model/IesDataMapper.php';
  35 +require_once 'Docente/Model/LicenciaturaDataMapper.php';
  36 +
  37 +require_once 'include/public/clsPublicUf.inc.php';
  38 +
  39 +/**
  40 + * EditController class.
  41 + *
  42 + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
  43 + * @category i-Educar
  44 + * @license @@license@@
  45 + * @package Docente
  46 + * @subpackage Modules
  47 + * @since Classe disponível desde a versão 1.1.0
  48 + * @version @@package_version@@
  49 + */
  50 +class EditController extends Core_Controller_Page_EditController
  51 +{
  52 + protected $_dataMapper = 'Docente_Model_LicenciaturaDataMapper';
  53 + protected $_titulo = 'Cadastro de Curso Superior/Licenciatura';
  54 + protected $_processoAp = 635;
  55 + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA;
  56 + protected $_saveOption = TRUE;
  57 + protected $_deleteOption = TRUE;
  58 +
  59 + protected $_formMap = array(
  60 + 'servidor' => array(
  61 + 'label' => '',
  62 + 'help' => '',
  63 + 'entity' => 'servidor'
  64 + ),
  65 + 'licenciatura' => array(
  66 + 'label' => 'Licenciatura',
  67 + 'help' => '',
  68 + 'entity' => 'licenciatura'
  69 + ),
  70 + 'curso' => array(
  71 + 'label' => 'Curso',
  72 + 'help' => '',
  73 + 'entity' => 'curso'
  74 + ),
  75 + 'anoConclusao' => array(
  76 + 'label' => 'Ano conclusão',
  77 + 'help' => '',
  78 + 'entity' => 'anoConclusao'
  79 + ),
  80 + 'ies' => array(
  81 + 'label' => 'IES',
  82 + 'help' => '',
  83 + 'entity' => 'ies'
  84 + ),
  85 + 'user' => array(
  86 + 'label' => '',
  87 + 'help' => '',
  88 + 'entity' => 'user'
  89 + ),
  90 + 'created_at' => array(
  91 + 'label' => '',
  92 + 'help' => '',
  93 + 'entity' => 'created_at'
  94 + )
  95 + );
  96 +
  97 + protected function _preConstruct()
  98 + {
  99 + $params = array(
  100 + 'id' => $this->getRequest()->id,
  101 + 'servidor' => $this->getRequest()->servidor,
  102 + 'instituicao' => $this->getRequest()->instituicao
  103 + );
  104 + $this->setOptions(array('new_success_params' => $params));
  105 + $this->setOptions(array('edit_success_params' => $params));
  106 +
  107 + unset($params['id']);
  108 + $this->setOptions(array('delete_success_params' => $params));
  109 + }
  110 +
  111 + /**
  112 + * @see clsCadastro#Gerar()
  113 + */
  114 + public function Gerar()
  115 + {
  116 + global $coreExt;
  117 +
  118 + $this->campoOculto('id', $this->getEntity()->id);
  119 + $this->campoOculto('servidor', $this->getRequest()->servidor);
  120 +
  121 + $cursoSuperiorMapper = new Educacenso_Model_CursoSuperiorDataMapper();
  122 + $cursos = $cursoSuperiorMapper->findAll(array(), array(), array('id' => 'ASC', 'nome' => 'ASC'));
  123 +
  124 + // Licenciatura
  125 + $licenciatura = $this->getEntity()->get('licenciatura') ?
  126 + $this->getEntity()->get('licenciatura') : 0;
  127 +
  128 + $this->campoRadio('licenciatura', $this->_getLabel('licenciatura'),
  129 + array(1 => 'Sim', 0 => 'Não'), $licenciatura);
  130 +
  131 + // Curso
  132 + $opcoes = array();
  133 + foreach ($cursos as $curso) {
  134 + $opcoes[$curso->id] = $curso->nome;
  135 + }
  136 +
  137 + $this->campoLista(
  138 + 'curso', $this->_getLabel('curso'), $opcoes, $this->getEntity()->get('curso')
  139 + );
  140 +
  141 + // Ano conclusão
  142 + $opcoes = range(1960, date('Y'));
  143 + rsort($opcoes);
  144 + $opcoes = array_combine($opcoes, $opcoes);
  145 + $this->campoLista(
  146 + 'anoConclusao', $this->_getLabel('anoConclusao'), $opcoes, $this->getEntity()->anoConclusao
  147 + );
  148 +
  149 + // UF da IES.
  150 + $ufs = new clsPublicUf();
  151 + $ufs = $ufs->lista();
  152 +
  153 + $opcoes = array();
  154 + foreach ($ufs as $uf) {
  155 + $opcoes[$uf['sigla_uf']] = $uf['sigla_uf'];
  156 + }
  157 + ksort($opcoes);
  158 +
  159 + // Caso não seja uma instância persistida, usa a UF do locale.
  160 + $uf = $this->getEntity()->ies->uf ?
  161 + $this->getEntity()->ies->uf : $coreExt['Config']->app->locale->province;
  162 +
  163 + $this->campoLista('uf', 'UF', $opcoes, $uf, 'getIes()');
  164 +
  165 + // IES.
  166 + $opcoes = array();
  167 + $iesMapper = new Educacenso_Model_IesDataMapper();
  168 + $iesUf = $iesMapper->findAll(array(), array('uf' => $uf));
  169 +
  170 + foreach ($iesUf as $ies) {
  171 + $opcoes[$ies->id] = $ies->nome;
  172 + }
  173 +
  174 + // Adiciona a instituição "Não cadastrada".
  175 + $ies = $iesMapper->find(array('ies' => 9999999));
  176 + $opcoes[$ies->id] = $ies->nome;
  177 +
  178 + $this->campoLista(
  179 + 'ies', $this->_getLabel('ies'), $opcoes, $this->getEntity()->ies->id
  180 + );
  181 +
  182 + $this->url_cancelar = sprintf(
  183 + 'index?servidor=%d&instituicao=%d',
  184 + $this->getRequest()->servidor, $this->getRequest()->instituicao
  185 + );
  186 +
  187 + // Javascript para Ajax.
  188 + echo
  189 +<<<EOT
  190 + <script type="text/javascript">
  191 + function getIes()
  192 + {
  193 + var ies = document.getElementById('ies').value;
  194 + var uf = document.getElementById('uf').value;
  195 +
  196 + var url = '/modules/Educacenso/Views/IesAjaxController.php';
  197 + var pars = '?uf=' + uf;
  198 +
  199 + var xml1 = new ajax(getIesXml);
  200 + xml1.envia(url + pars);
  201 + }
  202 +
  203 + function getIesXml(xml)
  204 + {
  205 + var ies = document.getElementById('ies');
  206 +
  207 + ies.length = 1;
  208 + ies.options[0] = new Option('Selecione uma IES', '', false, false);
  209 +
  210 + var iesItems = xml.getElementsByTagName('ies');
  211 +
  212 + for (var i = 0; i < iesItems.length; i++) {
  213 + ies.options[ies.options.length] = new Option(
  214 + iesItems[i].firstChild.nodeValue, iesItems[i].getAttribute('id'), false, false
  215 + );
  216 + }
  217 +
  218 + if (ies.length == 1) {
  219 + ies.options[0] = new Option(
  220 + 'A UF não possui IES.', '', false, false
  221 + );
  222 + }
  223 + }
  224 + </script>
  225 +EOT;
  226 + }
  227 +
  228 + public function Novo()
  229 + {
  230 + $_POST['user'] = $this->getOption('id_usuario');
  231 + $_POST['created_at'] = 'NOW()';
  232 + parent::Novo();
  233 + }
  234 +}
0 235 \ No newline at end of file
... ...
ieducar/modules/Docente/Views/IndexController.php 0 → 100644
... ... @@ -0,0 +1,119 @@
  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 Docente
  27 + * @subpackage Modules
  28 + * @since Arquivo disponível desde a versão 1.2.0
  29 + * @version $Id$
  30 + */
  31 +
  32 +require_once 'Core/Controller/Page/ListController.php';
  33 +require_once 'Docente/Model/LicenciaturaDataMapper.php';
  34 +
  35 +/**
  36 + * IndexController class.
  37 + *
  38 + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
  39 + * @category i-Educar
  40 + * @license @@license@@
  41 + * @package Docente
  42 + * @subpackage Modules
  43 + * @since Classe disponível desde a versão 1.2.0
  44 + * @version @@package_version@@
  45 + */
  46 +class IndexController extends Core_Controller_Page_ListController
  47 +{
  48 + protected $_dataMapper = 'Docente_Model_LicenciaturaDataMapper';
  49 + protected $_titulo = 'Listagem de licenciaturas do servidor';
  50 + protected $_processoAp = 635;
  51 +
  52 + protected $_tableMap = array(
  53 + 'Licenciatura' => 'licenciatura',
  54 + 'Curso' => 'curso',
  55 + 'Ano de conclusão' => 'anoConclusao',
  56 + 'IES' => 'ies'
  57 + );
  58 +
  59 + public function getEntries()
  60 + {
  61 + return $this->getDataMapper()->findAll(
  62 + array(), array('servidor' => $this->getRequest()->servidor), array('anoConclusao' => 'ASC')
  63 + );
  64 + }
  65 +
  66 + public function setAcao()
  67 + {
  68 + $this->acao = sprintf(
  69 + 'go("edit?servidor=%d&instituicao=%d")',
  70 + $this->getRequest()->servidor, $this->getRequest()->instituicao
  71 + );
  72 +
  73 + $this->nome_acao = 'Novo';
  74 + }
  75 +
  76 + public function Gerar()
  77 + {
  78 + $headers = $this->getTableMap();
  79 +
  80 + $this->addCabecalhos(array_keys($headers));
  81 +
  82 + $entries = $this->getEntries();
  83 +
  84 + // Paginador
  85 + $this->limite = 20;
  86 + $this->offset = ($_GET['pagina_' . $this->nome]) ?
  87 + $_GET['pagina_' . $this->nome] * $this->limite - $this->limite
  88 + : 0;
  89 +
  90 + foreach ($entries as $entry) {
  91 + $item = array();
  92 + $data = $entry->toArray();
  93 + $options = array('query' => array(
  94 + 'id' => $entry->id,
  95 + 'servidor' => $entry->servidor,
  96 + 'instituicao' => $this->getRequest()->instituicao
  97 + ));
  98 +
  99 + foreach ($headers as $label => $attr) {
  100 + $item[] = CoreExt_View_Helper_UrlHelper::l(
  101 + $entry->$attr, 'view', $options
  102 + );
  103 + }
  104 +
  105 + $this->addLinhas($item);
  106 + }
  107 +
  108 + $this->addPaginador2("", count($entries), $_GET, $this->nome, $this->limite);
  109 +
  110 + $this->setAcao();
  111 +
  112 + $this->acao_voltar = sprintf(
  113 + 'go("/intranet/educar_servidor_det.php?cod_servidor=%d&ref_cod_instituicao=%d")',
  114 + $this->getRequest()->servidor, $this->getRequest()->instituicao
  115 + );
  116 +
  117 + $this->largura = "100%";
  118 + }
  119 +}
0 120 \ No newline at end of file
... ...
ieducar/modules/Docente/Views/ViewController.php 0 → 100644
... ... @@ -0,0 +1,79 @@
  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 ComponenteCurricular
  27 + * @subpackage Modules
  28 + * @since Arquivo disponível desde a versão 1.2.0
  29 + * @version $Id$
  30 + */
  31 +
  32 +require_once 'Core/Controller/Page/ViewController.php';
  33 +require_once 'Docente/Model/LicenciaturaDataMapper.php';
  34 +
  35 +/**
  36 + * ViewController class.
  37 + *
  38 + * @author Eriksen Costa Paixão <eriksen.paixao_bs@cobra.com.br>
  39 + * @category i-Educar
  40 + * @license @@license@@
  41 + * @package Docente
  42 + * @subpackage Modules
  43 + * @since Classe disponível desde a versão 1.2.0
  44 + * @version @@package_version@@
  45 + */
  46 +class ViewController extends Core_Controller_Page_ViewController
  47 +{
  48 + protected $_dataMapper = 'Docente_Model_LicenciaturaDataMapper';
  49 + protected $_titulo = 'Detalhes da licenciatura';
  50 + protected $_processoAp = 635;
  51 + protected $_tableMap = array(
  52 + 'Licenciatura' => 'licenciatura',
  53 + 'Curso' => 'curso',
  54 + 'Ano de conclusão' => 'anoConclusao',
  55 + 'IES' => 'ies'
  56 + );
  57 +
  58 + public function setUrlEditar(CoreExt_Entity $entry)
  59 + {
  60 + $this->url_editar = CoreExt_View_Helper_UrlHelper::url(
  61 + 'edit', array('query' => array(
  62 + 'id' => $entry->id,
  63 + 'servidor' => $entry->servidor,
  64 + 'instituicao' => $this->getRequest()->instituicao
  65 + ))
  66 + );
  67 + }
  68 +
  69 + public function setUrlCancelar(CoreExt_Entity $entry)
  70 + {
  71 + $this->url_cancelar = CoreExt_View_Helper_UrlHelper::url(
  72 + 'index', array('query' => array(
  73 + 'id' => $entry->id,
  74 + 'servidor' => $entry->servidor,
  75 + 'instituicao' => $this->getRequest()->instituicao
  76 + ))
  77 + );
  78 + }
  79 +}
0 80 \ No newline at end of file
... ...
ieducar/modules/Docente/_data/install.sql 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +CREATE TABLE modules.docente_licenciatura
  2 +(
  3 + id serial,
  4 + servidor_id integer NOT NULL,
  5 + licenciatura integer NOT NULL,
  6 + curso_id integer,
  7 + ano_conclusao integer NOT NULL,
  8 + ies_id integer,
  9 + user_id integer NOT NULL,
  10 + created_at timestamp without time zone NOT NULL,
  11 + updated_at timestamp without time zone,
  12 + CONSTRAINT docente_licenciatura_pk PRIMARY KEY (id),
  13 + CONSTRAINT docente_licenciatura_curso_unique UNIQUE (servidor_id, curso_id, ies_id)
  14 +) WITH (OIDS=FALSE);
  15 +
  16 +
  17 +ALTER TABLE modules.docente_licenciatura ADD
  18 + CONSTRAINT docente_licenciatura_ies_fk
  19 + FOREIGN KEY (ies_id)
  20 + REFERENCES modules.educacenso_ies (id)
  21 + ON UPDATE NO ACTION ON DELETE RESTRICT;
  22 +
  23 +CREATE INDEX docente_licenciatura_ies_idx ON modules.docente_licenciatura(ies_id);
0 24 \ No newline at end of file
... ...