ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 
50  foreach ($role_ids as $role_id) {
51  $role_title = ilObject::_lookupTitle($role_id);
52  // mailbox addresses are not supported in general since title of object might be empty
53  $mailbox = $this->lng->txt('il_sess_participant') . ' <#' . $role_title . '>';
54 
55  $role_prefix = substr($role_title, 0, 12);
56  if ($role_prefix === 'il_sess_part') {
57  $sorted_role_ids[1]['default_checked'] = true;
58  $sorted_role_ids[1]['role_id'] = $role_id;
59  $sorted_role_ids[1]['mailbox'] = $mailbox;
60  $sorted_role_ids[1]['form_option_title'] = $this->lng->txt('send_mail_participants');
61  }
62  }
63  ksort($sorted_role_ids, SORT_NUMERIC);
64 
65  return $sorted_role_ids;
66  }
67 }
Class ilMailMemberSessionRoles.
$ref_id
Definition: ltiauth.php:65
static _lookupTitle(int $obj_id)
global $DIC
Definition: shib_login.php:22
Class ilAbstractMailMemberRoles.