ILIAS  release_8 Revision v8.23
class.ilObjGlossaryGUI.php
Go to the documentation of this file.
1 <?php
2 
28 {
31  protected int $tax_node = 0;
32  protected ilObjTaxonomy $tax;
33  protected $tax_id;
34  protected bool $in_administration = false;
35  protected \ILIAS\Glossary\Editing\EditingGUIRequest $edit_request;
37  public ?ilGlossaryTerm $term = null;
38  protected int $term_id = 0;
39  protected ilTabsGUI $tabs;
40  protected ilSetting $setting;
41  protected ilHelpGUI $help;
43  protected ilLogger $log;
44  protected \ILIAS\Style\Content\GUIService $content_style_gui;
45  protected \ILIAS\Style\Content\Object\ObjectFacade $content_style_domain;
46 
47  public function __construct(
48  $a_data,
49  int $a_id = 0,
50  bool $a_call_by_reference = true,
51  bool $a_prepare_output = true
52  ) {
53  global $DIC;
54 
55  $this->ctrl = $DIC->ctrl();
56  $this->lng = $DIC->language();
57  $this->user = $DIC->user();
58  $this->toolbar = $DIC->toolbar();
59  $this->tabs = $DIC->tabs();
60  $this->setting = $DIC["ilSetting"];
61  $this->access = $DIC->access();
62  $this->rbacsystem = $DIC->rbac()->system();
63  $this->help = $DIC["ilHelp"];
64 
65  $this->edit_request = $DIC->glossary()
66  ->internal()
67  ->gui()
68  ->editing()
69  ->request();
70 
71  $this->log = ilLoggerFactory::getLogger('glo');
72 
73  $this->term_perm = ilGlossaryTermPermission::getInstance();
74 
75  $this->ctrl->saveParameter($this, array("ref_id"));
76  $this->lng->loadLanguageModule("content");
77  $this->lng->loadLanguageModule("glo");
78 
79  $this->type = "glo";
80  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
81 
82  // determine term id and check whether it is valid (belongs to
83  // current glossary)
84  $this->term_id = $this->edit_request->getTermId();
85  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($this->term_id);
86  if ($this->term_id > 0 && $term_glo_id != $this->object->getId()
88  $this->term_id = 0;
89  }
90 
91  $this->tax_id = $this->object->getTaxonomyId();
92  if ($this->tax_id > 0) {
93  $this->ctrl->saveParameter($this, array("show_tax", "tax_node"));
94 
95  $this->tax = new ilObjTaxonomy($this->tax_id);
96  }
97  $tax_node = $this->edit_request->getTaxNode();
98  if ($tax_node > 1 && $this->tax->getTree()->readRootId() != $tax_node) {
99  $this->tax_node = $tax_node;
100  }
101 
102  if ($this->getGlossary()) {
103  $this->term_manager = $DIC->glossary()
104  ->internal()
105  ->domain()
106  ->term(
107  $this->getGlossary(),
108  $this->user->getId()
109  );
110  }
111 
112  $this->in_administration =
113  (strtolower($this->edit_request->getBaseClass()) == "iladministrationgui");
114  $cs = $DIC->contentStyle();
115  $this->content_style_gui = $cs->gui();
116  if (is_object($this->object)) {
117  $this->content_style_domain = $cs->domain()->styleForRefId($this->object->getRefId());
118  }
119  }
120 
121  public function executeCommand(): void
122  {
123  $cmd = $this->ctrl->getCmd();
124  $next_class = $this->ctrl->getNextClass($this);
125 
126  $this->log->debug("glossary term, next class " . $next_class . ", cmd: " . $cmd);
127 
128  switch ($next_class) {
129  case 'ilobjectmetadatagui':
130  $this->checkPermission("write");
131 
132  $this->getTemplate();
133  $this->setTabs();
134  $this->setLocator();
135  $this->addHeaderAction();
136 
137  $this->tabs_gui->activateTab('meta_data');
138  $md_gui = new ilObjectMetaDataGUI($this->object, 'term');
139  $this->ctrl->forwardCommand($md_gui);
140  break;
141 
142  case "ilglossarytermgui":
143  if (!$this->term_perm->checkPermission("edit_content", $this->term_id) &&
144  !$this->term_perm->checkPermission("write", $this->term_id)) {
145  throw new ilGlossaryException("No permission.");
146  }
147  $this->getTemplate();
148 // $this->quickList();
149  $this->ctrl->setReturn($this, "listTerms");
150  $term_gui = new ilGlossaryTermGUI($this->term_id);
151  $term_gui->setGlossary($this->getGlossary());
152  $this->ctrl->forwardCommand($term_gui);
153  break;
154 
155  case "ilinfoscreengui":
156  $this->addHeaderAction();
157  $this->showInfoScreen();
158  break;
159 
160  case "ilobjectcontentstylesettingsgui":
161  $this->checkPermission("write");
162  $this->prepareOutput();
163  $this->addHeaderAction();
164  $this->tabs_gui->activateTab("settings");
165  $this->setSettingsSubTabs("style");
166  $settings_gui = $this->content_style_gui
167  ->objectSettingsGUIForRefId(
168  null,
169  $this->object->getRefId()
170  );
171  $this->ctrl->forwardCommand($settings_gui);
172  break;
173 
174 
175  case 'ilpermissiongui':
176  if ($this->in_administration) {
177  $this->prepareOutput();
178  } else {
179  $this->getTemplate();
180  $this->setTabs();
181  $this->setLocator();
182  $this->addHeaderAction();
183  }
184  $perm_gui = new ilPermissionGUI($this);
185  $ret = $this->ctrl->forwardCommand($perm_gui);
186  break;
187 
188  case "ilcommonactiondispatchergui":
190  $this->prepareOutput();
191  $this->ctrl->forwardCommand($gui);
192  break;
193 
194  case "ilobjtaxonomygui":
195  $this->checkPermission("write");
196  $this->getTemplate();
197  $this->setTabs();
198  $this->setLocator();
199  $this->addHeaderAction();
200  $this->tabs->activateTab("settings");
201  $this->setSettingsSubTabs("taxonomy");
202 
203  $this->ctrl->setReturn($this, "properties");
204  $tax_gui = new ilObjTaxonomyGUI();
205  $tax_gui->setMultiple(false);
206 
207  $tax_gui->setAssignedObject($this->object->getId());
208  $ret = $this->ctrl->forwardCommand($tax_gui);
209  break;
210 
211  case "ilexportgui":
212  $this->checkPermission("write");
213  $this->getTemplate();
214  $this->setTabs();
215  $this->tabs->activateTab("export");
216  $this->setLocator();
217  $exp_gui = new ilExportGUI($this);
218  //$exp_gui->addFormat("xml", "", $this, "export");
219  $exp_gui->addFormat("xml");
220  $exp_gui->addFormat("html", "", $this, "exportHTML");
221  $exp_gui->addCustomColumn(
222  $this->lng->txt("cont_public_access"),
223  $this,
224  "getPublicAccessColValue"
225  );
226  $exp_gui->addCustomMultiCommand(
227  $this->lng->txt("cont_public_access"),
228  $this,
229  "publishExportFile"
230  );
231  $ret = $this->ctrl->forwardCommand($exp_gui);
232  break;
233 
234  case 'ilobjectcopygui':
235  $this->prepareOutput();
236  $cp = new ilObjectCopyGUI($this);
237  $cp->setType('glo');
238  $this->ctrl->forwardCommand($cp);
239  break;
240 
241  case "ilglossaryforeigntermcollectorgui":
242  $this->checkPermission("write");
243  $this->ctrl->setReturn($this, "");
244  $this->getTemplate();
245  $this->setTabs();
246  $this->setLocator();
247  $this->addHeaderAction();
249  $this->ctrl->forwardCommand($coll);
250  break;
251 
252  default:
253  $cmd = $this->ctrl->getCmd("listTerms");
254 
255  if (($cmd == "create") && ($this->edit_request->getNewType() == "term")) {
256  $this->ctrl->setCmd("create");
257  $this->ctrl->setCmdClass("ilGlossaryTermGUI");
258  $this->executeCommand();
259  return;
260  } else {
261  if ($cmd != "quickList") {
262  if ($this->in_administration ||
263  $this->getCreationMode() == true) {
264  $this->prepareOutput();
265  $cmd .= "Object";
266  } else {
267  $this->getTemplate();
268  $this->setTabs();
269  $this->setLocator();
270  $this->addHeaderAction();
271 
272  if ($cmd == "redrawHeaderAction") {
273  $cmd = "redrawHeaderActionObject";
274  }
275  }
276  }
277  if (in_array($cmd, [
278  "redrawHeaderActionObject"
279  ])) {
280  $this->checkPermission("read");
281  } elseif (in_array($cmd, [
282  "showInfoScreen"
283  ])) {
284  $this->checkPermission("visible");
285  } else {
286  if (!$this->getCreationMode()) {
287  $this->checkPermission("write");
288  }
289  }
290  $this->$cmd();
291  }
292  break;
293  }
294 
295  if ($cmd != "quickList") {
296  if (!$this->in_administration && !$this->getCreationMode()) {
297  $this->tpl->printToStdout();
298  }
299  } else {
300  $this->tpl->printToStdout(false);
301  }
302  }
303 
307  public function getGlossary(): ?ilObjGlossary
308  {
310  $glossary = $this->object;
311  if (isset($glossary) && $glossary->getType() == "glo") {
312  return $glossary;
313  }
314  return null;
315  }
316 
317  protected function assignObject(): void
318  {
319  $this->object = new ilObjGlossary($this->id, true);
320  }
321 
322  protected function initCreateForm(string $new_type): ilPropertyFormGUI
323  {
324  $form = new ilPropertyFormGUI();
325  $form->setTarget("_top");
326  $form->setFormAction($this->ctrl->getFormAction($this));
327  $form->setTitle($this->lng->txt($new_type . "_new"));
328 
329  // title
330  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
331  $ti->setSize(min(40, ilObject::TITLE_LENGTH));
332  $ti->setMaxLength(ilObject::TITLE_LENGTH);
333  $ti->setRequired(true);
334  $form->addItem($ti);
335 
336  // description
337  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
338  $ta->setCols(40);
339  $ta->setRows(2);
340  $form->addItem($ta);
341 
342  // didactic template
343  $form = $this->initDidacticTemplate($form);
344 
345  $form->addCommandButton("save", $this->lng->txt($new_type . "_add"));
346  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
347 
348  return $form;
349  }
350 
351  public function importObject(): void
352  {
353  $this->createObject();
354  }
355 
356  public function saveObject(): void
357  {
358  $new_type = $this->edit_request->getNewType();
359 
360  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
361  if (!$this->checkPermissionBool("create", "", $new_type)) {
362  throw new ilPermissionException($this->lng->txt("no_create_permission"));
363  }
364 
365  $this->lng->loadLanguageModule($new_type);
366  $this->ctrl->setParameter($this, "new_type", $new_type);
367 
368  $form = $this->initCreateForm($new_type);
369  if ($form->checkInput()) {
370  $this->ctrl->setParameter($this, "new_type", "");
371 
372  $newObj = new ilObjGlossary();
373  $newObj->setType($new_type);
374  $newObj->setTitle($form->getInput("title"));
375  $newObj->setDescription($form->getInput("desc"));
376  $newObj->setVirtualMode("none");
377  $newObj->create();
378 
379  $this->putObjectInTree($newObj);
380 
381  // apply didactic template?
382  $dtpl = $this->getDidacticTemplateVar("dtpl");
383  if ($dtpl) {
384  $newObj->applyDidacticTemplate($dtpl);
385  }
386 
387  // always send a message
388  $this->tpl->setOnScreenMessage('success', $this->lng->txt("glo_added"), true);
389  $this->ctrl->setParameterByClass(
390  ilObjGlossaryGUI::class,
391  "ref_id",
392  $newObj->getRefId()
393  );
394  $this->ctrl->redirectByClass(
395  [ilGlossaryEditorGUI::class, ilObjGlossaryGUI::class],
396  "properties"
397  );
398  }
399 
400  // display only this form to correct input
401  $form->setValuesByPost();
402  $this->tpl->setContent($form->getHTML());
403  }
404 
405  public function showInfoScreen(): void
406  {
407  $this->getTemplate();
408  $this->setTabs();
409  $this->setLocator();
410  $this->lng->loadLanguageModule("meta");
411 
412  $info = new ilInfoScreenGUI($this);
413  $info->enablePrivateNotes();
414  $info->enableNews();
415  if ($this->access->checkAccess("write", "", $this->requested_ref_id)) {
416  $info->enableNewsEditing();
417  $news_set = new ilSetting("news");
418  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
419  if ($enable_internal_rss) {
420  $info->setBlockProperty("news", "settings", true);
421  }
422  }
423  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
424 
425  self::addUsagesToInfo($info, $this->object->getId());
426 
427  $this->ctrl->forwardCommand($info);
428  }
429 
433  public static function addUsagesToInfo(
434  ilInfoScreenGUI $info,
435  int $glo_id
436  ): void {
437  global $DIC;
438 
439  $lng = $DIC->language();
440  $ilAccess = $DIC->access();
441 
442  $info->addSection($lng->txt("glo_usages"));
444  foreach ($sms as $sm) {
445  $link = false;
446  $refs = ilObject::_getAllReferences($sm);
447  foreach ($refs as $ref) {
448  if ($link === false && $ilAccess->checkAccess("write", "", $ref)) {
449  $link = ilLink::_getLink($ref, 'sahs');
450  }
451  }
452 
453  $entry = ilObject::_lookupTitle($sm);
454  if ($link !== false) {
455  $entry = "<a href='" . $link . "' target='_top'>" . $entry . "</a>";
456  }
457 
458  $info->addProperty($lng->txt("obj_sahs"), $entry);
459  }
460  }
461 
462 
463  public function viewObject(): void
464  {
465  if ($this->in_administration) {
466  parent::viewObject();
467  return;
468  }
469 
470  if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
471  throw new ilPermissionException($this->lng->txt("permission_denied"));
472  }
473  }
474 
475  public function properties(): void
476  {
477  $this->checkPermission("write");
478 
479  $this->setSettingsSubTabs("general_settings");
480 
481  $this->initSettingsForm();
482 
483  // Edit ecs export settings
484  $ecs = new ilECSGlossarySettings($this->object);
485  $ecs->addSettingsToForm($this->form, 'glo');
486 
487  $this->tpl->setContent($this->form->getHTML());
488  }
489 
490  public function initSettingsForm(
491  string $a_mode = "edit"
492  ): void {
493  $obj_service = $this->getObjectService();
494 
495  $this->form = new ilPropertyFormGUI();
496 
497  // title
498  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
499  $title->setRequired(true);
500  $this->form->addItem($title);
501 
502  // description
503  $desc = new ilTextAreaInputGUI($this->lng->txt("desc"), "description");
504  $this->form->addItem($desc);
505 
506  // glossary mode
507  // for layout of this property see https://mantis.ilias.de/view.php?id=31833
508  $glo_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_content_assembly"), "glo_mode");
509  //$glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
510  $op1 = new ilRadioOption($this->lng->txt("glo_mode_normal"), "none", $this->lng->txt("glo_mode_normal_info"));
511  $glo_mode->addOption($op1);
512  $op2 = new ilRadioOption($this->lng->txt("glo_collection"), "coll", $this->lng->txt("glo_collection_info"));
513  $glo_mode->addOption($op2);
514 
515  $glo_mode2 = new ilRadioGroupInputGUI("", "glo_mode2");
516  $glo_mode2->setValue("level");
517  $op3 = new ilRadioOption($this->lng->txt("glo_mode_level"), "level", $this->lng->txt("glo_mode_level_info"));
518  $glo_mode2->addOption($op3);
519  $op4 = new ilRadioOption($this->lng->txt("glo_mode_subtree"), "subtree", $this->lng->txt("glo_mode_subtree_info"));
520  $glo_mode2->addOption($op4);
521  $op2->addSubItem($glo_mode2);
522  $this->form->addItem($glo_mode);
523 
524 
525  $this->lng->loadLanguageModule("rep");
526  $section = new ilFormSectionHeaderGUI();
527  $section->setTitle($this->lng->txt('rep_activation_availability'));
528  $this->form->addItem($section);
529 
530  // online
531  $online = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
532  $online->setValue("y");
533  $online->setInfo($this->lng->txt("glo_online_info"));
534  $this->form->addItem($online);
535 
536  /*
537  $section = new ilFormSectionHeaderGUI();
538  $section->setTitle($this->lng->txt('glo_content_settings'));
539  $this->form->addItem($section);*/
540 
541 
542  // glossary mode
543  /*$options = array(
544  "none"=>$this->lng->txt("glo_mode_normal"),
545  "level"=>$this->lng->txt("glo_mode_level"),
546  "subtree"=>$this->lng->txt("glo_mode_subtree")
547  );
548  $glo_mode = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
549  $glo_mode->setOptions($options);
550  $glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
551  $this->form->addItem($glo_mode);*/
552 
553 
554  $section = new ilFormSectionHeaderGUI();
555  $section->setTitle($this->lng->txt('cont_presentation'));
556  $this->form->addItem($section);
557 
558  // tile image
559  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
560 
561  // presentation mode
562  $pres_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_presentation_mode"), "pres_mode");
563  $pres_mode->setValue("table");
564  $op1 = new ilRadioOption($this->lng->txt("glo_table_form"), "table", $this->lng->txt("glo_table_form_info"));
565 
566  // short text length
567  $snl = new ilNumberInputGUI($this->lng->txt("glo_text_snippet_length"), "snippet_length");
568  $snl->setMaxValue(3000);
569  $snl->setMinValue(100);
570  $snl->setMaxLength(4);
571  $snl->setSize(4);
572  $snl->setInfo($this->lng->txt("glo_text_snippet_length_info"));
573  $snl->setValue(200);
574  $snl->setSuffix($this->lng->txt("characters"));
575  $op1->addSubItem($snl);
576 
577  $pres_mode->addOption($op1);
578  $op2 = new ilRadioOption($this->lng->txt("glo_full_definitions"), "full_def", $this->lng->txt("glo_full_definitions_info"));
579  $pres_mode->addOption($op2);
580  $this->form->addItem($pres_mode);
581 
582  // show taxonomy
583  $show_tax = null;
584  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
585  if (count($tax_ids) > 0) {
586  $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
587  $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info"));
588  $this->form->addItem($show_tax);
589  }
590 
591  // downloads
592  $down = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "glo_act_downloads");
593  $down->setValue("y");
594  $down->setInfo($this->lng->txt("cont_downloads_desc"));
595  $this->form->addItem($down);
596 
597  if ($a_mode == "edit") {
598  $title->setValue($this->object->getTitle());
599  $desc->setValue($this->object->getDescription());
600  $online->setChecked($this->object->getOnline());
601  $mode1 = $this->object->getVirtualMode() === "none"
602  ? "none"
603  : "coll";
604  $mode2 = $this->object->getVirtualMode() !== "none"
605  ? $this->object->getVirtualMode()
606  : "level";
607  $glo_mode->setValue($mode1);
608  $glo_mode2->setValue($mode2);
609  $pres_mode->setValue($this->object->getPresentationMode());
610  $snl->setValue($this->object->getSnippetLength());
611  if (count($tax_ids) > 0) {
612  $show_tax->setChecked($this->object->getShowTaxonomy());
613  }
614 
615  $down->setChecked($this->object->isActiveDownloads());
616 
617  // additional features
618  $feat = new ilFormSectionHeaderGUI();
619  $feat->setTitle($this->lng->txt('obj_features'));
620  $this->form->addItem($feat);
621 
623  $this->object->getId(),
624  $this->form,
625  array(
627  )
628  );
629  }
630 
631  // sort columns, if adv fields are given
632  $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getRefId());
633  $cols = $adv_ap->getColumnOrder();
634  if (count($cols) > 1) {
635  $ti = new ilGloAdvColSortInputGUI($this->lng->txt("cont_col_ordering"), "field_order");
636  $this->form->addItem($ti);
637  $ti->setValue($cols);
638  $ti->setInfo($this->lng->txt("glo_col_ordering_info"));
639  }
640 
641  // save and cancel commands
642  $this->form->addCommandButton("saveProperties", $this->lng->txt("save"));
643 
644  $this->form->setTitle($this->lng->txt("cont_glo_properties"));
645  $this->form->setFormAction($this->ctrl->getFormAction($this));
646  }
647 
648 
649  public function saveProperties(): void
650  {
651  $obj_service = $this->getObjectService();
652 
653  $this->initSettingsForm();
654  if ($this->form->checkInput()) {
655  $this->object->setTitle($this->form->getInput("title"));
656  $this->object->setDescription($this->form->getInput("description"));
657  $this->object->setOnline(ilUtil::yn2tf($this->form->getInput("cobj_online")));
658  $glo_mode = $this->form->getInput("glo_mode") === "none"
659  ? $this->form->getInput("glo_mode")
660  : $this->form->getInput("glo_mode2");
661  $this->object->setVirtualMode($glo_mode);
662  $this->object->setActiveDownloads(ilUtil::yn2tf($this->form->getInput("glo_act_downloads")));
663  $this->object->setPresentationMode($this->form->getInput("pres_mode"));
664  $this->object->setSnippetLength($this->form->getInput("snippet_length"));
665  $this->object->setShowTaxonomy($this->form->getInput("show_tax"));
666  $this->object->update();
667 
668  // tile image
669  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
670 
671  // field order of advanced metadata
672  $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getRefId());
673  $cols = $adv_ap->getColumnOrder();
674  if (count($cols) > 1) {
675  $adv_ap->saveColumnOrder($this->form->getInput("field_order"));
676  }
677 
678  // set definition short texts dirty
680 
682  $this->object->getId(),
683  $this->form,
684  array(
686  )
687  );
688 
689  // Update ecs export settings
690  $ecs = new ilECSGlossarySettings($this->object);
691  if ($ecs->handleSettingsUpdate()) {
692  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
693  $this->ctrl->redirect($this, "properties");
694  }
695  }
696  $this->form->setValuesByPost();
697  $this->tpl->setContent($this->form->getHTML());
698  }
699 
700  public function listTerms(): void
701  {
702  $this->showTaxonomy();
703 
704  // term
705  $ti = new ilTextInputGUI($this->lng->txt("cont_new_term"), "new_term");
706  $ti->setMaxLength(80);
707  $ti->setSize(20);
708  $this->toolbar->addInputItem($ti, true);
709 
710  // language
711  $this->lng->loadLanguageModule("meta");
713  $session_lang = $this->term_manager->getSessionLang();
714  if ($session_lang != "") {
715  $s_lang = $session_lang;
716  } else {
717  $s_lang = $this->user->getLanguage();
718  }
719  $si = new ilSelectInputGUI($this->lng->txt("language"), "term_language");
720  $si->setOptions($lang);
721  $si->setValue($s_lang);
722  $this->toolbar->addInputItem($si, true);
723 
724  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
725  $this->toolbar->addFormButton($this->lng->txt("glo_add_new_term"), "addTerm");
726 
727  $this->toolbar->addSeparator();
728 
729  //ilEditClipboard::getAction() == "copy"
730  if ($this->user->clipboardHasObjectsOfType("term")) {
731  $this->toolbar->addButton(
732  $this->lng->txt("paste"),
733  $this->ctrl->getLinkTarget($this, "pasteTerms")
734  );
735  $this->toolbar->addButton(
736  $this->lng->txt("clear_clipboard"),
737  $this->ctrl->getLinkTarget($this, "clearClipboard")
738  );
739  } else {
740  $this->toolbar->addButton(
741  $this->lng->txt("glo_add_from_other"),
742  $this->ctrl->getLinkTargetByClass("ilglossaryforeigntermcollectorgui", "")
743  );
744  }
745 
746  $this->tabs->activateTab("cont_terms");
747 
748  $tab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
749  $this->tpl->setContent($tab->getHTML());
750  }
751 
752  public function actTaxonomy(): void
753  {
754  $this->ctrl->setParameter($this, "show_tax", 1);
755  $this->ctrl->redirect($this, "listTerms");
756  }
757 
761  public function deactTaxonomy(): void
762  {
763  $this->ctrl->setParameter($this, "show_tax", "");
764  $this->ctrl->redirect($this, "listTerms");
765  }
766 
767 
771  public function addTerm(): void
772  {
773  $new_term = $this->edit_request->getNewTerm();
774  if ($new_term == "") {
775  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_please_enter_a_term"), true);
776  $this->ctrl->redirect($this, "listTerms");
777  }
778 
779  // add term
780  $lang = $this->edit_request->getTermLanguage();
781  $term = new ilGlossaryTerm();
782  $term->setGlossary($this->getGlossary());
783  $term->setTerm($new_term);
784  $term->setLanguage($lang);
785  $term->create();
786 
787  $this->term_manager->setSessionLang($lang);
788 
789  // add first definition
790  $def = new ilGlossaryDefinition();
791  $def->setTermId($term->getId());
792  $def->setTitle($new_term);
793  $def->create();
794 
795  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
796  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
797  $this->ctrl->redirectByClass(array("ilglossarytermgui",
798  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
799  }
800 
804  public function moveDefinitionUp(): void
805  {
806  $definition = new ilGlossaryDefinition(
807  $this->edit_request->getDefinitionId()
808  );
809  $definition->moveUp();
810 
811  $this->ctrl->redirect($this, "listTerms");
812  }
813 
817  public function moveDefinitionDown(): void
818  {
819  $definition = new ilGlossaryDefinition(
820  $this->edit_request->getDefinitionId()
821  );
822  $definition->moveDown();
823 
824  $this->ctrl->redirect($this, "listTerms");
825  }
826 
830  public function confirmDefinitionDeletion(): void
831  {
832  $term = new ilGlossaryTerm($this->term_id);
833 
834  $add = "";
835  $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id);
836  if ($nr > 0) {
837  $this->ctrl->setParameterByClass(
838  "ilglossarytermgui",
839  "term_id",
840  $this->term_id
841  );
842  $link = "[<a href='" .
843  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
844  "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
845  $add = "<br/>" . sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link;
846  }
847 
848  $cgui = new ilConfirmationGUI();
849  $cgui->setHeaderText($this->lng->txt("info_delete_sure") . $add);
850 
851  $cgui->setFormAction($this->ctrl->getFormAction($this));
852  $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion");
853  $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition");
854 
855  // content style
856  $this->setContentStyleSheet($this->tpl);
857 
858  // syntax style
859  $this->tpl->setCurrentBlock("SyntaxStyle");
860  $this->tpl->setVariable(
861  "LOCATION_SYNTAX_STYLESHEET",
863  );
864  $this->tpl->parseCurrentBlock();
865 
866  $definition = new ilGlossaryDefinition(
867  $this->edit_request->getDefinitionId()
868  );
869  $page_gui = new ilGlossaryDefPageGUI($definition->getId());
870  $page_gui->setTemplateOutput(false);
871  $page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
872  $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->requested_ref_id);
873  $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->requested_ref_id);
874  $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->requested_ref_id);
875  $output = $page_gui->preview();
876 
877  $cgui->addItem(
878  "def",
879  $this->edit_request->getDefinitionId(),
880  $term->getTerm() . $output
881  );
882 
883  $this->tpl->setContent($cgui->getHTML());
884  }
885 
886  public function cancelDefinitionDeletion(): void
887  {
888  $this->ctrl->redirect($this, "listTerms");
889  }
890 
891  public function deleteDefinition(): void
892  {
893  $definition = new ilGlossaryDefinition($this->edit_request->getDefinitionId());
894  $definition->delete();
895  $this->ctrl->redirect($this, "listTerms");
896  }
897 
898  public function export(): void
899  {
900  $this->checkPermission("write");
901  $glo_exp = new ilGlossaryExport($this->getGlossary());
902  $glo_exp->buildExportFile();
903  $this->ctrl->redirectByClass("ilexportgui", "");
904  }
905 
909  public function exportHTML(): void
910  {
911  $glo_exp = new ilGlossaryExport($this->getGlossary(), "html");
912  $glo_exp->buildExportFile();
913  $this->ctrl->redirectByClass("ilexportgui", "");
914  }
915 
919  public function publishExportFile(): void
920  {
921  $files = $this->edit_request->getFiles();
922  if (count($files) == 0) {
923  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
924  $this->ctrl->redirectByClass("ilexportgui", "");
925  }
926  if (count($files) > 1) {
927  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
928  $this->ctrl->redirectByClass("ilexportgui", "");
929  }
930 
931  $file = explode(":", $files[0]);
932  $export_dir = $this->object->getExportDirectory($file[0]);
933 
934  if ($this->object->getPublicExportFile($file[0]) ==
935  $file[1]) {
936  $this->object->setPublicExportFile($file[0], "");
937  } else {
938  $this->object->setPublicExportFile($file[0], $file[1]);
939  }
940  $this->object->update();
941  $this->ctrl->redirectByClass("ilexportgui", "");
942  }
943 
944  public function confirmTermDeletion(): void
945  {
946  $ids = $this->edit_request->getIds();
947  if (count($ids) == 0) {
948  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
949  $this->ctrl->redirect($this, "listTerms");
950  }
951 
952  // check ids
953  foreach ($ids as $term_id) {
954  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($term_id);
955  if ($term_glo_id != $this->object->getId() && !ilGlossaryTermReferences::isReferenced([$this->object->getId()], $term_id)) {
956  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("glo_term_must_belong_to_glo"), true);
957  $this->ctrl->redirect($this, "listTerms");
958  }
959  }
960 
961  // display confirmation message
962  $cgui = new ilConfirmationGUI();
963  $cgui->setFormAction($this->ctrl->getFormAction($this));
964  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
965  $cgui->setCancel($this->lng->txt("cancel"), "cancelTermDeletion");
966  $cgui->setConfirm($this->lng->txt("confirm"), "deleteTerms");
967 
968  foreach ($ids as $id) {
969  $term = new ilGlossaryTerm($id);
970 
971  $add = "";
973  if ($nr > 0) {
974  $this->ctrl->setParameterByClass(
975  "ilglossarytermgui",
976  "term_id",
977  $id
978  );
979 
980  if (ilGlossaryTermReferences::isReferenced([$this->object->getId()], $id)) {
981  $add = " (" . $this->lng->txt("glo_term_reference") . ")";
982  } else {
983  $link = "[<a href='" .
984  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
985  "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
986  $add = "<div class='small'>" .
987  sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link . "</div>";
988  }
989  }
990 
991  $cgui->addItem("id[]", $id, $term->getTerm() . $add);
992  }
993 
994  $this->tpl->setContent($cgui->getHTML());
995  }
996 
997  public function cancelTermDeletion(): void
998  {
999  $this->ctrl->redirect($this, "listTerms");
1000  }
1001 
1002  public function deleteTerms(): void
1003  {
1004  $ids = $this->edit_request->getIds();
1005  foreach ($ids as $id) {
1006  if (ilGlossaryTermReferences::isReferenced([$this->object->getId()], $id)) {
1007  $refs = new ilGlossaryTermReferences($this->object->getId());
1008  $refs->deleteTerm($id);
1009  $refs->update();
1010  } else {
1011  $term = new ilGlossaryTerm($id);
1012  $term->delete();
1013  }
1014  }
1015  $this->ctrl->redirect($this, "listTerms");
1016  }
1017 
1018  protected function setLocator(): void
1019  {
1020  if (strtolower($this->edit_request->getBaseClass()) != "ilglossaryeditorgui") {
1021  parent::setLocator();
1022  } elseif (is_object($this->object)) {
1023  $gloss_loc = new ilGlossaryLocatorGUI();
1024  if (is_object($this->term)) {
1025  $gloss_loc->setTerm($this->term);
1026  }
1027  $gloss_loc->setGlossary($this->getGlossary());
1028  $gloss_loc->display();
1029  }
1030  }
1031 
1032  public function view(): void
1033  {
1034  $this->viewObject();
1035  }
1036 
1037  public function addDefinition(): void
1038  {
1039  $term_id = $this->edit_request->getTermId();
1040 
1041  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($term_id);
1042  if ($term_glo_id != $this->object->getId()) {
1043  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("glo_term_must_belong_to_glo"), true);
1044  $this->ctrl->redirect($this, "listTerms");
1045  }
1046 
1047  // add term
1048  $term = new ilGlossaryTerm($term_id);
1049 
1050  // add first definition
1051  $def = new ilGlossaryDefinition();
1052  $def->setTermId($term->getId());
1053  $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
1054  $def->create();
1055 
1056  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
1057  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
1058  $this->ctrl->redirectByClass(array("ilglossarytermgui",
1059  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
1060  }
1061 
1062  public function getTemplate(): void
1063  {
1064  $this->tpl->loadStandardTemplate();
1065 
1066  $title = $this->object->getTitle();
1067 
1068 
1069  if ($this->term_id > 0) {
1070  $this->tpl->setTitle($this->lng->txt("term") . ": " .
1071  ilGlossaryTerm::_lookGlossaryTerm($this->term_id));
1072  } else {
1073  parent::setTitleAndDescription();
1074  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
1075  $this->tpl->setTitle($this->lng->txt("glo") . ": " . $title);
1076  }
1077  }
1078 
1079  protected function getTabs(): void
1080  {
1081  $this->help->setScreenIdComponent("glo");
1082 
1083  // list terms
1084  $cmd = $this->ctrl->getCmd();
1085  $force_active = ($cmd == "" || $cmd == "listTerms");
1086  $this->tabs_gui->addTarget(
1087  "cont_terms",
1088  $this->ctrl->getLinkTarget($this, "listTerms"),
1089  array("listTerms", ""),
1090  get_class($this),
1091  "",
1092  $force_active
1093  );
1094 
1095  $force_active = false;
1096  if ($this->ctrl->getCmd() == "showSummary" ||
1097  strtolower($this->ctrl->getNextClass()) == "ilinfoscreengui") {
1098  $force_active = true;
1099  }
1100  $this->tabs_gui->addTarget(
1101  "info_short",
1102  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
1103  "",
1104  "ilInfoScreenGUI",
1105  "",
1106  $force_active
1107  );
1108 
1109  // properties
1110  if ($this->rbacsystem->checkAccess('write', $this->object->getRefId())) {
1111  $this->tabs_gui->addTarget(
1112  "settings",
1113  $this->ctrl->getLinkTarget($this, "properties"),
1114  "properties",
1115  get_class($this)
1116  );
1117 
1118  // meta data
1119  $mdgui = new ilObjectMetaDataGUI($this->object, "term");
1120  $mdtab = $mdgui->getTab();
1121  if ($mdtab) {
1122  $this->tabs_gui->addTarget(
1123  "meta_data",
1124  $mdtab,
1125  "",
1126  "ilobjectmetadatagui"
1127  );
1128  }
1129 
1130  // export
1131  /*$tabs_gui->addTarget("export",
1132  $this->ctrl->getLinkTarget($this, "exportList"),
1133  array("exportList", "viewExportLog"), get_class($this));*/
1134 
1135  // export
1136  $this->tabs_gui->addTarget(
1137  "export",
1138  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1139  "",
1140  "ilexportgui"
1141  );
1142  }
1143 
1144  // permissions
1145  if ($this->rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
1146  /*$tabs_gui->addTarget("permission_settings",
1147  $this->ctrl->getLinkTarget($this, "perm"),
1148  array("perm", "info"),
1149  get_class($this));
1150  */
1151  $this->tabs_gui->addTarget(
1152  "perm_settings",
1153  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1154  array("perm","info","owner"),
1155  'ilpermissiongui'
1156  );
1157  }
1158 
1159  $this->tabs_gui->addNonTabbedLink(
1160  "presentation_view",
1161  $this->lng->txt("glo_presentation_view"),
1162  "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->object->getRefId(),
1163  "_top"
1164  );
1165  }
1166 
1167  public function setSettingsSubTabs(string $a_active): void
1168  {
1169  if (in_array(
1170  $a_active,
1171  array("general_settings", "style", "taxonomy", "glossaries")
1172  )) {
1173  // general properties
1174  $this->tabs->addSubTab(
1175  "general_settings",
1176  $this->lng->txt("settings"),
1177  $this->ctrl->getLinkTarget($this, 'properties')
1178  );
1179 
1180  // style properties
1181  $this->tabs->addSubTab(
1182  "style",
1183  $this->lng->txt("obj_sty"),
1184  $this->ctrl->getLinkTargetByClass("ilobjectcontentstylesettingsgui", '')
1185  );
1186 
1187  // taxonomy
1189  $this->tabs->addSubTab(
1190  "taxonomy",
1191  $this->lng->txt("tax_taxonomy"),
1192  $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", '')
1193  );
1194 
1195  // style properties
1196  $this->tabs->addSubTab(
1197  "glossaries",
1198  $this->lng->txt("cont_auto_glossaries"),
1199  $this->ctrl->getLinkTarget($this, 'editGlossaries')
1200  );
1201 
1202  $this->tabs->activateSubTab($a_active);
1203  }
1204  }
1205 
1206 
1207  public static function _goto(string $a_target): void
1208  {
1209  global $DIC;
1210  $main_tpl = $DIC->ui()->mainTemplate();
1211 
1212  $lng = $DIC->language();
1213  $ilAccess = $DIC->access();
1214  $ctrl = $DIC->ctrl();
1215 
1216  if ($ilAccess->checkAccess("read", "", $a_target)) {
1217  $ctrl->setParameterByClass("ilGlossaryPresentationGUI", "ref_id", $a_target);
1218  $ctrl->redirectByClass("ilGlossaryPresentationGUI", "");
1219  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1220  $ctrl->setParameterByClass("ilGlossaryPresentationGUI", "ref_id", $a_target);
1221  $ctrl->redirectByClass("ilGlossaryPresentationGUI", "infoScreen");
1222  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1223  $main_tpl->setOnScreenMessage('failure', sprintf(
1224  $lng->txt("msg_no_perm_read_item"),
1226  ), true);
1228  }
1229 
1230  throw new ilPermissionException($lng->txt("no_permission"));
1231  }
1232 
1233  public function applyFilter(): void
1234  {
1235  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1236  $prtab->resetOffset();
1237  $prtab->writeFilterToSession();
1238  $this->listTerms();
1239  }
1240 
1241  public function resetFilter(): void
1242  {
1243  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1244  $prtab->resetOffset();
1245  $prtab->resetFilter();
1246  $this->listTerms();
1247  }
1248 
1249 
1253 
1254  public function setContentStyleSheet(
1255  ilGlobalTemplateInterface $a_tpl = null
1256  ): void {
1257  if ($a_tpl != null) {
1258  $ctpl = $a_tpl;
1259  } else {
1260  $ctpl = $this->tpl;
1261  }
1262 
1263  $this->content_style_gui->addCss($ctpl, $this->object->getRefId());
1264  }
1265 
1269  public function getPublicAccessColValue(
1270  string $a_type,
1271  string $a_file
1272  ): string {
1273  if ($this->object->getPublicExportFile($a_type) == $a_file) {
1274  return $this->lng->txt("yes");
1275  }
1276 
1277  return " ";
1278  }
1279 
1283  public function showTaxonomy(): void
1284  {
1285  global $DIC;
1286 
1287  $ctrl = $DIC->ctrl();
1288 
1289  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1290  if (count($tax_ids) > 0) {
1291  $tax_id = $tax_ids[0];
1292  $DIC->globalScreen()->tool()->context()->current()
1293  ->addAdditionalData(
1295  true
1296  );
1297  $DIC->globalScreen()->tool()->context()->current()
1298  ->addAdditionalData(
1301  );
1302  $DIC->globalScreen()->tool()->context()->current()
1303  ->addAdditionalData(
1305  $tax_id
1306  );
1307  $DIC->globalScreen()->tool()->context()->current()
1308  ->addAdditionalData(
1310  "listTerms"
1311  );
1312  $DIC->globalScreen()->tool()->context()->current()
1313  ->addAdditionalData(
1315  "showTaxonomy"
1316  );
1317 
1318 
1319  $tax_exp = new ilTaxonomyExplorerGUI(
1320  get_class($this),
1321  "showTaxonomy",
1322  $tax_ids[0],
1323  "ilobjglossarygui",
1324  "listTerms"
1325  );
1326  if (!$tax_exp->handleCommand()) {
1327  //$this->tpl->setLeftNavContent($tax_exp->getHTML());
1328  //$this->tpl->setLeftNavContent($tax_exp->getHTML() . "&nbsp;");
1329  }
1330  }
1331  }
1332 
1333  //
1334  // Auto glossaries
1335  //
1336 
1340  public function editGlossaries(): void
1341  {
1342  $this->tabs->setTabActive("settings");
1343  $this->setSettingsSubTabs("glossaries");
1344 
1345  $this->toolbar->addButton(
1346  $this->lng->txt("add"),
1347  $this->ctrl->getLinkTarget($this, "showGlossarySelector")
1348  );
1349 
1350  $tab = new ilGlossaryAutoLinkTableGUI($this->getGlossary(), $this, "editGlossaries");
1351 
1352  $this->tpl->setContent($tab->getHTML());
1353  }
1354 
1358  public function showGlossarySelector(): void
1359  {
1360  $this->tabs->setTabActive("settings");
1361  $this->setSettingsSubTabs("glossaries");
1362 
1363  $exp = new ilSearchRootSelector($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1364  $search_root_expand = $this->edit_request->getSearchRootExpand();
1365  $exp->setExpand($search_root_expand ?: $this->tree->readRootId());
1366  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1367  $exp->setTargetClass(get_class($this));
1368  $exp->setCmd('confirmGlossarySelection');
1369  $exp->setClickableTypes(array("glo"));
1370  $exp->addFilter("glo");
1371 
1372  // build html-output
1373  $exp->setOutput(0);
1374  $this->tpl->setContent($exp->getOutput());
1375  }
1376 
1377  public function confirmGlossarySelection(): void
1378  {
1379  $cgui = new ilConfirmationGUI();
1380  $this->ctrl->setParameter($this, "glo_ref_id", $this->edit_request->getGlossaryRefId());
1381  $cgui->setFormAction($this->ctrl->getFormAction($this));
1382  $cgui->setHeaderText($this->lng->txt("glo_link_glo_in_glo"));
1383  $cgui->setCancel($this->lng->txt("no"), "selectGlossary");
1384  $cgui->setConfirm($this->lng->txt("yes"), "selectGlossaryLink");
1385  $this->tpl->setContent($cgui->getHTML());
1386  }
1387 
1391  public function selectGlossaryLink(): void
1392  {
1393  $glo_ref_id = $this->edit_request->getGlossaryRefId();
1394  $this->object->autoLinkGlossaryTerms($glo_ref_id);
1395  $this->selectGlossary();
1396  }
1397 
1398 
1402  public function selectGlossary(): void
1403  {
1404  $glos = $this->object->getAutoGlossaries();
1405  $glo_ref_id = $this->edit_request->getGlossaryRefId();
1406  $glo_id = ilObject::_lookupObjId($glo_ref_id);
1407  if (!in_array($glo_id, $glos)) {
1408  $glos[] = $glo_id;
1409  }
1410  $this->object->setAutoGlossaries($glos);
1411  $this->object->update();
1412 
1413  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1414  $this->ctrl->redirect($this, "editGlossaries");
1415  }
1416 
1417  public function removeGlossary(): void
1418  {
1419  $this->object->removeAutoGlossary($this->edit_request->getGlossaryId());
1420  $this->object->update();
1421 
1422  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1423  $this->ctrl->redirect($this, "editGlossaries");
1424  }
1425 
1429  public function copyTerms(): void
1430  {
1431  $items = $this->edit_request->getIds();
1432  if (count($items) == 0) {
1433  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1434  $this->ctrl->redirect($this, "listTerms");
1435  }
1436 
1437  $this->user->clipboardDeleteObjectsOfType("term");
1438 
1439  // put them into the clipboard
1440  $time = date("Y-m-d H:i:s");
1441  $order = 0;
1442  foreach ($items as $id) {
1443  $this->user->addObjectToClipboard(
1444  $id,
1445  "term",
1447  0,
1448  $time,
1449  $order
1450  );
1451  }
1452 
1454  $this->tpl->setOnScreenMessage('info', $this->lng->txt("glo_selected_terms_have_been_copied"), true);
1455  $this->ctrl->redirect($this, "listTerms");
1456  }
1457 
1461  public function referenceTerms(): void
1462  {
1463  $items = $this->edit_request->getIds();
1464  if (count($items) == 0) {
1465  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1466  $this->ctrl->redirect($this, "listTerms");
1467  }
1468 
1469  $this->user->clipboardDeleteObjectsOfType("term");
1470 
1471  // put them into the clipboard
1472  $time = date("Y-m-d H:i:s");
1473  $order = 0;
1474  foreach ($items as $id) {
1475  $this->user->addObjectToClipboard(
1476  $id,
1477  "term",
1479  0,
1480  $time,
1481  $order
1482  );
1483  }
1484 
1486  $this->tpl->setOnScreenMessage('info', $this->lng->txt("glo_selected_terms_have_been_copied"), true);
1487  $this->ctrl->redirect($this, "listTerms");
1488  }
1489 
1490 
1491  public function clearClipboard(): void
1492  {
1493  $this->user->clipboardDeleteObjectsOfType("term");
1494  $this->ctrl->redirect($this, "listTerms");
1495  }
1496 
1497  public function pasteTerms(): void
1498  {
1499  if (ilEditClipboard::getAction() == "copy") {
1500  foreach ($this->user->getClipboardObjects("term") as $item) {
1501  ilGlossaryTerm::_copyTerm($item["id"], $this->object->getId());
1502  }
1503  }
1504  if (ilEditClipboard::getAction() == "link") {
1505  $refs = new ilGlossaryTermReferences($this->object->getId());
1506  foreach ($this->user->getClipboardObjects("term") as $item) {
1507  $refs->addTerm($item["id"]);
1508  }
1509  $refs->update();
1510  }
1511  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1512  $this->ctrl->redirect($this, "listTerms");
1513  }
1514 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct( $a_data, int $a_id=0, bool $a_call_by_reference=true, bool $a_prepare_output=true)
static getInstance(ilObjGlossaryGUI $a_glossary_gui)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static setAction(string $a_action)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static setShortTextsDirty(int $a_glo_id)
Set all short texts of glossary dirty (e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContentStyleSheet(ilGlobalTemplateInterface $a_tpl=null)
Class ilInfoScreenGUI.
static addUsagesToInfo(ilInfoScreenGUI $info, int $glo_id)
Add usages to info screen.
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for the workflow of copying objects.
const ROOT_FOLDER_ID
Definition: constants.php:32
const TITLE_LENGTH
editGlossaries()
Edit automatically linked glossaries.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareOutput(bool $show_sub_objects=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initCreateForm(string $new_type)
moveDefinitionUp()
move a definition up
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initSettingsForm(string $a_mode="edit")
setInfo(string $a_info)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static _getAllReferences(int $id)
get all reference ids for object ID
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Help GUI class.
ILIAS Glossary Term TermManager $term_manager
setTarget(string $a_target)
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
static getScormModulesForGlossary(int $a_glo_id)
Get SCORM modules that assign a certain glossary.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
This class represents a checkbox property in a property form.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
exportHTML()
create html package
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPublicAccessColValue(string $a_type, string $a_file)
Get public access value for export table.
createObject()
create new object form
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
setGlossary(ilObjGlossary $a_glossary)
static isReferenced(array $a_glo_id, int $a_term_id)
Is a term referenced by a set of glossaries.
static _lookupObjId(int $ref_id)
static _copyTerm(int $a_term_id, int $a_glossary_id)
Copy a term to a glossary.
showTaxonomy()
Show taxonomy.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
moveDefinitionDown()
move a definition down
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Style Content GUIService $content_style_gui
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
ILIAS Glossary Editing EditingGUIRequest $edit_request
ilGlossaryTermPermission $term_perm
deactTaxonomy()
Hide Taxonomy.
static _lookupTitle(int $obj_id)
setTerm(string $a_term)
setFormAction(string $a_formaction)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a number property in a property form.
selectGlossaryLink()
Select a glossary and link all its terms.
initDidacticTemplate(ilPropertyFormGUI $form)
Class ilObjectGUI Basic methods of all Output classes.
setValue(string $a_value)
static _lookGlossaryTerm(int $term_id)
get glossary term
static _goto(string $a_target)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addSection(string $a_title)
ILIAS Style Content Object ObjectFacade $content_style_domain
copyTerms()
Copy terms to clipboard.
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
form( $class_path, string $cmd)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
setLanguage(string $a_language)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$lang
Definition: xapiexit.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
putObjectInTree(ilObject $obj, int $parent_node_id=null)
Add object to tree at given position.
setSettingsSubTabs(string $a_active)
getCurrentClassPath()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
selectGlossary()
Select auto glossary.
referenceTerms()
Add terms to be referenced to clipboard.
confirmDefinitionDeletion()
deletion confirmation screen
static yn2tf(string $a_yn)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
ilPropertyFormGUI $form
setTabs()
set admin tabs
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
delete()
delete glossary term (and all its definition objects)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getNumberOfUsages(int $a_term_id)
showGlossarySelector()
Show auto glossary selection.
publishExportFile()
download export file
addHeaderAction()
Add header action menu.
$cols
Definition: xhr_table.php:11
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.
static _lookGlossaryID(int $term_id)
get glossary id form term id