/** * * Consulta os criterios e dados de um bloco do BD ou recupera/grava no sistema de cache */ public function cacheBlockAndCriterion($blocoId) { $mpeCache = new Vtx_Cache_MPE_QuestionarioCache(); $blocoCacheModel = $mpeCache->BlocoECriterios($blocoId, $this); return $blocoCacheModel; }
public function reportGlobalAction() { $this->incluirJoinRegionalForce = false; $filter = $this->_getParam('filter', null); $filter['show_only'] = 'candidatas'; if (isset($filter['competition_id']) and $filter['competition_id'] != $this->competitionId) { throw new Exception('access denied'); return; } $format = $this->_getParam('format', null); $render = $format == 'csv' ? 'report-global' : 'index'; $this->_helper->viewRenderer->setRender($render); if (!$format) { self::indexAction(); return; } $cacheQuestion = new Vtx_Cache_MPE_QuestionarioCache(); $Qstn = new Model_Questionnaire(); $alternativesByQuestion = $allAlternativeIds = array(); $blockId = isset($filter['qstn']) ? $filter['qstn'] : Zend_Registry::get('configDb')->qstn->currentBlockIdNegocios; //$this->view->showRadar = $blockId==Model_Devolutive::BLOCO_GESTAOEMPRESA? true : false; $this->view->showRadar = false; $questions = $cacheQuestion->BlocoECriterios($blockId, $Qstn->getCurrentQstnRow()); $this->view->questions = $questions = $questions[$blockId]; foreach ($questions['Criterions'] as $criterion) { foreach ($criterion['Questions'] as $questionId => $question) { $alternativesQuestion = $cacheQuestion->alternativasEQuestoes($question['QuestionId'], new Model_Alternative()); $alternativesByQuestion[$questionId] = $alternativesQuestion; foreach ($alternativesQuestion as $alternative) { $allAlternativeIds[] = $alternative['Id']; } } } $this->filterAdditional = $filter; $this->filterAdditional['alternativesId'] = $allAlternativeIds; $this->view->alternativesByQuestion = $alternativesByQuestion; $this->fetchReturn = 'pairs'; $this->fetchReturnForce = 'pairs'; $this->tipoRelatorio = 'report-global-respostas'; self::indexAction(); $this->view->qtRespostasAlternativa = $this->view->getAllEnterprise; if (!$this->view->showRadar) { return; } $dataCriterios = $this->Enterprise->getAllByColAE($this->paramsBuscaServiceArea[0], $this->paramsBuscaServiceArea[1], $this->autoavaliacaoId, null, null, $this->filter, null, $format, 'assoc', 'report-global-criterios'); $dataCriteriosPorcent = array(); $this->view->dataCriterios = $dataCriterios['total']; $this->view->pontuacaoMaxima = $pontuacaoMaxima = Vtx_Util_Array::pontuacaoMaximaCriteriosGestao(); $i = 0; foreach ($this->view->dataCriterios as $criterio => $pontuacao) { if ($i != 0) { $dataCriteriosPorcent[] = (double) $pontuacao / (double) $pontuacaoMaxima[$i] * 100; } $i++; } $this->view->dataCriteriosPoncent = $dataCriteriosPorcent; }