ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  private $lng;
40  private $guiclass;
41  private $subject;
42  private $messagetype;
43  private $sendtype;
44  private $savedmessages;
45  private $mailmessage;
46  private $savemessage;
48 
50  {
52 
53  global $lng;
54  global $ilAccess;
55 
56  $this->lng = &$lng;
57  $this->guiclass = &$guiclass;
58 
59  $this->setFormAction($guiclass->ctrl->getFormAction($this->guiclass));
60  $this->setTitle($this->lng->txt('compose'));
61 
62  $this->subject = new ilTextInputGUI($this->lng->txt('subject'), 'm_subject');
63  $this->subject->setSize(50);
64  $this->subject->setRequired(true);
65  $this->addItem($this->subject);
66 
67  $this->sendtype = new ilRadioGroupInputGUI($this->lng->txt('recipients'), "m_notsent");
68  $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_all"), 0, ''));
69  $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("not_sent_only"), 1, ''));
70  $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_unanswered"), 3, ''));
71  $this->sendtype->addOption(new ilCheckboxOption($this->lng->txt("send_to_answered"), 2, ''));
72  $this->addItem($this->sendtype);
73 
74  $existingdata = $this->guiclass->object->getExternalCodeRecipients();
75  $existingcolumns = array();
76  if (count($existingdata))
77  {
78  $first = array_shift($existingdata);
79  foreach ($first as $key => $value)
80  {
81  if (strcmp($key, 'code') != 0 && strcmp($key, 'email') != 0 && strcmp($key, 'sent') != 0) array_push($existingcolumns, '[' . $key . ']');
82  }
83  }
84 
85  global $ilUser;
86  $settings = $this->guiclass->object->getUserSettings($ilUser->getId(), 'savemessage');
87  if (count($settings))
88  {
89  $options = array(0 => $this->lng->txt('please_select'));
90  foreach ($settings as $setting)
91  {
92  $options[$setting['settings_id']] = $setting['title'];
93  }
94  $this->savedmessages = new ilSelectInputGUI($this->lng->txt("saved_messages"), "savedmessage");
95  $this->savedmessages->setOptions($options);
96  $this->addItem($this->savedmessages);
97  }
98 
99  $this->mailmessage = new ilTextAreaInputGUI($this->lng->txt('message_content'), 'm_message');
100  $this->mailmessage->setRequired(true);
101  $this->mailmessage->setCols(80);
102  $this->mailmessage->setRows(10);
103  $this->mailmessage->setInfo(sprintf($this->lng->txt('message_content_info'), join($existingcolumns, ', ')));
104  $this->addItem($this->mailmessage);
105 
106  // save message
107  $this->savemessage = new ilCheckboxInputGUI('', "savemessage");
108  $this->savemessage->setOptionTitle($this->lng->txt("save_reuse_message"));
109  $this->savemessage->setValue(1);
110 
111  $this->savemessagetitle = new ilTextInputGUI($this->lng->txt('save_reuse_title'), 'savemessagetitle');
112  $this->savemessagetitle->setSize(60);
113  $this->savemessage->addSubItem($this->savemessagetitle);
114 
115  $this->addItem($this->savemessage);
116 
117  if (count($settings))
118  {
119  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) $this->addCommandButton("deleteSavedMessage", $this->lng->txt("delete_saved_message"));
120  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) $this->addCommandButton("insertSavedMessage", $this->lng->txt("insert_saved_message"));
121  }
122  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) $this->addCommandButton("sendCodesMail", $this->lng->txt("send"));
123  }
124 
125  public function getSavedMessages()
126  {
127  return $this->savedmessages;
128  }
129 
130  public function getMailMessage()
131  {
132  return $this->mailmessage;
133  }
134 }
135 
136 ?>