ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
FormMailCodesGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
12 protected $guiclass;
13 protected $subject;
14 protected $sendtype;
15 protected $savedmessages;
16 protected $mailmessage;
17 protected $savemessage;
19
20 public function __construct($guiclass)
21 {
22 global $DIC;
23
25
26 $ilAccess = $DIC->access();
27 $ilSetting = $DIC->settings();
28 $ilUser = $DIC->user();
29 $rbacsystem = $DIC->rbac()->system();
30
32
33 $this->guiclass = $guiclass;
34
35 $this->setFormAction($this->ctrl->getFormAction($this->guiclass));
36 $this->setTitle($this->lng->txt('compose'));
37
38 $this->subject = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
39 $this->subject->setSize(50);
40 $this->subject->setRequired(true);
41 $this->addItem($this->subject);
42
43 $this->sendtype = new ilRadioGroupInputGUI($this->lng->txt('recipients'), "m_notsent");
44 $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_all"), 0, ''));
45 $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("not_sent_only"), 1, ''));
46 $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_unanswered"), 3, ''));
47 $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_answered"), 2, ''));
48 $this->addItem($this->sendtype);
49
50 $existingdata = $this->guiclass->getObject()->getExternalCodeRecipients();
51
52 $existingcolumns = array();
53 if (count($existingdata)) {
54 $first = array_shift($existingdata);
55 foreach ($first as $key => $value) {
56 if (strcmp($key, 'code') != 0 && strcmp($key, 'email') != 0 && strcmp($key, 'sent') != 0) {
57 array_push($existingcolumns, '[' . $key . ']');
58 }
59 }
60 }
61
62 $settings = $this->guiclass->getObject()->getUserSettings($ilUser->getId(), 'savemessage');
63 if (count($settings)) {
64 $options = array(0 => $this->lng->txt('please_select'));
65 foreach ($settings as $setting) {
66 $options[$setting['settings_id']] = $setting['title'];
67 }
68 $this->savedmessages = new ilSelectInputGUI($this->lng->txt("saved_messages"), "savedmessage");
69 $this->savedmessages->setOptions($options);
70 $this->addItem($this->savedmessages);
71 }
72
73 $this->mailmessage = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
74 $this->mailmessage->setRequired(true);
75 $this->mailmessage->setCols(80);
76 $this->mailmessage->setRows(10);
77 $this->mailmessage->setInfo(sprintf($this->lng->txt('message_content_info'), join(', ', $existingcolumns)));
78 $this->addItem($this->mailmessage);
79
80 // save message
81 $this->savemessage = new ilCheckboxInputGUI('', "savemessage");
82 $this->savemessage->setOptionTitle($this->lng->txt("save_reuse_message"));
83 $this->savemessage->setValue(1);
84
85 $this->savemessagetitle = new ilTextInputGUI($this->lng->txt('save_reuse_title'), 'savemessagetitle');
86 $this->savemessagetitle->setSize(60);
87 $this->savemessage->addSubItem($this->savemessagetitle);
88
89 $this->addItem($this->savemessage);
90
91 if (count($settings)) {
92 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
93 $this->addCommandButton("deleteSavedMessage", $this->lng->txt("delete_saved_message"));
94 }
95 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
96 $this->addCommandButton("insertSavedMessage", $this->lng->txt("insert_saved_message"));
97 }
98 }
99
100 if ((int) $ilSetting->get('mail_allow_external')) {
101 $this->addCommandButton("sendCodesMail", $this->lng->txt("send"));
102 } else {
103 ilUtil::sendInfo($lng->txt("cant_send_email_smtp_disabled"));
104 }
105 }
106
107 public function getSavedMessages()
108 {
110 }
111
112 public function getMailMessage()
113 {
114 return $this->mailmessage;
115 }
116}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Class FormMailCodesGUI.
__construct($guiclass)
This class represents a checkbox property in a property form.
This class represents an option in a checkbox group.
setFormAction($a_formaction)
Set FormAction.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
setTitle($a_title)
Set Title.
This class represents a property in a property form.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46