19 declare(strict_types=1);
47 private readonly
object $gui,
53 $this->
ctrl = $DIC[
'ilCtrl'];
54 $this->tpl = $DIC[
'tpl'];
55 $this->
lng = $DIC[
'lng'];
56 $this->
access = $DIC[
'ilAccess'];
57 $this->httpRequest = $DIC->http()->request();
59 $this->ui_factory = $DIC->ui()->factory();
60 $this->ui_renderer = $DIC->ui()->renderer();
62 $this->
http = $DIC->http();
64 $this->
lng->loadLanguageModule(
'mail');
65 $this->
lng->loadLanguageModule(
'search');
66 $this->mail_roles = $objMailMemberRoles->getMailRoles($ref_id);
71 $action = $this->
http->wrapper()->query()->retrieve(
72 'contact_search_members_action',
74 $this->refinery->kindlyTo()->string(),
80 default => $this->
ctrl->redirect($this,
'showSelectableUsers'),
86 $cmd = $this->
ctrl->getCmd();
88 $this->
ctrl->setReturn($this,
'');
91 case 'handleSearchMembersActions':
95 case 'showSelectableUsers':
108 if (isset($this->httpRequest->getQueryParams()[
'returned_from_mail']) &&
109 $this->httpRequest->getQueryParams()[
'returned_from_mail'] ===
'1') {
128 $back_link = $this->
ctrl->getParentReturn($this);
130 if (isset($this->httpRequest->getServerParams()[
'HTTP_REFERER'])) {
131 $referer = $this->httpRequest->getServerParams()[
'HTTP_REFERER'];
132 $urlParts = parse_url($referer);
133 if (is_array($urlParts) && isset($urlParts[
'path'])) {
134 $url = ltrim(basename($urlParts[
'path']),
'/');
135 if (isset($urlParts[
'query'])) {
136 $url .=
'?' . $urlParts[
'query'];
160 if ($form->checkInput()) {
161 if ($form->getInput(
'mail_member_type') ===
'mail_member_roles') {
162 if (is_array($form->getInput(
'roles')) && $form->getInput(
'roles') !== []) {
163 $role_mail_boxes = [];
164 $roles = $form->getInput(
'roles');
165 foreach ($roles as $role_id) {
166 $mailbox = $this->objMailMemberRoles->getMailboxRoleAddress((
int) $role_id);
167 $role_mail_boxes[] = $mailbox;
172 $this->
ctrl->redirectToURL(
179 'rcp_to' => implode(
',', $role_mail_boxes),
180 'sig' => $this->gui->createMailSignature()
186 $form->setValuesByPost();
187 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_checkbox'));
197 $form->setValuesByPost();
203 $contextParameters = [];
209 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
210 $contextParameters = [
220 if (
'crs' === $type) {
227 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
228 $contextParameters = [
237 return $contextParameters;
242 $this->tpl->loadStandardTemplate();
246 $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
251 $selected_user_ids = $this->
http->wrapper()->query()->retrieve(
252 'contact_search_members_user_ids',
254 $this->refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->string()),
259 if ((
string) current($selected_user_ids) ===
'ALL_OBJECTS') {
260 $selected_user_ids = [];
264 foreach ($entries as $entry) {
265 $selected_user_ids[] = (
int) $entry[
'user_id'];
268 $selected_user_ids =
array_map(intval(...), $selected_user_ids);
272 foreach ($selected_user_ids as $usr_id) {
276 if (array_filter($rcps) === []) {
277 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_checkbox'));
284 $this->
ctrl->redirectToURL(
291 'sig' => $this->gui->createMailSignature(),
303 $this->tpl->setContent($form->getHTML());
318 $this->
lng->loadLanguageModule(
'mail');
321 $form->setTitle($this->
lng->txt(
'mail_members'));
323 $form->setFormAction($this->
ctrl->getFormAction($this,
'nextMailForm'));
327 $form->addItem($radio_grp);
328 $form->addCommandButton(
'nextMailForm', $this->
lng->txt(
'mail_members_search_continue'));
329 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
348 $radio_sel_users =
new ilRadioOption($this->
lng->txt(
'mail_sel_users'),
'mail_sel_users');
350 $radio_roles =
new ilRadioOption($this->objMailMemberRoles->getRadioOptionTitle(),
'mail_member_roles');
351 foreach ($mail_roles as $role) {
352 $chk_role =
new ilCheckboxInputGUI($role[
'form_option_title'],
'roles[' . $role[
'role_id'] .
']');
354 if (isset($role[
'default_checked']) && $role[
'default_checked']) {
355 $chk_role->setChecked(
true);
357 $chk_role->setValue((
string) $role[
'role_id']);
358 $chk_role->setInfo($role[
'mailbox']);
362 $radio_grp->setValue(
'mail_member_roles');
364 $radio_grp->addOption($radio_sel_users);
365 $radio_grp->addOption($radio_roles);
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readonly ilCtrlInterface $ctrl
const PROP_CONTEXT_SUBJECT_PREFIX
readonly ilAccessHandler $access
readonly Renderer $ui_renderer
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _lookupObjId(int $ref_id)
const EXTERNAL_MAIL_PREFIX
static http()
Fetches the global http state from ILIAS.
ilParticipants $objParticipants
sendMailToSelectedUsers()
readonly ILIAS UI Factory $ui_factory
readonly ilGlobalTemplateInterface $tpl
redirectToParentReferer()
setObjParticipants(ilParticipants $objParticipants)
readonly Factory $refinery
Base class for course and group participants.
readonly array $mail_roles
readonly ServerRequestInterface $httpRequest
static _lookupType(int $id, bool $reference=false)
handleSearchMembersActions()
Class ilAbstractMailMemberRoles.
static set(string $a_var, $a_val)
Set a value.
__construct(private readonly object $gui, public int $ref_id, private readonly ilAbstractMailMemberRoles $objMailMemberRoles)
static _lookupLogin(int $a_user_id)