ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
FormMailCodesGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected \ILIAS\Survey\Editing\EditingGUIRequest $request;
34
35 public function __construct(
37 ) {
38 global $DIC;
39 $main_tpl = $DIC->ui()->mainTemplate();
40
42
43 $ilAccess = $DIC->access();
44 $ilSetting = $DIC->settings();
45 $ilUser = $DIC->user();
46 $this->request = $DIC->survey()
47 ->internal()
48 ->gui()
49 ->editing()
50 ->request();
51
53
54 $this->guiclass = $guiclass;
55
56 $this->setFormAction($this->ctrl->getFormAction($this->guiclass));
57 $this->setTitle($this->lng->txt('compose'));
58
59 $this->subject = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
60 $this->subject->setSize(50);
61 $this->subject->setRequired(true);
62 $this->addItem($this->subject);
63
64 $this->sendtype = new ilRadioGroupInputGUI($this->lng->txt('recipients'), "m_notsent");
65 $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_all"), 0, ''));
66 $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("not_sent_only"), 1, ''));
67 $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_unanswered"), 3, ''));
68 $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_answered"), 2, ''));
69 $this->addItem($this->sendtype);
70
71 $existingdata = $this->guiclass->getObject()->getExternalCodeRecipients();
72
73 $existingcolumns = array();
74 if (count($existingdata)) {
75 $first = array_shift($existingdata);
76 foreach ($first as $key => $value) {
77 if (strcmp($key, 'code') !== 0 && strcmp($key, 'email') !== 0 && strcmp($key, 'sent') !== 0) {
78 $existingcolumns[] = '[' . $key . ']';
79 }
80 }
81 }
82
83 $settings = $this->guiclass->getObject()->getUserSettings($ilUser->getId(), 'savemessage');
84 if (count($settings)) {
85 $options = array(0 => $this->lng->txt('please_select'));
86 foreach ($settings as $setting) {
87 $options[$setting['settings_id']] = $setting['title'];
88 }
89 $this->savedmessages = new ilSelectInputGUI($this->lng->txt("saved_messages"), "savedmessage");
90 $this->savedmessages->setOptions($options);
91 $this->addItem($this->savedmessages);
92 }
93
94 $this->mailmessage = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
95 $this->mailmessage->setRequired(true);
96 $this->mailmessage->setCols(80);
97 $this->mailmessage->setRows(10);
98 $this->mailmessage->setInfo(sprintf($this->lng->txt('message_content_info'), implode(', ', $existingcolumns)));
99 $this->addItem($this->mailmessage);
100
101 // save message
102 $this->savemessage = new ilCheckboxInputGUI('', "savemessage");
103 $this->savemessage->setOptionTitle($this->lng->txt("save_reuse_message"));
104 $this->savemessage->setValue(1);
105
106 $this->savemessagetitle = new ilTextInputGUI($this->lng->txt('save_reuse_title'), 'savemessagetitle');
107 $this->savemessagetitle->setSize(60);
108 $this->savemessage->addSubItem($this->savemessagetitle);
109
110 $this->addItem($this->savemessage);
111
112 if (count($settings)) {
113 if ($ilAccess->checkAccess("write", "", $this->request->getRefId())) {
114 $this->addCommandButton("deleteSavedMessage", $this->lng->txt("delete_saved_message"));
115 }
116 if ($ilAccess->checkAccess("write", "", $this->request->getRefId())) {
117 $this->addCommandButton("insertSavedMessage", $this->lng->txt("insert_saved_message"));
118 }
119 }
120
121 if ((int) $ilSetting->get('mail_allow_external')) {
122 $this->addCommandButton("sendCodesMail", $this->lng->txt("send"));
123 } else {
124 $main_tpl->setOnScreenMessage('info', $lng->txt("cant_send_email_smtp_disabled"));
125 }
126 }
127
129 {
131 }
132
134 {
135 return $this->mailmessage;
136 }
137}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilTextInputGUI $subject
ilTextAreaInputGUI $mailmessage
ilSelectInputGUI $savedmessages
ILIAS Survey Editing EditingGUIRequest $request
__construct(ilSurveyParticipantsGUI $guiclass)
ilRadioGroupInputGUI $sendtype
ilTextInputGUI $savemessagetitle
ilCheckboxInputGUI $savemessage
ilSurveyParticipantsGUI $guiclass
This class represents a checkbox property in a property form.
This class represents an option in a checkbox group.
setFormAction(string $a_formaction)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This class represents a property in a property form.
This class represents a selection list property in a property form.
Class ilSurveyParticipantsGUI.
This class represents a text area property in a property form.
This class represents a text property in a property form.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26