ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjGlossaryGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once("./Services/Object/classes/class.ilObjectGUI.php");
6 require_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
7 require_once("./Modules/Glossary/classes/class.ilGlossaryTermGUI.php");
8 require_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
9 require_once("./Modules/Glossary/classes/class.ilTermDefinitionEditorGUI.php");
10 require_once("./Services/COPage/classes/class.ilPCParagraph.php");
11 
27 {
29  var $mode;
30  var $term;
31 
36  function ilObjGlossaryGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
37  {
38  global $ilCtrl, $lng;
39 
40  $this->ctrl =& $ilCtrl;
41  $this->ctrl->saveParameter($this, array("ref_id", "offset"));
42  $lng->loadLanguageModule("content");
43 
44  $this->type = "glo";
45  parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, false);
46 
47  // determine term id and check whether it is valid (belongs to
48  // current glossary)
49  $this->term_id = (int) $_GET["term_id"];
50  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($this->term_id);
51  if ($this->term_id > 0 && $term_glo_id != $this->object->getId())
52  {
53  $this->term_id = "";
54  }
55 
56  }
57 
61  function &executeCommand()
62  {
63  global $lng, $ilAccess, $ilTabs, $ilErr;
64 
65  $cmd = $this->ctrl->getCmd();
66  $next_class = $this->ctrl->getNextClass($this);
67 
68  switch ($next_class)
69  {
70  case 'ilmdeditorgui':
71  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
72  {
73  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
74  }
75 
76  $this->getTemplate();
77  $this->setTabs();
78  $this->setLocator();
79  $this->addHeaderAction();
80 
81  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
82 
83  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
84  $md_gui->addObserver($this->object,'MDUpdateListener','General');
85 
86  $this->ctrl->forwardCommand($md_gui);
87  break;
88 
89  case "ilglossarytermgui":
90 // $this->quickList();
91  $this->ctrl->setReturn($this, "listTerms");
92  $term_gui =& new ilGlossaryTermGUI($this->term_id);
93  $term_gui->setGlossary($this->object);
94  //$ret =& $term_gui->executeCommand();
95  $ret =& $this->ctrl->forwardCommand($term_gui);
96  break;
97 
98  case "ilinfoscreengui":
99  $this->addHeaderAction();
100  $this->showInfoScreen();
101  break;
102 
103  case "ilobjstylesheetgui":
104  include_once ("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
105  $this->ctrl->setReturn($this, "editStyleProperties");
106  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
107  $style_gui->omitLocator();
108  if ($cmd == "create" || $_GET["new_type"]=="sty")
109  {
110  $style_gui->setCreationMode(true);
111  }
112 
113  if ($cmd == "confirmedDelete")
114  {
115  $this->object->setStyleSheetId(0);
116  $this->object->update();
117  }
118 
119  $ret = $this->ctrl->forwardCommand($style_gui);
120 
121  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
122  {
123  $style_id = $ret;
124  $this->object->setStyleSheetId($style_id);
125  $this->object->update();
126  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
127  }
128  break;
129 
130 
131  case 'ilpermissiongui':
132  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
133  {
134  $this->prepareOutput();
135  }
136  else
137  {
138  $this->getTemplate();
139  $this->setTabs();
140  $this->setLocator();
141  $this->addHeaderAction();
142  }
143  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
144  $perm_gui =& new ilPermissionGUI($this);
145  $ret =& $this->ctrl->forwardCommand($perm_gui);
146  break;
147 
148  case "ilcommonactiondispatchergui":
149  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
151  $this->ctrl->forwardCommand($gui);
152  break;
153 
154  case "ilobjtaxonomygui":
155  $this->getTemplate();
156  $this->setTabs();
157  $this->setLocator();
158  $this->addHeaderAction();
159  $ilTabs->activateTab("settings");
160  $this->setSettingsSubTabs("taxonomy");
161 
162  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php");
163  $this->ctrl->setReturn($this, "properties");
164  $tax_gui = new ilObjTaxonomyGUI();
165  $tax_gui->setAssignedObject($this->object->getId());
166  $ret = $this->ctrl->forwardCommand($tax_gui);
167  break;
168 
169  case "ilexportgui":
170  $this->getTemplate();
171  $this->setTabs();
172  $ilTabs->activateTab("export");
173  $this->setLocator();
174  include_once("./Services/Export/classes/class.ilExportGUI.php");
175  $exp_gui = new ilExportGUI($this);
176  //$exp_gui->addFormat("xml", "", $this, "export");
177  $exp_gui->addFormat("xml");
178  $exp_gui->addFormat("html", "", $this, "exportHTML");
179  $exp_gui->addCustomColumn($lng->txt("cont_public_access"),
180  $this, "getPublicAccessColValue");
181  $exp_gui->addCustomMultiCommand($lng->txt("cont_public_access"),
182  $this, "publishExportFile");
183  $ret = $this->ctrl->forwardCommand($exp_gui);
184  break;
185 
186  default:
187  $cmd = $this->ctrl->getCmd("listTerms");
188 
189  if (($cmd == "create") && ($_POST["new_type"] == "term"))
190  {
191  $this->ctrl->setCmd("create");
192  $this->ctrl->setCmdClass("ilGlossaryTermGUI");
193  $ret =& $this->executeCommand();
194  return;
195  }
196  else
197  {
198  if (!in_array($cmd, array("frameset", "quickList")))
199  {
200  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
201  $this->getCreationMode() == true)
202  {
203  $this->prepareOutput();
204  $cmd.= "Object";
205  }
206  else
207  {
208  $this->getTemplate();
209  $this->setTabs();
210  $this->setLocator();
211  $this->addHeaderAction();
212  }
213  }
214  $ret =& $this->$cmd();
215  }
216  break;
217  }
218 
219  if (!in_array($cmd, array("frameset", "quickList")))
220  {
221  if (strtolower($_GET["baseClass"]) != "iladministrationgui")
222  {
223  if (!$this->getCreationMode())
224  {
225  $this->tpl->show();
226  }
227  }
228  }
229  else
230  {
231  $this->tpl->show(false);
232  }
233  }
234 
235  function assignObject()
236  {
237  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
238 
239  $this->object =& new ilObjGlossary($this->id, true);
240  }
241 
242  protected function initCreationForms($a_new_type)
243  {
244  $forms = array(
245  self::CFORM_NEW => $this->initCreateForm($a_new_type),
246  self::CFORM_IMPORT => $this->initImportForm($a_new_type)
247  );
248 
249  return $forms;
250  }
251 
252  function initCreateForm($a_new_type)
253  {
254  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
255  $form = new ilPropertyFormGUI();
256  $form->setTarget("_top");
257  $form->setFormAction($this->ctrl->getFormAction($this));
258  $form->setTitle($this->lng->txt($a_new_type."_new"));
259 
260  // title
261  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
262  $ti->setMaxLength(128);
263  $ti->setSize(40);
264  $ti->setRequired(true);
265  $form->addItem($ti);
266 
267  // description
268  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
269  $ta->setCols(40);
270  $ta->setRows(2);
271  $form->addItem($ta);
272 
273  // mode
274  $stati = array(
275  "none"=>$this->lng->txt("glo_mode_normal"),
276  "level"=>$this->lng->txt("glo_mode_level"),
277  "subtree"=>$this->lng->txt("glo_mode_subtree")
278  );
279  $tm = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
280  $tm->setOptions($stati);
281  $tm->setInfo($this->lng->txt("glo_mode_desc"));
282  $tm->setRequired(true);
283  $form->addItem($tm);
284 
285  $form->addCommandButton("save", $this->lng->txt($a_new_type."_add"));
286  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
287 
288  return $form;
289  }
290 
291  function importObject()
292  {
293  $this->createObject();
294  }
295 
299  function saveObject()
300  {
301  global $tpl;
302 
303  $new_type = $_REQUEST["new_type"];
304 
305  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
306  if (!$this->checkPermissionBool("create", "", $new_type))
307  {
308  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
309  }
310 
311  $this->lng->loadLanguageModule($new_type);
312  $this->ctrl->setParameter($this, "new_type", $new_type);
313 
314  $form = $this->initCreateForm($new_type);
315  if ($form->checkInput())
316  {
317  $this->ctrl->setParameter($this, "new_type", "");
318 
319  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
320  $newObj = new ilObjGlossary();
321  $newObj->setType($new_type);
322  $newObj->setTitle($form->getInput("title"));
323  $newObj->setDescription($form->getInput("desc"));
324  $newObj->setVirtualMode($form->getInput("glo_mode"));
325  $newObj->create();
326 
327  $this->putObjectInTree($newObj);
328 
329  // always send a message
330  ilUtil::sendSuccess($this->lng->txt("glo_added"),true);
331  ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
332  }
333 
334  // display only this form to correct input
335  $form->setValuesByPost();
336  $tpl->setContent($form->getHtml());
337  }
338 
345  function importFileObject()
346  {
347  $new_type = $_REQUEST["new_type"];
348 
349  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
350  if (!$this->checkPermissionBool("create", "", $new_type))
351  {
352  $ilErr->raiseError($this->lng->txt("no_create_permission"));
353  }
354 
355  $this->lng->loadLanguageModule($new_type);
356  $this->ctrl->setParameter($this, "new_type", $new_type);
357 
358  $form = $this->initImportForm($new_type);
359  if ($form->checkInput())
360  {
361  $this->ctrl->setParameter($this, "new_type", "");
362  $upload = $_FILES["importfile"];
363 
364  // create and insert object in objecttree
365  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
366  $newObj = new ilObjGlossary();
367  $newObj->setType($new_type);
368  $newObj->setTitle($upload["name"]);
369  $newObj->create(true);
370 
371  $this->putObjectInTree($newObj);
372 
373  // create import directory
374  $newObj->createImportDirectory();
375 
376  // copy uploaded file to import directory
377  $file = pathinfo($upload["name"]);
378  $full_path = $newObj->getImportDirectory()."/".$upload["name"];
379 
380  ilUtil::moveUploadedFile($upload["tmp_name"], $upload["name"],
381  $full_path);
382 
383  // unzip file
384  ilUtil::unzip($full_path);
385 
386  // determine filename of xml file
387  $subdir = basename($file["basename"],".".$file["extension"]);
388  $xml_file = $newObj->getImportDirectory()."/".$subdir."/".$subdir.".xml";
389 
390  // check whether this is a new export file.
391  // this is the case if manifest.xml exits
392 //echo "1-".$newObj->getImportDirectory()."/".$subdir."/manifest.xml"."-";
393  if (is_file($newObj->getImportDirectory()."/".$subdir."/manifest.xml"))
394  {
395  include_once("./Services/Export/classes/class.ilImport.php");
396  $imp = new ilImport((int) $_GET["ref_id"]);
397  $map = $imp->getMapping();
398  $map->addMapping("Modules/Glossary", "glo", "new_id", $newObj->getId());
399  $imp->importObject($newObj, $full_path, $upload["name"], "glo",
400  "Modules/Glossary", true);
401  ilUtil::sendSuccess($this->lng->txt("glo_added"),true);
402  ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
403  }
404 
405  // check whether subdirectory exists within zip file
406  if (!is_dir($newObj->getImportDirectory()."/".$subdir))
407  {
408  $this->ilias->raiseError(sprintf($this->lng->txt("cont_no_subdir_in_zip"), $subdir),
409  $this->ilias->error_obj->MESSAGE);
410  }
411 
412  // check whether xml file exists within zip file
413  if (!is_file($xml_file))
414  {
415  $this->ilias->raiseError(sprintf($this->lng->txt("cont_zip_file_invalid"), $subdir."/".$subdir.".xml"),
416  $this->ilias->error_obj->MESSAGE);
417  }
418 
419  include_once ("./Modules/LearningModule/classes/class.ilContObjParser.php");
420  $contParser = new ilContObjParser($newObj, $xml_file, $subdir);
421  $contParser->startParsing();
422  ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
423 
424  // delete import directory
425  ilUtil::delDir($newObj->getImportDirectory());
426 
427  ilUtil::sendSuccess($this->lng->txt("glo_added"),true);
428  ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
429  }
430 
431  // display form to correct errors
432  $form->setValuesByPost();
433  $tpl->setContent($form->getHtml());
434  }
435 
442  function showInfoScreen()
443  {
444  global $ilAccess;
445 
446  $this->getTemplate();
447  $this->setTabs();
448  $this->setLocator();
449  $this->lng->loadLanguageModule("meta");
450  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
451 
452  $info = new ilInfoScreenGUI($this);
453  $info->enablePrivateNotes();
454  $info->enableNews();
455  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
456  {
457  $info->enableNewsEditing();
458  $news_set = new ilSetting("news");
459  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
460  if ($enable_internal_rss)
461  {
462  $info->setBlockProperty("news", "settings", true);
463  }
464  }
465  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
466 
467  ilObjGlossaryGUI::addUsagesToInfo($info, $this->object->getId());
468 
469  $this->ctrl->forwardCommand($info);
470  }
471 
478  function addUsagesToInfo($info, $glo_id)
479  {
480  global $lng, $ilAccess;
481 
482  $info->addSection($lng->txt("glo_usages"));
483  include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
485  foreach ($sms as $sm)
486  {
487  $link = false;
488  $refs = ilObject::_getAllReferences($sm);
489  foreach ($refs as $ref)
490  {
491  if ($link === false)
492  {
493  if ($ilAccess->checkAccess("write", "", $ref))
494  {
495  include_once("./Services/Link/classes/class.ilLink.php");
496  $link = ilLink::_getLink($ref,'sahs');
497  }
498  }
499  }
500 
501  $entry = ilObject::_lookupTitle($sm);
502  if ($link !== false)
503  {
504  $entry = "<a href='".$link."' target='_top'>".$entry."</a>";
505  }
506 
507  $info->addProperty($lng->txt("obj_sahs"), $entry);
508  }
509  }
510 
511 
512  function viewObject()
513  {
514  global $rbacsystem;
515 
516  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
517  {
519  return;
520  }
521 
522  if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
523  {
524  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
525  }
526 
527  // edit button
528  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
529 
530  $this->tpl->setCurrentBlock("btn_cell");
531  $this->tpl->setVariable("BTN_LINK",
532  "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$this->object->getRefID());
533  $this->tpl->setVariable("BTN_TARGET"," target=\"".
534  ilFrameTargetInfo::_getFrame("MainContent")."\" ");
535  $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
536  $this->tpl->parseCurrentBlock();
537 
538  //parent::viewObject();
539  }
540 
546  function properties()
547  {
548  global $rbacsystem, $tree, $tpl;
549 
550  $this->setSettingsSubTabs("general_settings");
551 
552  $this->initSettingsForm();
553  $this->getSettingsValues();
554 
555  // Edit ecs export settings
556  include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
557  $ecs = new ilECSGlossarySettings($this->object);
558  $ecs->addSettingsToForm($this->form, 'glo');
559 
560  $tpl->setContent($this->form->getHTML());
561  }
562 
568  public function initSettingsForm($a_mode = "edit")
569  {
570  global $lng, $ilCtrl;
571 
572  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
573  $this->form = new ilPropertyFormGUI();
574 
575  // online
576  $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
577  $cb->setValue("y");
578  $this->form->addItem($cb);
579 
580  // glossary mode
581  $options = array(
582  "none"=>$this->lng->txt("glo_mode_normal"),
583  "level"=>$this->lng->txt("glo_mode_level"),
584  "subtree"=>$this->lng->txt("glo_mode_subtree")
585  );
586  $si = new ilSelectInputGUI($lng->txt("glo_mode"), "glo_mode");
587  $si->setOptions($options);
588  $si->setInfo($lng->txt("glo_mode_desc"));
589  $this->form->addItem($si);
590 
591  // presentation mode
592  $radg = new ilRadioGroupInputGUI($lng->txt("glo_presentation_mode"), "pres_mode");
593  $radg->setValue("table");
594  $op1 = new ilRadioOption($lng->txt("glo_table_form"), "table", $lng->txt("glo_table_form_info"));
595 
596  // short text length
597  $ni = new ilNumberInputGUI($lng->txt("glo_text_snippet_length"), "snippet_length");
598  $ni->setMaxValue(3000);
599  $ni->setMinValue(100);
600  $ni->setMaxLength(4);
601  $ni->setSize(4);
602  $ni->setInfo($lng->txt("glo_text_snippet_length_info"));
603  $ni->setValue(200);
604  $op1->addSubItem($ni);
605 
606  $radg->addOption($op1);
607  $op2 = new ilRadioOption($lng->txt("glo_full_definitions"), "full_def", $lng->txt("glo_full_definitions_info"));
608  $radg->addOption($op2);
609  $this->form->addItem($radg);
610 
611  // show taxonomy
612  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
613  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
614  if (count($tax_ids) > 0)
615  {
616  $cb = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
617  $this->form->addItem($cb);
618  }
619 
620  // downloads
621  $cb = new ilCheckboxInputGUI($lng->txt("cont_downloads"), "glo_act_downloads");
622  $cb->setValue("y");
623  $cb->setInfo($lng->txt("cont_downloads_desc"));
624  $this->form->addItem($cb);
625 
626  // save and cancel commands
627  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
628 
629  $this->form->setTitle($lng->txt("cont_glo_properties"));
630  $this->form->setFormAction($ilCtrl->getFormAction($this));
631  }
632 
636  public function getSettingsValues()
637  {
638  $values = array();
639 
640  $values["cobj_online"] = $this->object->getOnline();
641  $values["glo_mode"] = $this->object->getVirtualMode();
642 // $values["glo_act_menu"] = $this->object->isActiveGlossaryMenu();
643  $values["glo_act_downloads"] = $this->object->isActiveDownloads();
644  $values["pres_mode"] = $this->object->getPresentationMode();
645  $values["snippet_length"] = $this->object->getSnippetLength();
646  $values["show_tax"] = $this->object->getShowTaxonomy();
647 
648  $this->form->setValuesByArray($values);
649  }
650 
654  function saveProperties()
655  {
656  global $tpl;
657 
658  $this->initSettingsForm();
659  if ($this->form->checkInput())
660  {
661  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
662  $this->object->setVirtualMode($_POST["glo_mode"]);
663 // $this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
664  $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
665  $this->object->setPresentationMode($_POST["pres_mode"]);
666  $this->object->setSnippetLength($_POST["snippet_length"]);
667  $this->object->setShowTaxonomy($_POST["show_tax"]);
668  $this->object->update();
669 
670  // set definition short texts dirty
671  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
672  ilGlossaryDefinition::setShortTextsDirty($this->object->getId());
673 
674  // Update ecs export settings
675  include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
676  $ecs = new ilECSGlossarySettings($this->object);
677  if($ecs->handleSettingsUpdate())
678  {
679  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
680  $this->ctrl->redirect($this, "properties");
681  }
682  }
683  $this->form->setValuesByPost();
684  $tpl->setContent($this->form->getHTML());
685  }
686 
690  function frameset()
691  {
692  global $ilCtrl;
693 
694  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
695  $fs_gui = new ilFramesetGUI();
696  $fs_gui->setFramesetTitle($this->object->getTitle());
697  if ((int) $_GET["edit_term"] > 0)
698  {
699  $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", (int) $_GET["edit_term"]);
700  $fs_gui->setMainFrameSource($this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listDefinitions"));
701  }
702  else
703  {
704  $fs_gui->setMainFrameSource($this->ctrl->getLinkTarget($this, "listTerms"));
705  }
706  $fs_gui->setSideFrameSource($this->ctrl->getLinkTarget($this, "quickList"));
707  $fs_gui->setMainFrameName("content");
708  $fs_gui->setSideFrameName("tree");
709  $fs_gui->show();
710  exit;
711  }
712 
716  function quickList()
717  {
718  global $ilUser, $tpl;
719 
720 return;
721  include_once("./Modules/Glossary/classes/class.ilTermQuickListTableGUI.php");
722  $tab = new ilTermQuickListTableGUI($this, "listTerms");
723  $tpl->setLeftContent($tab->getHTML());
724 
725  $this->tpl->addBlockFile("CONTENT", "content", "tpl.glossary_short_list.html",
726  "Modules/Glossary");
727 
728 // $this->tpl->addBlockFile("EXPLORER_TOP", "exp_top", "tpl.explorer_top.html");
729 // $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
730 
731  $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this));
732  $this->tpl->setVariable("CMD_REFR", "quickList");
733  $this->tpl->setVariable("TXT_REFR", $this->lng->txt("refresh"));
734  $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_terms"));
735 
736  include_once "./Services/Table/classes/class.ilTableGUI.php";
737 
738  // glossary term list template
739 
740  // load template for table
741  $this->tpl->addBlockfile("SHORT_LIST", "list", "tpl.table.html");
742 
743  // load template for table content data
744  $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_short_tbl_row.html", true);
745 
746  $num = 0;
747 
748  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
749 
750  // create table
751  $tbl = new ilTableGUI();
752 
753  // title & header columns
754  //$tbl->setTitle($this->lng->txt("cont_terms"));
755  //$tbl->setHelp("tbl_help.php","icon_help.png",$this->lng->txt("help"));
756 
757  $tbl->setHeaderNames(array($this->lng->txt("cont_term")));
758 
759  $cols = array("term");
760  $header_params = $this->ctrl->getParameterArrayByClass("ilobjglossarygui", "listTerms");
761  $header_params["cmd"] = "quickList";
762  $tbl->setHeaderVars($cols, $header_params);
763  $tbl->setColumnWidth(array("100%"));
764  $tbl->disable("title");
765 
766  // control
767  $tbl->setOrderColumn($_GET["sort_by"]);
768  $tbl->setOrderDirection($_GET["sort_order"]);
769  $tbl->setLimit($_GET["limit"]);
770  $tbl->setOffset($_GET["offset"]);
771  $tbl->disable("header");
772 
773  $term_list = $this->object->getTermList();
774  $tbl->setMaxCount(count($term_list));
775 
776  $this->tpl->setVariable("COLUMN_COUNT", 1);
777 
778  // footer
779  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
780 
781 
782  // sorting array
783  $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]);
784 
785  // render table
786  $tbl->render();
787 
788  if (count($term_list) > 0)
789  {
790  $i=1;
791  foreach($term_list as $key => $term)
792  {
794 
795  $sep = ": ";
796  for($j=0; $j<count($defs); $j++)
797  {
798  $def = $defs[$j];
799 
800  // edit
801  $this->tpl->setCurrentBlock("definition");
802  $this->tpl->setVariable("SEP", $sep);
803  $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term["id"]);
804  $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def["id"]);
805  $this->tpl->setVariable("LINK_EDIT_DEF",
806  $this->ctrl->getLinkTargetByClass(array("ilglossarytermgui",
807  "iltermdefinitioneditorgui",
808  "ilpageobjectgui"), "edit"));
809  $this->tpl->setVariable("TEXT_DEF", $this->lng->txt("glo_definition_abbr").($j+1));
810  $this->tpl->parseCurrentBlock();
811  $sep = ", ";
812  }
813 
814  $this->tpl->setCurrentBlock("tbl_content");
815  $css_row = ilUtil::switchColor(++$i,"tblrow1","tblrow2");
816 
817  // edit term link
818  $this->tpl->setVariable("TEXT_TERM", $term["term"]);
819  $this->ctrl->setParameter($this, "term_id", $term["id"]);
820  $this->tpl->setVariable("LINK_EDIT_TERM",
821  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "editTerm"));
822 
823  $this->tpl->setVariable("CSS_ROW", $css_row);
824  $this->tpl->parseCurrentBlock();
825  }
826  } //if is_array
827  else
828  {
829  //$this->tpl->setCurrentBlock("notfound");
830  $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
831  $this->tpl->setVariable("NUM_COLS", $num);
832  //$this->tpl->parseCurrentBlock();
833  }
834  }
835 
836 
840  function listTerms()
841  {
842  global $ilUser, $ilToolbar, $lng, $ilCtrl, $tpl;
843 
844  // term
845  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
846  $ti = new ilTextInputGUI($lng->txt("cont_new_term"), "new_term");
847  $ti->setMaxLength(80);
848  $ti->setSize(20);
849  $ilToolbar->addInputItem($ti, true);
850 
851  // language
852  $this->lng->loadLanguageModule("meta");
854  if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
855  {
856  $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
857  }
858  else
859  {
860  $s_lang = $ilUser->getLanguage();
861  }
862  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
863  $si = new ilSelectInputGUI($lng->txt("language"), "term_language");
864  $si->setOptions($lang);
865  $si->setValue($s_lang);
866  $ilToolbar->addInputItem($si, true);
867 
868  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
869  $ilToolbar->addFormButton($lng->txt("glo_add_new_term"), "addTerm");
870  //$select_language = ilUtil::formSelect ($s_lang, "term_language",$lang,false,true);
871  //$this->tpl->setVariable("SELECT_LANGUAGE", $select_language);
872 
873  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
874  $tab = new ilTermListTableGUI($this, "listTerms");
875  $tpl->setContent($tab->getHTML());
876  }
877 
883  function showActions($a_actions)
884  {
885  foreach ($a_actions as $name => $lng)
886  {
887  $d[$name] = array("name" => $name, "lng" => $lng);
888  }
889 
890  $notoperations = array();
891  $operations = array();
892 
893  $operations = $d;
894 
895  if (count($operations) > 0)
896  {
897  foreach ($operations as $val)
898  {
899  $this->tpl->setCurrentBlock("tbl_action_btn");
900  $this->tpl->setVariable("BTN_NAME", $val["name"]);
901  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
902  $this->tpl->parseCurrentBlock();
903  }
904 
905  $this->tpl->setCurrentBlock("tbl_action_row");
906  $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.png"));
907  $this->tpl->parseCurrentBlock();
908  }
909  }
910 
914  function addTerm()
915  {
916  global $lng, $ilCtrl;
917 
918  if (trim($_POST["new_term"]) == "")
919  {
920  ilUtil::sendFailure($lng->txt("cont_please_enter_a_term"), true);
921  $ilCtrl->redirect($this, "listTerms");
922  }
923 
924  // add term
925  include_once ("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
926  $term =& new ilGlossaryTerm();
927  $term->setGlossary($this->object);
928  $term->setTerm(ilUtil::stripSlashes($_POST["new_term"]));
929  $term->setLanguage($_POST["term_language"]);
930  $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["term_language"];
931  $term->create();
932 
933  // add first definition
934  $def =& new ilGlossaryDefinition();
935  $def->setTermId($term->getId());
936  $def->setTitle(ilUtil::stripSlashes($_POST["new_term"]));
937  $def->create();
938 
939  $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term->getId());
940  $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def->getId());
941  $this->ctrl->redirectByClass(array("ilglossarytermgui",
942  "iltermdefinitioneditorgui", "ilpageobjectgui"), "edit");
943  }
944 
948  function moveDefinitionUp()
949  {
950  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
951 
952  $definition =& new ilGlossaryDefinition($_GET["def"]);
953  $definition->moveUp();
954 
955  $this->ctrl->redirect($this, "listTerms");
956  }
957 
962  {
963  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
964 
965  $definition =& new ilGlossaryDefinition($_GET["def"]);
966  $definition->moveDown();
967 
968  $this->ctrl->redirect($this, "listTerms");
969  }
970 
975  {
976  global $ilCtrl, $lng;
977 
978  //$this->getTemplate();
979  //$this->displayLocator();
980  //$this->setTabs();
981 
982  $term = new ilGlossaryTerm($this->term_id);
983 
984  $add = "";
985  $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id);
986  if ($nr > 0)
987  {
988  $ilCtrl->setParameterByClass("ilglossarytermgui",
989  "term_id", $this->term_id);
990  $link = "[<a href='".
991  $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages").
992  "'>".$lng->txt("glo_list_usages")."</a>]";
993  $add = "<br/>".sprintf($lng->txt("glo_term_is_used_n_times"), $nr)." ".$link;
994  }
995 
996  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
997  $cgui = new ilConfirmationGUI();
998  $cgui->setHeaderText($this->lng->txt("info_delete_sure").$add);
999 
1000  $cgui->setFormAction($this->ctrl->getFormAction($this));
1001  $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion");
1002  $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition");
1003 
1004  // content style
1005  $this->setContentStyleSheet($this->tpl);
1006 
1007  // syntax style
1008  $this->tpl->setCurrentBlock("SyntaxStyle");
1009  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1011  $this->tpl->parseCurrentBlock();
1012 
1013  $definition =& new ilGlossaryDefinition($_GET["def"]);
1014  //$page =& new ilPageObject("gdf", $definition->getId());
1015  $page_gui =& new ilPageObjectGUI("gdf", $definition->getId());
1016  $page_gui->setTemplateOutput(false);
1017  $page_gui->setStyleId($this->object->getStyleSheetId());
1018  $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1019  $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1020  $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1021  $output = $page_gui->preview();
1022 
1023  $cgui->addItem("def", $_GET["def"], $term->getTerm().$output);
1024 
1025  $this->tpl->setContent($cgui->getHTML());
1026  }
1027 
1029  {
1030  $this->ctrl->redirect($this, "listTerms");
1031  }
1032 
1033 
1034  function deleteDefinition()
1035  {
1036  $definition =& new ilGlossaryDefinition($_REQUEST["def"]);
1037  $definition->delete();
1038  $this->ctrl->redirect($this, "listTerms");
1039  }
1040 
1044  function editTerm()
1045  {
1046  // deprecated
1047  }
1048 
1049 
1053  function updateTerm()
1054  {
1055  $term = new ilGlossaryTerm($this->term_id);
1056 
1057  $term->setTerm(ilUtil::stripSlashes($_POST["term"]));
1058  $term->setLanguage($_POST["term_language"]);
1059  $term->update();
1060  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1061  $this->ctrl->redirect($this, "listTerms");
1062  }
1063 
1064 
1065 
1069  function export()
1070  {
1071  require_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1072  $glo_exp = new ilGlossaryExport($this->object);
1073  $glo_exp->buildExportFile();
1074  $this->ctrl->redirectByClass("ilexportgui", "");
1075  }
1076 
1080  function exportHTML()
1081  {
1082  require_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1083  $glo_exp = new ilGlossaryExport($this->object, "html");
1084  $glo_exp->buildExportFile();
1085 //echo $this->tpl->get();
1086  $this->ctrl->redirectByClass("ilexportgui", "");
1087  }
1088 
1093  {
1094  if(!isset($_POST["file"]))
1095  {
1096  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1097  }
1098  if (count($_POST["file"]) > 1)
1099  {
1100  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1101  }
1102 
1103  $file = explode(":", $_POST["file"][0]);
1104  $export_dir = $this->object->getExportDirectory($file[0]);
1105 
1106  if ($this->object->getPublicExportFile($file[0]) ==
1107  $file[1])
1108  {
1109  $this->object->setPublicExportFile($file[0], "");
1110  }
1111  else
1112  {
1113  $this->object->setPublicExportFile($file[0], $file[1]);
1114  }
1115  $this->object->update();
1116  $this->ctrl->redirectByClass("ilexportgui", "");
1117  }
1118 
1119  /*
1120  * list all export files
1121  */
1122  function viewExportLog()
1123  {
1124  global $tree;
1125 /*
1126  $this->setTabs();
1127 
1128  //add template for view button
1129  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
1130 
1131  // create export file button
1132  $this->tpl->setCurrentBlock("btn_cell");
1133  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "exportList"));
1134  $this->tpl->setVariable("BTN_TXT", $this->lng->txt("cont_export_files"));
1135  $this->tpl->parseCurrentBlock();
1136 
1137  // load files templates
1138  $this->tpl->setVariable("ADM_CONTENT",
1139  nl2br(file_get_contents($this->object->getExportDirectory()."/export.log")));
1140 
1141  $this->tpl->parseCurrentBlock();*/
1142  }
1143 
1148  {
1149  global $ilCtrl, $lng;
1150 
1151  //$this->prepareOutput();
1152  if (!isset($_POST["id"]))
1153  {
1154  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1155  $ilCtrl->redirect($this, "listTerms");
1156  }
1157 
1158  // check ids
1159  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1160  foreach ($_POST["id"] as $term_id)
1161  {
1162  $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1163  if ($term_glo_id != $this->object->getId())
1164  {
1165  ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1166  $ilCtrl->redirect($this, "listTerms");
1167  }
1168  }
1169 
1170  // display confirmation message
1171  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1172  $cgui = new ilConfirmationGUI();
1173  $cgui->setFormAction($this->ctrl->getFormAction($this));
1174  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1175  $cgui->setCancel($this->lng->txt("cancel"), "cancelTermDeletion");
1176  $cgui->setConfirm($this->lng->txt("confirm"), "deleteTerms");
1177 
1178  foreach($_POST["id"] as $id)
1179  {
1180  $term = new ilGlossaryTerm($id);
1181 
1182  $add = "";
1184  if ($nr > 0)
1185  {
1186  $ilCtrl->setParameterByClass("ilglossarytermgui",
1187  "term_id", $id);
1188  $link = "[<a href='".
1189  $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages").
1190  "'>".$lng->txt("glo_list_usages")."</a>]";
1191  $add = "<div class='small'>".
1192  sprintf($lng->txt("glo_term_is_used_n_times"), $nr)." ".$link."</div>";
1193  }
1194 
1195  $cgui->addItem("id[]", $id, $term->getTerm().$add);
1196  }
1197 
1198  $this->tpl->setContent($cgui->getHTML());
1199  }
1200 
1207  {
1208  $this->ctrl->redirect($this, "listTerms");
1209  }
1210 
1214  function deleteTerms()
1215  {
1216  foreach($_POST["id"] as $id)
1217  {
1218  $term = new ilGlossaryTerm($id);
1219  $term->delete();
1220  }
1221  $this->ctrl->redirect($this, "listTerms");
1222  }
1223 
1231  function setLocator($a_tree = "", $a_id = "")
1232  {
1233  if(strtolower($_GET["baseClass"]) != "ilglossaryeditorgui")
1234  {
1235  parent::setLocator($a_tree, $a_id);
1236  }
1237  else
1238  {
1239  if(is_object($this->object))
1240  {
1241  require_once("./Modules/Glossary/classes/class.ilGlossaryLocatorGUI.php");
1242  $gloss_loc =& new ilGlossaryLocatorGUI();
1243  if (is_object($this->term))
1244  {
1245  $gloss_loc->setTerm($this->term);
1246  }
1247  $gloss_loc->setGlossary($this->object);
1248  //$gloss_loc->setDefinition($this->definition);
1249  $gloss_loc->display();
1250  }
1251  }
1252 
1253  }
1254 
1258  function view()
1259  {
1260  //$this->prepareOutput();
1261  $this->viewObject();
1262  }
1263 
1267  function create()
1268  {
1269  switch($_POST["new_type"])
1270  {
1271  case "term":
1272  $term_gui =& new ilGlossaryTermGUI();
1273  $term_gui->create();
1274  break;
1275  }
1276  }
1277 
1278  function saveTerm()
1279  {
1280  $term_gui =& new ilGlossaryTermGUI();
1281  $term_gui->setGlossary($this->object);
1282  $term_gui->save();
1283 
1284  ilUtil::sendSuccess($this->lng->txt("cont_added_term"),true);
1285 
1286  //ilUtil::redirect("glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
1287  $ilCtrl->redirect($this, "listTerms");
1288  }
1289 
1290 
1294  function addDefinition()
1295  {
1296  global $ilCtrl;
1297 
1298  if (count($_POST["id"]) < 1)
1299  {
1300  ilUtil::sendFailure($this->lng->txt("cont_select_term"), true);
1301  $ilCtrl->redirect($this, "listTerms");
1302  }
1303 
1304  if (count($_POST["id"]) > 1)
1305  {
1306  ilUtil::sendFailure($this->lng->txt("cont_select_max_one_term"), true);
1307  $ilCtrl->redirect($this, "listTerms");
1308  }
1309 
1310  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1311  $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $_POST["id"][0]);
1312  if ($term_glo_id != $this->object->getId())
1313  {
1314  ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1315  $ilCtrl->redirect($this, "listTerms");
1316  }
1317 
1318  // add term
1319  include_once ("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1320  $term =& new ilGlossaryTerm($_POST["id"][0]);
1321 
1322  // add first definition
1323  $def =& new ilGlossaryDefinition();
1324  $def->setTermId($term->getId());
1325  $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
1326  $def->create();
1327 
1328  $this->ctrl->setParameterByClass("ilpageobjectgui", "term_id", $term->getId());
1329  $this->ctrl->setParameterByClass("ilpageobjectgui", "def", $def->getId());
1330  $this->ctrl->redirectByClass(array("ilglossarytermgui",
1331  "iltermdefinitioneditorgui", "ilpageobjectgui"), "edit");
1332 
1333  }
1334 
1335  function getTemplate()
1336  {
1337  $this->tpl->getStandardTemplate();
1338 
1339  $title = $this->object->getTitle();
1340 
1341 
1342  if ($this->term_id > 0)
1343  {
1344  $this->tpl->setTitle($this->lng->txt("term").": ".
1345  ilGlossaryTerm::_lookGlossaryTerm($this->term_id));
1346  }
1347  else
1348  {
1349  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo_b.png"));
1350  $this->tpl->setTitle($this->lng->txt("glo").": ".$title);
1351  }
1352  }
1353 
1357  function setTabs()
1358  {
1359  $this->getTabs($this->tabs_gui);
1360  }
1361 
1365  function getTabs(&$tabs_gui)
1366  {
1367  global $rbacsystem, $ilHelp;
1368 
1369  $ilHelp->setScreenIdComponent("glo");
1370 
1371  // list terms
1372  $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "listTerms")
1373  ? true
1374  : false;
1375  $tabs_gui->addTarget("cont_terms",
1376  $this->ctrl->getLinkTarget($this, "listTerms"), array("listTerms", ""),
1377  get_class($this), "", $force_active);
1378 
1379  $force_active = false;
1380  if ($this->ctrl->getCmd() == "showSummary" ||
1381  strtolower($this->ctrl->getNextClass()) == "ilinfoscreengui")
1382  {
1383  $force_active = true;
1384  }
1385  $tabs_gui->addTarget("info_short",
1386  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "",
1387  "ilInfoScreenGUI", "", $force_active);
1388 
1389  // properties
1390  $tabs_gui->addTarget("settings",
1391  $this->ctrl->getLinkTarget($this, "properties"), "properties",
1392  get_class($this));
1393 
1394  // meta data
1395  $tabs_gui->addTarget("meta_data",
1396  $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
1397  "", "ilmdeditorgui");
1398 
1399  // export
1400  /*$tabs_gui->addTarget("export",
1401  $this->ctrl->getLinkTarget($this, "exportList"),
1402  array("exportList", "viewExportLog"), get_class($this));*/
1403 
1404  // export
1405  $tabs_gui->addTarget("export",
1406  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1407  "", "ilexportgui");
1408 
1409  // permissions
1410  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
1411  {
1412  /*$tabs_gui->addTarget("permission_settings",
1413  $this->ctrl->getLinkTarget($this, "perm"),
1414  array("perm", "info"),
1415  get_class($this));
1416  */
1417  $tabs_gui->addTarget("perm_settings",
1418  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1419 
1420  }
1421 
1422  $tabs_gui->addNonTabbedLink("presentation_view",
1423  $this->lng->txt("glo_presentation_view"),
1424  "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$this->object->getRefID(),
1425  "_top"
1426  );
1427 
1428  }
1429 
1433  function setSettingsSubTabs($a_active)
1434  {
1435  global $ilTabs, $ilCtrl, $lng;
1436 
1437  if (in_array($a_active,
1438  array("general_settings", "style", "taxonomy")))
1439  {
1440  // general properties
1441  $ilTabs->addSubTab("general_settings",
1442  $lng->txt("cont_glo_properties"),
1443  $ilCtrl->getLinkTarget($this, 'properties'));
1444 
1445  // style properties
1446  $ilTabs->addSubTab("style",
1447  $lng->txt("obj_sty"),
1448  $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
1449 
1450  // taxonomy
1451  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1453  $ilTabs->addSubTab("taxonomy",
1454  $lng->txt("tax_taxonomy"),
1455  $ilCtrl->getLinkTargetByClass("ilobjtaxonomygui", 'editAOTaxonomySettings'));
1456 
1457  $ilTabs->activateSubTab($a_active);
1458  }
1459  }
1460 
1461 
1467  function _goto($a_target)
1468  {
1469  global $rbacsystem, $ilErr, $lng, $ilAccess;
1470 
1471  if ($ilAccess->checkAccess("read", "", $a_target))
1472  {
1473  $_GET["ref_id"] = $a_target;
1474  $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1475  include("ilias.php");
1476  exit;
1477  }
1478  else if ($ilAccess->checkAccess("visible", "", $a_target))
1479  {
1480  $_GET["ref_id"] = $a_target;
1481  $_GET["cmd"] = "infoScreen";
1482  $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1483  include("ilias.php");
1484  exit;
1485  }
1486  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1487  {
1488  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1489  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1491  }
1492 
1493  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1494  }
1495 
1499  function applyFilter()
1500  {
1501  global $ilTabs;
1502 
1503  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
1504  $prtab = new ilTermListTableGUI($this, "listTerms");
1505  $prtab->resetOffset();
1506  $prtab->writeFilterToSession();
1507  $this->listTerms();
1508 
1509  }
1510 
1515  function resetFilter()
1516  {
1517  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
1518  $prtab = new ilTermListTableGUI($this, "listTerms");
1519  $prtab->resetOffset();
1520  $prtab->resetFilter();
1521  $this->listTerms();
1522  }
1523 
1524 
1528 
1532  function setContentStyleSheet($a_tpl = null)
1533  {
1534  global $tpl;
1535 
1536  if ($a_tpl != null)
1537  {
1538  $ctpl = $a_tpl;
1539  }
1540  else
1541  {
1542  $ctpl = $tpl;
1543  }
1544 
1545  $ctpl->setCurrentBlock("ContentStyle");
1546  $ctpl->setVariable("LOCATION_CONTENT_STYLESHEET",
1547  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
1548  $ctpl->parseCurrentBlock();
1549  }
1550 
1551 
1556  {
1557  global $ilTabs, $tpl;
1558 
1559  $this->checkPermission("write");
1560 
1561  $this->initStylePropertiesForm();
1562  $tpl->setContent($this->form->getHTML());
1563 
1564  $ilTabs->activateTab("settings");
1565  $this->setSettingsSubTabs("style");
1566  }
1567 
1572  {
1573  global $ilCtrl, $lng, $ilTabs, $ilSetting;
1574 
1575  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1576  $lng->loadLanguageModule("style");
1577 
1578  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1579  $this->form = new ilPropertyFormGUI();
1580 
1581  $fixed_style = $ilSetting->get("fixed_content_style_id");
1582  $style_id = $this->object->getStyleSheetId();
1583 
1584  if ($fixed_style > 0)
1585  {
1586  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1587  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
1588  $this->lng->txt("global_fixed").")");
1589  $this->form->addItem($st);
1590  }
1591  else
1592  {
1593  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
1594  $_GET["ref_id"]);
1595 
1596  $st_styles[0] = $this->lng->txt("default");
1597  ksort($st_styles);
1598 
1599  if ($style_id > 0)
1600  {
1601  // individual style
1602  if (!ilObjStyleSheet::_lookupStandard($style_id))
1603  {
1604  $st = new ilNonEditableValueGUI($lng->txt("style_current_style"));
1605  $st->setValue(ilObject::_lookupTitle($style_id));
1606  $this->form->addItem($st);
1607 
1608 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1609 
1610  // delete command
1611  $this->form->addCommandButton("editStyle",
1612  $lng->txt("style_edit_style"));
1613  $this->form->addCommandButton("deleteStyle",
1614  $lng->txt("style_delete_style"));
1615 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1616  }
1617  }
1618 
1619  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1620  {
1621  $style_sel = ilUtil::formSelect ($style_id, "style_id",
1622  $st_styles, false, true);
1623  $style_sel = new ilSelectInputGUI($lng->txt("style_current_style"), "style_id");
1624  $style_sel->setOptions($st_styles);
1625  $style_sel->setValue($style_id);
1626  $this->form->addItem($style_sel);
1627 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1628  $this->form->addCommandButton("saveStyleSettings",
1629  $lng->txt("save"));
1630  $this->form->addCommandButton("createStyle",
1631  $lng->txt("sty_create_ind_style"));
1632  }
1633  }
1634  $this->form->setTitle($lng->txt("glo_style"));
1635  $this->form->setFormAction($ilCtrl->getFormAction($this));
1636  }
1637 
1641  function createStyle()
1642  {
1643  global $ilCtrl;
1644 
1645  $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1646  }
1647 
1651  function editStyle()
1652  {
1653  global $ilCtrl;
1654 
1655  $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1656  }
1657 
1661  function deleteStyle()
1662  {
1663  global $ilCtrl;
1664 
1665  $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1666  }
1667 
1672  {
1673  global $ilSetting;
1674 
1675  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1676  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1677  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1678  || $this->object->getStyleSheetId() == 0))
1679  {
1680  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1681  $this->object->update();
1682  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1683  }
1684  $this->ctrl->redirect($this, "editStyleProperties");
1685  }
1686 
1690  function getPublicAccessColValue($a_type, $a_file)
1691  {
1692  global $lng, $ilCtrl;
1693 
1694  if ($this->object->getPublicExportFile($a_type) == $a_file)
1695  {
1696  return $lng->txt("yes");
1697  }
1698 
1699  return " ";
1700  }
1701 
1702 }
1703 
1704 ?>