ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjWebResourceAdministrationGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
33 public function __construct(
34 $a_data,
35 int $a_id,
36 bool $a_call_by_reference = true,
37 bool $a_prepare_output = true
38 ) {
39 $this->type = "wbrs";
41 $a_data,
42 $a_id,
43 $a_call_by_reference,
44 $a_prepare_output
45 );
46 $this->lng->loadLanguageModule("webr");
47 }
48
49 public function executeCommand(): void
50 {
51 $next_class = $this->ctrl->getNextClass($this);
52 $cmd = $this->ctrl->getCmd();
53 $this->prepareOutput();
54
55 if (!$this->rbac_system->checkAccess(
56 "visible,read",
57 $this->object->getRefId()
58 )) {
59 $this->error->raiseError(
60 $this->lng->txt("no_permission"),
61 $this->error->WARNING
62 );
63 }
64
65 switch ($next_class) {
66 case 'ilpermissiongui':
67 $this->tabs_gui->setTabActive("perm_settings");
68 $perm_gui = new ilPermissionGUI($this);
69 $this->ctrl->forwardCommand($perm_gui);
70 break;
71
72 default:
73 if (!$cmd || $cmd == "view") {
74 $cmd = "editSettings";
75 }
76 $this->$cmd();
77 break;
78 }
79 }
80
81 public function getAdminTabs(): void
82 {
83 if ($this->rbac_system->checkAccess(
84 "visible,read",
85 $this->object->getRefId()
86 )) {
87 $this->tabs_gui->addTarget(
88 "settings",
89 $this->ctrl->getLinkTarget($this, "editSettings"),
90 array("editSettings", "view")
91 );
92 }
93
94 if ($this->rbac_system->checkAccess(
95 "edit_permission",
96 $this->object->getRefId()
97 )) {
98 $this->tabs_gui->addTarget(
99 "perm_settings",
100 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"),
101 array(),
102 "ilpermissiongui"
103 );
104 }
105 }
106
107 public function editSettings(?ilPropertyFormGUI $a_form = null): bool
108 {
109 $this->tabs_gui->setTabActive('settings');
110 if (!$a_form) {
111 $a_form = $this->initFormSettings();
112 }
113 $this->tpl->setContent($a_form->getHTML());
114 return true;
115 }
116
117 public function saveSettings(): void
118 {
119 $this->checkPermission("write");
120 $form = $this->initFormSettings();
121 if ($form->checkInput()) {
122 $this->settings->set(
123 "links_dynamic",
124 $form->getInput("links_dynamic")
125 );
126 $this->tpl->setOnScreenMessage(
127 'success',
128 $this->lng->txt("settings_saved"),
129 true
130 );
131 $this->ctrl->redirect($this, "editSettings");
132 }
133 $form->setValuesByPost();
134 $this->editSettings($form);
135 }
136
138 {
139 $form = new ilPropertyFormGUI();
140 $form->setFormAction($this->ctrl->getFormAction($this, "saveSettings"));
141 $form->setTitle($this->lng->txt("settings"));
142
143 // dynamic web links
144 $cb = new ilCheckboxInputGUI(
145 $this->lng->txt("links_dynamic"),
146 "links_dynamic"
147 );
148 $cb->setInfo($this->lng->txt("links_dynamic_info"));
149 $cb->setChecked((bool) $this->settings->get("links_dynamic"));
150 $form->addItem($cb);
151
152 if ($this->access->checkAccess(
153 "write",
154 '',
155 $this->object->getRefId()
156 )) {
157 $form->addCommandButton("saveSettings", $this->lng->txt("save"));
158 $form->addCommandButton("view", $this->lng->txt("cancel"));
159 }
160 return $form;
161 }
162}
error(string $a_errmsg)
This class represents a checkbox property in a property form.
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
ilObjWebResourceAdministrationGUI constructor.
getAdminTabs()
administration tabs show only permissions and trash folder
Class ilObjectGUI Basic methods of all Output classes.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
This class represents a property form user interface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc