ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjGlossaryGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
18 {
22  protected $error;
23 
24  public $admin_tabs;
25  public $mode;
26  public $term;
27 
31  protected $term_id;
32 
36  protected $ctrl;
37 
41  protected $user;
42 
46  protected $toolbar;
47 
51  protected $tabs;
52 
56  protected $setting;
57 
61  protected $access;
62 
66  protected $rbacsystem;
67 
71  protected $help;
72 
76  protected $term_perm;
77 
81  protected $log;
82 
87  public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
88  {
89  $this->error = $DIC["ilErr"];
90  global $DIC;
91 
92  $this->ctrl = $DIC->ctrl();
93  $this->lng = $DIC->language();
94  $this->user = $DIC->user();
95  $this->toolbar = $DIC->toolbar();
96  $this->tabs = $DIC->tabs();
97  $this->setting = $DIC["ilSetting"];
98  $this->access = $DIC->access();
99  $this->rbacsystem = $DIC->rbac()->system();
100  $this->help = $DIC["ilHelp"];
101 
102  $this->log = ilLoggerFactory::getLogger('glo');
103 
104  $this->term_perm = ilGlossaryTermPermission::getInstance();
105 
106  $this->ctrl->saveParameter($this, array("ref_id", "offset"));
107 
108  $this->lng->loadLanguageModule("content");
109  $this->lng->loadLanguageModule("glo");
110 
111  $this->type = "glo";
112  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
113 
114  // determine term id and check whether it is valid (belongs to
115  // current glossary)
116  $this->term_id = (int) $_GET["term_id"];
117  $term_glo_id = ilGlossaryTerm::_lookGlossaryID($this->term_id);
118  if ($this->term_id > 0 && $term_glo_id != $this->object->getId()
119  && !ilGlossaryTermReferences::isReferenced($this->object->getId(), $this->term_id)) {
120  $this->term_id = "";
121  }
122 
123  $this->tax_id = $this->object->getTaxonomyId();
124  if ($this->tax_id > 0) {
125  $this->ctrl->saveParameter($this, array("show_tax", "tax_node"));
126 
127  $this->tax = new ilObjTaxonomy($this->tax_id);
128  }
129  if ((int) $_GET["tax_node"] > 1 && $this->tax->getTree()->readRootId() != $_GET["tax_node"]) {
130  $this->tax_node = (int) $_GET["tax_node"];
131  }
132  }
133 
137  public function executeCommand()
138  {
139  $cmd = $this->ctrl->getCmd();
140  $next_class = $this->ctrl->getNextClass($this);
141 
142  $this->log->debug("glossary term, next class " . $next_class . ", cmd: " . $cmd);
143 
144  switch ($next_class) {
145  case 'ilobjectmetadatagui':
146  $this->checkPermission("write");
147 
148  $this->getTemplate();
149  $this->setTabs();
150  $this->setLocator();
151  $this->addHeaderAction();
152 
153  $this->tabs_gui->activateTab('meta_data');
154  $md_gui = new ilObjectMetaDataGUI($this->object, 'term');
155  $this->ctrl->forwardCommand($md_gui);
156  break;
157 
158  case "ilglossarytermgui":
159  if (!$this->term_perm->checkPermission("edit_content", $this->term_id) &&
160  !$this->term_perm->checkPermission("write", $this->term_id)) {
161  throw new ilGlossaryException("No permission.");
162  }
163  $this->getTemplate();
164 // $this->quickList();
165  $this->ctrl->setReturn($this, "listTerms");
166  $term_gui = new ilGlossaryTermGUI($this->term_id);
167  $term_gui->setGlossary($this->object);
168  //$ret = $term_gui->executeCommand();
169  $ret = $this->ctrl->forwardCommand($term_gui);
170  break;
171 
172  case "ilinfoscreengui":
173  $this->addHeaderAction();
174  $this->showInfoScreen();
175  break;
176 
177  case "ilobjstylesheetgui":
178  $this->ctrl->setReturn($this, "editStyleProperties");
179  $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
180  $style_gui->omitLocator();
181  if ($cmd == "create" || $_GET["new_type"] == "sty") {
182  $style_gui->setCreationMode(true);
183  }
184 
185  if ($cmd == "confirmedDelete") {
186  $this->object->setStyleSheetId(0);
187  $this->object->update();
188  }
189 
190  $ret = $this->ctrl->forwardCommand($style_gui);
191 
192  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
193  $style_id = $ret;
194  $this->object->setStyleSheetId($style_id);
195  $this->object->update();
196  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
197  }
198  break;
199 
200 
201  case 'ilpermissiongui':
202  if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
203  $this->prepareOutput();
204  } else {
205  $this->getTemplate();
206  $this->setTabs();
207  $this->setLocator();
208  $this->addHeaderAction();
209  }
210  $perm_gui = new ilPermissionGUI($this);
211  $ret = $this->ctrl->forwardCommand($perm_gui);
212  break;
213 
214  case "ilcommonactiondispatchergui":
216  $this->ctrl->forwardCommand($gui);
217  break;
218 
219  case "ilobjtaxonomygui":
220  $this->getTemplate();
221  $this->setTabs();
222  $this->setLocator();
223  $this->addHeaderAction();
224  $this->tabs->activateTab("settings");
225  $this->setSettingsSubTabs("taxonomy");
226 
227  $this->ctrl->setReturn($this, "properties");
228  $tax_gui = new ilObjTaxonomyGUI();
229  $tax_gui->setMultiple(false);
230 
231  $tax_gui->setAssignedObject($this->object->getId());
232  $ret = $this->ctrl->forwardCommand($tax_gui);
233  break;
234 
235  case "ilexportgui":
236  $this->getTemplate();
237  $this->setTabs();
238  $this->tabs->activateTab("export");
239  $this->setLocator();
240  $exp_gui = new ilExportGUI($this);
241  //$exp_gui->addFormat("xml", "", $this, "export");
242  $exp_gui->addFormat("xml");
243  $exp_gui->addFormat("html", "", $this, "exportHTML");
244  $exp_gui->addCustomColumn(
245  $this->lng->txt("cont_public_access"),
246  $this,
247  "getPublicAccessColValue"
248  );
249  $exp_gui->addCustomMultiCommand(
250  $this->lng->txt("cont_public_access"),
251  $this,
252  "publishExportFile"
253  );
254  $ret = $this->ctrl->forwardCommand($exp_gui);
255  break;
256 
257  case 'ilobjectcopygui':
258  $this->prepareOutput();
259  $cp = new ilObjectCopyGUI($this);
260  $cp->setType('glo');
261  $this->ctrl->forwardCommand($cp);
262  break;
263 
264  case "ilglossaryforeigntermcollectorgui":
265  $this->ctrl->setReturn($this, "");
266  $this->getTemplate();
267  $this->setTabs();
268  $this->setLocator();
269  $this->addHeaderAction();
271  $this->ctrl->forwardCommand($coll);
272  break;
273 
274  default:
275  $cmd = $this->ctrl->getCmd("listTerms");
276 
277  if (($cmd == "create") && ($_POST["new_type"] == "term")) {
278  $this->ctrl->setCmd("create");
279  $this->ctrl->setCmdClass("ilGlossaryTermGUI");
280  $ret = $this->executeCommand();
281  return;
282  } else {
283  if (!in_array($cmd, array("quickList"))) {
284  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
285  $this->getCreationMode() == true) {
286  $this->prepareOutput();
287  $cmd .= "Object";
288  } else {
289  $this->getTemplate();
290  $this->setTabs();
291  $this->setLocator();
292  $this->addHeaderAction();
293 
294  if ($cmd == "redrawHeaderAction") {
295  $cmd = "redrawHeaderActionObject";
296  }
297  }
298  }
299  $ret = $this->$cmd();
300  }
301  break;
302  }
303 
304  if (!in_array($cmd, array("quickList"))) {
305  if (strtolower($_GET["baseClass"]) != "iladministrationgui") {
306  if (!$this->getCreationMode()) {
307  $this->tpl->printToStdout();
308  }
309  }
310  } else {
311  $this->tpl->printToStdout(false);
312  }
313  }
314 
315  public function assignObject()
316  {
317  $this->object = new ilObjGlossary($this->id, true);
318  }
319 
320  public function initCreateForm($a_new_type)
321  {
322  $form = new ilPropertyFormGUI();
323  $form->setTarget("_top");
324  $form->setFormAction($this->ctrl->getFormAction($this));
325  $form->setTitle($this->lng->txt($a_new_type . "_new"));
326 
327  // title
328  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
329  $ti->setSize(min(40, ilObject::TITLE_LENGTH));
330  $ti->setMaxLength(ilObject::TITLE_LENGTH);
331  $ti->setRequired(true);
332  $form->addItem($ti);
333 
334  // description
335  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
336  $ta->setCols(40);
337  $ta->setRows(2);
338  $form->addItem($ta);
339 
340  // mode
341  $stati = array(
342  "none" => $this->lng->txt("glo_mode_normal"),
343  "level" => $this->lng->txt("glo_mode_level"),
344  "subtree" => $this->lng->txt("glo_mode_subtree")
345  );
346  $tm = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
347  $tm->setOptions($stati);
348  $tm->setInfo($this->lng->txt("glo_mode_desc"));
349  $tm->setRequired(true);
350  $form->addItem($tm);
351 
352  $form->addCommandButton("save", $this->lng->txt($a_new_type . "_add"));
353  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
354 
355  return $form;
356  }
357 
358  public function importObject()
359  {
360  $this->createObject();
361  }
362 
366  public function saveObject()
367  {
369 
370  $new_type = $_REQUEST["new_type"];
371 
372  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
373  if (!$this->checkPermissionBool("create", "", $new_type)) {
374  $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->MESSAGE);
375  }
376 
377  $this->lng->loadLanguageModule($new_type);
378  $this->ctrl->setParameter($this, "new_type", $new_type);
379 
380  $form = $this->initCreateForm($new_type);
381  if ($form->checkInput()) {
382  $this->ctrl->setParameter($this, "new_type", "");
383 
384  $newObj = new ilObjGlossary();
385  $newObj->setType($new_type);
386  $newObj->setTitle($form->getInput("title"));
387  $newObj->setDescription($form->getInput("desc"));
388  $newObj->setVirtualMode($form->getInput("glo_mode"));
389  $newObj->create();
390 
391  $this->putObjectInTree($newObj);
392 
393  // always send a message
394  ilUtil::sendSuccess($this->lng->txt("glo_added"), true);
395  ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=" . $newObj->getRefId());
396  }
397 
398  // display only this form to correct input
399  $form->setValuesByPost();
400  $this->tpl->setContent($form->getHtml());
401  }
402 
409  public function showInfoScreen()
410  {
411  $this->getTemplate();
412  $this->setTabs();
413  $this->setLocator();
414  $this->lng->loadLanguageModule("meta");
415 
416  $info = new ilInfoScreenGUI($this);
417  $info->enablePrivateNotes();
418  $info->enableNews();
419  if ($this->access->checkAccess("write", "", $_GET["ref_id"])) {
420  $info->enableNewsEditing();
421  $news_set = new ilSetting("news");
422  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
423  if ($enable_internal_rss) {
424  $info->setBlockProperty("news", "settings", true);
425  }
426  }
427  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
428 
429  ilObjGlossaryGUI::addUsagesToInfo($info, $this->object->getId());
430 
431  $this->ctrl->forwardCommand($info);
432  }
433 
440  public static function addUsagesToInfo($info, $glo_id)
441  {
442  global $DIC;
443 
444  $lng = $DIC->language();
445  $ilAccess = $DIC->access();
446 
447  $info->addSection($lng->txt("glo_usages"));
449  foreach ($sms as $sm) {
450  $link = false;
451  $refs = ilObject::_getAllReferences($sm);
452  foreach ($refs as $ref) {
453  if ($link === false) {
454  if ($ilAccess->checkAccess("write", "", $ref)) {
455  $link = ilLink::_getLink($ref, 'sahs');
456  }
457  }
458  }
459 
460  $entry = ilObject::_lookupTitle($sm);
461  if ($link !== false) {
462  $entry = "<a href='" . $link . "' target='_top'>" . $entry . "</a>";
463  }
464 
465  $info->addProperty($lng->txt("obj_sahs"), $entry);
466  }
467  }
468 
469 
470  public function viewObject()
471  {
473 
474  if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
475  parent::viewObject();
476  return;
477  }
478 
479  if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
480  $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
481  }
482  }
483 
489  public function properties()
490  {
491  $this->checkPermission("write");
492 
493  $this->setSettingsSubTabs("general_settings");
494 
495  $this->initSettingsForm();
496 
497  // Edit ecs export settings
498  $ecs = new ilECSGlossarySettings($this->object);
499  $ecs->addSettingsToForm($this->form, 'glo');
500 
501  $this->tpl->setContent($this->form->getHTML());
502  }
503 
509  public function initSettingsForm($a_mode = "edit")
510  {
511  $obj_service = $this->getObjectService();
512 
513 
514  $this->form = new ilPropertyFormGUI();
515 
516  // title
517  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
518  $title->setRequired(true);
519  $this->form->addItem($title);
520 
521  // description
522  $desc = new ilTextAreaInputGUI($this->lng->txt("desc"), "description");
523  $this->form->addItem($desc);
524 
525  $this->lng->loadLanguageModule("rep");
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 
537  $section->setTitle($this->lng->txt('glo_content_settings'));
538  $this->form->addItem($section);
539 
540  // glossary mode
541  $glo_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_mode"), "glo_mode");
542  //$glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
543  $op1 = new ilRadioOption($this->lng->txt("glo_mode_normal"), "none", $this->lng->txt("glo_mode_normal_info"));
544  $glo_mode->addOption($op1);
545  $op2 = new ilRadioOption($this->lng->txt("glo_mode_level"), "level", $this->lng->txt("glo_mode_level_info"));
546  $glo_mode->addOption($op2);
547  $op3 = new ilRadioOption($this->lng->txt("glo_mode_subtree"), "subtree", $this->lng->txt("glo_mode_subtree_info"));
548  $glo_mode->addOption($op3);
549  $this->form->addItem($glo_mode);
550 
551  // glossary mode
552  /*$options = array(
553  "none"=>$this->lng->txt("glo_mode_normal"),
554  "level"=>$this->lng->txt("glo_mode_level"),
555  "subtree"=>$this->lng->txt("glo_mode_subtree")
556  );
557  $glo_mode = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
558  $glo_mode->setOptions($options);
559  $glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
560  $this->form->addItem($glo_mode);*/
561 
562 
564  $section->setTitle($this->lng->txt('cont_presentation'));
565  $this->form->addItem($section);
566 
567  // tile image
568  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
569 
570  // presentation mode
571  $pres_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_presentation_mode"), "pres_mode");
572  $pres_mode->setValue("table");
573  $op1 = new ilRadioOption($this->lng->txt("glo_table_form"), "table", $this->lng->txt("glo_table_form_info"));
574 
575  // short text length
576  $snl = new ilNumberInputGUI($this->lng->txt("glo_text_snippet_length"), "snippet_length");
577  $snl->setMaxValue(3000);
578  $snl->setMinValue(100);
579  $snl->setMaxLength(4);
580  $snl->setSize(4);
581  $snl->setInfo($this->lng->txt("glo_text_snippet_length_info"));
582  $snl->setValue(200);
583  $op1->addSubItem($snl);
584 
585  $pres_mode->addOption($op1);
586  $op2 = new ilRadioOption($this->lng->txt("glo_full_definitions"), "full_def", $this->lng->txt("glo_full_definitions_info"));
587  $pres_mode->addOption($op2);
588  $this->form->addItem($pres_mode);
589 
590  // show taxonomy
591  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
592  if (count($tax_ids) > 0) {
593  $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
594  $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info"));
595  $this->form->addItem($show_tax);
596  }
597 
598  // downloads
599  $down = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "glo_act_downloads");
600  $down->setValue("y");
601  $down->setInfo($this->lng->txt("cont_downloads_desc"));
602  $this->form->addItem($down);
603 
604  if ($a_mode == "edit") {
605  $title->setValue($this->object->getTitle());
606  $desc->setValue($this->object->getDescription());
607  $online->setChecked($this->object->getOnline());
608  $glo_mode->setValue($this->object->getVirtualMode());
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  }
639 
640  // save and cancel commands
641  $this->form->addCommandButton("saveProperties", $this->lng->txt("save"));
642 
643  $this->form->setTitle($this->lng->txt("cont_glo_properties"));
644  $this->form->setFormAction($this->ctrl->getFormAction($this));
645  }
646 
647 
651  public function saveProperties()
652  {
653  $obj_service = $this->getObjectService();
654 
655  $this->initSettingsForm();
656  if ($this->form->checkInput()) {
657  $this->object->setTitle($_POST['title']);
658  $this->object->setDescription($_POST['description']);
659  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
660  $this->object->setVirtualMode($_POST["glo_mode"]);
661  // $this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
662  $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
663  $this->object->setPresentationMode($_POST["pres_mode"]);
664  $this->object->setSnippetLength($_POST["snippet_length"]);
665  $this->object->setShowTaxonomy($_POST["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($_POST["field_order"]);
676  }
677 
678  // set definition short texts dirty
679  ilGlossaryDefinition::setShortTextsDirty($this->object->getId());
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  ilUtil::sendSuccess($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 
704  public function listTerms()
705  {
706  //if ($_GET["show_tax"]) {
707  $this->showTaxonomy();
708  //}
709 
710  // term
711  $ti = new ilTextInputGUI($this->lng->txt("cont_new_term"), "new_term");
712  $ti->setMaxLength(80);
713  $ti->setSize(20);
714  $this->toolbar->addInputItem($ti, true);
715 
716  // language
717  $this->lng->loadLanguageModule("meta");
719  if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") {
720  $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]];
721  } else {
722  $s_lang = $this->user->getLanguage();
723  }
724  $si = new ilSelectInputGUI($this->lng->txt("language"), "term_language");
725  $si->setOptions($lang);
726  $si->setValue($s_lang);
727  $this->toolbar->addInputItem($si, true);
728 
729  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
730  $this->toolbar->addFormButton($this->lng->txt("glo_add_new_term"), "addTerm");
731 
732  $this->toolbar->addSeparator();
733 
734  //ilEditClipboard::getAction() == "copy"
735  if ($this->user->clipboardHasObjectsOfType("term")) {
736  $this->toolbar->addButton(
737  $this->lng->txt("paste"),
738  $this->ctrl->getLinkTarget($this, "pasteTerms")
739  );
740  $this->toolbar->addButton(
741  $this->lng->txt("clear_clipboard"),
742  $this->ctrl->getLinkTarget($this, "clearClipboard")
743  );
744  } else {
745  $this->toolbar->addButton(
746  $this->lng->txt("glo_add_from_other"),
747  $this->ctrl->getLinkTargetByClass("ilglossaryforeigntermcollectorgui", "")
748  );
749  }
750 
751  /* this is done by collapsing the tool now
752  if (is_object($this->tax)) {
753  $this->toolbar->addSeparator();
754  if ($_GET["show_tax"]) {
755  $this->toolbar->addButton(
756  $this->lng->txt("glo_hide_taxonomy"),
757  $this->ctrl->getLinkTarget($this, "deactTaxonomy")
758  );
759  } else {
760  $this->toolbar->addButton(
761  $this->lng->txt("glo_show_taxonomy"),
762  $this->ctrl->getLinkTarget($this, "actTaxonomy")
763  );
764  }
765  }*/
766 
767  $tab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
768  $this->tpl->setContent($tab->getHTML());
769  }
770 
777  public function actTaxonomy()
778  {
779  $this->ctrl->setParameter($this, "show_tax", 1);
780  $this->ctrl->redirect($this, "listTerms");
781  }
782 
789  public function deactTaxonomy()
790  {
791  $this->ctrl->setParameter($this, "show_tax", "");
792  $this->ctrl->redirect($this, "listTerms");
793  }
794 
795 
801  public function showActions($a_actions)
802  {
803  foreach ($a_actions as $name => $lng) {
804  $d[$name] = array("name" => $name, "lng" => $lng);
805  }
806 
807  $notoperations = array();
808  $operations = array();
809 
810  $operations = $d;
811 
812  if (count($operations) > 0) {
813  foreach ($operations as $val) {
814  $this->tpl->setCurrentBlock("tbl_action_btn");
815  $this->tpl->setVariable("BTN_NAME", $val["name"]);
816  $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
817  $this->tpl->parseCurrentBlock();
818  }
819 
820  $this->tpl->setCurrentBlock("tbl_action_row");
821  $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
822  $this->tpl->parseCurrentBlock();
823  }
824  }
825 
829  public function addTerm()
830  {
831  if (trim($_POST["new_term"]) == "") {
832  ilUtil::sendFailure($this->lng->txt("cont_please_enter_a_term"), true);
833  $this->ctrl->redirect($this, "listTerms");
834  }
835 
836  // add term
837  $term = new ilGlossaryTerm();
838  $term->setGlossary($this->object);
839  $term->setTerm(ilUtil::stripSlashes($_POST["new_term"]));
840  $term->setLanguage($_POST["term_language"]);
841  $_SESSION["il_text_lang_" . $_GET["ref_id"]] = $_POST["term_language"];
842  $term->create();
843 
844  // add first definition
845  $def = new ilGlossaryDefinition();
846  $def->setTermId($term->getId());
847  $def->setTitle(ilUtil::stripSlashes($_POST["new_term"]));
848  $def->create();
849 
850  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
851  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
852  $this->ctrl->redirectByClass(array("ilglossarytermgui",
853  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
854  }
855 
859  public function moveDefinitionUp()
860  {
861  $definition = new ilGlossaryDefinition($_GET["def"]);
862  $definition->moveUp();
863 
864  $this->ctrl->redirect($this, "listTerms");
865  }
866 
870  public function moveDefinitionDown()
871  {
872  $definition = new ilGlossaryDefinition($_GET["def"]);
873  $definition->moveDown();
874 
875  $this->ctrl->redirect($this, "listTerms");
876  }
877 
881  public function confirmDefinitionDeletion()
882  {
883  //$this->getTemplate();
884  //$this->displayLocator();
885  //$this->setTabs();
886 
887  $term = new ilGlossaryTerm($this->term_id);
888 
889  $add = "";
890  $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id);
891  if ($nr > 0) {
892  $this->ctrl->setParameterByClass(
893  "ilglossarytermgui",
894  "term_id",
895  $this->term_id
896  );
897  $link = "[<a href='" .
898  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
899  "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
900  $add = "<br/>" . sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link;
901  }
902 
903  $cgui = new ilConfirmationGUI();
904  $cgui->setHeaderText($this->lng->txt("info_delete_sure") . $add);
905 
906  $cgui->setFormAction($this->ctrl->getFormAction($this));
907  $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion");
908  $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition");
909 
910  // content style
911  $this->setContentStyleSheet($this->tpl);
912 
913  // syntax style
914  $this->tpl->setCurrentBlock("SyntaxStyle");
915  $this->tpl->setVariable(
916  "LOCATION_SYNTAX_STYLESHEET",
918  );
919  $this->tpl->parseCurrentBlock();
920 
921  $definition = new ilGlossaryDefinition($_GET["def"]);
922  $page_gui = new ilGlossaryDefPageGUI($definition->getId());
923  $page_gui->setTemplateOutput(false);
924  $page_gui->setStyleId($this->object->getStyleSheetId());
925  $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
926  $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
927  $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
928  $output = $page_gui->preview();
929 
930  $cgui->addItem("def", $_GET["def"], $term->getTerm() . $output);
931 
932  $this->tpl->setContent($cgui->getHTML());
933  }
934 
935  public function cancelDefinitionDeletion()
936  {
937  $this->ctrl->redirect($this, "listTerms");
938  }
939 
940 
941  public function deleteDefinition()
942  {
943  $definition = new ilGlossaryDefinition($_REQUEST["def"]);
944  $definition->delete();
945  $this->ctrl->redirect($this, "listTerms");
946  }
947 
951  public function editTerm()
952  {
953  // deprecated
954  }
955 
956 
960  public function updateTerm()
961  {
962  $term = new ilGlossaryTerm($this->term_id);
963 
964  $term->setTerm(ilUtil::stripSlashes($_POST["term"]));
965  $term->setLanguage($_POST["term_language"]);
966  $term->update();
967  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
968  $this->ctrl->redirect($this, "listTerms");
969  }
970 
971 
972 
976  public function export()
977  {
978  $this->checkPermission("write");
979 
980  $glo_exp = new ilGlossaryExport($this->object);
981  $glo_exp->buildExportFile();
982  $this->ctrl->redirectByClass("ilexportgui", "");
983  }
984 
988  public function exportHTML()
989  {
990  $glo_exp = new ilGlossaryExport($this->object, "html");
991  $glo_exp->buildExportFile();
992  //echo $this->tpl->get();
993  $this->ctrl->redirectByClass("ilexportgui", "");
994  }
995 
999  public function publishExportFile()
1000  {
1001  $ilErr = $this->error;
1002 
1003  if (!isset($_POST["file"])) {
1004  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1005  }
1006  if (count($_POST["file"]) > 1) {
1007  $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1008  }
1009 
1010  $file = explode(":", $_POST["file"][0]);
1011  $export_dir = $this->object->getExportDirectory($file[0]);
1012 
1013  if ($this->object->getPublicExportFile($file[0]) ==
1014  $file[1]) {
1015  $this->object->setPublicExportFile($file[0], "");
1016  } else {
1017  $this->object->setPublicExportFile($file[0], $file[1]);
1018  }
1019  $this->object->update();
1020  $this->ctrl->redirectByClass("ilexportgui", "");
1021  }
1022 
1023  /*
1024  * list all export files
1025  */
1026  public function viewExportLog()
1027  {
1028  }
1029 
1033  public function confirmTermDeletion()
1034  {
1035  //$this->prepareOutput();
1036  if (!isset($_POST["id"])) {
1037  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1038  $this->ctrl->redirect($this, "listTerms");
1039  }
1040 
1041  // check ids
1042  foreach ($_POST["id"] as $term_id) {
1043  $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1044  if ($term_glo_id != $this->object->getId() && !ilGlossaryTermReferences::isReferenced($this->object->getId(), $term_id)) {
1045  ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1046  $this->ctrl->redirect($this, "listTerms");
1047  }
1048  }
1049 
1050  // display confirmation message
1051  $cgui = new ilConfirmationGUI();
1052  $cgui->setFormAction($this->ctrl->getFormAction($this));
1053  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1054  $cgui->setCancel($this->lng->txt("cancel"), "cancelTermDeletion");
1055  $cgui->setConfirm($this->lng->txt("confirm"), "deleteTerms");
1056 
1057  foreach ($_POST["id"] as $id) {
1058  $term = new ilGlossaryTerm($id);
1059 
1060  $add = "";
1062  if ($nr > 0) {
1063  $this->ctrl->setParameterByClass(
1064  "ilglossarytermgui",
1065  "term_id",
1066  $id
1067  );
1068 
1069  if (ilGlossaryTermReferences::isReferenced($this->object->getId(), $id)) {
1070  $add = " (" . $this->lng->txt("glo_term_reference") . ")";
1071  } else {
1072  $link = "[<a href='" .
1073  $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
1074  "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
1075  $add = "<div class='small'>" .
1076  sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link . "</div>";
1077  }
1078  }
1079 
1080  $cgui->addItem("id[]", $id, $term->getTerm() . $add);
1081  }
1082 
1083  $this->tpl->setContent($cgui->getHTML());
1084  }
1085 
1091  public function cancelTermDeletion()
1092  {
1093  $this->ctrl->redirect($this, "listTerms");
1094  }
1095 
1099  public function deleteTerms()
1100  {
1101  foreach ($_POST["id"] as $id) {
1102  if (ilGlossaryTermReferences::isReferenced($this->object->getId(), $id)) {
1103  $refs = new ilGlossaryTermReferences($this->object->getId());
1104  $refs->deleteTerm($id);
1105  $refs->update();
1106  } else {
1107  $term = new ilGlossaryTerm($id);
1108  $term->delete();
1109  }
1110  }
1111  $this->ctrl->redirect($this, "listTerms");
1112  }
1113 
1121  public function setLocator($a_tree = "", $a_id = "")
1122  {
1123  if (strtolower($_GET["baseClass"]) != "ilglossaryeditorgui") {
1124  parent::setLocator($a_tree, $a_id);
1125  } else {
1126  if (is_object($this->object)) {
1127  $gloss_loc = new ilGlossaryLocatorGUI();
1128  if (is_object($this->term)) {
1129  $gloss_loc->setTerm($this->term);
1130  }
1131  $gloss_loc->setGlossary($this->object);
1132  //$gloss_loc->setDefinition($this->definition);
1133  $gloss_loc->display();
1134  }
1135  }
1136  }
1137 
1141  public function view()
1142  {
1143  //$this->prepareOutput();
1144  $this->viewObject();
1145  }
1146 
1150  public function create()
1151  {
1152  switch ($_POST["new_type"]) {
1153  case "term":
1154  $term_gui = new ilGlossaryTermGUI();
1155  $term_gui->create();
1156  break;
1157  }
1158  }
1159 
1160  public function saveTerm()
1161  {
1162  $term_gui = new ilGlossaryTermGUI();
1163  $term_gui->setGlossary($this->object);
1164  $term_gui->save();
1165 
1166  ilUtil::sendSuccess($this->lng->txt("cont_added_term"), true);
1167 
1168  //ilUtil::redirect("glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
1169  $this->ctrl->redirect($this, "listTerms");
1170  }
1171 
1172 
1176  public function addDefinition()
1177  {
1178  $term_id = (int) $_GET["term_id"];
1179 
1180  $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1181  if ($term_glo_id != $this->object->getId()) {
1182  ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1183  $this->ctrl->redirect($this, "listTerms");
1184  }
1185 
1186  // add term
1187  $term = new ilGlossaryTerm($term_id);
1188 
1189  // add first definition
1190  $def = new ilGlossaryDefinition();
1191  $def->setTermId($term->getId());
1192  $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
1193  $def->create();
1194 
1195  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
1196  $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
1197  $this->ctrl->redirectByClass(array("ilglossarytermgui",
1198  "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
1199  }
1200 
1201  public function getTemplate()
1202  {
1203  $this->tpl->loadStandardTemplate();
1204 
1205  $title = $this->object->getTitle();
1206 
1207 
1208  if ($this->term_id > 0) {
1209  $this->tpl->setTitle($this->lng->txt("term") . ": " .
1210  ilGlossaryTerm::_lookGlossaryTerm($this->term_id));
1211  } else {
1212  parent::setTitleAndDescription();
1213  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
1214  $this->tpl->setTitle($this->lng->txt("glo") . ": " . $title);
1215  }
1216  }
1217 
1221  public function setTabs()
1222  {
1223  $this->getTabs();
1224  }
1225 
1229  public function getTabs()
1230  {
1231  $this->help->setScreenIdComponent("glo");
1232 
1233  // list terms
1234  $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "listTerms")
1235  ? true
1236  : false;
1237  $this->tabs_gui->addTarget(
1238  "cont_terms",
1239  $this->ctrl->getLinkTarget($this, "listTerms"),
1240  array("listTerms", ""),
1241  get_class($this),
1242  "",
1243  $force_active
1244  );
1245 
1246  $force_active = false;
1247  if ($this->ctrl->getCmd() == "showSummary" ||
1248  strtolower($this->ctrl->getNextClass()) == "ilinfoscreengui") {
1249  $force_active = true;
1250  }
1251  $this->tabs_gui->addTarget(
1252  "info_short",
1253  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
1254  "",
1255  "ilInfoScreenGUI",
1256  "",
1257  $force_active
1258  );
1259 
1260  // properties
1261  if ($this->rbacsystem->checkAccess('write', $this->object->getRefId())) {
1262  $this->tabs_gui->addTarget(
1263  "settings",
1264  $this->ctrl->getLinkTarget($this, "properties"),
1265  "properties",
1266  get_class($this)
1267  );
1268 
1269  // meta data
1270  $mdgui = new ilObjectMetaDataGUI($this->object, "term");
1271  $mdtab = $mdgui->getTab();
1272  if ($mdtab) {
1273  $this->tabs_gui->addTarget(
1274  "meta_data",
1275  $mdtab,
1276  "",
1277  "ilobjectmetadatagui"
1278  );
1279  }
1280 
1281  // export
1282  /*$tabs_gui->addTarget("export",
1283  $this->ctrl->getLinkTarget($this, "exportList"),
1284  array("exportList", "viewExportLog"), get_class($this));*/
1285 
1286  // export
1287  $this->tabs_gui->addTarget(
1288  "export",
1289  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1290  "",
1291  "ilexportgui"
1292  );
1293  }
1294 
1295  // permissions
1296  if ($this->rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
1297  /*$tabs_gui->addTarget("permission_settings",
1298  $this->ctrl->getLinkTarget($this, "perm"),
1299  array("perm", "info"),
1300  get_class($this));
1301  */
1302  $this->tabs_gui->addTarget(
1303  "perm_settings",
1304  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1305  array("perm","info","owner"),
1306  'ilpermissiongui'
1307  );
1308  }
1309 
1310  $this->tabs_gui->addNonTabbedLink(
1311  "presentation_view",
1312  $this->lng->txt("glo_presentation_view"),
1313  "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->object->getRefID(),
1314  "_top"
1315  );
1316  }
1317 
1321  public function setSettingsSubTabs($a_active)
1322  {
1323  if (in_array(
1324  $a_active,
1325  array("general_settings", "style", "taxonomy", "glossaries")
1326  )) {
1327  // general properties
1328  $this->tabs->addSubTab(
1329  "general_settings",
1330  $this->lng->txt("settings"),
1331  $this->ctrl->getLinkTarget($this, 'properties')
1332  );
1333 
1334  // style properties
1335  $this->tabs->addSubTab(
1336  "style",
1337  $this->lng->txt("obj_sty"),
1338  $this->ctrl->getLinkTarget($this, 'editStyleProperties')
1339  );
1340 
1341  // taxonomy
1343  $this->tabs->addSubTab(
1344  "taxonomy",
1345  $this->lng->txt("tax_taxonomy"),
1346  $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", '')
1347  );
1348 
1349  // style properties
1350  $this->tabs->addSubTab(
1351  "glossaries",
1352  $this->lng->txt("cont_auto_glossaries"),
1353  $this->ctrl->getLinkTarget($this, 'editGlossaries')
1354  );
1355 
1356  $this->tabs->activateSubTab($a_active);
1357  }
1358  }
1359 
1360 
1366  public static function _goto($a_target)
1367  {
1368  global $DIC;
1369 
1370  $lng = $DIC->language();
1371  $ilAccess = $DIC->access();
1372  $ilErr = $DIC["ilErr"];
1373 
1374  if ($ilAccess->checkAccess("read", "", $a_target)) {
1375  $_GET["ref_id"] = $a_target;
1376  $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1377  include("ilias.php");
1378  exit;
1379  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1380  $_GET["ref_id"] = $a_target;
1381  $_GET["cmd"] = "infoScreen";
1382  $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1383  include("ilias.php");
1384  exit;
1385  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1386  ilUtil::sendFailure(sprintf(
1387  $lng->txt("msg_no_perm_read_item"),
1389  ), true);
1391  }
1392 
1393  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1394  }
1395 
1399  public function applyFilter()
1400  {
1401  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1402  $prtab->resetOffset();
1403  $prtab->writeFilterToSession();
1404  $this->listTerms();
1405  }
1406 
1411  public function resetFilter()
1412  {
1413  $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1414  $prtab->resetOffset();
1415  $prtab->resetFilter();
1416  $this->listTerms();
1417  }
1418 
1419 
1423 
1427  public function setContentStyleSheet($a_tpl = null)
1428  {
1429  if ($a_tpl != null) {
1430  $ctpl = $a_tpl;
1431  } else {
1432  $ctpl = $this->tpl;
1433  }
1434 
1435  $ctpl->setCurrentBlock("ContentStyle");
1436  $ctpl->setVariable(
1437  "LOCATION_CONTENT_STYLESHEET",
1438  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
1439  );
1440  $ctpl->parseCurrentBlock();
1441  }
1442 
1443 
1447  public function editStyleProperties()
1448  {
1449  $this->checkPermission("write");
1450 
1451  $this->initStylePropertiesForm();
1452  $this->tpl->setContent($this->form->getHTML());
1453 
1454  $this->tabs->activateTab("settings");
1455  $this->setSettingsSubTabs("style");
1456  }
1457 
1461  public function initStylePropertiesForm()
1462  {
1463  $this->lng->loadLanguageModule("style");
1464 
1465  $this->form = new ilPropertyFormGUI();
1466 
1467  $fixed_style = $this->setting->get("fixed_content_style_id");
1468  $style_id = $this->object->getStyleSheetId();
1469 
1470  if ($fixed_style > 0) {
1471  $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
1472  $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
1473  $this->lng->txt("global_fixed") . ")");
1474  $this->form->addItem($st);
1475  } else {
1477  true,
1478  false,
1479  $_GET["ref_id"]
1480  );
1481 
1482  $st_styles[0] = $this->lng->txt("default");
1483  ksort($st_styles);
1484 
1485  if ($style_id > 0) {
1486  // individual style
1487  if (!ilObjStyleSheet::_lookupStandard($style_id)) {
1488  $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
1489  $st->setValue(ilObject::_lookupTitle($style_id));
1490  $this->form->addItem($st);
1491 
1492  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1493 
1494  // delete command
1495  $this->form->addCommandButton(
1496  "editStyle",
1497  $this->lng->txt("style_edit_style")
1498  );
1499  $this->form->addCommandButton(
1500  "deleteStyle",
1501  $this->lng->txt("style_delete_style")
1502  );
1503  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1504  }
1505  }
1506 
1507  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
1508  $style_sel = ilUtil::formSelect(
1509  $style_id,
1510  "style_id",
1511  $st_styles,
1512  false,
1513  true
1514  );
1515  $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"), "style_id");
1516  $style_sel->setOptions($st_styles);
1517  $style_sel->setValue($style_id);
1518  $this->form->addItem($style_sel);
1519  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1520  $this->form->addCommandButton(
1521  "saveStyleSettings",
1522  $this->lng->txt("save")
1523  );
1524  $this->form->addCommandButton(
1525  "createStyle",
1526  $this->lng->txt("sty_create_ind_style")
1527  );
1528  }
1529  }
1530  $this->form->setTitle($this->lng->txt("glo_style"));
1531  $this->form->setFormAction($this->ctrl->getFormAction($this));
1532  }
1533 
1537  public function createStyle()
1538  {
1539  $this->ctrl->redirectByClass("ilobjstylesheetgui", "create");
1540  }
1541 
1545  public function editStyle()
1546  {
1547  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
1548  }
1549 
1553  public function deleteStyle()
1554  {
1555  $this->ctrl->redirectByClass("ilobjstylesheetgui", "delete");
1556  }
1557 
1561  public function saveStyleSettings()
1562  {
1563  if ($this->setting->get("fixed_content_style_id") <= 0 &&
1564  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1565  || $this->object->getStyleSheetId() == 0)) {
1566  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1567  $this->object->update();
1568  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1569  }
1570  $this->ctrl->redirect($this, "editStyleProperties");
1571  }
1572 
1576  public function getPublicAccessColValue($a_type, $a_file)
1577  {
1578  if ($this->object->getPublicExportFile($a_type) == $a_file) {
1579  return $this->lng->txt("yes");
1580  }
1581 
1582  return " ";
1583  }
1584 
1590  public function showTaxonomy()
1591  {
1592  global $DIC;
1593 
1594  $ctrl = $DIC->ctrl();
1595 
1596  $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1597  if (count($tax_ids) > 0) {
1598  $tax_id = $tax_ids[0];
1599  $DIC->globalScreen()->tool()->context()->current()
1600  ->addAdditionalData(
1602  true
1603  );
1604  $DIC->globalScreen()->tool()->context()->current()
1605  ->addAdditionalData(
1607  $ctrl->getCurrentClassPath()
1608  );
1609  $DIC->globalScreen()->tool()->context()->current()
1610  ->addAdditionalData(
1612  $tax_id
1613  );
1614  $DIC->globalScreen()->tool()->context()->current()
1615  ->addAdditionalData(
1617  "listTerms"
1618  );
1619  $DIC->globalScreen()->tool()->context()->current()
1620  ->addAdditionalData(
1622  "showTaxonomy"
1623  );
1624 
1625 
1626  $tax_exp = new ilTaxonomyExplorerGUI(
1627  get_class($this),
1628  "showTaxonomy",
1629  $tax_ids[0],
1630  "ilobjglossarygui",
1631  "listTerms"
1632  );
1633  if (!$tax_exp->handleCommand()) {
1634  //$this->tpl->setLeftNavContent($tax_exp->getHTML());
1635  //$this->tpl->setLeftNavContent($tax_exp->getHTML() . "&nbsp;");
1636  }
1637  }
1638  }
1639 
1640  //
1641  // Auto glossaries
1642  //
1643 
1650  public function editGlossaries()
1651  {
1652  $this->tabs->setTabActive("settings");
1653  $this->setSettingsSubTabs("glossaries");
1654 
1655  $this->toolbar->addButton(
1656  $this->lng->txt("add"),
1657  $this->ctrl->getLinkTarget($this, "showGlossarySelector")
1658  );
1659 
1660  $tab = new ilGlossaryAutoLinkTableGUI($this->object, $this, "editGlossaries");
1661 
1662  $this->tpl->setContent($tab->getHTML());
1663  }
1664 
1671  public function showGlossarySelector()
1672  {
1673  $this->tabs->setTabActive("settings");
1674  $this->setSettingsSubTabs("glossaries");
1675 
1676  $exp = new ilSearchRootSelector($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1677  $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $this->tree->readRootId());
1678  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1679  $exp->setTargetClass(get_class($this));
1680  $exp->setCmd('confirmGlossarySelection');
1681  $exp->setClickableTypes(array("glo"));
1682  $exp->addFilter("glo");
1683 
1684  // build html-output
1685  $exp->setOutput(0);
1686  $this->tpl->setContent($exp->getOutput());
1687  }
1688 
1692  public function confirmGlossarySelection()
1693  {
1694  $cgui = new ilConfirmationGUI();
1695  $this->ctrl->setParameter($this, "glo_ref_id", $_GET["root_id"]);
1696  $cgui->setFormAction($this->ctrl->getFormAction($this));
1697  $cgui->setHeaderText($this->lng->txt("glo_link_glo_in_glo"));
1698  $cgui->setCancel($this->lng->txt("no"), "selectGlossary");
1699  $cgui->setConfirm($this->lng->txt("yes"), "selectGlossaryLink");
1700  $this->tpl->setContent($cgui->getHTML());
1701  }
1702 
1709  public function selectGlossaryLink()
1710  {
1711  $glo_ref_id = (int) $_GET["glo_ref_id"];
1712  $glo_id = ilObject::_lookupObjId($glo_ref_id);
1713  $this->object->autoLinkGlossaryTerms($glo_ref_id);
1714  $this->selectGlossary();
1715  }
1716 
1717 
1724  public function selectGlossary()
1725  {
1726  $glos = $this->object->getAutoGlossaries();
1727  $glo_ref_id = (int) $_GET["glo_ref_id"];
1728  $glo_id = ilObject::_lookupObjId($glo_ref_id);
1729  if (!in_array($glo_id, $glos)) {
1730  $glos[] = $glo_id;
1731  }
1732  $this->object->setAutoGlossaries($glos);
1733  $this->object->update();
1734 
1735  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1736  $this->ctrl->redirect($this, "editGlossaries");
1737  }
1738 
1745  public function removeGlossary()
1746  {
1747  $this->object->removeAutoGlossary((int) $_GET["glo_id"]);
1748  $this->object->update();
1749 
1750  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1751  $this->ctrl->redirect($this, "editGlossaries");
1752  }
1753 
1760  public function copyTerms()
1761  {
1762  $items = ilUtil::stripSlashesArray($_POST["id"]);
1763  if (!is_array($items)) {
1764  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1765  $this->ctrl->redirect($this, "listTerms");
1766  }
1767 
1768  $this->user->clipboardDeleteObjectsOfType("term");
1769 
1770  // put them into the clipboard
1771  $time = date("Y-m-d H:i:s", time());
1772  $order = 0;
1773  foreach ($items as $id) {
1774  $this->user->addObjectToClipboard(
1775  $id,
1776  "term",
1778  0,
1779  $time,
1780  $order
1781  );
1782  }
1783 
1785  ilUtil::sendInfo($this->lng->txt("glo_selected_terms_have_been_copied"), true);
1786  $this->ctrl->redirect($this, "listTerms");
1787  }
1788 
1795  public function referenceTerms()
1796  {
1797  $items = ilUtil::stripSlashesArray($_POST["id"]);
1798  if (!is_array($items)) {
1799  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1800  $this->ctrl->redirect($this, "listTerms");
1801  }
1802 
1803  $this->user->clipboardDeleteObjectsOfType("term");
1804 
1805  // put them into the clipboard
1806  $time = date("Y-m-d H:i:s", time());
1807  $order = 0;
1808  foreach ($items as $id) {
1809  $this->user->addObjectToClipboard(
1810  $id,
1811  "term",
1813  0,
1814  $time,
1815  $order
1816  );
1817  }
1818 
1820  ilUtil::sendInfo($this->lng->txt("glo_selected_terms_have_been_copied"), true);
1821  $this->ctrl->redirect($this, "listTerms");
1822  }
1823 
1824 
1831  public function clearClipboard()
1832  {
1833  $this->user->clipboardDeleteObjectsOfType("term");
1834  $this->ctrl->redirect($this, "listTerms");
1835  }
1836 
1840  public function pasteTerms()
1841  {
1842  if (ilEditClipboard::getAction() == "copy") {
1843  foreach ($this->user->getClipboardObjects("term") as $item) {
1844  ilGlossaryTerm::_copyTerm($item["id"], $this->object->getId());
1845  }
1846  }
1847  if (ilEditClipboard::getAction() == "link") {
1848  $refs = new ilGlossaryTermReferences($this->object->getId());
1849  foreach ($this->user->getClipboardObjects("term") as $item) {
1850  $refs->addTerm($item["id"]);
1851  }
1852  $refs->update();
1853  }
1854  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1855  $this->ctrl->redirect($this, "listTerms");
1856  }
1857 }
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
static getInstance(ilObjGlossaryGUI $a_glossary_gui)
Get instance.
Class ilGlossaryGUI.
This class represents an option in a radio group.
Class ilObjectMetaDataGUI.
showInfoScreen()
Show info screen.
saveObject()
save new content object to db
exit
Definition: login.php:29
Class ilInfoScreenGUI.
static isReferenced($a_glo_id, $a_term_id)
Is a term referenced by one or multiple glossaries.
setSettingsSubTabs($a_active)
Set sub tabs.
$_SESSION["AccountId"]
setTemplateOutput($a_output=true)
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
cancelTermDeletion()
cancel deletion of object
This class represents a property form user interface.
GUI class for the workflow of copying objects.
const TITLE_LENGTH
max length of object title
deleteTerms()
delete selected terms
$_GET["client_id"]
editGlossaries()
Edit automatically linked glossaries.
static getNumberOfUsages($a_term_id)
Get number of usages.
Glossary terms.
This class represents a section header in a property form.
moveDefinitionUp()
move a definiton up
Class ilObjGlossary.
initSettingsForm($a_mode="edit")
Init settings form.
Taxonomy explorer GUI class.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
executeCommand()
execute command
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
static _getStandardStyles( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
removeGlossary()
Remove lm glossary.
exportHTML()
create html package
createObject()
create new object form
export()
export content object
showActions($a_actions)
show possible action (form buttons)
resetFilter()
Reset filter (note: this function existed before data table filter has been introduced.
setInfo($a_info)
Set Info.
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
editStyleProperties()
Edit style properties.
showTaxonomy()
Show taxonomy.
static _lookupStandard($a_id)
Lookup standard flag.
help()
Definition: help.php:2
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$section
Definition: Utf8Test.php:83
$a_type
Definition: workflow.php:92
if($format !==null) $name
Definition: metadata.php:230
Export User Interface Class.
moveDefinitionDown()
move a definiton down
prepareOutput($a_show_subobjects=true)
prepare output
This class represents a property in a property form.
TableGUI class for auto link glossaries.
setValue($a_value)
Set Value.
deactTaxonomy()
Hide Taxonomy.
Taxonomy GUI class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
confirmGlossarySelection()
Confirm glossary selection.
actTaxonomy()
Show Taxonomy.
selectGlossaryLink()
Select a glossary and link all its terms.
create()
create new (subobject) in glossary
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
saveProperties()
save properties
setValue($a_value)
Set Value.
omitLocator($a_omit=true)
static addUsagesToInfo($info, $glo_id)
Add usages to info.
GUI class for glossary terms.
confirmTermDeletion()
confirm term deletion
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getSyntaxStylePath()
get syntax style path
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
addDefinition()
add definition
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setLocator($a_tree="", $a_id="")
set Locator
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
static _lookGlossaryID($term_id)
get glossary id form term id
$lang
Definition: xapiexit.php:8
Class ilGlossaryDefinition.
static _copyTerm($a_term_id, $a_glossary_id)
Copy a term to a glossary.
setContentStyleSheet($a_tpl=null)
Set content style sheet.
static getScormModulesForGlossary($a_glo_id)
Get SCORM modules that assign a certain glossary.
properties()
edit properties of object (admin form)
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
This class represents a non editable value in a property form.
Class ilObjStyleSheetGUI.
static _goto($a_target)
redirect script
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
Glossary definition page GUI class.
$ret
Definition: parser.php:6
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
$DIC
Definition: xapitoken.php:46
selectGlossary()
Select lm glossary.
getCreationMode()
get creation mode
referenceTerms()
Reference terms.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
confirmDefinitionDeletion()
deletion confirmation screen
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getLogger($a_component_id)
Get component logger.
Export class for content objects.
getObjectService()
Get object service.
getPublicAccessColValue($a_type, $a_file)
Get public access value for export table.
static yn2tf($a_yn)
convert "y"/"n" to true/false
showGlossarySelector()
Select LM Glossary.
static setAction($a_action)
publishExportFile()
download export file
static redirect($a_script)
addHeaderAction()
Add header action menu.
saveStyleSettings()
Save style settings.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
$cols
Definition: xhr_table.php:11
static _lookGlossaryTerm($term_id)
get glossary term
$_POST["username"]
Input for adv meta data column sorting in glossaries.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static setShortTextsDirty($a_glo_id)
Set short texts dirty.
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
Class ilECSGlossarySettings.
setLocator()
set Locator
initStylePropertiesForm()
Init style properties form.
Confirmation screen class.
clearClipboard()
Clear clipboard.
static loadLanguageModule()
Load language module.