ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCommonActionDispatcherGUI Class Reference

Class ilCommonActionDispatcherGUI. 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

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: shib_login.php:26

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 276 of file class.ilCommonActionDispatcherGUI.php.

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

◆ executeCommand()

ilCommonActionDispatcherGUI::executeCommand ( )

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

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

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 125 of file class.ilCommonActionDispatcherGUI.php.

126 {
127 global $DIC;
128
129 $ilAccess = $DIC->access();
130 $ilUser = $DIC->user();
131 $request_wrapper = $DIC->http()->wrapper()->query();
132 $refinery = $DIC->refinery();
133
134 if ($request_wrapper->has("cadh")) {
135 $parts = explode(";", $request_wrapper->retrieve("cadh", $refinery->kindlyTo()->string()));
136
137 $node_type = (int) $parts[0];
138 $node_id = (int) $parts[1];
139 $obj_type = (string) $parts[2];
140 $obj_id = (int) $parts[3];
141 $sub_type = (string) $parts[4];
142 $sub_id = (int) $parts[5];
143 $news_id = (int) $parts[6];
144
145 switch ($node_type) {
147 $access_handler = $ilAccess;
148 break;
149
151 $tree = new ilWorkspaceTree($ilUser->getId());
153 break;
154
155 default:
156 return null;
157 }
158
159 $dispatcher = new self($node_type, $access_handler, $obj_type, $node_id, $obj_id, $news_id);
160
161 if ($sub_type && $sub_id) {
162 $dispatcher->setSubObject($sub_type, $sub_id);
163 }
164
165 // poll comments have specific settings
166
167 if ($node_type == self::TYPE_REPOSITORY && $obj_type != "poll") {
168 $dispatcher->enableCommentsSettings(true);
169 }
170
171 return $dispatcher;
172 }
173 return null;
174 }
Class ilCommonActionDispatcherGUI.
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...
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61

References $DIC, $parts, ILIAS\UI\examples\Layout\Page\Standard\$refinery, ILIAS\UI\examples\Layout\Page\Standard\$request_wrapper, and ILIAS\Repository\int().

Referenced by ilObjBibliographicGUI\executeCommand(), ilObjBlogGUI\executeCommand(), ilObjCategoryGUI\executeCommand(), ilObjChatroomGUI\executeCommand(), ilObjCourseGUI\executeCommand(), ilDashboardBlockGUI\executeCommand(), ilObjDataCollectionGUI\executeCommand(), ilObjFolderGUI\executeCommand(), ilObjGlossaryGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilObjFileBasedLMGUI\executeCommand(), ilObjIndividualAssessmentGUI\executeCommand(), ilInfoScreenGUI\executeCommand(), ilObjItemGroupGUI\executeCommand(), ilLMPresentationGUI\executeCommand(), ilObjLearningSequenceGUI\executeCommand(), ilObjMediaCastGUI\executeCommand(), ilObjMediaPoolGUI\executeCommand(), ilPDNewsGUI\executeCommand(), ilObjOrgUnitGUI\executeCommand(), ilObjPollGUI\executeCommand(), ilObjPortfolioGUI\executeCommand(), ilObjPortfolioTemplateGUI\executeCommand(), ilObjectPluginGUI\executeCommand(), ilObjRootFolderGUI\executeCommand(), ilObjSAHSLearningModuleGUI\executeCommand(), ilObjSessionGUI\executeCommand(), ilObjStudyProgrammeGUI\executeCommand(), ilObjSurveyGUI\executeCommand(), ilObjSurveyQuestionPoolGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjLinkResourceGUI\executeCommand(), ilRemoteObjectBaseGUI\executeCommand(), ilObjWikiGUI\executeCommand(), ilWikiPageGUI\executeCommand(), and ilObjWorkspaceFolderGUI\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 292 of file class.ilCommonActionDispatcherGUI.php.

293 {
294 // check access for object
295 if (
296 $this->node_id &&
297 !$this->access_handler->checkAccess("visible", "", $this->node_id) &&
298 !$this->access_handler->checkAccess("read", "", $this->node_id)
299 ) {
300 return null;
301 }
302
304 $this->obj_type,
305 ($this->node_type == self::TYPE_REPOSITORY) ?
307 );
308
309 // remove all currently unwanted actions
310 $header_action->enableCopy(false);
311 $header_action->enableCut(false);
312 $header_action->enableDelete(false);
313 $header_action->enableLink(false);
314 $header_action->enableInfoScreen(false);
315 $header_action->enableTimings(false);
316 $header_action->enableSubscribe($this->node_type == self::TYPE_REPOSITORY);
317
318 $header_action->initItem($this->node_id, $this->obj_id, $this->obj_type);
319 $header_action->setHeaderSubObject($this->sub_type, $this->sub_id);
320 $header_action->setAjaxHash($this->getAjaxHash());
321
322 return $header_action;
323 }
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 {
114 $arr = explode(";", $hash);
115 if (isset($arr[4]) && isset($arr[5])) {
116 $arr[4] = "";
117 $arr[5] = "";
118 }
119 return implode(";", $arr);
120 }

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 284 of file class.ilCommonActionDispatcherGUI.php.

284 : void
285 {
286 $this->rating_callback = [$gui, $cmd];
287 }

◆ setSubObject()

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

Set sub object attributes.

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

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

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: