ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCommonActionDispatcherGUI Class Reference

Class ilCommonActionDispatcherGUI. More...

+ Collaboration diagram for ilCommonActionDispatcherGUI:

Public Member Functions

 __construct ($a_node_type, $a_access_handler, $a_obj_type, $a_node_id, $a_obj_id)
 Constructor. More...
 
 getAjaxHash ()
 Build ajax hash for current (object/node) properties. More...
 
 executeCommand ()
 
 setSubObject ($a_sub_obj_type, $a_sub_obj_id)
 Set sub object attributes. More...
 
 enableCommentsSettings ($a_value)
 Toggle comments settings. More...
 
 setRatingCallback ($a_gui, $a_cmd)
 Add callback for rating gui. More...
 
 initHeaderAction ()
 Set header action menu. More...
 

Static Public Member Functions

static buildAjaxHash ($a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null)
 Build ajax hash. More...
 
static getInstanceFromAjaxCall ()
 (Re-)Build instance from ajax call More...
 

Data Fields

const TYPE_REPOSITORY = 1
 
const TYPE_WORKSPACE = 2
 

Protected Attributes

 $ctrl
 
 $settings
 
 $obj_type
 
 $node_id
 
 $node_type
 
 $obj_id
 
 $sub_type
 
 $sub_id
 
 $enable_comments_settings
 
 $rating_callback
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCommonActionDispatcherGUI::__construct (   $a_node_type,
  $a_access_handler,
  $a_obj_type,
  $a_node_id,
  $a_obj_id 
)

Constructor.

Parameters
int$a_node_type
object$a_access_handler
string$a_obj_type
int$a_node_id
int$a_obj_id
Returns
object

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

50 {
51 global $DIC;
52
53 $this->ctrl = $DIC->ctrl();
54 $this->settings = $DIC->settings();
55 $this->node_type = (int) $a_node_type;
56 $this->access_handler = $a_access_handler;
57 $this->obj_type = (string) $a_obj_type;
58 $this->node_id = (int) $a_node_id;
59 $this->obj_id = (int) $a_obj_id;
60 }
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $DIC, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildAjaxHash()

static ilCommonActionDispatcherGUI::buildAjaxHash (   $a_node_type,
  $a_node_id,
  $a_obj_type,
  $a_obj_id,
  $a_sub_type = null,
  $a_sub_id = null 
)
static

Build ajax hash.

Parameters
int$a_node_type
int$a_node_id
string$a_obj_type
int$a_obj_id
type$a_sub_type
type$a_sub_id
Returns
string

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

91 {
92 return $a_node_type . ";" . $a_node_id . ";" . $a_obj_type . ";" .
93 $a_obj_id . ";" . $a_sub_type . ";" . $a_sub_id;
94 }

Referenced by ilPollBlockGUI\commentJSCall(), getAjaxHash(), ilDclRecordListTableGUI\getCommentsAjaxLink(), ilObjectListGUI\getListItemHTML(), and ilDclBaseRecordModel\getStandardFieldHTML().

+ Here is the caller graph for this function:

◆ enableCommentsSettings()

ilCommonActionDispatcherGUI::enableCommentsSettings (   $a_value)

Toggle comments settings.

Parameters
bool$a_value

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

257 {
258 $this->enable_comments_settings = (bool) $a_value;
259 }

◆ executeCommand()

ilCommonActionDispatcherGUI::executeCommand ( )

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

