ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCalendarHeaderNavigationGUI.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 
24 include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
25 
37 {
38  protected $cmdClass = null;
39  protected $seed = null;
40  protected $increment = '';
41 
42  protected $html;
43  protected $lng;
44  protected $tpl;
45 
54  public function __construct($cmdClass,ilDate $seed,$a_increment)
55  {
56  global $lng,$ilCtrl;
57 
58  $this->lng = $lng;
59 
60  $this->ctrl = $ilCtrl;
61  $this->cmdClass = $cmdClass;
62  $this->seed = clone $seed;
63  $this->increment = $a_increment;
64  }
65 
72  public function getHTML()
73  {
74  global $lng;
75 
76  $this->tpl = new ilTemplate('tpl.navigation_header.html',true,true,'Services/Calendar');
77 
78  $this->seed->increment($this->increment,-2);
79  $num = 0;
80  do
81  {
82  switch($this->increment)
83  {
84  case ilDateTime::DAY:
85  $this->tpl->setVariable('NAV_NAME_'.++$num,ilCalendarUtil::_numericDayToString($this->seed->get(IL_CAL_FKT_DATE,'w')));
86  break;
87 
88  case ilDateTime::WEEK:
89  $this->tpl->setVariable('NAV_NAME_'.++$num,$this->lng->txt('week').' '.$this->seed->get(IL_CAL_FKT_DATE,'W'));
90  break;
91 
92  case ilDateTime::MONTH:
93  if($num == 2)
94  {
95  $this->tpl->setVariable('NAV_NAME_'.++$num,
96  $this->lng->txt('month_'.$this->seed->get(IL_CAL_FKT_DATE,'m').'_long').
97  ' '.$this->seed->get(IL_CAL_FKT_DATE,'Y'));
98  }
99  else
100  {
101  $this->tpl->setVariable('NAV_NAME_'.++$num,$this->lng->txt('month_'.$this->seed->get(IL_CAL_FKT_DATE,'m').'_long'));
102  }
103  break;
104  }
105  $this->ctrl->setParameterByClass(get_class($this->cmdClass),'seed',$this->seed->get(IL_CAL_DATE));
106  $this->tpl->setVariable('NAV_LINK_'.$num,$this->ctrl->getLinkTarget($this->cmdClass,''));
107  $this->ctrl->clearParametersByClass(get_class($this->cmdClass));
108  $this->seed->increment($this->increment,1);
109  } while($num < 6);
110 
111  // header
112  switch ($this->increment)
113  {
114  case ilDateTime::DAY:
115  $this->tpl->setVariable('TXT_SELECT_TITLE', $lng->txt("cal_day_selection"));
116  $this->tpl->setVariable('TXT_VIEW_HEAD', $lng->txt("cal_day_overview"));
117  break;
118 
119  case ilDateTime::WEEK:
120  $this->tpl->setVariable('TXT_SELECT_TITLE', $lng->txt("cal_week_selection"));
121  $this->tpl->setVariable('TXT_VIEW_HEAD', $lng->txt("cal_week_overview"));
122  break;
123 
124  case ilDateTime::MONTH:
125  $this->tpl->setVariable('TXT_SELECT_TITLE', $lng->txt("cal_month_selection"));
126  $this->tpl->setVariable('TXT_VIEW_HEAD', $lng->txt("cal_month_overview"));
127  break;
128  }
129  $this->tpl->setVariable('TXT_SELECTED', $lng->txt("stat_selected"));
130 
131  return $this->tpl->get();
132  }
133 }
134 
135 ?>