/** * add definition */ function addDefinition() { global $ilCtrl; $term_id = (int) $_GET["term_id"]; include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id); if ($term_glo_id != $this->object->getId()) { ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true); $ilCtrl->redirect($this, "listTerms"); } // add term include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; $term = new ilGlossaryTerm($term_id); // add first definition $def = new ilGlossaryDefinition(); $def->setTermId($term->getId()); $def->setTitle(ilUtil::stripSlashes($term->getTerm())); $def->create(); $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId()); $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId()); $this->ctrl->redirectByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit"); }
/** * deletion confirmation screen */ function confirmDefinitionDeletion() { global $ilCtrl, $lng; //$this->getTemplate(); //$this->displayLocator(); //$this->setTabs(); $term = new ilGlossaryTerm($this->term_id); $add = ""; $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id); if ($nr > 0) { $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $this->term_id); $link = "[<a href='" . $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") . "'>" . $lng->txt("glo_list_usages") . "</a>]"; $add = "<br/>" . sprintf($lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link; } include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php"; $cgui = new ilConfirmationGUI(); $cgui->setHeaderText($this->lng->txt("info_delete_sure") . $add); $cgui->setFormAction($this->ctrl->getFormAction($this)); $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion"); $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition"); // content style $this->setContentStyleSheet($this->tpl); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); $definition = new ilGlossaryDefinition($_GET["def"]); $page_gui = new ilGlossaryDefPageGUI($definition->getId()); $page_gui->setTemplateOutput(false); $page_gui->setStyleId($this->object->getStyleSheetId()); $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&ref_id=" . $_GET["ref_id"]); $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&ref_id=" . $_GET["ref_id"]); $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&ref_id=" . $_GET["ref_id"]); $output = $page_gui->preview(); $cgui->addItem("def", $_GET["def"], $term->getTerm() . $output); $this->tpl->setContent($cgui->getHTML()); }