/** * @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')); }
/** * @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()))); }