示例#1
0
 /**
 * 
 * Verifica se usuario respondeu completamente:
 * - preencheu Relato
 * - bloco Empreendedorismo
 * - bloco Negocios
 * - gerou Devolutiva
 * 
 * @param type $enterpriseRow
 * @return Array
 * 
   $arrTerminoEtapas = array(
        'relato' => $relato,
        'negocios' => $negocios,
        'empreemdedorismo' => $empreendedorismo,
        'devolutiva' => $gerouDevolutiva,
   );   
 *
 */
 public function terminoEtapas($enterpriseId, $userId)
 {
     //config
     $questionarioCurrentId = Zend_Registry::get('configDb')->qstn->currentAutoavaliacaoId;
     $negociosBlockId = Zend_Registry::get('configDb')->qstn->currentBlockIdNegocios;
     $enterpreneurBlockId = Zend_Registry::get('configDb')->qstn->currentBlockIdEmpreendedorismo;
     //models
     $model_enterpriseReport = new Model_EnterpriseReport();
     $model_execution = new Model_Execution();
     //variades de retorno
     $relato = false;
     $gerouDevolutiva = false;
     $negocios = true;
     $empreendedorismo = true;
     //$enterpriseId = $enterpriseRow->getId();
     $relatoRow = $model_enterpriseReport->getEnterpriseReport("EnterpriseId = " . $enterpriseId);
     $empreendedorismoRow = $this->isFullyAnsweredByBloco($questionarioCurrentId, $userId, $enterpreneurBlockId);
     $negociosRow = $this->isFullyAnsweredByBloco($questionarioCurrentId, $userId, $negociosBlockId);
     $reportId = $relatoRow ? $relatoRow->getId() : null;
     //se respondeu todo bloco de Empreendedorismo
     if (!$empreendedorismoRow) {
         $empreendedorismo = false;
     }
     //se respondeu todo bloco de Negocios
     if (!$negociosRow) {
         $negocios = false;
     }
     //tem relato
     if ($reportId) {
         $relato = true;
     }
     //row execution
     $devolutive = $model_execution->getExecutionByUserAndQuestionnaire($questionarioCurrentId, $userId);
     //string - url da devolutiva gerada
     $devolutivePath = $devolutive ? $devolutive->getDevolutivePath() : null;
     //gerou devvolutiva
     if ($devolutivePath) {
         $gerouDevolutiva = true;
     }
     //return
     $arrTerminoEtapas = array('relato' => $relato, 'negocios' => $negocios, 'empreendedorismo' => $empreendedorismo, 'devolutiva' => $gerouDevolutiva);
     return $arrTerminoEtapas;
 }