function getExerciseInfo($a_assignment_id, $a_add_submit = false) { include_once "Modules/Exercise/classes/class.ilExAssignment.php"; $ass = new ilExAssignment($a_assignment_id); $exercise_id = $ass->getExerciseId(); if (!$exercise_id) { return; } // is the assignment still open? $times_up = false; if ($ass->getDeadline() && $ass->getDeadline() - time() <= 0) { $times_up = true; } // exercise goto include_once "./Services/Link/classes/class.ilLink.php"; $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id)); $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc"); $info = sprintf($this->lng->txt("prtf_exercise_info"), $ass->getTitle(), "<a href=\"" . $exc_link . "\">" . ilObject::_lookupTitle($exercise_id) . "</a>"); // submit button if ($a_add_submit && !$times_up) { $this->ctrl->setParameter($this, "exc", $exercise_id); $this->ctrl->setParameter($this, "ass", $a_assignment_id); $submit_link = $this->ctrl->getLinkTarget($this, "finalize"); $this->ctrl->setParameter($this, "ass", ""); $this->ctrl->setParameter($this, "exc", ""); include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php"; $button = ilLinkButton::getInstance(); $button->setCaption("prtf_finalize_portfolio"); $button->setPrimary(true); $button->setUrl($submit_link); $info .= " " . $button->render(); } // submitted files $submitted = ilExAssignment::getDeliveredFiles($exercise_id, $a_assignment_id, $this->user_id, true); if ($submitted) { $submitted = array_pop($submitted); $this->ctrl->setParameter($this, "ass", $a_assignment_id); $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcSubFile"); $this->ctrl->setParameter($this, "ass", ""); $rel = ilDatePresentation::useRelativeDates(); ilDatePresentation::setUseRelativeDates(false); include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php"; $button = ilLinkButton::getInstance(); $button->setCaption("download"); $button->setUrl($dl_link); $info .= "<br />" . sprintf($this->lng->txt("prtf_exercise_submitted_info"), ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME)), $button->render()); ilDatePresentation::setUseRelativeDates($rel); } // work instructions incl. files $tooltip = ""; $ass = $ass->getInstruction(); if ($ass) { $tooltip .= nl2br($ass); } $ass_files = ilExAssignment::getFiles($exercise_id, $a_assignment_id); if (count($ass_files) > 0) { $tooltip .= "<br /><br />"; foreach ($ass_files as $file) { $this->ctrl->setParameter($this, "ass", $a_assignment_id); $this->ctrl->setParameter($this, "file", urlencode($file["name"])); $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcAssFile"); $this->ctrl->setParameter($this, "file", ""); $this->ctrl->setParameter($this, "ass", ""); $tooltip .= $file["name"] . ": <a href=\"" . $dl_link . "\">" . $this->lng->txt("download") . "</a>"; } } if ($tooltip) { $ol_id = "exc_ass_" . $a_assignment_id; include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php"; $overlay = new ilOverlayGUI($ol_id); // overlay $overlay->setAnchor($ol_id . "_tr"); $overlay->setTrigger($ol_id . "_tr", "click", $ol_id . "_tr"); $overlay->setAutoHide(false); // $overlay->setCloseElementId($cl_id); $overlay->add(); // trigger $overlay->addTrigger($ol_id . "_tr", "click", $ol_id . "_tr"); $info .= "<div id=\"" . $ol_id . "_tr\"><a href=\"#\">" . $this->lng->txt("exc_instruction") . "</a></div>" . "<div id=\"" . $ol_id . "\" style=\"display:none; background-color:white; border: 1px solid #bbb; padding: 10px;\">" . $tooltip . "</div>"; } return $info; }
function addToolbar($root_node) { global $lng, $ilToolbar, $tpl; $create_list_gui = ilCloudConnector::getItemCreationListGUIClass($this->getService()); $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders()); if ($list_gui_html) { // toolbar $ov_id = "il_add_new_cld_item_v"; $ov_trigger_id = $ov_id . "_tr"; $toolbar_locator = new ilLocatorGUI(); $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node)); $ilToolbar->setId('xcld_toolbar'); $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>"); $ilToolbar->addSeparator(); $ilToolbar->addButton($lng->txt("cld_add_new_item"), "#", "", "", "", $ov_trigger_id, 'submit emphsubmit'); include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php"; $ov = new ilOverlayGUI($ov_id); $ov->add(); $ov->addTrigger($ov_trigger_id, "click", $ov_trigger_id, false, "tl", "tr"); $tpl->setVariable("SELECT_OBJTYPE_REPOS", '<div id="' . $ov_id . '" class="ilOverlay ilNoDisplay">' . $list_gui_html . '</div>'); } }
/** * Add new item selection to current page incl. toolbar (trigger) and overlay */ public function render() { global $ilToolbar, $tpl, $lng; if ($this->mode == ilObjectDefinition::MODE_WORKSPACE) { if (!$this->parsePersonalWorkspace()) { return; } } else { if (!$this->parseRepository()) { return; } } $ov_id = "il_add_new_item_ov"; $ov_trigger_id = $ov_id . "_tr"; include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php"; $ov = new ilOverlayGUI($ov_id); // $ov->setAnchor($ov_trigger_id, "tl", "tr"); // $ov->setTrigger($ov_trigger_id, "click", $ov_trigger_id); $ov->add(); // trigger $ov->addTrigger($ov_trigger_id, "click", $ov_trigger_id, false, "tl", "tr"); // toolbar $ilToolbar->addButton($lng->txt("cntr_add_new_item"), "#", "", "", "", $ov_trigger_id, 'submit emphsubmit'); // css? $tpl->setVariable("SELECT_OBJTYPE_REPOS", '<div id="' . $ov_id . '" style="display:none;" class="ilOverlay">' . $this->getHTML() . '</div>'); }