ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMailMemberGroupRoles.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
27  protected ilLanguage $lng;
29 
30  public function __construct()
31  {
32  global $DIC;
33 
34  $this->lng = $DIC['lng'];
35  $this->rbacreview = $DIC['rbacreview'];
36  }
37 
38 
39  public function getRadioOptionTitle(): string
40  {
41  return $this->lng->txt('mail_roles');
42  }
43 
44  public function getMailRoles(int $ref_id): array
45  {
46  $role_ids = $this->rbacreview->getLocalRoles($ref_id);
47 
48  $sorted_role_ids = [];
49  $counter = 2;
50 
51  foreach ($role_ids as $role_id) {
52  $role_title = ilObject::_lookupTitle($role_id);
53  $mailbox = $this->getMailboxRoleAddress($role_id);
54 
55  switch (substr($role_title, 0, 8)) {
56  case 'il_grp_a':
57  $sorted_role_ids[1]['role_id'] = $role_id;
58  $sorted_role_ids[1]['mailbox'] = $mailbox;
59  $sorted_role_ids[1]['form_option_title'] = $this->lng->txt('send_mail_admins');
60  break;
61 
62  case 'il_grp_m':
63  $sorted_role_ids[0]['role_id'] = $role_id;
64  $sorted_role_ids[0]['mailbox'] = $mailbox;
65  $sorted_role_ids[0]['form_option_title'] = $this->lng->txt('send_mail_members');
66  break;
67 
68  default:
69  $sorted_role_ids[$counter]['role_id'] = $role_id;
70  $sorted_role_ids[$counter]['mailbox'] = $mailbox;
71  $sorted_role_ids[$counter]['form_option_title'] = $role_title;
72 
73  $counter++;
74  break;
75  }
76  }
77  ksort($sorted_role_ids, SORT_NUMERIC);
78 
79  return $sorted_role_ids;
80  }
81 }
Class ilMailMemberCourseRoles.
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static _lookupTitle(int $obj_id)
Class ilAbstractMailMemberRoles.