public function gestornacAction() { $auth = Zend_Auth::getInstance(); $this->enterpriseKey = $this->_getParam('enterprise-id-key'); $this->enterpriseRow = $this->Enterprise->getEnterpriseByIdKey($this->enterpriseKey); $data['enterprise_id'] = $this->enterpriseRow->getId(); $data['user_id'] = $auth->getIdentity()->getUserId(); $data['programa_id'] = $this->programId; $data['tipo'] = 2; $data['status'] = "C"; $AppraiserModel = new Model_Appraiser(); $objAppraiser = $AppraiserModel->setCheckerToEnterpriseVerificador($data); $this->_helper->layout()->disableLayout(); $this->_redirect('/management/appraiser/checker'); }
public function answerAction() { $this->view->papelEmpresa = $this->userLogged->getRoleId() == Zend_Registry::get('config')->acl->roleEnterpriseId ? 'true' : 'false'; $this->view->user_id = $this->enterpriseUserId; $this->view->respondQuestionOk = false; $this->view->itemSuccess = false; $this->view->respondRowData = $dataPosted = $this->_getAllParams(); //Não respondeu nada. if (!isset($this->view->respondRowData['alternative_id']) or $this->view->respondRowData['alternative_id'] == '') { $this->view->itemSuccess = true; return; } $data['tipo'] = 1; if (isset($this->view->respondRowData['nacional'])) { if ($this->view->respondRowData['nacional'] == 2) { $data['tipo'] = 2; } } $data['enterprise_id'] = $this->enterpriseRow->getId(); $data['user_id'] = $this->loggedUserId; $data['programa_id'] = $this->competitionId; //$data['tipo'] = 2; $data['status'] = "I"; // 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; // } if ($this->view->respondRowData["question_id"] == 530) { $AppraiserModel = new Model_Appraiser(); $objAppraiser = $AppraiserModel->setCheckerToEnterpriseVerificador($data); } $respondQuestionId = $this->_getParam('question_id', ''); $respondQuestionRow = $this->Question->getQuestionById($respondQuestionId); if (!$respondQuestionId or !$respondQuestionRow) { throw new Exception('Questão inválida, não encontrada.'); } $block = $respondQuestionRow->findParentCriterion()->findParentBlock(); $questionnaire = $block->findParentQuestionnaire(); $qstnId = $questionnaire->getId(); $competitionId = $questionnaire->getCompetitionId(); if (!$this->Questionnaire->isQuestionnaireExecution($qstnId)) { throw new Exception('Período de resposta do questionário inválido.'); } $isAnswered = $this->Question->isAnsweredByVerificador($respondQuestionId, $this->loggedUserId, $this->enterpriseUserId); //print_r($isAnswered );exit; $respondRowData = $this->view->respondRowData; // resposta escrita $respondRowData['answer_value'] = isset($respondRowData['answer_value']) ? trim($respondRowData['answer_value']) : ''; $respondRowData = $this->AnswerVerificador->filterAnswerForm($respondRowData)->getUnescaped(); $respondRowData['aaresult_value'] = ''; // resposta com resultado anual //Verificação de segurança se é uma alternativa válida da questão $alternativeRow = $this->Alternative->isQuestionAlternative($respondRowData['alternative_id'], $respondQuestionId); if (!$alternativeRow) { throw new Exception($this->_messagesError['alternativeError']); } $this->view->respondRowData['answer_value'] = ""; $setExecutionProgress = false; $respondRowData['answer_date'] = date('Y-m-d'); $respondRowData['end_time'] = date('H:i:s'); $respondRowData['user_id'] = $this->userLogged->getUserId(); $respondRowData['logged_user_id'] = $this->loggedUserId; $respondRowData['qstn_id'] = $qstnId; $respondRowData['enterprise_id'] = $this->enterpriseUserId; //print_r($respondRowData);exit; if ($isAnswered['status']) { $answerId = $isAnswered['objAnswered']->getAnswerId(); if ($this->AnswerVerificador->hasChange($answerId, $respondRowData, $alternativeRow)) { $answer = $this->AnswerVerificador->updateAnswer($answerId, $respondRowData, $alternativeRow); $setExecutionProgress = true; } else { $answer['status'] = true; $answer['row'] = $isAnswered['objAnswered']; } } else { $answer = $this->AnswerVerificador->createAnswer($respondRowData, $alternativeRow); $answerId = $answer['row']->getId(); $setExecutionProgress = true; } if (!$answer['status']) { $this->view->itemSuccess = false; $this->view->messageError = $answer['messageError']; return; } if ($setExecutionProgress) { $this->Questionnaire->setExecutionProgress($qstnId, $this->enterpriseUserId); } //Privilégio avaliação de resposta: Pontos Fortes e Pontos a melhorar $this->verificaRotinasFeedback($answerId, $dataPosted); $this->checkForDevolutiveUpdate($competitionId, $qstnId, $block->getId()); $this->view->respondQuestionOk = true; $this->view->respondRowData = array(); $this->view->itemSuccess = true; }
public function getArrayReport() { $modelReport = new Model_EnterpriseReport(); $AppraiserModel = new Model_Appraiser(); $V = array('report' => $modelReport->getEnterpriseReportByEnterpriseIdKey($this->enterpriseKey->IdKey), 'enterprise' => $this->enterpriseRow, 'president' => $this->enterpriseRow->getPresidentRow(), 'scores' => $this->Appraiser->getEnterpriseScoreAppraisersData($this->enterpriseRow->getId(), null, 2)); //var_dump($this->Appraiser->getEnterpriseScoreAppraisersData($this->enterpriseRow->getId(), null, 2));die; $data['enterprise_id'] = $this->enterpriseRow->getId(); $data['user_id'] = $this->userAuth->getUserId(); $data['programa_id'] = $this->programId; $data['tipo'] = 1; if ($this->nacional == 2) { $data['tipo'] = 2; } $data['status'] = "IIII"; $objAppraiser = $AppraiserModel->setCheckerToEnterpriseVerificador($data); return $V; }