public function internalReportAction()
 {
     $enterpriseKey = $this->_getParam('enterprise-id-key');
     $competitionId = $this->_getParam('competition-id', null);
     $nacional = $this->_getParam('nacional', null);
     $this->view->fase = $nacional;
     $enterpriseRow = $this->Enterprise->getEnterpriseByIdKey($enterpriseKey);
     $commentQuestions = $this->Appraiser->getQuestions();
     $evaluationQuestions = DbTable_QuestionChecker::getInstance()->fetchAll('QuestionTypeId = 7', 'Designation');
     $this->evaluationRow = $this->Appraiser->getCheckerEvaluation($enterpriseRow->getId(), $competitionId ? $competitionId : $this->programId, $nacional);
     $modelReport = new Model_EnterpriseReport();
     $scores = $this->Appraiser->getEnterpriseScoreAppraisersData($enterpriseRow->getId(), $competitionId, $nacional);
     $checkerId = (isset($scores) and $scores->getCheckerId() != null) ? $scores->getCheckerId() : 0;
     $commentAnswers = $this->Appraiser->getApeEvaluationVerificadorComment($enterpriseRow->getId(), $checkerId);
     $View = array('report' => $modelReport->getEnterpriseReportByEnterpriseIdKey($enterpriseKey, $competitionId), 'enterprise' => $enterpriseRow, 'president' => $enterpriseRow->getPresidentRow(), 'questoes' => $commentQuestions, 'questionsAvaliacao' => $evaluationQuestions, 'evaluationRow' => $this->evaluationRow, 'respostas' => $this->evaluationRow ? $this->evaluationRow->getAnswers() : null, 'commentAnswers' => $commentAnswers->count() > 0 ? $commentAnswers : null, 'scores' => $scores);
     $this->view->assign($View);
 }
 public function criterioavaliacaonacAction()
 {
     $nacional = 2;
     $this->evaluationRow = $this->Appraiser->isCheckerPermit($this->enterpriseRow->getId(), $this->userAuth->getUserId(), $this->programId, $nacional);
     if (!$this->evaluationRow or $this->evaluationRow->getStatus() == 'C') {
         throw new Exception('Não autorizado');
     }
     if ($this->evaluationRow->getStatus() == 'N' or $this->evaluationRow->getStatus() == 'I') {
         $this->_redirect('management/appraiser/checker/retorno/true');
     }
     //var_dump($this->evaluationRow);die; aqui tem pontos fortes
     $commentQuestions = $this->Appraiser->getQuestions();
     $evaluationQuestions = DbTable_QuestionChecker::getInstance()->fetchAll('QuestionTypeId = 7', 'Designation');
     $V = array('enterprise' => $this->enterpriseRow, 'president' => $this->enterpriseRow->getPresidentRow(), 'questoes' => $commentQuestions, 'questionsAvaliacao' => $evaluationQuestions, 'respostas' => $this->evaluationRow->getAnswers(), 'commentAnswers' => $this->evaluationRow->getCommentAnswers(), 'conclusao' => $this->evaluationRow->getConclusao(), 'scores' => $this->Appraiser->getEnterpriseScoreAppraisersData($this->enterpriseRow->getId()), 'verificacaoAvaliador' => $this->Appraiser->getEnterpriseScoreAppraiserAnwserAvaliatorData($this->enterpriseRow->getId()), 'checkerEvaluation' => $this->Appraiser->getCheckerEvaluations($this->enterpriseRow->getId()));
     $this->view->assign($V);
     if (!$this->getRequest()->isPost()) {
         return;
     }
     $conclusao = $this->_getParam('conclusao', false);
     $finalizar = $this->_getParam('finalizar', false);
     $save = $this->Appraiser->saveCheckerEvaluation($commentQuestions, $evaluationQuestions, $this->evaluationRow, $this->_getParam('comments'), $this->_getParam('ansAvaliacao'), $conclusao, $finalizar);
     //print_r($this->_getParam('ansAvaliacao'));exit;
     $data['enterprise_id'] = $this->enterpriseRow->getId();
     $data['user_id'] = $this->loggedUserId;
     $data['programa_id'] = $this->competitionId;
     $data['tipo'] = 2;
     $data['status'] = "III";
     //     	switch ($this->evaluationRow->getStatus())
     //     	{
     //     		case "I": $data['status'] = "II"; break;
     //     		case "II": $data['status'] = "III"; break;
     //     		case "III": $data['status'] = "III"; break;
     //     		case "N": $data['status'] = "I"; break;
     //     		default: $data['status'] = "I"; break;
     //     	}
     $AppraiserModel = new Model_Appraiser();
     $objAppraiser = $AppraiserModel->setCheckerToEnterpriseVerificador($data);
     if ($save['status']) {
         $this->_redirect('management/appraiser/checker/' . $this->enterpriseKey);
     }
 }
 public function getArrayCriterioAvaliacao()
 {
     // Sandra - verificador nacional diferenciado do estadual
     //$nacional =2;
     $this->evaluationRow = $this->Appraiser->isCheckerPermit($this->enterpriseRow->getId(), $this->userAuth->getUserId(), $this->programId, $this->nacional);
     $commentQuestions = $this->Appraiser->getQuestions();
     $evaluationQuestions = DbTable_QuestionChecker::getInstance()->fetchAll('QuestionTypeId = 7', 'Designation');
     $V = array('questionsAvaliacao' => $evaluationQuestions, 'respostas' => $this->evaluationRow->getAnswers(), 'conclusao' => $this->evaluationRow->getConclusao());
     return $V;
 }