Esempio n. 1
0
 public function getQuestionsByBlockIdForView($blockId)
 {
     $questions = DbTable_Block::getInstance()->getQuestionsByBlockId($blockId);
     $lastBlockId = $lastQuestionId = $lastAlternativeId = null;
     $questionsArray = array();
     foreach ($questions as $k => $question) {
         $questionId = $question->getQuestionId();
         $blockId = $question->getBlockId();
         $alternativeId = $question->getAlternativeId();
         if ($lastQuestionId != $questionId) {
             $questionSummary = $question->getSummary();
             $questionType = $question->getQuestionTypeId();
             $supportingText = $question->getSupportingText();
             $showEnterpriseFeedback = ($supportingText and $questionType == Model_QuestionType::AGREEDISAGREE_ID) ? true : false;
             $questionsArray[$questionId] = array('QuestionId' => $questionId, 'QuestionSummary' => $questionSummary, 'QuestionValue' => $question->getQuestionValue(), 'SupportingText' => $supportingText, 'QuestionTypeId' => $questionType, 'ShowEnterpriseFeedback' => $showEnterpriseFeedback, 'Alternatives' => array());
         }
         if ($lastAlternativeId != $alternativeId) {
             $questionsArray[$questionId]['Alternatives'][$alternativeId] = array('AlternativeId' => $alternativeId, 'AlternativeValue' => $question->getAlternativeValue());
         }
         $lastBlockId = $blockId;
         $lastQuestionId = $questionId;
         $lastAlternativeId = $alternativeId;
     }
     return $questionsArray;
 }
Esempio n. 2
0
 public function deleteQuestionnaire($Identify)
 {
     $verifyBlock = DbTable_Block::getInstance()->fetchRow(array('QuestionnaireId = ?' => $Identify));
     if ($verifyBlock) {
         return array('status' => false, 'messageError' => $this->_messagesError['questionnaireExistsDep']);
     }
     $row = $this->tbQuestionnaire->find($Identify)->current()->delete();
     return array('status' => true);
 }