/** * Save glossary form */ public function saveGlossary() { global $tpl, $lng, $ilCtrl, $rbacsystem, $tree; $parent_ref_id = $tree->getParentId((int) $_GET["ref_id"]); if (!$rbacsystem->checkAccess("create", $parent_ref_id, "glo")) { ilUtil::sendFailure($lng->txt("no_permission"), true); $ilCtrl->redirect($this, "properties"); } $this->initGlossaryCreationForm(); if ($this->form->checkInput()) { include_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; $newObj = new ilObjGlossary(); $newObj->setType("glo"); $newObj->setTitle($_POST["title"]); $newObj->setDescription($_POST["description"]); $newObj->setVirtualMode("none"); $newObj->create(); $newObj->createReference(); $newObj->putInTree($parent_ref_id); $newObj->setPermissions($parent_ref_id); $newObj->notify("new", $parent_ref_id, $_GET["parent_non_rbac_id"], $parent_ref_id, $newObj->getRefId()); // perform save $this->object->setAssignedGlossary($newObj->getId()); $this->object->update(); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); $ilCtrl->redirect($this, "properties"); } $this->form->setValuesByPost(); $tpl->setContent($this->form->getHtml()); }
function importGlossary($slm, $packageFolder) { global $ilias; // create and insert object in objecttree include_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; $newObj = new ilObjGlossary(); $newObj->setType('glo'); $newObj->setTitle(''); $newObj->create(true); $newObj->createReference(); $newObj->putInTree($_GET["ref_id"]); $newObj->setPermissions($_GET["ref_id"]); $newObj->notify("new", $_GET["ref_id"], $_GET["parent_non_rbac_id"], $_GET["ref_id"], $newObj->getRefId()); $xml_file = $packageFolder . "/glossary.xml"; // check whether xml file exists within zip file if (!is_file($xml_file)) { return; } include_once "./Modules/LearningModule/classes/class.ilContObjParser.php"; $contParser = new ilContObjParser($newObj, $xml_file, $packageFolder); $contParser->startParsing(); $newObj->update(); //ilObject::_writeImportId($newObj->getId(), $newObj->getImportId()); $slm->setAssignedGlossary($newObj->getId()); $slm->update(); }