19 declare(strict_types=1);
48 private readonly
object $gui,
54 $this->
ctrl = $DIC[
'ilCtrl'];
55 $this->tpl = $DIC[
'tpl'];
56 $this->
lng = $DIC[
'lng'];
57 $this->
access = $DIC[
'ilAccess'];
58 $this->httpRequest = $DIC->http()->request();
60 $this->ui_factory = $DIC->ui()->factory();
61 $this->ui_renderer = $DIC->ui()->renderer();
63 $this->
http = $DIC->http();
65 $this->
lng->loadLanguageModule(
'mail');
66 $this->
lng->loadLanguageModule(
'search');
67 $this->mail_roles = $objMailMemberRoles->getMailRoles($ref_id);
72 $action = $this->
http->wrapper()->query()->retrieve(
73 'contact_search_members_action',
75 $this->refinery->kindlyTo()->string(),
81 default => $this->
ctrl->redirect($this,
'showSelectableUsers'),
87 $cmd = $this->
ctrl->getCmd();
89 $this->
ctrl->setReturn($this,
'');
92 case 'handleSearchMembersActions':
96 case 'showSelectableUsers':
109 if (isset($this->httpRequest->getQueryParams()[
'returned_from_mail']) &&
110 $this->httpRequest->getQueryParams()[
'returned_from_mail'] ===
'1') {
129 $back_link = $this->
ctrl->getParentReturn($this);
131 if (isset($this->httpRequest->getServerParams()[
'HTTP_REFERER'])) {
132 $referer = $this->httpRequest->getServerParams()[
'HTTP_REFERER'];
133 $urlParts = parse_url($referer);
134 if (is_array($urlParts) && isset($urlParts[
'path'])) {
135 $url = ltrim(basename($urlParts[
'path']),
'/');
136 if (isset($urlParts[
'query'])) {
137 $url .=
'?' . $urlParts[
'query'];
161 $form = $form->withRequest($this->
http->request());
162 if (!$form->getError()) {
163 $data = $form->getData();
165 if (isset(
$data[
'mail_member_type']) &&
$data[
'mail_member_type'][0] ===
'mail_member_roles') {
166 if (
$data[
'mail_member_type'][1]) {
167 $role_mail_boxes = [];
168 $roles =
$data[
'mail_member_type'][1];
169 foreach ($roles as $role_id => $enabled) {
171 $role_mail_boxes[] = $this->objMailMemberRoles->getMailboxRoleAddress((
int) $role_id);
177 $this->
ctrl->redirectToURL(
184 'rcp_to' => implode(
',', $role_mail_boxes),
185 'sig' => $this->gui->createMailSignature()
191 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_checkbox'));
208 $contextParameters = [];
214 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
215 $contextParameters = [
225 if (
'crs' === $type) {
232 if ($this->
access->checkAccess(
'write',
'', $this->ref_id)) {
233 $contextParameters = [
242 return $contextParameters;
247 $this->tpl->loadStandardTemplate();
251 $this->tpl->setContent($this->ui_renderer->render($tbl->getComponent()));
256 $selected_user_ids = $this->
http->wrapper()->query()->retrieve(
257 'contact_search_members_user_ids',
259 $this->refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->string()),
264 if ((
string) current($selected_user_ids) ===
'ALL_OBJECTS') {
265 $selected_user_ids = [];
269 foreach ($entries as $entry) {
270 $selected_user_ids[] = (
int) $entry[
'user_id'];
273 $selected_user_ids =
array_map(intval(...), $selected_user_ids);
277 foreach ($selected_user_ids as $usr_id) {
281 if (array_filter($rcps) === []) {
282 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'no_checkbox'));
289 $this->
ctrl->redirectToURL(
296 'sig' => $this->gui->createMailSignature(),
310 $this->tpl->setContent($this->ui_renderer->render($form));
325 $this->
lng->loadLanguageModule(
'mail');
327 return $this->ui_factory->input()->container()->form()->standard(
328 $this->
ctrl->getFormAction($this,
'nextMailForm'),
349 foreach ($mail_roles as $role) {
350 $chk_role = $this->ui_factory->input()->field()->checkbox($role[
'form_option_title'], $role[
'mailbox']);
351 $sub_items[$role[
'role_id']] = $chk_role;
352 if (isset($role[
'default_checked']) && $role[
'default_checked']) {
353 $values[$role[
'role_id']] =
true;
355 $values[$role[
'role_id']] =
false;
359 return $this->ui_factory->input()->field()->switchableGroup(
361 'mail_sel_users' => $this->ui_factory->input()->field()->group([], $this->
lng->txt(
'mail_sel_users')),
362 'mail_member_roles' => $this->ui_factory->input()->field()->group(
364 $this->objMailMemberRoles->getRadioOptionTitle()
367 $this->
lng->txt(
'mail_sel_label')
static get(string $a_var)
readonly ilCtrlInterface $ctrl
Interface Observer Contains several chained tasks and infos about them.
const PROP_CONTEXT_SUBJECT_PREFIX
readonly ilAccessHandler $access
readonly Renderer $ui_renderer
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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()
showSearchForm(?StandardForm $form=null)
setObjParticipants(ilParticipants $objParticipants)
readonly Factory $refinery
Base class for course and group participants.
readonly array $mail_roles
readonly ServerRequestInterface $httpRequest
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
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)