/** * Fill table row */ protected function fillRow($d) { global $lng, $ilCtrl; $user_id = $d["user_id"]; foreach ($this->ass_data as $ass) { // grade $this->tpl->setCurrentBlock("grade"); $status = ilEphAssignment::lookupStatusOfUser($ass["id"], $user_id); $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" '); $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("rep_robj_xeph_notgraded")); $this->tpl->setVariable("TXT_PASSED", $lng->txt("rep_robj_xeph_passed")); $this->tpl->setVariable("TXT_FAILED", $lng->txt("rep_robj_xeph_failed")); switch ($status) { case "passed": $pic = "scorm/passed.png"; break; case "failed": $pic = "scorm/failed.png"; break; default: $pic = "scorm/not_attempted.png"; break; } $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic)); $this->tpl->setVariable("ALT_STATUS", $lng->txt("rep_robj_xeph_" . $status)); // mark $mark = ilEphAssignment::lookupMarkOfUser($ass["id"], $user_id); $this->tpl->setVariable("VAL_ONLY_MARK", $mark); $this->tpl->parseCurrentBlock(); } // exercise total // mark input $this->tpl->setCurrentBlock("mark_input"); $this->tpl->setVariable("TXT_MARK", $lng->txt("rep_robj_xeph_mark")); $this->tpl->setVariable("NAME_MARK", "mark[" . $user_id . "]"); include_once 'Services/Tracking/classes/class.ilLPMarks.php'; $mark = ilLPMarks::_lookupMark($user_id, $this->eph_id); $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("grade"); $status = ilEphorusMembers::_lookupStatus($this->eph_id, $user_id); $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" '); switch ($status) { case "passed": $pic = "scorm/passed.png"; break; case "failed": $pic = "scorm/failed.png"; break; default: $pic = "scorm/not_attempted.png"; break; } $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic)); $this->tpl->setVariable("ALT_STATUS", $lng->txt("rep_robj_xeph_" . $status)); // mark /*$this->tpl->setVariable("TXT_MARK", $lng->txt("eph_mark")); $this->tpl->setVariable("NAME_MARK", "mark[".$d["id"]."]"); $mark = ilEphAssignment::lookupMarkOfUser($ass["id"], $user_id); $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));*/ $this->tpl->parseCurrentBlock(); // name $this->tpl->setVariable("TXT_NAME", $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]"); $this->tpl->setVariable("VAL_ID", $user_id); $ilCtrl->setParameter($this->parent_obj, "part_id", $user_id); $this->tpl->setVariable("LINK_NAME", $ilCtrl->getLinkTarget($this->parent_obj, "showParticipant")); // comment $this->tpl->setVariable("ID_COMMENT", $user_id); $c = ilLPMarks::_lookupComment($user_id, $this->eph_id); $this->tpl->setVariable("VAL_COMMENT", ilUtil::prepareFormOutput($c)); }
/** * Exports grades as ephel */ function exportGradesExcel() { include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php"; $ass_data = ilEphAssignment::getAssignmentDataOfEphorus($this->getId()); include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php"; $ephelfile = ilUtil::ilTempnam(); $adapter = new ilExcelWriterAdapter($ephelfile, FALSE); $workbook = $adapter->getWorkbook(); $workbook->setVersion(8); // Use Excel97/2000 Format include_once "./Services/Excel/classes/class.ilExcelUtils.php"; // // status // $mainworksheet = $workbook->addWorksheet(); // header row $mainworksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name"))); $cnt = 1; foreach ($ass_data as $ass) { $mainworksheet->writeString(0, $cnt, $cnt); $cnt++; } $mainworksheet->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("rep_robj_xeph_total_exc"))); // data rows $this->mem_obj = new ilEphorusMembers($this); $getmems = $this->mem_obj->getMembers(); $mems = array(); foreach ($getmems as $user_id) { $mems[$user_id] = ilObjUser::_lookupName($user_id); } $mems = ilUtil::sortArray($mems, "lastname", "asc", false, true); $data = array(); $row_cnt = 1; foreach ($mems as $user_id => $d) { $col_cnt = 1; // name $mainworksheet->writeString($row_cnt, 0, ilExcelUtils::_convert_text($d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]")); reset($ass_data); foreach ($ass_data as $ass) { $status = ilEphAssignment::lookupStatusOfUser($ass["id"], $user_id); $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("rep_robj_xeph_" . $status))); $col_cnt++; } // total status $status = ilEphorusMembers::_lookupStatus($this->getId(), $user_id); $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("rep_robj_xeph_" . $status))); $row_cnt++; } // // mark // $worksheet2 = $workbook->addWorksheet(); // header row $worksheet2->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name"))); $cnt = 1; foreach ($ass_data as $ass) { $worksheet2->writeString(0, $cnt, $cnt); $cnt++; } $worksheet2->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("rep_robj_xeph_total_exc"))); // data rows $data = array(); $row_cnt = 1; reset($mems); foreach ($mems as $user_id => $d) { $col_cnt = 1; $d = ilObjUser::_lookupName($user_id); // name $worksheet2->writeString($row_cnt, 0, ilExcelUtils::_convert_text($d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]")); reset($ass_data); foreach ($ass_data as $ass) { $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text(ilEphAssignment::lookupMarkOfUser($ass["id"], $user_id))); $col_cnt++; } // total mark include_once 'Services/Tracking/classes/class.ilLPMarks.php'; $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text(ilLPMarks::_lookupMark($user_id, $this->getId()))); $row_cnt++; } $workbook->close(); $eph_name = ilUtil::getASCIIFilename(preg_replace("/\\s/", "_", $this->getTitle())); ilUtil::deliverFile($ephelfile, $eph_name . ".xls", "application/vnd.ms-ephel"); }