151 {
154
155 // check access for object
156 if ($this->node_id &&
157 !$this->access_handler->checkAccess("visible", "", $this->node_id) &&
158 !$this->access_handler->checkAccess("read", "", $this->node_id)) {
159 exit();
160 }
161
162 $next_class = $ilCtrl->getNextClass($this);
163 $cmd = $ilCtrl->getCmd();
164
165 $ilCtrl->saveParameter($this, "cadh");
166
167 switch ($next_class) {
168 case "ilnotegui":
169
171 if ($this->sub_type) {
173 }
174
175 include_once "Services/Notes/classes/class.ilNoteGUI.php";
176 $note_gui = new ilNoteGUI($this->obj_id, $this->sub_id, $obj_type);
177 $note_gui->enablePrivateNotes(true);
178
179 $has_write = $this->access_handler->checkAccess("write", "", $this->node_id);
180 if ($has_write && $ilSetting->get("comments_del_tutor", 1)) {
181 $note_gui->enablePublicNotesDeletion(true);
182 }
183
184 // comments cannot be turned off globally
185 if ($this->enable_comments_settings) {
186 // should only be shown if active or permission to toggle
187 if ($has_write ||
188 $this->access_handler->checkAccess("edit_permissions", "", $this->node_id)) {
189 $note_gui->enableCommentsSettings();
190 }
191 }
192 /* this is different to the info screen but we need this
193 for sub-object action menus, e.g. wiki page */
194 elseif ($this->sub_id) {
195 $note_gui->enablePublicNotes(true);
196 }
197
198 $ilCtrl->forwardCommand($note_gui);
199 break;
200
201 case "iltagginggui":
202 include_once "Services/Tagging/classes/class.ilTaggingGUI.php";
203 $tags_gui = new ilTaggingGUI($this->node_id);
204 $tags_gui->setObject($this->obj_id, $this->obj_type);
205 $ilCtrl->forwardCommand($tags_gui);
206 break;
207
208 case "ilobjectactivationgui":
209 $ilCtrl->setParameter($this, "parent_id", (int) $_REQUEST['parent_id']);
210 include_once 'Services/Object/classes/class.ilObjectActivationGUI.php';
211 $act_gui = new ilObjectActivationGUI((int) $_REQUEST['parent_id'], $this->node_id);
212 $ilCtrl->forwardCommand($act_gui);
213 break;
214
215 case "ilratinggui":
216 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
217 $rating_gui = new ilRatingGUI();
218 if (!$_GET["rnsb"]) {
219 $rating_gui->setObject($this->obj_id, $this->obj_type, $this->sub_id, $this->sub_type);
220 } else {
221 // coming from headaction ignore sub-objects
222 $rating_gui->setObject($this->obj_id, $this->obj_type);
223 }
224 $ilCtrl->forwardCommand($rating_gui);
225 if ($this->rating_callback) {
226 // as rating in categories is form-based we need to redirect
227 // somewhere after saving
228 $ilCtrl->redirect($this->rating_callback[0], $this->rating_callback[1]);
229 }
230 break;
231
232 default:
233 break;
234 }
235
236 exit();
237 }
$_GET["client_id"]
Notes GUI class.
Class ilObjectActivationGUI.
Class ilRatingGUI.
Class ilTaggingGUI.
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17

References $_GET, $ctrl, $ilCtrl, $ilSetting, $obj_type, $settings, $sub_type, and exit.

◆ getAjaxHash()

ilCommonActionDispatcherGUI::getAjaxHash ( )

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

Returns
string

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

68 {
70 $this->node_type,
71 $this->node_id,
72 $this->obj_type,
73 $this->obj_id,
74 $this->sub_type,
75 $this->sub_id
76 );
77 }
static buildAjaxHash($a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null)
Build ajax hash.

References buildAjaxHash().

Referenced by initHeaderAction().

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

◆ getInstanceFromAjaxCall()

static ilCommonActionDispatcherGUI::getInstanceFromAjaxCall ( )
static

(Re-)Build instance from ajax call

Returns
object

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

102 {
103 global $DIC;
104
105 $ilAccess = $DIC->access();
106 $ilUser = $DIC->user();
107
108 if (isset($_GET["cadh"])) {
109 $parts = explode(";", (string) $_GET["cadh"]);
110
111 $node_type = $parts[0];
112 $node_id = $parts[1];
113 $obj_type = $parts[2];
114 $obj_id = $parts[3];
115 $sub_type = $parts[4];
116 $sub_id = $parts[5];
117
118 switch ($node_type) {
120 $access_handler = $ilAccess;
121 break;
122
124 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
125 $tree = new ilWorkspaceTree($ilUser->getId());
126 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
127 $access_handler = new ilWorkspaceAccessHandler($tree);
128 break;
129
130 default:
131 return null;
132 }
133
134 $dispatcher = new self($node_type, $access_handler, $obj_type, $node_id, $obj_id);
135
136 if ($sub_type && $sub_id) {
137 $dispatcher->setSubObject($sub_type, $sub_id);
138 }
139
140 // poll comments have specific settings
141
142 if ($node_type == self::TYPE_REPOSITORY && $obj_type != "poll") {
143 $dispatcher->enableCommentsSettings(true);
144 }
145
146 return $dispatcher;
147 }
148 }
Access handler for personal workspace.
Tree handler for personal workspace.
$ilUser
Definition: imgupload.php:18

References $_GET, $DIC, $ilUser, $node_id, $node_type, $obj_id, $obj_type, $sub_id, $sub_type, TYPE_REPOSITORY, and TYPE_WORKSPACE.

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

+ Here is the caller graph for this function:

◆ initHeaderAction()

ilCommonActionDispatcherGUI::initHeaderAction ( )

Set header action menu.

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

276 {
277 // check access for object
278 if ($this->node_id &&
279 !$this->access_handler->checkAccess("visible", "", $this->node_id) &&
280 !$this->access_handler->checkAccess("read", "", $this->node_id)) {
281 return;
282 }
283
284 include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
285 $this->header_action = ilObjectListGUIFactory::_getListGUIByType(
286 $this->obj_type,
287 ($this->node_type == self::TYPE_REPOSITORY)
290 );
291
292 // remove all currently unwanted actions
293 $this->header_action->enableCopy(false);
294 $this->header_action->enableCut(false);
295 $this->header_action->enableDelete(false);
296 $this->header_action->enableLink(false);
297 $this->header_action->enableInfoscreen(false);
298 $this->header_action->enableTimings(false);
299 $this->header_action->enableSubscribe($this->node_type == self::TYPE_REPOSITORY);
300
301 $this->header_action->initItem($this->node_id, $this->obj_id);
302 $this->header_action->setHeaderSubObject($this->sub_type, $this->sub_id);
303 $this->header_action->setAjaxHash($this->getAjaxHash());
304
305 return $this->header_action;
306 }
getAjaxHash()
Build ajax hash for current (object/node) properties.
static _getListGUIByType($a_type, $a_context=ilObjectListGUI::CONTEXT_REPOSITORY)

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

+ Here is the call graph for this function:

◆ setRatingCallback()

ilCommonActionDispatcherGUI::setRatingCallback (   $a_gui,
  $a_cmd 
)

Add callback for rating gui.

Parameters
object$a_gui
string$a_cmd

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

268 {
269 $this->rating_callback = array($a_gui, $a_cmd);
270 }

◆ setSubObject()

ilCommonActionDispatcherGUI::setSubObject (   $a_sub_obj_type,
  $a_sub_obj_id 
)

Set sub object attributes.

Parameters
string$a_sub_obj_type
int$a_sub_obj_id

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

246 {
247 $this->sub_type = (string) $a_sub_obj_type;
248 $this->sub_id = (int) $a_sub_obj_id;
249 }

Field Documentation

◆ $ctrl

ilCommonActionDispatcherGUI::$ctrl
protected

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

Referenced by executeCommand().

◆ $enable_comments_settings

ilCommonActionDispatcherGUI::$enable_comments_settings
protected

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

◆ $node_id

ilCommonActionDispatcherGUI::$node_id
protected

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

Referenced by getInstanceFromAjaxCall().

◆ $node_type

ilCommonActionDispatcherGUI::$node_type
protected

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

Referenced by getInstanceFromAjaxCall().

◆ $obj_id

ilCommonActionDispatcherGUI::$obj_id
protected

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

Referenced by getInstanceFromAjaxCall().

◆ $obj_type

ilCommonActionDispatcherGUI::$obj_type
protected

◆ $rating_callback

ilCommonActionDispatcherGUI::$rating_callback
protected

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

◆ $settings

ilCommonActionDispatcherGUI::$settings
protected

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

Referenced by executeCommand().

◆ $sub_id

ilCommonActionDispatcherGUI::$sub_id
protected

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

Referenced by getInstanceFromAjaxCall().

◆ $sub_type

ilCommonActionDispatcherGUI::$sub_type
protected

◆ TYPE_REPOSITORY

◆ TYPE_WORKSPACE

const ilCommonActionDispatcherGUI::TYPE_WORKSPACE = 2

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