ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
FormMailCodesGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
35 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
36 
38 {
39  protected $guiclass;
40  protected $subject;
41  protected $sendtype;
42  protected $savedmessages;
43  protected $mailmessage;
44  protected $savemessage;
45  protected $savemessagetitle;
46 
47  public function __construct($guiclass)
48  {
49  global $DIC;
50 
51  parent::__construct();
52 
53  $ilAccess = $DIC->access();
54  $ilSetting = $DIC->settings();
55  $ilUser = $DIC->user();
56  $rbacsystem = $DIC->rbac()->system();
57 
58  $lng = $this->lng;
59 
60  $this->guiclass = $guiclass;
61 
62  $this->setFormAction($this->ctrl->getFormAction($this->guiclass));
63  $this->setTitle($this->lng->txt('compose'));
64 
65  $this->subject = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
66  $this->subject->setSize(50);
67  $this->subject->setRequired(true);
68  $this->addItem($this->subject);
69 
70  $this->sendtype = new ilRadioGroupInputGUI($this->lng->txt('recipients'), "m_notsent");
71  $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_all"), 0, ''));
72  $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("not_sent_only"), 1, ''));
73  $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_unanswered"), 3, ''));
74  $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_answered"), 2, ''));
75  $this->addItem($this->sendtype);
76 
77  $existingdata = $this->guiclass->getObject()->getExternalCodeRecipients();
78 
79  $existingcolumns = array();
80  if (count($existingdata)) {
81  $first = array_shift($existingdata);
82  foreach ($first as $key => $value) {
83  if (strcmp($key, 'code') != 0 && strcmp($key, 'email') != 0 && strcmp($key, 'sent') != 0) {
84  array_push($existingcolumns, '[' . $key . ']');
85  }
86  }
87  }
88 
89  $settings = $this->guiclass->getObject()->getUserSettings($ilUser->getId(), 'savemessage');
90  if (count($settings)) {
91  $options = array(0 => $this->lng->txt('please_select'));
92  foreach ($settings as $setting) {
93  $options[$setting['settings_id']] = $setting['title'];
94  }
95  $this->savedmessages = new ilSelectInputGUI($this->lng->txt("saved_messages"), "savedmessage");
96  $this->savedmessages->setOptions($options);
97  $this->addItem($this->savedmessages);
98  }
99 
100  $this->mailmessage = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
101  $this->mailmessage->setRequired(true);
102  $this->mailmessage->setCols(80);
103  $this->mailmessage->setRows(10);
104  $this->mailmessage->setInfo(sprintf($this->lng->txt('message_content_info'), join($existingcolumns, ', ')));
105  $this->addItem($this->mailmessage);
106 
107  // save message
108  $this->savemessage = new ilCheckboxInputGUI('', "savemessage");
109  $this->savemessage->setOptionTitle($this->lng->txt("save_reuse_message"));
110  $this->savemessage->setValue(1);
111 
112  $this->savemessagetitle = new ilTextInputGUI($this->lng->txt('save_reuse_title'), 'savemessagetitle');
113  $this->savemessagetitle->setSize(60);
114  $this->savemessage->addSubItem($this->savemessagetitle);
115 
116  $this->addItem($this->savemessage);
117 
118  if (count($settings)) {
119  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
120  $this->addCommandButton("deleteSavedMessage", $this->lng->txt("delete_saved_message"));
121  }
122  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
123  $this->addCommandButton("insertSavedMessage", $this->lng->txt("insert_saved_message"));
124  }
125  }
126 
127  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $rbacsystem->checkAccess('smtp_mail', ilMailGlobalServices::getMailObjectRefId())) {
128  if ((int) $ilSetting->get('mail_allow_external')) {
129  $this->addCommandButton("sendCodesMail", $this->lng->txt("send"));
130  } else {
131  ilUtil::sendInfo($lng->txt("cant_send_email_smtp_disabled"));
132  }
133  } else {
134  ilUtil::sendInfo($lng->txt("cannot_send_emails"));
135  }
136  }
137 
138  public function getSavedMessages()
139  {
140  return $this->savedmessages;
141  }
142 
143  public function getMailMessage()
144  {
145  return $this->mailmessage;
146  }
147 }
This class represents an option in a checkbox group.
This class represents a selection list property in a property form.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
This class represents a checkbox property in a property form.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
__construct($guiclass)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class represents a property in a property form.
addOption($a_option)
Add Option.
setTitle($a_title)
Set Title.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
$ilUser
Definition: imgupload.php:18
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
This class represents a text area property in a property form.
Class FormMailCodesGUI.
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable...
$key
Definition: croninfo.php:18
setRequired($a_required)
Set Required.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20