ILIAS  release_8 Revision v8.24
class.ilGroupActionTargetExplorerGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
5
6
14{
15 protected bool $select_parent = false;
16 private string $clickable_type = '';
17
21 public function __construct(object $a_parent_obj, string $a_parent_cmd, bool $a_select_parent = false)
22 {
23 global $DIC;
24
25 $user = $DIC->user();
26
27 parent::__construct($a_parent_obj, $a_parent_cmd, null, "", "");
28 $this->select_parent = $a_select_parent;
29
30 // open paths to objects with access
31 if ($a_select_parent) {
32 $ref_ids = ilUtil::_getObjectsByOperations(array("root", "crs", "cat"), "create_grp", $user->getId(), 5);
33 } else {
34 $ref_ids = ilUtil::_getObjectsByOperations("grp", "manage_members", $user->getId(), 5);
35 }
36 foreach ($ref_ids as $ref_id) {
37 $this->setPathOpen($ref_id);
38 }
39 }
40
41 public function setClickableType(string $a_val): void
42 {
43 $this->clickable_type = $a_val;
44 }
45
46 public function getClickableType(): string
47 {
49 }
50
51 public function getNodeHref($a_node): string
52 {
53 return "#";
54 }
55
56 public function getNodeOnClick($a_node): string
57 {
58 if ($this->select_parent) {
59 $this->ctrl->setParameter($this->parent_obj, "grp_act_par_ref_id", $a_node["child"]);
60 $url = $this->ctrl->getLinkTarget($this->parent_obj, "createGroup", "", true, false);
61 return "il.Group.UserActions.initCreationForm(event, '$url'); return false;";
62 }
63 $this->ctrl->setParameter($this->parent_obj, "grp_act_ref_id", $a_node["child"]);
64 $url = $this->ctrl->getLinkTarget($this->parent_obj, "confirmAddUser", "", true, false);
65 return "event.stopPropagation(); event.preventDefault(); il.Util.ajaxReplaceInner('$url', 'il_grp_action_modal_content'); return false;";
66 }
67
73 public function isNodeClickable($a_node): bool
74 {
75 if ($this->select_parent) {
76 if ($this->access->checkAccess("create", "", (int) $a_node["child"], "grp")) {
77 return true;
78 }
79 } elseif ($a_node["type"] == $this->getClickableType() &&
80 $this->access->checkAccess("manage_members", "", (int) $a_node["child"])) {
81 return true;
82 }
83 return false;
84 }
85}
getNodeOnClick($a_node)
Get node onclick attribute.
__construct(object $a_parent_obj, string $a_parent_cmd, bool $a_select_parent=false)
Constructor.
Explorer for selecting repository items.
setPathOpen($a_id)
Set node path to be opened.
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url