/** * Creates the evaluation output for the test * * @access public */ function outEvaluation() { /** * @var $ilAcccess ilAccessHandler * @var $ilToolbar ilToolbarGUI */ global $ilAccess, $ilToolbar; if (!$ilAccess->checkAccess("tst_statistics", "", $this->ref_id) && !$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only evaluation access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); } include_once "./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php"; $table_gui = new ilEvaluationAllTableGUI($this, 'outEvaluation', $this->object->getAnonymity(), $this->object->isOfferingQuestionHintsEnabled()); $data = array(); $arrFilter = array(); foreach ($table_gui->getFilterItems() as $item) { if ($item->getValue() !== false) { switch ($item->getPostVar()) { case 'group': case 'name': case 'course': $arrFilter[$item->getPostVar()] = $item->getValue(); break; case 'passed_only': $passedonly = $item->getChecked(); break; } } } include_once "./Modules/Test/classes/class.ilTestEvaluationData.php"; $eval = new ilTestEvaluationData($this->object); $eval->setFilterArray($arrFilter); $foundParticipants =& $eval->getParticipants(); $counter = 1; if (count($foundParticipants) > 0) { if ($this->object->getECTSOutput()) { $passed_array =& $this->object->getTotalPointsPassedArray(); } foreach ($foundParticipants as $active_id => $userdata) { /* @var $userdata ilTestEvaluationUserData */ $remove = FALSE; if ($passedonly) { $mark_obj = $this->object->getMarkSchema()->getMatchingMark($userdata->getReachedPointsInPercent()); if ($mark_obj->getPassed() == FALSE || !$userdata->areObligationsAnswered()) { $remove = TRUE; } } if (!$remove) { // build the evaluation row $evaluationrow = array(); if ($this->object->getAnonymity()) { $evaluationrow['name'] = $counter; $evaluationrow['login'] = ''; } else { $evaluationrow['name'] = $userdata->getName(); if (strlen($userdata->getLogin())) { $evaluationrow['login'] = "******" . $userdata->getLogin() . "]"; } else { $evaluationrow['login'] = ''; } } $evaluationrow['reached'] = $userdata->getReached(); $evaluationrow['max'] = $userdata->getMaxpoints(); $evaluationrow['hint_count'] = $userdata->getRequestedHintsCountFromScoredPass(); $percentage = $userdata->getReachedPointsInPercent(); $mark = $this->object->getMarkSchema()->getMatchingMark($percentage); if (is_object($mark)) { $evaluationrow['mark'] = $mark->getShortName(); } if ($this->object->getECTSOutput()) { $ects_mark = $this->object->getECTSGrade($passed_array, $userdata->getReached(), $userdata->getMaxPoints()); $evaluationrow['ects_grade'] = $ects_mark; } $evaluationrow['answered'] = $userdata->getQuestionsWorkedThroughInPercent(); $evaluationrow['questions_worked_through'] = $userdata->getQuestionsWorkedThrough(); $evaluationrow['number_of_questions'] = $userdata->getNumberOfQuestions(); $time_seconds = $userdata->getTimeOfWork(); $time_hours = floor($time_seconds / 3600); $time_seconds -= $time_hours * 3600; $time_minutes = floor($time_seconds / 60); $time_seconds -= $time_minutes * 60; $evaluationrow['working_time'] = sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds); $this->ctrl->setParameter($this, "active_id", $active_id); $href = $this->ctrl->getLinkTarget($this, "detailedEvaluation"); $detailed_evaluation = $this->lng->txt("detailed_evaluation_show"); $evaluationrow['details'] = "<a class=\"il_ContainerItemCommand\" href=\"{$href}\">{$detailed_evaluation}</a>"; $userfields = ilObjUser::_lookupFields($userdata->getUserID()); $evaluationrow['gender'] = $userfields['gender']; $evaluationrow['email'] = $userfields['email']; $evaluationrow['institution'] = $userfields['institution']; $evaluationrow['street'] = $userfields['street']; $evaluationrow['city'] = $userfields['city']; $evaluationrow['zipcode'] = $userfields['zipcode']; $evaluationrow['country'] = $userfields['country']; $evaluationrow['sel_country'] = $userfields['sel_country']; $evaluationrow['department'] = $userfields['department']; $evaluationrow['matriculation'] = $userfields['matriculation']; $counter++; $data[] = $evaluationrow; } } } $table_gui->setData($data); if (count($foundParticipants) > 0) { $ilToolbar->setFormName('form_output_eval'); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'exportEvaluation')); require_once 'Services/Form/classes/class.ilSelectInputGUI.php'; $export_type = new ilSelectInputGUI($this->lng->txt('exp_eval_data'), 'export_type'); $options = array('excel' => $this->lng->txt('exp_type_excel'), 'csv' => $this->lng->txt('exp_type_spss')); if (!$this->object->getAnonymity()) { include_once 'Services/Certificate/classes/class.ilCertificate.php'; include_once 'Modules/Test/classes/class.ilTestCertificateAdapter.php'; if (ilCertificate::_isComplete(new ilTestCertificateAdapter($this->object))) { $options['certificate'] = $this->lng->txt('exp_type_certificate'); } } $export_type->setOptions($options); $ilToolbar->addInputItem($export_type, true); require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php'; $button = ilSubmitButton::getInstance(); $button->setCommand('exportEvaluation'); $button->setCaption('export'); $button->getOmitPreventDoubleSubmission(); $ilToolbar->addButtonInstance($button); } $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print"); if ($this->object->getShowSolutionAnswersOnly()) { $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print"); } $this->tpl->setContent($table_gui->getHTML()); }
/** * Creates the evaluation output for the test * * @access public */ function outEvaluation() { global $ilAccess; if (!$ilAccess->checkAccess("tst_statistics", "", $this->ref_id) && !$ilAccess->checkAccess("write", "", $this->ref_id)) { // allow only evaluation access ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true); $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen"); } include_once "./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php"; $table_gui = new ilEvaluationAllTableGUI($this, 'outEvaluation', $this->object->getAnonymity(), $this->object->isOfferingQuestionHintsEnabled()); $data = array(); $arrFilter = array(); foreach ($table_gui->getFilterItems() as $item) { if ($item->getValue() !== false) { switch ($item->getPostVar()) { case 'group': case 'name': case 'course': $arrFilter[$item->getPostVar()] = $item->getValue(); break; case 'passed_only': $passedonly = $item->getChecked(); break; } } } include_once "./Modules/Test/classes/class.ilTestEvaluationData.php"; $eval = new ilTestEvaluationData($this->object); $eval->setFilterArray($arrFilter); $foundParticipants =& $eval->getParticipants(); $counter = 1; if (count($foundParticipants) > 0) { if ($this->object->ects_output) { $passed_array =& $this->object->getTotalPointsPassedArray(); } foreach ($foundParticipants as $active_id => $userdata) { /* @var $userdata ilTestEvaluationUserData */ $remove = FALSE; if ($passedonly) { $mark_obj = $this->object->getMarkSchema()->getMatchingMark($userdata->getReachedPointsInPercent()); if ($mark_obj->getPassed() == FALSE || !$userdata->areObligationsAnswered()) { $remove = TRUE; } } if (!$remove) { // build the evaluation row $userfields = ilObjUser::_lookupFields($userdata->getUserID()); foreach ($userfields as $key => $value) { $evaluationrow[$key] = strlen($value) ? $value : ' '; } $evaluationrow = array(); $fullname = ""; if ($this->object->getAnonymity()) { $fullname = $counter; $evaluationrow['name'] = $fullname; $evaluationrow['login'] = ''; } else { $evaluationrow['name'] = $userdata->getName(); if (strlen($userdata->getLogin())) { $evaluationrow['login'] = "******" . $userdata->getLogin() . "]"; } else { $evaluationrow['login'] = ''; } } $evaluationrow['reached'] = $userdata->getReached(); $evaluationrow['max'] = $userdata->getMaxpoints(); $evaluationrow['hint_count'] = $userdata->getRequestedHintsCountFromScoredPass(); $percentage = $userdata->getReachedPointsInPercent(); $mark = $this->object->getMarkSchema()->getMatchingMark($percentage); if (is_object($mark)) { $evaluationrow['mark'] = $mark->getShortName(); } if ($this->object->ects_output) { $ects_mark = $this->object->getECTSGrade($passed_array, $userdata->getReached(), $userdata->getMaxPoints()); $evaluationrow['ects_grade'] = $ects_mark; } $evaluationrow['answered'] = $userdata->getQuestionsWorkedThrough() . " " . strtolower($this->lng->txt("of")) . " " . $userdata->getNumberOfQuestions() . " (" . sprintf("%2.2f", $userdata->getQuestionsWorkedThroughInPercent()) . " %" . ")"; $time_seconds = $userdata->getTimeOfWork(); $time_hours = floor($time_seconds / 3600); $time_seconds -= $time_hours * 3600; $time_minutes = floor($time_seconds / 60); $time_seconds -= $time_minutes * 60; $evaluationrow['working_time'] = sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds); $this->ctrl->setParameter($this, "active_id", $active_id); $href = $this->ctrl->getLinkTarget($this, "detailedEvaluation"); $detailed_evaluation = $this->lng->txt("detailed_evaluation_show"); $evaluationrow['details'] = "<a class=\"il_ContainerItemCommand\" href=\"{$href}\">{$detailed_evaluation}</a>"; $userfields = ilObjUser::_lookupFields($userdata->getUserID()); $evaluationrow['gender'] = $userfields['gender']; $evaluationrow['email'] = $userfields['email']; $evaluationrow['institution'] = $userfields['institution']; $evaluationrow['street'] = $userfields['street']; $evaluationrow['city'] = $userfields['city']; $evaluationrow['zipcode'] = $userfields['zipcode']; $evaluationrow['country'] = $userfields['country']; $evaluationrow['departement'] = $userfields['departement']; $evaluationrow['matriculation'] = $userfields['matriculation']; $counter++; array_push($data, $evaluationrow); } } } $table_gui->setData($data); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_evaluation.html", "Modules/Test"); $this->tpl->setVariable('EVALUATION_DATA', $table_gui->getHTML()); if (count($foundParticipants) > 0) { $template = new ilTemplate("tpl.il_as_tst_evaluation_export.html", TRUE, TRUE, "Modules/Test"); $template->setVariable("EXPORT_DATA", $this->lng->txt("exp_eval_data")); if (!$this->object->getAnonymity()) { include_once "./Services/Certificate/classes/class.ilCertificate.php"; include_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php"; if (ilCertificate::_isComplete(new ilTestCertificateAdapter($this->object))) { $template->setVariable("TEXT_CERTIFICATE", $this->lng->txt("exp_type_certificate")); } } $template->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel")); $template->setVariable("TEXT_CSV", $this->lng->txt("exp_type_spss")); $template->setVariable("CMD_EXPORT", "exportEvaluation"); $template->setVariable("BTN_EXPORT", $this->lng->txt("export")); $template->setVariable("BTN_PRINT", $this->lng->txt("print")); $template->setVariable("BTN_COMMAND", $this->ctrl->getCmd()); $template->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this, "exportEvaluation")); $exportoutput = $template->get(); $this->tpl->setVariable("EVALUATION_EXPORT", $exportoutput); } $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print"); if ($this->object->getShowSolutionAnswersOnly()) { $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print"); } }