/** * Get current values for assignment from * */ public function getAssignmentValues() { $values = array(); $ass = new ilExAssignment($_GET["ass_id"]); $values["title"] = $ass->getTitle(); if ($ass->getStartTime() > 0) { $values["start_time_cb"] = true; } $values["mandatory"] = $ass->getMandatory(); $values["instruction"] = $ass->getInstruction(); $values["type"] = $ass->getType(); if ($ass->getDeadline() > 0) { $values["deadline_cb"] = true; } if ($this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $this->form->removeItemByPostVar("peer"); $this->form->removeItemByPostVar("peer_min"); $this->form->removeItemByPostVar("peer_dl"); } else { $values["peer"] = $ass->getPeerReview(); $values["peer_min"] = $ass->getPeerReviewMin(); if ($ass->getPeerReviewDeadline() > 0) { $values["peer_dl_tgl"] = true; $peer_dl_date = new ilDateTime($ass->getPeerReviewDeadline(), IL_CAL_UNIX); $peer_dl = $this->form->getItemByPostVar("peer_dl"); $peer_dl->setDate($peer_dl_date); } } $this->form->setValuesByArray($values); if ($ass->getDeadline() > 0) { $edit_date = new ilDateTime($ass->getDeadline(), IL_CAL_UNIX); $ed_item = $this->form->getItemByPostVar("deadline"); $ed_item->setDate($edit_date); } if ($ass->getStartTime() > 0) { $edit_date = new ilDateTime($ass->getStartTime(), IL_CAL_UNIX); $ed_item = $this->form->getItemByPostVar("start_time"); $ed_item->setDate($edit_date); } if ($ass->getFeedbackFile()) { $this->form->getItemByPostVar("fb")->setChecked(true); $this->form->getItemByPostVar("fb_cron")->setChecked($ass->hasFeedbackCron()); $this->form->getItemByPostVar("fb_file")->setValue(basename($ass->getFeedbackFilePath())); } // if there are any submissions we cannot change type anymore if (sizeof(ilExAssignment::getAllDeliveredFiles($this->object->getId(), $ass->getId())) || $this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $this->form->getItemByPostVar("type")->setDisabled(true); } }
/** * Update assignment * */ public function updateAssignmentObject() { global $tpl, $lng, $ilCtrl, $ilTabs; $this->checkPermission("write"); $ilTabs->activateTab("content"); $this->addContentSubTabs("list_assignments"); $this->initAssignmentForm("edit"); if ($this->form->checkInput()) { include_once "./Modules/Exercise/classes/class.ilExAssignment.php"; $ass = new ilExAssignment($_GET["ass_id"]); // #14450 $protected_peer_review_groups = false; if ($ass->getPeerReview() && $ass->hasPeerReviewGroups()) { $protected_peer_review_groups = true; } // additional checks $valid = true; if (!$protected_peer_review_groups) { if ($_POST["start_time_cb"] && $_POST["deadline_cb"]) { // check whether start date is before end date $start_date = $this->form->getItemByPostVar("start_time")->getDate(); $end_date = $this->form->getItemByPostVar("deadline")->getDate(); if ($start_date->get(IL_CAL_UNIX) >= $end_date->get(IL_CAL_UNIX)) { $this->form->getItemByPostVar("start_time")->setAlert($lng->txt("exc_start_date_should_be_before_end_date")); $this->form->getItemByPostVar("deadline")->setAlert($lng->txt("exc_start_date_should_be_before_end_date")); $valid = false; } } if (!$_POST["deadline_cb"]) { if ($_POST["peer"]) { $this->form->getItemByPostVar("peer")->setAlert($lng->txt("exc_needs_deadline")); $valid = false; } if ($_POST["fb"] && $_POST["fb_date"] == ilExAssignment::FEEDBACK_DATE_DEADLINE) { $this->form->getItemByPostVar("fb")->setAlert($lng->txt("exc_needs_deadline")); $valid = false; } } else { if ($_POST["type"] != ilExAssignment::TYPE_UPLOAD_TEAM && $_POST["peer"] && $_POST["peer_dl_tgl"]) { $peer_dl = $this->form->getItemByPostVar("peer_dl")->getDate(); $peer_dl = $peer_dl->get(IL_CAL_UNIX); $end_date = $this->form->getItemByPostVar("deadline")->getDate(); $end_date = $end_date->get(IL_CAL_UNIX); // #13877 if ($peer_dl < $end_date) { $this->form->getItemByPostVar("peer_dl")->setAlert($lng->txt("exc_peer_deadline_mismatch")); $valid = false; } } } } if (!$valid) { ilUtil::sendFailure($lng->txt("form_input_not_valid")); $this->form->setValuesByPost(); $tpl->setContent($this->form->getHtml()); return; } $ass->setTitle($_POST["title"]); $ass->setInstruction($_POST["instruction"]); $ass->setExerciseId($this->object->getId()); $ass->setMandatory($_POST["mandatory"]); $ass->setType($_POST["type"]); if ($_POST["start_time_cb"]) { $date = $this->form->getItemByPostVar("start_time")->getDate(); $ass->setStartTime($date->get(IL_CAL_UNIX)); } else { $ass->setStartTime(null); } if (!$protected_peer_review_groups) { // deadline if ($_POST["deadline_cb"]) { $date = $this->form->getItemByPostVar("deadline")->getDate(); $ass->setDeadline($date->get(IL_CAL_UNIX)); } else { $ass->setDeadline(null); } if ($_POST["type"] != ilExAssignment::TYPE_UPLOAD_TEAM) { $ass->setPeerReview($_POST["peer"]); $ass->setPeerReviewMin($_POST["peer_min"]); $ass->setPeerReviewFileUpload($_POST["peer_file"]); if ($ass->getDeadline() && $ass->getDeadline() > time()) { $ass->setPeerReviewPersonalized($_POST["peer_prsl"]); } if ($_POST["peer_dl_tgl"]) { $peer_dl = $this->form->getItemByPostVar("peer_dl")->getDate(); $ass->setPeerReviewDeadline($peer_dl->get(IL_CAL_UNIX)); } else { $ass->setPeerReviewDeadline(null); } } } if (!$_POST["fb"] || $this->form->getItemByPostVar("fb_file")->getDeletionFlag()) { $ass->deleteFeedbackFile(); $ass->setFeedbackFile(null); } else { if ($_FILES["fb_file"]["tmp_name"]) { $ass->handleFeedbackFileUpload($_FILES["fb_file"]); } } $ass->setFeedbackCron($_POST["fb"]); // #13380 $ass->setFeedbackDate($_POST["fb_date"]); $ass->update(); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); $ilCtrl->redirect($this, "editAssignment"); } else { $this->form->setValuesByPost(); $tpl->setContent($this->form->getHtml()); } }
/** * Constructor */ function __construct($a_parent_obj, $a_parent_cmd, $a_exc, $a_ass_id) { global $ilCtrl, $lng; $this->exc = $a_exc; $this->exc_id = $this->exc->getId(); $this->setId("exc_mem_" . $a_ass_id); include_once "./Modules/Exercise/classes/class.ilFSStorageExercise.php"; $this->storage = new ilFSStorageExercise($this->exc_id, $a_ass_id); include_once "./Modules/Exercise/classes/class.ilExAssignment.php"; $this->ass_id = $a_ass_id; parent::__construct($a_parent_obj, $a_parent_cmd); $this->setTitle($lng->txt("exc_assignment") . ": " . ilExAssignment::lookupTitle($a_ass_id)); $this->setTopCommands(true); //$this->setLimit(9999); $this->type = ilExAssignment::lookupType($this->ass_id); $data = ilExAssignment::getMemberListData($this->exc_id, $this->ass_id); // team upload? (1 row == 1 team) if ($this->type == ilExAssignment::TYPE_UPLOAD_TEAM) { $ass_obj = new ilExAssignment($this->ass_id); $team_map = ilExAssignment::getAssignmentTeamMap($this->ass_id); $tmp = array(); foreach ($data as $item) { $team_id = $team_map[$item["usr_id"]]; if (!$team_id) { // #11058 // $team_id = $ass_obj->getTeamId($item["usr_id"], true); // #11957 $team_id = "nty" . $item["usr_id"]; } if (!isset($tmp[$team_id])) { $tmp[$team_id] = $item; } $tmp[$team_id]["team"][$item["usr_id"]] = $item["name"]; $tmp[$team_id]["team_id"] = $team_id; } $data = $tmp; unset($tmp); } else { // peer review / rating $ass_obj = new ilExAssignment($this->ass_id); $this->peer_review = $ass_obj->getPeerReview(); if ($this->peer_review) { include_once './Services/Rating/classes/class.ilRatingGUI.php'; } } $this->setData($data); $this->addColumn("", "", "1", true); if ($this->type != ilExAssignment::TYPE_UPLOAD_TEAM) { $this->selected = $this->getSelectedColumns(); if (in_array("image", $this->selected)) { $this->addColumn($this->lng->txt("image"), "", "1"); } $this->addColumn($this->lng->txt("name"), "name"); if (in_array("login", $this->selected)) { $this->addColumn($this->lng->txt("login"), "login"); } } else { $this->addColumn($this->lng->txt("exc_team")); } $this->sent_col = ilExAssignment::lookupAnyExerciseSent($this->exc->getId(), $this->ass_id); if ($this->sent_col) { $this->addColumn($this->lng->txt("exc_exercise_sent"), "sent_time"); } $this->addColumn($this->lng->txt("exc_submission"), "submission"); $this->addColumn($this->lng->txt("exc_grading"), "solved_time"); $this->addColumn($this->lng->txt("feedback"), "feedback_time"); $this->setDefaultOrderField("name"); $this->setDefaultOrderDirection("asc"); $this->setEnableHeader(true); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.exc_members_row.html", "Modules/Exercise"); //$this->disable("footer"); $this->setEnableTitle(true); $this->setSelectAllCheckbox("member"); $this->addMultiCommand("saveStatus", $lng->txt("exc_save_selected")); $this->addMultiCommand("redirectFeedbackMail", $lng->txt("exc_send_mail")); $this->addMultiCommand("sendMembers", $lng->txt("exc_send_assignment")); $this->addMultiCommand("confirmDeassignMembers", $lng->txt("exc_deassign_members")); $this->addCommandButton("saveStatusAll", $lng->txt("exc_save_all")); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php"; $this->overlay_tpl = new ilTemplate("tpl.exc_learner_comment_overlay.html", true, true, "Modules/Exercise"); }