ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMailMemberSessionRoles.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 addresses are not supported in general since title of object might be empty
54  $mailbox = $this->lng->txt('il_sess_participant') . ' <#' . $role_title . '>';
55 
56  $role_prefix = substr($role_title, 0, 12);
57  if ($role_prefix === 'il_sess_part') {
58  $sorted_role_ids[1]['default_checked'] = true;
59  $sorted_role_ids[1]['role_id'] = $role_id;
60  $sorted_role_ids[1]['mailbox'] = $mailbox;
61  $sorted_role_ids[1]['form_option_title'] = $this->lng->txt('send_mail_participants');
62  }
63  }
64  ksort($sorted_role_ids, SORT_NUMERIC);
65 
66  return $sorted_role_ids;
67  }
68 }
Class ilMailMemberSessionRoles.
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static _lookupTitle(int $obj_id)
Class ilAbstractMailMemberRoles.