/**
  * 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());
 }
Пример #2
0
 /**
  * save new content object to db
  */
 function saveObject()
 {
     global $tpl;
     $new_type = $_REQUEST["new_type"];
     // create permission is already checked in createObject. This check here is done to prevent hacking attempts
     if (!$this->checkPermissionBool("create", "", $new_type)) {
         $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
     }
     $this->lng->loadLanguageModule($new_type);
     $this->ctrl->setParameter($this, "new_type", $new_type);
     $form = $this->initCreateForm($new_type);
     if ($form->checkInput()) {
         $this->ctrl->setParameter($this, "new_type", "");
         include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
         $newObj = new ilObjGlossary();
         $newObj->setType($new_type);
         $newObj->setTitle($form->getInput("title"));
         $newObj->setDescription($form->getInput("desc"));
         $newObj->setVirtualMode($form->getInput("glo_mode"));
         $newObj->create();
         $this->putObjectInTree($newObj);
         // always send a message
         ilUtil::sendSuccess($this->lng->txt("glo_added"), true);
         ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=" . $newObj->getRefId());
     }
     // display only this form to correct input
     $form->setValuesByPost();
     $tpl->setContent($form->getHtml());
 }