Ejemplo n.º 1
0
 /**
  * @see CoreExt_Entity_Validatable#getDefaultValidatorCollection()
  */
 public function getDefaultValidatorCollection()
 {
     // Enums
     $tipoNotaValor = RegraAvaliacao_Model_Nota_TipoValor::getInstance();
     $tipoProgressao = RegraAvaliacao_Model_TipoProgressao::getInstance();
     $tipoParecerDescritivo = RegraAvaliacao_Model_TipoParecerDescritivo::getInstance();
     $tipoPresenca = RegraAvaliacao_Model_TipoPresenca::getInstance();
     // ids de fórmulas de média
     $formulaMedia = $this->getDataMapper()->findFormulaMediaFinal();
     $formulaMedia = CoreExt_Entity::entityFilterAttr($formulaMedia, 'id');
     // ids de fórmulas de recuperação
     $formulaRecuperacao = $this->getDataMapper()->findFormulaMediaRecuperacao();
     $formulaRecuperacao = CoreExt_Entity::entityFilterAttr($formulaRecuperacao, 'id');
     $formulaRecuperacao[0] = NULL;
     // ids de tabelas de arredondamento
     $tabelas = $this->getDataMapper()->findTabelaArredondamento($this);
     $tabelas = CoreExt_Entity::entityFilterAttr($tabelas, 'id');
     // Instituições
     $instituicoes = array_keys(App_Model_IedFinder::getInstituicoes());
     // Fórmula de média é obrigatória?
     $isFormulaMediaRequired = TRUE;
     // Média é obrigatória?
     $isMediaRequired = TRUE;
     if ($this->get('tipoNota') == RegraAvaliacao_Model_Nota_TipoValor::NENHUM) {
         $isFormulaMediaRequired = FALSE;
         $isMediaRequired = FALSE;
         // Aceita somente o valor NULL quando o tipo de nota é Nenhum.
         $formulaMedia = $formulaMedia + array(NULL);
     }
     return array('instituicao' => new CoreExt_Validate_Choice(array('choices' => $instituicoes)), 'nome' => new CoreExt_Validate_String(array('min' => 5, 'max' => 50)), 'formulaMedia' => new CoreExt_Validate_Choice(array('choices' => $formulaMedia, 'required' => $isFormulaMediaRequired)), 'formulaRecuperacao' => new CoreExt_Validate_Choice(array('choices' => $formulaRecuperacao, 'required' => FALSE)), 'tipoNota' => new CoreExt_Validate_Choice(array('choices' => $tipoNotaValor->getKeys())), 'tipoProgressao' => new CoreExt_Validate_Choice(array('choices' => $tipoProgressao->getKeys())), 'tabelaArredondamento' => new CoreExt_Validate_Choice(array('choices' => $tabelas, 'choice_error' => 'A tabela de arredondamento selecionada não ' . 'corresponde ao sistema de nota escolhido.')), 'parecerDescritivo' => new CoreExt_Validate_Choice(array('choices' => $tipoParecerDescritivo->getKeys())), 'tipoPresenca' => new CoreExt_Validate_Choice(array('choices' => $tipoPresenca->getKeys())), 'media' => $this->validateIfEquals('tipoProgressao', RegraAvaliacao_Model_TipoProgressao::CONTINUADA, 'CoreExt_Validate_Numeric', array('required' => $isMediaRequired, 'min' => 1, 'max' => 10), array('required' => $isMediaRequired, 'min' => 0, 'max' => 10)), 'porcentagemPresenca' => new CoreExt_Validate_Numeric(array('min' => 1, 'max' => 100)), 'mediaRecuperacao' => $this->validateIfEquals('tipoProgressao', RegraAvaliacao_Model_TipoProgressao::CONTINUADA, 'CoreExt_Validate_Numeric', array('required' => $isMediaRequired, 'min' => 1, 'max' => 14), array('required' => $isMediaRequired, 'min' => 0, 'max' => 14)));
 }
Ejemplo n.º 2
0
 protected function inputOptions($options)
 {
     $resources = $options['resources'];
     if (empty($resources)) {
         $resources = App_Model_IedFinder::getInstituicoes();
     }
     return $this->insertOption(null, "Selecione uma instituição", $resources);
 }
Ejemplo n.º 3
0
 /**
  * @see clsCadastro#Gerar()
  */
 public function Gerar()
 {
     $this->campoOculto('id', $this->getEntity()->id);
     // Instituição
     $instituicoes = App_Model_IedFinder::getInstituicoes();
     $this->campoLista('instituicao', $this->_getLabel('instituicao'), $instituicoes, $this->getEntity()->instituicao);
     // Nome
     $this->campoTexto('nome', $this->_getLabel('nome'), $this->getEntity()->nome, 60, 60, TRUE, FALSE, FALSE, $this->_getHelp('nome'));
 }
Ejemplo n.º 4
0
 public function getDefaultValidatorCollection()
 {
     $instituicoes = array_keys(App_Model_IedFinder::getInstituicoes());
     $tipoBase = ComponenteCurricular_Model_TipoBase::getInstance();
     $tipos = $tipoBase->getKeys();
     $areas = $this->getDataMapper()->findAreaConhecimento();
     $areas = CoreExt_Entity::entityFilterAttr($areas, 'id');
     return array('instituicao' => new CoreExt_Validate_Choice(array('choices' => $instituicoes)), 'nome' => new CoreExt_Validate_String(array('min' => 5, 'max' => 200)), 'abreviatura' => new CoreExt_Validate_String(array('min' => 2, 'max' => 15)), 'tipo_base' => new CoreExt_Validate_Choice(array('choices' => $tipos)), 'area_conhecimento' => new CoreExt_Validate_Choice(array('choices' => $areas)));
 }
Ejemplo n.º 5
0
 /**
  * @see CoreExt_Entity_Validatable#getDefaultValidatorCollection()
  */
 public function getDefaultValidatorCollection()
 {
     $instituicoes = array_keys(App_Model_IedFinder::getInstituicoes());
     // Tipo nota
     $tipoNota = RegraAvaliacao_Model_Nota_TipoValor::getInstance();
     $tipoNotas = $tipoNota->getKeys();
     // Remove "nenhum" das opções.
     unset($tipoNotas[RegraAvaliacao_Model_Nota_TipoValor::NENHUM]);
     return array('instituicao' => new CoreExt_Validate_Choice(array('choices' => $instituicoes)), 'nome' => new CoreExt_Validate_String(array('min' => 5, 'max' => 50)), 'tipoNota' => new CoreExt_Validate_Choice(array('choices' => $tipoNotas)));
 }
Ejemplo n.º 6
0
 /**
  * @see clsCadastro#Gerar()
  */
 public function Gerar()
 {
     $this->campoOculto('id', $this->getEntity()->id);
     // Instituição
     $instituicoes = App_Model_IedFinder::getInstituicoes();
     $this->campoLista('instituicao', $this->_getLabel('instituicao'), $instituicoes, $this->getEntity()->instituicao);
     // Nome
     $this->campoTexto('nome', $this->_getLabel('nome'), $this->getEntity()->nome, 50, 200, TRUE, FALSE, FALSE, $this->_getHelp('nome'));
     // Abreviatura
     $this->campoTexto('abreviatura', $this->_getLabel('abreviatura'), $this->getEntity()->abreviatura, 50, 25, TRUE, FALSE, FALSE, $this->_getHelp('abreviatura'));
     // Tipo Base
     $tipoBase = ComponenteCurricular_Model_TipoBase::getInstance();
     $this->campoRadio('tipo_base', $this->_getLabel('tipo_base'), $tipoBase->getEnums(), $this->getEntity()->get('tipo_base'));
     // Área de conhecimento
     $areas = $this->getDataMapper()->findAreaConhecimento();
     $areas = CoreExt_Entity::entityFilterAttr($areas, 'id', 'nome');
     $this->campoLista('area_conhecimento', $this->_getLabel('area_conhecimento'), $areas, $this->getEntity()->get('area_conhecimento'));
 }
Ejemplo n.º 7
0
 /**
  * @see clsCadastro#Gerar()
  */
 public function Gerar()
 {
     $this->campoOculto('id', $this->getEntity()->id);
     // Instituição
     $instituicoes = App_Model_IedFinder::getInstituicoes();
     $this->campoLista('instituicao', $this->_getLabel('instituicao'), $instituicoes, $this->getEntity()->instituicao);
     // Nome
     $this->campoTexto('nome', $this->_getLabel('nome'), $this->getEntity()->nome, 40, 50, TRUE, FALSE, FALSE, $this->_getHelp('nome'));
     // Fórmula de média
     $this->campoTexto('formulaMedia', $this->_getLabel('formulaMedia'), $this->getEntity()->formulaMedia, 40, 50, TRUE, FALSE, FALSE, $this->_getHelp('formulaMedia'));
     // Fórmula de recuperação
     /*$this->campoTexto('formulaRecuperacao', $this->_getLabel('formulaRecuperacao'),
       $this->getEntity()->formulaRecuperacao, 40, 50, TRUE, FALSE, FALSE,
       $this->_getHelp('formulaRecuperacao'));*/
     // Tipo de fórmula
     $tipoFormula = FormulaMedia_Model_TipoFormula::getInstance();
     $this->campoRadio('tipoFormula', $this->_getLabel('tipoFormula'), $tipoFormula->getEnums(), $this->getEntity()->get('tipoFormula'));
 }
 function renderHTML()
 {
     if ($_POST) {
         foreach ($_POST as $key => $value) {
             $this->{$key} = $value;
         }
     }
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     // Instancia o objeto clsPDF
     $this->pdf = new clsPDF('Boletim', 'BolTit', 'A4', '');
     $this->pdf->largura = 842.0;
     $this->pdf->altura = 595.0;
     $this->pdf->topmargin = 5;
     $this->pdf->bottommargirn = 5;
     $altura_linha = 13;
     // Instituição
     $instituicao = App_Model_IedFinder::getInstituicoes();
     $instituicao = $instituicao[$this->ref_cod_instituicao];
     // Escola
     $escola = new clsPmieducarEscola();
     $escola->cod_escola = $this->ref_cod_escola;
     $escola = $escola->detalhe();
     $escola = $escola['nome'];
     // Carrega as informações do curso
     $serie = new clsPmieducarSerie($this->ref_ref_cod_serie, NULL, NULL, $this->ref_cod_curso);
     // Dados da série
     $serie = $serie->detalhe();
     // Recupera a regra da série
     $regraMapper = new RegraAvaliacao_Model_RegraDataMapper();
     $regra = $regraMapper->find($serie['regra_avaliacao_id']);
     // Carrega alunos matriculados
     $matriculaTurma = new clsPmieducarMatriculaTurma();
     $matriculaTurma->setOrderby('nome_aluno');
     $matriculados = $matriculaTurma->lista($this->ref_cod_matricula, $this->ref_cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_serie, $this->ref_cod_curso, $this->ref_cod_escola, $this->ref_cod_instituicao, NULL, NULL, NULL, NULL, NULL, $this->ano, NULL, TRUE);
     foreach ($matriculados as $matriculado) {
         $this->pdf->OpenPage();
         $this->page_y = 10;
         $codMatricula = $matriculado['ref_cod_matricula'];
         $nomeAluno = $matriculado['nome_aluno'];
         $turma = $matriculado['nm_turma'];
         $boletim = new Avaliacao_Service_Boletim(array('matricula' => $codMatricula));
         $matriculaData = $boletim->getOption('matriculaData');
         $curso = $matriculaData['curso_nome'];
         $serie = $matriculaData['serie_nome'];
         $this->addCabecalho($instituicao, $escola, $codMatricula, $nomeAluno, $curso, $turma, $serie);
         $this->inicio_y = $this->page_y - 25;
         $this->_notasFaltasComponentes($boletim);
         $situacao = $boletim->getSituacaoAluno();
         $this->page_y += 25;
         $this->rodape($codMatricula, $nomeAluno, $matriculaData['aprovado']);
         $this->pdf->ClosePage();
     }
     $this->pdf->CloseFile();
     $this->get_link = $this->pdf->GetLink();
     echo sprintf('
   <script>
     window.onload = function()
     {
       parent.EscondeDiv("LoadImprimir");
       window.location="download.php?filename=%s"
     }
   </script>', $this->get_link);
     echo sprintf('
   <html>
     <center>
       Se o download não iniciar automaticamente <br /><a target="blank" href="%s" style="font-size: 16px; color: #000000; text-decoration: underline;">clique aqui!</a><br><br>
       <span style="font-size: 10px;">Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>
         Clique na Imagem para Baixar o instalador<br><br>
         <a href="http://www.adobe.com.br/products/acrobat/readstep2.html" target="new"><br><img src="imagens/acrobat.gif" width="88" height="31" border="0"></a>
       </span>
     </center>
   </html>', $this->get_link);
 }
Ejemplo n.º 9
0
 public function getDefaultValidatorCollection()
 {
     $instituicoes = array_keys(App_Model_IedFinder::getInstituicoes());
     return array('instituicao' => new CoreExt_Validate_Choice(array('choices' => $instituicoes)), 'nome' => new CoreExt_Validate_String(array('min' => 5, 'max' => 60)), 'secao' => new CoreExt_Validate_String(array('min' => 0, 'max' => 50)));
 }
Ejemplo n.º 10
0
 /**
  * @see clsCadastro#Gerar()
  */
 public function Gerar()
 {
     $this->campoOculto('id', $this->getEntity()->id);
     // Instituição
     $instituicoes = App_Model_IedFinder::getInstituicoes();
     $this->campoLista('instituicao', $this->_getLabel('instituicao'), $instituicoes, $this->getEntity()->instituicao);
     // Nome
     $this->campoTexto('nome', $this->_getLabel('nome'), $this->getEntity()->nome, 50, 50, TRUE, FALSE, FALSE, $this->_getHelp('nome'));
     // Nota tipo valor
     $notaTipoValor = RegraAvaliacao_Model_Nota_TipoValor::getInstance();
     $this->campoRadio('tipoNota', $this->_getLabel('tipoNota'), $notaTipoValor->getEnums(), $this->getEntity()->get('tipoNota'), '', $this->_getHelp('tipoNota'));
     // Tabela de arredondamento
     $tabelaArredondamento = $this->getDataMapper()->findTabelaArredondamento($this->getEntity());
     $tabelaArredondamento = CoreExt_Entity::entityFilterAttr($tabelaArredondamento, 'id', 'nome');
     if (empty($tabelaArredondamento)) {
         $tabelaArredondamento = array(0 => 'O tipo de nota não possui tabela de arredondamento.');
     }
     $this->campoLista('tabelaArredondamento', $this->_getLabel('tabelaArredondamento'), $tabelaArredondamento, $this->getEntity()->get('tabelaArredondamento'), '', FALSE, $this->_getHelp('tabelaArredondamento'), '', FALSE, FALSE);
     // Tipo progressão
     $tipoProgressao = RegraAvaliacao_Model_TipoProgressao::getInstance();
     $this->campoRadio('tipoProgressao', $this->_getLabel('tipoProgressao'), $tipoProgressao->getEnums(), $this->getEntity()->get('tipoProgressao'), '', $this->_getHelp('tipoProgressao'));
     // Média
     $this->campoTexto('media', $this->_getLabel('media'), $this->getEntity()->media, 5, 50, FALSE, FALSE, FALSE, $this->_getHelp('media'));
     $this->campoTexto('mediaRecuperacao', $this->_getLabel('mediaRecuperacao'), $this->getEntity()->mediaRecuperacao, 5, 50, FALSE, FALSE, FALSE, $this->_getHelp('mediaRecuperacao'));
     // Cálculo média
     $formulas = $this->getDataMapper()->findFormulaMediaFinal();
     $formulas = CoreExt_Entity::entityFilterAttr($formulas, 'id', 'nome');
     $this->campoLista('formulaMedia', $this->_getLabel('formulaMedia'), $formulas, $this->getEntity()->get('formulaMedia'), '', FALSE, $this->_getHelp('formulaMedia'), '', FALSE, FALSE);
     // Cálculo média recuperação
     $formulas = $this->getDataMapper()->findFormulaMediaRecuperacao();
     $formulasArray = array(0 => 'Não usar recuperação');
     $formulasArray = $formulasArray + CoreExt_Entity::entityFilterAttr($formulas, 'id', 'nome');
     $this->campoLista('formulaRecuperacao', $this->_getLabel('formulaRecuperacao'), $formulasArray, $this->getEntity()->get('formulaRecuperacao'), '', FALSE, $this->_getHelp('formulaRecuperacao'), '', FALSE, FALSE);
     // Porcentagem presença
     $this->campoTexto('porcentagemPresenca', $this->_getLabel('porcentagemPresenca'), $this->getEntity()->porcentagemPresenca, 5, 50, TRUE, FALSE, FALSE, $this->_getHelp('porcentagemPresenca'));
     // Parecer descritivo
     $parecerDescritivo = RegraAvaliacao_Model_TipoParecerDescritivo::getInstance();
     $this->campoRadio('parecerDescritivo', $this->_getLabel('parecerDescritivo'), $parecerDescritivo->getEnums(), $this->getEntity()->get('parecerDescritivo'), '', $this->_getHelp('parecerDescritivo'));
     // Presença
     $tipoPresenca = RegraAvaliacao_Model_TipoPresenca::getInstance();
     $this->campoRadio('tipoPresenca', $this->_getLabel('tipoPresenca'), $tipoPresenca->getEnums(), $this->getEntity()->get('tipoPresenca'), '', $this->_getHelp('tipoPresenca'));
 }
Ejemplo n.º 11
0
 /**
  * @see CoreExt_Entity_Validatable#getDefaultValidatorCollection()
  */
 public function getDefaultValidatorCollection()
 {
     $instituicoes = array_keys(App_Model_IedFinder::getInstituicoes());
     $tipoFormula = FormulaMedia_Model_TipoFormula::getInstance();
     // Se for de recuperação, inclui a token "Rc" como permitida.
     $formulaValidatorOptions = array();
     if (FormulaMedia_Model_TipoFormula::MEDIA_RECUPERACAO == $this->get('tipoFormula')) {
         $formulaValidatorOptions = array('excludeToken' => NULL);
     }
     return array('instituicao' => new CoreExt_Validate_Choice(array('choices' => $instituicoes)), 'nome' => new CoreExt_Validate_String(array('min' => 5, 'max' => 50)), 'formulaMedia' => new FormulaMedia_Validate_Formula($formulaValidatorOptions), 'tipoFormula' => new CoreExt_Validate_Choice(array('choices' => $tipoFormula->getKeys())));
 }
Ejemplo n.º 12
0
 /**
  * @see clsCadastro#Gerar()
  */
 public function Gerar()
 {
     $this->campoOculto('id', $this->getEntity()->id);
     // Instituição
     $instituicoes = App_Model_IedFinder::getInstituicoes();
     $this->campoLista('instituicao', $this->_getLabel('instituicao'), $instituicoes, $this->getEntity()->instituicao);
     // Nome
     $this->campoTexto('nome', $this->_getLabel('nome'), $this->getEntity()->nome, 40, 50, TRUE, FALSE, FALSE, $this->_getHelp('nome'));
     // Tipo de nota
     $notaTipoValor = RegraAvaliacao_Model_Nota_TipoValor::getInstance();
     $notaTipos = $notaTipoValor->getEnums();
     unset($notaTipos[RegraAvaliacao_Model_Nota_TipoValor::NENHUM]);
     if ($this->getEntity()->id != '') {
         $this->campoTexto('tipNota', $this->_getLabel('tipoNota'), $notaTipos[$this->getEntity()->get('tipoNota')], 40, 40, false, false, false, '', '', '', '', true);
     } else {
         $this->campoRadio('tipoNota', $this->_getLabel('tipoNota'), $notaTipos, $this->getEntity()->get('tipoNota'), '', $this->_getHelp('tipoNota'));
     }
     // Parte condicional
     if (!$this->getEntity()->isNew()) {
         // Quebra
         $this->campoQuebra();
         // Ajuda
         $help = 'Caso seja necessário adicionar mais notas, ' . 'salve o formulário. Automaticamente 3 campos ' . 'novos ficarão disponíveis.<br /><br />';
         $this->campoRotulo('__help1', '<strong>Notas para arredondamento</strong><br />', $help, FALSE, '', '');
         // Cria campos para a postagem de notas
         $valores = $this->getDataMapper()->findTabelaValor($this->getEntity());
         for ($i = 0, $loop = count($valores); $i < ($loop == 0 ? 5 : $loop + 3); $i++) {
             $valorNota = $valores[$i];
             $valor_label = sprintf("valor[label][%d]", $i);
             $valor_id = sprintf("valor[id][%d]", $i);
             $valor_nome = sprintf("valor[nome][%d]", $i);
             $valor_descricao = sprintf("valor[descricao][%d]", $i);
             $valor_valor_minimo = sprintf("valor[valor_minimo][%d]", $i);
             $valor_valor_maximo = sprintf("valor[valor_maximo][%d]", $i);
             $this->campoRotulo($valor_label, 'Arredondamento ' . ($i + 1), $this->_getLabel(''), TRUE);
             // Id
             $this->campoOculto($valor_id, $valorNota->id);
             // Nome
             $this->campoTexto($valor_nome, $this->_getLabel('valor_nome'), $valorNota->nome, 5, 5, FALSE, FALSE, TRUE, $this->_getHelp('valor_nome'));
             // Descrição (se conceitual)
             if (RegraAvaliacao_Model_Nota_TipoValor::CONCEITUAL == $this->getEntity()->get('tipoNota')) {
                 $this->campoTexto($valor_descricao, $this->_getLabel('valor_descricao'), $valorNota->descricao, 15, 25, FALSE, FALSE, TRUE, $this->_getHelp('valor_descricao'));
             }
             // Valor mínimo
             $this->campoTexto($valor_valor_minimo, $this->_getLabel('valor_valor_minimo'), $valorNota->valorMinimo, 6, 6, FALSE, FALSE, TRUE, $this->_getHelp('valor_valor_minimo'));
             // Valor máximo
             $this->campoTexto($valor_valor_maximo, $this->_getLabel('valor_valor_maximo'), $valorNota->valorMaximo, 6, 6, FALSE, FALSE, FALSE, $this->_getHelp('valor_valor_maximo'));
         }
         // Quebra
         $this->campoQuebra();
     }
 }
Ejemplo n.º 13
0
 public function testGetInstituicoes()
 {
     $returnValue = array(array('cod_instituicao' => 1, 'nm_instituicao' => 'Instituição'));
     $expected = array(1 => 'Instituição');
     $mock = $this->getCleanMock('clsPmieducarInstituicao');
     $mock->expects($this->once())->method('lista')->will($this->returnValue($returnValue));
     // Registra a instância no repositório de classes de CoreExt_Entity
     $instance = App_Model_IedFinder::addClassToStorage('clsPmieducarInstituicao', $mock);
     $instituicoes = App_Model_IedFinder::getInstituicoes();
     $this->assertEquals($expected, $instituicoes, '::getInstituicoes() retorna todas as instituições cadastradas.');
 }