/** * * // 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; }
/** * * // 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; }
/** * * * 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; }
/** * Devolutiva PSMN * * DevolutiveCalcId 3 => Tipo de questionario PSMN * * Tipo 3 foi baseado no questionario autoavaliacao (tipo 2). */ public function initTipo() { $result = false; //cria diretorio no filesystem, para gravar pdf $this->makepdf->preparaFileSystemParaDevolutiva(); //regra desnecessaria para geracao devolutiva de PSMN //$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(), null, $this->devolutive->getIsRA()); //faz geracao do pdf $result = true; $result = $this->makePdfDevolutivePSMN(); return $result; }