Exemplo n.º 1
0
 /**
  * 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");
 }