protected function initAssignmentTextForm(ilExAssignment $a_ass, $a_read_only = false, $a_cancel_cmd = "showOverview", $a_peer_review_cmd = null, $a_peer_rating_html = null) { global $ilCtrl, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setTitle($this->lng->txt("exc_assignment") . " \"" . $a_ass->getTitle() . "\""); if (!$a_read_only) { $text = new ilTextAreaInputGUI($this->lng->txt("exc_your_text"), "atxt"); $text->setRequired((bool) $a_ass->getMandatory()); $text->setRows(40); $form->addItem($text); // custom rte tags $text->setUseRte(true); $text->setRTESupport($ilUser->getId(), "exca~", "exc_ass"); // see ilObjForumGUI $text->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext')); $form->setFormAction($ilCtrl->getFormAction($this, "updateAssignmentText")); $form->addCommandButton("updateAssignmentTextAndReturn", $this->lng->txt("save_return")); $form->addCommandButton("updateAssignmentText", $this->lng->txt("save")); } else { $text = new ilNonEditableValueGUI($this->lng->txt("exc_files_returned_text"), "atxt", true); $form->addItem($text); if (!$a_peer_review_cmd) { $form->setFormAction($ilCtrl->getFormAction($this, "showOverview")); } else { $rating = new ilCustomInputGUI($this->lng->txt("exc_peer_review_rating")); $rating->setHtml($a_peer_rating_html); $form->addItem($rating); $comm = new ilTextAreaInputGUI($this->lng->txt("exc_peer_review_comment"), "comm"); $comm->setCols(75); $comm->setRows(15); $form->addItem($comm); $form->setFormAction($ilCtrl->getFormAction($this, $a_peer_review_cmd)); $form->addCommandButton($a_peer_review_cmd, $this->lng->txt("save")); } } $form->addCommandButton($a_cancel_cmd, $this->lng->txt("cancel")); return $form; }
/** * 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; } $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 there are any submissions we cannot change type anymore if (sizeof(ilExAssignment::getAllDeliveredFiles($this->object->getId(), $ass->getId()))) { $this->form->getItemByPostVar("type")->setDisabled(true); } }