ILIAS  Release_3_10_x_branch Revision 61812
 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  $this->tpl = new ilTemplate('tpl.navigation_header.html',true,true,'Services/Calendar');
75  $this->seed->increment($this->increment,-2);
76  $num = 0;
77  do
78  {
79  switch($this->increment)
80  {
81  case ilDateTime::DAY:
82  $this->tpl->setVariable('NAV_NAME_'.++$num,ilCalendarUtil::_numericDayToString($this->seed->get(IL_CAL_FKT_DATE,'w')));
83  break;
84 
85  case ilDateTime::WEEK:
86  $this->tpl->setVariable('NAV_NAME_'.++$num,$this->lng->txt('week').' '.$this->seed->get(IL_CAL_FKT_DATE,'W'));
87  break;
88 
89  case ilDateTime::MONTH:
90  if($num == 2)
91  {
92  $this->tpl->setVariable('NAV_NAME_'.++$num,
93  $this->lng->txt('month_'.$this->seed->get(IL_CAL_FKT_DATE,'m').'_long').
94  ' '.$this->seed->get(IL_CAL_FKT_DATE,'Y'));
95  }
96  else
97  {
98  $this->tpl->setVariable('NAV_NAME_'.++$num,$this->lng->txt('month_'.$this->seed->get(IL_CAL_FKT_DATE,'m').'_long'));
99  }
100  break;
101  }
102  $this->ctrl->setParameterByClass(get_class($this->cmdClass),'seed',$this->seed->get(IL_CAL_DATE));
103  $this->tpl->setVariable('NAV_LINK_'.$num,$this->ctrl->getLinkTarget($this->cmdClass,''));
104  $this->ctrl->clearParametersByClass(get_class($this->cmdClass));
105  $this->seed->increment($this->increment,1);
106  } while($num < 6);
107 
108  return $this->tpl->get();
109  }
110 }
111 
112 ?>