ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjGlossaryGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once("./Services/Object/classes/class.ilObjectGUI.php");
6require_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
7require_once("./Modules/Glossary/classes/class.ilGlossaryTermGUI.php");
8require_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
9require_once("./Modules/Glossary/classes/class.ilTermDefinitionEditorGUI.php");
10require_once("./Services/COPage/classes/class.ilPCParagraph.php");
11
28{
32 protected $error;
33
35 public $mode;
36 public $term;
37
41 protected $term_id;
42
46 protected $ctrl;
47
51 protected $user;
52
56 protected $toolbar;
57
61 protected $tabs;
62
66 protected $setting;
67
71 protected $access;
72
76 protected $rbacsystem;
77
81 protected $help;
82
86 protected $term_perm;
87
91 protected $log;
92
97 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
98 {
99 $this->error = $DIC["ilErr"];
100 global $DIC;
101
102 $this->ctrl = $DIC->ctrl();
103 $this->lng = $DIC->language();
104 $this->user = $DIC->user();
105 $this->toolbar = $DIC->toolbar();
106 $this->tabs = $DIC->tabs();
107 $this->setting = $DIC["ilSetting"];
108 $this->access = $DIC->access();
109 $this->rbacsystem = $DIC->rbac()->system();
110 $this->help = $DIC["ilHelp"];
111
112 $this->log = ilLoggerFactory::getLogger('glo');
113
114 include_once("./Modules/Glossary/classes/class.ilGlossaryTermPermission.php");
115 $this->term_perm = ilGlossaryTermPermission::getInstance();
116
117 $this->ctrl->saveParameter($this, array("ref_id", "offset"));
118
119 $this->lng->loadLanguageModule("content");
120 $this->lng->loadLanguageModule("glo");
121
122 $this->type = "glo";
123 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
124
125 // determine term id and check whether it is valid (belongs to
126 // current glossary)
127 $this->term_id = (int) $_GET["term_id"];
128 $term_glo_id = ilGlossaryTerm::_lookGlossaryID($this->term_id);
129 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
130 if ($this->term_id > 0 && $term_glo_id != $this->object->getId()
131 && !ilGlossaryTermReferences::isReferenced($this->object->getId(), $this->term_id)) {
132 $this->term_id = "";
133 }
134
135 $this->tax_id = $this->object->getTaxonomyId();
136 if ($this->tax_id > 0) {
137 $this->ctrl->saveParameter($this, array("show_tax", "tax_node"));
138
139 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
140 $this->tax = new ilObjTaxonomy($this->tax_id);
141 }
142 if ((int) $_GET["tax_node"] > 1 && $this->tax->getTree()->readRootId() != $_GET["tax_node"]) {
143 $this->tax_node = (int) $_GET["tax_node"];
144 }
145 }
146
150 public function executeCommand()
151 {
152 $cmd = $this->ctrl->getCmd();
153 $next_class = $this->ctrl->getNextClass($this);
154
155 $this->log->debug("glossary term, next class " . $next_class . ", cmd: " . $cmd);
156
157 switch ($next_class) {
158 case 'ilobjectmetadatagui':
159 $this->checkPermission("write");
160
161 $this->getTemplate();
162 $this->setTabs();
163 $this->setLocator();
164 $this->addHeaderAction();
165
166 $this->tabs_gui->activateTab('meta_data');
167 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
168 $md_gui = new ilObjectMetaDataGUI($this->object, 'term');
169 $this->ctrl->forwardCommand($md_gui);
170 break;
171
172 case "ilglossarytermgui":
173 if (!$this->term_perm->checkPermission("edit_content", $this->term_id) &&
174 !$this->term_perm->checkPermission("write", $this->term_id)) {
175 include_once("./Modules/Glossary/exceptions/class.ilGlossaryException.php");
176 throw new ilGlossaryException("No permission.");
177 }
178 $this->getTemplate();
179// $this->quickList();
180 $this->ctrl->setReturn($this, "listTerms");
181 $term_gui = new ilGlossaryTermGUI($this->term_id);
182 $term_gui->setGlossary($this->object);
183 //$ret = $term_gui->executeCommand();
184 $ret = $this->ctrl->forwardCommand($term_gui);
185 break;
186
187 case "ilinfoscreengui":
188 $this->addHeaderAction();
189 $this->showInfoScreen();
190 break;
191
192 case "ilobjstylesheetgui":
193 include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
194 $this->ctrl->setReturn($this, "editStyleProperties");
195 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
196 $style_gui->omitLocator();
197 if ($cmd == "create" || $_GET["new_type"] == "sty") {
198 $style_gui->setCreationMode(true);
199 }
200
201 if ($cmd == "confirmedDelete") {
202 $this->object->setStyleSheetId(0);
203 $this->object->update();
204 }
205
206 $ret = $this->ctrl->forwardCommand($style_gui);
207
208 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
209 $style_id = $ret;
210 $this->object->setStyleSheetId($style_id);
211 $this->object->update();
212 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
213 }
214 break;
215
216
217 case 'ilpermissiongui':
218 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
219 $this->prepareOutput();
220 } else {
221 $this->getTemplate();
222 $this->setTabs();
223 $this->setLocator();
224 $this->addHeaderAction();
225 }
226 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
227 $perm_gui = new ilPermissionGUI($this);
228 $ret = $this->ctrl->forwardCommand($perm_gui);
229 break;
230
231 case "ilcommonactiondispatchergui":
232 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
234 $this->ctrl->forwardCommand($gui);
235 break;
236
237 case "ilobjtaxonomygui":
238 $this->getTemplate();
239 $this->setTabs();
240 $this->setLocator();
241 $this->addHeaderAction();
242 $this->tabs->activateTab("settings");
243 $this->setSettingsSubTabs("taxonomy");
244
245 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php");
246 $this->ctrl->setReturn($this, "properties");
247 $tax_gui = new ilObjTaxonomyGUI();
248 $tax_gui->setMultiple(false);
249
250 /*include_once("./Modules/Glossary/classes/class.ilTermTaxInfo.php");
251 $term_info = new ilTermTaxInfo();*/
252 //$tax_gui->activateAssignedItemSorting($term_info, "glo", "term");
253
254 $tax_gui->setAssignedObject($this->object->getId());
255 $ret = $this->ctrl->forwardCommand($tax_gui);
256 break;
257
258 case "ilexportgui":
259 $this->getTemplate();
260 $this->setTabs();
261 $this->tabs->activateTab("export");
262 $this->setLocator();
263 include_once("./Services/Export/classes/class.ilExportGUI.php");
264 $exp_gui = new ilExportGUI($this);
265 //$exp_gui->addFormat("xml", "", $this, "export");
266 $exp_gui->addFormat("xml");
267 $exp_gui->addFormat("html", "", $this, "exportHTML");
268 $exp_gui->addCustomColumn(
269 $this->lng->txt("cont_public_access"),
270 $this,
271 "getPublicAccessColValue"
272 );
273 $exp_gui->addCustomMultiCommand(
274 $this->lng->txt("cont_public_access"),
275 $this,
276 "publishExportFile"
277 );
278 $ret = $this->ctrl->forwardCommand($exp_gui);
279 break;
280
281 case 'ilobjectcopygui':
282 $this->prepareOutput();
283 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
284 $cp = new ilObjectCopyGUI($this);
285 $cp->setType('glo');
286 $this->ctrl->forwardCommand($cp);
287 break;
288
289 case "ilglossaryforeigntermcollectorgui":
290 $this->ctrl->setReturn($this, "");
291 $this->getTemplate();
292 $this->setTabs();
293 $this->setLocator();
294 $this->addHeaderAction();
295 include_once("./Modules/Glossary/classes/class.ilGlossaryForeignTermCollectorGUI.php");
297 $this->ctrl->forwardCommand($coll);
298 break;
299
300 default:
301 $cmd = $this->ctrl->getCmd("listTerms");
302
303 if (($cmd == "create") && ($_POST["new_type"] == "term")) {
304 $this->ctrl->setCmd("create");
305 $this->ctrl->setCmdClass("ilGlossaryTermGUI");
306 $ret = $this->executeCommand();
307 return;
308 } else {
309 if (!in_array($cmd, array("quickList"))) {
310 if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
311 $this->getCreationMode() == true) {
312 $this->prepareOutput();
313 $cmd .= "Object";
314 } else {
315 $this->getTemplate();
316 $this->setTabs();
317 $this->setLocator();
318 $this->addHeaderAction();
319
320 if ($cmd == "redrawHeaderAction") {
321 $cmd = "redrawHeaderActionObject";
322 }
323 }
324 }
325 $ret = $this->$cmd();
326 }
327 break;
328 }
329
330 if (!in_array($cmd, array("quickList"))) {
331 if (strtolower($_GET["baseClass"]) != "iladministrationgui") {
332 if (!$this->getCreationMode()) {
333 $this->tpl->show();
334 }
335 }
336 } else {
337 $this->tpl->show(false);
338 }
339 }
340
341 public function assignObject()
342 {
343 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
344
345 $this->object = new ilObjGlossary($this->id, true);
346 }
347
348 /*protected function initCreationForms($a_new_type)
349 {
350 $forms = array(
351 self::CFORM_NEW => $this->initCreateForm($a_new_type),
352 self::CFORM_IMPORT => $this->initImportForm($a_new_type)
353 );
354
355 return $forms;
356 }*/
357
358 public function initCreateForm($a_new_type)
359 {
360 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
361 $form = new ilPropertyFormGUI();
362 $form->setTarget("_top");
363 $form->setFormAction($this->ctrl->getFormAction($this));
364 $form->setTitle($this->lng->txt($a_new_type . "_new"));
365
366 // title
367 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
368 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
369 $ti->setMaxLength(ilObject::TITLE_LENGTH);
370 $ti->setRequired(true);
371 $form->addItem($ti);
372
373 // description
374 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
375 $ta->setCols(40);
376 $ta->setRows(2);
377 $form->addItem($ta);
378
379 // mode
380 $stati = array(
381 "none" => $this->lng->txt("glo_mode_normal"),
382 "level" => $this->lng->txt("glo_mode_level"),
383 "subtree" => $this->lng->txt("glo_mode_subtree")
384 );
385 $tm = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
386 $tm->setOptions($stati);
387 $tm->setInfo($this->lng->txt("glo_mode_desc"));
388 $tm->setRequired(true);
389 $form->addItem($tm);
390
391 $form->addCommandButton("save", $this->lng->txt($a_new_type . "_add"));
392 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
393
394 return $form;
395 }
396
397 public function importObject()
398 {
399 $this->createObject();
400 }
401
405 public function saveObject()
406 {
408
409 $new_type = $_REQUEST["new_type"];
410
411 // create permission is already checked in createObject. This check here is done to prevent hacking attempts
412 if (!$this->checkPermissionBool("create", "", $new_type)) {
413 $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->MESSAGE);
414 }
415
416 $this->lng->loadLanguageModule($new_type);
417 $this->ctrl->setParameter($this, "new_type", $new_type);
418
419 $form = $this->initCreateForm($new_type);
420 if ($form->checkInput()) {
421 $this->ctrl->setParameter($this, "new_type", "");
422
423 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
424 $newObj = new ilObjGlossary();
425 $newObj->setType($new_type);
426 $newObj->setTitle($form->getInput("title"));
427 $newObj->setDescription($form->getInput("desc"));
428 $newObj->setVirtualMode($form->getInput("glo_mode"));
429 $newObj->create();
430
431 $this->putObjectInTree($newObj);
432
433 // always send a message
434 ilUtil::sendSuccess($this->lng->txt("glo_added"), true);
435 ilUtil::redirect("ilias.php?baseClass=ilGlossaryEditorGUI&ref_id=" . $newObj->getRefId());
436 }
437
438 // display only this form to correct input
439 $form->setValuesByPost();
440 $this->tpl->setContent($form->getHtml());
441 }
442
449 public function showInfoScreen()
450 {
451 $this->getTemplate();
452 $this->setTabs();
453 $this->setLocator();
454 $this->lng->loadLanguageModule("meta");
455 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
456
457 $info = new ilInfoScreenGUI($this);
458 $info->enablePrivateNotes();
459 $info->enableNews();
460 if ($this->access->checkAccess("write", "", $_GET["ref_id"])) {
461 $info->enableNewsEditing();
462 $news_set = new ilSetting("news");
463 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
464 if ($enable_internal_rss) {
465 $info->setBlockProperty("news", "settings", true);
466 }
467 }
468 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
469
470 ilObjGlossaryGUI::addUsagesToInfo($info, $this->object->getId());
471
472 $this->ctrl->forwardCommand($info);
473 }
474
481 public static function addUsagesToInfo($info, $glo_id)
482 {
483 global $DIC;
484
485 $lng = $DIC->language();
486 $ilAccess = $DIC->access();
487
488 $info->addSection($lng->txt("glo_usages"));
489 include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php");
491 foreach ($sms as $sm) {
492 $link = false;
493 $refs = ilObject::_getAllReferences($sm);
494 foreach ($refs as $ref) {
495 if ($link === false) {
496 if ($ilAccess->checkAccess("write", "", $ref)) {
497 include_once("./Services/Link/classes/class.ilLink.php");
498 $link = ilLink::_getLink($ref, 'sahs');
499 }
500 }
501 }
502
503 $entry = ilObject::_lookupTitle($sm);
504 if ($link !== false) {
505 $entry = "<a href='" . $link . "' target='_top'>" . $entry . "</a>";
506 }
507
508 $info->addProperty($lng->txt("obj_sahs"), $entry);
509 }
510 }
511
512
513 public function viewObject()
514 {
516
517 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
518 parent::viewObject();
519 return;
520 }
521
522 if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
523 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
524 }
525 }
526
532 public function properties()
533 {
534 $this->checkPermission("write");
535
536 $this->setSettingsSubTabs("general_settings");
537
538 $this->initSettingsForm();
539
540 // Edit ecs export settings
541 include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
542 $ecs = new ilECSGlossarySettings($this->object);
543 $ecs->addSettingsToForm($this->form, 'glo');
544
545 $this->tpl->setContent($this->form->getHTML());
546 }
547
553 public function initSettingsForm($a_mode = "edit")
554 {
555 $obj_service = $this->getObjectService();
556
557 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
558 $this->form = new ilPropertyFormGUI();
559
560 // title
561 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
562 $title->setRequired(true);
563 $this->form->addItem($title);
564
565 // description
566 $desc = new ilTextAreaInputGUI($this->lng->txt("desc"), "description");
567 $this->form->addItem($desc);
568
569 $this->lng->loadLanguageModule("rep");
571 $section->setTitle($this->lng->txt('rep_activation_availability'));
572 $this->form->addItem($section);
573
574 // online
575 $online = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
576 $online->setValue("y");
577 $online->setInfo($this->lng->txt("glo_online_info"));
578 $this->form->addItem($online);
579
581 $section->setTitle($this->lng->txt('glo_content_settings'));
582 $this->form->addItem($section);
583
584 // glossary mode
585 $glo_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_mode"), "glo_mode");
586 //$glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
587 $op1 = new ilRadioOption($this->lng->txt("glo_mode_normal"), "none", $this->lng->txt("glo_mode_normal_info"));
588 $glo_mode->addOption($op1);
589 $op2 = new ilRadioOption($this->lng->txt("glo_mode_level"), "level", $this->lng->txt("glo_mode_level_info"));
590 $glo_mode->addOption($op2);
591 $op3 = new ilRadioOption($this->lng->txt("glo_mode_subtree"), "subtree", $this->lng->txt("glo_mode_subtree_info"));
592 $glo_mode->addOption($op3);
593 $this->form->addItem($glo_mode);
594
595 // glossary mode
596 /*$options = array(
597 "none"=>$this->lng->txt("glo_mode_normal"),
598 "level"=>$this->lng->txt("glo_mode_level"),
599 "subtree"=>$this->lng->txt("glo_mode_subtree")
600 );
601 $glo_mode = new ilSelectInputGUI($this->lng->txt("glo_mode"), "glo_mode");
602 $glo_mode->setOptions($options);
603 $glo_mode->setInfo($this->lng->txt("glo_mode_desc"));
604 $this->form->addItem($glo_mode);*/
605
606
608 $section->setTitle($this->lng->txt('cont_presentation'));
609 $this->form->addItem($section);
610
611 // tile image
612 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
613
614 // presentation mode
615 $pres_mode = new ilRadioGroupInputGUI($this->lng->txt("glo_presentation_mode"), "pres_mode");
616 $pres_mode->setValue("table");
617 $op1 = new ilRadioOption($this->lng->txt("glo_table_form"), "table", $this->lng->txt("glo_table_form_info"));
618
619 // short text length
620 $snl = new ilNumberInputGUI($this->lng->txt("glo_text_snippet_length"), "snippet_length");
621 $snl->setMaxValue(3000);
622 $snl->setMinValue(100);
623 $snl->setMaxLength(4);
624 $snl->setSize(4);
625 $snl->setInfo($this->lng->txt("glo_text_snippet_length_info"));
626 $snl->setValue(200);
627 $op1->addSubItem($snl);
628
629 $pres_mode->addOption($op1);
630 $op2 = new ilRadioOption($this->lng->txt("glo_full_definitions"), "full_def", $this->lng->txt("glo_full_definitions_info"));
631 $pres_mode->addOption($op2);
632 $this->form->addItem($pres_mode);
633
634 // show taxonomy
635 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
636 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
637 if (count($tax_ids) > 0) {
638 $show_tax = new ilCheckboxInputGUI($this->lng->txt("glo_show_taxonomy"), "show_tax");
639 $show_tax->setInfo($this->lng->txt("glo_show_taxonomy_info"));
640 $this->form->addItem($show_tax);
641 }
642
643 // downloads
644 $down = new ilCheckboxInputGUI($this->lng->txt("cont_downloads"), "glo_act_downloads");
645 $down->setValue("y");
646 $down->setInfo($this->lng->txt("cont_downloads_desc"));
647 $this->form->addItem($down);
648
649 if ($a_mode == "edit") {
650 $title->setValue($this->object->getTitle());
651 $desc->setValue($this->object->getDescription());
652 $online->setChecked($this->object->getOnline());
653 $glo_mode->setValue($this->object->getVirtualMode());
654 $pres_mode->setValue($this->object->getPresentationMode());
655 $snl->setValue($this->object->getSnippetLength());
656 if (count($tax_ids) > 0) {
657 $show_tax->setChecked($this->object->getShowTaxonomy());
658 }
659
660 $down->setChecked($this->object->isActiveDownloads());
661
662 // additional features
663 $feat = new ilFormSectionHeaderGUI();
664 $feat->setTitle($this->lng->txt('obj_features'));
665 $this->form->addItem($feat);
666
667 include_once './Services/Container/classes/class.ilContainer.php';
668 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
670 $this->object->getId(),
671 $this->form,
672 array(
674 )
675 );
676 }
677
678 // sort columns, if adv fields are given
679 include_once("./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php");
680 $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getRefId());
681 $cols = $adv_ap->getColumnOrder();
682 if (count($cols) > 1) {
683 include_once './Modules/Glossary/classes/class.ilGloAdvColSortInputGUI.php';
684 $ti = new ilGloAdvColSortInputGUI($this->lng->txt("cont_col_ordering"), "field_order");
685 $this->form->addItem($ti);
686 $ti->setValue($cols);
687 }
688
689 // save and cancel commands
690 $this->form->addCommandButton("saveProperties", $this->lng->txt("save"));
691
692 $this->form->setTitle($this->lng->txt("cont_glo_properties"));
693 $this->form->setFormAction($this->ctrl->getFormAction($this));
694 }
695
696
700 public function saveProperties()
701 {
702 $obj_service = $this->getObjectService();
703
704 $this->initSettingsForm();
705 if ($this->form->checkInput()) {
706 $this->object->setTitle($_POST['title']);
707 $this->object->setDescription($_POST['description']);
708 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
709 $this->object->setVirtualMode($_POST["glo_mode"]);
710 // $this->object->setActiveGlossaryMenu(ilUtil::yn2tf($_POST["glo_act_menu"]));
711 $this->object->setActiveDownloads(ilUtil::yn2tf($_POST["glo_act_downloads"]));
712 $this->object->setPresentationMode($_POST["pres_mode"]);
713 $this->object->setSnippetLength($_POST["snippet_length"]);
714 $this->object->setShowTaxonomy($_POST["show_tax"]);
715 $this->object->update();
716
717 // tile image
718 $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
719
720 // field order of advanced metadata
721 include_once("./Modules/Glossary/classes/class.ilGlossaryAdvMetaDataAdapter.php");
722 $adv_ap = new ilGlossaryAdvMetaDataAdapter($this->object->getRefId());
723 $cols = $adv_ap->getColumnOrder();
724 if (count($cols) > 1) {
725 $adv_ap->saveColumnOrder($_POST["field_order"]);
726 }
727
728 // set definition short texts dirty
729 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
730 ilGlossaryDefinition::setShortTextsDirty($this->object->getId());
731
732 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
734 $this->object->getId(),
735 $this->form,
736 array(
738 )
739 );
740
741 // Update ecs export settings
742 include_once 'Modules/Glossary/classes/class.ilECSGlossarySettings.php';
743 $ecs = new ilECSGlossarySettings($this->object);
744 if ($ecs->handleSettingsUpdate()) {
745 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
746 $this->ctrl->redirect($this, "properties");
747 }
748 }
749 $this->form->setValuesByPost();
750 $this->tpl->setContent($this->form->getHTML());
751 }
752
753
757 public function listTerms()
758 {
759 if ($_GET["show_tax"]) {
760 $this->showTaxonomy();
761 }
762
763 // term
764 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
765 $ti = new ilTextInputGUI($this->lng->txt("cont_new_term"), "new_term");
766 $ti->setMaxLength(80);
767 $ti->setSize(20);
768 $this->toolbar->addInputItem($ti, true);
769
770 // language
771 $this->lng->loadLanguageModule("meta");
773 if ($_SESSION["il_text_lang_" . $_GET["ref_id"]] != "") {
774 $s_lang = $_SESSION["il_text_lang_" . $_GET["ref_id"]];
775 } else {
776 $s_lang = $this->user->getLanguage();
777 }
778 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
779 $si = new ilSelectInputGUI($this->lng->txt("language"), "term_language");
780 $si->setOptions($lang);
781 $si->setValue($s_lang);
782 $this->toolbar->addInputItem($si, true);
783
784 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
785 $this->toolbar->addFormButton($this->lng->txt("glo_add_new_term"), "addTerm");
786
787 $this->toolbar->addSeparator();
788
789 //ilEditClipboard::getAction() == "copy"
790 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
791 if ($this->user->clipboardHasObjectsOfType("term")) {
792 $this->toolbar->addButton(
793 $this->lng->txt("paste"),
794 $this->ctrl->getLinkTarget($this, "pasteTerms")
795 );
796 $this->toolbar->addButton(
797 $this->lng->txt("clear_clipboard"),
798 $this->ctrl->getLinkTarget($this, "clearClipboard")
799 );
800 } else {
801 $this->toolbar->addButton(
802 $this->lng->txt("glo_add_from_other"),
803 $this->ctrl->getLinkTargetByClass("ilglossaryforeigntermcollectorgui", "")
804 );
805 }
806
807 if (is_object($this->tax)) {
808 $this->toolbar->addSeparator();
809 if ($_GET["show_tax"]) {
810 $this->toolbar->addButton(
811 $this->lng->txt("glo_hide_taxonomy"),
812 $this->ctrl->getLinkTarget($this, "deactTaxonomy")
813 );
814 } else {
815 $this->toolbar->addButton(
816 $this->lng->txt("glo_show_taxonomy"),
817 $this->ctrl->getLinkTarget($this, "actTaxonomy")
818 );
819 }
820 }
821
822 include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
823 $tab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
824 $this->tpl->setContent($tab->getHTML());
825 }
826
833 public function actTaxonomy()
834 {
835 $this->ctrl->setParameter($this, "show_tax", 1);
836 $this->ctrl->redirect($this, "listTerms");
837 }
838
845 public function deactTaxonomy()
846 {
847 $this->ctrl->setParameter($this, "show_tax", "");
848 $this->ctrl->redirect($this, "listTerms");
849 }
850
851
857 public function showActions($a_actions)
858 {
859 foreach ($a_actions as $name => $lng) {
860 $d[$name] = array("name" => $name, "lng" => $lng);
861 }
862
863 $notoperations = array();
864 $operations = array();
865
866 $operations = $d;
867
868 if (count($operations) > 0) {
869 foreach ($operations as $val) {
870 $this->tpl->setCurrentBlock("tbl_action_btn");
871 $this->tpl->setVariable("BTN_NAME", $val["name"]);
872 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt($val["lng"]));
873 $this->tpl->parseCurrentBlock();
874 }
875
876 $this->tpl->setCurrentBlock("tbl_action_row");
877 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
878 $this->tpl->parseCurrentBlock();
879 }
880 }
881
885 public function addTerm()
886 {
887 if (trim($_POST["new_term"]) == "") {
888 ilUtil::sendFailure($this->lng->txt("cont_please_enter_a_term"), true);
889 $this->ctrl->redirect($this, "listTerms");
890 }
891
892 // add term
893 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
894 $term = new ilGlossaryTerm();
895 $term->setGlossary($this->object);
896 $term->setTerm(ilUtil::stripSlashes($_POST["new_term"]));
897 $term->setLanguage($_POST["term_language"]);
898 $_SESSION["il_text_lang_" . $_GET["ref_id"]] = $_POST["term_language"];
899 $term->create();
900
901 // add first definition
903 $def->setTermId($term->getId());
904 $def->setTitle(ilUtil::stripSlashes($_POST["new_term"]));
905 $def->create();
906
907 $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
908 $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
909 $this->ctrl->redirectByClass(array("ilglossarytermgui",
910 "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
911 }
912
916 public function moveDefinitionUp()
917 {
918 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
919
920 $definition = new ilGlossaryDefinition($_GET["def"]);
921 $definition->moveUp();
922
923 $this->ctrl->redirect($this, "listTerms");
924 }
925
929 public function moveDefinitionDown()
930 {
931 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
932
933 $definition = new ilGlossaryDefinition($_GET["def"]);
934 $definition->moveDown();
935
936 $this->ctrl->redirect($this, "listTerms");
937 }
938
943 {
944 //$this->getTemplate();
945 //$this->displayLocator();
946 //$this->setTabs();
947
948 $term = new ilGlossaryTerm($this->term_id);
949
950 $add = "";
951 $nr = ilGlossaryTerm::getNumberOfUsages($this->term_id);
952 if ($nr > 0) {
953 $this->ctrl->setParameterByClass(
954 "ilglossarytermgui",
955 "term_id",
956 $this->term_id
957 );
958 $link = "[<a href='" .
959 $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
960 "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
961 $add = "<br/>" . sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link;
962 }
963
964 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
965 $cgui = new ilConfirmationGUI();
966 $cgui->setHeaderText($this->lng->txt("info_delete_sure") . $add);
967
968 $cgui->setFormAction($this->ctrl->getFormAction($this));
969 $cgui->setCancel($this->lng->txt("cancel"), "cancelDefinitionDeletion");
970 $cgui->setConfirm($this->lng->txt("confirm"), "deleteDefinition");
971
972 // content style
973 $this->setContentStyleSheet($this->tpl);
974
975 // syntax style
976 $this->tpl->setCurrentBlock("SyntaxStyle");
977 $this->tpl->setVariable(
978 "LOCATION_SYNTAX_STYLESHEET",
980 );
981 $this->tpl->parseCurrentBlock();
982
983 $definition = new ilGlossaryDefinition($_GET["def"]);
984 $page_gui = new ilGlossaryDefPageGUI($definition->getId());
985 $page_gui->setTemplateOutput(false);
986 $page_gui->setStyleId($this->object->getStyleSheetId());
987 $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
988 $page_gui->setFileDownloadLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
989 $page_gui->setFullscreenLink("ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $_GET["ref_id"]);
990 $output = $page_gui->preview();
991
992 $cgui->addItem("def", $_GET["def"], $term->getTerm() . $output);
993
994 $this->tpl->setContent($cgui->getHTML());
995 }
996
997 public function cancelDefinitionDeletion()
998 {
999 $this->ctrl->redirect($this, "listTerms");
1000 }
1001
1002
1003 public function deleteDefinition()
1004 {
1005 $definition = new ilGlossaryDefinition($_REQUEST["def"]);
1006 $definition->delete();
1007 $this->ctrl->redirect($this, "listTerms");
1008 }
1009
1013 public function editTerm()
1014 {
1015 // deprecated
1016 }
1017
1018
1022 public function updateTerm()
1023 {
1024 $term = new ilGlossaryTerm($this->term_id);
1025
1026 $term->setTerm(ilUtil::stripSlashes($_POST["term"]));
1027 $term->setLanguage($_POST["term_language"]);
1028 $term->update();
1029 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1030 $this->ctrl->redirect($this, "listTerms");
1031 }
1032
1033
1034
1038 public function export()
1039 {
1040 $this->checkPermission("write");
1041
1042 require_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1043 $glo_exp = new ilGlossaryExport($this->object);
1044 $glo_exp->buildExportFile();
1045 $this->ctrl->redirectByClass("ilexportgui", "");
1046 }
1047
1051 public function exportHTML()
1052 {
1053 require_once("./Modules/Glossary/classes/class.ilGlossaryExport.php");
1054 $glo_exp = new ilGlossaryExport($this->object, "html");
1055 $glo_exp->buildExportFile();
1056 //echo $this->tpl->get();
1057 $this->ctrl->redirectByClass("ilexportgui", "");
1058 }
1059
1063 public function publishExportFile()
1064 {
1066
1067 if (!isset($_POST["file"])) {
1068 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
1069 }
1070 if (count($_POST["file"]) > 1) {
1071 $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
1072 }
1073
1074 $file = explode(":", $_POST["file"][0]);
1075 $export_dir = $this->object->getExportDirectory($file[0]);
1076
1077 if ($this->object->getPublicExportFile($file[0]) ==
1078 $file[1]) {
1079 $this->object->setPublicExportFile($file[0], "");
1080 } else {
1081 $this->object->setPublicExportFile($file[0], $file[1]);
1082 }
1083 $this->object->update();
1084 $this->ctrl->redirectByClass("ilexportgui", "");
1085 }
1086
1087 /*
1088 * list all export files
1089 */
1090 public function viewExportLog()
1091 {
1092 }
1093
1097 public function confirmTermDeletion()
1098 {
1099 //$this->prepareOutput();
1100 if (!isset($_POST["id"])) {
1101 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1102 $this->ctrl->redirect($this, "listTerms");
1103 }
1104
1105 // check ids
1106 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1107 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
1108 foreach ($_POST["id"] as $term_id) {
1109 $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1110 if ($term_glo_id != $this->object->getId() && !ilGlossaryTermReferences::isReferenced($this->object->getId(), $term_id)) {
1111 ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1112 $this->ctrl->redirect($this, "listTerms");
1113 }
1114 }
1115
1116 // display confirmation message
1117 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1118 $cgui = new ilConfirmationGUI();
1119 $cgui->setFormAction($this->ctrl->getFormAction($this));
1120 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
1121 $cgui->setCancel($this->lng->txt("cancel"), "cancelTermDeletion");
1122 $cgui->setConfirm($this->lng->txt("confirm"), "deleteTerms");
1123
1124 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
1125
1126 foreach ($_POST["id"] as $id) {
1127 $term = new ilGlossaryTerm($id);
1128
1129 $add = "";
1131 if ($nr > 0) {
1132 $this->ctrl->setParameterByClass(
1133 "ilglossarytermgui",
1134 "term_id",
1135 $id
1136 );
1137
1138 if (ilGlossaryTermReferences::isReferenced($this->object->getId(), $id)) {
1139 $add = " (" . $this->lng->txt("glo_term_reference") . ")";
1140 } else {
1141 $link = "[<a href='" .
1142 $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "listUsages") .
1143 "'>" . $this->lng->txt("glo_list_usages") . "</a>]";
1144 $add = "<div class='small'>" .
1145 sprintf($this->lng->txt("glo_term_is_used_n_times"), $nr) . " " . $link . "</div>";
1146 }
1147 }
1148
1149 $cgui->addItem("id[]", $id, $term->getTerm() . $add);
1150 }
1151
1152 $this->tpl->setContent($cgui->getHTML());
1153 }
1154
1160 public function cancelTermDeletion()
1161 {
1162 $this->ctrl->redirect($this, "listTerms");
1163 }
1164
1168 public function deleteTerms()
1169 {
1170 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
1171 foreach ($_POST["id"] as $id) {
1172 if (ilGlossaryTermReferences::isReferenced($this->object->getId(), $id)) {
1173 $refs = new ilGlossaryTermReferences($this->object->getId());
1174 $refs->deleteTerm($id);
1175 $refs->update();
1176 } else {
1177 $term = new ilGlossaryTerm($id);
1178 $term->delete();
1179 }
1180 }
1181 $this->ctrl->redirect($this, "listTerms");
1182 }
1183
1191 public function setLocator($a_tree = "", $a_id = "")
1192 {
1193 if (strtolower($_GET["baseClass"]) != "ilglossaryeditorgui") {
1194 parent::setLocator($a_tree, $a_id);
1195 } else {
1196 if (is_object($this->object)) {
1197 require_once("./Modules/Glossary/classes/class.ilGlossaryLocatorGUI.php");
1198 $gloss_loc = new ilGlossaryLocatorGUI();
1199 if (is_object($this->term)) {
1200 $gloss_loc->setTerm($this->term);
1201 }
1202 $gloss_loc->setGlossary($this->object);
1203 //$gloss_loc->setDefinition($this->definition);
1204 $gloss_loc->display();
1205 }
1206 }
1207 }
1208
1212 public function view()
1213 {
1214 //$this->prepareOutput();
1215 $this->viewObject();
1216 }
1217
1221 public function create()
1222 {
1223 switch ($_POST["new_type"]) {
1224 case "term":
1225 $term_gui = new ilGlossaryTermGUI();
1226 $term_gui->create();
1227 break;
1228 }
1229 }
1230
1231 public function saveTerm()
1232 {
1233 $term_gui = new ilGlossaryTermGUI();
1234 $term_gui->setGlossary($this->object);
1235 $term_gui->save();
1236
1237 ilUtil::sendSuccess($this->lng->txt("cont_added_term"), true);
1238
1239 //ilUtil::redirect("glossary_edit.php?ref_id=".$_GET["ref_id"]."&cmd=listTerms");
1240 $this->ctrl->redirect($this, "listTerms");
1241 }
1242
1243
1247 public function addDefinition()
1248 {
1249 $term_id = (int) $_GET["term_id"];
1250
1251 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1252 $term_glo_id = ilGlossaryTerm::_lookGlossaryID((int) $term_id);
1253 if ($term_glo_id != $this->object->getId()) {
1254 ilUtil::sendFailure($this->lng->txt("glo_term_must_belong_to_glo"), true);
1255 $this->ctrl->redirect($this, "listTerms");
1256 }
1257
1258 // add term
1259 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
1261
1262 // add first definition
1263 $def = new ilGlossaryDefinition();
1264 $def->setTermId($term->getId());
1265 $def->setTitle(ilUtil::stripSlashes($term->getTerm()));
1266 $def->create();
1267
1268 $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term->getId());
1269 $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def->getId());
1270 $this->ctrl->redirectByClass(array("ilglossarytermgui",
1271 "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit");
1272 }
1273
1274 public function getTemplate()
1275 {
1276 $this->tpl->getStandardTemplate();
1277
1278 $title = $this->object->getTitle();
1279
1280
1281 if ($this->term_id > 0) {
1282 $this->tpl->setTitle($this->lng->txt("term") . ": " .
1283 ilGlossaryTerm::_lookGlossaryTerm($this->term_id));
1284 } else {
1285 parent::setTitleAndDescription();
1286 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_glo.svg"));
1287 $this->tpl->setTitle($this->lng->txt("glo") . ": " . $title);
1288 }
1289 }
1290
1294 public function setTabs()
1295 {
1296 $this->getTabs();
1297 }
1298
1302 public function getTabs()
1303 {
1304 $this->help->setScreenIdComponent("glo");
1305
1306 // list terms
1307 $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "listTerms")
1308 ? true
1309 : false;
1310 $this->tabs_gui->addTarget(
1311 "cont_terms",
1312 $this->ctrl->getLinkTarget($this, "listTerms"),
1313 array("listTerms", ""),
1314 get_class($this),
1315 "",
1316 $force_active
1317 );
1318
1319 $force_active = false;
1320 if ($this->ctrl->getCmd() == "showSummary" ||
1321 strtolower($this->ctrl->getNextClass()) == "ilinfoscreengui") {
1322 $force_active = true;
1323 }
1324 $this->tabs_gui->addTarget(
1325 "info_short",
1326 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
1327 "",
1328 "ilInfoScreenGUI",
1329 "",
1330 $force_active
1331 );
1332
1333 // properties
1334 if ($this->rbacsystem->checkAccess('write', $this->object->getRefId())) {
1335 $this->tabs_gui->addTarget(
1336 "settings",
1337 $this->ctrl->getLinkTarget($this, "properties"),
1338 "properties",
1339 get_class($this)
1340 );
1341
1342 // meta data
1343 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1344 $mdgui = new ilObjectMetaDataGUI($this->object, "term");
1345 $mdtab = $mdgui->getTab();
1346 if ($mdtab) {
1347 $this->tabs_gui->addTarget(
1348 "meta_data",
1349 $mdtab,
1350 "",
1351 "ilobjectmetadatagui"
1352 );
1353 }
1354
1355 // export
1356 /*$tabs_gui->addTarget("export",
1357 $this->ctrl->getLinkTarget($this, "exportList"),
1358 array("exportList", "viewExportLog"), get_class($this));*/
1359
1360 // export
1361 $this->tabs_gui->addTarget(
1362 "export",
1363 $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1364 "",
1365 "ilexportgui"
1366 );
1367 }
1368
1369 // permissions
1370 if ($this->rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
1371 /*$tabs_gui->addTarget("permission_settings",
1372 $this->ctrl->getLinkTarget($this, "perm"),
1373 array("perm", "info"),
1374 get_class($this));
1375 */
1376 $this->tabs_gui->addTarget(
1377 "perm_settings",
1378 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1379 array("perm","info","owner"),
1380 'ilpermissiongui'
1381 );
1382 }
1383
1384 $this->tabs_gui->addNonTabbedLink(
1385 "presentation_view",
1386 $this->lng->txt("glo_presentation_view"),
1387 "ilias.php?baseClass=ilGlossaryPresentationGUI&amp;ref_id=" . $this->object->getRefID(),
1388 "_top"
1389 );
1390 }
1391
1395 public function setSettingsSubTabs($a_active)
1396 {
1397 if (in_array(
1398 $a_active,
1399 array("general_settings", "style", "taxonomy", "glossaries")
1400 )) {
1401 // general properties
1402 $this->tabs->addSubTab(
1403 "general_settings",
1404 $this->lng->txt("settings"),
1405 $this->ctrl->getLinkTarget($this, 'properties')
1406 );
1407
1408 // style properties
1409 $this->tabs->addSubTab(
1410 "style",
1411 $this->lng->txt("obj_sty"),
1412 $this->ctrl->getLinkTarget($this, 'editStyleProperties')
1413 );
1414
1415 // taxonomy
1416 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1418 $this->tabs->addSubTab(
1419 "taxonomy",
1420 $this->lng->txt("tax_taxonomy"),
1421 $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", '')
1422 );
1423
1424 // style properties
1425 $this->tabs->addSubTab(
1426 "glossaries",
1427 $this->lng->txt("cont_auto_glossaries"),
1428 $this->ctrl->getLinkTarget($this, 'editGlossaries')
1429 );
1430
1431 $this->tabs->activateSubTab($a_active);
1432 }
1433 }
1434
1435
1441 public static function _goto($a_target)
1442 {
1443 global $DIC;
1444
1445 $lng = $DIC->language();
1446 $ilAccess = $DIC->access();
1447 $ilErr = $DIC["ilErr"];
1448
1449 if ($ilAccess->checkAccess("read", "", $a_target)) {
1450 $_GET["ref_id"] = $a_target;
1451 $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1452 include("ilias.php");
1453 exit;
1454 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1455 $_GET["ref_id"] = $a_target;
1456 $_GET["cmd"] = "infoScreen";
1457 $_GET["baseClass"] = "ilGlossaryPresentationGUI";
1458 include("ilias.php");
1459 exit;
1460 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1461 ilUtil::sendFailure(sprintf(
1462 $lng->txt("msg_no_perm_read_item"),
1464 ), true);
1466 }
1467
1468 $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1469 }
1470
1474 public function applyFilter()
1475 {
1476 include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
1477 $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1478 $prtab->resetOffset();
1479 $prtab->writeFilterToSession();
1480 $this->listTerms();
1481 }
1482
1487 public function resetFilter()
1488 {
1489 include_once("./Modules/Glossary/classes/class.ilTermListTableGUI.php");
1490 $prtab = new ilTermListTableGUI($this, "listTerms", $this->tax_node);
1491 $prtab->resetOffset();
1492 $prtab->resetFilter();
1493 $this->listTerms();
1494 }
1495
1496
1500
1504 public function setContentStyleSheet($a_tpl = null)
1505 {
1506 if ($a_tpl != null) {
1507 $ctpl = $a_tpl;
1508 } else {
1509 $ctpl = $this->tpl;
1510 }
1511
1512 $ctpl->setCurrentBlock("ContentStyle");
1513 $ctpl->setVariable(
1514 "LOCATION_CONTENT_STYLESHEET",
1515 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
1516 );
1517 $ctpl->parseCurrentBlock();
1518 }
1519
1520
1524 public function editStyleProperties()
1525 {
1526 $this->checkPermission("write");
1527
1528 $this->initStylePropertiesForm();
1529 $this->tpl->setContent($this->form->getHTML());
1530
1531 $this->tabs->activateTab("settings");
1532 $this->setSettingsSubTabs("style");
1533 }
1534
1538 public function initStylePropertiesForm()
1539 {
1540 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1541 $this->lng->loadLanguageModule("style");
1542
1543 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1544 $this->form = new ilPropertyFormGUI();
1545
1546 $fixed_style = $this->setting->get("fixed_content_style_id");
1547 $style_id = $this->object->getStyleSheetId();
1548
1549 if ($fixed_style > 0) {
1550 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
1551 $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
1552 $this->lng->txt("global_fixed") . ")");
1553 $this->form->addItem($st);
1554 } else {
1556 true,
1557 false,
1558 $_GET["ref_id"]
1559 );
1560
1561 $st_styles[0] = $this->lng->txt("default");
1562 ksort($st_styles);
1563
1564 if ($style_id > 0) {
1565 // individual style
1566 if (!ilObjStyleSheet::_lookupStandard($style_id)) {
1567 $st = new ilNonEditableValueGUI($this->lng->txt("style_current_style"));
1568 $st->setValue(ilObject::_lookupTitle($style_id));
1569 $this->form->addItem($st);
1570
1571 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1572
1573 // delete command
1574 $this->form->addCommandButton(
1575 "editStyle",
1576 $this->lng->txt("style_edit_style")
1577 );
1578 $this->form->addCommandButton(
1579 "deleteStyle",
1580 $this->lng->txt("style_delete_style")
1581 );
1582 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1583 }
1584 }
1585
1586 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
1587 $style_sel = ilUtil::formSelect(
1588 $style_id,
1589 "style_id",
1590 $st_styles,
1591 false,
1592 true
1593 );
1594 $style_sel = new ilSelectInputGUI($this->lng->txt("style_current_style"), "style_id");
1595 $style_sel->setOptions($st_styles);
1596 $style_sel->setValue($style_id);
1597 $this->form->addItem($style_sel);
1598 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1599 $this->form->addCommandButton(
1600 "saveStyleSettings",
1601 $this->lng->txt("save")
1602 );
1603 $this->form->addCommandButton(
1604 "createStyle",
1605 $this->lng->txt("sty_create_ind_style")
1606 );
1607 }
1608 }
1609 $this->form->setTitle($this->lng->txt("glo_style"));
1610 $this->form->setFormAction($this->ctrl->getFormAction($this));
1611 }
1612
1616 public function createStyle()
1617 {
1618 $this->ctrl->redirectByClass("ilobjstylesheetgui", "create");
1619 }
1620
1624 public function editStyle()
1625 {
1626 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
1627 }
1628
1632 public function deleteStyle()
1633 {
1634 $this->ctrl->redirectByClass("ilobjstylesheetgui", "delete");
1635 }
1636
1640 public function saveStyleSettings()
1641 {
1642 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1643 if ($this->setting->get("fixed_content_style_id") <= 0 &&
1644 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1645 || $this->object->getStyleSheetId() == 0)) {
1646 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1647 $this->object->update();
1648 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1649 }
1650 $this->ctrl->redirect($this, "editStyleProperties");
1651 }
1652
1656 public function getPublicAccessColValue($a_type, $a_file)
1657 {
1658 if ($this->object->getPublicExportFile($a_type) == $a_file) {
1659 return $this->lng->txt("yes");
1660 }
1661
1662 return " ";
1663 }
1664
1671 public function showTaxonomy()
1672 {
1673 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
1674 $tax_ids = ilObjTaxonomy::getUsageOfObject($this->object->getId());
1675 if (count($tax_ids) > 0) {
1676 include_once("./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
1677 $tax_exp = new ilTaxonomyExplorerGUI(
1678 $this,
1679 "showTaxonomy",
1680 $tax_ids[0],
1681 "ilobjglossarygui",
1682 "listTerms"
1683 );
1684 if (!$tax_exp->handleCommand()) {
1685 //$this->tpl->setLeftNavContent($tax_exp->getHTML());
1686 $this->tpl->setLeftNavContent($tax_exp->getHTML() . "&nbsp;");
1687 }
1688 }
1689 }
1690
1691 //
1692 // Auto glossaries
1693 //
1694
1701 public function editGlossaries()
1702 {
1703 $this->tabs->setTabActive("settings");
1704 $this->setSettingsSubTabs("glossaries");
1705
1706 $this->toolbar->addButton(
1707 $this->lng->txt("add"),
1708 $this->ctrl->getLinkTarget($this, "showGlossarySelector")
1709 );
1710
1711 include_once("./Modules/Glossary/classes/class.ilGlossaryAutoLinkTableGUI.php");
1712 $tab = new ilGlossaryAutoLinkTableGUI($this->object, $this, "editGlossaries");
1713
1714 $this->tpl->setContent($tab->getHTML());
1715 }
1716
1723 public function showGlossarySelector()
1724 {
1725 $this->tabs->setTabActive("settings");
1726 $this->setSettingsSubTabs("glossaries");
1727
1728 include_once 'Services/Search/classes/class.ilSearchRootSelector.php';
1729
1730 $exp = new ilSearchRootSelector($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1731 $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $this->tree->readRootId());
1732 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showGlossarySelector'));
1733 $exp->setTargetClass(get_class($this));
1734 $exp->setCmd('confirmGlossarySelection');
1735 $exp->setClickableTypes(array("glo"));
1736 $exp->addFilter("glo");
1737
1738 // build html-output
1739 $exp->setOutput(0);
1740 $this->tpl->setContent($exp->getOutput());
1741 }
1742
1747 {
1748 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1749 $cgui = new ilConfirmationGUI();
1750 $this->ctrl->setParameter($this, "glo_ref_id", $_GET["root_id"]);
1751 $cgui->setFormAction($this->ctrl->getFormAction($this));
1752 $cgui->setHeaderText($this->lng->txt("glo_link_glo_in_glo"));
1753 $cgui->setCancel($this->lng->txt("no"), "selectGlossary");
1754 $cgui->setConfirm($this->lng->txt("yes"), "selectGlossaryLink");
1755 $this->tpl->setContent($cgui->getHTML());
1756 }
1757
1764 public function selectGlossaryLink()
1765 {
1766 $glo_ref_id = (int) $_GET["glo_ref_id"];
1767 $glo_id = ilObject::_lookupObjId($glo_ref_id);
1768 $this->object->autoLinkGlossaryTerms($glo_ref_id);
1769 $this->selectGlossary();
1770 }
1771
1772
1779 public function selectGlossary()
1780 {
1781 $glos = $this->object->getAutoGlossaries();
1782 $glo_ref_id = (int) $_GET["glo_ref_id"];
1783 $glo_id = ilObject::_lookupObjId($glo_ref_id);
1784 if (!in_array($glo_id, $glos)) {
1785 $glos[] = $glo_id;
1786 }
1787 $this->object->setAutoGlossaries($glos);
1788 $this->object->update();
1789
1790 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1791 $this->ctrl->redirect($this, "editGlossaries");
1792 }
1793
1800 public function removeGlossary()
1801 {
1802 $this->object->removeAutoGlossary((int) $_GET["glo_id"]);
1803 $this->object->update();
1804
1805 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1806 $this->ctrl->redirect($this, "editGlossaries");
1807 }
1808
1815 public function copyTerms()
1816 {
1817 $items = ilUtil::stripSlashesArray($_POST["id"]);
1818 if (!is_array($items)) {
1819 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1820 $this->ctrl->redirect($this, "listTerms");
1821 }
1822
1823 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1824 $this->user->clipboardDeleteObjectsOfType("term");
1825
1826 // put them into the clipboard
1827 $time = date("Y-m-d H:i:s", time());
1828 $order = 0;
1829 foreach ($items as $id) {
1830 $this->user->addObjectToClipboard(
1831 $id,
1832 "term",
1834 0,
1835 $time,
1836 $order
1837 );
1838 }
1839
1841 ilUtil::sendInfo($this->lng->txt("glo_selected_terms_have_been_copied"), true);
1842 $this->ctrl->redirect($this, "listTerms");
1843 }
1844
1851 public function referenceTerms()
1852 {
1853 $items = ilUtil::stripSlashesArray($_POST["id"]);
1854 if (!is_array($items)) {
1855 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1856 $this->ctrl->redirect($this, "listTerms");
1857 }
1858
1859 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1860 $this->user->clipboardDeleteObjectsOfType("term");
1861
1862 // put them into the clipboard
1863 $time = date("Y-m-d H:i:s", time());
1864 $order = 0;
1865 foreach ($items as $id) {
1866 $this->user->addObjectToClipboard(
1867 $id,
1868 "term",
1870 0,
1871 $time,
1872 $order
1873 );
1874 }
1875
1877 ilUtil::sendInfo($this->lng->txt("glo_selected_terms_have_been_copied"), true);
1878 $this->ctrl->redirect($this, "listTerms");
1879 }
1880
1881
1888 public function clearClipboard()
1889 {
1890 $this->user->clipboardDeleteObjectsOfType("term");
1891 $this->ctrl->redirect($this, "listTerms");
1892 }
1893
1897 public function pasteTerms()
1898 {
1899 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
1900 if (ilEditClipboard::getAction() == "copy") {
1901 foreach ($this->user->getClipboardObjects("term") as $item) {
1902 ilGlossaryTerm::_copyTerm($item["id"], $this->object->getId());
1903 }
1904 }
1905 if (ilEditClipboard::getAction() == "link") {
1906 include_once("./Modules/Glossary/classes/class.ilGlossaryTermReferences.php");
1907 $refs = new ilGlossaryTermReferences($this->object->getId());
1908 foreach ($this->user->getClipboardObjects("term") as $item) {
1909 $refs->addTerm($item["id"]);
1910 }
1911 $refs->update();
1912 }
1913 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1914 $this->ctrl->redirect($this, "listTerms");
1915 }
1916}
user()
Definition: user.php:4
$section
Definition: Utf8Test.php:83
exit
Definition: backend.php:16
$_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.
Class ilGlossaryTerm.
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()
list childs of current object
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)
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.
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.
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.
$def
Definition: croninfo.php:21
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
if(!array_key_exists('StateId', $_REQUEST)) $id
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
$time
Definition: cron.php:21
$info
Definition: index.php:5
$ret
Definition: parser.php:6
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
$cols
Definition: xhr_table.php:11