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
00045 class ilObjGlossaryGUI extends ilObjectGUI
00046 {
00047 var $admin_tabs;
00048 var $mode;
00049 var $term;
00050
00055 function ilObjGlossaryGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
00056 {
00057 global $ilCtrl, $lng;
00058
00059 $this->ctrl =& $ilCtrl;
00060 $this->ctrl->saveParameter($this, array("ref_id", "offset"));
00061 $lng->loadLanguageModule("content");
00062
00063 $this->type = "glo";
00064 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, false);
00065
00066
00067
00068
00069 }
00070
00074 function &executeCommand()
00075 {
00076 global $lng, $ilAccess;
00077
00078 $cmd = $this->ctrl->getCmd();
00079 $next_class = $this->ctrl->getNextClass($this);
00080
00081 switch ($next_class)
00082 {
00083 case 'ilmdeditorgui':
00084 $this->getTemplate();
00085 $this->setTabs();
00086 $this->setLocator();
00087
00088 include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
00089
00090 $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
00091 $md_gui->addObserver($this->object,'MDUpdateListener','General');
00092
00093 $this->ctrl->forwardCommand($md_gui);
00094 break;
00095
00096 case "ilglossarytermgui":
00097 $this->ctrl->setReturn($this, "listTerms");
00098 $term_gui =& new ilGlossaryTermGUI($_GET["term_id"]);
00099 $term_gui->setGlossary($this->object);
00100
00101 $ret =& $this->ctrl->forwardCommand($term_gui);
00102 break;
00103
00104 case 'ilpermissiongui':
00105 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
00106 {
00107 $this->prepareOutput();
00108 }
00109 else
00110 {
00111 $this->getTemplate();
00112 $this->setTabs();
00113 $this->setLocator();
00114 }
00115 include_once("./classes/class.ilPermissionGUI.php");
00116 $perm_gui =& new ilPermissionGUI($this);
00117 $ret =& $this->ctrl->forwardCommand($perm_gui);
00118 break;
00119
00120 default:
00121 $cmd = $this->ctrl->getCmd("frameset");
00122
00123 if (($cmd == "create") && ($_POST["new_type"] == "term"))
00124 {
00125 $this->ctrl->setCmd("create");
00126 $this->ctrl->setCmdClass("ilGlossaryTermGUI");
00127 $ret =& $this->executeCommand();
00128 return;
00129 }
00130 else
00131 {
00132 if (!in_array($cmd, array("frameset", "quickList")))
00133 {
00134 if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
00135 $this->getCreationMode() == true)
00136 {
00137 $this->prepareOutput();
00138 $cmd.= "Object";
00139 }
00140 else
00141 {
00142 $this->getTemplate();
00143 $this->setTabs();
00144 $this->setLocator();
00145 }
00146 }
00147 $ret =& $this->$cmd();
00148 }
00149 break;
00150 }
00151
00152 if (!in_array($cmd, array("frameset", "quickList")))
00153 {
00154 if (strtolower($_GET["baseClass"]) != "iladministrationgui")
00155 {
00156 if (!$this->getCreationMode())
00157 {
00158 $this->tpl->show();
00159 }
00160 }
00161 }
00162 else
00163 {
00164 $this->tpl->show(false);
00165 }
00166 }
00167
00168 function assignObject()
00169 {
00170 include_once("content/classes/class.ilObjGlossary.php");
00171
00172 $this->object =& new ilObjGlossary($this->id, true);
00173 }
00174
00175
00179 function createObject()
00180 {
00181 global $rbacsystem;
00182
00183 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
00184
00185 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
00186 {
00187 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00188 }
00189
00190 $stati = array(
00191 "none"=>$this->lng->txt("glo_mode_normal"),
00192 "level"=>$this->lng->txt("glo_mode_level"),
00193 "subtree"=>$this->lng->txt("glo_mode_subtree")
00194 );
00195
00196 $glo_type = $_SESSION["error_post_vars"]["glo_type"];
00197
00198 $opts = ilUtil::formSelect("none","glo_mode",$stati,false,true);
00199
00200
00201 $data = array();
00202 $data["fields"] = array();
00203 $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
00204 $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
00205
00206 $this->getTemplateFile("create", $new_type);
00207
00208 foreach ($data["fields"] as $key => $val)
00209 {
00210 $this->tpl->setVariable("TXT_".strtoupper($key), $this->lng->txt($key));
00211 $this->tpl->setVariable(strtoupper($key), $val);
00212
00213 if ($this->prepare_output)
00214 {
00215 $this->tpl->parseCurrentBlock();
00216 }
00217 }
00218
00219 $this->ctrl->setParameter($this, "new_type", $new_type);
00220 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00221
00222
00223
00224 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
00225 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00226 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
00227 $this->tpl->setVariable("CMD_SUBMIT", "save");
00228 $this->tpl->setVariable("TARGET", ' target="'.
00229 ilFrameTargetInfo::_getFrame("MainContent").'" ');
00230 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00231
00232 $this->tpl->setVariable("SELECT_GLO_MODE", $opts);
00233 $this->tpl->setVariable("TXT_GLO_MODE", $this->lng->txt("glo_mode"));
00234 $this->tpl->setVariable("TXT_GLO_MODE_DESC", $this->lng->txt("glo_mode_desc"));
00235
00236 $this->tpl->setVariable("TXT_IMPORT_GLO", $this->lng->txt("import_glossary"));
00237 $this->tpl->setVariable("TXT_GLO_FILE", $this->lng->txt("glo_upload_file"));
00238 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
00239 }
00240
00241 function importObject()
00242 {
00243 $this->createObject();
00244 }
00245
00249 function saveObject()
00250 {
00251 global $rbacadmin, $rbacsystem;
00252
00253
00254
00255
00256 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"]))
00257 {
00258 $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
00259 }
00260
00261
00262 if (empty($_POST["Fobject"]["title"]))
00263 {
00264 $this->ilErr->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilErr->MESSAGE);
00265 }
00266
00267
00268 include_once("content/classes/class.ilObjGlossary.php");
00269 $newObj = new ilObjGlossary();
00270 $newObj->setType($this->type);
00271 $newObj->setTitle($_POST["Fobject"]["title"]);
00272 $newObj->setDescription($_POST["Fobject"]["desc"]);
00273 $newObj->setVirtualMode($_POST["glo_mode"]);
00274 $newObj->create();
00275 $newObj->createReference();
00276 $newObj->putInTree($_GET["ref_id"]);
00277 $newObj->setPermissions($_GET["ref_id"]);
00278 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
00279
00280
00281 sendInfo($this->lng->txt("glo_added"),true);
00282 ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
00283
00284
00285 }
00286
00293 function importFileObject()
00294 {
00295 global $_FILES, $rbacsystem;
00296
00297
00298 $source = $_FILES["xmldoc"]["tmp_name"];
00299 if (($source == 'none') || (!$source))
00300 {
00301 $this->ilias->raiseError($this->lng->txt("msg_no_file"),$this->ilias->error_obj->MESSAGE);
00302 }
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312 $info = pathinfo($_FILES["xmldoc"]["name"]);
00313 if (strtolower($info["extension"]) != "zip")
00314 {
00315 $this->ilias->raiseError($this->lng->txt("cont_no_zip_file"),
00316 $this->ilias->error_obj->MESSAGE);
00317 }
00318
00319
00320 include_once("content/classes/class.ilObjGlossary.php");
00321 $newObj = new ilObjGlossary();
00322 $newObj->setType($_GET["new_type"]);
00323 $newObj->setTitle($_FILES["xmldoc"]["name"]);
00324 $newObj->create(true);
00325 $newObj->createReference();
00326 $newObj->putInTree($_GET["ref_id"]);
00327 $newObj->setPermissions($_GET["ref_id"]);
00328 $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
00329
00330
00331 $newObj->createImportDirectory();
00332
00333
00334 $file = pathinfo($_FILES["xmldoc"]["name"]);
00335 $full_path = $newObj->getImportDirectory()."/".$_FILES["xmldoc"]["name"];
00336
00337 ilUtil::moveUploadedFile($_FILES["xmldoc"]["tmp_name"],
00338 $_FILES["xmldoc"]["name"], $full_path);
00339
00340
00341 ilUtil::unzip($full_path);
00342
00343
00344 $subdir = basename($file["basename"],".".$file["extension"]);
00345 $xml_file = $newObj->getImportDirectory()."/".$subdir."/".$subdir.".xml";
00346
00347
00348 if (!is_dir($newObj->getImportDirectory()."/".$subdir))
00349 {
00350 $this->ilias->raiseError(sprintf($this->lng->txt("cont_no_subdir_in_zip"), $subdir),
00351 $this->ilias->error_obj->MESSAGE);
00352 }
00353
00354
00355 if (!is_file($xml_file))
00356 {
00357 $this->ilias->raiseError(sprintf($this->lng->txt("cont_zip_file_invalid"), $subdir."/".$subdir.".xml"),
00358 $this->ilias->error_obj->MESSAGE);
00359 }
00360
00361 include_once ("content/classes/class.ilContObjParser.php");
00362 $contParser = new ilContObjParser($newObj, $xml_file, $subdir);
00363 $contParser->startParsing();
00364 ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
00365
00366
00367 ilUtil::delDir($newObj->getImportDirectory());
00368
00369 sendInfo($this->lng->txt("glo_added"),true);
00370 ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
00371
00372 }
00373
00374
00375 function viewObject()
00376 {
00377 global $rbacsystem;
00378
00379 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
00380 {
00381 parent::viewObject();
00382 return;
00383 }
00384
00385 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00386 {
00387 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00388 }
00389
00390
00391 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00392
00393 $this->tpl->setCurrentBlock("btn_cell");
00394 $this->tpl->setVariable("BTN_LINK",
00395 "content/glossary_presentation.php?cmd=listTerms&ref_id=".$this->object->getRefID());
00396 $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00397 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
00398 $this->tpl->parseCurrentBlock();
00399
00400
00401 }
00402
00408 function properties()
00409 {
00410 global $rbacsystem, $tree, $tpl;
00411
00412
00413 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.glossary_properties.html", true);
00414 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00415 $this->tpl->setVariable("TXT_PROPERTIES", $this->lng->txt("cont_glo_properties"));
00416
00417
00418 $this->tpl->setVariable("TXT_ONLINE", $this->lng->txt("cont_online"));
00419 $this->tpl->setVariable("CBOX_ONLINE", "cobj_online");
00420 $this->tpl->setVariable("VAL_ONLINE", "y");
00421
00422 if ($this->object->getOnline())
00423 {
00424 $this->tpl->setVariable("CHK_ONLINE", "checked");
00425 }
00426
00427
00428 $stati = array(
00429 "none"=>$this->lng->txt("glo_mode_normal"),
00430 "level"=>$this->lng->txt("glo_mode_level"),
00431 "subtree"=>$this->lng->txt("glo_mode_subtree")
00432 );
00433
00434 $opts = ilUtil::formSelect($this->object->getVirtualMode(),"glo_mode",$stati,false,true);
00435
00436 $this->tpl->setVariable("SELECT_GLO_MODE", $opts);
00437 $this->tpl->setVariable("TXT_GLO_MODE", $this->lng->txt("glo_mode"));
00438 $this->tpl->setVariable("TXT_GLO_MODE_DESC", $this->lng->txt("glo_mode_desc"));
00439
00440
00441 $this->tpl->setVariable("TXT_GLO_MENU", $this->lng->txt("cont_glo_menu"));
00442 $this->tpl->setVariable("TXT_ACT_MENU", $this->lng->txt("cont_active"));
00443 $this->tpl->setVariable("CBOX_GLO_MENU", "glo_act_menu");
00444 $this->tpl->setVariable("VAL_GLO_MENU", "y");
00445
00446 if ($this->object->isActiveGlossaryMenu())
00447 {
00448 $this->tpl->setVariable("CHK_GLO_MENU", "checked");
00449 }
00450
00451
00452 $this->tpl->setVariable("TXT_DOWNLOADS", $this->lng->txt("cont_downloads"));
00453 $this->tpl->setVariable("TXT_DOWNLOADS_DESC", $this->lng->txt("cont_downloads_desc"));
00454 $this->tpl->setVariable("CBOX_DOWNLOADS", "glo_act_downloads");
00455 $this->tpl->setVariable("VAL_DOWNLOADS", "y");
00456 if ($this->object->isActiveDownloads())
00457 {
00458 $this->tpl->setVariable("CHK_DOWNLOADS", "checked");
00459 }
00460
00461
00462 $this->tpl->setCurrentBlock("commands");
00463 $this->tpl->setVariable("BTN_NAME", "saveProperties");
00464 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00465 $this->tpl->parseCurrentBlock();
00466
00467 }
00468
00472 function saveProperties()
00473 {
00474 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
00475 $this->object->setVirtualMode($_POST["glo_mode"]);
00476 $this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
00477 $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
00478 $this->object->update();
00479 sendInfo($this->lng->txt("msg_obj_modified"), true);
00480 $this->ctrl->redirect($this, "properties");
00481 }
00482
00486 function frameset()
00487 {
00488 $this->tpl = new ilTemplate("tpl.glossary_frameset.html", true, true, "content");
00489 $this->tpl->setVariable("HREF_EDITOR", $this->ctrl->getLinkTarget($this, "listTerms"));
00490 $this->tpl->setVariable("HREF_EXPLORER", $this->ctrl->getLinkTarget($this, "quickList"));
00491 }
00492
00496 function quickList()
00497 {
00498 global $ilUser;
00499
00500 $this->tpl->addBlockFile("CONTENT", "content", "tpl.glossary_short_list.html", "content");
00501
00502
00503 $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
00504 $this->tpl->setVariable("CMD_REFR", "quickList");
00505 $this->tpl->setVariable("TXT_REFR", $this->lng->txt("refresh"));
00506
00507 include_once "./classes/class.ilTableGUI.php";
00508
00509
00510
00511
00512 $this->tpl->addBlockfile("SHORT_LIST", "list", "tpl.table.html");
00513
00514
00515 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_short_tbl_row.html", true);
00516
00517 $num = 0;
00518
00519 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00520
00521 $tbl = new ilTableGUI();
00522
00523
00524 $tbl->setTitle($this->lng->txt("cont_terms"));
00525
00526
00527 $tbl->setHeaderNames(array($this->lng->txt("cont_term")));
00528
00529 $cols = array("term");
00530
00531 $header_params = $this->ctrl->getParameterArrayByClass("ilobjglossarygui", "listTerms");
00532 $header_params["cmd"] = "quickList";
00533 $tbl->setHeaderVars($cols, $header_params);
00534 $tbl->setColumnWidth(array("100%"));
00535
00536
00537 $tbl->setOrderColumn($_GET["sort_by"]);
00538 $tbl->setOrderDirection($_GET["sort_order"]);
00539 $tbl->setLimit($_GET["limit"]);
00540 $tbl->setOffset($_GET["offset"]);
00541 $tbl->disable("header");
00542
00543 $term_list = $this->object->getTermList();
00544 $tbl->setMaxCount(count($term_list));
00545
00546 $this->tpl->setVariable("COLUMN_COUNT", 1);
00547
00548
00549 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00550
00551
00552
00553 $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]);
00554
00555
00556 $tbl->render();
00557
00558 if (count($term_list) > 0)
00559 {
00560 $i=1;
00561 foreach($term_list as $key => $term)
00562 {
00563 $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
00564
00565 $sep = ": ";
00566 for($j=0; $j<count($defs); $j++)
00567 {
00568 $def = $defs[$j];
00569
00570
00571 $this->tpl->setCurrentBlock("definition");
00572 $this->tpl->setVariable("SEP", $sep);
00573 $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term["id"]);
00574 $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def["id"]);
00575 $this->tpl->setVariable("LINK_EDIT_DEF",
00576 $this->ctrl->getLinkTargetByClass(array("ilglossarytermgui",
00577 "iltermdefinitioneditorgui",
00578 "ilpageobjectgui"), "view"));
00579 $this->tpl->setVariable("TEXT_DEF", $this->lng->txt("glo_definition_abbr").($j+1));
00580 $this->tpl->parseCurrentBlock();
00581 $sep = ", ";
00582 }
00583
00584 $this->tpl->setCurrentBlock("tbl_content");
00585 $css_row = ilUtil::switchColor(++$i,"tblrow1","tblrow2");
00586
00587
00588 $this->tpl->setVariable("TEXT_TERM", $term["term"]);
00589 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00590 $this->tpl->setVariable("LINK_EDIT_TERM",
00591 $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "editTerm"));
00592
00593 $this->tpl->setVariable("CSS_ROW", $css_row);
00594 $this->tpl->parseCurrentBlock();
00595 }
00596 }
00597 else
00598 {
00599 $this->tpl->setCurrentBlock("notfound");
00600 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00601 $this->tpl->setVariable("NUM_COLS", $num);
00602 $this->tpl->parseCurrentBlock();
00603 }
00604 }
00605
00606
00610 function listTerms()
00611 {
00612 global $ilUser;
00613
00614
00615
00616
00617 $this->lng->loadLanguageModule("meta");
00618 include_once "./classes/class.ilTableGUI.php";
00619
00620
00621
00622 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00623
00624 $this->tpl->setCurrentBlock("btn_cell");
00625 $this->tpl->setVariable("BTN_LINK", "content/glossary_presentation.php?cmd=listTerms&ref_id=".$this->object->getRefID());
00626 $this->tpl->setVariable("BTN_TARGET"," target=\"bottom\" ");
00627 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
00628 $this->tpl->parseCurrentBlock();
00629
00630
00631 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.glossary_term_list.html", true);
00632 $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
00633 $this->tpl->setVariable("TXT_TERM", $this->lng->txt("cont_term"));
00634 $this->tpl->setVariable("TXT_ADD2", $this->lng->txt("add"));
00635 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
00636 $lang = ilMetaData::getLanguages();
00637
00638 if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
00639 {
00640 $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
00641 }
00642 else
00643 {
00644 $s_lang = $ilUser->getLanguage();
00645 }
00646
00647 $select_language = ilUtil::formSelect ($s_lang, "term_language",$lang,false,true);
00648 $this->tpl->setVariable("SELECT_LANGUAGE", $select_language);
00649
00650
00651
00652 $this->tpl->addBlockfile("TERM_TABLE", "term_table", "tpl.table.html");
00653
00654
00655 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_tbl_row.html", true);
00656
00657 $num = 0;
00658
00659 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00660
00661
00662 $tbl = new ilTableGUI();
00663
00664
00665 $tbl->setTitle($this->lng->txt("cont_terms"));
00666
00667
00668 $tbl->setHeaderNames(array("", $this->lng->txt("cont_term"),
00669 $this->lng->txt("language"), $this->lng->txt("cont_definitions")));
00670
00671 $cols = array("", "term", "language", "definitions", "id");
00672
00673 $header_params = $this->ctrl->getParameterArrayByClass("ilobjglossarygui", "listTerms");
00674 $tbl->setHeaderVars($cols, $header_params);
00675 $tbl->setColumnWidth(array("1%","24%","15%","60%"));
00676
00677
00678 $tbl->setOrderColumn($_GET["sort_by"]);
00679 $tbl->setOrderDirection($_GET["sort_order"]);
00680 $tbl->setLimit($_GET["limit"]);
00681 $tbl->setOffset($_GET["offset"]);
00682 $tbl->disable("sort");
00683
00684 $term_list = $this->object->getTermList();
00685 $tbl->setMaxCount(count($term_list));
00686
00687
00688
00689
00690 $this->setActions(array("confirmTermDeletion" => "delete", "addDefinition" => "cont_add_definition"));
00691
00692
00693
00694 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00695
00696
00697
00698 $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]);
00699
00700
00701 $tbl->render();
00702
00703 if (count($term_list) > 0)
00704 {
00705 $this->tpl->setVariable("COLUMN_COUNTS", 4);
00706 $this->showActions(true);
00707
00708 $i=1;
00709 foreach($term_list as $key => $term)
00710 {
00711 $css_row = ilUtil::switchColor(++$i,"tblrow1","tblrow2");
00712 $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
00713 for($j=0; $j<count($defs); $j++)
00714 {
00715 $def = $defs[$j];
00716
00717
00718 if ($j > 0)
00719 {
00720 $this->tpl->setCurrentBlock("move_up");
00721 $this->tpl->setVariable("TXT_UP", $this->lng->txt("up"));
00722 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00723 $this->ctrl->setParameter($this, "def", $def["id"]);
00724 $this->tpl->setVariable("LINK_UP",
00725 $this->ctrl->getLinkTarget($this, "moveDefinitionUp"));
00726 $this->tpl->parseCurrentBlock();
00727 }
00728
00729
00730 if ($j+1 < count($defs))
00731 {
00732 $this->tpl->setCurrentBlock("move_down");
00733 $this->tpl->setVariable("TXT_DOWN", $this->lng->txt("down"));
00734 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00735 $this->ctrl->setParameter($this, "def", $def["id"]);
00736 $this->tpl->setVariable("LINK_DOWN",
00737 $this->ctrl->getLinkTarget($this, "moveDefinitionDown"));
00738 $this->tpl->parseCurrentBlock();
00739 }
00740
00741
00742 $this->tpl->setCurrentBlock("delete");
00743 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00744 $this->ctrl->setParameter($this, "def", $def["id"]);
00745 $this->tpl->setVariable("LINK_DELETE",
00746 $this->ctrl->getLinkTarget($this, "confirmDefinitionDeletion"));
00747 $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("delete"));
00748 $this->tpl->parseCurrentBlock();
00749
00750
00751 $this->tpl->setCurrentBlock("edit");
00752 $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term["id"]);
00753 $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def["id"]);
00754 $this->tpl->setVariable("LINK_EDIT",
00755 $this->ctrl->getLinkTargetByClass(array("ilglossarytermgui",
00756 "iltermdefinitioneditorgui",
00757 "ilpageobjectgui"), "view"));
00758 $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
00759 $this->tpl->parseCurrentBlock();
00760
00761
00762 $this->tpl->setCurrentBlock("definition");
00763 $short_str = ilPCParagraph::xml2output($def["short_text"]);
00764
00765
00766 $this->tpl->setVariable("DEF_SHORT", $short_str);
00767 $this->tpl->parseCurrentBlock();
00768
00769 $this->tpl->setCurrentBlock("definition_row");
00770 $this->tpl->parseCurrentBlock();
00771 }
00772
00773 $this->tpl->setCurrentBlock("check_col");
00774 $this->tpl->setVariable("CHECKBOX_ID", $term["id"]);
00775 $this->tpl->setVariable("CSS_ROW", $css_row);
00776 $this->tpl->parseCurrentBlock();
00777
00778
00779 $this->tpl->setCurrentBlock("edit_term");
00780 $this->tpl->setVariable("TEXT_TERM", $term["term"]);
00781 $this->ctrl->setParameter($this, "term_id", $term["id"]);
00782 $this->tpl->setVariable("LINK_EDIT_TERM",
00783 $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "editTerm"));
00784 $this->tpl->setVariable("TXT_EDIT_TERM", $this->lng->txt("edit"));
00785 $this->tpl->parseCurrentBlock();
00786
00787 $this->tpl->setCurrentBlock("tbl_content");
00788
00789
00790 $this->tpl->setVariable("CSS_ROW", $css_row);
00791 $this->tpl->setVariable("TEXT_LANGUAGE", $this->lng->txt("meta_l_".$term["language"]));
00792 $this->tpl->setCurrentBlock("tbl_content");
00793 $this->tpl->parseCurrentBlock();
00794 }
00795 }
00796 else
00797 {
00798 $this->tpl->setCurrentBlock("notfound");
00799 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00800 $this->tpl->setVariable("NUM_COLS", $num);
00801 $this->tpl->parseCurrentBlock();
00802 }
00803 }
00804
00808 function addTerm()
00809 {
00810
00811 include_once ("content/classes/class.ilGlossaryTerm.php");
00812 $term =& new ilGlossaryTerm();
00813 $term->setGlossary($this->object);
00814 $term->setTerm(ilUtil::stripSlashes($_POST["new_term"]));
00815 $term->setLanguage($_POST["term_language"]);
00816 $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["term_language"];
00817 $term->create();
00818
00819
00820 $def =& new ilGlossaryDefinition();
00821 $def->setTermId($term->getId());
00822 $def->setTitle(ilUtil::stripSlashes($_POST["new_term"]));
00823 $def->create();
00824
00825 $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term->getId());
00826 $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def->getId());
00827 $this->ctrl->redirectByClass(array("ilglossarytermgui",
00828 "iltermdefinitioneditorgui", "ilpageobjectgui"), "view");
00829 }
00830
00834 function moveDefinitionUp()
00835 {
00836 include_once("content/classes/class.ilGlossaryDefinition.php");
00837
00838 $definition =& new ilGlossaryDefinition($_GET["def"]);
00839 $definition->moveUp();
00840
00841 $this->ctrl->redirect($this, "listTerms");
00842 }
00843
00847 function moveDefinitionDown()
00848 {
00849 include_once("content/classes/class.ilGlossaryDefinition.php");
00850
00851 $definition =& new ilGlossaryDefinition($_GET["def"]);
00852 $definition->moveDown();
00853
00854 $this->ctrl->redirect($this, "listTerms");
00855 }
00856
00860 function confirmDefinitionDeletion()
00861 {
00862
00863
00864
00865
00866 $term = new ilGlossaryTerm($_GET["term_id"]);
00867
00868
00869 $this->tpl->setCurrentBlock("ContentStyle");
00870 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
00871 ilObjStyleSheet::getContentStylePath(0));
00872 $this->tpl->parseCurrentBlock();
00873
00874
00875 $this->tpl->setCurrentBlock("SyntaxStyle");
00876 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
00877 ilObjStyleSheet::getSyntaxStylePath());
00878 $this->tpl->parseCurrentBlock();
00879
00880
00881
00882
00883
00884 $this->tpl->addBlockfile("ADM_CONTENT", "def_list", "tpl.glossary_definition_delete.html", true);
00885 sendInfo($this->lng->txt("info_delete_sure"));
00886
00887 $this->tpl->setVariable("TXT_TERM", $term->getTerm());
00888
00889 $definition =& new ilGlossaryDefinition($_GET["def"]);
00890 $page =& new ilPageObject("gdf", $definition->getId());
00891 $page_gui =& new ilPageObjectGUI($page);
00892 $page_gui->setTemplateOutput(false);
00893 $page_gui->setSourcecodeDownloadScript("glossary_presentation.php?ref_id=".$_GET["ref_id"]);
00894 $output = $page_gui->preview();
00895
00896 $this->tpl->setCurrentBlock("definition");
00897 $this->tpl->setVariable("PAGE_CONTENT", $output);
00898 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00899 $this->tpl->setVariable("LINK_CANCEL",
00900 $this->ctrl->getLinkTarget($this, "cancelDefinitionDeletion"));
00901 $this->tpl->setVariable("TXT_CONFIRM", $this->lng->txt("confirm"));
00902 $this->ctrl->setParameter($this, "def", $definition->getId());
00903 $this->tpl->setVariable("LINK_CONFIRM",
00904 $this->ctrl->getLinkTarget($this, "deleteDefinition"));
00905 $this->tpl->parseCurrentBlock();
00906 }
00907
00913 function cancelObject($in_rep = false)
00914 {
00915 sendInfo($this->lng->txt("msg_cancel"),true);
00916 ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
00917
00918 }
00919
00920 function cancelDefinitionDeletion()
00921 {
00922 $this->ctrl->redirect($this, "listTerms");
00923 }
00924
00925
00926 function deleteDefinition()
00927 {
00928 $definition =& new ilGlossaryDefinition($_GET["def"]);
00929 $definition->delete();
00930 $this->ctrl->redirect($this, "listTerms");
00931 }
00932
00936 function editTerm()
00937 {
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957 }
00958
00959
00963 function updateTerm()
00964 {
00965 $term = new ilGlossaryTerm($_GET["term_id"]);
00966
00967 $term->setTerm(ilUtil::stripSlashes($_POST["term"]));
00968 $term->setLanguage($_POST["term_language"]);
00969 $term->update();
00970 sendinfo($this->lng->txt("msg_obj_modified"),true);
00971 $this->ctrl->redirect($this, "listTerms");
00972 }
00973
00974
00975
00976
00977
00978 function exportList()
00979 {
00980 global $tree;
00981
00982
00983
00984
00985 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00986
00987
00988 $this->tpl->setCurrentBlock("btn_cell");
00989 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "export"));
00990 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_xml"));
00991 $this->tpl->parseCurrentBlock();
00992
00993
00994 $this->tpl->setCurrentBlock("btn_cell");
00995 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportHTML"));
00996 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_create_export_file_html"));
00997 $this->tpl->parseCurrentBlock();
00998
00999
01000 if (is_file($this->object->getExportDirectory()."/export.log"))
01001 {
01002 $this->tpl->setCurrentBlock("btn_cell");
01003 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "viewExportLog"));
01004 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_view_last_export_log"));
01005 $this->tpl->parseCurrentBlock();
01006 }
01007
01008
01009 $export_dir = $this->object->getExportDirectory();
01010
01011 $export_files = $this->object->getExportFiles();
01012
01013
01014 require_once("classes/class.ilTableGUI.php");
01015 $tbl = new ilTableGUI();
01016
01017
01018 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
01019
01020
01021 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.glo_export_file_row.html", true);
01022
01023 $num = 0;
01024
01025 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01026
01027 $tbl->setTitle($this->lng->txt("cont_export_files"));
01028
01029 $tbl->setHeaderNames(array("", $this->lng->txt("type"),
01030 $this->lng->txt("cont_file"),
01031 $this->lng->txt("cont_size"), $this->lng->txt("date") ));
01032
01033 $cols = array("", "type", "file", "size", "date");
01034 $header_params = array("ref_id" => $_GET["ref_id"],
01035 "cmd" => "exportList", "cmdClass" => get_class($this));
01036 $tbl->setHeaderVars($cols, $header_params);
01037 $tbl->setColumnWidth(array("1%", "9%", "40%", "25%", "25%"));
01038 $tbl->disable("sort");
01039
01040
01041 $tbl->setOrderColumn($_GET["sort_by"]);
01042 $tbl->setOrderDirection($_GET["sort_order"]);
01043 $tbl->setLimit($_GET["limit"]);
01044 $tbl->setOffset($_GET["offset"]);
01045 $tbl->setMaxCount($this->maxcount);
01046
01047 $this->tpl->setVariable("COLUMN_COUNTS", 5);
01048
01049
01050 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
01051 $this->tpl->setCurrentBlock("tbl_action_btn");
01052 $this->tpl->setVariable("BTN_NAME", "confirmDeleteExportFile");
01053 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
01054 $this->tpl->parseCurrentBlock();
01055
01056 $this->tpl->setCurrentBlock("tbl_action_btn");
01057 $this->tpl->setVariable("BTN_NAME", "downloadExportFile");
01058 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("download"));
01059 $this->tpl->parseCurrentBlock();
01060
01061
01062 $this->tpl->setCurrentBlock("tbl_action_btn");
01063 $this->tpl->setVariable("BTN_NAME", "publishExportFile");
01064 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("cont_public_access"));
01065 $this->tpl->parseCurrentBlock();
01066
01067
01068 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
01069
01070
01071 $tbl->setMaxCount(count($export_files));
01072 $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
01073
01074 $tbl->render();
01075 if(count($export_files) > 0)
01076 {
01077 $i=0;
01078 foreach($export_files as $exp_file)
01079 {
01080 $this->tpl->setCurrentBlock("tbl_content");
01081 $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
01082
01083 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
01084 $this->tpl->setVariable("CSS_ROW", $css_row);
01085
01086 $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
01087
01088 $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
01089 ? " <b>(".$this->lng->txt("public").")<b>"
01090 : "";
01091 $this->tpl->setVariable("TXT_TYPE", $exp_file["type"].$public_str);
01092 $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"].":".$exp_file["file"]);
01093
01094 $file_arr = explode("__", $exp_file["file"]);
01095 $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s",$file_arr[0]));
01096
01097 $this->tpl->parseCurrentBlock();
01098 }
01099 }
01100 else
01101 {
01102 $this->tpl->setCurrentBlock("notfound");
01103 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
01104 $this->tpl->setVariable("NUM_COLS", 3);
01105 $this->tpl->parseCurrentBlock();
01106 }
01107
01108 $this->tpl->parseCurrentBlock();
01109 }
01110
01111
01115 function export()
01116 {
01117 require_once("content/classes/class.ilGlossaryExport.php");
01118 $glo_exp = new ilGlossaryExport($this->object);
01119 $glo_exp->buildExportFile();
01120 $this->ctrl->redirect($this, "exportList");
01121 }
01122
01126 function exportHTML()
01127 {
01128 require_once("content/classes/class.ilGlossaryExport.php");
01129 $glo_exp = new ilGlossaryExport($this->object, "html");
01130 $glo_exp->buildExportFile();
01131
01132 $this->ctrl->redirect($this, "exportList");
01133 }
01134
01135
01139 function downloadExportFile()
01140 {
01141 if(!isset($_POST["file"]))
01142 {
01143 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01144 }
01145
01146 if (count($_POST["file"]) > 1)
01147 {
01148 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
01149 }
01150
01151 $file = explode(":", $_POST["file"][0]);
01152 $export_dir = $this->object->getExportDirectory($file[0]);
01153 ilUtil::deliverFile($export_dir."/".$file[1],
01154 $file[1]);
01155 }
01156
01160 function publishExportFile()
01161 {
01162 if(!isset($_POST["file"]))
01163 {
01164 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01165 }
01166 if (count($_POST["file"]) > 1)
01167 {
01168 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
01169 }
01170
01171 $file = explode(":", $_POST["file"][0]);
01172 $export_dir = $this->object->getExportDirectory($file[0]);
01173
01174 if ($this->object->getPublicExportFile($file[0]) ==
01175 $file[1])
01176 {
01177 $this->object->setPublicExportFile($file[0], "");
01178 }
01179 else
01180 {
01181 $this->object->setPublicExportFile($file[0], $file[1]);
01182 }
01183 $this->object->update();
01184 $this->ctrl->redirect($this, "exportList");
01185 }
01186
01187
01188
01189
01190 function viewExportLog()
01191 {
01192 global $tree;
01193
01194 $this->setTabs();
01195
01196
01197 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
01198
01199
01200 $this->tpl->setCurrentBlock("btn_cell");
01201 $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportList"));
01202 $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_export_files"));
01203 $this->tpl->parseCurrentBlock();
01204
01205
01206 $this->tpl->setVariable("ADM_CONTENT",
01207 nl2br(file_get_contents($this->object->getExportDirectory()."/export.log")));
01208
01209 $this->tpl->parseCurrentBlock();
01210 }
01211
01215 function confirmDeleteExportFile()
01216 {
01217 if(!isset($_POST["file"]))
01218 {
01219 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01220 }
01221
01222 $this->setTabs();
01223
01224
01225 $_SESSION["ilExportFiles"] = $_POST["file"];
01226
01227 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.confirm_deletion.html", true);
01228
01229 sendInfo($this->lng->txt("info_delete_sure"));
01230
01231 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01232
01233
01234 $this->tpl->setCurrentBlock("table_header");
01235 $this->tpl->setVariable("TEXT",$this->lng->txt("objects"));
01236 $this->tpl->parseCurrentBlock();
01237
01238
01239 $counter = 0;
01240 foreach($_POST["file"] as $file)
01241 {
01242 $file = explode(":", $file);
01243 $this->tpl->setCurrentBlock("table_row");
01244 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
01245 $this->tpl->setVariable("TEXT_CONTENT", $file[1]." (".$file[0].")");
01246 $this->tpl->parseCurrentBlock();
01247 }
01248
01249
01250 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
01251 $buttons = array( "cancelDeleteExportFile" => $this->lng->txt("cancel"),
01252 "deleteExportFile" => $this->lng->txt("confirm"));
01253 foreach ($buttons as $name => $value)
01254 {
01255 $this->tpl->setCurrentBlock("operation_btn");
01256 $this->tpl->setVariable("BTN_NAME",$name);
01257 $this->tpl->setVariable("BTN_VALUE",$value);
01258 $this->tpl->parseCurrentBlock();
01259 }
01260 }
01261
01265 function cancelDeleteExportFile()
01266 {
01267 session_unregister("ilExportFiles");
01268 $this->ctrl->redirect($this, "exportList");
01269 }
01270
01274 function deleteExportFile()
01275 {
01276 foreach($_SESSION["ilExportFiles"] as $file)
01277 {
01278 $file = explode(":", $file);
01279 $export_dir = $this->object->getExportDirectory($file[0]);
01280
01281 $exp_file = $export_dir."/".$file[1];
01282 $exp_dir = $export_dir."/".substr($file, 0, strlen($file) - 4);
01283 if (@is_file($exp_file))
01284 {
01285 unlink($exp_file);
01286 }
01287 if (@is_dir($exp_dir))
01288 {
01289 ilUtil::delDir($exp_dir);
01290 }
01291 }
01292 $this->ctrl->redirect($this, "exportList");
01293 }
01294
01298 function confirmTermDeletion()
01299 {
01300
01301 if (!isset($_POST["id"]))
01302 {
01303 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
01304 }
01305
01306
01307 $_SESSION["term_delete"] = $_POST["id"];
01308
01309 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.obj_confirm.html");
01310
01311 sendInfo($this->lng->txt("info_delete_sure"));
01312 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
01313
01314
01315 $cols = array("cont_term");
01316 foreach ($cols as $key)
01317 {
01318 $this->tpl->setCurrentBlock("table_header");
01319 $this->tpl->setVariable("TEXT",$this->lng->txt($key));
01320 $this->tpl->parseCurrentBlock();
01321 }
01322
01323 foreach($_POST["id"] as $id)
01324 {
01325 $term = new ilGlossaryTerm($id);
01326
01327
01328 $this->tpl->setCurrentBlock("table_cell");
01329 $this->tpl->setVariable("TEXT_CONTENT", $term->getTerm());
01330 $this->tpl->parseCurrentBlock();
01331
01332
01333 $this->tpl->setCurrentBlock("table_row");
01334 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
01335 $this->tpl->parseCurrentBlock();
01336 }
01337
01338
01339 $buttons = array( "cancelTermDeletion" => $this->lng->txt("cancel"),
01340 "deleteTerms" => $this->lng->txt("confirm"));
01341 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
01342 foreach($buttons as $name => $value)
01343 {
01344 $this->tpl->setCurrentBlock("operation_btn");
01345 $this->tpl->setVariable("BTN_NAME",$name);
01346 $this->tpl->setVariable("BTN_VALUE",$value);
01347 $this->tpl->parseCurrentBlock();
01348 }
01349
01350 }
01351
01357 function cancelTermDeletion()
01358 {
01359 session_unregister("term_delete");
01360 sendInfo($this->lng->txt("msg_cancel"),true);
01361 $this->ctrl->redirect($this, "listTerms");
01362 }
01363
01367 function deleteTerms()
01368 {
01369 foreach($_SESSION["term_delete"] as $id)
01370 {
01371 $term = new ilGlossaryTerm($id);
01372 $term->delete();
01373 }
01374 session_unregister("term_delete");
01375 $this->ctrl->redirect($this, "listTerms");
01376 }
01377
01385 function setLocator($a_tree = "", $a_id = "")
01386 {
01387 global $ilias_locator;
01388
01389 if(strtolower($_GET["baseClass"]) != "ilglossaryeditorgui")
01390 {
01391 parent::setLocator($a_tree, $a_id);
01392 }
01393 else
01394 {
01395 if(is_object($this->object))
01396 {
01397 require_once("content/classes/class.ilGlossaryLocatorGUI.php");
01398 $gloss_loc =& new ilGlossaryLocatorGUI();
01399 if (is_object($this->term))
01400 {
01401 $gloss_loc->setTerm($this->term);
01402 }
01403 $gloss_loc->setGlossary($this->object);
01404
01405 $gloss_loc->display();
01406 }
01407 }
01408
01409 }
01410
01414 function perm()
01415 {
01416 echo "Deprecated"; exit;
01417
01418
01419
01420
01421
01422 }
01423
01427 function permSave()
01428 {
01429 echo "Deprecated"; exit;
01430
01431
01432
01433 }
01434
01438 function info()
01439 {
01440 echo "Deprecated"; exit;
01441
01442
01443 }
01444
01448 function addRole()
01449 {
01450 echo "Deprecated"; exit;
01451
01452
01453
01454 }
01455
01459 function owner()
01460 {
01461 echo "Deprecated"; exit;
01462
01463
01464
01465 }
01466
01470 function view()
01471 {
01472
01473 $this->viewObject();
01474 }
01475
01479 function create()
01480 {
01481 switch($_POST["new_type"])
01482 {
01483 case "term":
01484 $term_gui =& new ilGlossaryTermGUI();
01485 $term_gui->create();
01486 break;
01487 }
01488 }
01489
01490 function saveTerm()
01491 {
01492 $term_gui =& new ilGlossaryTermGUI();
01493 $term_gui->setGlossary($this->object);
01494 $term_gui->save();
01495
01496 sendinfo($this->lng->txt("cont_added_term"),true);
01497
01498
01499 $ilCtrl->redirect($this, "listTerms");
01500 }
01501
01502
01506 function addDefinition()
01507 {
01508 if (count($_POST["id"]) < 1)
01509 {
01510 $this->ilias->raiseError($this->lng->txt("cont_select_term"),$this->ilias->error_obj->MESSAGE);
01511 }
01512
01513 if (count($_POST["id"]) > 1)
01514 {
01515 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_term"),$this->ilias->error_obj->MESSAGE);
01516 }
01517
01518
01519 include_once ("content/classes/class.ilGlossaryTerm.php");
01520 $term =& new ilGlossaryTerm($_POST["id"][0]);
01521
01522
01523 $def =& new ilGlossaryDefinition();
01524 $def->setTermId($term->getId());
01525 $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
01526 $def->create();
01527
01528 $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term->getId());
01529 $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def->getId());
01530 $this->ctrl->redirectByClass(array("ilglossarytermgui",
01531 "iltermdefinitioneditorgui", "ilpageobjectgui"), "view");
01532
01533 }
01534
01535 function getTemplate()
01536 {
01537 $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
01538 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
01539
01540 $title = $this->object->getTitle();
01541
01542
01543 sendInfo();
01544
01545 if ($_GET["term_id"] > 0)
01546 {
01547
01548
01549
01550 $this->tpl->setVariable("HEADER", $this->lng->txt("term").": ".
01551 ilGlossaryTerm::_lookGlossaryTerm($_GET["term_id"]));
01552 }
01553 else
01554 {
01555 $this->tpl->setCurrentBlock("header_image");
01556 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_glo_b.gif"));
01557 $this->tpl->parseCurrentBlock();
01558 $this->tpl->setVariable("HEADER", $this->lng->txt("glo").": ".$title);
01559 }
01560
01561
01562
01563
01564 }
01565
01569 function setTabs()
01570 {
01571
01572
01573 #include_once("classes/class.ilTabsGUI.php");
01574 #$tabs_gui =& new ilTabsGUI();
01575 $this->getTabs($this->tabs_gui);
01576
01577 #$this->tpl->setVariable("TABS", $tabs_gui->getHTML());
01578
01579 }
01580
01584 function getTabs(&$tabs_gui)
01585 {
01586 global $rbacsystem;
01587
01588
01589 $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "listTerms")
01590 ? true
01591 : false;
01592 $tabs_gui->addTarget("cont_terms",
01593 $this->ctrl->getLinkTarget($this, "listTerms"), array("listTerms", ""),
01594 get_class($this), "", $force_active);
01595
01596
01597 $tabs_gui->addTarget("properties",
01598 $this->ctrl->getLinkTarget($this, "properties"), "properties",
01599 get_class($this));
01600
01601
01602 $tabs_gui->addTarget("meta_data",
01603 $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
01604 "", "ilmdeditorgui");
01605
01606
01607 $tabs_gui->addTarget("export",
01608 $this->ctrl->getLinkTarget($this, "exportList"),
01609 array("exportList", "viewExportLog"), get_class($this));
01610
01611
01612 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
01613 {
01614
01615
01616
01617
01618
01619 $tabs_gui->addTarget("perm_settings",
01620 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
01621
01622 }
01623 }
01624
01625 }
01626
01627 ?>