ILIAS  release_7 Revision v7.30-3-g800a261c036
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
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->prepareOutput();
217 $this->ctrl->forwardCommand($gui);
218 break;
219
220 case "ilobjtaxonomygui":
221 $this->getTemplate();
222 $this->setTabs();
223 $this->setLocator();
224 $this->addHeaderAction();
225 $this->tabs->activateTab("settings");
226 $this->setSettingsSubTabs("taxonomy");
227
228 $this->ctrl->setReturn($this, "properties");
229 $tax_gui = new ilObjTaxonomyGUI();
230 $tax_gui->setMultiple(false);
231
232 $tax_gui->setAssignedObject($this->object->getId());
233 $ret = $this->ctrl->forwardCommand($tax_gui);
234 break;
235
236 case "ilexportgui":
237 $this->getTemplate();
238 $this->setTabs();
239 $this->tabs->activateTab("export");
240 $this->setLocator();
241 $exp_gui = new ilExportGUI($this);
242 //$exp_gui->addFormat("xml", "", $this, "export");
243 $exp_gui->addFormat("xml");
244 $exp_gui->addFormat("html", "", $this, "exportHTML");
245 $exp_gui->addCustomColumn(
246 $this->lng->txt("cont_public_access"),
247 $this,
248 "getPublicAccessColValue"
249 );
250 $exp_gui->addCustomMultiCommand(
251 $this->lng->txt("cont_public_access"),
252 $this,
253 "publishExportFile"
254 );
255 $ret = $this->ctrl->forwardCommand($exp_gui);
256 break;
257
258 case 'ilobjectcopygui':
259 $this->prepareOutput();
260 $cp = new ilObjectCopyGUI($this);
261 $cp->setType('glo');
262 $this->ctrl->forwardCommand($cp);
263 break;
264
265 case "ilglossaryforeigntermcollectorgui":
266 $this->ctrl->setReturn($this, "");
267 $this->getTemplate();
268 $this->setTabs();
269 $this->setLocator();
270 $this->addHeaderAction();
272 $this->ctrl->forwardCommand($coll);
273 break;
274
275 default:
276 $cmd = $this->ctrl->getCmd("listTerms");
277
278 if (($cmd == "create") && ($_POST["new_type"] == "term")) {
279 $this->ctrl->setCmd("create");
280 $this->ctrl->setCmdClass("ilGlossaryTermGUI");
281 $ret = $this->executeCommand();
282 return;
283 } else {
284 if (!in_array($cmd, array("quickList"))) {
285 if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
286 $this->getCreationMode() == true) {
287 $this->prepareOutput();
288 $cmd .= "Object";
289 } else {
290 $this->getTemplate();
291 $this->setTabs();
292 $this->setLocator();
293 $this->addHeaderAction();
294
295 if ($cmd == "redrawHeaderAction") {
296 $cmd = "redrawHeaderActionObject";
297 }
298 }
299 }
300 $ret = $this->$cmd();
301 }
302 break;
303 }
304
305 if (!in_array($cmd, array("quickList"))) {
306 if (strtolower($_GET["baseClass"]) != "iladministrationgui") {
307 if (!$this->getCreationMode()) {
308 $this->tpl->printToStdout();
309 }
310 }
311 } else {
312 $this->tpl->printToStdout(false);
313 }
314 }
315
316 public function assignObject()
317 {
318 $this->object = new ilObjGlossary($this->id, true);
319 }
320
321 public function initCreateForm($a_new_type)
322 {
323 $form = new ilPropertyFormGUI();
324 $form->setTarget("_top");
325 $form->setFormAction($this->ctrl->getFormAction($this));
326 $form->setTitle($this->lng->txt($a_new_type . "_new"));
327
328 // title
329 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
330 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
331 $ti->setMaxLength(ilObject::TITLE_LENGTH);
332 $ti->setRequired(true);
333 $form->addItem($ti);
334
335 // description
336 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
337 $ta->setCols(40);
338 $ta->setRows(2);
339 $form->addItem($ta);
340
341 // mode
342 $stati = array(
343 "none" => $this->lng->txt("glo_mode_normal"),
344 "level" => $this->lng->txt("glo_mode_level"),
345 "subtree" => $this->lng->txt("glo_mode_subtree")
346 );
347 $tm = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
348 $tm->setOptions($stati);
349 $tm->setInfo($this->lng->txt("glo_mode_desc"));
350 $tm->setRequired(true);
351 $form->addItem($tm);
352
353 // didactic template
354 $form = $this->initDidacticTemplate($form);
355
356 $form->addCommandButton("save", $this->lng->txt($a_new_type . "_add"));
357 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
358
359 return $form;
360 }
361
362 public function importObject()
363 {
364 $this->createObject();
365 }
366
370 public function saveObject()
371 {
373
374 $new_type = $_REQUEST["new_type"];
375
376 // create permission is already checked in createObject. This check here is done to prevent hacking attempts
377 if (!$this->checkPermissionBool("create", "", $new_type)) {
378 $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->MESSAGE);
379 }
380
381 $this->lng->loadLanguageModule($new_type);
382 $this->ctrl->setParameter($this, "new_type", $new_type);
383
384 $form = $this->initCreateForm($new_type);
385 if ($form->checkInput()) {
386 $this->ctrl->setParameter($this, "new_type", "");
387
388 $newObj = new ilObjGlossary();
389 $newObj->setType($new_type);
390 $newObj->setTitle($form->getInput("title"));
391 $newObj->setDescription($form->getInput("desc"));
392 $newObj->setVirtualMode($form->getInput("glo_mode"));
393 $newObj->create();
394
395 $this->putObjectInTree($newObj);
396
397 // apply didactic template?
398 $dtpl = $this->getDidacticTemplateVar("dtpl");
399 if ($dtpl) {
400 $newObj->applyDidacticTemplate($dtpl);
401 }
402
403 // always send a message
404 ilUtil::sendSuccess($this->lng->txt("glo_added"), true);
405 ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=" . $newObj->getRefId());
406 }
407
408 // display only this form to correct input
409 $form->setValuesByPost();
410 $this->tpl->setContent($form->getHtml());
411 }
412
419 public function showInfoScreen()
420 {
421 $this->getTemplate();
422 $this->setTabs();
423 $this->setLocator();
424 $this->lng->loadLanguageModule("meta");
425
426 $info = new ilInfoScreenGUI($this);
427 $info->enablePrivateNotes();
428 $info->enableNews();
429 if ($this->access->checkAccess("write", "", $_GET["ref_id"])) {
430 $info->enableNewsEditing();
431 $news_set = new ilSetting("news");
432 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
433 if ($enable_internal_rss) {
434 $info->setBlockProperty("news", "settings", true);
435 }
436 }
437 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
438
439 ilObjGlossaryGUI::addUsagesToInfo($info, $this->object->getId());
440
441 $this->ctrl->forwardCommand($info);
442 }
443
450 public static function addUsagesToInfo($info, $glo_id)
451 {
452 global $DIC;
453
454 $lng = $DIC->language();
455 $ilAccess = $DIC->access();
456
457 $info->addSection($lng->txt("glo_usages"));
459 foreach ($sms as $sm) {
460 $link = false;
461 $refs = ilObject::_getAllReferences($sm);
462 foreach ($refs as $ref) {
463 if ($link === false) {
464 if ($ilAccess->checkAccess("write", "", $ref)) {
465 $link = ilLink::_getLink($ref, 'sahs');
466 }
467 }
468 }
469
470 $entry = ilObject::_lookupTitle($sm);
471 if ($link !== false) {
472 $entry = "<a href='" . $link . "' target='_top'>" . $entry . "</a>";
473 }
474
475 $info->addProperty($lng->txt("obj_sahs"), $entry);
476 }
477 }
478
479
480 public function viewObject()
481 {
483
484 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
485 parent::viewObject();
486 return;
487 }
488
489 if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
490 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
491 }
492 }
493
499 public function properties()
500 {
501 $this->checkPermission("write");
502
503 $this->setSettingsSubTabs("general_settings");
504
505 $this->initSettingsForm();
506
507 // Edit ecs export settings
508 $ecs = new ilECSGlossarySettings($this->object);
509 $ecs->addSettingsToForm($this->form, 'glo');
510
511 $this->tpl->setContent($this->form->getHTML());
512 }
513
519 public function initSettingsForm($a_mode = "edit")
520 {
521 $obj_service = $this->getObjectService();
522
523
524 $this->form = new ilPropertyFormGUI();
525
526 // title
527 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
528 $title->setRequired(true);
529 $this->form->addItem($title);
530
531 // description
532 $desc = new ilTextAreaInputGUI($this->lng->txt("desc"), "description");
533 $this->form->addItem($desc);
534
535 $this->lng->loadLanguageModule("rep");
537 $section->setTitle($this->lng->txt('rep_activation_availability'));
538 $this->form->addItem($section);
539
540 // online
541 $online = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
542 $online->setValue("y");
543 $online->setInfo($this->lng->txt("glo_online_info"));
544 $this->form->addItem($online);
545
547 $section->setTitle($this->lng->txt('glo_content_settings'));
548 $this->form->addItem($section);
549
550 // glossary mode
551 $glo_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_mode"), "glo_mode");
552 //$glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
553 $op1 = new ilRadioOption($this->lng->txt("glo_mode_normal"), "none", $this->lng->txt("glo_mode_normal_info"));
554 $glo_mode->addOption($op1);
555 $op2 = new ilRadioOption($this->lng->txt("glo_mode_level"), "level", $this->lng->txt("glo_mode_level_info"));
556 $glo_mode->addOption($op2);
557 $op3 = new ilRadioOption($this->lng->txt("glo_mode_subtree"), "subtree", $this->lng->txt("glo_mode_subtree_info"));
558 $glo_mode->addOption($op3);
559 $this->form->addItem($glo_mode);
560
561 // glossary mode
562 /*$options = array(
563 "none"=>$this->lng->txt("glo_mode_normal"),
564 "level"=>$this->lng->txt("glo_mode_level"),
565 "subtree"=>$this->lng->txt("glo_mode_subtree")
566 );
567 $glo_mode = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
568 $glo_mode->setOptions($options);
569 $glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
570 $this->form->addItem($glo_mode);*/
571
572
574 $section->setTitle($this->lng->txt('cont_presentation'));
575 $this->form->addItem($section);
576
577 // tile image
578 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
579
580 // presentation mode
581 $pres_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_presentation_mode"), "pres_mode");
582 $pres_mode->setValue("table");
583 $op1 = new ilRadioOption($this->lng->txt("glo_table_form"), "table", $this->lng->txt("glo_table_form_info"));
584
585 // short text length
586 $snl = new ilNumberInputGUI($this->lng->txt("glo_text_snippet_length"), "snippet_length");
587 $snl->setMaxValue(3000);
588 $snl->setMinValue(100);
589 $snl->setMaxLength(4);
590 $snl->setSize(4);
591 $snl->setInfo($this->lng->txt("glo_text_snippet_length_info"));
592 $snl->setValue(200);
593 $op1->addSubItem($snl);
594
595 $pres_mode->addOption($op1);
596 $op2 = new ilRadioOption($this->lng->txt("glo_full_definitions"), "full_def", $this->lng->txt("glo_full_definitions_info"));
597 $pres_mode->addOption($op2);
598 $this->form->addItem($pres_mode);
599
600 // show taxonomy
601 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
602 if (count($tax_ids) > 0) {
603 $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
604 $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info"));
605 $this->form->addItem($show_tax);
606 }
607
608 // downloads
609 $down = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "glo_act_downloads");
610 $down->setValue("y");
611 $down->setInfo($this->lng->txt("cont_downloads_desc"));
612 $this->form->addItem($down);
613
614 if ($a_mode == "edit") {
615 $title->setValue($this->object->getTitle());
616 $desc->setValue($this->object->getDescription());
617 $online->setChecked($this->object->getOnline());
618 $glo_mode->setValue($this->object->getVirtualMode());
619 $pres_mode->setValue($this->object->getPresentationMode());
620 $snl->setValue($this->object->getSnippetLength());
621 if (count($tax_ids) > 0) {
622 $show_tax->setChecked($this->object->getShowTaxonomy());
623 }
624
625 $down->setChecked($this->object->isActiveDownloads());
626
627 // additional features
628 $feat = new ilFormSectionHeaderGUI();
629 $feat->setTitle($this->lng->txt('obj_features'));
630 $this->form->addItem($feat);
631
633 $this->object->getId(),
634 $this->form,
635 array(
637 )
638 );
639 }
640
641 // sort columns, if adv fields are given
642 $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getRefId());
643 $cols = $adv_ap->getColumnOrder();
644 if (count($cols) > 1) {
645 $ti = new ilGloAdvColSortInputGUI($this->lng->txt("cont_col_ordering"), "field_order");
646 $this->form->addItem($ti);
647 $ti->setValue($cols);
648 }
649
650 // save and cancel commands
651 $this->form->addCommandButton("saveProperties", $this->lng->txt("save"));
652
653 $this->form->setTitle($this->lng->txt("cont_glo_properties"));
654 $this->form->setFormAction($this->ctrl->getFormAction($this));
655 }
656
657
661 public function saveProperties()
662 {
663 $obj_service = $this->getObjectService();
664
665 $this->initSettingsForm();
666 if ($this->form->checkInput()) {
667 $this->object->setTitle($_POST['title']);
668 $this->object->setDescription($_POST['description']);
669 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
670 $this->object->setVirtualMode($_POST["glo_mode"]);
671 // $this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
672 $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
673 $this->object->setPresentationMode($_POST["pres_mode"]);
674 $this->object->setSnippetLength($_POST["snippet_length"]);
675 $this->object->setShowTaxonomy($_POST["show_tax"]);
676 $this->object->update();
677
678 // tile image
679 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
680
681 // field order of advanced metadata
682 $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getRefId());
683 $cols = $adv_ap->getColumnOrder();
684 if (count($cols) > 1) {
685 $adv_ap->saveColumnOrder($_POST["field_order"]);
686 }
687
688 // set definition short texts dirty
689 ilGlossaryDefinition::setShortTextsDirty($this->object->getId());
690
692 $this->object->getId(),
693 $this->form,
694 array(
696 )
697 );
698
699 // Update ecs export settings
700 $ecs = new ilECSGlossarySettings($this->object);
701 if ($ecs->handleSettingsUpdate()) {
702 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
703 $this->ctrl->redirect($this, "properties");
704 }
705 }
706 $this->form->setValuesByPost();
707 $this->tpl->setContent($this->form->getHTML());
708 }
709
710
714 public function listTerms()
715 {
716 //if ($_GET["show_tax"]) {
717 $this->showTaxonomy();
718 //}
719
720 // term
721 $ti = new ilTextInputGUI($this->lng->txt("cont_new_term"), "new_term");
722 $ti->setMaxLength(80);
723 $ti->setSize(20);
724 $this->toolbar->addInputItem($ti, true);
725
726 // language
727 $this->lng->loadLanguageModule("meta");
729 if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") {
730 $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]];
731 } else {
732 $s_lang = $this->user->getLanguage();
733 }
734 $si = new ilSelectInputGUI($this->lng->txt("language"), "term_language");
735 $si->setOptions($lang);
736 $si->setValue($s_lang);
737 $this->toolbar->addInputItem($si, true);
738
739 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
740 $this->toolbar->addFormButton($this->lng->txt("glo_add_new_term"), "addTerm");
741
742 $this->toolbar->addSeparator();
743
744 //ilEditClipboard::getAction() == "copy"
745 if ($this->user->clipboardHasObjectsOfType("term")) {
746 $this->toolbar->addButton(
747 $this->lng->txt("paste"),
748 $this->ctrl->getLinkTarget($this, "pasteTerms")
749 );
750 $this->toolbar->addButton(
751 $this->lng->txt("clear_clipboard"),
752 $this->ctrl->getLinkTarget($this, "clearClipboard")
753 );
754 } else {
755 $this->toolbar->addButton(
756 $this->lng->txt("glo_add_from_other"),
757 $this->ctrl->getLinkTargetByClass("ilglossaryforeigntermcollectorgui", "")
758 );
759 }
760
761 /* this is done by collapsing the tool now
762 if (is_object($this->tax)) {
763 $this->toolbar->addSeparator();
764 if ($_GET["show_tax"]) {
765 $this->toolbar->addButton(
766 $this->lng->txt("glo_hide_taxonomy"),
767 $this->ctrl->getLinkTarget($this, "deactTaxonomy")
768 );
769 } else {
770 $this->toolbar->addButton(
771 $this->lng->txt("glo_show_taxonomy"),
772 $this->ctrl->getLinkTarget($this, "actTaxonomy")
773 );
774 }
775 }*/
776
777 $tab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
778 $this->tpl->setContent($tab->getHTML());
779 }
780
787 public function actTaxonomy()
788 {
789 $this->ctrl->setParameter($this, "show_tax", 1);
790 $this->ctrl->redirect($this, "listTerms");
791 }
792
799 public function deactTaxonomy()
800 {
801 $this->ctrl->setParameter($this, "show_tax", "");
802 $this->ctrl->redirect($this, "listTerms");
803 }
804
805
811 public function showActions($a_actions)
812 {
813 foreach ($a_actions as $name => $lng) {
814 $d[$name] = array("name" => $name, "lng" => $lng);
815 }
816
817 $notoperations = array();
818 $operations = array();
819
820 $operations = $d;
821
822 if (count($operations) > 0) {
823 foreach ($operations as $val) {
824 $this->tpl->setCurrentBlock("tbl_action_btn");
825 $this->tpl->setVariable("BTN_NAME", $val["name"]);
826 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
827 $this->tpl->parseCurrentBlock();
828 }
829
830 $this->tpl->setCurrentBlock("tbl_action_row");
831 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
832 $this->tpl->parseCurrentBlock();
833 }
834 }
835
839 public function addTerm()
840 {
841 if (trim($_POST["new_term"]) == "") {
842 ilUtil::sendFailure($this->lng->txt("cont_please_enter_a_term"), true);
843 $this->ctrl->redirect($this, "listTerms");
844 }
845
846 // add term
847 $term = new ilGlossaryTerm();
848 $term->setGlossary($this->object);
849 $term->setTerm(ilUtil::stripSlashes($_POST["new_term"]));
850 $term->setLanguage($_POST["term_language"]);
851 $_SESSION["il_text_lang_" . $_GET["ref_id"]] = $_POST["term_language"];
852 $term->create();
853
854 // add first definition
855 $def = new ilGlossaryDefinition();
856 $def->setTermId($term->getId());
857 $def->setTitle(ilUtil::stripSlashes($_POST["new_term"]));
858 $def->create();
859
860 $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
861 $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
862 $this->ctrl->redirectByClass(array("ilglossarytermgui",
863 "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
864 }
865
869 public function moveDefinitionUp()
870 {
871 $definition = new ilGlossaryDefinition($_GET["def"]);
872 $definition->moveUp();
873
874 $this->ctrl->redirect($this, "listTerms");
875 }
876
880 public function moveDefinitionDown()
881 {
882 $definition = new ilGlossaryDefinition($_GET["def"]);
883 $definition->moveDown();
884
885 $this->ctrl->redirect($this, "listTerms");
886 }
887
892 {
893 //$this->getTemplate();
894 //$this->displayLocator();
895 //$this->setTabs();
896
897 $term = new ilGlossaryTerm($this->term_id);
898
899 $add = "";
900 $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id);
901 if ($nr > 0) {
902 $this->ctrl->setParameterByClass(
903 "ilglossarytermgui",
904 "term_id",
905 $this->term_id
906 );
907 $link = "[<a href='" .
908 $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
909 "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
910 $add = "<br/>" . sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link;
911 }
912
913 $cgui = new ilConfirmationGUI();
914 $cgui->setHeaderText($this->lng->txt("info_delete_sure") . $add);
915
916 $cgui->setFormAction($this->ctrl->getFormAction($this));
917 $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion");
918 $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition");
919
920 // content style
921 $this->setContentStyleSheet($this->tpl);
922
923 // syntax style
924 $this->tpl->setCurrentBlock("SyntaxStyle");
925 $this->tpl->setVariable(
926 "LOCATION_SYNTAX_STYLESHEET",
928 );
929 $this->tpl->parseCurrentBlock();
930
931 $definition = new ilGlossaryDefinition($_GET["def"]);
932 $page_gui = new ilGlossaryDefPageGUI($definition->getId());
933 $page_gui->setTemplateOutput(false);
934 $page_gui->setStyleId($this->object->getStyleSheetId());
935 $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
936 $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
937 $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
938 $output = $page_gui->preview();
939
940 $cgui->addItem("def", $_GET["def"], $term->getTerm() . $output);
941
942 $this->tpl->setContent($cgui->getHTML());
943 }
944
945 public function cancelDefinitionDeletion()
946 {
947 $this->ctrl->redirect($this, "listTerms");
948 }
949
950
951 public function deleteDefinition()
952 {
953 $definition = new ilGlossaryDefinition($_REQUEST["def"]);
954 $definition->delete();
955 $this->ctrl->redirect($this, "listTerms");
956 }
957
961 public function editTerm()
962 {
963 // deprecated
964 }
965
966
970 public function updateTerm()
971 {
972 $term = new ilGlossaryTerm($this->term_id);
973
974 $term->setTerm(ilUtil::stripSlashes($_POST["term"]));
975 $term->setLanguage($_POST["term_language"]);
976 $term->update();
977 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
978 $this->ctrl->redirect($this, "listTerms");
979 }
980
981
982
986 public function export()
987 {
988 $this->checkPermission("write");
989
990 $glo_exp = new ilGlossaryExport($this->object);
991 $glo_exp->buildExportFile();
992 $this->ctrl->redirectByClass("ilexportgui", "");
993 }
994
998 public function exportHTML()
999 {
1000 $glo_exp = new ilGlossaryExport($this->object, "html");
1001 $glo_exp->buildExportFile();
1002 //echo $this->tpl->get();
1003 $this->ctrl->redirectByClass("ilexportgui", "");
1004 }
1005
1009 public function publishExportFile()
1010 {
1012
1013 if (!isset($_POST["file"])) {
1014 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1015 }
1016 if (count($_POST["file"]) > 1) {
1017 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1018 }
1019
1020 $file = explode(":", $_POST["file"][0]);
1021 $export_dir = $this->object->getExportDirectory($file[0]);
1022
1023 if ($this->object->getPublicExportFile($file[0]) ==
1024 $file[1]) {
1025 $this->object->setPublicExportFile($file[0], "");
1026 } else {
1027 $this->object->setPublicExportFile($file[0], $file[1]);
1028 }
1029 $this->object->update();
1030 $this->ctrl->redirectByClass("ilexportgui", "");
1031 }
1032
1033 /*
1034 * list all export files
1035 */
1036 public function viewExportLog()
1037 {
1038 }
1039
1043 public function confirmTermDeletion()
1044 {
1045 //$this->prepareOutput();
1046 if (!isset($_POST["id"])) {
1047 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1048 $this->ctrl->redirect($this, "listTerms");
1049 }
1050
1051 // check ids
1052 foreach ($_POST["id"] as $term_id) {
1053 $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1054 if ($term_glo_id != $this->object->getId() && !ilGlossaryTermReferences::isReferenced($this->object->getId(), $term_id)) {
1055 ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1056 $this->ctrl->redirect($this, "listTerms");
1057 }
1058 }
1059
1060 // display confirmation message
1061 $cgui = new ilConfirmationGUI();
1062 $cgui->setFormAction($this->ctrl->getFormAction($this));
1063 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1064 $cgui->setCancel($this->lng->txt("cancel"), "cancelTermDeletion");
1065 $cgui->setConfirm($this->lng->txt("confirm"), "deleteTerms");
1066
1067 foreach ($_POST["id"] as $id) {
1068 $term = new ilGlossaryTerm($id);
1069
1070 $add = "";
1072 if ($nr > 0) {
1073 $this->ctrl->setParameterByClass(
1074 "ilglossarytermgui",
1075 "term_id",
1076 $id
1077 );
1078
1079 if (ilGlossaryTermReferences::isReferenced($this->object->getId(), $id)) {
1080 $add = " (" . $this->lng->txt("glo_term_reference") . ")";
1081 } else {
1082 $link = "[<a href='" .
1083 $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
1084 "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
1085 $add = "<div class='small'>" .
1086 sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link . "</div>";
1087 }
1088 }
1089
1090 $cgui->addItem("id[]", $id, $term->getTerm() . $add);
1091 }
1092
1093 $this->tpl->setContent($cgui->getHTML());
1094 }
1095
1101 public function cancelTermDeletion()
1102 {
1103 $this->ctrl->redirect($this, "listTerms");
1104 }
1105
1109 public function deleteTerms()
1110 {
1111 foreach ($_POST["id"] as $id) {
1112 if (ilGlossaryTermReferences::isReferenced($this->object->getId(), $id)) {
1113 $refs = new ilGlossaryTermReferences($this->object->getId());
1114 $refs->deleteTerm($id);
1115 $refs->update();
1116 } else {
1117 $term = new ilGlossaryTerm($id);
1118 $term->delete();
1119 }
1120 }
1121 $this->ctrl->redirect($this, "listTerms");
1122 }
1123
1131 public function setLocator($a_tree = "", $a_id = "")
1132 {
1133 if (strtolower($_GET["baseClass"]) != "ilglossaryeditorgui") {
1134 parent::setLocator($a_tree, $a_id);
1135 } else {
1136 if (is_object($this->object)) {
1137 $gloss_loc = new ilGlossaryLocatorGUI();
1138 if (is_object($this->term)) {
1139 $gloss_loc->setTerm($this->term);
1140 }
1141 $gloss_loc->setGlossary($this->object);
1142 //$gloss_loc->setDefinition($this->definition);
1143 $gloss_loc->display();
1144 }
1145 }
1146 }
1147
1151 public function view()
1152 {
1153 //$this->prepareOutput();
1154 $this->viewObject();
1155 }
1156
1160 public function create()
1161 {
1162 switch ($_POST["new_type"]) {
1163 case "term":
1164 $term_gui = new ilGlossaryTermGUI();
1165 $term_gui->create();
1166 break;
1167 }
1168 }
1169
1170 public function saveTerm()
1171 {
1172 $term_gui = new ilGlossaryTermGUI();
1173 $term_gui->setGlossary($this->object);
1174 $term_gui->save();
1175
1176 ilUtil::sendSuccess($this->lng->txt("cont_added_term"), true);
1177
1178 //ilUtil::redirect("glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
1179 $this->ctrl->redirect($this, "listTerms");
1180 }
1181
1182
1186 public function addDefinition()
1187 {
1188 $term_id = (int) $_GET["term_id"];
1189
1190 $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1191 if ($term_glo_id != $this->object->getId()) {
1192 ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1193 $this->ctrl->redirect($this, "listTerms");
1194 }
1195
1196 // add term
1198
1199 // add first definition
1200 $def = new ilGlossaryDefinition();
1201 $def->setTermId($term->getId());
1202 $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
1203 $def->create();
1204
1205 $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
1206 $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
1207 $this->ctrl->redirectByClass(array("ilglossarytermgui",
1208 "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
1209 }
1210
1211 public function getTemplate()
1212 {
1213 $this->tpl->loadStandardTemplate();
1214
1215 $title = $this->object->getTitle();
1216
1217
1218 if ($this->term_id > 0) {
1219 $this->tpl->setTitle($this->lng->txt("term") . ": " .
1220 ilGlossaryTerm::_lookGlossaryTerm($this->term_id));
1221 } else {
1222 parent::setTitleAndDescription();
1223 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
1224 $this->tpl->setTitle($this->lng->txt("glo") . ": " . $title);
1225 }
1226 }
1227
1231 public function setTabs()
1232 {
1233 $this->getTabs();
1234 }
1235
1239 public function getTabs()
1240 {
1241 $this->help->setScreenIdComponent("glo");
1242
1243 // list terms
1244 $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "listTerms")
1245 ? true
1246 : false;
1247 $this->tabs_gui->addTarget(
1248 "cont_terms",
1249 $this->ctrl->getLinkTarget($this, "listTerms"),
1250 array("listTerms", ""),
1251 get_class($this),
1252 "",
1253 $force_active
1254 );
1255
1256 $force_active = false;
1257 if ($this->ctrl->getCmd() == "showSummary" ||
1258 strtolower($this->ctrl->getNextClass()) == "ilinfoscreengui") {
1259 $force_active = true;
1260 }
1261 $this->tabs_gui->addTarget(
1262 "info_short",
1263 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
1264 "",
1265 "ilInfoScreenGUI",
1266 "",
1267 $force_active
1268 );
1269
1270 // properties
1271 if ($this->rbacsystem->checkAccess('write', $this->object->getRefId())) {
1272 $this->tabs_gui->addTarget(
1273 "settings",
1274 $this->ctrl->getLinkTarget($this, "properties"),
1275 "properties",
1276 get_class($this)
1277 );
1278
1279 // meta data
1280 $mdgui = new ilObjectMetaDataGUI($this->object, "term");
1281 $mdtab = $mdgui->getTab();
1282 if ($mdtab) {
1283 $this->tabs_gui->addTarget(
1284 "meta_data",
1285 $mdtab,
1286 "",
1287 "ilobjectmetadatagui"
1288 );
1289 }
1290
1291 // export
1292 /*$tabs_gui->addTarget("export",
1293 $this->ctrl->getLinkTarget($this, "exportList"),
1294 array("exportList", "viewExportLog"), get_class($this));*/
1295
1296 // export
1297 $this->tabs_gui->addTarget(
1298 "export",
1299 $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1300 "",
1301 "ilexportgui"
1302 );
1303 }
1304
1305 // permissions
1306 if ($this->rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
1307 /*$tabs_gui->addTarget("permission_settings",
1308 $this->ctrl->getLinkTarget($this, "perm"),
1309 array("perm", "info"),
1310 get_class($this));
1311 */
1312 $this->tabs_gui->addTarget(
1313 "perm_settings",
1314 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1315 array("perm","info","owner"),
1316 'ilpermissiongui'
1317 );
1318 }
1319
1320 $this->tabs_gui->addNonTabbedLink(
1321 "presentation_view",
1322 $this->lng->txt("glo_presentation_view"),
1323 "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->object->getRefID(),
1324 "_top"
1325 );
1326 }
1327
1331 public function setSettingsSubTabs($a_active)
1332 {
1333 if (in_array(
1334 $a_active,
1335 array("general_settings", "style", "taxonomy", "glossaries")
1336 )) {
1337 // general properties
1338 $this->tabs->addSubTab(
1339 "general_settings",
1340 $this->lng->txt("settings"),
1341 $this->ctrl->getLinkTarget($this, 'properties')
1342 );
1343
1344 // style properties
1345 $this->tabs->addSubTab(
1346 "style",
1347 $this->lng->txt("obj_sty"),
1348 $this->ctrl->getLinkTarget($this, 'editStyleProperties')
1349 );
1350
1351 // taxonomy
1353 $this->tabs->addSubTab(
1354 "taxonomy",
1355 $this->lng->txt("tax_taxonomy"),
1356 $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", '')
1357 );
1358
1359 // style properties
1360 $this->tabs->addSubTab(
1361 "glossaries",
1362 $this->lng->txt("cont_auto_glossaries"),
1363 $this->ctrl->getLinkTarget($this, 'editGlossaries')
1364 );
1365
1366 $this->tabs->activateSubTab($a_active);
1367 }
1368 }
1369
1370
1376 public static function _goto($a_target)
1377 {
1378 global $DIC;
1379
1380 $lng = $DIC->language();
1381 $ilAccess = $DIC->access();
1382 $ilErr = $DIC["ilErr"];
1383
1384 if ($ilAccess->checkAccess("read", "", $a_target)) {
1385 $_GET["ref_id"] = $a_target;
1386 $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1387 include("ilias.php");
1388 exit;
1389 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1390 $_GET["ref_id"] = $a_target;
1391 $_GET["cmd"] = "infoScreen";
1392 $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1393 include("ilias.php");
1394 exit;
1395 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1396 ilUtil::sendFailure(sprintf(
1397 $lng->txt("msg_no_perm_read_item"),
1399 ), true);
1401 }
1402
1403 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1404 }
1405
1409 public function applyFilter()
1410 {
1411 $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1412 $prtab->resetOffset();
1413 $prtab->writeFilterToSession();
1414 $this->listTerms();
1415 }
1416
1421 public function resetFilter()
1422 {
1423 $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1424 $prtab->resetOffset();
1425 $prtab->resetFilter();
1426 $this->listTerms();
1427 }
1428
1429
1433
1437 public function setContentStyleSheet($a_tpl = null)
1438 {
1439 if ($a_tpl != null) {
1440 $ctpl = $a_tpl;
1441 } else {
1442 $ctpl = $this->tpl;
1443 }
1444
1445 $ctpl->setCurrentBlock("ContentStyle");
1446 $ctpl->setVariable(
1447 "LOCATION_CONTENT_STYLESHEET",
1448 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
1449 );
1450 $ctpl->parseCurrentBlock();
1451 }
1452
1453
1457 public function editStyleProperties()
1458 {
1459 $this->checkPermission("write");
1460
1461 $this->initStylePropertiesForm();
1462 $this->tpl->setContent($this->form->getHTML());
1463
1464 $this->tabs->activateTab("settings");
1465 $this->setSettingsSubTabs("style");
1466 }
1467
1471 public function initStylePropertiesForm()
1472 {
1473 $this->lng->loadLanguageModule("style");
1474
1475 $this->form = new ilPropertyFormGUI();
1476
1477 $fixed_style = $this->setting->get("fixed_content_style_id");
1478 $style_id = $this->object->getStyleSheetId();
1479
1480 if ($fixed_style > 0) {
1481 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
1482 $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
1483 $this->lng->txt("global_fixed") . ")");
1484 $this->form->addItem($st);
1485 } else {
1487 true,
1488 false,
1489 $_GET["ref_id"]
1490 );
1491
1492 $st_styles[0] = $this->lng->txt("default");
1493 ksort($st_styles);
1494
1495 if ($style_id > 0) {
1496 // individual style
1497 if (!ilObjStyleSheet::_lookupStandard($style_id)) {
1498 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
1499 $st->setValue(ilObject::_lookupTitle($style_id));
1500 $this->form->addItem($st);
1501
1502 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1503
1504 // delete command
1505 $this->form->addCommandButton(
1506 "editStyle",
1507 $this->lng->txt("style_edit_style")
1508 );
1509 $this->form->addCommandButton(
1510 "deleteStyle",
1511 $this->lng->txt("style_delete_style")
1512 );
1513 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1514 }
1515 }
1516
1517 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
1518 $style_sel = ilUtil::formSelect(
1519 $style_id,
1520 "style_id",
1521 $st_styles,
1522 false,
1523 true
1524 );
1525 $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"), "style_id");
1526 $style_sel->setOptions($st_styles);
1527 $style_sel->setValue($style_id);
1528 $this->form->addItem($style_sel);
1529 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1530 $this->form->addCommandButton(
1531 "saveStyleSettings",
1532 $this->lng->txt("save")
1533 );
1534 $this->form->addCommandButton(
1535 "createStyle",
1536 $this->lng->txt("sty_create_ind_style")
1537 );
1538 }
1539 }
1540 $this->form->setTitle($this->lng->txt("glo_style"));
1541 $this->form->setFormAction($this->ctrl->getFormAction($this));
1542 }
1543
1547 public function createStyle()
1548 {
1549 $this->ctrl->redirectByClass("ilobjstylesheetgui", "create");
1550 }
1551
1555 public function editStyle()
1556 {
1557 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
1558 }
1559
1563 public function deleteStyle()
1564 {
1565 $this->ctrl->redirectByClass("ilobjstylesheetgui", "delete");
1566 }
1567
1571 public function saveStyleSettings()
1572 {
1573 if ($this->setting->get("fixed_content_style_id") <= 0 &&
1574 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1575 || $this->object->getStyleSheetId() == 0)) {
1576 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1577 $this->object->update();
1578 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1579 }
1580 $this->ctrl->redirect($this, "editStyleProperties");
1581 }
1582
1586 public function getPublicAccessColValue($a_type, $a_file)
1587 {
1588 if ($this->object->getPublicExportFile($a_type) == $a_file) {
1589 return $this->lng->txt("yes");
1590 }
1591
1592 return " ";
1593 }
1594
1600 public function showTaxonomy()
1601 {
1602 global $DIC;
1603
1604 $ctrl = $DIC->ctrl();
1605
1606 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1607 if (count($tax_ids) > 0) {
1608 $tax_id = $tax_ids[0];
1609 $DIC->globalScreen()->tool()->context()->current()
1610 ->addAdditionalData(
1612 true
1613 );
1614 $DIC->globalScreen()->tool()->context()->current()
1615 ->addAdditionalData(
1617 $ctrl->getCurrentClassPath()
1618 );
1619 $DIC->globalScreen()->tool()->context()->current()
1620 ->addAdditionalData(
1622 $tax_id
1623 );
1624 $DIC->globalScreen()->tool()->context()->current()
1625 ->addAdditionalData(
1627 "listTerms"
1628 );
1629 $DIC->globalScreen()->tool()->context()->current()
1630 ->addAdditionalData(
1632 "showTaxonomy"
1633 );
1634
1635
1636 $tax_exp = new ilTaxonomyExplorerGUI(
1637 get_class($this),
1638 "showTaxonomy",
1639 $tax_ids[0],
1640 "ilobjglossarygui",
1641 "listTerms"
1642 );
1643 if (!$tax_exp->handleCommand()) {
1644 //$this->tpl->setLeftNavContent($tax_exp->getHTML());
1645 //$this->tpl->setLeftNavContent($tax_exp->getHTML() . "&nbsp;");
1646 }
1647 }
1648 }
1649
1650 //
1651 // Auto glossaries
1652 //
1653
1660 public function editGlossaries()
1661 {
1662 $this->tabs->setTabActive("settings");
1663 $this->setSettingsSubTabs("glossaries");
1664
1665 $this->toolbar->addButton(
1666 $this->lng->txt("add"),
1667 $this->ctrl->getLinkTarget($this, "showGlossarySelector")
1668 );
1669
1670 $tab = new ilGlossaryAutoLinkTableGUI($this->object, $this, "editGlossaries");
1671
1672 $this->tpl->setContent($tab->getHTML());
1673 }
1674
1681 public function showGlossarySelector()
1682 {
1683 $this->tabs->setTabActive("settings");
1684 $this->setSettingsSubTabs("glossaries");
1685
1686 $exp = new ilSearchRootSelector($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1687 $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $this->tree->readRootId());
1688 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1689 $exp->setTargetClass(get_class($this));
1690 $exp->setCmd('confirmGlossarySelection');
1691 $exp->setClickableTypes(array("glo"));
1692 $exp->addFilter("glo");
1693
1694 // build html-output
1695 $exp->setOutput(0);
1696 $this->tpl->setContent($exp->getOutput());
1697 }
1698
1703 {
1704 $cgui = new ilConfirmationGUI();
1705 $this->ctrl->setParameter($this, "glo_ref_id", $_GET["root_id"]);
1706 $cgui->setFormAction($this->ctrl->getFormAction($this));
1707 $cgui->setHeaderText($this->lng->txt("glo_link_glo_in_glo"));
1708 $cgui->setCancel($this->lng->txt("no"), "selectGlossary");
1709 $cgui->setConfirm($this->lng->txt("yes"), "selectGlossaryLink");
1710 $this->tpl->setContent($cgui->getHTML());
1711 }
1712
1719 public function selectGlossaryLink()
1720 {
1721 $glo_ref_id = (int) $_GET["glo_ref_id"];
1722 $glo_id = ilObject::_lookupObjId($glo_ref_id);
1723 $this->object->autoLinkGlossaryTerms($glo_ref_id);
1724 $this->selectGlossary();
1725 }
1726
1727
1734 public function selectGlossary()
1735 {
1736 $glos = $this->object->getAutoGlossaries();
1737 $glo_ref_id = (int) $_GET["glo_ref_id"];
1738 $glo_id = ilObject::_lookupObjId($glo_ref_id);
1739 if (!in_array($glo_id, $glos)) {
1740 $glos[] = $glo_id;
1741 }
1742 $this->object->setAutoGlossaries($glos);
1743 $this->object->update();
1744
1745 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1746 $this->ctrl->redirect($this, "editGlossaries");
1747 }
1748
1755 public function removeGlossary()
1756 {
1757 $this->object->removeAutoGlossary((int) $_GET["glo_id"]);
1758 $this->object->update();
1759
1760 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1761 $this->ctrl->redirect($this, "editGlossaries");
1762 }
1763
1770 public function copyTerms()
1771 {
1772 $items = ilUtil::stripSlashesArray($_POST["id"]);
1773 if (!is_array($items)) {
1774 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1775 $this->ctrl->redirect($this, "listTerms");
1776 }
1777
1778 $this->user->clipboardDeleteObjectsOfType("term");
1779
1780 // put them into the clipboard
1781 $time = date("Y-m-d H:i:s", time());
1782 $order = 0;
1783 foreach ($items as $id) {
1784 $this->user->addObjectToClipboard(
1785 $id,
1786 "term",
1788 0,
1789 $time,
1790 $order
1791 );
1792 }
1793
1795 ilUtil::sendInfo($this->lng->txt("glo_selected_terms_have_been_copied"), true);
1796 $this->ctrl->redirect($this, "listTerms");
1797 }
1798
1805 public function referenceTerms()
1806 {
1807 $items = ilUtil::stripSlashesArray($_POST["id"]);
1808 if (!is_array($items)) {
1809 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1810 $this->ctrl->redirect($this, "listTerms");
1811 }
1812
1813 $this->user->clipboardDeleteObjectsOfType("term");
1814
1815 // put them into the clipboard
1816 $time = date("Y-m-d H:i:s", time());
1817 $order = 0;
1818 foreach ($items as $id) {
1819 $this->user->addObjectToClipboard(
1820 $id,
1821 "term",
1823 0,
1824 $time,
1825 $order
1826 );
1827 }
1828
1830 ilUtil::sendInfo($this->lng->txt("glo_selected_terms_have_been_copied"), true);
1831 $this->ctrl->redirect($this, "listTerms");
1832 }
1833
1834
1841 public function clearClipboard()
1842 {
1843 $this->user->clipboardDeleteObjectsOfType("term");
1844 $this->ctrl->redirect($this, "listTerms");
1845 }
1846
1850 public function pasteTerms()
1851 {
1852 if (ilEditClipboard::getAction() == "copy") {
1853 foreach ($this->user->getClipboardObjects("term") as $item) {
1854 ilGlossaryTerm::_copyTerm($item["id"], $this->object->getId());
1855 }
1856 }
1857 if (ilEditClipboard::getAction() == "link") {
1858 $refs = new ilGlossaryTermReferences($this->object->getId());
1859 foreach ($this->user->getClipboardObjects("term") as $item) {
1860 $refs->addTerm($item["id"]);
1861 }
1862 $refs->update();
1863 }
1864 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1865 $this->ctrl->redirect($this, "listTerms");
1866 }
1867}
user()
Definition: user.php:4
$section
Definition: Utf8Test.php:83
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
Class ilECSGlossarySettings.
static setAction($a_action)
Export User Interface Class.
This class represents a section header in a property form.
Input for adv meta data column sorting in glossaries.
TableGUI class for auto link glossaries.
Glossary definition page GUI class.
Class ilGlossaryDefinition.
static setShortTextsDirty($a_glo_id)
Set short texts dirty.
Export class for content objects.
static getInstance(ilObjGlossaryGUI $a_glossary_gui)
Get instance.
GUI class for glossary terms.
static isReferenced($a_glo_id, $a_term_id)
Is a term referenced by one or multiple glossaries.
static getNumberOfUsages($a_term_id)
Get number of usages.
static _lookGlossaryID($term_id)
get glossary id form term id
static _copyTerm($a_term_id, $a_glossary_id)
Copy a term to a glossary.
static _lookGlossaryTerm($term_id)
get glossary term
Class ilInfoScreenGUI.
static getLogger($a_component_id)
Get component logger.
This class represents a non editable value in a property form.
This class represents a number property in a property form.
Class ilGlossaryGUI.
initSettingsForm($a_mode="edit")
Init settings form.
exportHTML()
create html package
addDefinition()
add definition
referenceTerms()
Reference terms.
moveDefinitionDown()
move a definiton down
setLocator($a_tree="", $a_id="")
set Locator
static _goto($a_target)
redirect script
setContentStyleSheet($a_tpl=null)
Set content style sheet.
setSettingsSubTabs($a_active)
Set sub tabs.
initStylePropertiesForm()
Init style properties form.
confirmGlossarySelection()
Confirm glossary selection.
confirmTermDeletion()
confirm term deletion
confirmDefinitionDeletion()
deletion confirmation screen
getPublicAccessColValue($a_type, $a_file)
Get public access value for export table.
static addUsagesToInfo($info, $glo_id)
Add usages to info.
actTaxonomy()
Show Taxonomy.
executeCommand()
execute command
showActions($a_actions)
show possible action (form buttons)
properties()
edit properties of object (admin form)
deleteTerms()
delete selected terms
moveDefinitionUp()
move a definiton up
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
showTaxonomy()
Show taxonomy.
editStyleProperties()
Edit style properties.
selectGlossaryLink()
Select a glossary and link all its terms.
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
showGlossarySelector()
Select LM Glossary.
publishExportFile()
download export file
saveObject()
save new content object to db
selectGlossary()
Select lm glossary.
resetFilter()
Reset filter (note: this function existed before data table filter has been introduced.
create()
create new (subobject) in glossary
deactTaxonomy()
Hide Taxonomy.
clearClipboard()
Clear clipboard.
export()
export content object
saveStyleSettings()
Save style settings.
initCreateForm($a_new_type)
Init object creation form.
cancelTermDeletion()
cancel deletion of object
removeGlossary()
Remove lm glossary.
showInfoScreen()
Show info screen.
saveProperties()
save properties
editGlossaries()
Edit automatically linked glossaries.
Class ilObjGlossary.
static getScormModulesForGlossary($a_glo_id)
Get SCORM modules that assign a certain glossary.
Class ilObjStyleSheetGUI.
static _lookupStandard($a_id)
Lookup standard flag.
static getSyntaxStylePath()
get syntax style path
static _getStandardStyles( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
Taxonomy GUI class.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static loadLanguageModule()
Load language module.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
getDidacticTemplateVar($a_type)
Get didactic template setting from creation screen.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
addHeaderAction()
Add header action menu.
createObject()
create new object form
setLocator()
set Locator
getObjectService()
Get object service.
Class ilObjectMetaDataGUI.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
ILIAS Setting Class.
Taxonomy explorer GUI class.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static yn2tf($a_yn)
convert "y"/"n" to true/false
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.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
const ROOT_FOLDER_ID
Definition: constants.php:30
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
exit
Definition: login.php:29
if($format !==null) $name
Definition: metadata.php:230
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
$lang
Definition: xapiexit.php:8
$cols
Definition: xhr_table.php:11