ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

References string.

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  }
Add rich text string
The name of the decorator.

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.

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

71  {
72  return $a_node_type.";".$a_node_id.";".$a_obj_type.";".
73  $a_obj_id.";".$a_sub_type.";".$a_sub_id;
74  }
+ 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.

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

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"]
Class ilTaggingGUI.
$cmd
Definition: sahs_server.php:35
Class ilObjectActivationGUI.
Notes GUI class.
global $ilCtrl
Definition: ilias.php:18
Class ilRatingGUI.
global $ilSetting
Definition: privfeed.php:17

◆ getAjaxHash()

ilCommonActionDispatcherGUI::getAjaxHash ( )

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

Returns
string

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

Referenced by initHeaderAction().

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  }
+ 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.

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

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

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  {
98  case self::TYPE_REPOSITORY:
99  $access_handler = $ilAccess;
100  break;
101 
102  case self::TYPE_WORKSPACE:
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  }
$_GET["client_id"]
Access handler for personal workspace.
Tree handler for personal workspace.
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ initHeaderAction()

ilCommonActionDispatcherGUI::initHeaderAction ( )

Set header action menu.

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

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

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(
278  $this->obj_type,
279  ($this->node_type == self::TYPE_REPOSITORY)
282  );
283 
284  // remove all currently unwanted actions
285  $this->header_action->enableCopy(false);
286  $this->header_action->enableCut(false);
287  $this->header_action->enableDelete(false);
288  $this->header_action->enableLink(false);
289  $this->header_action->enableInfoscreen(false);
290  $this->header_action->enableTimings(false);
291  $this->header_action->enableSubscribe($this->node_type == self::TYPE_REPOSITORY);
292 
293  $this->header_action->initItem($this->node_id, $this->obj_id);
294  $this->header_action->setHeaderSubObject($this->sub_type, $this->sub_id);
295  $this->header_action->setAjaxHash($this->getAjaxHash());
296 
297  return $this->header_action;
298  }
static _getListGUIByType($a_type, $a_context=ilObjectListGUI::CONTEXT_REPOSITORY)
getAjaxHash()
Build ajax hash for current (object/node) properties.
+ 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.

References array.

259  {
260  $this->rating_callback = array($a_gui, $a_cmd);
261  }
Create styles array
The data for the language used.

◆ 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.

References string.

Referenced by ilLMPresentationGUI\addHeaderAction(), and ilObjectGUI\initHeaderAction().

237  {
238  $this->sub_type = (string)$a_sub_obj_type;
239  $this->sub_id = (int)$a_sub_obj_id;
240  }
Add rich text string
The name of the decorator.
+ Here is the caller graph for this function:

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: