/**
  * Returns HTML code for a signature field
  *
  * @return string HTML code of the date and signature field for the test results
  * @access public
  */
 function getResultsSignature()
 {
     if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
         // output of time/date and signature
         $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE, "Modules/Test");
         $template->setVariable("TXT_DATE", $this->lng->txt("date"));
         $template->setVariable("VALUE_DATE", strftime("%Y-%m-%d %H:%M:%S", time()));
         $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
         $template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.png"));
         return $template->get();
     } else {
         return "";
     }
 }
Esempio n. 2
0
 /**
  * Returns HTML code for a signature field
  *
  * @return string HTML code of the date and signature field for the test results
  * @access public
  */
 function getResultsSignature()
 {
     if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
         $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE, "Modules/Test");
         $template->setVariable("TXT_DATE", $this->lng->txt("date"));
         $old_value = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
         ilDatePresentation::setUseRelativeDates($old_value);
         $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
         $template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.png"));
         return $template->get();
     } else {
         return "";
     }
 }
 private function addResultDetailsSettingsFormSection(ilPropertyFormGUI $form)
 {
     // HEADER: result settings
     $header_tr = new ilFormSectionHeaderGUI();
     $header_tr->setTitle($this->lng->txt('tst_results_details_options'));
     $form->addItem($header_tr);
     // show solution details
     $showSolutionDetails = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_details'), 'solution_details');
     $showSolutionDetails->setInfo($this->lng->txt('tst_show_solution_details_desc'));
     $showSolutionDetails->setChecked($this->testOBJ->getShowSolutionDetails());
     $form->addItem($showSolutionDetails);
     // best solution in test results
     $results_print_best_solution = new ilCheckboxInputGUI($this->lng->txt('tst_results_print_best_solution'), 'print_bs_with_res');
     $results_print_best_solution->setInfo($this->lng->txt('tst_results_print_best_solution_info'));
     $results_print_best_solution->setChecked((bool) $this->testOBJ->isBestSolutionPrintedWithResult());
     $showSolutionDetails->addSubItem($results_print_best_solution);
     // show solution feedback ==> solution feedback in test results
     $showSolutionFeedbackOption = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_feedback'), 'solution_feedback');
     $showSolutionFeedbackOption->setInfo($this->lng->txt('tst_show_solution_feedback_desc'));
     $showSolutionFeedbackOption->setChecked($this->testOBJ->getShowSolutionFeedback());
     $form->addItem($showSolutionFeedbackOption);
     // show suggested solution
     $showSuggestedSolutionOption = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_suggested'), 'solution_suggested');
     $showSuggestedSolutionOption->setInfo($this->lng->txt('tst_show_solution_suggested_desc'));
     $showSuggestedSolutionOption->setChecked($this->testOBJ->getShowSolutionSuggested());
     $form->addItem($showSuggestedSolutionOption);
     // show solution printview ==> list of answers
     $showSolutionPrintview = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_printview'), 'solution_printview');
     $showSolutionPrintview->setInfo($this->lng->txt('tst_show_solution_printview_desc'));
     $showSolutionPrintview->setChecked($this->testOBJ->getShowSolutionPrintview());
     $form->addItem($showSolutionPrintview);
     // show best solution in list of answers
     $solutionCompareInput = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_compare'), 'solution_compare');
     $solutionCompareInput->setChecked($this->testOBJ->getShowSolutionListComparison());
     $showSolutionPrintview->addSubItem($solutionCompareInput);
     // solution answers only ==> printview of results (answers only)
     $solutionAnswersOnly = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_answers_only'), 'solution_answers_only');
     $solutionAnswersOnly->setInfo($this->lng->txt('tst_show_solution_answers_only_desc'));
     $solutionAnswersOnly->setChecked($this->testOBJ->getShowSolutionAnswersOnly());
     $showSolutionPrintview->addSubItem($solutionAnswersOnly);
     // high score
     $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled");
     $highscore->setValue(1);
     $highscore->setChecked($this->testOBJ->getHighscoreEnabled());
     $highscore->setInfo($this->lng->txt("tst_highscore_description"));
     $form->addItem($highscore);
     $highscore_tables = new ilRadioGroupInputGUI($this->lng->txt('tst_highscore_mode'), 'highscore_mode');
     $highscore_tables->setRequired(true);
     $highscore_tables->setValue($this->testOBJ->getHighscoreMode());
     $highscore_table_own = new ilRadioOption($this->lng->txt('tst_highscore_own_table'), ilObjTest::HIGHSCORE_SHOW_OWN_TABLE);
     $highscore_table_own->setInfo($this->lng->txt('tst_highscore_own_table_description'));
     $highscore_tables->addOption($highscore_table_own);
     $highscore_table_other = new ilRadioOption($this->lng->txt('tst_highscore_top_table'), ilObjTest::HIGHSCORE_SHOW_TOP_TABLE);
     $highscore_table_other->setInfo($this->lng->txt('tst_highscore_top_table_description'));
     $highscore_tables->addOption($highscore_table_other);
     $highscore_table_other = new ilRadioOption($this->lng->txt('tst_highscore_all_tables'), ilObjTest::HIGHSCORE_SHOW_ALL_TABLES);
     $highscore_table_other->setInfo($this->lng->txt('tst_highscore_all_tables_description'));
     $highscore_tables->addOption($highscore_table_other);
     $highscore->addSubItem($highscore_tables);
     $highscore_top_num = new ilNumberInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num");
     $highscore_top_num->setSize(4);
     $highscore_top_num->setRequired(true);
     $highscore_top_num->setMinValue(1);
     $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit"));
     $highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum(null));
     $highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description"));
     $highscore->addSubItem($highscore_top_num);
     $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon");
     $highscore_anon->setValue(1);
     $highscore_anon->setChecked($this->testOBJ->getHighscoreAnon());
     $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description"));
     $highscore->addSubItem($highscore_anon);
     $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts");
     $highscore_achieved_ts->setValue(1);
     $highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS());
     $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description"));
     $highscore->addSubItem($highscore_achieved_ts);
     $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score");
     $highscore_score->setValue(1);
     $highscore_score->setChecked($this->testOBJ->getHighscoreScore());
     $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description"));
     $highscore->addSubItem($highscore_score);
     $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage");
     $highscore_percentage->setValue(1);
     $highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage());
     $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description"));
     $highscore->addSubItem($highscore_percentage);
     $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints");
     $highscore_hints->setValue(1);
     $highscore_hints->setChecked($this->testOBJ->getHighscoreHints());
     $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description"));
     $highscore->addSubItem($highscore_hints);
     $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime");
     $highscore_wtime->setValue(1);
     $highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime());
     $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description"));
     $highscore->addSubItem($highscore_wtime);
     // show signature placeholder
     $showSignaturePlaceholder = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_signature'), 'solution_signature');
     $showSignaturePlaceholder->setInfo($this->lng->txt('tst_show_solution_signature_desc'));
     $showSignaturePlaceholder->setChecked($this->testOBJ->getShowSolutionSignature());
     if ($this->testOBJ->getAnonymity()) {
         $showSignaturePlaceholder->setDisabled(true);
     }
     $form->addItem($showSignaturePlaceholder);
     // show signature placeholder
     $showExamId = new ilCheckboxInputGUI($this->lng->txt('examid_in_test_res'), 'examid_in_test_res');
     $showExamId->setInfo($this->lng->txt('examid_in_test_res_desc'));
     $showExamId->setChecked($this->testOBJ->isShowExamIdInTestResultsEnabled());
     $form->addItem($showExamId);
     // export settings
     $export_settings = new ilCheckboxInputGUI($this->lng->txt('tst_exp_sc_short'), 'exp_sc_short');
     $export_settings->setInfo($this->lng->txt('tst_exp_sc_short_desc'));
     $export_settings->setChecked($this->testOBJ->getExportSettingsSingleChoiceShort());
     $form->addItem($export_settings);
 }
 /**
  * Display and fill the scoring settings form of the test
  *
  * @access	public
  */
 function scoringObject($checkonly = FALSE)
 {
     global $ilAccess;
     if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
         // allow only write access
         ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
         $this->ctrl->redirect($this, "infoScreen");
     }
     // using template?
     $template_settings = null;
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         include_once "Modules/Test/classes/class.ilObjAssessmentFolderGUI.php";
         $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
         $template_settings = $template->getSettings();
     }
     $save = strcmp($this->ctrl->getCmd(), "saveScoring") == 0 ? TRUE : FALSE;
     $total = $this->object->evalTotalPersons();
     $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("test_properties_scoring");
     // scoring properties
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("scoring"));
     $form->addItem($header);
     // scoring system
     $count_system = new ilRadioGroupInputGUI($this->lng->txt("tst_text_count_system"), "count_system");
     $count_system->addOption(new ilRadioOption($this->lng->txt("tst_count_partial_solutions"), 0, ''));
     $count_system->addOption(new ilRadioOption($this->lng->txt("tst_count_correct_solutions"), 1, ''));
     $count_system->setValue($this->object->getCountSystem());
     $count_system->setInfo($this->lng->txt("tst_count_system_description"));
     if ($total) {
         $count_system->setDisabled(true);
     }
     $form->addItem($count_system);
     // mc questions
     $mc_scoring = new ilRadioGroupInputGUI($this->lng->txt("tst_score_mcmr_questions"), "mc_scoring");
     $mc_scoring->addOption(new ilRadioOption($this->lng->txt("tst_score_mcmr_zero_points_when_unanswered"), 0, ''));
     $mc_scoring->addOption(new ilRadioOption($this->lng->txt("tst_score_mcmr_use_scoring_system"), 1, ''));
     $mc_scoring->setValue($this->object->getMCScoring());
     $mc_scoring->setInfo($this->lng->txt("tst_score_mcmr_questions_description"));
     if ($total) {
         $mc_scoring->setDisabled(true);
     }
     $form->addItem($mc_scoring);
     // score cutting
     $score_cutting = new ilRadioGroupInputGUI($this->lng->txt("tst_score_cutting"), "score_cutting");
     $score_cutting->addOption(new ilRadioOption($this->lng->txt("tst_score_cut_question"), 0, ''));
     $score_cutting->addOption(new ilRadioOption($this->lng->txt("tst_score_cut_test"), 1, ''));
     $score_cutting->setValue($this->object->getScoreCutting());
     $score_cutting->setInfo($this->lng->txt("tst_score_cutting_description"));
     if ($total) {
         $score_cutting->setDisabled(true);
     }
     $form->addItem($score_cutting);
     // pass scoring
     $pass_scoring = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_scoring"), "pass_scoring");
     $pass_scoring->addOption(new ilRadioOption($this->lng->txt("tst_pass_last_pass"), 0, ''));
     $pass_scoring->addOption(new ilRadioOption($this->lng->txt("tst_pass_best_pass"), 1, ''));
     $pass_scoring->setValue($this->object->getPassScoring());
     $pass_scoring->setInfo($this->lng->txt("tst_pass_scoring_description"));
     if ($total) {
         $pass_scoring->setDisabled(true);
     }
     $form->addItem($pass_scoring);
     // enable obligations
     $checkBoxEnableObligations = new ilCheckboxInputGUI($this->lng->txt("tst_setting_enable_obligations_label"), "obligations_enabled");
     $checkBoxEnableObligations->setChecked($this->object->areObligationsEnabled());
     $checkBoxEnableObligations->setInfo($this->lng->txt("tst_setting_enable_obligations_info"));
     if ($total) {
         $checkBoxEnableObligations->setDisabled(true);
     }
     $form->addItem($checkBoxEnableObligations);
     // offer hints
     $checkBoxOfferHints = new ilCheckboxInputGUI($this->lng->txt("tst_setting_offer_hints_label"), "offer_hints");
     $checkBoxOfferHints->setChecked($this->object->isOfferingQuestionHintsEnabled());
     $checkBoxOfferHints->setInfo($this->lng->txt("tst_setting_offer_hints_info"));
     if ($total) {
         $checkBoxOfferHints->setDisabled(true);
     }
     $form->addItem($checkBoxOfferHints);
     // instant feedback
     $instant_feedback = new ilCheckboxGroupInputGUI($this->lng->txt("tst_instant_feedback"), "instant_feedback");
     $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_answer_specific"), 'instant_feedback_specific', ''));
     $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_answer_generic"), 'instant_feedback_generic', ''));
     $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_results"), 'instant_feedback_points', ''));
     $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_solution"), 'instant_feedback_solution', ''));
     $values = array();
     if ($this->object->getSpecificAnswerFeedback()) {
         array_push($values, 'instant_feedback_specific');
     }
     if ($this->object->getGenericAnswerFeedback()) {
         array_push($values, 'instant_feedback_generic');
     }
     if ($this->object->getAnswerFeedbackPoints()) {
         array_push($values, 'instant_feedback_points');
     }
     if ($this->object->getInstantFeedbackSolution()) {
         array_push($values, 'instant_feedback_solution');
     }
     $instant_feedback->setValue($values);
     $instant_feedback->setInfo($this->lng->txt("tst_instant_feedback_description"));
     $form->addItem($instant_feedback);
     // access to test results
     $results_access = new ilRadioGroupInputGUI($this->lng->txt("tst_results_access"), "results_access");
     $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_always"), 2, ''));
     $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_finished"), 1, ''));
     $results_access_date_limitation = new ilRadioOption($this->lng->txt("tst_results_access_date"), 3, '');
     $results_access->addOption($results_access_date_limitation);
     $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_never"), 4, ''));
     $results_access->setValue($this->object->getScoreReporting());
     $results_access->setInfo($this->lng->txt("tst_results_access_description"));
     // access date
     $reporting_date = new ilDateTimeInputGUI('', 'reporting_date');
     $reporting_date->setShowDate(true);
     $reporting_date->setShowTime(true);
     if (strlen($this->object->getReportingDate())) {
         $reporting_date->setDate(new ilDateTime($this->object->getReportingDate(), IL_CAL_TIMESTAMP));
     } else {
         $reporting_date->setDate(new ilDateTime(time(), IL_CAL_UNIX));
     }
     $results_access_date_limitation->addSubItem($reporting_date);
     $form->addItem($results_access);
     $results_print_best_solution = new ilCheckboxInputGUI($this->lng->txt("tst_results_print_best_solution"), "print_bs_with_res");
     $results_print_best_solution->setInfo($this->lng->txt('tst_results_print_best_solution_info'));
     $results_print_best_solution->setValue(1);
     $results_print_best_solution->setChecked((bool) $this->object->isBestSolutionPrintedWithResult());
     $form->addItem($results_print_best_solution);
     // results presentation
     $results_presentation = new ilCheckboxGroupInputGUI($this->lng->txt("tst_results_presentation"), "results_presentation");
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_pass_details"), 'pass_details', ''));
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_details"), 'solution_details', ''));
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_printview"), 'solution_printview', ''));
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_feedback"), 'solution_feedback', ''));
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_answers_only"), 'solution_answers_only', ''));
     $signatureOption = new ilCheckboxOption($this->lng->txt("tst_show_solution_signature"), 'solution_signature', '');
     $results_presentation->addOption($signatureOption);
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_suggested"), 'solution_suggested', ''));
     $values = array();
     if ($this->object->getShowPassDetails()) {
         array_push($values, 'pass_details');
     }
     if ($this->object->getShowSolutionDetails()) {
         array_push($values, 'solution_details');
     }
     if ($this->object->getShowSolutionPrintview()) {
         array_push($values, 'solution_printview');
     }
     if ($this->object->getShowSolutionFeedback()) {
         array_push($values, 'solution_feedback');
     }
     if ($this->object->getShowSolutionAnswersOnly()) {
         array_push($values, 'solution_answers_only');
     }
     if ($this->object->getShowSolutionSignature()) {
         array_push($values, 'solution_signature');
     }
     if ($this->object->getShowSolutionSuggested()) {
         array_push($values, 'solution_suggested');
     }
     $results_presentation->setValue($values);
     $results_presentation->setInfo($this->lng->txt("tst_results_presentation_description"));
     if ($this->object->getAnonymity()) {
         $signatureOption->setDisabled(true);
     }
     $form->addItem($results_presentation);
     // deletion of test results
     $passDeletion = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_deletion"), "pass_deletion_allowed");
     $passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_not_allowed"), 0, ''));
     $passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_allowed"), 1, ''));
     $passDeletion->setValue($this->object->isPassDeletionAllowed());
     $form->addItem($passDeletion);
     // export settings
     $export_settings = new ilCheckboxGroupInputGUI($this->lng->txt("tst_export_settings"), "export_settings");
     $export_settings->addOption(new ilCheckboxOption($this->lng->txt("tst_exp_sc_short"), 'exp_sc_short', ''));
     $values = array();
     if ($this->object->getExportSettingsSingleChoiceShort()) {
         array_push($values, 'exp_sc_short');
     }
     $export_settings->setValue($values);
     $form->addItem($export_settings);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form->addCommandButton("saveScoring", $this->lng->txt("save"));
     }
     // remove items when using template
     if ($template_settings) {
         foreach ($template_settings as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     $errors = false;
     if ($save) {
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }