ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilGroupActionTargetExplorerGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
27 {
28  protected bool $select_parent = false;
29  private string $clickable_type = '';
30 
34  public function __construct(object $a_parent_obj, string $a_parent_cmd, bool $a_select_parent = false)
35  {
36  global $DIC;
37 
38  $user = $DIC->user();
39 
40  parent::__construct($a_parent_obj, $a_parent_cmd, null, "", "");
41  $this->select_parent = $a_select_parent;
42 
43  // open paths to objects with access
44  if ($a_select_parent) {
45  $ref_ids = ilUtil::_getObjectsByOperations(array("root", "crs", "cat"), "create_grp", $user->getId(), 5);
46  } else {
47  $ref_ids = ilUtil::_getObjectsByOperations("grp", "manage_members", $user->getId(), 5);
48  }
49  foreach ($ref_ids as $ref_id) {
50  $this->setPathOpen($ref_id);
51  }
52  }
53 
54  public function setClickableType(string $a_val): void
55  {
56  $this->clickable_type = $a_val;
57  }
58 
59  public function getClickableType(): string
60  {
61  return $this->clickable_type;
62  }
63 
64  public function getNodeHref($a_node): string
65  {
66  return "#";
67  }
68 
69  public function getNodeOnClick($a_node): string
70  {
71  if ($this->select_parent) {
72  $this->ctrl->setParameter($this->parent_obj, "grp_act_par_ref_id", $a_node["child"]);
73  $url = $this->ctrl->getLinkTarget($this->parent_obj, "createGroup", "", true, false);
74  return "il.Group.UserActions.initCreationForm(event, '$url'); return false;";
75  }
76  $this->ctrl->setParameter($this->parent_obj, "grp_act_ref_id", $a_node["child"]);
77  $url = $this->ctrl->getLinkTarget($this->parent_obj, "confirmAddUser", "", true, false);
78  return "event.stopPropagation(); event.preventDefault(); il.repository.core.fetchReplaceInner( document.getElementById('il_grp_action_modal_content'),'$url'); return false;";
79  }
80 
86  public function isNodeClickable($a_node): bool
87  {
88  if ($this->select_parent) {
89  if ($this->access->checkAccess("create", "", (int) $a_node["child"], "grp")) {
90  return true;
91  }
92  } elseif ($a_node["type"] == $this->getClickableType() &&
93  $this->access->checkAccess("manage_members", "", (int) $a_node["child"])) {
94  return true;
95  }
96  return false;
97  }
98 }
setPathOpen($a_id)
Set node path to be opened.
$url
Definition: shib_logout.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
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, instead it parses the serialized rbac_pa entries.
__construct(Container $dic, ilPlugin $plugin)
__construct(object $a_parent_obj, string $a_parent_cmd, bool $a_select_parent=false)
Constructor.