ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilForumModerators::__construct (   $a_ref_id)

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

17 {
18 global $ilDB;
19
20 $this->db = $ilDB;
21 $this->ref_id = $a_ref_id;
22 }
global $ilDB

References $ilDB.

Member Function Documentation

◆ addModeratorRole()

ilForumModerators::addModeratorRole (   $a_usr_id)

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

40 {
41 global $rbacreview, $rbacadmin;
42
43 $role_list = $rbacreview->getRoleListByObject($this->getRefId());
44 foreach ($role_list as $role)
45 {
46 if(strpos($role['title'], 'il_frm_moderator') !== false)
47 {
48 $a_rol_id = $role['obj_id'];
49 break;
50 }
51 }
52
53 if((int)$a_rol_id)
54 {
55 $user = $rbacadmin->assignUser($a_rol_id, $a_usr_id);
56 return true;
57 }
58
59 return false;
60 }

References getRefId().

+ Here is the call graph for this function:

◆ detachModeratorRole()

ilForumModerators::detachModeratorRole (   $a_usr_id)

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

63 {
64 global $rbacreview, $rbacadmin;
65
66 $role_list = $rbacreview->getRoleListByObject($this->getRefId());
67 foreach ($role_list as $role)
68 {
69 if(strpos($role['title'], 'il_frm_moderator') !== false)
70 {
71 $a_rol_id = $role['obj_id'];
72 break;
73 }
74 }
75
76 if((int)$a_rol_id)
77 {
78 $user = $rbacadmin->deassignUser($a_rol_id, $a_usr_id);
79 return true;
80 }
81
82 return false;
83 }

References getRefId().

+ Here is the call graph for this function:

◆ getCurrentModerators()

ilForumModerators::getCurrentModerators ( )

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

86 {
87 global $rbacreview;
88
89 $roles = $rbacreview->getRoleListByObject($this->getRefId());
90 foreach($roles as $role)
91 {
92 if(strpos($role['title'], 'il_frm_moderator') !== false)
93 {
94 $assigned_users = $rbacreview->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 35 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 ( )

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

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

References getRefId().

+ Here is the call graph for this function:

◆ setRefId()

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

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

28 {
29 $this->ref_id = $ref_id;
30 }

References $ref_id.

Field Documentation

◆ $db

ilForumModerators::$db = null
private

Definition at line 13 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: