ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilMailMemberGroupRoles.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Contact/classes/class.ilAbstractMailMemberRoles.php';
5 
11 {
15  protected $lng;
16 
20  protected $rbacreview;
21 
25  public function __construct()
26  {
27  global $DIC;
28 
29  $this->lng = $DIC['lng'];
30  $this->rbacreview = $DIC['rbacreview'];
31  }
32 
36  public function getRadioOptionTitle()
37  {
38  return $this->lng->txt('mail_grp_roles');
39  }
40 
45  public function getMailRoles($ref_id)
46  {
47  $role_ids = $this->rbacreview->getLocalRoles($ref_id);
48 
49  $sorted_role_ids = array();
50  $counter = 2;
51 
52  foreach($role_ids as $role_id)
53  {
54  $role_title = ilObject::_lookupTitle($role_id);
55  $mailbox = $this->getMailboxRoleAddress($role_id);
56 
57  switch(substr($role_title, 0, 8))
58  {
59  case 'il_grp_a':
60  $sorted_role_ids[1]['role_id'] = $role_id;
61  $sorted_role_ids[1]['mailbox'] = $mailbox;
62  $sorted_role_ids[1]['form_option_title'] = $this->lng->txt('send_mail_admins');
63  break;
64 
65  case 'il_grp_m':
66  $sorted_role_ids[0]['role_id'] = $role_id;
67  $sorted_role_ids[0]['mailbox'] = $mailbox;
68  $sorted_role_ids[0]['form_option_title'] = $this->lng->txt('send_mail_members');
69  break;
70 
71  default:
72  $sorted_role_ids[$counter]['role_id'] = $role_id;
73  $sorted_role_ids[$counter]['mailbox'] = $mailbox;
74  $sorted_role_ids[$counter]['form_option_title'] = $role_title;
75 
76  $counter++;
77  break;
78  }
79  }
80  ksort($sorted_role_ids, SORT_NUMERIC);
81 
82  return $sorted_role_ids;
83  }
84 }
static _lookupTitle($a_id)
lookup object title
Class ilMailMemberCourseRoles.
$counter
__construct()
ilMailMemberGroupRoles constructor.
Create styles array
The data for the language used.
$ref_id
Definition: sahs_server.php:39
global $DIC
Class ilAbstractMailMemberRoles.