protected function inputOptions($options) { $resources = $options['resources']; $instituicaoId = $this->getInstituicaoId($options['instituicaoId']); $escolaId = $this->getEscolaId($options['escolaId']); $serieId = $this->getSerieId($options['serieId']); $ano = $this->viewInstance->ano; $userId = $this->getCurrentUserId(); $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); if ($escolaId and $serieId and empty($resources) and $isProfessor) { $turmas = Portabilis_Business_Professor::turmasAlocado($escolaId, $serieId, $userId); $resources = Portabilis_Array_Utils::setAsIdValue($turmas, 'id', 'nome'); } elseif ($escolaId && $serieId && empty($resources)) { $resources = App_Model_IedFinder::getTurmas($escolaId, $serieId); } // caso no letivo esteja definido para filtrar turmas por ano, // somente exibe as turmas do ano letivo. if ($escolaId && $ano && $this->turmasPorAno($escolaId, $ano)) { foreach ($resources as $id => $nome) { $turma = new clsPmieducarTurma(); $turma->cod_turma = $id; $turma = $turma->detalhe(); if ($turma['ano'] != $ano) { unset($resources[$id]); } } } return $this->insertOption(null, "Selecione uma turma", $resources); }
protected function getTurmas() { if ($this->canGetTurmas()) { $userId = $this->getSession()->id_pessoa; $instituicaoId = $this->getRequest()->instituicao_id; $escolaId = $this->getRequest()->escola_id; $serieId = $this->getRequest()->serie_id; $ano = $this->getRequest()->ano; $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); if ($isProfessor) { $turmas = Portabilis_Business_Professor::turmasAlocado($escolaId, $serieId, $userId); } else { $sql = "select cod_turma as id, nm_turma || ' - ' || COALESCE(ano::varchar,'SEM ANO') as nome from pmieducar.turma where ref_ref_cod_escola = \$1\n and (ref_ref_cod_serie = \$2 or ref_ref_cod_serie_mult = \$2) and ativo = 1 and\n visivel != 'f' order by nm_turma asc"; $turmas = $this->fetchPreparedQuery($sql, array($escolaId, $serieId)); } // caso no ano letivo esteja definido para filtrar turmas por ano, // somente retorna as turmas do ano letivo. if ($ano && $this->turmasPorAno($escolaId, $ano)) { foreach ($turmas as $index => $t) { $turma = new clsPmieducarTurma(); $turma->cod_turma = $t['id']; $turma = $turma->detalhe(); if ($turma['ano'] != $ano) { unset($turmas[$index]); } } } $options = array(); foreach ($turmas as $turma) { $options['__' . $turma['id']] = $this->toUtf8($turma['nome']); } return array('options' => $options); } }
protected function getComponentesCurriculares() { if ($this->canGetComponentesCurriculares()) { $userId = $this->getSession()->id_pessoa; $instituicaoId = $this->getRequest()->instituicao_id; $turmaId = $this->getRequest()->turma_id; $ano = $this->getRequest()->ano; $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); if ($isProfessor) { $componentesCurriculares = Portabilis_Business_Professor::componentesCurricularesAlocado($turmaId, $ano, $userId); } else { $sql = "select cc.id, cc.nome, ac.nome as area_conhecimento, ac.secao as secao_area_conhecimento\n from pmieducar.turma, modules.componente_curricular_turma as cct, modules.componente_curricular as cc, modules.area_conhecimento as ac, \n pmieducar.escola_ano_letivo as al where turma.cod_turma = \$1 and cct.turma_id = turma.cod_turma and\n cct.escola_id = turma.ref_ref_cod_escola and cct.componente_curricular_id = cc.id and al.ano = \$2\n and cct.escola_id = al.ref_cod_escola and cc.area_conhecimento_id = ac.id\n order by ac.secao, ac.nome, cc.nome"; $componentesCurriculares = $this->fetchPreparedQuery($sql, array($turmaId, $ano)); if (count($ComponentesCurriculares) < 1) { $sql = "select cc.id, cc.nome, ac.nome as area_conhecimento, ac.secao as secao_area_conhecimento from\n pmieducar.turma as t, pmieducar.escola_serie_disciplina as esd, modules.componente_curricular\n as cc, modules.area_conhecimento as ac, pmieducar.escola_ano_letivo as al where t.cod_turma = \$1 and esd.ref_ref_cod_escola =\n t.ref_ref_cod_escola and esd.ref_ref_cod_serie = t.ref_ref_cod_serie and esd.ref_cod_disciplina =\n cc.id and al.ano = \$2 and esd.ref_ref_cod_escola = al.ref_cod_escola and t.ativo = 1 and\n esd.ativo = 1 and al.ativo = 1 and cc.area_conhecimento_id = ac.id\n order by ac.secao, ac.nome, cc.nome"; $componentesCurriculares = $this->fetchPreparedQuery($sql, array($turmaId, $ano)); } } $options = array(); foreach ($componentesCurriculares as $componenteCurricular) { $areaConhecimento = ($componenteCurricular['secao_area_conhecimento'] != '' ? $componenteCurricular['secao_area_conhecimento'] . ' - ' : '') . $componenteCurricular['area_conhecimento']; $options['__' . $componenteCurricular['id']] = array('value' => $this->toUtf8($componenteCurricular['nome']), 'group' => $this->toUtf8($areaConhecimento)); } return array('options' => $options); } }
protected function inputOptions($options) { $resources = $options['resources']; $instituicaoId = $this->getInstituicaoId($options['instituicaoId']); $escolaId = $this->getEscolaId($options['escolaId']); $userId = $this->getCurrentUserId(); $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); if ($instituicaoId and $escolaId and empty($resources) and $isProfessor) { $cursos = Portabilis_Business_Professor::cursosAlocado($instituicaoId, $escolaId, $userId); $resources = Portabilis_Array_Utils::setAsIdValue($cursos, 'id', 'nome'); } elseif ($escolaId && empty($resources)) { $resources = App_Model_IedFinder::getCursos($escolaId); } return $this->insertOption(null, "Selecione um curso", $resources); }
protected function getCursos() { if ($this->canGetCursos()) { $userId = $this->getSession()->id_pessoa; $instituicaoId = $this->getRequest()->instituicao_id; $escolaId = $this->getRequest()->escola_id; $isProfessor = Portabilis_Business_Professor::isProfessor($instituicaoId, $userId); if ($isProfessor) { $cursos = Portabilis_Business_Professor::cursosAlocado($instituicaoId, $escolaId, $userId); } else { $sql = "select c.cod_curso as id, c.nm_curso as nome FROM pmieducar.curso c,\n pmieducar.escola_curso ec WHERE ec.ref_cod_escola = \$1 AND ec.ref_cod_curso =\n c.cod_curso AND ec.ativo = 1 AND c.ativo = 1 ORDER BY c.nm_curso ASC"; $cursos = $this->fetchPreparedQuery($sql, $escolaId); } $options = array(); foreach ($cursos as $curso) { $options['__' . $curso['id']] = $this->toUtf8($curso['nome']); } return array('options' => $options); } }
public function escola($options = array()) { $isProfessor = Portabilis_Business_Professor::isProfessor($this->getInstituicaoId($options['instituicaoId']), $this->getCurrentUserId()); if ($this->hasNivelAcesso('POLI_INSTITUCIONAL') || $this->hasNivelAcesso('INSTITUCIONAL') || $isProfessor) { $this->selectInput($options); } elseif ($this->hasNivelAcesso('SOMENTE_ESCOLA') || $this->hasNivelAcesso('SOMENTE_BIBLIOTECA')) { $this->stringInput($options); } Portabilis_View_Helper_Application::loadJavascript($this->viewInstance, '/modules/DynamicInput/Assets/Javascripts/Escola.js'); }