ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

Referenced by ilObjectListGUI\getListItemHTML().

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

240  {
241  $this->enable_comments_settings = (bool)$a_value;
242  }

◆ executeCommand()

ilCommonActionDispatcherGUI::executeCommand ( )

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

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

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

◆ 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(), ilObjBookingPoolGUI\executeCommand(), ilObjFileGUI\executeCommand(), ilObjectPluginGUI\executeCommand(), ilObjSurveyGUI\executeCommand(), ilObjSAHSLearningModuleGUI\executeCommand(), ilObjLinkResourceGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilObjWikiGUI\executeCommand(), ilObjContentObjectGUI\executeCommand(), ilObjItemGroupGUI\executeCommand(), ilObjCategoryGUI\executeCommand(), ilObjFileBasedLMGUI\executeCommand(), ilObjCloudGUI\executeCommand(), ilObjExerciseGUI\executeCommand(), ilObjMediaCastGUI\executeCommand(), ilObjMediaPoolGUI\executeCommand(), ilObjSessionGUI\executeCommand(), ilInfoScreenGUI\executeCommand(), ilObjSurveyQuestionPoolGUI\executeCommand(), ilWikiPageGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilObjFolderGUI\executeCommand(), ilObjDataCollectionGUI\executeCommand(), ilObjWorkspaceFolderGUI\executeCommand(), ilObjBibliographicGUI\executeCommand(), ilObjGlossaryGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjOrgUnitGUI\executeCommand(), ilObjRootFolderGUI\executeCommand(), ilLMPresentationGUI\executeCommand(), ilObjPollGUI\executeCommand(), ilObjBlogGUI\executeCommand(), ilPDSelectedItemsBlockGUI\executeCommand(), ilObjCourseGUI\executeCommand(), and ilObjForumGUI\initSessionStorage().

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  if($node_type == self::TYPE_REPOSITORY)
121  {
122  $dispatcher->enableCommentsSettings(true);
123  }
124 
125  return $dispatcher;
126  }
127  }
$_GET["client_id"]
Access handler for personal workspace.
Tree handler for personal workspace.
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ initHeaderAction()

ilCommonActionDispatcherGUI::initHeaderAction ( )

Set header action menu.

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

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

259  {
260  // check access for object
261  if ($this->node_id &&
262  !$this->access_handler->checkAccess("visible", "", $this->node_id) &&
263  !$this->access_handler->checkAccess("read", "", $this->node_id))
264  {
265  return;
266  }
267 
268  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
269  $this->header_action = ilObjectListGUIFactory::_getListGUIByType($this->obj_type);
270 
271  // remove all currently unwanted actions
272  $this->header_action->enableCopy(false);
273  $this->header_action->enableCut(false);
274  $this->header_action->enableDelete(false);
275  $this->header_action->enableLink(false);
276  $this->header_action->enableInfoscreen(false);
277  $this->header_action->enablePayment(false);
278  $this->header_action->enableTimings(false);
279 
280  switch($this->node_type)
281  {
282  case self::TYPE_REPOSITORY:
283  $this->header_action->enableSubscribe(true);
285  break;
286 
287  case self::TYPE_WORKSPACE:
288  $this->header_action->enableSubscribe(false);
290  break;
291  }
292 
293  $this->header_action->initItem($this->node_id, $this->obj_id, "", "",
294  $context);
295  $this->header_action->setHeaderSubObject($this->sub_type, $this->sub_id);
296  $this->header_action->setAjaxHash($this->getAjaxHash());
297 
298  return $this->header_action;
299  }
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 250 of file class.ilCommonActionDispatcherGUI.php.

251  {
252  $this->rating_callback = array($a_gui, $a_cmd);
253  }

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

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

229  {
230  $this->sub_type = (string)$a_sub_obj_type;
231  $this->sub_id = (int)$a_sub_obj_id;
232  }
+ 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: