ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

References $ilDB.

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

Member Function Documentation

◆ addModeratorRole()

ilForumModerators::addModeratorRole (   $a_usr_id)

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

References getRefId().

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  }
+ Here is the call graph for this function:

◆ detachModeratorRole()

ilForumModerators::detachModeratorRole (   $a_usr_id)

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

References getRefId().

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  }
+ Here is the call graph for this function:

◆ getCurrentModerators()

ilForumModerators::getCurrentModerators ( )

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

References array, and getRefId().

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  }
Create styles array
The data for the language used.
+ 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().

36  {
37  return $this->ref_id;
38  }
+ Here is the caller graph for this function:

◆ getUsers()

ilForumModerators::getUsers ( )

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

References array, and getRefId().

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  }
Create styles array
The data for the language used.
+ 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.

References $ref_id.

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

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: