/** * Output of anonymous aggregated results for the test * * Output of anonymous aggregated results for the test * * @access public */ function eval_a() { /** * @var $ilAccess 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"); } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_eval_anonymous_aggregation.html", "Modules/Test"); $eval =& $this->object->getCompleteEvaluationData(); $data = array(); $foundParticipants =& $eval->getParticipants(); if (count($foundParticipants)) { $ilToolbar->setFormName('form_output_eval'); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'exportAggregatedResults')); require_once 'Services/Form/classes/class.ilSelectInputGUI.php'; $export_type = new ilSelectInputGUI($this->lng->txt('exp_eval_data'), 'export_type'); $export_type->setOptions(array('excel' => $this->lng->txt('exp_type_excel'), 'csv' => $this->lng->txt('exp_type_spss'))); $ilToolbar->addInputItem($export_type, true); require_once 'Services/UIComponent/Button/classes/class.ilSubmitButton.php'; $button = ilSubmitButton::getInstance(); $button->setCommand('exportAggregatedResults'); $button->setCaption('export'); $button->getOmitPreventDoubleSubmission(); $ilToolbar->addButtonInstance($button); array_push($data, array('result' => $this->lng->txt("tst_eval_total_persons"), 'value' => count($foundParticipants))); $total_finished = $this->object->evalTotalFinished(); array_push($data, array('result' => $this->lng->txt("tst_eval_total_finished"), 'value' => $total_finished)); $average_time = $this->object->evalTotalStartedAverageTime(); $diff_seconds = $average_time; $diff_hours = floor($diff_seconds / 3600); $diff_seconds -= $diff_hours * 3600; $diff_minutes = floor($diff_seconds / 60); $diff_seconds -= $diff_minutes * 60; array_push($data, array('result' => $this->lng->txt("tst_eval_total_finished_average_time"), 'value' => sprintf("%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds))); $total_passed = 0; $total_passed_reached = 0; $total_passed_max = 0; $total_passed_time = 0; foreach ($foundParticipants as $userdata) { if ($userdata->getPassed()) { $total_passed++; $total_passed_reached += $userdata->getReached(); $total_passed_max += $userdata->getMaxpoints(); $total_passed_time += $userdata->getTimeOfWork(); } } $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0; $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0; $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0; array_push($data, array('result' => $this->lng->txt("tst_eval_total_passed"), 'value' => $total_passed)); array_push($data, array('result' => $this->lng->txt("tst_eval_total_passed_average_points"), 'value' => sprintf("%2.2f", $average_passed_reached) . " " . strtolower($this->lng->txt("of")) . " " . sprintf("%2.2f", $average_passed_max))); $average_time = $average_passed_time; $diff_seconds = $average_time; $diff_hours = floor($diff_seconds / 3600); $diff_seconds -= $diff_hours * 3600; $diff_minutes = floor($diff_seconds / 60); $diff_seconds -= $diff_minutes * 60; array_push($data, array('result' => $this->lng->txt("tst_eval_total_passed_average_time"), 'value' => sprintf("%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds))); } include_once "./Modules/Test/classes/tables/class.ilTestAggregatedResultsTableGUI.php"; $table_gui = new ilTestAggregatedResultsTableGUI($this, 'eval_a'); $table_gui->setData($data); $this->tpl->setVariable('AGGREGATED_RESULTS', $table_gui->getHTML()); $rows = array(); foreach ($eval->getQuestionTitles() as $question_id => $question_title) { $answered = 0; $reached = 0; $max = 0; foreach ($foundParticipants as $userdata) { for ($i = 0; $i <= $userdata->getLastPass(); $i++) { if (is_object($userdata->getPass($i))) { $question =& $userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id); if (is_array($question)) { $answered++; $reached += $question["reached"]; $max += $question["points"]; } } } } $percent = $max ? $reached / $max * 100.0 : 0; $counter++; $this->ctrl->setParameter($this, "qid", $question_id); $points_reached = $answered ? $reached / $answered : 0; $points_max = $answered ? $max / $answered : 0; array_push($rows, array('qid' => $question_id, 'title' => $question_title, 'points' => $points_reached, 'points_reached' => $points_reached, 'points_max' => $points_max, 'percentage' => (double) $percent, 'answers' => $answered)); } include_once "./Modules/Test/classes/tables/class.ilTestAverageReachedPointsTableGUI.php"; $table_gui = new ilTestAverageReachedPointsTableGUI($this, 'eval_a'); $table_gui->setData($rows); $this->tpl->setVariable('TBL_AVG_REACHED', $table_gui->getHTML()); }
/** * Output of anonymous aggregated results for the test * * Output of anonymous aggregated results for the test * * @access public */ function eval_a() { 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"); } $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_eval_anonymous_aggregation.html", "Modules/Test"); $eval =& $this->object->getCompleteEvaluationData(); $data = array(); $foundParticipants =& $eval->getParticipants(); if (count($foundParticipants)) { $template = new ilTemplate("tpl.il_as_tst_evaluation_export.html", TRUE, TRUE, "Modules/Test"); $template->setVariable("EXPORT_DATA", $this->lng->txt("exp_eval_data")); $template->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel")); $template->setVariable("TEXT_CSV", $this->lng->txt("exp_type_spss")); $template->setVariable("CMD_EXPORT", "exportAggregatedResults"); $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, "exportAggregatedResults")); $exportoutput = $template->get(); $this->tpl->setVariable("EVALUATION_EXPORT", $exportoutput); array_push($data, array('result' => $this->lng->txt("tst_eval_total_persons"), 'value' => count($foundParticipants))); $total_finished = $this->object->evalTotalFinished(); array_push($data, array('result' => $this->lng->txt("tst_eval_total_finished"), 'value' => $total_finished)); $average_time = $this->object->evalTotalStartedAverageTime(); $diff_seconds = $average_time; $diff_hours = floor($diff_seconds / 3600); $diff_seconds -= $diff_hours * 3600; $diff_minutes = floor($diff_seconds / 60); $diff_seconds -= $diff_minutes * 60; array_push($data, array('result' => $this->lng->txt("tst_eval_total_finished_average_time"), 'value' => sprintf("%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds))); $total_passed = 0; $total_passed_reached = 0; $total_passed_max = 0; $total_passed_time = 0; foreach ($foundParticipants as $userdata) { if ($userdata->getPassed()) { $total_passed++; $total_passed_reached += $userdata->getReached(); $total_passed_max += $userdata->getMaxpoints(); $total_passed_time += $userdata->getTimeOfWork(); } } $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0; $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0; $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0; array_push($data, array('result' => $this->lng->txt("tst_eval_total_passed"), 'value' => $total_passed)); array_push($data, array('result' => $this->lng->txt("tst_eval_total_passed_average_points"), 'value' => sprintf("%2.2f", $average_passed_reached) . " " . strtolower($this->lng->txt("of")) . " " . sprintf("%2.2f", $average_passed_max))); $average_time = $average_passed_time; $diff_seconds = $average_time; $diff_hours = floor($diff_seconds / 3600); $diff_seconds -= $diff_hours * 3600; $diff_minutes = floor($diff_seconds / 60); $diff_seconds -= $diff_minutes * 60; array_push($data, array('result' => $this->lng->txt("tst_eval_total_passed_average_time"), 'value' => sprintf("%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds))); } include_once "./Modules/Test/classes/tables/class.ilTestAggregatedResultsTableGUI.php"; $table_gui = new ilTestAggregatedResultsTableGUI($this, 'eval_a'); $table_gui->setData($data); $this->tpl->setVariable('AGGREGATED_RESULTS', $table_gui->getHTML()); $rows = array(); foreach ($eval->getQuestionTitles() as $question_id => $question_title) { $answered = 0; $reached = 0; $max = 0; foreach ($foundParticipants as $userdata) { for ($i = 0; $i <= $userdata->getLastPass(); $i++) { if (is_object($userdata->getPass($i))) { $question =& $userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id); if (is_array($question)) { $answered++; $reached += $question["reached"]; $max += $question["points"]; } } } } $percent = $max ? $reached / $max * 100.0 : 0; $counter++; $this->ctrl->setParameter($this, "qid", $question_id); array_push($rows, array('title' => $question_title, 'points' => sprintf("%.2f", $answered ? $reached / $answered : 0) . " " . strtolower($this->lng->txt("of")) . " " . sprintf("%.2f", $answered ? $max / $answered : 0), 'percentage' => (double) $percent, 'answers' => $answered)); } include_once "./Modules/Test/classes/tables/class.ilTestAverageReachedPointsTableGUI.php"; $table_gui = new ilTestAverageReachedPointsTableGUI($this, 'eval_a'); $table_gui->setData($rows); $this->tpl->setVariable('TBL_AVG_REACHED', $table_gui->getHTML()); }