/** * Constructor */ function ilEphAssignmentTableGUI($a_parent_obj, $a_parent_cmd, $a_eph) { global $ilCtrl, $lng, $ilAccess; $this->eph = $a_eph; $this->setId("ephass" . $this->eph->getId()); parent::__construct($a_parent_obj, $a_parent_cmd); $this->setTitle($lng->txt("rep_robj_xeph_assignments")); $this->setTopCommands(true); // if you add pagination and disable the unlimited setting: // fix saving of ordering of single pages! $this->setLimit(9999); $this->addColumn("", "", "1", true); $this->addColumn($lng->txt("title"), "title"); $this->addColumn($lng->txt("rep_robj_xeph_presentation_order"), "order_val"); $this->addColumn($lng->txt("rep_robj_xeph_start_time"), "start_time"); $this->addColumn($lng->txt("rep_robj_xeph_deadline"), "deadline"); $this->addColumn($lng->txt("rep_robj_xeph_mandatory"), "mandatory"); $this->addColumn($lng->txt("rep_robj_xeph_instruction"), "", "40%"); $this->addColumn($lng->txt("actions")); $this->setDefaultOrderField("val_order"); $this->setDefaultOrderDirection("asc"); $this->setEnableHeader(true); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.eph_assignments_row.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus"); $this->setEnableTitle(true); $this->setSelectAllCheckbox("id"); $this->addMultiCommand("confirmDeleteAssignment", $lng->txt("delete")); $this->addCommandButton("orderAssignmentsByDeadline", $lng->txt("rep_robj_xeph_order_by_deadline")); $this->addCommandButton("saveAssignmentsOrder", $lng->txt("rep_robj_xeph_save_order")); include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php"; $data = ilEphAssignment::getAssignmentDataOfEphorus($this->eph->getId()); $this->setData($data); }
/** * Constructor */ function __construct($a_parent_obj, $a_parent_cmd, $a_eph, $a_mem_obj) { global $ilCtrl, $lng, $ilAccess, $lng; $this->eph = $a_eph; $this->eph_id = $this->eph->getId(); include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php"; $this->setId("eph_grades_" . $this->eph_id); $this->mem_obj = $a_mem_obj; $mems = $this->mem_obj->getMembers(); $data = array(); foreach ($mems as $d) { $data[$d] = ilObjUser::_lookupName($d); $data[$d]["user_id"] = $d; } parent::__construct($a_parent_obj, $a_parent_cmd); $this->setData($data); $this->ass_data = ilEphAssignment::getAssignmentDataOfEphorus($this->eph_id); //var_dump($data); $this->setTitle($lng->txt("rep_robj_xeph_grades_overview")); $this->setTopCommands(true); //$this->setLimit(9999); // $this->addColumn("", "", "1", true); $this->addColumn($this->lng->txt("name"), "lastname"); $cnt = 1; foreach ($this->ass_data as $ass) { $ilCtrl->setParameter($this->parent_obj, "ass_id", $ass["id"]); $cnt_str = '<a href="' . $ilCtrl->getLinkTarget($this->parent_obj, "showSubmissions") . '">' . $cnt . '</a>'; if ($ass["mandatory"]) { $this->addColumn("<u>" . $cnt_str . "</u>", "", "", false, "", $ass["title"] . " " . "(" . $lng->txt("rep_robj_xeph_mandatory") . ")"); } else { $this->addColumn($cnt_str, "", "", false, "", $ass["title"]); } $cnt++; } $ilCtrl->setParameter($this->parent_obj, "ass_id", ""); $this->addColumn($this->lng->txt("rep_robj_xeph_total_exc"), ""); $this->addColumn($this->lng->txt("rep_robj_xeph_comment_for_learner"), "", "1%"); // $this->addColumn($this->lng->txt("eph_grading"), "solved_time"); // $this->addColumn($this->lng->txt("mail"), "feedback_time"); $this->setDefaultOrderField("lastname"); $this->setDefaultOrderDirection("asc"); $this->setEnableHeader(true); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.eph_grades_row.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus"); //$this->disable("footer"); $this->setEnableTitle(true); // $this->setSelectAllCheckbox("assid"); if (count($mems) > 0) { $this->addCommandButton("saveGrades", $lng->txt("rep_robj_xeph_save")); } }
/** * Constructor */ function __construct($a_parent_obj, $a_parent_cmd, $a_eph, $a_part_id) { global $ilCtrl, $lng, $ilAccess, $lng; $this->eph = $a_eph; $this->eph_id = $this->eph->getId(); include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php"; $this->part_id = $a_part_id; $this->setId("eph_part_" . $this->eph_id . "_" . $this->part_id); include_once "./Services/User/classes/class.ilObjUser.php"; if ($this->part_id > 0) { $name = ilObjUser::_lookupName($this->part_id); $this->user = new ilObjUser($this->part_id); } parent::__construct($a_parent_obj, $a_parent_cmd); $data = ilEphAssignment::getAssignmentDataOfEphorus($this->eph_id); $this->setData($data); if ($this->part_id > 0) { $this->setTitle($lng->txt("rep_robj_xeph_participant") . ": " . $name["lastname"] . ", " . $name["firstname"] . " [" . $name["login"] . "]"); } else { $this->setTitle($lng->txt("rep_robj_xeph_participant")); } $this->setTopCommands(true); $this->addColumn($this->lng->txt("rep_robj_xeph_assignment"), "order_val"); $this->addColumn($this->lng->txt("rep_robj_xeph_submission"), "submission"); $this->addColumn($this->lng->txt("rep_robj_xeph_reports"), "reports"); $this->addColumn($this->lng->txt("rep_robj_xeph_grading"), "solved_time"); $this->addColumn($this->lng->txt("feedback"), "feedback_time"); $this->setDefaultOrderField("order_val"); $this->setDefaultOrderDirection("asc"); $this->setEnableHeader(true); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.eph_participant_row.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus"); $this->setEnableTitle(true); if ($this->part_id > 0) { $this->addCommandButton("saveStatusParticipant", $lng->txt("rep_robj_xeph_save")); } }
/** * Create member status record for a new participant for all assignments */ static function createNewUserRecords($a_user_id, $a_eph_id) { global $ilDB; $ass_data = ilEphAssignment::getAssignmentDataOfEphorus($a_eph_id); foreach ($ass_data as $ass) { $ilDB->replace("rep_robj_xeph_ass_stat", array("ass_id" => array("integer", $ass["id"]), "user_id" => array("integer", $a_user_id)), array("status" => array("text", "notgraded"))); } }
/** * Show participants */ function showParticipants() { global $ilCtrl, $tpl, $ilTabs, $ilToolbar; $ilTabs->activateTab("submissions"); $this->addSubmissionSubTabs("participant"); // participant selection include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php"; $ass = ilEphAssignment::getAssignmentDataOfEphorus($this->object->getId()); $members = $this->object->members_obj->getMembers(); if (count($members) == 0) { ilUtil::sendInfo($this->txt("no_participants")); return; } $mems = array(); foreach ($members as $mem_id) { if (ilObject::_lookupType($mem_id) == "usr") { include_once "./Services/User/classes/class.ilObjUser.php"; $name = ilObjUser::_lookupName($mem_id); $mems[$mem_id] = $name; } } $mems = ilUtil::sortArray($mems, "lastname", "asc", false, true); if ($_GET["part_id"] == "" && count($mems) > 0) { $_GET["part_id"] = key($mems); } reset($mems); if (count($mems) > 1) { $options = array(); foreach ($mems as $k => $m) { $options[$k] = $m["lastname"] . ", " . $m["firstname"] . " [" . $m["login"] . "]"; } include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $si = new ilSelectInputGUI($this->lng->txt(""), "part_id"); $si->setOptions($options); $si->setValue($_GET["part_id"]); $ilToolbar->addInputItem($si); $ilToolbar->setFormAction($ilCtrl->getFormAction($this)); $ilToolbar->addFormButton($this->lng->txt("rep_robj_xeph_select_part"), "selectParticipant"); } if (count($mems) > 0) { include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphParticipantTableGUI.php"; $part_tab = new ilEphParticipantTableGUI($this, "showParticipants", $this->object, $_GET["part_id"]); $tpl->setContent($part_tab->getHTML()); } else { ilUtil::sendInfo($this->lng->txt("rep_robj_xeph_no_assignments_available")); } }
/** * 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"); }