ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMailMemberCourseRoles.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  // Sort by relevance
49  $sorted_role_ids = [];
50  $counter = 3;
51 
52  foreach ($role_ids as $role_id) {
53  $role_title = ilObject::_lookupTitle($role_id);
54  $mailbox = $this->getMailboxRoleAddress($role_id);
55 
56  switch (substr($role_title, 0, 8)) {
57  case 'il_crs_a':
58  $sorted_role_ids[2]['role_id'] = $role_id;
59  $sorted_role_ids[2]['mailbox'] = $mailbox;
60  $sorted_role_ids[2]['form_option_title'] = $this->lng->txt('send_mail_admins');
61  break;
62 
63  case 'il_crs_t':
64  $sorted_role_ids[1]['role_id'] = $role_id;
65  $sorted_role_ids[1]['mailbox'] = $mailbox;
66  $sorted_role_ids[1]['form_option_title'] = $this->lng->txt('send_mail_tutors');
67  break;
68 
69  case 'il_crs_m':
70  $sorted_role_ids[0]['role_id'] = $role_id;
71  $sorted_role_ids[0]['mailbox'] = $mailbox;
72  $sorted_role_ids[0]['form_option_title'] = $this->lng->txt('send_mail_members');
73  break;
74 
75  default:
76  $sorted_role_ids[$counter]['role_id'] = $role_id;
77  $sorted_role_ids[$counter]['mailbox'] = $mailbox;
78  $sorted_role_ids[$counter]['form_option_title'] = $role_title;
79 
80  $counter++;
81  break;
82  }
83  }
84  ksort($sorted_role_ids, SORT_NUMERIC);
85 
86  return $sorted_role_ids;
87  }
88 }
Class ilMailMemberCourseRoles.
$ref_id
Definition: ltiauth.php:65
static _lookupTitle(int $obj_id)
global $DIC
Definition: shib_login.php:22
Class ilAbstractMailMemberRoles.