/** * Update assignment * */ public function updateAssignment() { global $tpl, $lng, $ilCtrl, $ilTabs; $ilTabs->activateTab("overview"); $this->addOverviewSubTabs("list_assignments"); $this->initAssignmentForm("edit"); if ($this->form->checkInput()) { include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php"; // additional checks if ($_POST["start_time_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)) { ilUtil::sendFailure($lng->txt("form_input_not_valid"), true); $this->form->getItemByPostVar("start_time")->setAlert($lng->txt("rep_robj_xeph_start_date_should_be_before_end_date")); $this->form->getItemByPostVar("deadline")->setAlert($lng->txt("rep_robj_xeph_start_date_should_be_before_end_date")); $this->form->setValuesByPost(); $tpl->setContent($this->form->getHtml()); return; } } $ass = new ilEphAssignment($_GET["ass_id"]); $ass->setTitle($_POST["title"]); $ass->setInstruction($_POST["instruction"]); $ass->setEphorusId($this->object->getId()); $ass->setMandatory($_POST["mandatory"]); if ($_POST["start_time_cb"]) { $date = $this->form->getItemByPostVar("start_time")->getDate(); $ass->setStartTime($date->get(IL_CAL_UNIX)); } else { $ass->setStartTime(null); } // deadline $date = $this->form->getItemByPostVar("deadline")->getDate(); $ass->setDeadline($date->get(IL_CAL_UNIX)); $ass->update($this->object); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); $ilCtrl->redirect($this, "listAssignments"); } else { $this->form->setValuesByPost(); $tpl->setContent($this->form->getHtml()); } }