ILIAS  release_8 Revision v8.24
ilForumModerators Class Reference

Class ilForumModerators. More...

+ Collaboration diagram for ilForumModerators:

Public Member Functions

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

Private Attributes

int $ref_id
 
ILIAS DI RBACServices $rbac
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumModerators::__construct ( int  $a_ref_id)

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

32 {
33 global $DIC;
34
35 $this->rbac = $DIC->rbac();
36 $this->ref_id = $a_ref_id;
37 }
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addModeratorRole()

ilForumModerators::addModeratorRole ( int  $a_usr_id)

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

49 : bool
50 {
51 $a_rol_id = null;
52 $role_list = $this->rbac->review()->getRoleListByObject($this->getRefId());
53 foreach ($role_list as $role) {
54 if (strpos($role['title'], 'il_frm_moderator') !== false) {
55 $a_rol_id = (int) $role['obj_id'];
56 break;
57 }
58 }
59
60 if ($a_rol_id !== null) {
61 $this->rbac->admin()->assignUser($a_rol_id, $a_usr_id);
62 return true;
63 }
64
65 return false;
66 }

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

+ Here is the call graph for this function:

◆ detachModeratorRole()

ilForumModerators::detachModeratorRole ( int  $a_usr_id)

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

68 : bool
69 {
70 $a_rol_id = null;
71 $role_list = $this->rbac->review()->getRoleListByObject($this->getRefId());
72 foreach ($role_list as $role) {
73 if (strpos($role['title'], 'il_frm_moderator') !== false) {
74 $a_rol_id = (int) $role['obj_id'];
75 break;
76 }
77 }
78
79 if ($a_rol_id !== null) {
80 $this->rbac->admin()->deassignUser($a_rol_id, $a_usr_id);
81 return true;
82 }
83
84 return false;
85 }

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

+ Here is the call graph for this function:

◆ getCurrentModerators()

ilForumModerators::getCurrentModerators ( )
Returns
int[]

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

90 : array
91 {
92 $assigned_users = [];
93 $roles = $this->rbac->review()->getRoleListByObject($this->getRefId());
94 foreach ($roles as $role) {
95 if (strpos($role['title'], 'il_frm_moderator') !== false) {
96 $assigned_users = $this->rbac->review()->assignedUsers((int) $role['rol_id']);
97 break;
98 }
99 }
100
101 return $assigned_users;
102 }

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

+ Here is the call graph for this function:

◆ getRefId()

ilForumModerators::getRefId ( )

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

44 : int
45 {
46 return $this->ref_id;
47 }

References $ref_id.

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

+ Here is the caller graph for this function:

◆ getUsers()

ilForumModerators::getUsers ( )
Returns
int[]

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

107 : array
108 {
109 $assigned_users = [];
110 $roles = $this->rbac->review()->getRoleListByObject($this->getRefId());
111 foreach ($roles as $role) {
112 if (strpos($role['title'], 'il_frm_moderator') !== false) {
113 $assigned_users = array_map('intval', $this->rbac->review()->assignedUsers((int) $role['rol_id']));
114 break;
115 }
116 }
117
118 return $assigned_users;
119 }

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

+ Here is the call graph for this function:

◆ setRefId()

ilForumModerators::setRefId ( int  $ref_id)

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

39 : void
40 {
41 $this->ref_id = $ref_id;
42 }

References $ref_id.

Field Documentation

◆ $rbac

ILIAS DI RBACServices ilForumModerators::$rbac
private

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

◆ $ref_id

int ilForumModerators::$ref_id
private

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

Referenced by getRefId(), and setRefId().


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