From 4fb058800c076b751dfb7b098bdf5314af0d2d65 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Date: Mon, 23 Aug 2010 06:32:22 -0300 Subject: [PATCH] Adicionado novo módulo {{{Docente}}}: --- ieducar/misc/database/deltas/29_cria_tabela_modules_docente_licenciatura.sql | 42 ++++++++++++++++++++++++++++++++++++++++++ ieducar/misc/database/ieducar.sql | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ieducar/modules/Docente/Model/Licenciatura.php | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ieducar/modules/Docente/Model/LicenciaturaDataMapper.php | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ieducar/modules/Docente/Views/EditController.php | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ieducar/modules/Docente/Views/IndexController.php | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ieducar/modules/Docente/Views/ViewController.php | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ieducar/modules/Docente/_data/install.sql | 23 +++++++++++++++++++++++ 8 files changed, 727 insertions(+), 0 deletions(-) create mode 100644 ieducar/misc/database/deltas/29_cria_tabela_modules_docente_licenciatura.sql create mode 100644 ieducar/modules/Docente/Model/Licenciatura.php create mode 100644 ieducar/modules/Docente/Model/LicenciaturaDataMapper.php create mode 100644 ieducar/modules/Docente/Views/EditController.php create mode 100644 ieducar/modules/Docente/Views/IndexController.php create mode 100644 ieducar/modules/Docente/Views/ViewController.php create mode 100644 ieducar/modules/Docente/_data/install.sql diff --git a/ieducar/misc/database/deltas/29_cria_tabela_modules_docente_licenciatura.sql b/ieducar/misc/database/deltas/29_cria_tabela_modules_docente_licenciatura.sql new file mode 100644 index 0000000..3a286f6 --- /dev/null +++ b/ieducar/misc/database/deltas/29_cria_tabela_modules_docente_licenciatura.sql @@ -0,0 +1,42 @@ +-- // + +-- +-- Cria as tabelas modules.docente_licenciatura. +-- +-- @author Eriksen Costa Paixão +-- @license @@license@@ +-- @version $Id$ +-- + +CREATE TABLE modules.docente_licenciatura +( + id serial, + servidor_id integer NOT NULL, + licenciatura integer NOT NULL, + curso_id integer, + ano_conclusao integer NOT NULL, + ies_id integer, + user_id integer NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone, + CONSTRAINT docente_licenciatura_pk PRIMARY KEY (id), + CONSTRAINT docente_licenciatura_curso_unique UNIQUE (servidor_id, curso_id, ies_id) +) WITH (OIDS=FALSE); + + +ALTER TABLE modules.docente_licenciatura ADD + CONSTRAINT docente_licenciatura_ies_fk + FOREIGN KEY (ies_id) + REFERENCES modules.educacenso_ies (id) + ON UPDATE NO ACTION ON DELETE RESTRICT; + +CREATE INDEX docente_licenciatura_ies_idx ON modules.docente_licenciatura(ies_id); + +-- //@UNDO + +ALTER TABLE modules.docente_licenciatura DROP + CONSTRAINT docente_licenciatura_ies_fk; + +DROP TABLE modules.docente_licenciatura; + +-- // \ No newline at end of file diff --git a/ieducar/misc/database/ieducar.sql b/ieducar/misc/database/ieducar.sql index 32f8901..b3071fb 100644 --- a/ieducar/misc/database/ieducar.sql +++ b/ieducar/misc/database/ieducar.sql @@ -10352,6 +10352,49 @@ CREATE TABLE componente_curricular_turma ( -- +-- Name: docente_licenciatura; Type: TABLE; Schema: modules; Owner: -; Tablespace: +-- + +CREATE TABLE docente_licenciatura ( + id integer NOT NULL, + servidor_id integer NOT NULL, + licenciatura integer NOT NULL, + curso_id integer, + ano_conclusao integer NOT NULL, + ies_id integer, + user_id integer NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone +); + + +-- +-- Name: docente_licenciatura_id_seq; Type: SEQUENCE; Schema: modules; Owner: - +-- + +CREATE SEQUENCE docente_licenciatura_id_seq + START WITH 1 + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + + +-- +-- Name: docente_licenciatura_id_seq; Type: SEQUENCE OWNED BY; Schema: modules; Owner: - +-- + +ALTER SEQUENCE docente_licenciatura_id_seq OWNED BY docente_licenciatura.id; + + +-- +-- Name: docente_licenciatura_id_seq; Type: SEQUENCE SET; Schema: modules; Owner: - +-- + +SELECT pg_catalog.setval('docente_licenciatura_id_seq', 1, false); + + +-- -- Name: educacenso_cod_aluno; Type: TABLE; Schema: modules; Owner: -; Tablespace: -- @@ -16932,6 +16975,13 @@ ALTER TABLE componente_curricular ALTER COLUMN id SET DEFAULT nextval('component -- Name: id; Type: DEFAULT; Schema: modules; Owner: - -- +ALTER TABLE docente_licenciatura ALTER COLUMN id SET DEFAULT nextval('docente_licenciatura_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: modules; Owner: - +-- + ALTER TABLE educacenso_curso_superior ALTER COLUMN id SET DEFAULT nextval('educacenso_curso_superior_id_seq'::regclass); @@ -17876,6 +17926,12 @@ SET search_path = modules, pg_catalog; -- +-- Data for Name: docente_licenciatura; Type: TABLE DATA; Schema: modules; Owner: - +-- + + + +-- -- Data for Name: educacenso_cod_aluno; Type: TABLE DATA; Schema: modules; Owner: - -- @@ -25734,6 +25790,7 @@ INSERT INTO changelog VALUES (25, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '25_adic INSERT INTO changelog VALUES (26, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '26_cria_tabela_modules_transporte_aluno.sql'); INSERT INTO changelog VALUES (27, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '27_cria_tabela_modules_educacenso_cod_aluno_e_docente.sql'); INSERT INTO changelog VALUES (28, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '28_cria_tabelas_modules_educacenso_ies_e_curso_superior.sql'); +INSERT INTO changelog VALUES (29, 'Main', 'NOW()', 'NOW()', 'dbdeploy', '29_cria_tabela_modules_docente_licenciatura.sql'); -- @@ -32644,6 +32701,22 @@ ALTER TABLE ONLY componente_curricular_turma -- +-- Name: docente_licenciatura_curso_unique; Type: CONSTRAINT; Schema: modules; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY docente_licenciatura + ADD CONSTRAINT docente_licenciatura_curso_unique UNIQUE (servidor_id, curso_id, ies_id); + + +-- +-- Name: docente_licenciatura_pk; Type: CONSTRAINT; Schema: modules; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY docente_licenciatura + ADD CONSTRAINT docente_licenciatura_pk PRIMARY KEY (id); + + +-- -- Name: educacenso_cod_aluno_pk; Type: CONSTRAINT; Schema: modules; Owner: -; Tablespace: -- @@ -34634,6 +34707,13 @@ CREATE INDEX componente_curricular_turma_turma_idx ON componente_curricular_turm -- +-- Name: docente_licenciatura_ies_idx; Type: INDEX; Schema: modules; Owner: -; Tablespace: +-- + +CREATE INDEX docente_licenciatura_ies_idx ON docente_licenciatura USING btree (ies_id); + + +-- -- Name: regra_avaliacao_id_key; Type: INDEX; Schema: modules; Owner: -; Tablespace: -- @@ -38500,6 +38580,14 @@ ALTER TABLE ONLY componente_curricular_turma -- +-- Name: docente_licenciatura_ies_fk; Type: FK CONSTRAINT; Schema: modules; Owner: - +-- + +ALTER TABLE ONLY docente_licenciatura + ADD CONSTRAINT docente_licenciatura_ies_fk FOREIGN KEY (ies_id) REFERENCES educacenso_ies(id) ON DELETE RESTRICT; + + +-- -- Name: educacenso_cod_aluno_cod_aluno_fk; Type: FK CONSTRAINT; Schema: modules; Owner: - -- diff --git a/ieducar/modules/Docente/Model/Licenciatura.php b/ieducar/modules/Docente/Model/Licenciatura.php new file mode 100644 index 0000000..3975690 --- /dev/null +++ b/ieducar/modules/Docente/Model/Licenciatura.php @@ -0,0 +1,80 @@ + + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Arquivo disponível desde a versão 1.2.0 + * @version $Id$ + */ + +require_once 'CoreExt/Entity.php'; + +/** + * Docente_Model_Licenciatura class. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Classe disponível desde a versão 1.2.0 + * @version @@package_version@@ + */ +class Docente_Model_Licenciatura extends CoreExt_Entity +{ + protected $_data = array( + 'servidor' => NULL, + 'licenciatura' => NULL, + 'curso' => NULL, + 'anoConclusao' => NULL, + 'ies' => NULL, + 'user' => NULL, + 'created_at' => NULL, + 'updated_at' => NULL + ); + + protected $_references = array( + 'licenciatura' => array( + 'value' => NULL, + 'class' => 'App_Model_SimNao', + 'file' => 'App/Model/SimNao.php' + ), + 'ies' => array( + 'value' => NULL, + 'class' => 'Educacenso_Model_IesDataMapper', + 'file' => 'Educacenso/Model/IesDataMapper.php' + ), + 'curso' => array( + 'value' => NULL, + 'class' => 'Educacenso_Model_CursoSuperiorDataMapper', + 'file' => 'Educacenso/Model/CursoSuperiorDataMapper.php' + ) + ); + + public function getDefaultValidatorCollection() + { + return array(); + } +} \ No newline at end of file diff --git a/ieducar/modules/Docente/Model/LicenciaturaDataMapper.php b/ieducar/modules/Docente/Model/LicenciaturaDataMapper.php new file mode 100644 index 0000000..7f69084 --- /dev/null +++ b/ieducar/modules/Docente/Model/LicenciaturaDataMapper.php @@ -0,0 +1,62 @@ + + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Arquivo disponível desde a versão 1.2.0 + * @version $Id$ + */ + +require_once 'CoreExt/DataMapper.php'; +require_once 'Docente/Model/Licenciatura.php'; + +/** + * Docente_Model_LicenciaturaDataMapper class. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Classe disponível desde a versão 1.2.0 + * @version @@package_version@@ + */ +class Docente_Model_LicenciaturaDataMapper extends CoreExt_DataMapper +{ + protected $_entityClass = 'Docente_Model_Licenciatura'; + protected $_tableName = 'docente_licenciatura'; + protected $_tableSchema = 'modules'; + + protected $_attributeMap = array( + 'servidor' => 'servidor_id', + 'licenciatura' => 'licenciatura', + 'curso' => 'curso_id', + 'anoConclusao' => 'ano_conclusao', + 'ies' => 'ies_id', + 'user' => 'user_id', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ); +} \ No newline at end of file diff --git a/ieducar/modules/Docente/Views/EditController.php b/ieducar/modules/Docente/Views/EditController.php new file mode 100644 index 0000000..d2bdf4a --- /dev/null +++ b/ieducar/modules/Docente/Views/EditController.php @@ -0,0 +1,234 @@ + + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Arquivo disponível desde a versão 1.1.0 + * @version $Id$ + */ + +require_once 'Core/Controller/Page/EditController.php'; +require_once 'Educacenso/Model/CursoSuperiorDataMapper.php'; +require_once 'Educacenso/Model/IesDataMapper.php'; +require_once 'Docente/Model/LicenciaturaDataMapper.php'; + +require_once 'include/public/clsPublicUf.inc.php'; + +/** + * EditController class. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Classe disponível desde a versão 1.1.0 + * @version @@package_version@@ + */ +class EditController extends Core_Controller_Page_EditController +{ + protected $_dataMapper = 'Docente_Model_LicenciaturaDataMapper'; + protected $_titulo = 'Cadastro de Curso Superior/Licenciatura'; + protected $_processoAp = 635; + protected $_nivelAcessoOption = App_Model_NivelAcesso::SOMENTE_ESCOLA; + protected $_saveOption = TRUE; + protected $_deleteOption = TRUE; + + protected $_formMap = array( + 'servidor' => array( + 'label' => '', + 'help' => '', + 'entity' => 'servidor' + ), + 'licenciatura' => array( + 'label' => 'Licenciatura', + 'help' => '', + 'entity' => 'licenciatura' + ), + 'curso' => array( + 'label' => 'Curso', + 'help' => '', + 'entity' => 'curso' + ), + 'anoConclusao' => array( + 'label' => 'Ano conclusão', + 'help' => '', + 'entity' => 'anoConclusao' + ), + 'ies' => array( + 'label' => 'IES', + 'help' => '', + 'entity' => 'ies' + ), + 'user' => array( + 'label' => '', + 'help' => '', + 'entity' => 'user' + ), + 'created_at' => array( + 'label' => '', + 'help' => '', + 'entity' => 'created_at' + ) + ); + + protected function _preConstruct() + { + $params = array( + 'id' => $this->getRequest()->id, + 'servidor' => $this->getRequest()->servidor, + 'instituicao' => $this->getRequest()->instituicao + ); + $this->setOptions(array('new_success_params' => $params)); + $this->setOptions(array('edit_success_params' => $params)); + + unset($params['id']); + $this->setOptions(array('delete_success_params' => $params)); + } + + /** + * @see clsCadastro#Gerar() + */ + public function Gerar() + { + global $coreExt; + + $this->campoOculto('id', $this->getEntity()->id); + $this->campoOculto('servidor', $this->getRequest()->servidor); + + $cursoSuperiorMapper = new Educacenso_Model_CursoSuperiorDataMapper(); + $cursos = $cursoSuperiorMapper->findAll(array(), array(), array('id' => 'ASC', 'nome' => 'ASC')); + + // Licenciatura + $licenciatura = $this->getEntity()->get('licenciatura') ? + $this->getEntity()->get('licenciatura') : 0; + + $this->campoRadio('licenciatura', $this->_getLabel('licenciatura'), + array(1 => 'Sim', 0 => 'Não'), $licenciatura); + + // Curso + $opcoes = array(); + foreach ($cursos as $curso) { + $opcoes[$curso->id] = $curso->nome; + } + + $this->campoLista( + 'curso', $this->_getLabel('curso'), $opcoes, $this->getEntity()->get('curso') + ); + + // Ano conclusão + $opcoes = range(1960, date('Y')); + rsort($opcoes); + $opcoes = array_combine($opcoes, $opcoes); + $this->campoLista( + 'anoConclusao', $this->_getLabel('anoConclusao'), $opcoes, $this->getEntity()->anoConclusao + ); + + // UF da IES. + $ufs = new clsPublicUf(); + $ufs = $ufs->lista(); + + $opcoes = array(); + foreach ($ufs as $uf) { + $opcoes[$uf['sigla_uf']] = $uf['sigla_uf']; + } + ksort($opcoes); + + // Caso não seja uma instância persistida, usa a UF do locale. + $uf = $this->getEntity()->ies->uf ? + $this->getEntity()->ies->uf : $coreExt['Config']->app->locale->province; + + $this->campoLista('uf', 'UF', $opcoes, $uf, 'getIes()'); + + // IES. + $opcoes = array(); + $iesMapper = new Educacenso_Model_IesDataMapper(); + $iesUf = $iesMapper->findAll(array(), array('uf' => $uf)); + + foreach ($iesUf as $ies) { + $opcoes[$ies->id] = $ies->nome; + } + + // Adiciona a instituição "Não cadastrada". + $ies = $iesMapper->find(array('ies' => 9999999)); + $opcoes[$ies->id] = $ies->nome; + + $this->campoLista( + 'ies', $this->_getLabel('ies'), $opcoes, $this->getEntity()->ies->id + ); + + $this->url_cancelar = sprintf( + 'index?servidor=%d&instituicao=%d', + $this->getRequest()->servidor, $this->getRequest()->instituicao + ); + + // Javascript para Ajax. + echo +<< + function getIes() + { + var ies = document.getElementById('ies').value; + var uf = document.getElementById('uf').value; + + var url = '/modules/Educacenso/Views/IesAjaxController.php'; + var pars = '?uf=' + uf; + + var xml1 = new ajax(getIesXml); + xml1.envia(url + pars); + } + + function getIesXml(xml) + { + var ies = document.getElementById('ies'); + + ies.length = 1; + ies.options[0] = new Option('Selecione uma IES', '', false, false); + + var iesItems = xml.getElementsByTagName('ies'); + + for (var i = 0; i < iesItems.length; i++) { + ies.options[ies.options.length] = new Option( + iesItems[i].firstChild.nodeValue, iesItems[i].getAttribute('id'), false, false + ); + } + + if (ies.length == 1) { + ies.options[0] = new Option( + 'A UF não possui IES.', '', false, false + ); + } + } + +EOT; + } + + public function Novo() + { + $_POST['user'] = $this->getOption('id_usuario'); + $_POST['created_at'] = 'NOW()'; + parent::Novo(); + } +} \ No newline at end of file diff --git a/ieducar/modules/Docente/Views/IndexController.php b/ieducar/modules/Docente/Views/IndexController.php new file mode 100644 index 0000000..10e5691 --- /dev/null +++ b/ieducar/modules/Docente/Views/IndexController.php @@ -0,0 +1,119 @@ + + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Arquivo disponível desde a versão 1.2.0 + * @version $Id$ + */ + +require_once 'Core/Controller/Page/ListController.php'; +require_once 'Docente/Model/LicenciaturaDataMapper.php'; + +/** + * IndexController class. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Classe disponível desde a versão 1.2.0 + * @version @@package_version@@ + */ +class IndexController extends Core_Controller_Page_ListController +{ + protected $_dataMapper = 'Docente_Model_LicenciaturaDataMapper'; + protected $_titulo = 'Listagem de licenciaturas do servidor'; + protected $_processoAp = 635; + + protected $_tableMap = array( + 'Licenciatura' => 'licenciatura', + 'Curso' => 'curso', + 'Ano de conclusão' => 'anoConclusao', + 'IES' => 'ies' + ); + + public function getEntries() + { + return $this->getDataMapper()->findAll( + array(), array('servidor' => $this->getRequest()->servidor), array('anoConclusao' => 'ASC') + ); + } + + public function setAcao() + { + $this->acao = sprintf( + 'go("edit?servidor=%d&instituicao=%d")', + $this->getRequest()->servidor, $this->getRequest()->instituicao + ); + + $this->nome_acao = 'Novo'; + } + + public function Gerar() + { + $headers = $this->getTableMap(); + + $this->addCabecalhos(array_keys($headers)); + + $entries = $this->getEntries(); + + // Paginador + $this->limite = 20; + $this->offset = ($_GET['pagina_' . $this->nome]) ? + $_GET['pagina_' . $this->nome] * $this->limite - $this->limite + : 0; + + foreach ($entries as $entry) { + $item = array(); + $data = $entry->toArray(); + $options = array('query' => array( + 'id' => $entry->id, + 'servidor' => $entry->servidor, + 'instituicao' => $this->getRequest()->instituicao + )); + + foreach ($headers as $label => $attr) { + $item[] = CoreExt_View_Helper_UrlHelper::l( + $entry->$attr, 'view', $options + ); + } + + $this->addLinhas($item); + } + + $this->addPaginador2("", count($entries), $_GET, $this->nome, $this->limite); + + $this->setAcao(); + + $this->acao_voltar = sprintf( + 'go("/intranet/educar_servidor_det.php?cod_servidor=%d&ref_cod_instituicao=%d")', + $this->getRequest()->servidor, $this->getRequest()->instituicao + ); + + $this->largura = "100%"; + } +} \ No newline at end of file diff --git a/ieducar/modules/Docente/Views/ViewController.php b/ieducar/modules/Docente/Views/ViewController.php new file mode 100644 index 0000000..f9fcc8f --- /dev/null +++ b/ieducar/modules/Docente/Views/ViewController.php @@ -0,0 +1,79 @@ + + * + * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo + * sob os termos da Licença Pública Geral GNU conforme publicada pela Free + * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) + * qualquer versão posterior. + * + * Este programa é distribuí­do na expectativa de que seja útil, porém, SEM + * NENHUMA GARANTIA; nem mesmo a garantia implí­cita de COMERCIABILIDADE OU + * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral + * do GNU para mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto + * com este programa; se não, escreva para a Free Software Foundation, Inc., no + * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package ComponenteCurricular + * @subpackage Modules + * @since Arquivo disponível desde a versão 1.2.0 + * @version $Id$ + */ + +require_once 'Core/Controller/Page/ViewController.php'; +require_once 'Docente/Model/LicenciaturaDataMapper.php'; + +/** + * ViewController class. + * + * @author Eriksen Costa Paixão + * @category i-Educar + * @license @@license@@ + * @package Docente + * @subpackage Modules + * @since Classe disponível desde a versão 1.2.0 + * @version @@package_version@@ + */ +class ViewController extends Core_Controller_Page_ViewController +{ + protected $_dataMapper = 'Docente_Model_LicenciaturaDataMapper'; + protected $_titulo = 'Detalhes da licenciatura'; + protected $_processoAp = 635; + protected $_tableMap = array( + 'Licenciatura' => 'licenciatura', + 'Curso' => 'curso', + 'Ano de conclusão' => 'anoConclusao', + 'IES' => 'ies' + ); + + public function setUrlEditar(CoreExt_Entity $entry) + { + $this->url_editar = CoreExt_View_Helper_UrlHelper::url( + 'edit', array('query' => array( + 'id' => $entry->id, + 'servidor' => $entry->servidor, + 'instituicao' => $this->getRequest()->instituicao + )) + ); + } + + public function setUrlCancelar(CoreExt_Entity $entry) + { + $this->url_cancelar = CoreExt_View_Helper_UrlHelper::url( + 'index', array('query' => array( + 'id' => $entry->id, + 'servidor' => $entry->servidor, + 'instituicao' => $this->getRequest()->instituicao + )) + ); + } +} \ No newline at end of file diff --git a/ieducar/modules/Docente/_data/install.sql b/ieducar/modules/Docente/_data/install.sql new file mode 100644 index 0000000..2ead9fd --- /dev/null +++ b/ieducar/modules/Docente/_data/install.sql @@ -0,0 +1,23 @@ +CREATE TABLE modules.docente_licenciatura +( + id serial, + servidor_id integer NOT NULL, + licenciatura integer NOT NULL, + curso_id integer, + ano_conclusao integer NOT NULL, + ies_id integer, + user_id integer NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone, + CONSTRAINT docente_licenciatura_pk PRIMARY KEY (id), + CONSTRAINT docente_licenciatura_curso_unique UNIQUE (servidor_id, curso_id, ies_id) +) WITH (OIDS=FALSE); + + +ALTER TABLE modules.docente_licenciatura ADD + CONSTRAINT docente_licenciatura_ies_fk + FOREIGN KEY (ies_id) + REFERENCES modules.educacenso_ies (id) + ON UPDATE NO ACTION ON DELETE RESTRICT; + +CREATE INDEX docente_licenciatura_ies_idx ON modules.docente_licenciatura(ies_id); \ No newline at end of file -- libgit2 0.21.2