function viewReport() { global $ilCtrl, $ilTabs, $lng, $tpl; include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphorusReportTableGUI.php"; include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphorusReportGUI.php"; include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/include/class.DLEApi.php"; include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/include/class.EphorusApi.php"; $document = DLEApi::getDocument($_GET['doc_id']); $mode = isset($_GET["mode"]) ? $_GET["mode"] : "summary"; $ephorus_report = new EphorusReport($_GET['doc_id'], $mode); $tpl->setTitle(sprintf($lng->txt("rep_robj_xeph_report_for assignment"), ilEphAssignment::lookupTitle($_GET["ass_id"]))); $tpl->setDescription(""); $tpl->addCss($this->object->plugin->getStyleSheetLocation("report.css")); $ilTabs->clearTargets(); $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "showSubmissions")); $eph_tab = new ilEphorusReportHeaderTableGUI($this, "viewReport", $document); $header = $eph_tab->getHTML() . "<br />"; $matches = ""; $eph_content = new ilEphorusReportGUI($this); if ($document->status == 1) { $pre_header = "<div class=\"small xephModeSelection\">"; $ilCtrl->setParameter($this, "mode", "summary"); $pre_header .= ($mode == "summary" ? "<span style=>Summary</span>" : "<a href=\"" . $ilCtrl->getLinkTarget($this, "viewReport") . "\">Summary</a>") . " / "; $ilCtrl->setParameter($this, "mode", "detailed"); $pre_header .= $mode == "detailed" ? "<span>Detailed</span>" : "<a href=\"" . $ilCtrl->getLinkTarget($this, "viewReport") . "\">Detailed</a>"; $header = $pre_header . "</div>" . $header; $ilCtrl->setParameter($this, "mode", $mode); $results = DLEApi::getResults($document->guid); if ($mode == "detailed") { $js = "\$('input[name=\"diff\"]').change(function() {\n \$(this).parents('form').append('<input type=\"hidden\" name=\"cmd[viewReport]\">');\n \$(this).parents('form').submit();\n });"; $tpl->addOnLoadCode($js); $result = isset($_POST['diff']) ? $_POST["diff"] : reset($results)->guid; $eph_matches = new ilEphorusReportMatchesDetailedTableGUI($this, "viewReport", $document, $ephorus_report->getHeader($result)); $matches = $eph_matches->getHTML() . "<br />"; $content = $eph_content->getReport($ephorus_report->getReport(array(), $results[$result]->comparison)); } else { $guids = isset($_POST['guids_use']) ? $_POST["guids_use"] : array_keys($results); $eph_matches = new ilEphorusReportMatchesTableGUI($this, "viewReport", $document, $ephorus_report->getHeader($guids)); $matches = $eph_matches->getHTML() . "<br />"; $content = $eph_content->getReport($ephorus_report->getReport($guids)); } } else { $content = $eph_content->getReport($ephorus_report->getReport()); } $tpl->setContent($header . $matches . $content); }
/** * Gets the header of the report * * @param array|string $selected_sources * @return array */ public function getHeader($selected_sources) { $result_list = array(); $results = DLEApi::getResults($this->document_guid); foreach ($results as $result) { $result_list[$result->guid] = array('percentage' => $result->percentage); if ($this->mode == 'detailed') { $result_list[$result->guid]['input'] = array('type' => 'radio', 'checked' => $result->guid == $selected_sources, 'value' => $result->guid, 'name' => 'diff'); } else { $result_list[$result->guid]['input'] = array('type' => 'checkbox', 'checked' => in_array($result->guid, $selected_sources), 'value' => $result->guid, 'name' => 'guids_use[]'); } $result_list[$result->guid]['source'] = array('title' => $result->type == 'local' ? sprintf(DLEApi::getText('document_written_by'), $result->student_name, $result->student_number) : $result->url, 'link' => $result->type == 'local' ? ($document_id = DLEApi::checkDocumentExists($result->original_guid)) ? DLEApi::getURL($document_id) : false : $result->url); } return $result_list; }