Exemplo n.º 1
0
 /**
  * @author esilva
  * 
  * Checa se usuario é Produtor Rural
  * 
  * PRural nao possui cnpj
  * 
  * esta regra foi validada com o Marco em 3 maio 13
  * @return boolean
  */
 public function identificaProdutorRural()
 {
     $produtorRural = false;
     $arrEnterprise = $this->objDevolutive->getArrEnterprise();
     if (is_null($arrEnterprise['CPF/CNPJ']) || $arrEnterprise['CPF/CNPJ'] == '') {
         $produtorRural = true;
     }
     return $produtorRural;
 }
Exemplo n.º 2
0
 /**
  * 
  * 
  * metodo que recebe objeto Devolutive e nomeia arquivo pdf e cria diretorio onde pdf sera gravado
  * 
  * @param Model_Devolutive $objDevolutive
  * 
  * @return boolean
  */
 public function preparaFileSystemParaDevolutiva()
 {
     $result = false;
     $arrUser = array('Id = ?' => $this->objDevolutive->getUserId());
     $this->userSalt = $this->tbUser->fetchRow($arrUser)->getSalt();
     if (!$this->objDevolutive->getIsRA()) {
         $arqName = self::ARQNAME_DEVOLUTIVE . $this->objDevolutive->getQuestionnaireId() . "_" . date("YmdHis") . self::EXTENSION_ARQ;
     } else {
         $arqName = self::ARQNAME_EVALUATION . $this->objDevolutive->getQuestionnaireId() . "_" . date("YmdHis") . self::EXTENSION_ARQ;
     }
     $this->objDevolutive->setArqName($arqName);
     $basePath = self::BASE_PATH . hash("sha256", $this->objDevolutive->getUserId() . "_" . $this->userSalt) . "/";
     $dirName = $this->public_path . $basePath;
     $this->objDevolutive->setDirName($dirName);
     $publicDir = Zend_Controller_Front::getInstance()->getBaseUrl() . $basePath;
     $this->objDevolutive->setPublicDir($publicDir);
     $arqPath = $publicDir . $arqName;
     $this->objDevolutive->setArqPath($arqPath);
     //cria diretorio para pdf
     try {
         if (!is_dir($dirName)) {
             mkdir($dirName);
         }
         chmod($dirName, 0777);
     } catch (Excception $e) {
     }
     return $result;
 }
Exemplo n.º 3
0
 /**
  * Verifica se questionario possui blocos Padrao: Negocios e Empreendedorismo
  * 
  * @param type $questionnaire_id
  * @throws Exception
  */
 protected function validaBlocosQuestionario($questionnaire_id)
 {
     $blocks = $this->Questionnaire->getBlocksAutoavaliacao($questionnaire_id);
     //caso Bloco do questionario nao exista
     if (!$blocks) {
         //$urldevolutiva = $this->printAvisoPdfDevolutivaCasoNaoHajaBlocoQuestionario($arrBlocksResult);
         //return $urldevolutiva;
         throw new Exception($this->_messagesError['blocksNotExists']);
     }
     //bloco 1 do questionario
     //$negociosBlockId = $blocks[0];
     $negociosBlockId = Zend_Registry::get('configDb')->qstn->currentBlockIdNegocios;
     //bloco 2 do questionario
     //$enterpreneurBlockId = $blocks[1];
     $enterpreneurBlockId = Zend_Registry::get('configDb')->qstn->currentBlockIdEmpreendedorismo;
     //seta blocos para uso na classe que processara a devolutiva
     $this->Devolutive->setBlockIdNegocios($negociosBlockId);
     $this->Devolutive->setBlockIdEmpreendedorismo($enterpreneurBlockId);
 }
Exemplo n.º 4
0
 /**
  * 
  * @deprecated 
  * 
  * validacao de blocos refatorada para DEvolutiveController
  * 
  * versao do pdf devolutiva caso Blocos do questionario nao existam
  * 
  * @param string $urldevolutiva
  */
 public function printAvisoPdfDevolutivaCasoNaoHajaBlocoQuestionario($arrBlocksResult)
 {
     require_once APPLICATION_PATH . '/models/DevolutiveRAA.php';
     $arrHeader['title'] = "Relatório de Autoavaliação";
     $pdf = new Model_DevolutiveRAA($arrHeader);
     // Desabilita header e footer
     $pdf->header = 0;
     $pdf->footer = 0;
     // Prepara variáveis para paginação
     $pdf->AliasNbPages();
     // Habilita header e footer
     $pdf->header = 1;
     $pdf->AddPage();
     $pdf->footer = 1;
     $pdf->SetFont('Arial', 'BI', 16);
     $pdf->SetTextColor(255, 0, 0);
     $pdf->MultiCell(190, 13, utf8_decode("Faltando o cadastro dos blocos do Questionario"), 0, "C");
     // Renderização do arquivo PDF
     $pdf->Output($this->devolutive->getDirName() . $this->devolutive->getArqName());
     // Configura as permissões do arquivo
     chmod($this->devolutive->getDirName() . $this->devolutive->getArqName(), 0666);
     return $this->devolutive->getPublicDir() . $this->devolutive->getArqName();
 }
Exemplo n.º 5
0
 /**
  * 
  * // case 2 = Tipo do questionario autoavaliacao.
  */
 public function initTipo()
 {
     // case 2 = Tipo do questionario autoavaliacao.
     $result = false;
     $arrScore = $this->devolutive->makeScoreRAA($this->devolutive->getQuestionnaireId(), $this->devolutive->getUserId());
     if ($arrScore) {
         //grava dados em Execution
         $this->execution->finishExecution($this->devolutive->getQuestionnaireId(), $this->devolutive->getUserId(), $this->devolutive->getArqPath(), $arrScore[2], $this->devolutive->getIsRA());
         //faz geracao do pdf
         $result = $this->devolutive->makePdfDevolutiveAutoAvaliacao($this->devolutive->getQuestionnaireId(), $this->devolutive->getUserId(), $this->devolutive->getDirName(), $this->devolutive->getPublicDir(), $this->devolutive->getArqName(), $this->devolutive->getIsRA());
     }
     //end if
     return $result;
 }
Exemplo n.º 6
0
 /**
  * 
  * // case 1 = Tipo do questionario diagnostico.
  */
 public function initTipo()
 {
     $this->execution->finishExecution($this->devolutive->getQuestionnaireId(), $this->devolutive->getUserId(), $this->devolutive->getArqPath(), null, $this->devolutive->getIsRA());
     $this->eligibility->doAutoavaliacaoEligibility($this->devolutive->getQuestionnaireId(), $this->devolutive->getUserId());
     $result = $this->devolutive->makePdfDevolutiveAllBlocks($this->devolutive->getQuestionnaireId(), $this->devolutive->getUserId(), $this->devolutive->getDirName(), $this->devolutive->getPublicDir(), $this->devolutive->getArqName(), $this->devolutive->getIsRA());
     return $result;
 }