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