ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMiniCalendarGUI Class Reference
+ Collaboration diagram for ilMiniCalendarGUI:

Public Member Functions

 __construct (ilDate $seed, $a_par_obj)
 Constructor. More...
 
 setParentObject ($a_parentobject)
 Set Parent GUI object. More...
 
 getParentObject ()
 Get Parent GUI object. More...
 
 getHTML ()
 Get HTML for calendar. More...
 
 addMiniMonth ($a_tpl)
 Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab. More...
 

Data Fields

const PRESENTATION_CALENDAR = 1
 

Protected Attributes

 $seed
 
 $mode = null
 
 $user_settings = null
 
 $tpl = null
 
 $lng
 

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 33 of file class.ilMiniCalendarGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMiniCalendarGUI::__construct ( ilDate  $seed,
  $a_par_obj 
)

Constructor.

public

Parameters

Definition at line 50 of file class.ilMiniCalendarGUI.php.

References $ilUser, $lng, $seed, ilCalendarUserSettings\_getInstanceByUserId(), and setParentObject().

51  {
52  global $ilUser,$lng;
53 
54  $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
55  $this->tpl = new ilTemplate('tpl.minical.html',true,true,'Services/Calendar');
56  $this->lng = $lng;
57  $this->lng->loadLanguageModule('dateplaner');
58  $this->seed = $seed;
59  $this->setParentObject($a_par_obj);
60  }
static _getInstanceByUserId($a_user_id)
get singleton instance
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
setParentObject($a_parentobject)
Set Parent GUI object.
+ Here is the call graph for this function:

Member Function Documentation

◆ addMiniMonth()

ilMiniCalendarGUI::addMiniMonth (   $a_tpl)

Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.

Definition at line 105 of file class.ilMiniCalendarGUI.php.

References $counter, $ilCtrl, $ilUser, $lng, ilDateTime\_before(), ilCalendarUtil\_buildMonthDayList(), ilDateTime\_equals(), ilCalendarUtil\_isToday(), ilCalendarUtil\_numericDayToString(), getParentObject(), IL_CAL_DATE, IL_CAL_FKT_DATE, IL_CAL_MONTH, ilDateTime\MONTH, and ilCalendarSchedule\TYPE_MONTH.

Referenced by getHTML().

106  {
107  global $ilCtrl, $lng,$ilUser;
108 
109  // weekdays
110  include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
111  $a_tpl->setCurrentBlock('month_header_col');
112  $a_tpl->setVariable('TXT_WEEKDAY', $lng->txt("cal_week_abbrev"));
113  $a_tpl->parseCurrentBlock();
114  for($i = (int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++)
115  {
116  $a_tpl->setCurrentBlock('month_header_col');
117  $a_tpl->setVariable('TXT_WEEKDAY',ilCalendarUtil::_numericDayToString($i,false));
118  $a_tpl->parseCurrentBlock();
119  }
120 
121  include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
122  $this->scheduler = new ilCalendarSchedule($this->seed,ilCalendarSchedule::TYPE_MONTH);
123  $this->scheduler->calculate();
124 
125  $counter = 0;
126  foreach(ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE,'m'),
127  $this->seed->get(IL_CAL_FKT_DATE,'Y'),
128  $this->user_settings->getWeekStart())->get() as $date)
129  {
130  $counter++;
131  //$this->showEvents($date);
132 
133 
134  $a_tpl->setCurrentBlock('month_col');
135 
136  if(count($this->scheduler->getByDay($date,$ilUser->getTimeZone())))
137  {
138  $a_tpl->setVariable('DAY_CLASS','calminiapp');
139  #$a_tpl->setVariable('TD_CLASS','calminiapp');
140  }
141 
142  include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
143  if(ilCalendarUtil::_isToday($date))
144  {
145  $a_tpl->setVariable('TD_CLASS','calminitoday');
146  }
147  #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
148  #{
149  # $a_tpl->setVariable('TD_CLASS','calmininow');
150  #}
151  elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_MONTH))
152  {
153  $a_tpl->setVariable('TD_CLASS','calministd');
154  }
155  elseif(ilDateTime::_before($date,$this->seed,IL_CAL_MONTH))
156  {
157  $a_tpl->setVariable('TD_CLASS','calminiprev');
158  }
159  else
160  {
161  $a_tpl->setVariable('TD_CLASS','calmininext');
162  }
163 
164  $day = $date->get(IL_CAL_FKT_DATE,'j');
165  $month = $date->get(IL_CAL_FKT_DATE,'n');
166 
167  $month_day = $day;
168 
169  $ilCtrl->clearParametersByClass('ilcalendardaygui');
170  $ilCtrl->setParameterByClass('ilcalendardaygui','seed',$date->get(IL_CAL_DATE));
171  $a_tpl->setVariable('OPEN_DAY_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendardaygui',''));
172  $ilCtrl->clearParametersByClass('ilcalendardaygui');
173 
174  $a_tpl->setVariable('MONTH_DAY',$month_day);
175  $a_tpl->parseCurrentBlock();
176 
177  if($counter and !($counter % 7))
178  {
179  $a_tpl->setCurrentBlock('month_row');
180  $ilCtrl->clearParametersByClass('ilcalendarweekgui');
181  $ilCtrl->setParameterByClass('ilcalendarweekgui','seed',$date->get(IL_CAL_DATE));
182  $a_tpl->setVariable('OPEN_WEEK_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendarweekgui',''));
183  $ilCtrl->clearParametersByClass('ilcalendarweekgui');
184  $a_tpl->setVariable('TD_CLASS','calminiweek');
185  $a_tpl->setVariable('WEEK',
186  $date->get(IL_CAL_FKT_DATE,'W'));
187  $a_tpl->parseCurrentBlock();
188  }
189  }
190  $a_tpl->setCurrentBlock('mini_month');
191  $a_tpl->setVariable('TXT_MONTH_OVERVIEW', $lng->txt("cal_month_overview"));
192  $a_tpl->setVariable('TXT_MONTH',
193  $lng->txt('month_'.$this->seed->get(IL_CAL_FKT_DATE,'m').'_long').
194  ' '.$this->seed->get(IL_CAL_FKT_DATE,'Y'));
195  $myseed = clone($this->seed);
196  $ilCtrl->setParameterByClass('ilcalendarmonthgui','seed',$myseed->get(IL_CAL_DATE));
197  $a_tpl->setVariable('OPEN_MONTH_VIEW',$ilCtrl->getLinkTargetByClass('ilcalendarmonthgui',''));
198 
199  $myseed->increment(ilDateTime::MONTH, -1);
200  $ilCtrl->setParameter($this->getParentObject(),'seed',$myseed->get(IL_CAL_DATE));
201 
202  //$a_tpl->setVariable('BL_TYPE', $this->getBlockType());
203  //$a_tpl->setVariable('BL_ID', $this->getBlockId());
204 
205  $a_tpl->setVariable('PREV_MONTH',
206  $ilCtrl->getLinkTarget($this->getParentObject(), ""));
207 
208  $myseed->increment(ilDateTime::MONTH, 2);
209  $ilCtrl->setParameter($this->getParentObject(),'seed',$myseed->get(IL_CAL_DATE));
210  $a_tpl->setVariable('NEXT_MONTH',
211  $ilCtrl->getLinkTarget($this->getParentObject(), ""));
212 
213  $ilCtrl->setParameter($this->getParentObject(), 'seed', "");
214  $a_tpl->parseCurrentBlock();
215  }
static _buildMonthDayList($a_month, $a_year, $weekstart)
Build a month day list.
static _numericDayToString($a_day, $a_long=true)
get
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
const IL_CAL_MONTH
global $ilCtrl
Definition: ilias.php:18
$counter
getParentObject()
Get Parent GUI object.
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
const IL_CAL_FKT_DATE
$ilUser
Definition: imgupload.php:18
const IL_CAL_DATE
static _isToday($date)
check if a date is today
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilMiniCalendarGUI::getHTML ( )

