ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilObjWikiSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 
29 {
31  protected ilTabsGUI $tabs;
32 
33  public function __construct(
34  int $a_id = 0,
35  int $a_id_type = self::REPOSITORY_NODE_ID,
36  int $a_parent_node_id = 0
37  ) {
38  parent::__construct($a_id, $a_id_type, $a_parent_node_id);
39  global $DIC;
40 
41  $this->error = $DIC["ilErr"];
42  $this->access = $DIC->access();
43  $this->lng = $DIC->language();
44  $this->ctrl = $DIC->ctrl();
45  $this->tabs = $DIC->tabs();
46  $this->toolbar = $DIC->toolbar();
47  $this->tpl = $DIC["tpl"];
48  }
49 
50  public function getType(): string
51  {
52  return "wiks";
53  }
54 
55  public function executeCommand(): void
56  {
58  $lng = $this->lng;
59 
60  $lng->loadLanguageModule("wiki");
61 
62  $next_class = $this->ctrl->getNextClass($this);
63  $cmd = $this->ctrl->getCmd();
64 
65  $this->prepareOutput();
66 
67  if (!$this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
68  $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
69  }
70 
71  switch ($next_class) {
72  case 'ilpermissiongui':
73  $this->tabs_gui->setTabActive('perm_settings');
74  $perm_gui = new ilPermissionGUI($this);
75  $this->ctrl->forwardCommand($perm_gui);
76  break;
77 
78  default:
79  if (!$cmd || $cmd === 'view') {
80  $cmd = "editSettings";
81  }
82  $this->$cmd();
83  break;
84  }
85  }
86 
87  protected function editSettings(ilPropertyFormGUI $form = null): void
88  {
89  $ilTabs = $this->tabs;
90  $tpl = $this->tpl;
91 
92  $ilTabs->activateTab("settings");
93 
94  if ($this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
95  if (!$form) {
96  $form = $this->initForm();
97  $this->populateWithCurrentSettings($form);
98  }
99  $tpl->setContent($form->getHTML());
100  }
101  }
102 
103  protected function populateWithCurrentSettings(ilPropertyFormGUI $form): void
104  {
105  $form->setValuesByArray([]);
106  }
107 
108  public function initForm(): ilPropertyFormGUI
109  {
110  $lng = $this->lng;
111  $ilCtrl = $this->ctrl;
112 
113  $form = new ilPropertyFormGUI();
114 
115 
116  if ($this->checkPermissionBool("write")) {
117  $form->addCommandButton("saveSettings", $lng->txt("save"));
118  }
119 
120  $form->setTitle($lng->txt("settings"));
121  $form->setFormAction($ilCtrl->getFormAction($this));
122 
123  return $form;
124  }
125 
126  protected function saveSettings(): void
127  {
128  $lng = $this->lng;
129  $ilCtrl = $this->ctrl;
130 
131  if (!$this->checkPermissionBool("write")) {
132  $this->editSettings();
133  return;
134  }
135 
136  $form = $this->initForm();
137  if (!$form->checkInput()) {
138  $form->setValuesByPost();
139  $this->editSettings($form);
140  return;
141  }
142 
143  $this->tpl->setOnScreenMessage('success', $lng->txt('msg_obj_modified'), true);
144  $ilCtrl->redirect($this, 'editSettings');
145  }
146 
147  public function getAdminTabs(): void
148  {
149  if ($this->checkPermissionBool("visible,read")) {
150  $this->tabs_gui->addTab(
151  "settings",
152  $this->lng->txt("settings"),
153  $this->ctrl->getLinkTarget($this, "editSettings")
154  );
155  }
156 
157  if ($this->checkPermissionBool("edit_permission")) {
158  $this->tabs_gui->addTab(
159  "perm_settings",
160  $this->lng->txt("perm_settings"),
161  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
162  );
163  }
164  }
165 
166  public function addToExternalSettingsForm(int $a_form_id): ?array
167  {
168  return null;
169  }
170 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
New implementation of ilObjectGUI.
prepareOutput(bool $show_sub_objects=true)
loadLanguageModule(string $a_module)
Load language module.
$ilErr
Definition: raiseError.php:17
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
global $DIC
Definition: feed.php:28
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
setContent(string $a_html)
Sets content for standard template.
editSettings(ilPropertyFormGUI $form=null)
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
Error Handling & global info handling uses PEAR error class.
__construct(Container $dic, ilPlugin $plugin)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
populateWithCurrentSettings(ilPropertyFormGUI $form)