ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilForumModerators Class Reference

Class ilForumModerators. More...

+ Collaboration diagram for ilForumModerators:

Public Member Functions

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

Private Attributes

 $db = null
 
 $ref_id = 0
 
 $rbac
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumModerators::__construct (   $a_ref_id)

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

18 {
19 global $DIC;
20
21 $this->db = $DIC->database();
22 $this->rbac = $DIC->rbac();
23 $this->ref_id = $a_ref_id;
24 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ addModeratorRole()

ilForumModerators::addModeratorRole (   $a_usr_id)
Parameters
$a_usr_id
Returns
bool

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

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

References getRefId().

+ Here is the call graph for this function:

◆ detachModeratorRole()

ilForumModerators::detachModeratorRole (   $a_usr_id)
Parameters
$a_usr_id
Returns
bool

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

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

References getRefId().

+ Here is the call graph for this function:

◆ getCurrentModerators()

ilForumModerators::getCurrentModerators ( )
Returns
array

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

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

References getRefId().

+ Here is the call graph for this function:

◆ getRefId()

ilForumModerators::getRefId ( )
Returns
int

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

References $ref_id.

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

+ Here is the caller graph for this function:

◆ getUsers()

ilForumModerators::getUsers ( )
Returns
array

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

105 {
106 $roles = $this->rbac->review()->getRoleListByObject($this->getRefId());
107 foreach ($roles as $role) {
108 if (strpos($role['title'], 'il_frm_moderator') !== false) {
109 $assigned_users = $this->rbac->review()->assignedUsers($role['rol_id']);
110 //vd($assigned_users);
111 break;
112 }
113 }
114 return is_array($assigned_users) ? $assigned_users : array();
115 }

References getRefId().

+ Here is the call graph for this function:

◆ setRefId()

ilForumModerators::setRefId (   $ref_id)
Parameters
int$ref_id

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

30 {
31 $this->ref_id = $ref_id;
32 }

References $ref_id.

Field Documentation

◆ $db

ilForumModerators::$db = null
private

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

◆ $rbac

ilForumModerators::$rbac
private

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

◆ $ref_id

ilForumModerators::$ref_id = 0
private

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

Referenced by getRefId(), and setRefId().


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