ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
28 {
30  var $mode;
31  var $term;
32 
36  protected $term_id;
37 
41  protected $ctrl;
42 
46  protected $user;
47 
51  protected $toolbar;
52 
56  protected $tabs;
57 
61  protected $setting;
62 
66  protected $access;
67 
71  protected $rbacsystem;
72 
76  protected $help;
77 
81  protected $term_perm;
82 
86  protected $log;
87 
92  function __construct($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
93  {
94  global $DIC;
95 
96  $this->ctrl = $DIC->ctrl();
97  $this->lng = $DIC->language();
98  $this->user = $DIC->user();
99  $this->toolbar = $DIC->toolbar();
100  $this->tabs = $DIC->tabs();
101  $this->setting = $DIC["ilSetting"];
102  $this->access = $DIC->access();
103  $this->rbacsystem = $DIC->rbac()->system();
104  $this->help = $DIC["ilHelp"];
105 
106  $this->log = ilLoggerFactory::getLogger('glo');
107 
108  include_once("./Modules/Glossary/classes/class.ilGlossaryTermPermission.php");
109  $this->term_perm = ilGlossaryTermPermission::getInstance();
110 
111  $this->ctrl->saveParameter($this, array("ref_id", "offset"));
112 
113  $this->lng->loadLanguageModule("content");
114  $this->lng->loadLanguageModule("glo");
115 
116  $this->type = "glo";
117  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
118 
119  // determine term id and check whether it is valid (belongs to
120  // current glossary)
121  $this->term_id = (int) $_GET["term_id"];
122  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($this->term_id);
123  include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
124  if ($this->term_id > 0 && $term_glo_id != $this->object->getId()
126  {
127  $this->term_id = "";
128  }
129 
130  $this->tax_id = $this->object->getTaxonomyId();
131  if ($this->tax_id > 0)
132  {
133  $this->ctrl->saveParameter($this, array("show_tax", "tax_node"));
134 
135  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
136  $this->tax = new ilObjTaxonomy($this->tax_id);
137  }
138  if ((int) $_GET["tax_node"] > 1 && $this->tax->getTree()->readRootId() != $_GET["tax_node"])
139  {
140  $this->tax_node = (int) $_GET["tax_node"];
141  }
142  }
143 
147  function executeCommand()
148  {
149  $cmd = $this->ctrl->getCmd();
150  $next_class = $this->ctrl->getNextClass($this);
151 
152  $this->log->debug("glossary term, next class ".$next_class.", cmd: ".$cmd);
153 
154  switch ($next_class)
155  {
156  case 'ilobjectmetadatagui';
157  $this->checkPermission("write");
158 
159  $this->getTemplate();
160  $this->setTabs();
161  $this->setLocator();
162  $this->addHeaderAction();
163 
164  $this->tabs_gui->activateTab('meta_data');
165  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
166  $md_gui = new ilObjectMetaDataGUI($this->object, 'term');
167  $this->ctrl->forwardCommand($md_gui);
168  break;
169 
170  case "ilglossarytermgui":
171  if (!$this->term_perm->checkPermission("edit_content", $this->term_id) &&
172  !$this->term_perm->checkPermission("write", $this->term_id))
173  {
174  include_once("./Modules/Glossary/exceptions/class.ilGlossaryException.php");
175  throw new ilGlossaryException("No permission.");
176  }
177  $this->getTemplate();
178 // $this->quickList();
179  $this->ctrl->setReturn($this, "listTerms");
180  $term_gui = new ilGlossaryTermGUI($this->term_id);
181  $term_gui->setGlossary($this->object);
182  //$ret = $term_gui->executeCommand();
183  $ret = $this->ctrl->forwardCommand($term_gui);
184  break;
185 
186  case "ilinfoscreengui":
187  $this->addHeaderAction();
188  $this->showInfoScreen();
189  break;
190 
191  case "ilobjstylesheetgui":
192  include_once ("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
193  $this->ctrl->setReturn($this, "editStyleProperties");
194  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
195  $style_gui->omitLocator();
196  if ($cmd == "create" || $_GET["new_type"]=="sty")
197  {
198  $style_gui->setCreationMode(true);
199  }
200 
201  if ($cmd == "confirmedDelete")
202  {
203  $this->object->setStyleSheetId(0);
204  $this->object->update();
205  }
206 
207  $ret = $this->ctrl->forwardCommand($style_gui);
208 
209  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
210  {
211  $style_id = $ret;
212  $this->object->setStyleSheetId($style_id);
213  $this->object->update();
214  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
215  }
216  break;
217 
218 
219  case 'ilpermissiongui':
220  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
221  {
222  $this->prepareOutput();
223  }
224  else
225  {
226  $this->getTemplate();
227  $this->setTabs();
228  $this->setLocator();
229  $this->addHeaderAction();
230  }
231  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
232  $perm_gui = new ilPermissionGUI($this);
233  $ret = $this->ctrl->forwardCommand($perm_gui);
234  break;
235 
236  case "ilcommonactiondispatchergui":
237  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
239  $this->ctrl->forwardCommand($gui);
240  break;
241 
242  case "ilobjtaxonomygui":
243  $this->getTemplate();
244  $this->setTabs();
245  $this->setLocator();
246  $this->addHeaderAction();
247  $this->tabs->activateTab("settings");
248  $this->setSettingsSubTabs("taxonomy");
249 
250  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php");
251  $this->ctrl->setReturn($this, "properties");
252  $tax_gui = new ilObjTaxonomyGUI();
253  $tax_gui->setMultiple(false);
254 
255  /*include_once("./Modules/Glossary/classes/class.ilTermTaxInfo.php");
256  $term_info = new ilTermTaxInfo();*/
257  //$tax_gui->activateAssignedItemSorting($term_info, "glo", "term");
258 
259  $tax_gui->setAssignedObject($this->object->getId());
260  $ret = $this->ctrl->forwardCommand($tax_gui);
261  break;
262 
263  case "ilexportgui":
264  $this->getTemplate();
265  $this->setTabs();
266  $this->tabs->activateTab("export");
267  $this->setLocator();
268  include_once("./Services/Export/classes/class.ilExportGUI.php");
269  $exp_gui = new ilExportGUI($this);
270  //$exp_gui->addFormat("xml", "", $this, "export");
271  $exp_gui->addFormat("xml");
272  $exp_gui->addFormat("html", "", $this, "exportHTML");
273  $exp_gui->addCustomColumn($this->lng->txt("cont_public_access"),
274  $this, "getPublicAccessColValue");
275  $exp_gui->addCustomMultiCommand($this->lng->txt("cont_public_access"),
276  $this, "publishExportFile");
277  $ret = $this->ctrl->forwardCommand($exp_gui);
278  break;
279 
280  case 'ilobjectcopygui':
281  $this->prepareOutput();
282  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
283  $cp = new ilObjectCopyGUI($this);
284  $cp->setType('glo');
285  $this->ctrl->forwardCommand($cp);
286  break;
287 
288  case "ilglossaryforeigntermcollectorgui":
289  $this->ctrl->setReturn($this, "");
290  $this->getTemplate();
291  $this->setTabs();
292  $this->setLocator();
293  $this->addHeaderAction();
294  include_once("./Modules/Glossary/classes/class.ilGlossaryForeignTermCollectorGUI.php");
296  $this->ctrl->forwardCommand($coll);
297  break;
298 
299  default:
300  $cmd = $this->ctrl->getCmd("listTerms");
301 
302  if (($cmd == "create") && ($_POST["new_type"] == "term"))
303  {
304  $this->ctrl->setCmd("create");
305  $this->ctrl->setCmdClass("ilGlossaryTermGUI");
306  $ret = $this->executeCommand();
307  return;
308  }
309  else
310  {
311  if (!in_array($cmd, array("quickList")))
312  {
313  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
314  $this->getCreationMode() == true)
315  {
316  $this->prepareOutput();
317  $cmd.= "Object";
318  }
319  else
320  {
321  $this->getTemplate();
322  $this->setTabs();
323  $this->setLocator();
324  $this->addHeaderAction();
325 
326  if($cmd == "redrawHeaderAction")
327  {
328  $cmd = "redrawHeaderActionObject";
329  }
330  }
331  }
332  $ret = $this->$cmd();
333  }
334  break;
335  }
336 
337  if (!in_array($cmd, array("quickList")))
338  {
339  if (strtolower($_GET["baseClass"]) != "iladministrationgui")
340  {
341  if (!$this->getCreationMode())
342  {
343  $this->tpl->show();
344  }
345  }
346  }
347  else
348  {
349  $this->tpl->show(false);
350  }
351  }
352 
353  function assignObject()
354  {
355  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
356 
357  $this->object = new ilObjGlossary($this->id, true);
358  }
359 
360  /*protected function initCreationForms($a_new_type)
361  {
362  $forms = array(
363  self::CFORM_NEW => $this->initCreateForm($a_new_type),
364  self::CFORM_IMPORT => $this->initImportForm($a_new_type)
365  );
366 
367  return $forms;
368  }*/
369 
370  function initCreateForm($a_new_type)
371  {
372  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
373  $form = new ilPropertyFormGUI();
374  $form->setTarget("_top");
375  $form->setFormAction($this->ctrl->getFormAction($this));
376  $form->setTitle($this->lng->txt($a_new_type."_new"));
377 
378  // title
379  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
380  $ti->setSize(min(40, ilObject::TITLE_LENGTH));
381  $ti->setMaxLength(ilObject::TITLE_LENGTH);
382  $ti->setRequired(true);
383  $form->addItem($ti);
384 
385  // description
386  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
387  $ta->setCols(40);
388  $ta->setRows(2);
389  $form->addItem($ta);
390 
391  // mode
392  $stati = array(
393  "none"=>$this->lng->txt("glo_mode_normal"),
394  "level"=>$this->lng->txt("glo_mode_level"),
395  "subtree"=>$this->lng->txt("glo_mode_subtree")
396  );
397  $tm = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
398  $tm->setOptions($stati);
399  $tm->setInfo($this->lng->txt("glo_mode_desc"));
400  $tm->setRequired(true);
401  $form->addItem($tm);
402 
403  $form->addCommandButton("save", $this->lng->txt($a_new_type."_add"));
404  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
405 
406  return $form;
407  }
408 
409  function importObject()
410  {
411  $this->createObject();
412  }
413 
417  function saveObject()
418  {
419  $new_type = $_REQUEST["new_type"];
420 
421  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
422  if (!$this->checkPermissionBool("create", "", $new_type))
423  {
424  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
425  }
426 
427  $this->lng->loadLanguageModule($new_type);
428  $this->ctrl->setParameter($this, "new_type", $new_type);
429 
430  $form = $this->initCreateForm($new_type);
431  if ($form->checkInput())
432  {
433  $this->ctrl->setParameter($this, "new_type", "");
434 
435  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
436  $newObj = new ilObjGlossary();
437  $newObj->setType($new_type);
438  $newObj->setTitle($form->getInput("title"));
439  $newObj->setDescription($form->getInput("desc"));
440  $newObj->setVirtualMode($form->getInput("glo_mode"));
441  $newObj->create();
442 
443  $this->putObjectInTree($newObj);
444 
445  // always send a message
446  ilUtil::sendSuccess($this->lng->txt("glo_added"),true);
447  ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=".$newObj->getRefId());
448  }
449 
450  // display only this form to correct input
451  $form->setValuesByPost();
452  $this->tpl->setContent($form->getHtml());
453  }
454 
461  function showInfoScreen()
462  {
463  $this->getTemplate();
464  $this->setTabs();
465  $this->setLocator();
466  $this->lng->loadLanguageModule("meta");
467  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
468 
469  $info = new ilInfoScreenGUI($this);
470  $info->enablePrivateNotes();
471  $info->enableNews();
472  if ($this->access->checkAccess("write", "", $_GET["ref_id"]))
473  {
474  $info->enableNewsEditing();
475  $news_set = new ilSetting("news");
476  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
477  if ($enable_internal_rss)
478  {
479  $info->setBlockProperty("news", "settings", true);
480  }
481  }
482  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
483 
485 
486  $this->ctrl->forwardCommand($info);
487  }
488 
495  static function addUsagesToInfo($info, $glo_id)
496  {
497  global $lng, $ilAccess;
498 
499  $info->addSection($lng->txt("glo_usages"));
500  include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
502  foreach ($sms as $sm)
503  {
504  $link = false;
505  $refs = ilObject::_getAllReferences($sm);
506  foreach ($refs as $ref)
507  {
508  if ($link === false)
509  {
510  if ($ilAccess->checkAccess("write", "", $ref))
511  {
512  include_once("./Services/Link/classes/class.ilLink.php");
513  $link = ilLink::_getLink($ref,'sahs');
514  }
515  }
516  }
517 
518  $entry = ilObject::_lookupTitle($sm);
519  if ($link !== false)
520  {
521  $entry = "<a href='".$link."' target='_top'>".$entry."</a>";
522  }
523 
524  $info->addProperty($lng->txt("obj_sahs"), $entry);
525  }
526  }
527 
528 
529  function viewObject()
530  {
531  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
532  {
533  parent::viewObject();
534  return;
535  }
536 
537  if (!$this->rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
538  {
539  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
540  }
541 
542  }
543 
549  function properties()
550  {
551  $this->checkPermission("write");
552 
553  $this->setSettingsSubTabs("general_settings");
554 
555  $this->initSettingsForm();
556 
557  // Edit ecs export settings
558  include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
559  $ecs = new ilECSGlossarySettings($this->object);
560  $ecs->addSettingsToForm($this->form, 'glo');
561 
562  $this->tpl->setContent($this->form->getHTML());
563  }
564 
570  public function initSettingsForm($a_mode = "edit")
571  {
572  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
573  $this->form = new ilPropertyFormGUI();
574 
575  // title
576  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
577  $title->setRequired(true);
578  $this->form->addItem($title);
579 
580  // description
581  $desc = new ilTextAreaInputGUI($this->lng->txt("desc"), "description");
582  $this->form->addItem($desc);
583 
584  $this->lng->loadLanguageModule("rep");
586  $section->setTitle($this->lng->txt('rep_activation_availability'));
587  $this->form->addItem($section);
588 
589  // online
590  $online = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
591  $online->setValue("y");
592  $online->setInfo($this->lng->txt("glo_online_info"));
593  $this->form->addItem($online);
594 
596  $section->setTitle($this->lng->txt('glo_content_settings'));
597  $this->form->addItem($section);
598 
599  // glossary mode
600  $glo_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_mode"), "glo_mode");
601  //$glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
602  $op1 = new ilRadioOption($this->lng->txt("glo_mode_normal"), "none",$this->lng->txt("glo_mode_normal_info"));
603  $glo_mode->addOption($op1);
604  $op2 = new ilRadioOption($this->lng->txt("glo_mode_level"), "level",$this->lng->txt("glo_mode_level_info"));
605  $glo_mode->addOption($op2);
606  $op3 = new ilRadioOption($this->lng->txt("glo_mode_subtree"), "subtree",$this->lng->txt("glo_mode_subtree_info"));
607  $glo_mode->addOption($op3);
608  $this->form->addItem($glo_mode);
609 
610  // glossary mode
611  /*$options = array(
612  "none"=>$this->lng->txt("glo_mode_normal"),
613  "level"=>$this->lng->txt("glo_mode_level"),
614  "subtree"=>$this->lng->txt("glo_mode_subtree")
615  );
616  $glo_mode = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
617  $glo_mode->setOptions($options);
618  $glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
619  $this->form->addItem($glo_mode);*/
620 
621 
623  $section->setTitle($this->lng->txt('cont_presentation'));
624  $this->form->addItem($section);
625 
626  // presentation mode
627  $pres_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_presentation_mode"), "pres_mode");
628  $pres_mode->setValue("table");
629  $op1 = new ilRadioOption($this->lng->txt("glo_table_form"), "table", $this->lng->txt("glo_table_form_info"));
630 
631  // short text length
632  $snl = new ilNumberInputGUI($this->lng->txt("glo_text_snippet_length"), "snippet_length");
633  $snl->setMaxValue(3000);
634  $snl->setMinValue(100);
635  $snl->setMaxLength(4);
636  $snl->setSize(4);
637  $snl->setInfo($this->lng->txt("glo_text_snippet_length_info"));
638  $snl->setValue(200);
639  $op1->addSubItem($snl);
640 
641  $pres_mode->addOption($op1);
642  $op2 = new ilRadioOption($this->lng->txt("glo_full_definitions"), "full_def", $this->lng->txt("glo_full_definitions_info"));
643  $pres_mode->addOption($op2);
644  $this->form->addItem($pres_mode);
645 
646  // show taxonomy
647  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
648  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
649  if (count($tax_ids) > 0)
650  {
651  $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
652  $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info"));
653  $this->form->addItem($show_tax);
654  }
655 
656  // downloads
657  $down = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "glo_act_downloads");
658  $down->setValue("y");
659  $down->setInfo($this->lng->txt("cont_downloads_desc"));
660  $this->form->addItem($down);
661 
662  if ($a_mode == "edit")
663  {
664  $title->setValue($this->object->getTitle());
665  $desc->setValue($this->object->getDescription());
666  $online->setChecked($this->object->getOnline());
667  $glo_mode->setValue($this->object->getVirtualMode());
668  $pres_mode->setValue($this->object->getPresentationMode());
669  $snl->setValue($this->object->getSnippetLength());
670  if (count($tax_ids) > 0)
671  {
672  $show_tax->setChecked($this->object->getShowTaxonomy());
673  }
674 
675  $down->setChecked($this->object->isActiveDownloads());
676 
677  // additional features
678  $feat = new ilFormSectionHeaderGUI();
679  $feat->setTitle($this->lng->txt('obj_features'));
680  $this->form->addItem($feat);
681 
682  include_once './Services/Container/classes/class.ilContainer.php';
683  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
685  $this->object->getId(),
686  $this->form,
687  array(
689  )
690  );
691  }
692 
693  // sort columns, if adv fields are given
694  include_once("./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php");
695  $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getId());
696  $cols = $adv_ap->getColumnOrder();
697  if (count($cols) > 1)
698  {
699  include_once './Modules/Glossary/classes/class.ilGloAdvColSortInputGUI.php';
700  $ti = new ilGloAdvColSortInputGUI($this->lng->txt("cont_col_ordering"), "field_order");
701  $this->form->addItem($ti);
702  $ti->setValue($cols);
703  }
704 
705  // save and cancel commands
706  $this->form->addCommandButton("saveProperties", $this->lng->txt("save"));
707 
708  $this->form->setTitle($this->lng->txt("cont_glo_properties"));
709  $this->form->setFormAction($this->ctrl->getFormAction($this));
710  }
711 
712 
716  function saveProperties()
717  {
718  $this->initSettingsForm();
719  if ($this->form->checkInput())
720  {
721  $this->object->setTitle($_POST['title']);
722  $this->object->setDescription($_POST['description']);
723  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
724  $this->object->setVirtualMode($_POST["glo_mode"]);
725 // $this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
726  $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
727  $this->object->setPresentationMode($_POST["pres_mode"]);
728  $this->object->setSnippetLength($_POST["snippet_length"]);
729  $this->object->setShowTaxonomy($_POST["show_tax"]);
730  $this->object->update();
731 
732  // field order of advanced metadata
733  include_once("./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php");
734  $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getId());
735  $cols = $adv_ap->getColumnOrder();
736  if (count($cols) > 1)
737  {
738  $adv_ap->saveColumnOrder($_POST["field_order"]);
739  }
740 
741  // set definition short texts dirty
742  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
744 
745  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
747  $this->object->getId(),
748  $this->form,
749  array(
751  )
752  );
753 
754  // Update ecs export settings
755  include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
756  $ecs = new ilECSGlossarySettings($this->object);
757  if($ecs->handleSettingsUpdate())
758  {
759  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
760  $this->ctrl->redirect($this, "properties");
761  }
762 
763  }
764  $this->form->setValuesByPost();
765  $this->tpl->setContent($this->form->getHTML());
766  }
767 
768 
772  function listTerms()
773  {
774  if ($_GET["show_tax"])
775  {
776  $this->showTaxonomy();
777  }
778 
779  // term
780  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
781  $ti = new ilTextInputGUI($this->lng->txt("cont_new_term"), "new_term");
782  $ti->setMaxLength(80);
783  $ti->setSize(20);
784  $this->toolbar->addInputItem($ti, true);
785 
786  // language
787  $this->lng->loadLanguageModule("meta");
789  if ($_SESSION["il_text_lang_".$_GET["ref_id"]] != "")
790  {
791  $s_lang = $_SESSION["il_text_lang_".$_GET["ref_id"]];
792  }
793  else
794  {
795  $s_lang = $this->user->getLanguage();
796  }
797  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
798  $si = new ilSelectInputGUI($this->lng->txt("language"), "term_language");
799  $si->setOptions($lang);
800  $si->setValue($s_lang);
801  $this->toolbar->addInputItem($si, true);
802 
803  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
804  $this->toolbar->addFormButton($this->lng->txt("glo_add_new_term"), "addTerm");
805 
806  $this->toolbar->addSeparator();
807 
808  //ilEditClipboard::getAction() == "copy"
809  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
810  if ($this->user->clipboardHasObjectsOfType("term"))
811  {
812  $this->toolbar->addButton($this->lng->txt("paste"),
813  $this->ctrl->getLinkTarget($this, "pasteTerms"));
814  $this->toolbar->addButton($this->lng->txt("clear_clipboard"),
815  $this->ctrl->getLinkTarget($this, "clearClipboard"));
816  }
817  else
818  {
819  $this->toolbar->addButton($this->lng->txt("glo_add_from_other"),
820  $this->ctrl->getLinkTargetByClass("ilglossaryforeigntermcollectorgui", ""));
821  }
822 
823  if (is_object($this->tax))
824  {
825  $this->toolbar->addSeparator();
826  if ($_GET["show_tax"])
827  {
828  $this->toolbar->addButton($this->lng->txt("glo_hide_taxonomy"),
829  $this->ctrl->getLinkTarget($this, "deactTaxonomy"));
830  }
831  else
832  {
833  $this->toolbar->addButton($this->lng->txt("glo_show_taxonomy"),
834  $this->ctrl->getLinkTarget($this, "actTaxonomy"));
835  }
836  }
837 
838  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
839  $tab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
840  $this->tpl->setContent($tab->getHTML());
841  }
842 
849  function actTaxonomy()
850  {
851  $this->ctrl->setParameter($this, "show_tax", 1);
852  $this->ctrl->redirect($this, "listTerms");
853  }
854 
861  function deactTaxonomy()
862  {
863  $this->ctrl->setParameter($this, "show_tax", "");
864  $this->ctrl->redirect($this, "listTerms");
865  }
866 
867 
873  function showActions($a_actions)
874  {
875  foreach ($a_actions as $name => $lng)
876  {
877  $d[$name] = array("name" => $name, "lng" => $lng);
878  }
879 
880  $notoperations = array();
881  $operations = array();
882 
883  $operations = $d;
884 
885  if (count($operations) > 0)
886  {
887  foreach ($operations as $val)
888  {
889  $this->tpl->setCurrentBlock("tbl_action_btn");
890  $this->tpl->setVariable("BTN_NAME", $val["name"]);
891  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
892  $this->tpl->parseCurrentBlock();
893  }
894 
895  $this->tpl->setCurrentBlock("tbl_action_row");
896  $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.svg"));
897  $this->tpl->parseCurrentBlock();
898  }
899  }
900 
904  function addTerm()
905  {
906  if (trim($_POST["new_term"]) == "")
907  {
908  ilUtil::sendFailure($this->lng->txt("cont_please_enter_a_term"), true);
909  $this->ctrl->redirect($this, "listTerms");
910  }
911 
912  // add term
913  include_once ("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
914  $term = new ilGlossaryTerm();
915  $term->setGlossary($this->object);
916  $term->setTerm(ilUtil::stripSlashes($_POST["new_term"]));
917  $term->setLanguage($_POST["term_language"]);
918  $_SESSION["il_text_lang_".$_GET["ref_id"]] = $_POST["term_language"];
919  $term->create();
920 
921  // add first definition
922  $def = new ilGlossaryDefinition();
923  $def->setTermId($term->getId());
924  $def->setTitle(ilUtil::stripSlashes($_POST["new_term"]));
925  $def->create();
926 
927  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
928  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
929  $this->ctrl->redirectByClass(array("ilglossarytermgui",
930  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
931  }
932 
936  function moveDefinitionUp()
937  {
938  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
939 
940  $definition = new ilGlossaryDefinition($_GET["def"]);
941  $definition->moveUp();
942 
943  $this->ctrl->redirect($this, "listTerms");
944  }
945 
950  {
951  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
952 
953  $definition = new ilGlossaryDefinition($_GET["def"]);
954  $definition->moveDown();
955 
956  $this->ctrl->redirect($this, "listTerms");
957  }
958 
963  {
964  //$this->getTemplate();
965  //$this->displayLocator();
966  //$this->setTabs();
967 
968  $term = new ilGlossaryTerm($this->term_id);
969 
970  $add = "";
971  $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id);
972  if ($nr > 0)
973  {
974  $this->ctrl->setParameterByClass("ilglossarytermgui",
975  "term_id", $this->term_id);
976  $link = "[<a href='".
977  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages").
978  "'>".$this->lng->txt("glo_list_usages")."</a>]";
979  $add = "<br/>".sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr)." ".$link;
980  }
981 
982  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
983  $cgui = new ilConfirmationGUI();
984  $cgui->setHeaderText($this->lng->txt("info_delete_sure").$add);
985 
986  $cgui->setFormAction($this->ctrl->getFormAction($this));
987  $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion");
988  $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition");
989 
990  // content style
991  $this->setContentStyleSheet($this->tpl);
992 
993  // syntax style
994  $this->tpl->setCurrentBlock("SyntaxStyle");
995  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
997  $this->tpl->parseCurrentBlock();
998 
999  $definition = new ilGlossaryDefinition($_GET["def"]);
1000  $page_gui = new ilGlossaryDefPageGUI($definition->getId());
1001  $page_gui->setTemplateOutput(false);
1002  $page_gui->setStyleId($this->object->getStyleSheetId());
1003  $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1004  $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1005  $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$_GET["ref_id"]);
1006  $output = $page_gui->preview();
1007 
1008  $cgui->addItem("def", $_GET["def"], $term->getTerm().$output);
1009 
1010  $this->tpl->setContent($cgui->getHTML());
1011  }
1012 
1014  {
1015  $this->ctrl->redirect($this, "listTerms");
1016  }
1017 
1018 
1019  function deleteDefinition()
1020  {
1021  $definition = new ilGlossaryDefinition($_REQUEST["def"]);
1022  $definition->delete();
1023  $this->ctrl->redirect($this, "listTerms");
1024  }
1025 
1029  function editTerm()
1030  {
1031  // deprecated
1032  }
1033 
1034 
1038  function updateTerm()
1039  {
1040  $term = new ilGlossaryTerm($this->term_id);
1041 
1042  $term->setTerm(ilUtil::stripSlashes($_POST["term"]));
1043  $term->setLanguage($_POST["term_language"]);
1044  $term->update();
1045  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1046  $this->ctrl->redirect($this, "listTerms");
1047  }
1048 
1049 
1050 
1054  function export()
1055  {
1056  $this->checkPermission("write");
1057 
1058  require_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1059  $glo_exp = new ilGlossaryExport($this->object);
1060  $glo_exp->buildExportFile();
1061  $this->ctrl->redirectByClass("ilexportgui", "");
1062  }
1063 
1067  function exportHTML()
1068  {
1069  require_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1070  $glo_exp = new ilGlossaryExport($this->object, "html");
1071  $glo_exp->buildExportFile();
1072 //echo $this->tpl->get();
1073  $this->ctrl->redirectByClass("ilexportgui", "");
1074  }
1075 
1080  {
1081  if(!isset($_POST["file"]))
1082  {
1083  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
1084  }
1085  if (count($_POST["file"]) > 1)
1086  {
1087  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1088  }
1089 
1090  $file = explode(":", $_POST["file"][0]);
1091  $export_dir = $this->object->getExportDirectory($file[0]);
1092 
1093  if ($this->object->getPublicExportFile($file[0]) ==
1094  $file[1])
1095  {
1096  $this->object->setPublicExportFile($file[0], "");
1097  }
1098  else
1099  {
1100  $this->object->setPublicExportFile($file[0], $file[1]);
1101  }
1102  $this->object->update();
1103  $this->ctrl->redirectByClass("ilexportgui", "");
1104  }
1105 
1106  /*
1107  * list all export files
1108  */
1109  function viewExportLog()
1110  {
1111  }
1112 
1117  {
1118  //$this->prepareOutput();
1119  if (!isset($_POST["id"]))
1120  {
1121  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1122  $this->ctrl->redirect($this, "listTerms");
1123  }
1124 
1125  // check ids
1126  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1127  include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
1128  foreach ($_POST["id"] as $term_id)
1129  {
1130  $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1131  if ($term_glo_id != $this->object->getId() && !ilGlossaryTermReferences::isReferenced($this->object->getId(), $term_id))
1132  {
1133  ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1134  $this->ctrl->redirect($this, "listTerms");
1135  }
1136  }
1137 
1138  // display confirmation message
1139  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1140  $cgui = new ilConfirmationGUI();
1141  $cgui->setFormAction($this->ctrl->getFormAction($this));
1142  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1143  $cgui->setCancel($this->lng->txt("cancel"), "cancelTermDeletion");
1144  $cgui->setConfirm($this->lng->txt("confirm"), "deleteTerms");
1145 
1146  include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
1147 
1148  foreach($_POST["id"] as $id)
1149  {
1150  $term = new ilGlossaryTerm($id);
1151 
1152  $add = "";
1154  if ($nr > 0)
1155  {
1156  $this->ctrl->setParameterByClass("ilglossarytermgui",
1157  "term_id", $id);
1158 
1159  if (ilGlossaryTermReferences::isReferenced($this->object->getId(), $id))
1160  {
1161  $add = " (".$this->lng->txt("glo_term_reference").")";
1162  }
1163  else
1164  {
1165  $link = "[<a href='".
1166  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages").
1167  "'>".$this->lng->txt("glo_list_usages")."</a>]";
1168  $add = "<div class='small'>".
1169  sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr)." ".$link."</div>";
1170 
1171  }
1172  }
1173 
1174  $cgui->addItem("id[]", $id, $term->getTerm().$add);
1175  }
1176 
1177  $this->tpl->setContent($cgui->getHTML());
1178  }
1179 
1186  {
1187  $this->ctrl->redirect($this, "listTerms");
1188  }
1189 
1193  function deleteTerms()
1194  {
1195  include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
1196  foreach($_POST["id"] as $id)
1197  {
1198  if (ilGlossaryTermReferences::isReferenced($this->object->getId(), $id))
1199  {
1200  $refs = new ilGlossaryTermReferences($this->object->getId());
1201  $refs->deleteTerm($id);
1202  $refs->update();
1203  }
1204  else
1205  {
1206  $term = new ilGlossaryTerm($id);
1207  $term->delete();
1208  }
1209  }
1210  $this->ctrl->redirect($this, "listTerms");
1211  }
1212 
1220  function setLocator($a_tree = "", $a_id = "")
1221  {
1222  if(strtolower($_GET["baseClass"]) != "ilglossaryeditorgui")
1223  {
1224  parent::setLocator($a_tree, $a_id);
1225  }
1226  else
1227  {
1228  if(is_object($this->object))
1229  {
1230  require_once("./Modules/Glossary/classes/class.ilGlossaryLocatorGUI.php");
1231  $gloss_loc = new ilGlossaryLocatorGUI();
1232  if (is_object($this->term))
1233  {
1234  $gloss_loc->setTerm($this->term);
1235  }
1236  $gloss_loc->setGlossary($this->object);
1237  //$gloss_loc->setDefinition($this->definition);
1238  $gloss_loc->display();
1239  }
1240  }
1241 
1242  }
1243 
1247  function view()
1248  {
1249  //$this->prepareOutput();
1250  $this->viewObject();
1251  }
1252 
1256  function create()
1257  {
1258  switch($_POST["new_type"])
1259  {
1260  case "term":
1261  $term_gui = new ilGlossaryTermGUI();
1262  $term_gui->create();
1263  break;
1264  }
1265  }
1266 
1267  function saveTerm()
1268  {
1269  $term_gui = new ilGlossaryTermGUI();
1270  $term_gui->setGlossary($this->object);
1271  $term_gui->save();
1272 
1273  ilUtil::sendSuccess($this->lng->txt("cont_added_term"),true);
1274 
1275  //ilUtil::redirect("glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
1276  $this->ctrl->redirect($this, "listTerms");
1277  }
1278 
1279 
1283  function addDefinition()
1284  {
1285  $term_id = (int) $_GET["term_id"];
1286 
1287  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1288  $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1289  if ($term_glo_id != $this->object->getId())
1290  {
1291  ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1292  $this->ctrl->redirect($this, "listTerms");
1293  }
1294 
1295  // add term
1296  include_once ("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1297  $term = new ilGlossaryTerm($term_id);
1298 
1299  // add first definition
1300  $def = new ilGlossaryDefinition();
1301  $def->setTermId($term->getId());
1302  $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
1303  $def->create();
1304 
1305  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
1306  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
1307  $this->ctrl->redirectByClass(array("ilglossarytermgui",
1308  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
1309 
1310  }
1311 
1312  function getTemplate()
1313  {
1314  $this->tpl->getStandardTemplate();
1315 
1316  $title = $this->object->getTitle();
1317 
1318 
1319  if ($this->term_id > 0)
1320  {
1321  $this->tpl->setTitle($this->lng->txt("term").": ".
1322  ilGlossaryTerm::_lookGlossaryTerm($this->term_id));
1323  }
1324  else
1325  {
1326  parent::setTitleAndDescription();
1327  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
1328  $this->tpl->setTitle($this->lng->txt("glo").": ".$title);
1329  }
1330  }
1331 
1335  function setTabs()
1336  {
1337  $this->getTabs();
1338  }
1339 
1343  function getTabs()
1344  {
1345  $this->help->setScreenIdComponent("glo");
1346 
1347  // list terms
1348  $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "listTerms")
1349  ? true
1350  : false;
1351  $this->tabs_gui->addTarget("cont_terms",
1352  $this->ctrl->getLinkTarget($this, "listTerms"), array("listTerms", ""),
1353  get_class($this), "", $force_active);
1354 
1355  $force_active = false;
1356  if ($this->ctrl->getCmd() == "showSummary" ||
1357  strtolower($this->ctrl->getNextClass()) == "ilinfoscreengui")
1358  {
1359  $force_active = true;
1360  }
1361  $this->tabs_gui->addTarget("info_short",
1362  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "",
1363  "ilInfoScreenGUI", "", $force_active);
1364 
1365  // properties
1366  if ($this->rbacsystem->checkAccess('write',$this->object->getRefId()))
1367  {
1368  $this->tabs_gui->addTarget("settings",
1369  $this->ctrl->getLinkTarget($this, "properties"), "properties",
1370  get_class($this));
1371 
1372  // meta data
1373  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1374  $mdgui = new ilObjectMetaDataGUI($this->object, "term");
1375  $mdtab = $mdgui->getTab();
1376  if($mdtab)
1377  {
1378  $this->tabs_gui->addTarget("meta_data", $mdtab,
1379  "", "ilobjectmetadatagui");
1380  }
1381 
1382  // export
1383  /*$tabs_gui->addTarget("export",
1384  $this->ctrl->getLinkTarget($this, "exportList"),
1385  array("exportList", "viewExportLog"), get_class($this));*/
1386 
1387  // export
1388  $this->tabs_gui->addTarget("export",
1389  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1390  "", "ilexportgui");
1391  }
1392 
1393  // permissions
1394  if ($this->rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
1395  {
1396  /*$tabs_gui->addTarget("permission_settings",
1397  $this->ctrl->getLinkTarget($this, "perm"),
1398  array("perm", "info"),
1399  get_class($this));
1400  */
1401  $this->tabs_gui->addTarget("perm_settings",
1402  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1403 
1404  }
1405 
1406  $this->tabs_gui->addNonTabbedLink("presentation_view",
1407  $this->lng->txt("glo_presentation_view"),
1408  "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=".$this->object->getRefID(),
1409  "_top"
1410  );
1411 
1412  }
1413 
1417  function setSettingsSubTabs($a_active)
1418  {
1419  if (in_array($a_active,
1420  array("general_settings", "style", "taxonomy", "glossaries")))
1421  {
1422  // general properties
1423  $this->tabs->addSubTab("general_settings",
1424  $this->lng->txt("settings"),
1425  $this->ctrl->getLinkTarget($this, 'properties'));
1426 
1427  // style properties
1428  $this->tabs->addSubTab("style",
1429  $this->lng->txt("obj_sty"),
1430  $this->ctrl->getLinkTarget($this, 'editStyleProperties'));
1431 
1432  // taxonomy
1433  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1435  $this->tabs->addSubTab("taxonomy",
1436  $this->lng->txt("tax_taxonomy"),
1437  $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", ''));
1438 
1439  // style properties
1440  $this->tabs->addSubTab("glossaries",
1441  $this->lng->txt("cont_auto_glossaries"),
1442  $this->ctrl->getLinkTarget($this, 'editGlossaries'));
1443 
1444  $this->tabs->activateSubTab($a_active);
1445  }
1446  }
1447 
1448 
1454  public static function _goto($a_target)
1455  {
1456  global $DIC;
1457 
1458  $lng = $DIC->language();
1459  $ilAccess = $DIC->access();
1460  $ilErr = $DIC["ilErr"];
1461 
1462  if ($ilAccess->checkAccess("read", "", $a_target))
1463  {
1464  $_GET["ref_id"] = $a_target;
1465  $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1466  include("ilias.php");
1467  exit;
1468  }
1469  else if ($ilAccess->checkAccess("visible", "", $a_target))
1470  {
1471  $_GET["ref_id"] = $a_target;
1472  $_GET["cmd"] = "infoScreen";
1473  $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1474  include("ilias.php");
1475  exit;
1476  }
1477  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1478  {
1479  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1480  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1482  }
1483 
1484  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1485  }
1486 
1490  function applyFilter()
1491  {
1492  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
1493  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1494  $prtab->resetOffset();
1495  $prtab->writeFilterToSession();
1496  $this->listTerms();
1497  }
1498 
1503  function resetFilter()
1504  {
1505  include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
1506  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1507  $prtab->resetOffset();
1508  $prtab->resetFilter();
1509  $this->listTerms();
1510  }
1511 
1512 
1516 
1520  function setContentStyleSheet($a_tpl = null)
1521  {
1522  if ($a_tpl != null)
1523  {
1524  $ctpl = $a_tpl;
1525  }
1526  else
1527  {
1528  $ctpl = $this->tpl;
1529  }
1530 
1531  $ctpl->setCurrentBlock("ContentStyle");
1532  $ctpl->setVariable("LOCATION_CONTENT_STYLESHEET",
1533  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
1534  $ctpl->parseCurrentBlock();
1535  }
1536 
1537 
1542  {
1543  $this->checkPermission("write");
1544 
1545  $this->initStylePropertiesForm();
1546  $this->tpl->setContent($this->form->getHTML());
1547 
1548  $this->tabs->activateTab("settings");
1549  $this->setSettingsSubTabs("style");
1550  }
1551 
1556  {
1557  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1558  $this->lng->loadLanguageModule("style");
1559 
1560  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1561  $this->form = new ilPropertyFormGUI();
1562 
1563  $fixed_style = $this->setting->get("fixed_content_style_id");
1564  $style_id = $this->object->getStyleSheetId();
1565 
1566  if ($fixed_style > 0)
1567  {
1568  $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
1569  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
1570  $this->lng->txt("global_fixed").")");
1571  $this->form->addItem($st);
1572  }
1573  else
1574  {
1575  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
1576  $_GET["ref_id"]);
1577 
1578  $st_styles[0] = $this->lng->txt("default");
1579  ksort($st_styles);
1580 
1581  if ($style_id > 0)
1582  {
1583  // individual style
1584  if (!ilObjStyleSheet::_lookupStandard($style_id))
1585  {
1586  $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
1587  $st->setValue(ilObject::_lookupTitle($style_id));
1588  $this->form->addItem($st);
1589 
1590 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1591 
1592  // delete command
1593  $this->form->addCommandButton("editStyle",
1594  $this->lng->txt("style_edit_style"));
1595  $this->form->addCommandButton("deleteStyle",
1596  $this->lng->txt("style_delete_style"));
1597 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1598  }
1599  }
1600 
1601  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1602  {
1603  $style_sel = ilUtil::formSelect ($style_id, "style_id",
1604  $st_styles, false, true);
1605  $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"), "style_id");
1606  $style_sel->setOptions($st_styles);
1607  $style_sel->setValue($style_id);
1608  $this->form->addItem($style_sel);
1609 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1610  $this->form->addCommandButton("saveStyleSettings",
1611  $this->lng->txt("save"));
1612  $this->form->addCommandButton("createStyle",
1613  $this->lng->txt("sty_create_ind_style"));
1614  }
1615  }
1616  $this->form->setTitle($this->lng->txt("glo_style"));
1617  $this->form->setFormAction($this->ctrl->getFormAction($this));
1618  }
1619 
1623  function createStyle()
1624  {
1625  $this->ctrl->redirectByClass("ilobjstylesheetgui", "create");
1626  }
1627 
1631  function editStyle()
1632  {
1633  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
1634  }
1635 
1639  function deleteStyle()
1640  {
1641  $this->ctrl->redirectByClass("ilobjstylesheetgui", "delete");
1642  }
1643 
1648  {
1649  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1650  if ($this->setting->get("fixed_content_style_id") <= 0 &&
1651  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1652  || $this->object->getStyleSheetId() == 0))
1653  {
1654  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1655  $this->object->update();
1656  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1657  }
1658  $this->ctrl->redirect($this, "editStyleProperties");
1659  }
1660 
1665  {
1666  if ($this->object->getPublicExportFile($a_type) == $a_file)
1667  {
1668  return $this->lng->txt("yes");
1669  }
1670 
1671  return " ";
1672  }
1673 
1680  function showTaxonomy()
1681  {
1682  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1683  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1684  if (count($tax_ids) > 0)
1685  {
1686  include_once("./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
1687  $tax_exp = new ilTaxonomyExplorerGUI($this, "showTaxonomy", $tax_ids[0],
1688  "ilobjglossarygui", "listTerms");
1689  if (!$tax_exp->handleCommand())
1690  {
1691  //$this->tpl->setLeftNavContent($tax_exp->getHTML());
1692  $this->tpl->setLeftNavContent($tax_exp->getHTML()."&nbsp;");
1693  }
1694  }
1695 
1696  }
1697 
1698  //
1699  // Auto glossaries
1700  //
1701 
1708  function editGlossaries()
1709  {
1710  $this->tabs->setTabActive("settings");
1711  $this->setSettingsSubTabs("glossaries");
1712 
1713  $this->toolbar->addButton($this->lng->txt("add"),
1714  $this->ctrl->getLinkTarget($this, "showGlossarySelector"));
1715 
1716  include_once("./Modules/Glossary/classes/class.ilGlossaryAutoLinkTableGUI.php");
1717  $tab = new ilGlossaryAutoLinkTableGUI($this->object, $this, "editGlossaries");
1718 
1719  $this->tpl->setContent($tab->getHTML());
1720  }
1721 
1729  {
1730  $this->tabs->setTabActive("settings");
1731  $this->setSettingsSubTabs("glossaries");
1732 
1733  include_once 'Services/Search/classes/class.ilSearchRootSelector.php';
1734 
1735  $exp = new ilSearchRootSelector($this->ctrl->getLinkTarget($this,'showGlossarySelector'));
1736  $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $this->tree->readRootId());
1737  $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showGlossarySelector'));
1738  $exp->setTargetClass(get_class($this));
1739  $exp->setCmd('confirmGlossarySelection');
1740  $exp->setClickableTypes(array("glo"));
1741  $exp->addFilter("glo");
1742 
1743  // build html-output
1744  $exp->setOutput(0);
1745  $this->tpl->setContent($exp->getOutput());
1746 
1747  }
1748 
1753  {
1754  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1755  $cgui = new ilConfirmationGUI();
1756  $this->ctrl->setParameter($this, "glo_ref_id", $_GET["root_id"]);
1757  $cgui->setFormAction($this->ctrl->getFormAction($this));
1758  $cgui->setHeaderText($this->lng->txt("glo_link_glo_in_glo"));
1759  $cgui->setCancel($this->lng->txt("no"), "selectGlossary");
1760  $cgui->setConfirm($this->lng->txt("yes"), "selectGlossaryLink");
1761  $this->tpl->setContent($cgui->getHTML());
1762  }
1763 
1771  {
1772  $glo_ref_id = (int) $_GET["glo_ref_id"];
1773  $glo_id = ilObject::_lookupObjId($glo_ref_id);
1774  $this->object->autoLinkGlossaryTerms($glo_id);
1775  $this->selectGlossary();
1776  }
1777 
1778 
1785  function selectGlossary()
1786  {
1787  $glos = $this->object->getAutoGlossaries();
1788  $glo_ref_id = (int) $_GET["glo_ref_id"];
1789  $glo_id = ilObject::_lookupObjId($glo_ref_id);
1790  if (!in_array($glo_id, $glos))
1791  {
1792  $glos[] = $glo_id;
1793  }
1794  $this->object->setAutoGlossaries($glos);
1795  $this->object->update();
1796 
1797  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1798  $this->ctrl->redirect($this, "editGlossaries");
1799  }
1800 
1807  function removeGlossary()
1808  {
1809  $this->object->removeAutoGlossary((int) $_GET["glo_id"]);
1810  $this->object->update();
1811 
1812  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1813  $this->ctrl->redirect($this, "editGlossaries");
1814  }
1815 
1822  function copyTerms()
1823  {
1824  $items = ilUtil::stripSlashesArray($_POST["id"]);
1825  if (!is_array($items))
1826  {
1827  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1828  $this->ctrl->redirect($this, "listTerms");
1829  }
1830 
1831  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1832  $this->user->clipboardDeleteObjectsOfType("term");
1833 
1834  // put them into the clipboard
1835  $time = date("Y-m-d H:i:s", time());
1836  $order = 0;
1837  foreach ($items as $id)
1838  {
1839  $this->user->addObjectToClipboard($id,
1840  "term", ilGlossaryTerm::_lookGlossaryTerm($id), 0, $time, $order);
1841  }
1842 
1844  ilUtil::sendInfo($this->lng->txt("glo_selected_terms_have_been_copied"), true);
1845  $this->ctrl->redirect($this, "listTerms");
1846  }
1847 
1854  function referenceTerms()
1855  {
1856  $items = ilUtil::stripSlashesArray($_POST["id"]);
1857  if (!is_array($items))
1858  {
1859  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1860  $this->ctrl->redirect($this, "listTerms");
1861  }
1862 
1863  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1864  $this->user->clipboardDeleteObjectsOfType("term");
1865 
1866  // put them into the clipboard
1867  $time = date("Y-m-d H:i:s", time());
1868  $order = 0;
1869  foreach ($items as $id)
1870  {
1871  $this->user->addObjectToClipboard($id,
1872  "term", ilGlossaryTerm::_lookGlossaryTerm($id), 0, $time, $order);
1873  }
1874 
1876  ilUtil::sendInfo($this->lng->txt("glo_selected_terms_have_been_copied"), true);
1877  $this->ctrl->redirect($this, "listTerms");
1878  }
1879 
1880 
1887  function clearClipboard()
1888  {
1889  $this->user->clipboardDeleteObjectsOfType("term");
1890  $this->ctrl->redirect($this, "listTerms");
1891  }
1892 
1896  function pasteTerms()
1897  {
1898  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1899  if (ilEditClipboard::getAction() == "copy")
1900  {
1901  foreach ($this->user->getClipboardObjects("term") as $item)
1902  {
1903  ilGlossaryTerm::_copyTerm($item["id"], $this->object->getId());
1904  }
1905  }
1906  if (ilEditClipboard::getAction() == "link")
1907  {
1908  include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
1909  $refs = new ilGlossaryTermReferences($this->object->getId());
1910  foreach ($this->user->getClipboardObjects("term") as $item)
1911  {
1912  $refs->addTerm($item["id"]);
1913  }
1914  $refs->update();
1915  }
1916  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1917  $this->ctrl->redirect($this, "listTerms");
1918  }
1919 
1920 
1921 }
1922 
1923 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static getInstance(ilObjGlossaryGUI $a_glossary_gui)
Get instance.
Class ilGlossaryGUI.
global $ilErr
Definition: raiseError.php:16
This class represents an option in a radio group.
ILIAS Setting Class.
Class ilObjectMetaDataGUI.
showInfoScreen()
Show info screen.
saveObject()
save new content object to db
Class ilInfoScreenGUI.
static isReferenced($a_glo_id, $a_term_id)
Is a term referenced by one or multiple glossaries.
setSettingsSubTabs($a_active)
Set sub tabs.
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
setTemplateOutput($a_output=true)
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
cancelTermDeletion()
cancel deletion of object
This class represents a property form user interface.
GUI class for the workflow of copying objects.
const TITLE_LENGTH
max length of object title
deleteTerms()
delete selected terms
$_GET["client_id"]
editGlossaries()
Edit automatically linked glossaries.
static getNumberOfUsages($a_term_id)
Get number of usages.
Class ilGlossaryTerm.
This class represents a section header in a property form.
moveDefinitionUp()
move a definiton up
Class ilObjGlossary.
initSettingsForm($a_mode="edit")
Init settings form.
static _getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
$cmd
Definition: sahs_server.php:35
Taxonomy explorer GUI class.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
executeCommand()
execute command
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
removeGlossary()
Remove lm glossary.
exportHTML()
create html package
createObject()
create new object form
export()
export content object
showActions($a_actions)
show possible action (form buttons)
resetFilter()
Reset filter (note: this function existed before data table filter has been introduced.
setInfo($a_info)
Set Info.
for($col=0; $col< 50; $col++) $d
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
editStyleProperties()
Edit style properties.
showTaxonomy()
Show taxonomy.
static _lookupStandard($a_id)
Lookup standard flag.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$section
Definition: Utf8Test.php:83
$a_type
Definition: workflow.php:93
Export User Interface Class.
moveDefinitionDown()
move a definiton down
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
$info
Definition: example_052.php:80
prepareOutput($a_show_subobjects=true)
prepare output
This class represents a property in a property form.
TableGUI class for auto link glossaries.
setValue($a_value)
Set Value.
deactTaxonomy()
Hide Taxonomy.
Taxonomy GUI class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
confirmGlossarySelection()
Confirm glossary selection.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
actTaxonomy()
Show Taxonomy.
selectGlossaryLink()
Select a glossary and link all its terms.
create()
create new (subobject) in glossary
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
saveProperties()
save properties
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
setValue($a_value)
Set Value.
omitLocator($a_omit=true)
setSize($a_size)
Set Size.
static addUsagesToInfo($info, $glo_id)
Add usages to info.
This class represents a text property in a property form.
GUI class for glossary terms.
redirection script todo: (a better solution should control the processing via a xml file) ...
setMaxLength($a_maxlength)
Set Max Length.
confirmTermDeletion()
confirm term deletion
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getSyntaxStylePath()
get syntax style path
setOptions($a_options)
Set Options.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
Create styles array
The data for the language used.
addDefinition()
add definition
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setLocator($a_tree="", $a_id="")
set Locator
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
static _lookGlossaryID($term_id)
get glossary id form term id
Class ilGlossaryDefinition.
static getContentStylePath($a_style_id)
get content style path
static _copyTerm($a_term_id, $a_glossary_id)
Copy a term to a glossary.
setContentStyleSheet($a_tpl=null)
Set content style sheet.
static getScormModulesForGlossary($a_glo_id)
Get SCORM modules that assign a certain glossary.
properties()
edit properties of object (admin form)
This class represents a non editable value in a property form.
Create new PHPExcel object
obj_idprivate
Class ilObjStyleSheetGUI.
static _goto($a_target)
redirect script
This class represents a text area property in a property form.
Glossary definition page GUI class.
$ret
Definition: parser.php:6
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
selectGlossary()
Select lm glossary.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
getCreationMode()
get creation mode
referenceTerms()
Reference terms.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
confirmDefinitionDeletion()
deletion confirmation screen
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
global $DIC
static getLogger($a_component_id)
Get component logger.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
Export class for content objects.
getPublicAccessColValue($a_type, $a_file)
Get public access value for export table.
static yn2tf($a_yn)
convert "y"/"n" to true/false
showGlossarySelector()
Select LM Glossary.
static setAction($a_action)
publishExportFile()
download export file
static redirect($a_script)
http redirect to other script
addHeaderAction()
Add header action menu.
saveStyleSettings()
Save style settings.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
static _lookGlossaryTerm($term_id)
get glossary term
$_POST["username"]
Input for adv meta data column sorting in glossaries.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static setShortTextsDirty($a_glo_id)
Set short texts dirty.
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
Class ilECSGlossarySettings.
setLocator()
set Locator
initStylePropertiesForm()
Init style properties form.
Confirmation screen class.
clearClipboard()
Clear clipboard.
static loadLanguageModule()
Load language module.