00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once("classes/class.ilObjectGUI.php");
00025
00026 require_once("content/classes/class.ilObjGlossary.php");
00027 require_once("content/classes/class.ilGlossaryTermGUI.php");
00028 require_once("content/classes/class.ilGlossaryDefinition.php");
00029 require_once("content/classes/class.ilTermDefinitionEditorGUI.php");
00030 require_once("content/classes/Pages/class.ilPCParagraph.php");
00031
00044 class ilObjGlossaryGUI extends ilObjectGUI
00045 {
00046 var $admin_tabs;
00047 var $mode;
00048 var $term;
00049
00054 function ilObjGlossaryGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
00055 {
00056 global $ilCtrl, $lng;
00057
00058 $this->ctrl =& $ilCtrl;
00059 $this->ctrl->saveParameter($this, array("ref_id", "offset"));
00060 $lng->loadLanguageModule("content");
00061
00062 $this->type = "glo";
00063 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, false);
00064 if (defined("ILIAS_MODULE"))
00065 {
00066 $this->setTabTargetScript("glossary_edit.php");
00067 }
00068 if ($a_prepare_output)
00069 {
00070 $this->prepareOutput();
00071 }
00072 }
00073
00077 function &executeCommand()
00078 {
00079 $cmd = $this->ctrl->getCmd();
00080 $next_class = $this->ctrl->getNextClass($this);
00081
00082 switch ($next_class)
00083 {
00084 case 'ilmdeditorgui':
00085 $this->getTemplate();
00086 $this->setTabs();
00087 $this->setLocator();
00088
00089 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
00090
00091 $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
00092 $md_gui->addObserver($this->object,'MDUpdateListener','General');
00093
00094 $this->ctrl->forwardCommand($md_gui);
00095 break;
00096
00097 case "ilglossarytermgui":
00098 $this->ctrl->setReturn($this, "listTerms");
00099 $term_gui =& new ilGlossaryTermGUI($_GET["term_id"]);
00100 $term_gui->setGlossary($this->object);
00101
00102 $ret =& $this->ctrl->forwardCommand($term_gui);
00103 break;
00104
00105 default:
00106 $cmd = $this->ctrl->getCmd("ListTerms");
00107
00108 if (($cmd == "create") && ($_POST["new_type"] == "term"))
00109 {
00110 $this->ctrl->setCmd("create");
00111 $this->ctrl->setCmdClass("ilGlossaryTermGUI");
00112 $ret =& $this->executeCommand();
00113 return;
00114 }
00115 else
00116 {
00117 $this->getTemplate();
00118 $this->setTabs();
00119 $this->setLocator();
00120 $ret =& $this->$cmd();
00121 }
00122 break;
00123 }
00124
00125 $this->tpl->show();
00126 }
00127
00128 function assignObject()
00129 {
00130 include_once("content/classes/class.ilObjGlossary.php");
00131
00132 $this->object =& new ilObjGlossary($this->id, true);
00133 }
00134
00135
00139 function createObject()
00140 {
00141 global $rbacsystem;
00142
00143 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
00144
00145 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
00146 {
00147 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00148 }
00149
00150 $stati = array(
00151 "none"=>$this->lng->txt("glo_mode_normal"),
00152 "level"=>$this->lng->txt("glo_mode_level"),
00153 "subtree"=>$this->lng->txt("glo_mode_subtree")
00154 );
00155
00156 $glo_type = $_SESSION["error_post_vars"]["glo_type"];
00157
00158 $opts = ilUtil::formSelect("none","glo_mode",$stati,false,true);
00159
00160
00161 $data = array();
00162 $data["fields"] = array();
00163 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
00164 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
00165
00166 $this->getTemplateFile("create", $new_type);
00167
00168 foreach ($data["fields"] as $key => $val)
00169 {
00170 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
00171 $this->tpl->setVariable(strtoupper($key), $val);
00172
00173 if ($this->prepare_output)
00174 {
00175 $this->tpl->parseCurrentBlock();
00176 }
00177 }
00178
00179 $this->tpl->setVariable("FORMACTION", $this->getFormAction("save","adm_object.php?cmd=gateway&ref_id=".
00180 $_GET["ref_id"]."&new_type=".$new_type));
00181 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
00182 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00183 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
00184 $this->tpl->setVariable("CMD_SUBMIT", "save");
00185 $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
00186 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00187
00188 $this->tpl->setVariable("SELECT_GLO_MODE", $opts);
00189 $this->tpl->setVariable("TXT_GLO_MODE", $this->lng->txt("glo_mode"));
00190 $this->tpl->setVariable("TXT_GLO_MODE_DESC", $this->lng->txt("glo_mode_desc"));
00191
00192 $this->tpl->setVariable("TXT_IMPORT_GLO", $this->lng->txt("import_glossary"));
00193 $this->tpl->setVariable("TXT_GLO_FILE", $this->lng->txt("glo_upload_file"));
00194 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
00195 }
00196
00197 function importObject()
00198 {
00199 $this->createObject();
00200 }
00201
00205 function saveObject()
00206 {
00207 global $rbacadmin, $rbacsystem;
00208
00209
00210
00211
00212 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"]))
00213 {
00214 $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
00215 }
00216
00217
00218 if (empty($_POST["Fobject"]["title"]))
00219 {
00220 $this->ilErr->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilErr->MESSAGE);
00221 }
00222
00223
00224 include_once("content/classes/class.ilObjGlossary.php");
00225 $newObj = new ilObjGlossary();
00226 $newObj->setType($this->type);
00227 $newObj->setTitle($_POST["Fobject"]["title"]);
00228 $newObj->setDescription($_POST["Fobject"]["desc"]);
00229 $newObj->setVirtualMode($_POST["glo_mode"]);
00230 $newObj->create();
00231 $newObj->createReference();
00232 $newObj->putInTree($_GET["ref_id"]);
00233 $newObj->setPermissions($_GET["ref_id"]);
00234 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
00235
00236
00237
00238
00239
00240
00241
00242 unset($newObj);
00243
00244
00245 sendInfo($this->lng->txt("glo_added"),true);
00246 ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
00247 }
00248
00255 function importFileObject()
00256 {
00257 global $_FILES, $rbacsystem;
00258
00259
00260 $source = $_FILES["xmldoc"]["tmp_name"];
00261 if (($source == 'none') || (!$source))
00262 {
00263 $this->ilias->raiseError($this->lng->txt("msg_no_file"),$this->ilias->error_obj->MESSAGE);
00264 }
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274 $info = pathinfo($_FILES["xmldoc"]["name"]);
00275 if (strtolower($info["extension"]) != "zip")
00276 {
00277 $this->ilias->raiseError($this->lng->txt("cont_no_zip_file"),
00278 $this->ilias->error_obj->MESSAGE);
00279 }
00280
00281
00282 include_once("content/classes/class.ilObjGlossary.php");
00283 $newObj = new ilObjGlossary();
00284 $newObj->setType($_GET["new_type"]);
00285 $newObj->setTitle($_FILES["xmldoc"]["name"]);
00286 $newObj->create(true);
00287 $newObj->createReference();
00288 $newObj->putInTree($_GET["ref_id"]);
00289 $newObj->setPermissions($_GET["ref_id"]);
00290 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
00291
00292
00293 $newObj->createImportDirectory();
00294
00295
00296 $file = pathinfo($_FILES["xmldoc"]["name"]);
00297 $full_path = $newObj->getImportDirectory()."/".$_FILES["xmldoc"]["name"];
00298
00299 ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"],
00300 $_FILES["xmldoc"]["name"], $full_path);
00301
00302
00303 ilUtil::unzip($full_path);
00304
00305
00306 $subdir = basename($file["basename"],".".$file["extension"]);
00307 $xml_file = $newObj->getImportDirectory()."/".$subdir."/".$subdir.".xml";
00308
00309
00310 if (!is_dir($newObj->getImportDirectory()."/".$subdir))
00311 {
00312 $this->ilias->raiseError(sprintf($this->lng->txt("cont_no_subdir_in_zip"), $subdir),
00313 $this->ilias->error_obj->MESSAGE);
00314 }
00315
00316
00317 if (!is_file($xml_file))
00318 {
00319 $this->ilias->raiseError(sprintf($this->lng->txt("cont_zip_file_invalid"), $subdir."/".$subdir.".xml"),
00320 $this->ilias->error_obj->MESSAGE);
00321 }
00322
00323 include_once ("content/classes/class.ilContObjParser.php");
00324 $contParser = new ilContObjParser($newObj, $xml_file, $subdir);
00325 $contParser->startParsing();
00326 ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
00327
00328
00329 ilUtil::delDir($newObj->getImportDirectory());
00330
00331 sendInfo($this->lng->txt("glo_added"),true);
00332 ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
00333 }
00334
00335
00336 function viewObject()
00337 {
00338 global $rbacsystem;
00339
00340 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00341 {
00342 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00343 }
00344
00345
00346 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00347
00348 if (!defined("ILIAS_MODULE"))
00349 {
00350 $this->tpl->setCurrentBlock("btn_cell");
00351 $this->tpl->setVariable("BTN_LINK","content/glossary_edit.php?cmd=listTerms&ref_id=".$this->object->getRefID());
00352 $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00353 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("edit"));
00354 $this->tpl->parseCurrentBlock();
00355 }
00356
00357 $this->tpl->setCurrentBlock("btn_cell");
00358 $this->tpl->setVariable("BTN_LINK","content/glossary_presentation.php?cmd=listTerms&ref_id=".$this->object->getRefID());
00359 $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00360 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
00361 $this->tpl->parseCurrentBlock();
00362
00363
00364 }
00365
00371 function properties()
00372 {
00373 global $rbacsystem, $tree, $tpl;
00374
00375
00376 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.glossary_properties.html", true);
00377 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00378 $this->tpl->setVariable("TXT_PROPERTIES", $this->lng->txt("cont_glo_properties"));
00379
00380
00381 $this->tpl->setVariable("TXT_ONLINE", $this->lng->txt("cont_online"));
00382 $this->tpl->setVariable("CBOX_ONLINE", "cobj_online");
00383 $this->tpl->setVariable("VAL_ONLINE", "y");
00384
00385 if ($this->object->getOnline())
00386 {
00387 $this->tpl->setVariable("CHK_ONLINE", "checked");
00388 }
00389
00390
00391 $stati = array(
00392 "none"=>$this->lng->txt("glo_mode_normal"),
00393 "level"=>$this->lng->txt("glo_mode_level"),
00394 "subtree"=>$this->lng->txt("glo_mode_subtree")
00395 );
00396
00397 $opts = ilUtil::formSelect($this->object->getVirtualMode(),"glo_mode",$stati,false,true);
00398
00399 $this->tpl->setVariable("SELECT_GLO_MODE", $opts);
00400 $this->tpl->setVariable("TXT_GLO_MODE", $this->lng->txt("glo_mode"));
00401 $this->tpl->setVariable("TXT_GLO_MODE_DESC", $this->lng->txt("glo_mode_desc"));
00402
00403
00404 $this->tpl->setVariable("TXT_GLO_MENU", $this->lng->txt("cont_glo_menu"));
00405 $this->tpl->setVariable("TXT_ACT_MENU", $this->lng->txt("cont_active"));
00406 $this->tpl->setVariable("CBOX_GLO_MENU", "glo_act_menu");
00407 $this->tpl->setVariable("VAL_GLO_MENU", "y");
00408
00409 if ($this->object->isActiveGlossaryMenu())
00410 {
00411 $this->tpl->setVariable("CHK_GLO_MENU", "checked");
00412 }
00413
00414
00415 $this->tpl->setVariable("TXT_DOWNLOADS", $this->lng->txt("cont_downloads"));
00416 $this->tpl->setVariable("TXT_DOWNLOADS_DESC", $this->lng->txt("cont_downloads_desc"));
00417 $this->tpl->setVariable("CBOX_DOWNLOADS", "glo_act_downloads");
00418 $this->tpl->setVariable("VAL_DOWNLOADS", "y");
00419 if ($this->object->isActiveDownloads())
00420 {
00421 $this->tpl->setVariable("CHK_DOWNLOADS", "checked");
00422 }
00423
00424
00425 $this->tpl->setCurrentBlock("commands");
00426 $this->tpl->setVariable("BTN_NAME", "saveProperties");
00427 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00428 $this->tpl->parseCurrentBlock();
00429
00430 }
00431
00435 function saveProperties()
00436 {
00437 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
00438 $this->object->setVirtualMode($_POST["glo_mode"]);
00439 $this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
00440 $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
00441 $this->object->update();
00442 sendInfo($this->lng->txt("msg_obj_modified"), true);
00443 $this->ctrl->redirect($this, "properties");
00444 }
00445
00446
00447
00451 function listTerms()
00452 {
00453 global $ilUser;
00454
00455
00456
00457
00458 $this->lng->loadLanguageModule("meta");
00459 include_once "./classes/class.ilTableGUI.php";
00460
00461
00462
00463 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00464
00465 $this->tpl->setCurrentBlock("btn_cell");
00466 $this->tpl->setVariable("BTN_LINK", "glossary_presentation.php?cmd=listTerms&ref_id=".$this->object->getRefID());
00467 $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00468 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
00469 $this->tpl->parseCurrentBlock();
00470
00471
00472 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.glossary_term_list.html", true);
00473 $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
00474 $this->tpl->setVariable("TXT_TERM", $this->lng->txt("cont_term"));
00475 $this->tpl->setVariable("TXT_ADD2", $this->lng->txt("add"));
00476 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
00477 $lang = ilMetaData::getLanguages();
00478
00479 if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
00480 {
00481 $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
00482 }
00483 else
00484 {
00485 $s_lang = $ilUser->getLanguage();
00486 }
00487
00488 $select_language = ilUtil::formSelect ($s_lang, "term_language",$lang,false,true);
00489 $this->tpl->setVariable("SELECT_LANGUAGE", $select_language);
00490
00491
00492
00493 $this->tpl->addBlockfile("TERM_TABLE", "term_table", "tpl.table.html");
00494
00495
00496 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_tbl_row.html", true);
00497
00498 $num = 0;
00499
00500 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00501
00502
00503 $tbl = new ilTableGUI();
00504
00505
00506 $tbl->setTitle($this->lng->txt("cont_terms"));
00507
00508
00509 $tbl->setHeaderNames(array("", $this->lng->txt("cont_term"),
00510 $this->lng->txt("language"), $this->lng->txt("cont_definitions")));
00511
00512 $cols = array("", "term", "language", "definitions", "id");
00513 $header_params = array("ref_id" => $this->ref_id, "cmd" => "listTerms");
00514 $tbl->setHeaderVars($cols, $header_params);
00515 $tbl->setColumnWidth(array("1%","24%","15%","60%"));
00516
00517
00518 $tbl->setOrderColumn($_GET["sort_by"]);
00519 $tbl->setOrderDirection($_GET["sort_order"]);
00520 $tbl->setLimit($_GET["limit"]);
00521 $tbl->setOffset($_GET["offset"]);
00522
00523 $term_list = $this->object->getTermList();
00524 $tbl->setMaxCount(count($term_list));
00525
00526
00527
00528
00529 $this->setActions(array("confirmTermDeletion" => "delete", "addDefinition" => "cont_add_definition"));
00530
00531
00532
00533 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00534
00535
00536
00537 $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]);
00538
00539
00540 $tbl->render();
00541
00542 if (count($term_list) > 0)
00543 {
00544 $this->tpl->setVariable("COLUMN_COUNTS", 4);
00545 $this->showActions(true);
00546
00547 $i=1;
00548 foreach($term_list as $key => $term)
00549 {
00550 $css_row = ilUtil::switchColor($i++,"tblrow1","tblrow2");
00551 $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
00552 for($j=0; $j<count($defs); $j++)
00553 {
00554 $def = $defs[$j];
00555
00556
00557 if ($j > 0)
00558 {
00559 $this->tpl->setCurrentBlock("move_up");
00560 $this->tpl->setVariable("TXT_UP", $this->lng->txt("up"));
00561 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00562 $this->ctrl->setParameter($this, "def", $def["id"]);
00563 $this->tpl->setVariable("LINK_UP",
00564 $this->ctrl->getLinkTarget($this, "moveDefinitionUp"));
00565 $this->tpl->parseCurrentBlock();
00566 }
00567
00568
00569 if ($j+1 < count($defs))
00570 {
00571 $this->tpl->setCurrentBlock("move_down");
00572 $this->tpl->setVariable("TXT_DOWN", $this->lng->txt("down"));
00573 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00574 $this->ctrl->setParameter($this, "def", $def["id"]);
00575 $this->tpl->setVariable("LINK_DOWN",
00576 $this->ctrl->getLinkTarget($this, "moveDefinitionDown"));
00577 $this->tpl->parseCurrentBlock();
00578 }
00579
00580
00581 $this->tpl->setCurrentBlock("delete");
00582 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00583 $this->ctrl->setParameter($this, "def", $def["id"]);
00584 $this->tpl->setVariable("LINK_DELETE",
00585 $this->ctrl->getLinkTarget($this, "confirmDefinitionDeletion"));
00586 $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("delete"));
00587 $this->tpl->parseCurrentBlock();
00588
00589
00590 $this->tpl->setCurrentBlock("edit");
00591 $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term["id"]);
00592 $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def["id"]);
00593 $this->tpl->setVariable("LINK_EDIT",
00594 $this->ctrl->getLinkTargetByClass(array("ilglossarytermgui",
00595 "iltermdefinitioneditorgui",
00596 "ilpageobjectgui"), "view"));
00597 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00598 $this->tpl->parseCurrentBlock();
00599
00600
00601 $this->tpl->setCurrentBlock("definition");
00602 $short_str = ilPCParagraph::xml2output($def["short_text"]);
00603
00604
00605 $this->tpl->setVariable("DEF_SHORT", $short_str);
00606 $this->tpl->parseCurrentBlock();
00607
00608 $this->tpl->setCurrentBlock("definition_row");
00609 $this->tpl->parseCurrentBlock();
00610 }
00611
00612 $this->tpl->setCurrentBlock("check_col");
00613 $this->tpl->setVariable("CHECKBOX_ID", $term["id"]);
00614 $this->tpl->setVariable("CSS_ROW", $css_row);
00615 $this->tpl->parseCurrentBlock();
00616
00617
00618 $this->tpl->setCurrentBlock("edit_term");
00619 $this->tpl->setVariable("TEXT_TERM", $term["term"]);
00620 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00621 $this->tpl->setVariable("LINK_EDIT_TERM",
00622 $this->ctrl->getLinkTarget($this, "editTerm"));
00623 $this->tpl->setVariable("TXT_EDIT_TERM", $this->lng->txt("edit"));
00624 $this->tpl->parseCurrentBlock();
00625
00626 $this->tpl->setCurrentBlock("tbl_content");
00627
00628
00629 $this->tpl->setVariable("CSS_ROW", $css_row);
00630 $this->tpl->setVariable("TEXT_LANGUAGE", $this->lng->txt("meta_l_".$term["language"]));
00631 $this->tpl->setCurrentBlock("tbl_content");
00632 $this->tpl->parseCurrentBlock();
00633 }
00634 }
00635 else
00636 {
00637 $this->tpl->setCurrentBlock("notfound");
00638 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00639 $this->tpl->setVariable("NUM_COLS", $num);
00640 $this->tpl->parseCurrentBlock();
00641 }
00642 }
00643
00647 function addTerm()
00648 {
00649
00650 include_once ("content/classes/class.ilGlossaryTerm.php");
00651 $term =& new ilGlossaryTerm();
00652 $term->setGlossary($this->object);
00653 $term->setTerm(ilUtil::stripSlashes($_POST["new_term"]));
00654 $term->setLanguage($_POST["term_language"]);
00655 $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["term_language"];
00656 $term->create();
00657
00658
00659 $def =& new ilGlossaryDefinition();
00660 $def->setTermId($term->getId());
00661 $def->setTitle(ilUtil::stripSlashes($_POST["new_term"]));
00662 $def->create();
00663
00664 $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term->getId());
00665 $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def->getId());
00666 $this->ctrl->redirectByClass(array("ilglossarytermgui",
00667 "iltermdefinitioneditorgui", "ilpageobjectgui"), "view");
00668 }
00669
00673 function moveDefinitionUp()
00674 {
00675 include_once("content/classes/class.ilGlossaryDefinition.php");
00676
00677 $definition =& new ilGlossaryDefinition($_GET["def"]);
00678 $definition->moveUp();
00679
00680 $this->ctrl->redirect($this, "listTerms");
00681 }
00682
00686 function moveDefinitionDown()
00687 {
00688 include_once("content/classes/class.ilGlossaryDefinition.php");
00689
00690 $definition =& new ilGlossaryDefinition($_GET["def"]);
00691 $definition->moveDown();
00692
00693 $this->ctrl->redirect($this, "listTerms");
00694 }
00695
00699 function confirmDefinitionDeletion()
00700 {
00701
00702
00703
00704
00705 $term = new ilGlossaryTerm($_GET["term_id"]);
00706
00707
00708 $this->tpl->setCurrentBlock("ContentStyle");
00709 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00710 ilObjStyleSheet::getContentStylePath(0));
00711 $this->tpl->parseCurrentBlock();
00712
00713
00714 $this->tpl->setCurrentBlock("SyntaxStyle");
00715 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00716 ilObjStyleSheet::getSyntaxStylePath());
00717 $this->tpl->parseCurrentBlock();
00718
00719
00720
00721
00722
00723 $this->tpl->addBlockfile("ADM_CONTENT", "def_list", "tpl.glossary_definition_delete.html", true);
00724 sendInfo($this->lng->txt("info_delete_sure"));
00725
00726 $this->tpl->setVariable("TXT_TERM", $term->getTerm());
00727
00728 $definition =& new ilGlossaryDefinition($_GET["def"]);
00729 $page =& new ilPageObject("gdf", $definition->getId());
00730 $page_gui =& new ilPageObjectGUI($page);
00731 $page_gui->setTemplateOutput(false);
00732 $page_gui->setSourcecodeDownloadScript("glossary_presentation.php?ref_id=".$_GET["ref_id"]);
00733 $output = $page_gui->preview();
00734
00735 $this->tpl->setCurrentBlock("definition");
00736 $this->tpl->setVariable("PAGE_CONTENT", $output);
00737 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00738 $this->tpl->setVariable("LINK_CANCEL",
00739 $this->ctrl->getLinkTarget($this, "cancelDefinitionDeletion"));
00740 $this->tpl->setVariable("TXT_CONFIRM", $this->lng->txt("confirm"));
00741 $this->ctrl->setParameter($this, "def", $definition->getId());
00742 $this->tpl->setVariable("LINK_CONFIRM",
00743 $this->ctrl->getLinkTarget($this, "deleteDefinition"));
00744 $this->tpl->parseCurrentBlock();
00745 }
00746
00747 function cancelDefinitionDeletion()
00748 {
00749 $this->ctrl->redirect($this, "listTerms");
00750 }
00751
00752
00753 function deleteDefinition()
00754 {
00755 $definition =& new ilGlossaryDefinition($_GET["def"]);
00756 $definition->delete();
00757 $this->ctrl->redirect($this, "listTerms");
00758 }
00759
00763 function editTerm()
00764 {
00765 $term = new ilGlossaryTerm($_GET["term_id"]);
00766
00767
00768
00769 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.glossary_term_edit.html", true);
00770 $this->ctrl->setParameter($this, "term_id", $_GET["term_id"]);
00771 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00772 $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_edit_term"));
00773 $this->tpl->setVariable("TXT_TERM", $this->lng->txt("cont_term"));
00774 $this->tpl->setVariable("INPUT_TERM", "term");
00775 $this->tpl->setVariable("VALUE_TERM", htmlspecialchars($term->getTerm()));
00776 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
00777 $lang = ilMetaData::getLanguages();
00778 $select_language = ilUtil::formSelect ($term->getLanguage(),"term_language",$lang,false,true);
00779 $this->tpl->setVariable("SELECT_LANGUAGE", $select_language);
00780 $this->tpl->setVariable("BTN_NAME", "updateTerm");
00781 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00782 }
00783
00784
00788 function updateTerm()
00789 {
00790 $term = new ilGlossaryTerm($_GET["term_id"]);
00791
00792 $term->setTerm(ilUtil::stripSlashes($_POST["term"]));
00793 $term->setLanguage($_POST["term_language"]);
00794 $term->update();
00795 sendinfo($this->lng->txt("msg_obj_modified"),true);
00796 $this->ctrl->redirect($this, "listTerms");
00797 }
00798
00799
00800
00801
00802
00803 function exportList()
00804 {
00805 global $tree;
00806
00807 $this->setTabs();
00808
00809
00810 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00811
00812
00813 $this->tpl->setCurrentBlock("btn_cell");
00814 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "export"));
00815 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_xml"));
00816 $this->tpl->parseCurrentBlock();
00817
00818
00819 $this->tpl->setCurrentBlock("btn_cell");
00820 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportHTML"));
00821 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_html"));
00822 $this->tpl->parseCurrentBlock();
00823
00824
00825 if (is_file($this->object->getExportDirectory()."/export.log"))
00826 {
00827 $this->tpl->setCurrentBlock("btn_cell");
00828 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "viewExportLog"));
00829 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_view_last_export_log"));
00830 $this->tpl->parseCurrentBlock();
00831 }
00832
00833
00834 $export_dir = $this->object->getExportDirectory();
00835
00836 $export_files = $this->object->getExportFiles();
00837
00838
00839 require_once("classes/class.ilTableGUI.php");
00840 $tbl = new ilTableGUI();
00841
00842
00843 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00844
00845
00846 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.glo_export_file_row.html", true);
00847
00848 $num = 0;
00849
00850 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00851
00852 $tbl->setTitle($this->lng->txt("cont_export_files"));
00853
00854 $tbl->setHeaderNames(array("", $this->lng->txt("type"),
00855 $this->lng->txt("cont_file"),
00856 $this->lng->txt("cont_size"), $this->lng->txt("date") ));
00857
00858 $cols = array("", "type", "file", "size", "date");
00859 $header_params = array("ref_id" => $_GET["ref_id"],
00860 "cmd" => "exportList", "cmdClass" => get_class($this));
00861 $tbl->setHeaderVars($cols, $header_params);
00862 $tbl->setColumnWidth(array("1%", "9%", "40%", "25%", "25%"));
00863 $tbl->disable("sort");
00864
00865
00866 $tbl->setOrderColumn($_GET["sort_by"]);
00867 $tbl->setOrderDirection($_GET["sort_order"]);
00868 $tbl->setLimit($_GET["limit"]);
00869 $tbl->setOffset($_GET["offset"]);
00870 $tbl->setMaxCount($this->maxcount);
00871
00872 $this->tpl->setVariable("COLUMN_COUNTS", 5);
00873
00874
00875 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00876 $this->tpl->setCurrentBlock("tbl_action_btn");
00877 $this->tpl->setVariable("BTN_NAME", "confirmDeleteExportFile");
00878 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
00879 $this->tpl->parseCurrentBlock();
00880
00881 $this->tpl->setCurrentBlock("tbl_action_btn");
00882 $this->tpl->setVariable("BTN_NAME", "downloadExportFile");
00883 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
00884 $this->tpl->parseCurrentBlock();
00885
00886
00887 $this->tpl->setCurrentBlock("tbl_action_btn");
00888 $this->tpl->setVariable("BTN_NAME", "publishExportFile");
00889 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_public_access"));
00890 $this->tpl->parseCurrentBlock();
00891
00892
00893 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00894
00895
00896 $tbl->setMaxCount(count($export_files));
00897 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
00898
00899 $tbl->render();
00900 if(count($export_files) > 0)
00901 {
00902 $i=0;
00903 foreach($export_files as $exp_file)
00904 {
00905 $this->tpl->setCurrentBlock("tbl_content");
00906 $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
00907
00908 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00909 $this->tpl->setVariable("CSS_ROW", $css_row);
00910
00911 $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
00912
00913 $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
00914 ? " <b>(".$this->lng->txt("public").")<b>"
00915 : "";
00916 $this->tpl->setVariable("TXT_TYPE", $exp_file["type"].$public_str);
00917 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"].":".$exp_file["file"]);
00918
00919 $file_arr = explode("__", $exp_file["file"]);
00920 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
00921
00922 $this->tpl->parseCurrentBlock();
00923 }
00924 }
00925 else
00926 {
00927 $this->tpl->setCurrentBlock("notfound");
00928 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00929 $this->tpl->setVariable("NUM_COLS", 3);
00930 $this->tpl->parseCurrentBlock();
00931 }
00932
00933 $this->tpl->parseCurrentBlock();
00934 }
00935
00936
00940 function export()
00941 {
00942 require_once("content/classes/class.ilGlossaryExport.php");
00943 $glo_exp = new ilGlossaryExport($this->object);
00944 $glo_exp->buildExportFile();
00945 $this->ctrl->redirect($this, "exportList");
00946 }
00947
00951 function exportHTML()
00952 {
00953 require_once("content/classes/class.ilGlossaryExport.php");
00954 $glo_exp = new ilGlossaryExport($this->object, "html");
00955 $glo_exp->buildExportFile();
00956
00957 $this->ctrl->redirect($this, "exportList");
00958 }
00959
00960
00964 function downloadExportFile()
00965 {
00966 if(!isset($_POST["file"]))
00967 {
00968 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00969 }
00970
00971 if (count($_POST["file"]) > 1)
00972 {
00973 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00974 }
00975
00976 $file = explode(":", $_POST["file"][0]);
00977 $export_dir = $this->object->getExportDirectory($file[0]);
00978 ilUtil::deliverFile($export_dir."/".$file[1],
00979 $file[1]);
00980 }
00981
00985 function publishExportFile()
00986 {
00987 if(!isset($_POST["file"]))
00988 {
00989 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
00990 }
00991 if (count($_POST["file"]) > 1)
00992 {
00993 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
00994 }
00995
00996 $file = explode(":", $_POST["file"][0]);
00997 $export_dir = $this->object->getExportDirectory($file[0]);
00998
00999 if ($this->object->getPublicExportFile($file[0]) ==
01000 $file[1])
01001 {
01002 $this->object->setPublicExportFile($file[0], "");
01003 }
01004 else
01005 {
01006 $this->object->setPublicExportFile($file[0], $file[1]);
01007 }
01008 $this->object->update();
01009 $this->ctrl->redirect($this, "exportList");
01010 }
01011
01012
01013
01014
01015 function viewExportLog()
01016 {
01017 global $tree;
01018
01019 $this->setTabs();
01020
01021
01022 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
01023
01024
01025 $this->tpl->setCurrentBlock("btn_cell");
01026 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportList"));
01027 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_export_files"));
01028 $this->tpl->parseCurrentBlock();
01029
01030
01031 $this->tpl->setVariable("ADM_CONTENT",
01032 nl2br(file_get_contents($this->object->getExportDirectory()."/export.log")));
01033
01034 $this->tpl->parseCurrentBlock();
01035 }
01036
01040 function confirmDeleteExportFile()
01041 {
01042 if(!isset($_POST["file"]))
01043 {
01044 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01045 }
01046
01047 $this->setTabs();
01048
01049
01050 $_SESSION["ilExportFiles"] = $_POST["file"];
01051
01052 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
01053
01054 sendInfo($this->lng->txt("info_delete_sure"));
01055
01056 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01057
01058
01059 $this->tpl->setCurrentBlock("table_header");
01060 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
01061 $this->tpl->parseCurrentBlock();
01062
01063
01064 $counter = 0;
01065 foreach($_POST["file"] as $file)
01066 {
01067 $file = explode(":", $file);
01068 $this->tpl->setCurrentBlock("table_row");
01069 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
01070 $this->tpl->setVariable("TEXT_CONTENT", $file[1]." (".$file[0].")");
01071 $this->tpl->parseCurrentBlock();
01072 }
01073
01074
01075 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
01076 $buttons = array( "cancelDeleteExportFile" => $this->lng->txt("cancel"),
01077 "deleteExportFile" => $this->lng->txt("confirm"));
01078 foreach ($buttons as $name => $value)
01079 {
01080 $this->tpl->setCurrentBlock("operation_btn");
01081 $this->tpl->setVariable("BTN_NAME",$name);
01082 $this->tpl->setVariable("BTN_VALUE",$value);
01083 $this->tpl->parseCurrentBlock();
01084 }
01085 }
01086
01090 function cancelDeleteExportFile()
01091 {
01092 session_unregister("ilExportFiles");
01093 $this->ctrl->redirect($this, "exportList");
01094 }
01095
01099 function deleteExportFile()
01100 {
01101 foreach($_SESSION["ilExportFiles"] as $file)
01102 {
01103 $file = explode(":", $file);
01104 $export_dir = $this->object->getExportDirectory($file[0]);
01105
01106 $exp_file = $export_dir."/".$file[1];
01107 $exp_dir = $export_dir."/".substr($file, 0, strlen($file) - 4);
01108 if (@is_file($exp_file))
01109 {
01110 unlink($exp_file);
01111 }
01112 if (@is_dir($exp_dir))
01113 {
01114 ilUtil::delDir($exp_dir);
01115 }
01116 }
01117 $this->ctrl->redirect($this, "exportList");
01118 }
01119
01123 function confirmTermDeletion()
01124 {
01125
01126 if (!isset($_POST["id"]))
01127 {
01128 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01129 }
01130
01131
01132 $_SESSION["term_delete"] = $_POST["id"];
01133
01134 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.obj_confirm.html");
01135
01136 sendInfo($this->lng->txt("info_delete_sure"));
01137 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01138
01139
01140 $cols = array("cont_term");
01141 foreach ($cols as $key)
01142 {
01143 $this->tpl->setCurrentBlock("table_header");
01144 $this->tpl->setVariable("TEXT",$this->lng->txt($key));
01145 $this->tpl->parseCurrentBlock();
01146 }
01147
01148 foreach($_POST["id"] as $id)
01149 {
01150 $term = new ilGlossaryTerm($id);
01151
01152
01153 $this->tpl->setCurrentBlock("table_cell");
01154 $this->tpl->setVariable("TEXT_CONTENT", $term->getTerm());
01155 $this->tpl->parseCurrentBlock();
01156
01157
01158 $this->tpl->setCurrentBlock("table_row");
01159 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
01160 $this->tpl->parseCurrentBlock();
01161 }
01162
01163
01164 $buttons = array( "cancelTermDeletion" => $this->lng->txt("cancel"),
01165 "deleteTerms" => $this->lng->txt("confirm"));
01166 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
01167 foreach($buttons as $name => $value)
01168 {
01169 $this->tpl->setCurrentBlock("operation_btn");
01170 $this->tpl->setVariable("BTN_NAME",$name);
01171 $this->tpl->setVariable("BTN_VALUE",$value);
01172 $this->tpl->parseCurrentBlock();
01173 }
01174
01175 }
01176
01182 function cancelTermDeletion()
01183 {
01184 session_unregister("term_delete");
01185 sendInfo($this->lng->txt("msg_cancel"),true);
01186 $this->ctrl->redirect($this, "listTerms");
01187 }
01188
01192 function deleteTerms()
01193 {
01194 foreach($_SESSION["term_delete"] as $id)
01195 {
01196 $term = new ilGlossaryTerm($id);
01197 $term->delete();
01198 }
01199 session_unregister("term_delete");
01200 $this->ctrl->redirect($this, "listTerms");
01201 }
01202
01210 function setLocator($a_tree = "", $a_id = "")
01211 {
01212 global $ilias_locator;
01213
01214 if(!defined("ILIAS_MODULE"))
01215 {
01216 parent::setLocator($a_tree, $a_id);
01217 }
01218 else
01219 {
01220 if(is_object($this->object))
01221 {
01222 require_once("content/classes/class.ilGlossaryLocatorGUI.php");
01223 $gloss_loc =& new ilGlossaryLocatorGUI();
01224 if (is_object($this->term))
01225 {
01226 $gloss_loc->setTerm($this->term);
01227 }
01228 $gloss_loc->setGlossary($this->object);
01229
01230 $gloss_loc->display();
01231 return;
01232
01233
01234
01235
01236 $i = 1;
01237
01238 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
01239
01240 if (!empty($_GET["term_id"]))
01241 {
01242 $this->tpl->touchBlock("locator_separator");
01243 }
01244
01245 $this->tpl->setCurrentBlock("locator_item");
01246 $this->tpl->setVariable("ITEM", $this->object->getTitle());
01247
01248 $this->tpl->setVariable("LINK_ITEM", "glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
01249 $this->tpl->parseCurrentBlock();
01250
01251
01252
01253 $ilias_locator->navigate($i++,$this->object->getTitle(),"glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms","bottom");
01254
01255 if (!empty($_GET["term_id"]))
01256 {
01257 $term =& new ilGlossaryTerm($_GET["term_id"]);
01258 $this->tpl->setCurrentBlock("locator_item");
01259 $this->tpl->setVariable("ITEM", $term->getTerm());
01260 $this->tpl->setVariable("LINK_ITEM", "glossary_edit.php?ref_id=".$_GET["ref_id"].
01261 "&cmd=listDefinitions&term_id=".$term->getId());
01262 $this->tpl->parseCurrentBlock();
01263
01264
01265
01266 $ilias_locator->navigate($i++,$term->getTerm(),"glossary_edit.php?ref_id=".$_GET["ref_id"].
01267 "&cmd=listDefinitions&term_id=".$term->getId(),"bottom");
01268 }
01269
01270
01271
01272 $this->tpl->setCurrentBlock("locator");
01273 $this->tpl->setVariable("TXT_LOCATOR",$debug.$this->lng->txt("locator"));
01274 $this->tpl->parseCurrentBlock();
01275 }
01276 }
01277
01278 }
01279
01283 function perm()
01284 {
01285
01286 $this->setFormAction("addRole", "glossary_edit.php?ref_id=".$this->object->getRefId()."&cmd=addRole");
01287 $this->setFormAction("permSave", "glossary_edit.php?ref_id=".$this->object->getRefId()."&cmd=permSave");
01288 $this->permObject();
01289 }
01290
01294 function permSave()
01295 {
01296 $this->setReturnLocation("permSave", "glossary_edit.php?ref_id=".$this->object->getRefId()."&cmd=perm");
01297 $this->permSaveObject();
01298 }
01299
01303 function info()
01304 {
01305 $this->infoObject();
01306 }
01307
01311 function addRole()
01312 {
01313 $this->setReturnLocation("addRole", "glossary_edit.php?ref_id=".$this->object->getRefId()."&cmd=perm");
01314 $this->addRoleObject();
01315 }
01316
01320 function owner()
01321 {
01322
01323 $this->ownerObject();
01324 }
01325
01329 function view()
01330 {
01331
01332 $this->viewObject();
01333 }
01334
01338 function create()
01339 {
01340 switch($_POST["new_type"])
01341 {
01342 case "term":
01343 $term_gui =& new ilGlossaryTermGUI();
01344 $term_gui->create();
01345 break;
01346 }
01347 }
01348
01349 function saveTerm()
01350 {
01351 $term_gui =& new ilGlossaryTermGUI();
01352 $term_gui->setGlossary($this->object);
01353 $term_gui->save();
01354
01355 sendinfo($this->lng->txt("cont_added_term"),true);
01356
01357 ilUtil::redirect("glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
01358 }
01359
01360
01364 function addDefinition()
01365 {
01366 if (count($_POST["id"]) < 1)
01367 {
01368 $this->ilias->raiseError($this->lng->txt("cont_select_term"),$this->ilias->error_obj->MESSAGE);
01369 }
01370
01371 if (count($_POST["id"]) > 1)
01372 {
01373 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_term"),$this->ilias->error_obj->MESSAGE);
01374 }
01375
01376
01377 include_once ("content/classes/class.ilGlossaryTerm.php");
01378 $term =& new ilGlossaryTerm($_POST["id"][0]);
01379
01380
01381 $def =& new ilGlossaryDefinition();
01382 $def->setTermId($term->getId());
01383 $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
01384 $def->create();
01385
01386 $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term->getId());
01387 $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def->getId());
01388 $this->ctrl->redirectByClass(array("ilglossarytermgui",
01389 "iltermdefinitioneditorgui", "ilpageobjectgui"), "view");
01390
01391 }
01392
01393 function getTemplate()
01394 {
01395 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
01396 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
01397
01398 $title = $this->object->getTitle();
01399
01400
01401 sendInfo();
01402
01403 $this->tpl->setVariable("HEADER", $this->lng->txt("glo").": ".$title);
01404
01405
01406
01407
01408 }
01409
01413 function setTabs()
01414 {
01415
01416
01417 include_once("classes/class.ilTabsGUI.php");
01418 $tabs_gui =& new ilTabsGUI();
01419 $this->getTabs($tabs_gui);
01420
01421 $this->tpl->setVariable("TABS", $tabs_gui->getHTML());
01422
01423 }
01424
01428 function getTabs(&$tabs_gui)
01429 {
01430 global $rbacsystem;
01431
01432
01433 $tabs_gui->addTarget("cont_terms",
01434 $this->ctrl->getLinkTarget($this, "listTerms"), "listTerms",
01435 get_class($this));
01436
01437
01438 $tabs_gui->addTarget("properties",
01439 $this->ctrl->getLinkTarget($this, "properties"), "properties",
01440 get_class($this));
01441
01442
01443 $tabs_gui->addTarget("meta_data",
01444 $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
01445 "meta_data", get_class($this));
01446
01447
01448 $tabs_gui->addTarget("export",
01449 $this->ctrl->getLinkTarget($this, "exportList"),
01450 "exportList", get_class($this));
01451
01452
01453 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
01454 {
01455 $tabs_gui->addTarget("permission_settings",
01456 $this->ctrl->getLinkTarget($this, "perm"), "perm",
01457 get_class($this));
01458 }
01459
01460 }
01461
01462 }
01463
01464 ?>