ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 $tpl,$lng;
49 
50  $this->form = $a_form;
51  $this->recurrence = $a_recurrence;
52 
53  $this->lng = $lng;
54  $this->lng->loadLanguageModule('dateplaner');
55 
56  }
57 
65  public function setRecurrence($a_rec)
66  {
67  $this->recurrence = $a_rec;
68  }
69 
77  public function initForm()
78  {
79  $rec = new ilSelectInputGUI($this->lng->txt('cal_recurrences'),'frequence');
80  $rec->setRequired(true);
81  $rec->setOptions(
82  array(0 => $this->lng->txt('cal_no_recurrence'),
83  ilCalendarRecurrence::FREQ_DAILY => $this->lng->txt('cal_rec_daily'),
84  ilCalendarRecurrence::FREQ_WEEKLY => $this->lng->txt('cal_rec_weekly'),
85  ilCalendarRecurrence::FREQ_MONTHLY => $this->lng->txt('cal_rec_monthly'),
86  ilCalendarRecurrence::FREQ_YEARLY => $this->lng->txt('cal_rec_yearly')));
87  $rec->setValue($this->recurrence->getFrequenceType());
88  $this->form->addItem($rec);
89 
90  // DAILY part
91  $interval = new ilTextInputGUI($this->lng->txt('interval'),'interval');
92  $interval->setSize(2);
93  $interval->setMaxLength(3);
94  $interval->setValue($this->recurrence->getInterval() ? $this->recurrence->getInterval() : 1);
95  $interval->setInfo($this->lng->txt('interval_info'));
96  $rec->addSubItem($interval);
97 
98  // Weekly
99  $check = new ilCheckboxInputGUI($this->lng->txt('Su_short'),'w_day[0]');
100  $check->setChecked(true);
101  $rec->addSubItem($check);
102  $check = new ilCheckboxInputGUI($this->lng->txt('Mo_short'),'w_day[1]');
103  $check->setChecked(true);
104  $rec->addSubItem($check);
105  $check = new ilCheckboxInputGUI($this->lng->txt('Tu_short'),'w_day[2]');
106  $check->setChecked(true);
107  $rec->addSubItem($check);
108  $check = new ilCheckboxInputGUI($this->lng->txt('We_short'),'w_day[3]');
109  $check->setChecked(true);
110  $rec->addSubItem($check);
111  $check = new ilCheckboxInputGUI($this->lng->txt('Th_short'),'w_day[4]');
112  $check->setChecked(true);
113  $rec->addSubItem($check);
114  $check = new ilCheckboxInputGUI($this->lng->txt('Fr_short'),'w_day[5]');
115  $check->setChecked(true);
116  $rec->addSubItem($check);
117  $check = new ilCheckboxInputGUI($this->lng->txt('Sa_short'),'w_day[6]');
118  $check->setChecked(true);
119  $rec->addSubItem($check);
120  }
121 
122 
123 }
124 ?>