ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilForumModerators Class Reference

Class ilForumModerators. More...

+ Collaboration diagram for ilForumModerators:

Public Member Functions

 __construct (private int $ref_id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 addModeratorRole (int $a_usr_id)
 
 detachModeratorRole (int $a_usr_id)
 
 getCurrentModerators ()
 
 getUsers ()
 

Private Attributes

readonly ILIAS DI RBACServices $rbac
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumModerators::__construct ( private int  $ref_id)

Definition at line 30 of file class.ilForumModerators.php.

References $DIC, and ILIAS\Repository\rbac().

31  {
32  global $DIC;
33 
34  $this->rbac = $DIC->rbac();
35  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ addModeratorRole()

ilForumModerators::addModeratorRole ( int  $a_usr_id)

Definition at line 47 of file class.ilForumModerators.php.

References getRefId(), ILIAS\Repository\int(), null, and ILIAS\Repository\rbac().

47  : bool
48  {
49  $a_rol_id = null;
50  $role_list = $this->rbac->review()->getRoleListByObject($this->getRefId());
51  foreach ($role_list as $role) {
52  if (str_contains($role['title'], 'il_frm_moderator')) {
53  $a_rol_id = (int) $role['obj_id'];
54  break;
55  }
56  }
57 
58  if ($a_rol_id !== null) {
59  $this->rbac->admin()->assignUser($a_rol_id, $a_usr_id);
60  return true;
61  }
62 
63  return false;
64  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ detachModeratorRole()

ilForumModerators::detachModeratorRole ( int  $a_usr_id)

Definition at line 66 of file class.ilForumModerators.php.

References getRefId(), ILIAS\Repository\int(), null, and ILIAS\Repository\rbac().

66  : bool
67  {
68  $a_rol_id = null;
69  $role_list = $this->rbac->review()->getRoleListByObject($this->getRefId());
70  foreach ($role_list as $role) {
71  if (str_contains($role['title'], 'il_frm_moderator')) {
72  $a_rol_id = (int) $role['obj_id'];
73  break;
74  }
75  }
76 
77  if ($a_rol_id !== null) {
78  $this->rbac->admin()->deassignUser($a_rol_id, $a_usr_id);
79  return true;
80  }
81 
82  return false;
83  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getCurrentModerators()

ilForumModerators::getCurrentModerators ( )
Returns
int[]

Definition at line 88 of file class.ilForumModerators.php.

References getRefId(), and ILIAS\Repository\rbac().

88  : array
89  {
90  $assigned_users = [];
91  $roles = $this->rbac->review()->getRoleListByObject($this->getRefId());
92  foreach ($roles as $role) {
93  if (str_contains($role['title'], 'il_frm_moderator')) {
94  $assigned_users = $this->rbac->review()->assignedUsers((int) $role['rol_id']);
95  break;
96  }
97  }
98 
99  return $assigned_users;
100  }
+ Here is the call graph for this function:

◆ getRefId()

ilForumModerators::getRefId ( )

Definition at line 42 of file class.ilForumModerators.php.

References $ref_id.

Referenced by addModeratorRole(), detachModeratorRole(), getCurrentModerators(), and getUsers().

42  : int
43  {
44  return $this->ref_id;
45  }
$ref_id
Definition: ltiauth.php:65
+ Here is the caller graph for this function:

◆ getUsers()

ilForumModerators::getUsers ( )
Returns
int[]

Definition at line 105 of file class.ilForumModerators.php.

References getRefId(), and ILIAS\Repository\rbac().

105  : array
106  {
107  $assigned_users = [];
108  $roles = $this->rbac->review()->getRoleListByObject($this->getRefId());
109  foreach ($roles as $role) {
110  if (str_contains($role['title'], 'il_frm_moderator')) {
111  $assigned_users = array_map('intval', $this->rbac->review()->assignedUsers((int) $role['rol_id']));
112  break;
113  }
114  }
115 
116  return $assigned_users;
117  }
+ Here is the call graph for this function:

◆ setRefId()

ilForumModerators::setRefId ( int  $ref_id)

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

References $ref_id.

37  : void
38  {
39  $this->ref_id = $ref_id;
40  }
$ref_id
Definition: ltiauth.php:65

Field Documentation

◆ $rbac

readonly ILIAS DI RBACServices ilForumModerators::$rbac
private

Definition at line 28 of file class.ilForumModerators.php.


The documentation for this class was generated from the following file: