ILIAS  release_8 Revision v8.24
ilCommonActionDispatcherGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilCommonActionDispatcherGUI:

Public Member Functions

 __construct (int $node_type, $access_handler, string $obj_type, int $node_id, int $obj_id, int $news_id=0)
 
 getAjaxHash ()
 Build ajax hash for current (object/node) properties. More...
 
 executeCommand ()
 
 setSubObject (?string $sub_obj_type, ?int $sub_obj_id)
 Set sub object attributes. More...
 
 enableCommentsSettings (bool $value)
 Toggle comments settings. More...
 
 setRatingCallback (object $gui, string $cmd)
 Add callback for rating gui. More...
 
 initHeaderAction ()
 Set header action menu. More...
 

Static Public Member Functions

static buildAjaxHash (int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
 Build ajax hash. More...
 
static removeSubObjFromAjaxHash (string $hash)
 
static getInstanceFromAjaxCall ()
 (Re-)Build instance from ajax call More...
 

Data Fields

const TYPE_REPOSITORY = 1
 
const TYPE_WORKSPACE = 2
 

Protected Attributes

ilCtrl $ctrl
 
ilSetting $settings
 
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
 
ILIAS Refinery Factory $refinery
 
int $node_type = 0
 
 $access_handler
 
string $obj_type = ""
 
int $node_id = 0
 
int $obj_id = 0
 
int $news_id = 0
 
string $sub_type = null
 
int $sub_id = null
 
bool $enable_comments_settings = false
 
array $rating_callback = []
 

Private Attributes

ilObjectRequestRetriever $retriever
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilCommonActionDispatcherGUI

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om @ilCtrl_Calls ilCommonActionDispatcherGUI: ilNoteGUI, ilTaggingGUI, ilObjectActivationGUI @ilCtrl_Calls ilCommonActionDispatcherGUI: ilRatingGUI, ilObjRootFolderGUI

Definition at line 28 of file class.ilCommonActionDispatcherGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCommonActionDispatcherGUI::__construct ( int  $node_type,
  $access_handler,
string  $obj_type,
int  $node_id,
int  $obj_id,
int  $news_id = 0 
)

Definition at line 54 of file class.ilCommonActionDispatcherGUI.php.

61 {
62 global $DIC;
63
64 $this->ctrl = $DIC->ctrl();
65 $this->settings = $DIC->settings();
66 $this->request_wrapper = $DIC->http()->wrapper()->query();
67 $this->refinery = $DIC->refinery();
68 $this->retriever = new ilObjectRequestRetriever($DIC->http()->wrapper(), $this->refinery);
69
70 $this->node_type = $node_type;
71 $this->access_handler = $access_handler;
72 $this->obj_type = $obj_type;
73 $this->node_id = $node_id;
74 $this->obj_id = $obj_id;
75 $this->news_id = $news_id;
76 }
Base class for all sub item list gui's.
global $DIC
Definition: feed.php:28

References $access_handler, $DIC, $news_id, $node_id, $node_type, $obj_id, $obj_type, ILIAS\Repository\ctrl(), ILIAS\Repository\refinery(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildAjaxHash()

static ilCommonActionDispatcherGUI::buildAjaxHash ( int  $node_type,
?int  $node_id,
string  $obj_type,
int  $obj_id,
string  $sub_type = null,
int  $sub_id = null,
int  $news_id = 0 
)
static

◆ enableCommentsSettings()

ilCommonActionDispatcherGUI::enableCommentsSettings ( bool  $value)

Toggle comments settings.

Definition at line 275 of file class.ilCommonActionDispatcherGUI.php.

275 : void
276 {
277 $this->enable_comments_settings = $value;
278 }

◆ executeCommand()

ilCommonActionDispatcherGUI::executeCommand ( )

Definition at line 175 of file class.ilCommonActionDispatcherGUI.php.

175 : void
176 {
177 // check access for object
178 if (
179 $this->node_id &&
180 !$this->access_handler->checkAccess("visible", "", $this->node_id) &&
181 !$this->access_handler->checkAccess("read", "", $this->node_id)
182 ) {
183 exit();
184 }
185
186 $next_class = $this->ctrl->getNextClass($this);
187
188 $this->ctrl->saveParameter($this, "cadh");
189
190 switch ($next_class) {
191 case "ilnotegui":
192
194 if ($this->sub_type) {
196 }
197
198 $note_gui = new ilNoteGUI($this->obj_id, (int) $this->sub_id, $obj_type, false, $this->news_id);
199 $note_gui->enablePrivateNotes();
200
201 $has_write = $this->access_handler->checkAccess("write", "", $this->node_id);
202 if ($has_write && $this->settings->get("comments_del_tutor", "1")) {
203 $note_gui->enablePublicNotesDeletion();
204 }
205
206 // comments cannot be turned off globally
207 if ($this->enable_comments_settings) {
208 // should only be shown if active or permission to toggle
209 if (
210 $has_write ||
211 $this->access_handler->checkAccess("edit_permissions", "", $this->node_id)
212 ) {
213 $note_gui->enableCommentsSettings();
214 }
215 }
216 /* this is different to the info screen but we need this
217 for sub-object action menus, e.g. wiki page */
218 elseif ($this->sub_id) {
219 $note_gui->enablePublicNotes();
220 }
221
222 $this->ctrl->forwardCommand($note_gui);
223 break;
224
225 case "iltagginggui":
226 $tags_gui = new ilTaggingGUI();
227 $tags_gui->setObject($this->obj_id, $this->obj_type);
228 $this->ctrl->forwardCommand($tags_gui);
229 break;
230
231 case "ilobjectactivationgui":
232 $parent_id = $this->retriever->getMaybeInt('parent_id') ?? 0;
233 $this->ctrl->setParameter($this, "parent_id", $parent_id);
234 $act_gui = new ilObjectActivationGUI($parent_id, $this->node_id);
235 $this->ctrl->forwardCommand($act_gui);
236 break;
237
238 case "ilratinggui":
239 $rating_gui = new ilRatingGUI();
240 if (
241 $this->request_wrapper->has("rnsb")
242 ) {
243 $rating_gui->setObject($this->obj_id, $this->obj_type, $this->sub_id, $this->sub_type);
244 } else {
245 // coming from headaction ignore sub-objects
246 $rating_gui->setObject($this->obj_id, $this->obj_type);
247 }
248 $this->ctrl->forwardCommand($rating_gui);
249 if ($this->rating_callback) {
250 // as rating in categories is form-based we need to redirect
251 // somewhere after saving
252 $this->ctrl->redirect($this->rating_callback[0], $this->rating_callback[1]);
253 }
254 break;
255
256 default:
257 break;
258 }
259
260 exit();
261 }
Notes GUI class.
Class ilObjectActivationGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilTaggingGUI.
exit
Definition: login.php:28

References ILIAS\Repository\ctrl(), exit, and ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ getAjaxHash()

ilCommonActionDispatcherGUI::getAjaxHash ( )

Build ajax hash for current (object/node) properties.

Definition at line 81 of file class.ilCommonActionDispatcherGUI.php.

81 : string
82 {
84 $this->node_type,
85 $this->node_id,
86 $this->obj_type,
87 $this->obj_id,
88 $this->sub_type,
89 $this->sub_id,
90 $this->news_id
91 );
92 }
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.

References buildAjaxHash().

+ Here is the call graph for this function:

◆ getInstanceFromAjaxCall()

static ilCommonActionDispatcherGUI::getInstanceFromAjaxCall ( )
static

(Re-)Build instance from ajax call

Definition at line 124 of file class.ilCommonActionDispatcherGUI.php.

125 {
126 global $DIC;
127
128 $ilAccess = $DIC->access();
129 $ilUser = $DIC->user();
130 $request_wrapper = $DIC->http()->wrapper()->query();
131 $refinery = $DIC->refinery();
132
133 if ($request_wrapper->has("cadh")) {
134 $parts = explode(";", $request_wrapper->retrieve("cadh", $refinery->kindlyTo()->string()));
135
136 $node_type = (int) $parts[0];
137 $node_id = (int) $parts[1];
138 $obj_type = (string) $parts[2];
139 $obj_id = (int) $parts[3];
140 $sub_type = (string) $parts[4];
141 $sub_id = (int) $parts[5];
142 $news_id = (int) $parts[6];
143
144 switch ($node_type) {
146 $access_handler = $ilAccess;
147 break;
148
150 $tree = new ilWorkspaceTree($ilUser->getId());
152 break;
153
154 default:
155 return null;
156 }
157
158 $dispatcher = new self($node_type, $access_handler, $obj_type, $node_id, $obj_id, $news_id);
159
160 if ($sub_type && $sub_id) {
161 $dispatcher->setSubObject($sub_type, $sub_id);
162 }
163
164 // poll comments have specific settings
165
166 if ($node_type == self::TYPE_REPOSITORY && $obj_type != "poll") {
167 $dispatcher->enableCommentsSettings(true);
168 }
169
170 return $dispatcher;
171 }
172 return null;
173 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilUser
Definition: imgupload.php:34
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64

References $DIC, $ilUser, $parts, ILIAS\Repository\$refinery, ILIAS\UI\examples\Tree\Expandable\$request_wrapper, and ILIAS\Repository\int().

Referenced by ilObjBibliographicGUI\executeCommand(), ilObjBlogGUI\executeCommand(), ilObjCategoryGUI\executeCommand(), ilObjChatroomGUI\executeCommand(), ilObjCourseGUI\executeCommand(), ilObjDataCollectionGUI\executeCommand(), ilObjFolderGUI\executeCommand(), ilObjGlossaryGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilObjFileBasedLMGUI\executeCommand(), ilObjIndividualAssessmentGUI\executeCommand(), ilObjItemGroupGUI\executeCommand(), ilLMPresentationGUI\executeCommand(), ilObjLearningSequenceGUI\executeCommand(), ilObjMediaCastGUI\executeCommand(), ilObjMediaPoolGUI\executeCommand(), ilObjOrgUnitGUI\executeCommand(), ilObjPollGUI\executeCommand(), ilObjPortfolioGUI\executeCommand(), ilObjPortfolioTemplateGUI\executeCommand(), ilObjRootFolderGUI\executeCommand(), ilObjSAHSLearningModuleGUI\executeCommand(), ilObjSessionGUI\executeCommand(), ilObjStudyProgrammeGUI\executeCommand(), ilObjSurveyGUI\executeCommand(), ilObjSurveyQuestionPoolGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjLinkResourceGUI\executeCommand(), ilObjWikiGUI\executeCommand(), ilWikiPageGUI\executeCommand(), ilObjWorkspaceFolderGUI\executeCommand(), ilPDSelectedItemsBlockGUI\executeCommand(), ilInfoScreenGUI\executeCommand(), ilObjectPluginGUI\executeCommand(), and ilRemoteObjectBaseGUI\executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initHeaderAction()

ilCommonActionDispatcherGUI::initHeaderAction ( )

Set header action menu.

Definition at line 291 of file class.ilCommonActionDispatcherGUI.php.

292 {
293 // check access for object
294 if (
295 $this->node_id &&
296 !$this->access_handler->checkAccess("visible", "", $this->node_id) &&
297 !$this->access_handler->checkAccess("read", "", $this->node_id)
298 ) {
299 return null;
300 }
301
303 $this->obj_type,
304 ($this->node_type == self::TYPE_REPOSITORY) ?
306 );
307
308 // remove all currently unwanted actions
309 $header_action->enableCopy(false);
310 $header_action->enableCut(false);
311 $header_action->enableDelete(false);
312 $header_action->enableLink(false);
313 $header_action->enableInfoScreen(false);
314 $header_action->enableTimings(false);
315 $header_action->enableSubscribe($this->node_type == self::TYPE_REPOSITORY);
316
317 $header_action->initItem($this->node_id, $this->obj_id, $this->obj_type);
318 $header_action->setHeaderSubObject($this->sub_type, $this->sub_id);
319 $header_action->setAjaxHash($this->getAjaxHash());
320
321 return $header_action;
322 }
getAjaxHash()
Build ajax hash for current (object/node) properties.
static _getListGUIByType(string $type, int $context=ilObjectListGUI::CONTEXT_REPOSITORY)

References ilObjectListGUIFactory\_getListGUIByType(), ilObjectListGUI\CONTEXT_REPOSITORY, and ilObjectListGUI\CONTEXT_WORKSPACE.

+ Here is the call graph for this function:

◆ removeSubObjFromAjaxHash()

static ilCommonActionDispatcherGUI::removeSubObjFromAjaxHash ( string  $hash)
static

Definition at line 112 of file class.ilCommonActionDispatcherGUI.php.

112 : string {
113 $arr = explode(";", $hash);
114 if (isset($arr[4]) && isset($arr[5])) {
115 $arr[4] = "";
116 $arr[5] = "";
117 }
118 return implode(";", $arr);
119 }

Referenced by ilObjectListGUI\getHeaderAction().

+ Here is the caller graph for this function:

◆ setRatingCallback()

ilCommonActionDispatcherGUI::setRatingCallback ( object  $gui,
string  $cmd 
)

Add callback for rating gui.

Definition at line 283 of file class.ilCommonActionDispatcherGUI.php.

283 : void
284 {
285 $this->rating_callback = array($gui, $cmd);
286 }

◆ setSubObject()

ilCommonActionDispatcherGUI::setSubObject ( ?string  $sub_obj_type,
?int  $sub_obj_id 
)

Set sub object attributes.

Definition at line 266 of file class.ilCommonActionDispatcherGUI.php.

266 : void
267 {
268 $this->sub_type = $sub_obj_type;
269 $this->sub_id = $sub_obj_id;
270 }

Field Documentation

◆ $access_handler

ilCommonActionDispatcherGUI::$access_handler
protected

Definition at line 42 of file class.ilCommonActionDispatcherGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilCommonActionDispatcherGUI::$ctrl
protected

Definition at line 33 of file class.ilCommonActionDispatcherGUI.php.

◆ $enable_comments_settings

bool ilCommonActionDispatcherGUI::$enable_comments_settings = false
protected

Definition at line 50 of file class.ilCommonActionDispatcherGUI.php.

◆ $news_id

int ilCommonActionDispatcherGUI::$news_id = 0
protected

Definition at line 46 of file class.ilCommonActionDispatcherGUI.php.

Referenced by __construct().

◆ $node_id

int ilCommonActionDispatcherGUI::$node_id = 0
protected

Definition at line 44 of file class.ilCommonActionDispatcherGUI.php.

Referenced by __construct().

◆ $node_type

int ilCommonActionDispatcherGUI::$node_type = 0
protected

Definition at line 38 of file class.ilCommonActionDispatcherGUI.php.

Referenced by __construct().

◆ $obj_id

int ilCommonActionDispatcherGUI::$obj_id = 0
protected

Definition at line 45 of file class.ilCommonActionDispatcherGUI.php.

Referenced by __construct().

◆ $obj_type

string ilCommonActionDispatcherGUI::$obj_type = ""
protected

Definition at line 43 of file class.ilCommonActionDispatcherGUI.php.

Referenced by __construct().

◆ $rating_callback

array ilCommonActionDispatcherGUI::$rating_callback = []
protected

Definition at line 51 of file class.ilCommonActionDispatcherGUI.php.

◆ $refinery

ILIAS Refinery Factory ilCommonActionDispatcherGUI::$refinery
protected

Definition at line 36 of file class.ilCommonActionDispatcherGUI.php.

◆ $request_wrapper

ILIAS HTTP Wrapper RequestWrapper ilCommonActionDispatcherGUI::$request_wrapper
protected

Definition at line 35 of file class.ilCommonActionDispatcherGUI.php.

◆ $retriever

ilObjectRequestRetriever ilCommonActionDispatcherGUI::$retriever
private

Definition at line 52 of file class.ilCommonActionDispatcherGUI.php.

◆ $settings

ilSetting ilCommonActionDispatcherGUI::$settings
protected

Definition at line 34 of file class.ilCommonActionDispatcherGUI.php.

◆ $sub_id

int ilCommonActionDispatcherGUI::$sub_id = null
protected

Definition at line 49 of file class.ilCommonActionDispatcherGUI.php.

◆ $sub_type

string ilCommonActionDispatcherGUI::$sub_type = null
protected

Definition at line 48 of file class.ilCommonActionDispatcherGUI.php.

◆ TYPE_REPOSITORY

◆ TYPE_WORKSPACE

const ilCommonActionDispatcherGUI::TYPE_WORKSPACE = 2

Definition at line 31 of file class.ilCommonActionDispatcherGUI.php.

Referenced by ilObject2GUI\initHeaderAction().


The documentation for this class was generated from the following file: