/**
  * Returns the list of answers of a users test pass and offers a scoring option
  *
  * @param array $result_array An array containing the results of the users test pass (generated by ilObjTest::getTestResult)
  * @param integer $active_id Active ID of the active user
  * @param integer $pass Test pass
  * @param boolean $show_solutions TRUE, if the solution output should be shown in the answers, FALSE otherwise
  * @return string HTML code of the list of answers
  * @access public
  * 
  * @deprecated
  */
 function getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions = FALSE)
 {
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, "Modules/Test");
     include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
     $scoring = ilObjAssessmentFolder::_getManualScoring();
     $counter = 1;
     // output of questions with solutions
     foreach ($result_array as $question_data) {
         $question = $question_data["qid"];
         if (is_numeric($question)) {
             $question_gui = $this->object->createQuestionGUI("", $question);
             if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
                 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", TRUE, TRUE, "Modules/TestQuestionPool");
                 $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE, "Modules/Test");
                 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
                 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
                 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
                 $points = $question_gui->object->getMaximumPoints();
                 if ($points == 1) {
                     $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
                 } else {
                     $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
                 }
                 $show_question_only = $this->object->getShowSolutionAnswersOnly() ? TRUE : FALSE;
                 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
                 $solout = $question_gui->object->getSuggestedSolutionOutput();
                 if (strlen($solout)) {
                     $scoretemplate->setCurrentBlock("suggested_solution");
                     $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
                     $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
                     $scoretemplate->parseCurrentBlock();
                 }
                 $scoretemplate->setCurrentBlock("feedback");
                 $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
                 $feedback = $this->object->getManualFeedback($active_id, $question, $pass);
                 $scoretemplate->setVariable("VALUE_FEEDBACK", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
                 $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
                 $scoretemplate->parseCurrentBlock();
                 $scoretemplate->setVariable("NAME_INPUT", $question);
                 $this->ctrl->setParameter($this, "active_id", $active_id);
                 $this->ctrl->setParameter($this, "pass", $pass);
                 $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
                 $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
                 $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
                 $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
                 $template->setVariable("SOLUTION_OUTPUT", $result_output);
                 $maintemplate->setCurrentBlock("printview_question");
                 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
                 $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
                 $maintemplate->parseCurrentBlock();
             }
             $counter++;
         }
     }
     if ($counter == 1) {
         // no scorable questions found
         $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
     }
     $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass + 1));
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initDomEvent();
     return $maintemplate->get();
 }
 /**
  *
  */
 private function showManScoringByQuestionParticipantsTable($manPointsPost = array())
 {
     /**
      * @var $tpl      ilTemplate
      * @var $ilAccess ilAccessHandler
      */
     global $tpl, $ilAccess;
     if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
         ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
         $this->ctrl->redirectByClass('ilobjtestgui', 'infoScreen');
     }
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once 'Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initPanel();
     ilYuiUtil::initOverlay();
     $mathJaxSetting = new ilSetting('MathJax');
     if ($mathJaxSetting->get("enable")) {
         $tpl->addJavaScript($mathJaxSetting->get("path_to_mathjax"));
     }
     $tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js');
     $tpl->addJavaScript("./Services/JavaScript/js/Basic.js");
     $tpl->addJavaScript("./Services/Form/js/Form.js");
     $tpl->addCss($this->object->getTestStyleLocation("output"), "screen");
     require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php';
     $table = new ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI($this);
     $table->setManualScoringPointsPostData($manPointsPost);
     $qst_id = $table->getFilterItemByPostVar('question')->getValue();
     $pass_id = $table->getFilterItemByPostVar('pass')->getValue();
     $table_data = array();
     $selected_questionData = null;
     if (is_numeric($qst_id)) {
         $scoring = ilObjAssessmentFolder::_getManualScoring();
         $info = assQuestion::_getQuestionInfo($qst_id);
         $selected_questionData = $info;
         $type = $info["question_type_fi"];
         if (in_array($type, $scoring)) {
             $selected_questionData = $info;
         }
     }
     if ($selected_questionData && is_numeric($pass_id)) {
         $data = $this->object->getCompleteEvaluationData(FALSE);
         foreach ($data->getParticipants() as $active_id => $participant) {
             $testResultData = $this->object->getTestResult($active_id, $pass_id - 1);
             foreach ($testResultData as $questionData) {
                 if (!isset($questionData['qid']) || $questionData['qid'] != $selected_questionData['question_id']) {
                     continue;
                 }
                 $table_data[] = array('pass_id' => $pass_id - 1, 'active_id' => $active_id, 'qst_id' => $questionData['qid'], 'reached_points' => assQuestion::_getReachedPoints($active_id, $questionData['qid'], $pass_id - 1), 'maximum_points' => assQuestion::_getMaximumPoints($questionData['qid']), 'participant' => $participant);
             }
         }
     } else {
         $table->disable('header');
     }
     if ($selected_questionData) {
         $maxpoints = assQuestion::_getMaximumPoints($selected_questionData['question_id']);
         if ($maxpoints == 1) {
             $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')';
         } else {
             $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')';
         }
         $table->setTitle($this->lng->txt('tst_man_scoring_by_qst') . ': ' . $selected_questionData['title'] . $maxpoints . ' [' . $this->lng->txt('question_id_short') . ': ' . $selected_questionData['question_id'] . ']');
     } else {
         $table->setTitle($this->lng->txt('tst_man_scoring_by_qst'));
     }
     $table->setData($table_data);
     $tpl->setContent($table->getHTML());
 }
예제 #3
0
 private function buildManScoringParticipantForm($questionGuiList, $activeId, $pass, $initValues = false)
 {
     global $ilCtrl, $lng;
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     require_once 'Services/Form/classes/class.ilFormSectionHeaderGUI.php';
     require_once 'Services/Form/classes/class.ilCustomInputGUI.php';
     require_once 'Services/Form/classes/class.ilCheckboxInputGUI.php';
     require_once 'Services/Form/classes/class.ilTextInputGUI.php';
     require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
     $ilCtrl->setParameter($this, 'active_id', $activeId);
     $ilCtrl->setParameter($this, 'pass', $pass);
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle(sprintf($lng->txt('manscoring_results_pass'), $pass + 1));
     $form->setTableWidth('100%');
     foreach ($questionGuiList as $questionId => $questionGUI) {
         $questionHeader = sprintf($lng->txt('tst_manscoring_question_section_header'), $questionGUI->object->getTitle());
         $questionSolution = $questionGUI->getSolutionOutput($activeId, $pass, false, false, true, false, false, true);
         $bestSolution = $questionGUI->object->getSuggestedSolutionOutput();
         $sect = new ilFormSectionHeaderGUI();
         $sect->setTitle($questionHeader . ' [' . $this->lng->txt('question_id_short') . ': ' . $questionGUI->object->getId() . ']');
         $form->addItem($sect);
         $cust = new ilCustomInputGUI($lng->txt('tst_manscoring_input_question_and_user_solution'));
         $cust->setHtml($questionSolution);
         $form->addItem($cust);
         $text = new ilTextInputGUI($lng->txt('tst_change_points_for_question'), "question__{$questionId}__points");
         if ($initValues) {
             $text->setValue(assQuestion::_getReachedPoints($activeId, $questionId, $pass));
         }
         $form->addItem($text);
         $nonedit = new ilNonEditableValueGUI($lng->txt('tst_manscoring_input_max_points_for_question'), "question__{$questionId}__maxpoints");
         if ($initValues) {
             $nonedit->setValue(assQuestion::_getMaximumPoints($questionId));
         }
         $form->addItem($nonedit);
         $area = new ilTextAreaInputGUI($lng->txt('set_manual_feedback'), "question__{$questionId}__feedback");
         $area->setUseRTE(true);
         if ($initValues) {
             $area->setValue($this->object->getManualFeedback($activeId, $questionId, $pass));
         }
         $form->addItem($area);
         if (strlen(trim($bestSolution))) {
             $cust = new ilCustomInputGUI($lng->txt('tst_show_solution_suggested'));
             $cust->setHtml($bestSolution);
             $form->addItem($cust);
         }
     }
     $sect = new ilFormSectionHeaderGUI();
     $sect->setTitle($lng->txt('tst_participant'));
     $form->addItem($sect);
     $check = new ilCheckboxInputGUI($lng->txt('set_manscoring_done'), 'manscoring_done');
     if ($initValues && ilTestService::isManScoringDone($activeId)) {
         $check->setChecked(true);
     }
     $form->addItem($check);
     $check = new ilCheckboxInputGUI($lng->txt('tst_manscoring_user_notification'), 'manscoring_notify');
     $form->addItem($check);
     $form->addCommandButton('saveManScoringParticipantScreen', $lng->txt('save'));
     $form->addCommandButton('saveReturnManScoringParticipantScreen', $lng->txt('save_return'));
     $form->addCommandButton('saveNextManScoringParticipantScreen', $lng->txt('save_and_next'));
     return $form;
 }
 private function isQuestionAnsweredCorrect($questionId, $activeId)
 {
     $questionGUI = $this->object->createQuestionGUI("", $questionId);
     $reachedPoints = assQuestion::_getReachedPoints($activeId, $questionId, 0);
     $maxPoints = $questionGUI->object->getMaximumPoints();
     if ($reachedPoints < $maxPoints) {
         return false;
     }
     return true;
 }