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