ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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->getTemplate();
196  $this->setTabs();
197  $this->setLocator();
198  $this->addHeaderAction();
199  $this->tabs->activateTab("settings");
200  $this->setSettingsSubTabs("taxonomy");
201 
202  $this->ctrl->setReturn($this, "properties");
203  $tax_gui = new ilObjTaxonomyGUI();
204  $tax_gui->setMultiple(false);
205 
206  $tax_gui->setAssignedObject($this->object->getId());
207  $ret = $this->ctrl->forwardCommand($tax_gui);
208  break;
209 
210  case "ilexportgui":
211  $this->getTemplate();
212  $this->setTabs();
213  $this->tabs->activateTab("export");
214  $this->setLocator();
215  $exp_gui = new ilExportGUI($this);
216  //$exp_gui->addFormat("xml", "", $this, "export");
217  $exp_gui->addFormat("xml");
218  $exp_gui->addFormat("html", "", $this, "exportHTML");
219  $exp_gui->addCustomColumn(
220  $this->lng->txt("cont_public_access"),
221  $this,
222  "getPublicAccessColValue"
223  );
224  $exp_gui->addCustomMultiCommand(
225  $this->lng->txt("cont_public_access"),
226  $this,
227  "publishExportFile"
228  );
229  $ret = $this->ctrl->forwardCommand($exp_gui);
230  break;
231 
232  case 'ilobjectcopygui':
233  $this->prepareOutput();
234  $cp = new ilObjectCopyGUI($this);
235  $cp->setType('glo');
236  $this->ctrl->forwardCommand($cp);
237  break;
238 
239  case "ilglossaryforeigntermcollectorgui":
240  $this->ctrl->setReturn($this, "");
241  $this->getTemplate();
242  $this->setTabs();
243  $this->setLocator();
244  $this->addHeaderAction();
246  $this->ctrl->forwardCommand($coll);
247  break;
248 
249  default:
250  $cmd = $this->ctrl->getCmd("listTerms");
251 
252  if (($cmd == "create") && ($this->edit_request->getNewType() == "term")) {
253  $this->ctrl->setCmd("create");
254  $this->ctrl->setCmdClass("ilGlossaryTermGUI");
255  $this->executeCommand();
256  return;
257  } else {
258  if ($cmd != "quickList") {
259  if ($this->in_administration ||
260  $this->getCreationMode() == true) {
261  $this->prepareOutput();
262  $cmd .= "Object";
263  } else {
264  $this->getTemplate();
265  $this->setTabs();
266  $this->setLocator();
267  $this->addHeaderAction();
268 
269  if ($cmd == "redrawHeaderAction") {
270  $cmd = "redrawHeaderActionObject";
271  }
272  }
273  }
274  $this->$cmd();
275  }
276  break;
277  }
278 
279  if ($cmd != "quickList") {
280  if (!$this->in_administration && !$this->getCreationMode()) {
281  $this->tpl->printToStdout();
282  }
283  } else {
284  $this->tpl->printToStdout(false);
285  }
286  }
287 
291  public function getGlossary(): ?ilObjGlossary
292  {
294  $glossary = $this->object;
295  if (isset($glossary) && $glossary->getType() == "glo") {
296  return $glossary;
297  }
298  return null;
299  }
300 
301  protected function assignObject(): void
302  {
303  $this->object = new ilObjGlossary($this->id, true);
304  }
305 
306  protected function initCreateForm(string $new_type): ilPropertyFormGUI
307  {
308  $form = new ilPropertyFormGUI();
309  $form->setTarget("_top");
310  $form->setFormAction($this->ctrl->getFormAction($this));
311  $form->setTitle($this->lng->txt($new_type . "_new"));
312 
313  // title
314  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
315  $ti->setSize(min(40, ilObject::TITLE_LENGTH));
316  $ti->setMaxLength(ilObject::TITLE_LENGTH);
317  $ti->setRequired(true);
318  $form->addItem($ti);
319 
320  // description
321  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
322  $ta->setCols(40);
323  $ta->setRows(2);
324  $form->addItem($ta);
325 
326  // didactic template
327  $form = $this->initDidacticTemplate($form);
328 
329  $form->addCommandButton("save", $this->lng->txt($new_type . "_add"));
330  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
331 
332  return $form;
333  }
334 
335  public function importObject(): void
336  {
337  $this->createObject();
338  }
339 
340  public function saveObject(): void
341  {
342  $new_type = $this->edit_request->getNewType();
343 
344  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
345  if (!$this->checkPermissionBool("create", "", $new_type)) {
346  throw new ilPermissionException($this->lng->txt("no_create_permission"));
347  }
348 
349  $this->lng->loadLanguageModule($new_type);
350  $this->ctrl->setParameter($this, "new_type", $new_type);
351 
352  $form = $this->initCreateForm($new_type);
353  if ($form->checkInput()) {
354  $this->ctrl->setParameter($this, "new_type", "");
355 
356  $newObj = new ilObjGlossary();
357  $newObj->setType($new_type);
358  $newObj->setTitle($form->getInput("title"));
359  $newObj->setDescription($form->getInput("desc"));
360  $newObj->setVirtualMode("none");
361  $newObj->create();
362 
363  $this->putObjectInTree($newObj);
364 
365  // apply didactic template?
366  $dtpl = $this->getDidacticTemplateVar("dtpl");
367  if ($dtpl) {
368  $newObj->applyDidacticTemplate($dtpl);
369  }
370 
371  // always send a message
372  $this->tpl->setOnScreenMessage('success', $this->lng->txt("glo_added"), true);
373  $this->ctrl->setParameterByClass(
374  ilObjGlossaryGUI::class,
375  "ref_id",
376  $newObj->getRefId()
377  );
378  $this->ctrl->redirectByClass(
379  [ilGlossaryEditorGUI::class, ilObjGlossaryGUI::class],
380  "properties"
381  );
382  }
383 
384  // display only this form to correct input
385  $form->setValuesByPost();
386  $this->tpl->setContent($form->getHTML());
387  }
388 
389  public function showInfoScreen(): void
390  {
391  $this->getTemplate();
392  $this->setTabs();
393  $this->setLocator();
394  $this->lng->loadLanguageModule("meta");
395 
396  $info = new ilInfoScreenGUI($this);
397  $info->enablePrivateNotes();
398  $info->enableNews();
399  if ($this->access->checkAccess("write", "", $this->requested_ref_id)) {
400  $info->enableNewsEditing();
401  $news_set = new ilSetting("news");
402  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
403  if ($enable_internal_rss) {
404  $info->setBlockProperty("news", "settings", true);
405  }
406  }
407  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
408 
409  self::addUsagesToInfo($info, $this->object->getId());
410 
411  $this->ctrl->forwardCommand($info);
412  }
413 
417  public static function addUsagesToInfo(
418  ilInfoScreenGUI $info,
419  int $glo_id
420  ): void {
421  global $DIC;
422 
423  $lng = $DIC->language();
424  $ilAccess = $DIC->access();
425 
426  $info->addSection($lng->txt("glo_usages"));
428  foreach ($sms as $sm) {
429  $link = false;
430  $refs = ilObject::_getAllReferences($sm);
431  foreach ($refs as $ref) {
432  if ($link === false && $ilAccess->checkAccess("write", "", $ref)) {
433  $link = ilLink::_getLink($ref, 'sahs');
434  }
435  }
436 
437  $entry = ilObject::_lookupTitle($sm);
438  if ($link !== false) {
439  $entry = "<a href='" . $link . "' target='_top'>" . $entry . "</a>";
440  }
441 
442  $info->addProperty($lng->txt("obj_sahs"), $entry);
443  }
444  }
445 
446 
447  public function viewObject(): void
448  {
449  if ($this->in_administration) {
450  parent::viewObject();
451  return;
452  }
453 
454  if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
455  throw new ilPermissionException($this->lng->txt("permission_denied"));
456  }
457  }
458 
459  public function properties(): void
460  {
461  $this->checkPermission("write");
462 
463  $this->setSettingsSubTabs("general_settings");
464 
465  $this->initSettingsForm();
466 
467  // Edit ecs export settings
468  $ecs = new ilECSGlossarySettings($this->object);
469  $ecs->addSettingsToForm($this->form, 'glo');
470 
471  $this->tpl->setContent($this->form->getHTML());
472  }
473 
474  public function initSettingsForm(
475  string $a_mode = "edit"
476  ): void {
477  $obj_service = $this->getObjectService();
478 
479  $this->form = new ilPropertyFormGUI();
480 
481  // title
482  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
483  $title->setRequired(true);
484  $this->form->addItem($title);
485 
486  // description
487  $desc = new ilTextAreaInputGUI($this->lng->txt("desc"), "description");
488  $this->form->addItem($desc);
489 
490  // glossary mode
491  // for layout of this property see https://mantis.ilias.de/view.php?id=31833
492  $glo_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_content_assembly"), "glo_mode");
493  //$glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
494  $op1 = new ilRadioOption($this->lng->txt("glo_mode_normal"), "none", $this->lng->txt("glo_mode_normal_info"));
495  $glo_mode->addOption($op1);
496  $op2 = new ilRadioOption($this->lng->txt("glo_collection"), "coll", $this->lng->txt("glo_collection_info"));
497  $glo_mode->addOption($op2);
498 
499  $glo_mode2 = new ilRadioGroupInputGUI("", "glo_mode2");
500  $glo_mode2->setValue("level");
501  $op3 = new ilRadioOption($this->lng->txt("glo_mode_level"), "level", $this->lng->txt("glo_mode_level_info"));
502  $glo_mode2->addOption($op3);
503  $op4 = new ilRadioOption($this->lng->txt("glo_mode_subtree"), "subtree", $this->lng->txt("glo_mode_subtree_info"));
504  $glo_mode2->addOption($op4);
505  $op2->addSubItem($glo_mode2);
506  $this->form->addItem($glo_mode);
507 
508 
509  $this->lng->loadLanguageModule("rep");
510  $section = new ilFormSectionHeaderGUI();
511  $section->setTitle($this->lng->txt('rep_activation_availability'));
512  $this->form->addItem($section);
513 
514  // online
515  $online = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
516  $online->setValue("y");
517  $online->setInfo($this->lng->txt("glo_online_info"));
518  $this->form->addItem($online);
519 
520  /*
521  $section = new ilFormSectionHeaderGUI();
522  $section->setTitle($this->lng->txt('glo_content_settings'));
523  $this->form->addItem($section);*/
524 
525 
526  // glossary mode
527  /*$options = array(
528  "none"=>$this->lng->txt("glo_mode_normal"),
529  "level"=>$this->lng->txt("glo_mode_level"),
530  "subtree"=>$this->lng->txt("glo_mode_subtree")
531  );
532  $glo_mode = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
533  $glo_mode->setOptions($options);
534  $glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
535  $this->form->addItem($glo_mode);*/
536 
537 
538  $section = new ilFormSectionHeaderGUI();
539  $section->setTitle($this->lng->txt('cont_presentation'));
540  $this->form->addItem($section);
541 
542  // tile image
543  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
544 
545  // presentation mode
546  $pres_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_presentation_mode"), "pres_mode");
547  $pres_mode->setValue("table");
548  $op1 = new ilRadioOption($this->lng->txt("glo_table_form"), "table", $this->lng->txt("glo_table_form_info"));
549 
550  // short text length
551  $snl = new ilNumberInputGUI($this->lng->txt("glo_text_snippet_length"), "snippet_length");
552  $snl->setMaxValue(3000);
553  $snl->setMinValue(100);
554  $snl->setMaxLength(4);
555  $snl->setSize(4);
556  $snl->setInfo($this->lng->txt("glo_text_snippet_length_info"));
557  $snl->setValue(200);
558  $snl->setSuffix($this->lng->txt("characters"));
559  $op1->addSubItem($snl);
560 
561  $pres_mode->addOption($op1);
562  $op2 = new ilRadioOption($this->lng->txt("glo_full_definitions"), "full_def", $this->lng->txt("glo_full_definitions_info"));
563  $pres_mode->addOption($op2);
564  $this->form->addItem($pres_mode);
565 
566  // show taxonomy
567  $show_tax = null;
568  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
569  if (count($tax_ids) > 0) {
570  $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
571  $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info"));
572  $this->form->addItem($show_tax);
573  }
574 
575  // downloads
576  $down = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "glo_act_downloads");
577  $down->setValue("y");
578  $down->setInfo($this->lng->txt("cont_downloads_desc"));
579  $this->form->addItem($down);
580 
581  if ($a_mode == "edit") {
582  $title->setValue($this->object->getTitle());
583  $desc->setValue($this->object->getDescription());
584  $online->setChecked($this->object->getOnline());
585  $mode1 = $this->object->getVirtualMode() === "none"
586  ? "none"
587  : "coll";
588  $mode2 = $this->object->getVirtualMode() !== "none"
589  ? $this->object->getVirtualMode()
590  : "level";
591  $glo_mode->setValue($mode1);
592  $glo_mode2->setValue($mode2);
593  $pres_mode->setValue($this->object->getPresentationMode());
594  $snl->setValue($this->object->getSnippetLength());
595  if (count($tax_ids) > 0) {
596  $show_tax->setChecked($this->object->getShowTaxonomy());
597  }
598 
599  $down->setChecked($this->object->isActiveDownloads());
600 
601  // additional features
602  $feat = new ilFormSectionHeaderGUI();
603  $feat->setTitle($this->lng->txt('obj_features'));
604  $this->form->addItem($feat);
605 
607  $this->object->getId(),
608  $this->form,
609  array(
611  )
612  );
613  }
614 
615  // sort columns, if adv fields are given
616  $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getRefId());
617  $cols = $adv_ap->getColumnOrder();
618  if (count($cols) > 1) {
619  $ti = new ilGloAdvColSortInputGUI($this->lng->txt("cont_col_ordering"), "field_order");
620  $this->form->addItem($ti);
621  $ti->setValue($cols);
622  $ti->setInfo($this->lng->txt("glo_col_ordering_info"));
623  }
624 
625  // save and cancel commands
626  $this->form->addCommandButton("saveProperties", $this->lng->txt("save"));
627 
628  $this->form->setTitle($this->lng->txt("cont_glo_properties"));
629  $this->form->setFormAction($this->ctrl->getFormAction($this));
630  }
631 
632 
633  public function saveProperties(): void
634  {
635  $obj_service = $this->getObjectService();
636 
637  $this->initSettingsForm();
638  if ($this->form->checkInput()) {
639  $this->object->setTitle($this->form->getInput("title"));
640  $this->object->setDescription($this->form->getInput("description"));
641  $this->object->setOnline(ilUtil::yn2tf($this->form->getInput("cobj_online")));
642  $glo_mode = $this->form->getInput("glo_mode") === "none"
643  ? $this->form->getInput("glo_mode")
644  : $this->form->getInput("glo_mode2");
645  $this->object->setVirtualMode($glo_mode);
646  $this->object->setActiveDownloads(ilUtil::yn2tf($this->form->getInput("glo_act_downloads")));
647  $this->object->setPresentationMode($this->form->getInput("pres_mode"));
648  $this->object->setSnippetLength($this->form->getInput("snippet_length"));
649  $this->object->setShowTaxonomy($this->form->getInput("show_tax"));
650  $this->object->update();
651 
652  // tile image
653  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
654 
655  // field order of advanced metadata
656  $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getRefId());
657  $cols = $adv_ap->getColumnOrder();
658  if (count($cols) > 1) {
659  $adv_ap->saveColumnOrder($this->form->getInput("field_order"));
660  }
661 
662  // set definition short texts dirty
664 
666  $this->object->getId(),
667  $this->form,
668  array(
670  )
671  );
672 
673  // Update ecs export settings
674  $ecs = new ilECSGlossarySettings($this->object);
675  if ($ecs->handleSettingsUpdate()) {
676  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
677  $this->ctrl->redirect($this, "properties");
678  }
679  }
680  $this->form->setValuesByPost();
681  $this->tpl->setContent($this->form->getHTML());
682  }
683 
684  public function listTerms(): void
685  {
686  $this->showTaxonomy();
687 
688  // term
689  $ti = new ilTextInputGUI($this->lng->txt("cont_new_term"), "new_term");
690  $ti->setMaxLength(80);
691  $ti->setSize(20);
692  $this->toolbar->addInputItem($ti, true);
693 
694  // language
695  $this->lng->loadLanguageModule("meta");
697  $session_lang = $this->term_manager->getSessionLang();
698  if ($session_lang != "") {
699  $s_lang = $session_lang;
700  } else {
701  $s_lang = $this->user->getLanguage();
702  }
703  $si = new ilSelectInputGUI($this->lng->txt("language"), "term_language");
704  $si->setOptions($lang);
705  $si->setValue($s_lang);
706  $this->toolbar->addInputItem($si, true);
707 
708  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
709  $this->toolbar->addFormButton($this->lng->txt("glo_add_new_term"), "addTerm");
710 
711  $this->toolbar->addSeparator();
712 
713  //ilEditClipboard::getAction() == "copy"
714  if ($this->user->clipboardHasObjectsOfType("term")) {
715  $this->toolbar->addButton(
716  $this->lng->txt("paste"),
717  $this->ctrl->getLinkTarget($this, "pasteTerms")
718  );
719  $this->toolbar->addButton(
720  $this->lng->txt("clear_clipboard"),
721  $this->ctrl->getLinkTarget($this, "clearClipboard")
722  );
723  } else {
724  $this->toolbar->addButton(
725  $this->lng->txt("glo_add_from_other"),
726  $this->ctrl->getLinkTargetByClass("ilglossaryforeigntermcollectorgui", "")
727  );
728  }
729 
730  $this->tabs->activateTab("cont_terms");
731 
732  $tab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
733  $this->tpl->setContent($tab->getHTML());
734  }
735 
736  public function actTaxonomy(): void
737  {
738  $this->ctrl->setParameter($this, "show_tax", 1);
739  $this->ctrl->redirect($this, "listTerms");
740  }
741 
745  public function deactTaxonomy(): void
746  {
747  $this->ctrl->setParameter($this, "show_tax", "");
748  $this->ctrl->redirect($this, "listTerms");
749  }
750 
751 
755  public function addTerm(): void
756  {
757  $new_term = $this->edit_request->getNewTerm();
758  if ($new_term == "") {
759  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_please_enter_a_term"), true);
760  $this->ctrl->redirect($this, "listTerms");
761  }
762 
763  // add term
764  $lang = $this->edit_request->getTermLanguage();
765  $term = new ilGlossaryTerm();
766  $term->setGlossary($this->getGlossary());
767  $term->setTerm($new_term);
768  $term->setLanguage($lang);
769  $term->create();
770 
771  $this->term_manager->setSessionLang($lang);
772 
773  // add first definition
774  $def = new ilGlossaryDefinition();
775  $def->setTermId($term->getId());
776  $def->setTitle($new_term);
777  $def->create();
778 
779  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
780  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
781  $this->ctrl->redirectByClass(array("ilglossarytermgui",
782  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
783  }
784 
788  public function moveDefinitionUp(): void
789  {
790  $definition = new ilGlossaryDefinition(
791  $this->edit_request->getDefinitionId()
792  );
793  $definition->moveUp();
794 
795  $this->ctrl->redirect($this, "listTerms");
796  }
797 
801  public function moveDefinitionDown(): void
802  {
803  $definition = new ilGlossaryDefinition(
804  $this->edit_request->getDefinitionId()
805  );
806  $definition->moveDown();
807 
808  $this->ctrl->redirect($this, "listTerms");
809  }
810 
814  public function confirmDefinitionDeletion(): void
815  {
816  $term = new ilGlossaryTerm($this->term_id);
817 
818  $add = "";
819  $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id);
820  if ($nr > 0) {
821  $this->ctrl->setParameterByClass(
822  "ilglossarytermgui",
823  "term_id",
824  $this->term_id
825  );
826  $link = "[<a href='" .
827  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
828  "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
829  $add = "<br/>" . sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link;
830  }
831 
832  $cgui = new ilConfirmationGUI();
833  $cgui->setHeaderText($this->lng->txt("info_delete_sure") . $add);
834 
835  $cgui->setFormAction($this->ctrl->getFormAction($this));
836  $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion");
837  $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition");
838 
839  // content style
840  $this->setContentStyleSheet($this->tpl);
841 
842  // syntax style
843  $this->tpl->setCurrentBlock("SyntaxStyle");
844  $this->tpl->setVariable(
845  "LOCATION_SYNTAX_STYLESHEET",
847  );
848  $this->tpl->parseCurrentBlock();
849 
850  $definition = new ilGlossaryDefinition(
851  $this->edit_request->getDefinitionId()
852  );
853  $page_gui = new ilGlossaryDefPageGUI($definition->getId());
854  $page_gui->setTemplateOutput(false);
855  $page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
856  $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->requested_ref_id);
857  $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->requested_ref_id);
858  $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->requested_ref_id);
859  $output = $page_gui->preview();
860 
861  $cgui->addItem(
862  "def",
863  $this->edit_request->getDefinitionId(),
864  $term->getTerm() . $output
865  );
866 
867  $this->tpl->setContent($cgui->getHTML());
868  }
869 
870  public function cancelDefinitionDeletion(): void
871  {
872  $this->ctrl->redirect($this, "listTerms");
873  }
874 
875  public function deleteDefinition(): void
876  {
877  $definition = new ilGlossaryDefinition($this->edit_request->getDefinitionId());
878  $definition->delete();
879  $this->ctrl->redirect($this, "listTerms");
880  }
881 
882  public function export(): void
883  {
884  $this->checkPermission("write");
885  $glo_exp = new ilGlossaryExport($this->getGlossary());
886  $glo_exp->buildExportFile();
887  $this->ctrl->redirectByClass("ilexportgui", "");
888  }
889 
893  public function exportHTML(): void
894  {
895  $glo_exp = new ilGlossaryExport($this->getGlossary(), "html");
896  $glo_exp->buildExportFile();
897  $this->ctrl->redirectByClass("ilexportgui", "");
898  }
899 
903  public function publishExportFile(): void
904  {
905  $files = $this->edit_request->getFiles();
906  if (count($files) == 0) {
907  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
908  $this->ctrl->redirectByClass("ilexportgui", "");
909  }
910  if (count($files) > 1) {
911  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("cont_select_max_one_item"), true);
912  $this->ctrl->redirectByClass("ilexportgui", "");
913  }
914 
915  $file = explode(":", $files[0]);
916  $export_dir = $this->object->getExportDirectory($file[0]);
917 
918  if ($this->object->getPublicExportFile($file[0]) ==
919  $file[1]) {
920  $this->object->setPublicExportFile($file[0], "");
921  } else {
922  $this->object->setPublicExportFile($file[0], $file[1]);
923  }
924  $this->object->update();
925  $this->ctrl->redirectByClass("ilexportgui", "");
926  }
927 
928  public function confirmTermDeletion(): void
929  {
930  $ids = $this->edit_request->getIds();
931  if (count($ids) == 0) {
932  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
933  $this->ctrl->redirect($this, "listTerms");
934  }
935 
936  // check ids
937  foreach ($ids as $term_id) {
938  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($term_id);
939  if ($term_glo_id != $this->object->getId() && !ilGlossaryTermReferences::isReferenced([$this->object->getId()], $term_id)) {
940  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("glo_term_must_belong_to_glo"), true);
941  $this->ctrl->redirect($this, "listTerms");
942  }
943  }
944 
945  // display confirmation message
946  $cgui = new ilConfirmationGUI();
947  $cgui->setFormAction($this->ctrl->getFormAction($this));
948  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
949  $cgui->setCancel($this->lng->txt("cancel"), "cancelTermDeletion");
950  $cgui->setConfirm($this->lng->txt("confirm"), "deleteTerms");
951 
952  foreach ($ids as $id) {
953  $term = new ilGlossaryTerm($id);
954 
955  $add = "";
957  if ($nr > 0) {
958  $this->ctrl->setParameterByClass(
959  "ilglossarytermgui",
960  "term_id",
961  $id
962  );
963 
964  if (ilGlossaryTermReferences::isReferenced([$this->object->getId()], $id)) {
965  $add = " (" . $this->lng->txt("glo_term_reference") . ")";
966  } else {
967  $link = "[<a href='" .
968  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
969  "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
970  $add = "<div class='small'>" .
971  sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link . "</div>";
972  }
973  }
974 
975  $cgui->addItem("id[]", $id, $term->getTerm() . $add);
976  }
977 
978  $this->tpl->setContent($cgui->getHTML());
979  }
980 
981  public function cancelTermDeletion(): void
982  {
983  $this->ctrl->redirect($this, "listTerms");
984  }
985 
986  public function deleteTerms(): void
987  {
988  $ids = $this->edit_request->getIds();
989  foreach ($ids as $id) {
990  if (ilGlossaryTermReferences::isReferenced([$this->object->getId()], $id)) {
991  $refs = new ilGlossaryTermReferences($this->object->getId());
992  $refs->deleteTerm($id);
993  $refs->update();
994  } else {
995  $term = new ilGlossaryTerm($id);
996  $term->delete();
997  }
998  }
999  $this->ctrl->redirect($this, "listTerms");
1000  }
1001 
1002  protected function setLocator(): void
1003  {
1004  if (strtolower($this->edit_request->getBaseClass()) != "ilglossaryeditorgui") {
1005  parent::setLocator();
1006  } elseif (is_object($this->object)) {
1007  $gloss_loc = new ilGlossaryLocatorGUI();
1008  if (is_object($this->term)) {
1009  $gloss_loc->setTerm($this->term);
1010  }
1011  $gloss_loc->setGlossary($this->getGlossary());
1012  $gloss_loc->display();
1013  }
1014  }
1015 
1016  public function view(): void
1017  {
1018  $this->viewObject();
1019  }
1020 
1021  public function addDefinition(): void
1022  {
1023  $term_id = $this->edit_request->getTermId();
1024 
1025  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($term_id);
1026  if ($term_glo_id != $this->object->getId()) {
1027  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("glo_term_must_belong_to_glo"), true);
1028  $this->ctrl->redirect($this, "listTerms");
1029  }
1030 
1031  // add term
1032  $term = new ilGlossaryTerm($term_id);
1033 
1034  // add first definition
1035  $def = new ilGlossaryDefinition();
1036  $def->setTermId($term->getId());
1037  $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
1038  $def->create();
1039 
1040  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
1041  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
1042  $this->ctrl->redirectByClass(array("ilglossarytermgui",
1043  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
1044  }
1045 
1046  public function getTemplate(): void
1047  {
1048  $this->tpl->loadStandardTemplate();
1049 
1050  $title = $this->object->getTitle();
1051 
1052 
1053  if ($this->term_id > 0) {
1054  $this->tpl->setTitle($this->lng->txt("term") . ": " .
1055  ilGlossaryTerm::_lookGlossaryTerm($this->term_id));
1056  } else {
1057  parent::setTitleAndDescription();
1058  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
1059  $this->tpl->setTitle($this->lng->txt("glo") . ": " . $title);
1060  }
1061  }
1062 
1063  protected function getTabs(): void
1064  {
1065  $this->help->setScreenIdComponent("glo");
1066 
1067  // list terms
1068  $cmd = $this->ctrl->getCmd();
1069  $force_active = ($cmd == "" || $cmd == "listTerms");
1070  $this->tabs_gui->addTarget(
1071  "cont_terms",
1072  $this->ctrl->getLinkTarget($this, "listTerms"),
1073  array("listTerms", ""),
1074  get_class($this),
1075  "",
1076  $force_active
1077  );
1078 
1079  $force_active = false;
1080  if ($this->ctrl->getCmd() == "showSummary" ||
1081  strtolower($this->ctrl->getNextClass()) == "ilinfoscreengui") {
1082  $force_active = true;
1083  }
1084  $this->tabs_gui->addTarget(
1085  "info_short",
1086  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
1087  "",
1088  "ilInfoScreenGUI",
1089  "",
1090  $force_active
1091  );
1092 
1093  // properties
1094  if ($this->rbacsystem->checkAccess('write', $this->object->getRefId())) {
1095  $this->tabs_gui->addTarget(
1096  "settings",
1097  $this->ctrl->getLinkTarget($this, "properties"),
1098  "properties",
1099  get_class($this)
1100  );
1101 
1102  // meta data
1103  $mdgui = new ilObjectMetaDataGUI($this->object, "term");
1104  $mdtab = $mdgui->getTab();
1105  if ($mdtab) {
1106  $this->tabs_gui->addTarget(
1107  "meta_data",
1108  $mdtab,
1109  "",
1110  "ilobjectmetadatagui"
1111  );
1112  }
1113 
1114  // export
1115  /*$tabs_gui->addTarget("export",
1116  $this->ctrl->getLinkTarget($this, "exportList"),
1117  array("exportList", "viewExportLog"), get_class($this));*/
1118 
1119  // export
1120  $this->tabs_gui->addTarget(
1121  "export",
1122  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1123  "",
1124  "ilexportgui"
1125  );
1126  }
1127 
1128  // permissions
1129  if ($this->rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
1130  /*$tabs_gui->addTarget("permission_settings",
1131  $this->ctrl->getLinkTarget($this, "perm"),
1132  array("perm", "info"),
1133  get_class($this));
1134  */
1135  $this->tabs_gui->addTarget(
1136  "perm_settings",
1137  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1138  array("perm","info","owner"),
1139  'ilpermissiongui'
1140  );
1141  }
1142 
1143  $this->tabs_gui->addNonTabbedLink(
1144  "presentation_view",
1145  $this->lng->txt("glo_presentation_view"),
1146  "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->object->getRefId(),
1147  "_top"
1148  );
1149  }
1150 
1151  public function setSettingsSubTabs(string $a_active): void
1152  {
1153  if (in_array(
1154  $a_active,
1155  array("general_settings", "style", "taxonomy", "glossaries")
1156  )) {
1157  // general properties
1158  $this->tabs->addSubTab(
1159  "general_settings",
1160  $this->lng->txt("settings"),
1161  $this->ctrl->getLinkTarget($this, 'properties')
1162  );
1163 
1164  // style properties
1165  $this->tabs->addSubTab(
1166  "style",
1167  $this->lng->txt("obj_sty"),
1168  $this->ctrl->getLinkTargetByClass("ilobjectcontentstylesettingsgui", '')
1169  );
1170 
1171  // taxonomy
1173  $this->tabs->addSubTab(
1174  "taxonomy",
1175  $this->lng->txt("tax_taxonomy"),
1176  $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", '')
1177  );
1178 
1179  // style properties
1180  $this->tabs->addSubTab(
1181  "glossaries",
1182  $this->lng->txt("cont_auto_glossaries"),
1183  $this->ctrl->getLinkTarget($this, 'editGlossaries')
1184  );
1185 
1186  $this->tabs->activateSubTab($a_active);
1187  }
1188  }
1189 
1190 
1191  public static function _goto(string $a_target): void
1192  {
1193  global $DIC;
1194  $main_tpl = $DIC->ui()->mainTemplate();
1195 
1196  $lng = $DIC->language();
1197  $ilAccess = $DIC->access();
1198  $ctrl = $DIC->ctrl();
1199 
1200  if ($ilAccess->checkAccess("read", "", $a_target)) {
1201  $ctrl->setParameterByClass("ilGlossaryPresentationGUI", "ref_id", $a_target);
1202  $ctrl->redirectByClass("ilGlossaryPresentationGUI", "");
1203  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1204  $ctrl->setParameterByClass("ilGlossaryPresentationGUI", "ref_id", $a_target);
1205  $ctrl->redirectByClass("ilGlossaryPresentationGUI", "infoScreen");
1206  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1207  $main_tpl->setOnScreenMessage('failure', sprintf(
1208  $lng->txt("msg_no_perm_read_item"),
1210  ), true);
1212  }
1213 
1214  throw new ilPermissionException($lng->txt("no_permission"));
1215  }
1216 
1217  public function applyFilter(): void
1218  {
1219  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1220  $prtab->resetOffset();
1221  $prtab->writeFilterToSession();
1222  $this->listTerms();
1223  }
1224 
1225  public function resetFilter(): void
1226  {
1227  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1228  $prtab->resetOffset();
1229  $prtab->resetFilter();
1230  $this->listTerms();
1231  }
1232 
1233 
1237 
1238  public function setContentStyleSheet(
1239  ilGlobalTemplateInterface $a_tpl = null
1240  ): void {
1241  if ($a_tpl != null) {
1242  $ctpl = $a_tpl;
1243  } else {
1244  $ctpl = $this->tpl;
1245  }
1246 
1247  $this->content_style_gui->addCss($ctpl, $this->object->getRefId());
1248  }
1249 
1253  public function getPublicAccessColValue(
1254  string $a_type,
1255  string $a_file
1256  ): string {
1257  if ($this->object->getPublicExportFile($a_type) == $a_file) {
1258  return $this->lng->txt("yes");
1259  }
1260 
1261  return " ";
1262  }
1263 
1267  public function showTaxonomy(): void
1268  {
1269  global $DIC;
1270 
1271  $ctrl = $DIC->ctrl();
1272 
1273  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1274  if (count($tax_ids) > 0) {
1275  $tax_id = $tax_ids[0];
1276  $DIC->globalScreen()->tool()->context()->current()
1277  ->addAdditionalData(
1279  true
1280  );
1281  $DIC->globalScreen()->tool()->context()->current()
1282  ->addAdditionalData(
1285  );
1286  $DIC->globalScreen()->tool()->context()->current()
1287  ->addAdditionalData(
1289  $tax_id
1290  );
1291  $DIC->globalScreen()->tool()->context()->current()
1292  ->addAdditionalData(
1294  "listTerms"
1295  );
1296  $DIC->globalScreen()->tool()->context()->current()
1297  ->addAdditionalData(
1299  "showTaxonomy"
1300  );
1301 
1302 
1303  $tax_exp = new ilTaxonomyExplorerGUI(
1304  get_class($this),
1305  "showTaxonomy",
1306  $tax_ids[0],
1307  "ilobjglossarygui",
1308  "listTerms"
1309  );
1310  if (!$tax_exp->handleCommand()) {
1311  //$this->tpl->setLeftNavContent($tax_exp->getHTML());
1312  //$this->tpl->setLeftNavContent($tax_exp->getHTML() . "&nbsp;");
1313  }
1314  }
1315  }
1316 
1317  //
1318  // Auto glossaries
1319  //
1320 
1324  public function editGlossaries(): void
1325  {
1326  $this->tabs->setTabActive("settings");
1327  $this->setSettingsSubTabs("glossaries");
1328 
1329  $this->toolbar->addButton(
1330  $this->lng->txt("add"),
1331  $this->ctrl->getLinkTarget($this, "showGlossarySelector")
1332  );
1333 
1334  $tab = new ilGlossaryAutoLinkTableGUI($this->getGlossary(), $this, "editGlossaries");
1335 
1336  $this->tpl->setContent($tab->getHTML());
1337  }
1338 
1342  public function showGlossarySelector(): void
1343  {
1344  $this->tabs->setTabActive("settings");
1345  $this->setSettingsSubTabs("glossaries");
1346 
1347  $exp = new ilSearchRootSelector($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1348  $search_root_expand = $this->edit_request->getSearchRootExpand();
1349  $exp->setExpand($search_root_expand ?: $this->tree->readRootId());
1350  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1351  $exp->setTargetClass(get_class($this));
1352  $exp->setCmd('confirmGlossarySelection');
1353  $exp->setClickableTypes(array("glo"));
1354  $exp->addFilter("glo");
1355 
1356  // build html-output
1357  $exp->setOutput(0);
1358  $this->tpl->setContent($exp->getOutput());
1359  }
1360 
1361  public function confirmGlossarySelection(): void
1362  {
1363  $cgui = new ilConfirmationGUI();
1364  $this->ctrl->setParameter($this, "glo_ref_id", $this->edit_request->getGlossaryRefId());
1365  $cgui->setFormAction($this->ctrl->getFormAction($this));
1366  $cgui->setHeaderText($this->lng->txt("glo_link_glo_in_glo"));
1367  $cgui->setCancel($this->lng->txt("no"), "selectGlossary");
1368  $cgui->setConfirm($this->lng->txt("yes"), "selectGlossaryLink");
1369  $this->tpl->setContent($cgui->getHTML());
1370  }
1371 
1375  public function selectGlossaryLink(): void
1376  {
1377  $glo_ref_id = $this->edit_request->getGlossaryRefId();
1378  $this->object->autoLinkGlossaryTerms($glo_ref_id);
1379  $this->selectGlossary();
1380  }
1381 
1382 
1386  public function selectGlossary(): void
1387  {
1388  $glos = $this->object->getAutoGlossaries();
1389  $glo_ref_id = $this->edit_request->getGlossaryRefId();
1390  $glo_id = ilObject::_lookupObjId($glo_ref_id);
1391  if (!in_array($glo_id, $glos)) {
1392  $glos[] = $glo_id;
1393  }
1394  $this->object->setAutoGlossaries($glos);
1395  $this->object->update();
1396 
1397  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1398  $this->ctrl->redirect($this, "editGlossaries");
1399  }
1400 
1401  public function removeGlossary(): void
1402  {
1403  $this->object->removeAutoGlossary($this->edit_request->getGlossaryId());
1404  $this->object->update();
1405 
1406  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1407  $this->ctrl->redirect($this, "editGlossaries");
1408  }
1409 
1413  public function copyTerms(): void
1414  {
1415  $items = $this->edit_request->getIds();
1416  if (count($items) == 0) {
1417  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1418  $this->ctrl->redirect($this, "listTerms");
1419  }
1420 
1421  $this->user->clipboardDeleteObjectsOfType("term");
1422 
1423  // put them into the clipboard
1424  $time = date("Y-m-d H:i:s");
1425  $order = 0;
1426  foreach ($items as $id) {
1427  $this->user->addObjectToClipboard(
1428  $id,
1429  "term",
1431  0,
1432  $time,
1433  $order
1434  );
1435  }
1436 
1438  $this->tpl->setOnScreenMessage('info', $this->lng->txt("glo_selected_terms_have_been_copied"), true);
1439  $this->ctrl->redirect($this, "listTerms");
1440  }
1441 
1445  public function referenceTerms(): void
1446  {
1447  $items = $this->edit_request->getIds();
1448  if (count($items) == 0) {
1449  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
1450  $this->ctrl->redirect($this, "listTerms");
1451  }
1452 
1453  $this->user->clipboardDeleteObjectsOfType("term");
1454 
1455  // put them into the clipboard
1456  $time = date("Y-m-d H:i:s");
1457  $order = 0;
1458  foreach ($items as $id) {
1459  $this->user->addObjectToClipboard(
1460  $id,
1461  "term",
1463  0,
1464  $time,
1465  $order
1466  );
1467  }
1468 
1470  $this->tpl->setOnScreenMessage('info', $this->lng->txt("glo_selected_terms_have_been_copied"), true);
1471  $this->ctrl->redirect($this, "listTerms");
1472  }
1473 
1474 
1475  public function clearClipboard(): void
1476  {
1477  $this->user->clipboardDeleteObjectsOfType("term");
1478  $this->ctrl->redirect($this, "listTerms");
1479  }
1480 
1481  public function pasteTerms(): void
1482  {
1483  if (ilEditClipboard::getAction() == "copy") {
1484  foreach ($this->user->getClipboardObjects("term") as $item) {
1485  ilGlossaryTerm::_copyTerm($item["id"], $this->object->getId());
1486  }
1487  }
1488  if (ilEditClipboard::getAction() == "link") {
1489  $refs = new ilGlossaryTermReferences($this->object->getId());
1490  foreach ($this->user->getClipboardObjects("term") as $item) {
1491  $refs->addTerm($item["id"]);
1492  }
1493  $refs->update();
1494  }
1495  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1496  $this->ctrl->redirect($this, "listTerms");
1497  }
1498 }
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