Get HTML for calendar.

Definition at line 85 of file class.ilMiniCalendarGUI.php.

References $lng, $tpl, and addMiniMonth().

86  {
87  global $lng;
88 
89  $ftpl = new ilTemplate("tpl.calendar_block_frame.html", true, true,
90  "Services/Calendar");
91 
92  $tpl = new ilTemplate("tpl.calendar_block.html", true, true,
93  "Services/Calendar");
94  $this->addMiniMonth($tpl);
95 
96  $ftpl->setVariable("BLOCK_TITLE", $lng->txt("calendar"));
97  $ftpl->setVariable("CONTENT", $tpl->get());
98  return $ftpl->get();
99  }
special template class to simplify handling of ITX/PEAR
addMiniMonth($a_tpl)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab...
+ Here is the call graph for this function:

◆ getParentObject()

ilMiniCalendarGUI::getParentObject ( )

Get Parent GUI object.

Returns
object Parent GUI object

Definition at line 77 of file class.ilMiniCalendarGUI.php.

Referenced by addMiniMonth().

78  {
79  return $this->parentobject;
80  }
+ Here is the caller graph for this function:

◆ setParentObject()

ilMiniCalendarGUI::setParentObject (   $a_parentobject)

Set Parent GUI object.

Parameters
object$a_parentobjectParent GUI object

Definition at line 67 of file class.ilMiniCalendarGUI.php.

Referenced by __construct().

68  {
69  $this->parentobject = $a_parentobject;
70  }
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilMiniCalendarGUI::$lng
protected

Definition at line 41 of file class.ilMiniCalendarGUI.php.

Referenced by __construct(), addMiniMonth(), and getHTML().

◆ $mode

ilMiniCalendarGUI::$mode = null
protected

Definition at line 38 of file class.ilMiniCalendarGUI.php.

◆ $seed

ilMiniCalendarGUI::$seed
protected

Definition at line 37 of file class.ilMiniCalendarGUI.php.

Referenced by __construct().

◆ $tpl

ilMiniCalendarGUI::$tpl = null
protected

Definition at line 40 of file class.ilMiniCalendarGUI.php.

Referenced by getHTML().

◆ $user_settings

ilMiniCalendarGUI::$user_settings = null
protected

Definition at line 39 of file class.ilMiniCalendarGUI.php.

◆ PRESENTATION_CALENDAR

const ilMiniCalendarGUI::PRESENTATION_CALENDAR = 1

Definition at line 35 of file class.ilMiniCalendarGUI.php.


The documentation for this class was generated from the following file: