ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCalendarRecurrenceGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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 
35 {
36  protected $form;
37  protected $appointment;
38  protected $recurrence;
39 
46  public function __construct($a_form, $a_recurrence)
47  {
48  global $DIC;
49 
50  $tpl = $DIC['tpl'];
51  $lng = $DIC['lng'];
52 
53  $this->form = $a_form;
54  $this->recurrence = $a_recurrence;
55 
56  $this->lng = $lng;
57  $this->lng->loadLanguageModule('dateplaner');
58  }
59 
67  public function setRecurrence($a_rec)
68  {
69  $this->recurrence = $a_rec;
70  }
71 
79  public function initForm()
80  {
81  $rec = new ilSelectInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
82  $rec->setRequired(true);
83  $rec->setOptions(
84  array(0 => $this->lng->txt('cal_no_recurrence'),
85  ilCalendarRecurrence::FREQ_DAILY => $this->lng->txt('cal_rec_daily'),
86  ilCalendarRecurrence::FREQ_WEEKLY => $this->lng->txt('cal_rec_weekly'),
87  ilCalendarRecurrence::FREQ_MONTHLY => $this->lng->txt('cal_rec_monthly'),
88  ilCalendarRecurrence::FREQ_YEARLY => $this->lng->txt('cal_rec_yearly'))
89  );
90  $rec->setValue($this->recurrence->getFrequenceType());
91  $this->form->addItem($rec);
92 
93  // DAILY part
94  $interval = new ilTextInputGUI($this->lng->txt('interval'), 'interval');
95  $interval->setSize(2);
96  $interval->setMaxLength(3);
97  $interval->setValue($this->recurrence->getInterval() ? $this->recurrence->getInterval() : 1);
98  $interval->setInfo($this->lng->txt('interval_info'));
99  $rec->addSubItem($interval);
100 
101  // Weekly
102  $check = new ilCheckboxInputGUI($this->lng->txt('Su_short'), 'w_day[0]');
103  $check->setChecked(true);
104  $rec->addSubItem($check);
105  $check = new ilCheckboxInputGUI($this->lng->txt('Mo_short'), 'w_day[1]');
106  $check->setChecked(true);
107  $rec->addSubItem($check);
108  $check = new ilCheckboxInputGUI($this->lng->txt('Tu_short'), 'w_day[2]');
109  $check->setChecked(true);
110  $rec->addSubItem($check);
111  $check = new ilCheckboxInputGUI($this->lng->txt('We_short'), 'w_day[3]');
112  $check->setChecked(true);
113  $rec->addSubItem($check);
114  $check = new ilCheckboxInputGUI($this->lng->txt('Th_short'), 'w_day[4]');
115  $check->setChecked(true);
116  $rec->addSubItem($check);
117  $check = new ilCheckboxInputGUI($this->lng->txt('Fr_short'), 'w_day[5]');
118  $check->setChecked(true);
119  $rec->addSubItem($check);
120  $check = new ilCheckboxInputGUI($this->lng->txt('Sa_short'), 'w_day[6]');
121  $check->setChecked(true);
122  $rec->addSubItem($check);
123  }
124 }
This class represents a selection list property in a property form.
global $DIC
Definition: saml.php:7
$tpl
Definition: ilias.php:10
This class represents a checkbox property in a property form.
setChecked($a_checked)
Set Checked.
$lng
setSize($a_size)
Set Size.
This class represents a text property in a property form.
__construct($a_form, $a_recurrence)
Constructor.
setRecurrence($a_rec)
set recurrence object
GUI class for calendar recurrences.
setRequired($a_required)
Set Required.