ILIAS  Release_5_0_x_branch Revision 61816
 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 
43  $lng->loadLanguageModule("content");
44 
45  $this->type = "glo";
46  parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, false);
47 
48  // determine term id and check whether it is valid (belongs to
49  // current glossary)
50  $this->term_id = (int) $_GET["term_id"];
51  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($this->term_id);
52  if ($this->term_id > 0 && $term_glo_id != $this->object->getId())
53  {
54  $this->term_id = "";
55  }
56 
57  $this->tax_id = $this->object->getTaxonomyId();
58  if ($this->tax_id > 0)
59  {
60  $this->ctrl->saveParameter($this, array("show_tax", "tax_node"));
61 
62  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
63  $this->tax = new ilObjTaxonomy($this->tax_id);
64  }
65  if ((int) $_GET["tax_node"] > 1 && $this->tax->getTree()->readRootId() != $_GET["tax_node"])
66  {
67  $this->tax_node = (int) $_GET["tax_node"];
68  }
69  }
70 
74  function &executeCommand()
75  {
76  global $lng, $ilAccess, $ilTabs, $ilErr;
77 
78  $cmd = $this->ctrl->getCmd();
79  $next_class = $this->ctrl->getNextClass($this);
80 
81  switch ($next_class)
82  {
83  case 'ilmdeditorgui':
84  $this->checkPermission("write");
85 
86  $this->getTemplate();
87  $this->setTabs();
88  $this->setLocator();
89  $this->addHeaderAction();
90 
91  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
92 
93  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
94  $md_gui->addObserver($this->object,'MDUpdateListener','General');
95 
96  $this->ctrl->forwardCommand($md_gui);
97  break;
98 
99  case "ilglossarytermgui":
100  $this->getTemplate();
101 // $this->quickList();
102  $this->ctrl->setReturn($this, "listTerms");
103  $term_gui =& new ilGlossaryTermGUI($this->term_id);
104  $term_gui->setGlossary($this->object);
105  //$ret =& $term_gui->executeCommand();
106  $ret =& $this->ctrl->forwardCommand($term_gui);
107  break;
108 
109  case "ilinfoscreengui":
110  $this->addHeaderAction();
111  $this->showInfoScreen();
112  break;
113 
114  case "ilobjstylesheetgui":
115  include_once ("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
116  $this->ctrl->setReturn($this, "editStyleProperties");
117  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
118  $style_gui->omitLocator();
119  if ($cmd == "create" || $_GET["new_type"]=="sty")
120  {
121  $style_gui->setCreationMode(true);
122  }
123 
124  if ($cmd == "confirmedDelete")
125  {
126  $this->object->setStyleSheetId(0);
127  $this->object->update();
128  }
129 
130  $ret = $this->ctrl->forwardCommand($style_gui);
131 
132  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
133  {
134  $style_id = $ret;
135  $this->object->setStyleSheetId($style_id);
136  $this->object->update();
137  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
138  }
139  break;
140 
141 
142  case 'ilpermissiongui':
143  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
144  {
145  $this->prepareOutput();
146  }
147  else
148  {
149  $this->getTemplate();
150  $this->setTabs();
151  $this->setLocator();
152  $this->addHeaderAction();
153  }
154  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
155  $perm_gui =& new ilPermissionGUI($this);
156  $ret =& $this->ctrl->forwardCommand($perm_gui);
157  break;
158 
159  case "ilcommonactiondispatchergui":
160  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
162  $this->ctrl->forwardCommand($gui);
163  break;
164 
165  case "ilobjtaxonomygui":
166  $this->getTemplate();
167  $this->setTabs();
168  $this->setLocator();
169  $this->addHeaderAction();
170  $ilTabs->activateTab("settings");
171  $this->setSettingsSubTabs("taxonomy");
172 
173  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php");
174  $this->ctrl->setReturn($this, "properties");
175  $tax_gui = new ilObjTaxonomyGUI();
176  $tax_gui->setMultiple(false);
177 
178  /*include_once("./Modules/Glossary/classes/class.ilTermTaxInfo.php");
179  $term_info = new ilTermTaxInfo();*/
180  //$tax_gui->activateAssignedItemSorting($term_info, "glo", "term");
181 
182  $tax_gui->setAssignedObject($this->object->getId());
183  $ret = $this->ctrl->forwardCommand($tax_gui);
184  break;
185 
186  case "ilexportgui":
187  $this->getTemplate();
188  $this->setTabs();
189  $ilTabs->activateTab("export");
190  $this->setLocator();
191  include_once("./Services/Export/classes/class.ilExportGUI.php");
192  $exp_gui = new ilExportGUI($this);
193  //$exp_gui->addFormat("xml", "", $this, "export");
194  $exp_gui->addFormat("xml");
195  $exp_gui->addFormat("html", "", $this, "exportHTML");
196  $exp_gui->addCustomColumn($lng->txt("cont_public_access"),
197  $this, "getPublicAccessColValue");
198  $exp_gui->addCustomMultiCommand($lng->txt("cont_public_access"),
199  $this, "publishExportFile");
200  $ret = $this->ctrl->forwardCommand($exp_gui);
201  break;
202 
203  case 'ilobjectcopygui':
204  $this->prepareOutput();
205  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
206  $cp = new ilObjectCopyGUI($this);
207  $cp->setType('glo');
208  $this->ctrl->forwardCommand($cp);
209  break;
210 
211  default:
212  $cmd = $this->ctrl->getCmd("listTerms");
213 
214  if (($cmd == "create") && ($_POST["new_type"] == "term"))
215  {
216  $this->ctrl->setCmd("create");
217  $this->ctrl->setCmdClass("ilGlossaryTermGUI");
218  $ret =& $this->executeCommand();
219  return;
220  }
221  else
222  {
223  if (!in_array($cmd, array("frameset", "quickList")))
224  {
225  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
226  $this->getCreationMode() == true)
227  {
228  $this->prepareOutput();
229  $cmd.= "Object";
230  }
231  else
232  {
233  $this->getTemplate();
234  $this->setTabs();
235  $this->setLocator();
236  $this->addHeaderAction();
237 
238  if($cmd == "redrawHeaderAction")
239  {
240  $cmd = "redrawHeaderActionObject";
241  }
242  }
243  }
244  $ret =& $this->$cmd();
245  }
246  break;
247  }
248 
249  if (!in_array($cmd, array("frameset", "quickList")))
250  {
251  if (strtolower($_GET["baseClass"]) != "iladministrationgui")
252  {
253  if (!$this->getCreationMode())
254  {
255  $this->tpl->show();
256  }
257  }
258  }
259  else
260  {
261  $this->tpl->show(false);
262  }
263  }
264 
265  function assignObject()
266  {
267  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
268 
269  $this->object =& new ilObjGlossary($this->id, true);
270  }
271 
272  /*protected function initCreationForms($a_new_type)
273  {
274  $forms = array(
275  self::CFORM_NEW => $this->initCreateForm($a_new_type),
276  self::CFORM_IMPORT => $this->initImportForm($a_new_type)
277  );
278 
279  return $forms;
280  }*/
281 
282  function initCreateForm($a_new_type)
283  {
284  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
285  $form = new ilPropertyFormGUI();
286  $form->setTarget("_top");
287  $form->setFormAction($this->ctrl->getFormAction($this));
288  $form->setTitle($this->lng->txt($a_new_type."_new"));
289 
290  // title
291  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
292  $ti->setSize(min(40, ilObject::TITLE_LENGTH));
293  $ti->setMaxLength(ilObject::TITLE_LENGTH);
294  $ti->setRequired(true);
295  $form->addItem($ti);
296 
297  // description
298  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
299  $ta->setCols(40);
300  $ta->setRows(2);
301  $form->addItem($ta);
302 
303  // mode
304  $stati = array(
305  "none"=>$this->lng->txt("glo_mode_normal"),
306  "level"=>$this->lng->txt("glo_mode_level"),
307  "subtree"=>$this->lng->txt("glo_mode_subtree")
308  );
309  $tm = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
310  $tm->setOptions($stati);
311  $tm->setInfo($this->lng->txt("glo_mode_desc"));
312  $tm->setRequired(true);
313  $form->addItem($tm);
314 
315  $form->addCommandButton("save", $this->lng->txt($a_new_type."_add"));
316  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
317 
318  return $form;
319  }
320 
321  function importObject()
322  {
323  $this->createObject();
324  }
325 
329  function saveObject()
330  {
331  global $tpl;
332 
333  $new_type = $_REQUEST["new_type"];
334 
335  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
336  if (!$this->checkPermissionBool("create", "", $new_type))
337  {
338  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
339  }
340 
341  $this->lng->loadLanguageModule($new_type);
342  $this->ctrl->setParameter($this, "new_type", $new_type);
343 
344  $form = $this->initCreateForm($new_type);
345  if ($form->checkInput())
346  {
347  $this->ctrl->setParameter($this, "new_type", "");
348 
349  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
350  $newObj = new ilObjGlossary();
351  $newObj->setType($new_type);
352  $newObj->setTitle($form->getInput("title"));
353  $newObj->setDescription($form->getInput("desc"));
354  $newObj->setVirtualMode($form->getInput("glo_mode"));
355  $newObj->create();
356 
357  $this->putObjectInTree($newObj);
358 
359  // always send a message
360  ilUtil::sendSuccess($this->lng->txt("glo_added"),true);
361  ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
362  }
363 
364  // display only this form to correct input
365  $form->setValuesByPost();
366  $tpl->setContent($form->getHtml());
367  }
368 
375  function importFileObject()
376  {
377  global $tpl, $ilErr;
378 
379  $new_type = $_REQUEST["new_type"];
380 
381  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
382  if (!$this->checkPermissionBool("create", "", $new_type))
383  {
384  $ilErr->raiseError($this->lng->txt("no_create_permission"));
385  }
386 
387  $this->lng->loadLanguageModule($new_type);
388  $this->ctrl->setParameter($this, "new_type", $new_type);
389 
390  $form = $this->initImportForm($new_type);
391  if ($form->checkInput())
392  {
393  $this->ctrl->setParameter($this, "new_type", "");
394  $upload = $_FILES["importfile"];
395 
396  // create and insert object in objecttree
397  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
398  $newObj = new ilObjGlossary();
399  $newObj->setType($new_type);
400  $newObj->setTitle($upload["name"]);
401  $newObj->create(true);
402 
403  $this->putObjectInTree($newObj);
404 
405  // create import directory
406  $newObj->createImportDirectory();
407 
408  // copy uploaded file to import directory
409  $file = pathinfo($upload["name"]);
410  $full_path = $newObj->getImportDirectory()."/".$upload["name"];
411 
412  ilUtil::moveUploadedFile($upload["tmp_name"], $upload["name"],
413  $full_path);
414 
415  // unzip file
416  ilUtil::unzip($full_path);
417 
418  // determine filename of xml file
419  $subdir = basename($file["basename"],".".$file["extension"]);
420  $xml_file = $newObj->getImportDirectory()."/".$subdir."/".$subdir.".xml";
421 
422  // check whether this is a new export file.
423  // this is the case if manifest.xml exits
424 //echo "1-".$newObj->getImportDirectory()."/".$subdir."/manifest.xml"."-";
425  if (is_file($newObj->getImportDirectory()."/".$subdir."/manifest.xml"))
426  {
427  include_once("./Services/Export/classes/class.ilImport.php");
428  $imp = new ilImport((int) $_GET["ref_id"]);
429  $map = $imp->getMapping();
430  $map->addMapping("Modules/Glossary", "glo", "new_id", $newObj->getId());
431  $imp->importObject($newObj, $full_path, $upload["name"], "glo",
432  "Modules/Glossary", true);
433  ilUtil::sendSuccess($this->lng->txt("glo_added"),true);
434  ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
435  }
436 
437  // check whether subdirectory exists within zip file
438  if (!is_dir($newObj->getImportDirectory()."/".$subdir))
439  {
440  $this->ilias->raiseError(sprintf($this->lng->txt("cont_no_subdir_in_zip"), $subdir),
441  $this->ilias->error_obj->MESSAGE);
442  }
443 
444  // check whether xml file exists within zip file
445  if (!is_file($xml_file))
446  {
447  $this->ilias->raiseError(sprintf($this->lng->txt("cont_zip_file_invalid"), $subdir."/".$subdir.".xml"),
448  $this->ilias->error_obj->MESSAGE);
449  }
450 
451  include_once ("./Modules/LearningModule/classes/class.ilContObjParser.php");
452  $contParser = new ilContObjParser($newObj, $xml_file, $subdir);
453  $contParser->startParsing();
454  ilObject::_writeImportId($newObj->getId(), $newObj->getImportId());
455 
456  // delete import directory
457  ilUtil::delDir($newObj->getImportDirectory());
458 
459  ilUtil::sendSuccess($this->lng->txt("glo_added"),true);
460  ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
461  }
462 
463  // display form to correct errors
464  $form->setValuesByPost();
465  $tpl->setContent($form->getHtml());
466  }
467 
474  function showInfoScreen()
475  {
476  global $ilAccess;
477 
478  $this->getTemplate();
479  $this->setTabs();
480  $this->setLocator();
481  $this->lng->loadLanguageModule("meta");
482  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
483 
484  $info = new ilInfoScreenGUI($this);
485  $info->enablePrivateNotes();
486  $info->enableNews();
487  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
488  {
489  $info->enableNewsEditing();
490  $news_set = new ilSetting("news");
491  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
492  if ($enable_internal_rss)
493  {
494  $info->setBlockProperty("news", "settings", true);
495  }
496  }
497  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
498 
499  ilObjGlossaryGUI::addUsagesToInfo($info, $this->object->getId());
500 
501  $this->ctrl->forwardCommand($info);
502  }
503 
510  function addUsagesToInfo($info, $glo_id)
511  {
512  global $lng, $ilAccess;
513 
514  $info->addSection($lng->txt("glo_usages"));
515  include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
517  foreach ($sms as $sm)
518  {
519  $link = false;
520  $refs = ilObject::_getAllReferences($sm);
521  foreach ($refs as $ref)
522  {
523  if ($link === false)
524  {
525  if ($ilAccess->checkAccess("write", "", $ref))
526  {
527  include_once("./Services/Link/classes/class.ilLink.php");
528  $link = ilLink::_getLink($ref,'sahs');
529  }
530  }
531  }
532 
533  $entry = ilObject::_lookupTitle($sm);
534  if ($link !== false)
535  {
536  $entry = "<a href='".$link."' target='_top'>".$entry."</a>";
537  }
538 
539  $info->addProperty($lng->txt("obj_sahs"), $entry);
540  }
541  }
542 
543 
544  function viewObject()
545  {
546  global $rbacsystem;
547 
548  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
549  {
551  return;
552  }
553 
554  if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
555  {
556  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
557  }
558 
559  }
560 
566  function properties()
567  {
568  global $tpl;
569 
570  $this->checkPermission("write");
571 
572  $this->setSettingsSubTabs("general_settings");
573 
574  $this->initSettingsForm();
575 
576  // Edit ecs export settings
577  include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
578  $ecs = new ilECSGlossarySettings($this->object);
579  $ecs->addSettingsToForm($this->form, 'glo');
580 
581  $tpl->setContent($this->form->getHTML());
582  }
583 
589  public function initSettingsForm($a_mode = "edit")
590  {
591  global $lng, $ilCtrl;
592 
593  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
594  $this->form = new ilPropertyFormGUI();
595 
596  // title
597  $title = new ilTextInputGUI($lng->txt("title"), "title");
598  $title->setRequired(true);
599  $this->form->addItem($title);
600 
601  // description
602  $desc = new ilTextAreaInputGUI($lng->txt("desc"), "description");
603  $this->form->addItem($desc);
604 
605  $lng->loadLanguageModule("rep");
607  $section->setTitle($this->lng->txt('rep_activation_availability'));
608  $this->form->addItem($section);
609 
610  // online
611  $online = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
612  $online->setValue("y");
613  $online->setInfo($lng->txt("glo_online_info"));
614  $this->form->addItem($online);
615 
617  $section->setTitle($this->lng->txt('glo_content_settings'));
618  $this->form->addItem($section);
619 
620  // glossary mode
621  $glo_mode = new ilRadioGroupInputGUI($lng->txt("glo_mode"), "glo_mode");
622  //$glo_mode->setInfo($lng->txt("glo_mode_desc"));
623  $op1 = new ilRadioOption($lng->txt("glo_mode_normal"), "none",$lng->txt("glo_mode_normal_info"));
624  $glo_mode->addOption($op1);
625  $op2 = new ilRadioOption($lng->txt("glo_mode_level"), "level",$lng->txt("glo_mode_level_info"));
626  $glo_mode->addOption($op2);
627  $op3 = new ilRadioOption($lng->txt("glo_mode_subtree"), "subtree",$lng->txt("glo_mode_subtree_info"));
628  $glo_mode->addOption($op3);
629  $this->form->addItem($glo_mode);
630 
631  // glossary mode
632  /*$options = array(
633  "none"=>$this->lng->txt("glo_mode_normal"),
634  "level"=>$this->lng->txt("glo_mode_level"),
635  "subtree"=>$this->lng->txt("glo_mode_subtree")
636  );
637  $glo_mode = new ilSelectInputGUI($lng->txt("glo_mode"), "glo_mode");
638  $glo_mode->setOptions($options);
639  $glo_mode->setInfo($lng->txt("glo_mode_desc"));
640  $this->form->addItem($glo_mode);*/
641 
642 
644  $section->setTitle($this->lng->txt('cont_presentation'));
645  $this->form->addItem($section);
646 
647  // presentation mode
648  $pres_mode = new ilRadioGroupInputGUI($lng->txt("glo_presentation_mode"), "pres_mode");
649  $pres_mode->setValue("table");
650  $op1 = new ilRadioOption($lng->txt("glo_table_form"), "table", $lng->txt("glo_table_form_info"));
651 
652  // short text length
653  $snl = new ilNumberInputGUI($lng->txt("glo_text_snippet_length"), "snippet_length");
654  $snl->setMaxValue(3000);
655  $snl->setMinValue(100);
656  $snl->setMaxLength(4);
657  $snl->setSize(4);
658  $snl->setInfo($lng->txt("glo_text_snippet_length_info"));
659  $snl->setValue(200);
660  $op1->addSubItem($snl);
661 
662  $pres_mode->addOption($op1);
663  $op2 = new ilRadioOption($lng->txt("glo_full_definitions"), "full_def", $lng->txt("glo_full_definitions_info"));
664  $pres_mode->addOption($op2);
665  $this->form->addItem($pres_mode);
666 
667  // show taxonomy
668  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
669  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
670  if (count($tax_ids) > 0)
671  {
672  $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
673  $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info"));
674  $this->form->addItem($show_tax);
675  }
676 
677  // downloads
678  $down = new ilCheckboxInputGUI($lng->txt("cont_downloads"), "glo_act_downloads");
679  $down->setValue("y");
680  $down->setInfo($lng->txt("cont_downloads_desc"));
681  $this->form->addItem($down);
682 
683  if ($a_mode == "edit")
684  {
685  $title->setValue($this->object->getTitle());
686  $desc->setValue($this->object->getDescription());
687  $online->setChecked($this->object->getOnline());
688  $glo_mode->setValue($this->object->getVirtualMode());
689  $pres_mode->setValue($this->object->getPresentationMode());
690  $snl->setValue($this->object->getSnippetLength());
691  if (count($tax_ids) > 0)
692  {
693  $show_tax->setChecked($this->object->getShowTaxonomy());
694  }
695 
696  $down->setChecked($this->object->isActiveDownloads());
697  }
698 
699  // advanced metadata
700  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
701  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_REC_SELECTION,'glo',$this->object->getId(), "term");
702  $record_gui->setPropertyForm($this->form);
703  $record_gui->parseRecordSelection($this->lng->txt("glo_add_term_properties"));
704 
705  // sort columns, if adv fields are given
706  include_once("./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php");
707  $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getId());
708  $cols = $adv_ap->getColumnOrder();
709  if (count($cols) > 1)
710  {
711  include_once './Modules/Glossary/classes/class.ilGloAdvColSortInputGUI.php';
712  $ti = new ilGloAdvColSortInputGUI($lng->txt("cont_col_ordering"), "field_order");
713  $this->form->addItem($ti);
714  $ti->setValue($cols);
715  }
716 
717  // save and cancel commands
718  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
719 
720  $this->form->setTitle($lng->txt("cont_glo_properties"));
721  $this->form->setFormAction($ilCtrl->getFormAction($this));
722  }
723 
724 
728  function saveProperties()
729  {
730  global $tpl;
731 
732  $this->initSettingsForm();
733  if ($this->form->checkInput())
734  {
735  $this->object->setTitle($_POST['title']);
736  $this->object->setDescription($_POST['description']);
737  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
738  $this->object->setVirtualMode($_POST["glo_mode"]);
739 // $this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
740  $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
741  $this->object->setPresentationMode($_POST["pres_mode"]);
742  $this->object->setSnippetLength($_POST["snippet_length"]);
743  $this->object->setShowTaxonomy($_POST["show_tax"]);
744  $this->object->update();
745 
746  // field order of advanced metadata
747  include_once("./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php");
748  $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getId());
749  $cols = $adv_ap->getColumnOrder();
750  if (count($cols) > 1)
751  {
752  $adv_ap->saveColumnOrder($_POST["field_order"]);
753  }
754 
755  // set definition short texts dirty
756  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
757  ilGlossaryDefinition::setShortTextsDirty($this->object->getId());
758 
759  // update metadata record selection
760  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
761  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_REC_SELECTION,'glo',$this->object->getId(), "term");
762  $record_gui->saveSelection();
763 
764  // Update ecs export settings
765  include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
766  $ecs = new ilECSGlossarySettings($this->object);
767  if($ecs->handleSettingsUpdate())
768  {
769  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
770  $this->ctrl->redirect($this, "properties");
771  }
772 
773  }
774  $this->form->setValuesByPost();
775  $tpl->setContent($this->form->getHTML());
776  }
777 
781  function frameset()
782  {
783  global $ilCtrl;
784 
785  include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
786  $fs_gui = new ilFramesetGUI();
787  $fs_gui->setFramesetTitle($this->object->getTitle());
788  if ((int) $_GET["edit_term"] > 0)
789  {
790  $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", (int) $_GET["edit_term"]);
791  $fs_gui->setMainFrameSource($this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listDefinitions"));
792  }
793  else
794  {
795  $fs_gui->setMainFrameSource($this->ctrl->getLinkTarget($this, "listTerms"));
796  }
797  $fs_gui->setSideFrameSource($this->ctrl->getLinkTarget($this, "quickList"));
798  $fs_gui->setMainFrameName("content");
799  $fs_gui->setSideFrameName("tree");
800  $fs_gui->show();
801  exit;
802  }
803 
807  function quickList()
808  {
809  global $ilUser, $tpl;
810 
811  }
812 
813 
817  function listTerms()
818  {
819  global $ilUser, $ilToolbar, $lng, $ilCtrl, $tpl;
820 
821  if ($_GET["show_tax"])
822  {
823  $this->showTaxonomy();
824  }
825 
826  // term
827  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
828  $ti = new ilTextInputGUI($lng->txt("cont_new_term"), "new_term");
829  $ti->setMaxLength(80);
830  $ti->setSize(20);
831  $ilToolbar->addInputItem($ti, true);
832 
833  // language
834  $this->lng->loadLanguageModule("meta");
836  if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
837  {
838  $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
839  }
840  else
841  {
842  $s_lang = $ilUser->getLanguage();
843  }
844  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
845  $si = new ilSelectInputGUI($lng->txt("language"), "term_language");
846  $si->setOptions($lang);
847  $si->setValue($s_lang);
848  $ilToolbar->addInputItem($si, true);
849 
850  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
851  $ilToolbar->addFormButton($lng->txt("glo_add_new_term"), "addTerm");
852  //$select_language = ilUtil::formSelect ($s_lang, "term_language",$lang,false,true);
853  //$this->tpl->setVariable("SELECT_LANGUAGE", $select_language);
854 
855  if (is_object($this->tax))
856  {
857  $ilToolbar->addSeparator();
858  if ($_GET["show_tax"])
859  {
860  $ilToolbar->addButton($lng->txt("glo_hide_taxonomy"),
861  $ilCtrl->getLinkTarget($this, "deactTaxonomy"));
862  }
863  else
864  {
865  $ilToolbar->addButton($lng->txt("glo_show_taxonomy"),
866  $ilCtrl->getLinkTarget($this, "actTaxonomy"));
867  }
868  }
869 
870  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
871  $tab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
872  $tpl->setContent($tab->getHTML());
873  }
874 
881  function actTaxonomy()
882  {
883  global $ilCtrl;
884 
885  $ilCtrl->setParameter($this, "show_tax", 1);
886  $ilCtrl->redirect($this, "listTerms");
887  }
888 
895  function deactTaxonomy()
896  {
897  global $ilCtrl;
898 
899  $ilCtrl->setParameter($this, "show_tax", "");
900  $ilCtrl->redirect($this, "listTerms");
901  }
902 
903 
909  function showActions($a_actions)
910  {
911  foreach ($a_actions as $name => $lng)
912  {
913  $d[$name] = array("name" => $name, "lng" => $lng);
914  }
915 
916  $notoperations = array();
917  $operations = array();
918 
919  $operations = $d;
920 
921  if (count($operations) > 0)
922  {
923  foreach ($operations as $val)
924  {
925  $this->tpl->setCurrentBlock("tbl_action_btn");
926  $this->tpl->setVariable("BTN_NAME", $val["name"]);
927  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
928  $this->tpl->parseCurrentBlock();
929  }
930 
931  $this->tpl->setCurrentBlock("tbl_action_row");
932  $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.svg"));
933  $this->tpl->parseCurrentBlock();
934  }
935  }
936 
940  function addTerm()
941  {
942  global $lng, $ilCtrl;
943 
944  if (trim($_POST["new_term"]) == "")
945  {
946  ilUtil::sendFailure($lng->txt("cont_please_enter_a_term"), true);
947  $ilCtrl->redirect($this, "listTerms");
948  }
949 
950  // add term
951  include_once ("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
952  $term =& new ilGlossaryTerm();
953  $term->setGlossary($this->object);
954  $term->setTerm(ilUtil::stripSlashes($_POST["new_term"]));
955  $term->setLanguage($_POST["term_language"]);
956  $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["term_language"];
957  $term->create();
958 
959  // add first definition
960  $def =& new ilGlossaryDefinition();
961  $def->setTermId($term->getId());
962  $def->setTitle(ilUtil::stripSlashes($_POST["new_term"]));
963  $def->create();
964 
965  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
966  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
967  $this->ctrl->redirectByClass(array("ilglossarytermgui",
968  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
969  }
970 
974  function moveDefinitionUp()
975  {
976  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
977 
978  $definition =& new ilGlossaryDefinition($_GET["def"]);
979  $definition->moveUp();
980 
981  $this->ctrl->redirect($this, "listTerms");
982  }
983 
988  {
989  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
990 
991  $definition =& new ilGlossaryDefinition($_GET["def"]);
992  $definition->moveDown();
993 
994  $this->ctrl->redirect($this, "listTerms");
995  }
996 
1001  {
1002  global $ilCtrl, $lng;
1003 
1004  //$this->getTemplate();
1005  //$this->displayLocator();
1006  //$this->setTabs();
1007 
1008  $term = new ilGlossaryTerm($this->term_id);
1009 
1010  $add = "";
1011  $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id);
1012  if ($nr > 0)
1013  {
1014  $ilCtrl->setParameterByClass("ilglossarytermgui",
1015  "term_id", $this->term_id);
1016  $link = "[<a href='".
1017  $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages").
1018  "'>".$lng->txt("glo_list_usages")."</a>]";
1019  $add = "<br/>".sprintf($lng->txt("glo_term_is_used_n_times"), $nr)." ".$link;
1020  }
1021 
1022  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1023  $cgui = new ilConfirmationGUI();
1024  $cgui->setHeaderText($this->lng->txt("info_delete_sure").$add);
1025 
1026  $cgui->setFormAction($this->ctrl->getFormAction($this));
1027  $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion");
1028  $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition");
1029 
1030  // content style
1031  $this->setContentStyleSheet($this->tpl);
1032 
1033  // syntax style
1034  $this->tpl->setCurrentBlock("SyntaxStyle");
1035  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1037  $this->tpl->parseCurrentBlock();
1038 
1039  $definition = new ilGlossaryDefinition($_GET["def"]);
1040  $page_gui = new ilGlossaryDefPageGUI($definition->getId());
1041  $page_gui->setTemplateOutput(false);
1042  $page_gui->setStyleId($this->object->getStyleSheetId());
1043  $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1044  $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1045  $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1046  $output = $page_gui->preview();
1047 
1048  $cgui->addItem("def", $_GET["def"], $term->getTerm().$output);
1049 
1050  $this->tpl->setContent($cgui->getHTML());
1051  }
1052 
1054  {
1055  $this->ctrl->redirect($this, "listTerms");
1056  }
1057 
1058 
1059  function deleteDefinition()
1060  {
1061  $definition =& new ilGlossaryDefinition($_REQUEST["def"]);
1062  $definition->delete();
1063  $this->ctrl->redirect($this, "listTerms");
1064  }
1065 
1069  function editTerm()
1070  {
1071  // deprecated
1072  }
1073 
1074 
1078  function updateTerm()
1079  {
1080  $term = new ilGlossaryTerm($this->term_id);
1081 
1082  $term->setTerm(ilUtil::stripSlashes($_POST["term"]));
1083  $term->setLanguage($_POST["term_language"]);
1084  $term->update();
1085  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1086  $this->ctrl->redirect($this, "listTerms");
1087  }
1088 
1089 
1090 
1094  function export()
1095  {
1096  $this->checkPermission("write");
1097 
1098  require_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1099  $glo_exp = new ilGlossaryExport($this->object);
1100  $glo_exp->buildExportFile();
1101  $this->ctrl->redirectByClass("ilexportgui", "");
1102  }
1103 
1107  function exportHTML()
1108  {
1109  require_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1110  $glo_exp = new ilGlossaryExport($this->object, "html");
1111  $glo_exp->buildExportFile();
1112 //echo $this->tpl->get();
1113  $this->ctrl->redirectByClass("ilexportgui", "");
1114  }
1115 
1120  {
1121  if(!isset($_POST["file"]))
1122  {
1123  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1124  }
1125  if (count($_POST["file"]) > 1)
1126  {
1127  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1128  }
1129 
1130  $file = explode(":", $_POST["file"][0]);
1131  $export_dir = $this->object->getExportDirectory($file[0]);
1132 
1133  if ($this->object->getPublicExportFile($file[0]) ==
1134  $file[1])
1135  {
1136  $this->object->setPublicExportFile($file[0], "");
1137  }
1138  else
1139  {
1140  $this->object->setPublicExportFile($file[0], $file[1]);
1141  }
1142  $this->object->update();
1143  $this->ctrl->redirectByClass("ilexportgui", "");
1144  }
1145 
1146  /*
1147  * list all export files
1148  */
1149  function viewExportLog()
1150  {
1151  }
1152 
1157  {
1158  global $ilCtrl, $lng;
1159 
1160  //$this->prepareOutput();
1161  if (!isset($_POST["id"]))
1162  {
1163  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1164  $ilCtrl->redirect($this, "listTerms");
1165  }
1166 
1167  // check ids
1168  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1169  foreach ($_POST["id"] as $term_id)
1170  {
1171  $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1172  if ($term_glo_id != $this->object->getId())
1173  {
1174  ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1175  $ilCtrl->redirect($this, "listTerms");
1176  }
1177  }
1178 
1179  // display confirmation message
1180  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1181  $cgui = new ilConfirmationGUI();
1182  $cgui->setFormAction($this->ctrl->getFormAction($this));
1183  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1184  $cgui->setCancel($this->lng->txt("cancel"), "cancelTermDeletion");
1185  $cgui->setConfirm($this->lng->txt("confirm"), "deleteTerms");
1186 
1187  foreach($_POST["id"] as $id)
1188  {
1189  $term = new ilGlossaryTerm($id);
1190 
1191  $add = "";
1193  if ($nr > 0)
1194  {
1195  $ilCtrl->setParameterByClass("ilglossarytermgui",
1196  "term_id", $id);
1197  $link = "[<a href='".
1198  $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages").
1199  "'>".$lng->txt("glo_list_usages")."</a>]";
1200  $add = "<div class='small'>".
1201  sprintf($lng->txt("glo_term_is_used_n_times"), $nr)." ".$link."</div>";
1202  }
1203 
1204  $cgui->addItem("id[]", $id, $term->getTerm().$add);
1205  }
1206 
1207  $this->tpl->setContent($cgui->getHTML());
1208  }
1209 
1216  {
1217  $this->ctrl->redirect($this, "listTerms");
1218  }
1219 
1223  function deleteTerms()
1224  {
1225  foreach($_POST["id"] as $id)
1226  {
1227  $term = new ilGlossaryTerm($id);
1228  $term->delete();
1229  }
1230  $this->ctrl->redirect($this, "listTerms");
1231  }
1232 
1240  function setLocator($a_tree = "", $a_id = "")
1241  {
1242  if(strtolower($_GET["baseClass"]) != "ilglossaryeditorgui")
1243  {
1244  parent::setLocator($a_tree, $a_id);
1245  }
1246  else
1247  {
1248  if(is_object($this->object))
1249  {
1250  require_once("./Modules/Glossary/classes/class.ilGlossaryLocatorGUI.php");
1251  $gloss_loc =& new ilGlossaryLocatorGUI();
1252  if (is_object($this->term))
1253  {
1254  $gloss_loc->setTerm($this->term);
1255  }
1256  $gloss_loc->setGlossary($this->object);
1257  //$gloss_loc->setDefinition($this->definition);
1258  $gloss_loc->display();
1259  }
1260  }
1261 
1262  }
1263 
1267  function view()
1268  {
1269  //$this->prepareOutput();
1270  $this->viewObject();
1271  }
1272 
1276  function create()
1277  {
1278  switch($_POST["new_type"])
1279  {
1280  case "term":
1281  $term_gui =& new ilGlossaryTermGUI();
1282  $term_gui->create();
1283  break;
1284  }
1285  }
1286 
1287  function saveTerm()
1288  {
1289  $term_gui =& new ilGlossaryTermGUI();
1290  $term_gui->setGlossary($this->object);
1291  $term_gui->save();
1292 
1293  ilUtil::sendSuccess($this->lng->txt("cont_added_term"),true);
1294 
1295  //ilUtil::redirect("glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
1296  $ilCtrl->redirect($this, "listTerms");
1297  }
1298 
1299 
1303  function addDefinition()
1304  {
1305  global $ilCtrl;
1306 
1307  $term_id = (int) $_GET["term_id"];
1308 
1309  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1310  $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1311  if ($term_glo_id != $this->object->getId())
1312  {
1313  ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1314  $ilCtrl->redirect($this, "listTerms");
1315  }
1316 
1317  // add term
1318  include_once ("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1319  $term = new ilGlossaryTerm($term_id);
1320 
1321  // add first definition
1322  $def = new ilGlossaryDefinition();
1323  $def->setTermId($term->getId());
1324  $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
1325  $def->create();
1326 
1327  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
1328  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
1329  $this->ctrl->redirectByClass(array("ilglossarytermgui",
1330  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
1331 
1332  }
1333 
1334  function getTemplate()
1335  {
1336  $this->tpl->getStandardTemplate();
1337 
1338  $title = $this->object->getTitle();
1339 
1340 
1341  if ($this->term_id > 0)
1342  {
1343  $this->tpl->setTitle($this->lng->txt("term").": ".
1344  ilGlossaryTerm::_lookGlossaryTerm($this->term_id));
1345  }
1346  else
1347  {
1349  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
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  if ($rbacsystem->checkAccess('write',$this->object->getRefId()))
1391  {
1392  $tabs_gui->addTarget("settings",
1393  $this->ctrl->getLinkTarget($this, "properties"), "properties",
1394  get_class($this));
1395 
1396  // meta data
1397  $tabs_gui->addTarget("meta_data",
1398  $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
1399  "", "ilmdeditorgui");
1400 
1401  // export
1402  /*$tabs_gui->addTarget("export",
1403  $this->ctrl->getLinkTarget($this, "exportList"),
1404  array("exportList", "viewExportLog"), get_class($this));*/
1405 
1406  // export
1407  $tabs_gui->addTarget("export",
1408  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1409  "", "ilexportgui");
1410  }
1411 
1412  // permissions
1413  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
1414  {
1415  /*$tabs_gui->addTarget("permission_settings",
1416  $this->ctrl->getLinkTarget($this, "perm"),
1417  array("perm", "info"),
1418  get_class($this));
1419  */
1420  $tabs_gui->addTarget("perm_settings",
1421  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1422 
1423  }
1424 
1425  $tabs_gui->addNonTabbedLink("presentation_view",
1426  $this->lng->txt("glo_presentation_view"),
1427  "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$this->object->getRefID(),
1428  "_top"
1429  );
1430 
1431  }
1432 
1436  function setSettingsSubTabs($a_active)
1437  {
1438  global $ilTabs, $ilCtrl, $lng;
1439 
1440  if (in_array($a_active,
1441  array("general_settings", "style", "taxonomy")))
1442  {
1443  // general properties
1444  $ilTabs->addSubTab("general_settings",
1445  $lng->txt("settings"),
1446  $ilCtrl->getLinkTarget($this, 'properties'));
1447 
1448  // style properties
1449  $ilTabs->addSubTab("style",
1450  $lng->txt("obj_sty"),
1451  $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
1452 
1453  // taxonomy
1454  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1456  $ilTabs->addSubTab("taxonomy",
1457  $lng->txt("tax_taxonomy"),
1458  $ilCtrl->getLinkTargetByClass("ilobjtaxonomygui", ''));
1459 
1460  $ilTabs->activateSubTab($a_active);
1461  }
1462  }
1463 
1464 
1470  public static function _goto($a_target)
1471  {
1472  global $rbacsystem, $ilErr, $lng, $ilAccess;
1473 
1474  if ($ilAccess->checkAccess("read", "", $a_target))
1475  {
1476  $_GET["ref_id"] = $a_target;
1477  $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1478  include("ilias.php");
1479  exit;
1480  }
1481  else if ($ilAccess->checkAccess("visible", "", $a_target))
1482  {
1483  $_GET["ref_id"] = $a_target;
1484  $_GET["cmd"] = "infoScreen";
1485  $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1486  include("ilias.php");
1487  exit;
1488  }
1489  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1490  {
1491  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1492  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1494  }
1495 
1496  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1497  }
1498 
1502  function applyFilter()
1503  {
1504  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
1505  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1506  $prtab->resetOffset();
1507  $prtab->writeFilterToSession();
1508  $this->listTerms();
1509  }
1510 
1515  function resetFilter()
1516  {
1517  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
1518  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
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 
1708  function showTaxonomy()
1709  {
1710  global $tpl, $lng;
1711 
1712  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1713  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1714  if (count($tax_ids) > 0)
1715  {
1716  include_once("./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
1717  $tax_exp = new ilTaxonomyExplorerGUI($this, "showTaxonomy", $tax_ids[0],
1718  "ilobjglossarygui", "listTerms");
1719  if (!$tax_exp->handleCommand())
1720  {
1721  //$tpl->setLeftNavContent($tax_exp->getHTML());
1722  $tpl->setLeftNavContent($tax_exp->getHTML()."&nbsp;");
1723  }
1724  }
1725 
1726  }
1727 
1728 }
1729 
1730 ?>