ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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, $a_news_id=0)
 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, $a_news_id=0)
 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
 
 $news_id = 0
 
 $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,
  $a_news_id = 0 
)

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

References $DIC, and settings().

56  {
57  global $DIC;
58 
59  $this->ctrl = $DIC->ctrl();
60  $this->settings = $DIC->settings();
61  $this->node_type = (int) $a_node_type;
62  $this->access_handler = $a_access_handler;
63  $this->obj_type = (string) $a_obj_type;
64  $this->node_id = (int) $a_node_id;
65  $this->obj_id = (int) $a_obj_id;
66  $this->news_id = (int) $a_news_id;
67  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
+ 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,
  $a_news_id = 0 
)
static

Build ajax hash.

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

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

Referenced by ilPollBlockGUI\commentJSCall(), ilDclRecordListTableGUI\getCommentsAjaxLink(), ilQuestionBrowserTableGUI\getCommentsAjaxLink(), ilNoteGUI\getCommentsWidget(), ilObjectListGUI\getListItemHTML(), ilDclBaseRecordModel\getStandardFieldHTML(), and ilContainerContentGUI\renderCard().

106  {
107  return $a_node_type . ";" . $a_node_id . ";" . $a_obj_type . ";" .
108  $a_obj_id . ";" . $a_sub_type . ";" . $a_sub_id . ";" . $a_news_id;
109  }
+ Here is the caller graph for this function:

◆ enableCommentsSettings()

ilCommonActionDispatcherGUI::enableCommentsSettings (   $a_value)

Toggle comments settings.

Parameters
bool$a_value

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

272  {
273  $this->enable_comments_settings = (bool) $a_value;
274  }

◆ executeCommand()

ilCommonActionDispatcherGUI::executeCommand ( )

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

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

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

◆ getAjaxHash()

ilCommonActionDispatcherGUI::getAjaxHash ( )

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

Returns
string

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

Referenced by initHeaderAction().

75  {
76  return self::buildAjaxHash(
77  $this->node_type,
78  $this->node_id,
79  $this->obj_type,
80  $this->obj_id,
81  $this->sub_type,
82  $this->sub_id,
83  $this->news_id
84  );
85  }
+ Here is the caller graph for this function:

◆ getInstanceFromAjaxCall()

static ilCommonActionDispatcherGUI::getInstanceFromAjaxCall ( )
static

(Re-)Build instance from ajax call

Returns
object

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

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

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

117  {
118  global $DIC;
119 
120  $ilAccess = $DIC->access();
121  $ilUser = $DIC->user();
122  if (isset($_GET["cadh"])) {
123  $parts = explode(";", (string) $_GET["cadh"]);
124 
125  $node_type = $parts[0];
126  $node_id = $parts[1];
127  $obj_type = $parts[2];
128  $obj_id = $parts[3];
129  $sub_type = $parts[4];
130  $sub_id = $parts[5];
131  $news_id = $parts[6];
132 
133  switch ($node_type) {
134  case self::TYPE_REPOSITORY:
135  $access_handler = $ilAccess;
136  break;
137 
138  case self::TYPE_WORKSPACE:
139  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
140  $tree = new ilWorkspaceTree($ilUser->getId());
141  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
142  $access_handler = new ilWorkspaceAccessHandler($tree);
143  break;
144 
145  default:
146  return null;
147  }
148 
149  $dispatcher = new self($node_type, $access_handler, $obj_type, $node_id, $obj_id, $news_id);
150 
151  if ($sub_type && $sub_id) {
152  $dispatcher->setSubObject($sub_type, $sub_id);
153  }
154 
155  // poll comments have specific settings
156 
157  if ($node_type == self::TYPE_REPOSITORY && $obj_type != "poll") {
158  $dispatcher->enableCommentsSettings(true);
159  }
160 
161  return $dispatcher;
162  }
163  }
global $DIC
Definition: saml.php:7
$_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 290 of file class.ilCommonActionDispatcherGUI.php.

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

291  {
292  // check access for object
293  if ($this->node_id &&
294  !$this->access_handler->checkAccess("visible", "", $this->node_id) &&
295  !$this->access_handler->checkAccess("read", "", $this->node_id)) {
296  return;
297  }
298 
299  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
300  $this->header_action = ilObjectListGUIFactory::_getListGUIByType(
301  $this->obj_type,
302  ($this->node_type == self::TYPE_REPOSITORY)
305  );
306 
307  // remove all currently unwanted actions
308  $this->header_action->enableCopy(false);
309  $this->header_action->enableCut(false);
310  $this->header_action->enableDelete(false);
311  $this->header_action->enableLink(false);
312  $this->header_action->enableInfoscreen(false);
313  $this->header_action->enableTimings(false);
314  $this->header_action->enableSubscribe($this->node_type == self::TYPE_REPOSITORY);
315 
316  $this->header_action->initItem($this->node_id, $this->obj_id);
317  $this->header_action->setHeaderSubObject($this->sub_type, $this->sub_id);
318  $this->header_action->setAjaxHash($this->getAjaxHash());
319 
320  return $this->header_action;
321  }
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 282 of file class.ilCommonActionDispatcherGUI.php.

283  {
284  $this->rating_callback = array($a_gui, $a_cmd);
285  }

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

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

261  {
262  $this->sub_type = (string) $a_sub_obj_type;
263  $this->sub_id = (int) $a_sub_obj_id;
264  }
+ Here is the caller graph for this function:

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

◆ $news_id

ilCommonActionDispatcherGUI::$news_id = 0
protected

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

Referenced by getInstanceFromAjaxCall().

◆ $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 40 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: