ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

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

40 {
41 $this->node_type = (int)$a_node_type;
42 $this->access_handler = $a_access_handler;
43 $this->obj_type = (string)$a_obj_type;
44 $this->node_id = (int)$a_node_id;
45 $this->obj_id = (int)$a_obj_id;
46 }

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

71 {
72 return $a_node_type.";".$a_node_id.";".$a_obj_type.";".
73 $a_obj_id.";".$a_sub_type.";".$a_sub_id;
74 }

Referenced by ilPollBlockGUI\commentJSCall(), getAjaxHash(), ilDataCollectionRecordListTableGUI\getCommentsAjaxLink(), ilObjectListGUI\getListItemHTML(), and ilDataCollectionRecord\getStandardFieldHTML().

+ Here is the caller graph for this function:

◆ enableCommentsSettings()

ilCommonActionDispatcherGUI::enableCommentsSettings (   $a_value)

Toggle comments settings.

Parameters
bool$a_value

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

248 {
249 $this->enable_comments_settings = (bool)$a_value;
250 }

◆ executeCommand()

ilCommonActionDispatcherGUI::executeCommand ( )

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

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

References $_GET, $_REQUEST, $cmd, $ilCtrl, $ilSetting, $obj_type, $sub_type, and exit.

◆ getAjaxHash()

ilCommonActionDispatcherGUI::getAjaxHash ( )

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

Returns
string

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

54 {
55 return self::buildAjaxHash($this->node_type, $this->node_id, $this->obj_type,
56 $this->obj_id, $this->sub_type, $this->sub_id);
57 }
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 81 of file class.ilCommonActionDispatcherGUI.php.

82 {
83 global $ilAccess, $ilUser;
84
85 if(isset($_GET["cadh"]))
86 {
87 $parts = explode(";", (string)$_GET["cadh"]);
88
89 $node_type = $parts[0];
90 $node_id = $parts[1];
91 $obj_type = $parts[2];
92 $obj_id = $parts[3];
93 $sub_type = $parts[4];
94 $sub_id = $parts[5];
95
96 switch($node_type)
97 {
99 $access_handler = $ilAccess;
100 break;
101
103 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
104 $tree = new ilWorkspaceTree($ilUser->getId());
105 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
106 $access_handler = new ilWorkspaceAccessHandler($tree);
107 break;
108
109 default:
110 return null;
111 }
112
113 $dispatcher = new self($node_type, $access_handler, $obj_type, $node_id, $obj_id);
114
115 if($sub_type && $sub_id)
116 {
117 $dispatcher->setSubObject($sub_type, $sub_id);
118 }
119
120 // poll comments have specific settings
121
122 if($node_type == self::TYPE_REPOSITORY && $obj_type != "poll")
123 {
124 $dispatcher->enableCommentsSettings(true);
125 }
126
127 return $dispatcher;
128 }
129 }
Access handler for personal workspace.
Tree handler for personal workspace.
global $ilUser
Definition: imgupload.php:15

References $_GET, $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(), ilObjCloudGUI\executeCommand(), ilObjCourseGUI\executeCommand(), ilObjExerciseGUI\executeCommand(), ilObjFileGUI\executeCommand(), ilObjFolderGUI\executeCommand(), ilObjGlossaryGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilObjFileBasedLMGUI\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 266 of file class.ilCommonActionDispatcherGUI.php.

267 {
268 // check access for object
269 if ($this->node_id &&
270 !$this->access_handler->checkAccess("visible", "", $this->node_id) &&
271 !$this->access_handler->checkAccess("read", "", $this->node_id))
272 {
273 return;
274 }
275
276 include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
277 $this->header_action = ilObjectListGUIFactory::_getListGUIByType($this->obj_type);
278
279 // remove all currently unwanted actions
280 $this->header_action->enableCopy(false);
281 $this->header_action->enableCut(false);
282 $this->header_action->enableDelete(false);
283 $this->header_action->enableLink(false);
284 $this->header_action->enableInfoscreen(false);
285 $this->header_action->enablePayment(false);
286 $this->header_action->enableTimings(false);
287
288 switch($this->node_type)
289 {
291 $this->header_action->enableSubscribe(true);
293 break;
294
296 $this->header_action->enableSubscribe(false);
298 break;
299 }
300
301 $this->header_action->initItem($this->node_id, $this->obj_id, "", "",
302 $context);
303 $this->header_action->setHeaderSubObject($this->sub_type, $this->sub_id);
304 $this->header_action->setAjaxHash($this->getAjaxHash());
305
306 return $this->header_action;
307 }
getAjaxHash()
Build ajax hash for current (object/node) properties.

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

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

259 {
260 $this->rating_callback = array($a_gui, $a_cmd);
261 }

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

237 {
238 $this->sub_type = (string)$a_sub_obj_type;
239 $this->sub_id = (int)$a_sub_obj_id;
240 }

Field Documentation

◆ $enable_comments_settings

ilCommonActionDispatcherGUI::$enable_comments_settings
protected

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

◆ $node_id

ilCommonActionDispatcherGUI::$node_id
protected

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

Referenced by getInstanceFromAjaxCall().

◆ $node_type

ilCommonActionDispatcherGUI::$node_type
protected

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

Referenced by getInstanceFromAjaxCall().

◆ $obj_id

ilCommonActionDispatcherGUI::$obj_id
protected

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

Referenced by getInstanceFromAjaxCall().

◆ $obj_type

ilCommonActionDispatcherGUI::$obj_type
protected

◆ $rating_callback

ilCommonActionDispatcherGUI::$rating_callback
protected

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

◆ $sub_id

ilCommonActionDispatcherGUI::$sub_id
protected

Definition at line 22 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: