ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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->lng = $lng;
56  $this->lng->loadLanguageModule('dateplaner');
57  $this->seed = $seed;
58  $this->setParentObject($a_par_obj);
59  }
static _getInstanceByUserId($a_user_id)
get singleton instance
$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 112 of file class.ilMiniCalendarGUI.php.

References $counter, $i, $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().

113  {
114  global $ilCtrl, $lng,$ilUser;
115 
116  // weekdays
117  include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
118  $a_tpl->setCurrentBlock('month_header_col');
119  $a_tpl->setVariable('TXT_WEEKDAY', $lng->txt("cal_week_abbrev"));
120  $a_tpl->parseCurrentBlock();
121  for ($i = (int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++) {
122  $a_tpl->setCurrentBlock('month_header_col');
123  $a_tpl->setVariable('TXT_WEEKDAY', ilCalendarUtil::_numericDayToString($i, false));
124  $a_tpl->parseCurrentBlock();
125  }
126 
127  include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
128  $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_MONTH);
129  $this->scheduler->calculate();
130 
131  $counter = 0;
133  $this->seed->get(IL_CAL_FKT_DATE, 'm'),
134  $this->seed->get(IL_CAL_FKT_DATE, 'Y'),
135  $this->user_settings->getWeekStart()
136  )->get() as $date) {
137  $counter++;
138  //$this->showEvents($date);
139 
140 
141  $a_tpl->setCurrentBlock('month_col');
142 
143  if (count($this->scheduler->getByDay($date, $ilUser->getTimeZone()))) {
144  $a_tpl->setVariable('DAY_CLASS', 'calminiapp');
145  #$a_tpl->setVariable('TD_CLASS','calminiapp');
146  }
147 
148  include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
149  if (ilCalendarUtil::_isToday($date)) {
150  $a_tpl->setVariable('TD_CLASS', 'calminitoday');
151  }
152  #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
153  #{
154  # $a_tpl->setVariable('TD_CLASS','calmininow');
155  #}
156  elseif (ilDateTime::_equals($date, $this->seed, IL_CAL_MONTH)) {
157  $a_tpl->setVariable('TD_CLASS', 'calministd');
158  } elseif (ilDateTime::_before($date, $this->seed, IL_CAL_MONTH)) {
159  $a_tpl->setVariable('TD_CLASS', 'calminiprev');
160  } else {
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  $a_tpl->setCurrentBlock('week');
179  $a_tpl->setVariable(
180  'WEEK',
181  $date->get(IL_CAL_FKT_DATE, 'W')
182  );
183  $a_tpl->parseCurrentBlock();
184 
185  $a_tpl->setCurrentBlock('month_row');
186  $ilCtrl->clearParametersByClass('ilcalendarweekgui');
187  $ilCtrl->setParameterByClass('ilcalendarweekgui', 'seed', $date->get(IL_CAL_DATE));
188  $ilCtrl->clearParametersByClass('ilcalendarweekgui');
189  $a_tpl->setVariable('TD_CLASS', 'calminiweek');
190  $a_tpl->parseCurrentBlock();
191  }
192  }
193  $a_tpl->setCurrentBlock('mini_month');
194  $a_tpl->setVariable('TXT_MONTH_OVERVIEW', $lng->txt("cal_month_overview"));
195  $a_tpl->setVariable(
196  'TXT_MONTH',
197  $lng->txt('month_' . $this->seed->get(IL_CAL_FKT_DATE, 'm') . '_long') .
198  ' ' . $this->seed->get(IL_CAL_FKT_DATE, 'Y')
199  );
200  $myseed = clone($this->seed);
201  $ilCtrl->setParameterByClass('ilcalendarmonthgui', 'seed', $myseed->get(IL_CAL_DATE));
202  $a_tpl->setVariable('OPEN_MONTH_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendarmonthgui', ''));
203 
204  $myseed->increment(ilDateTime::MONTH, -1);
205  $ilCtrl->setParameter($this->getParentObject(), 'seed', $myseed->get(IL_CAL_DATE));
206 
207  //$a_tpl->setVariable('BL_TYPE', $this->getBlockType());
208  //$a_tpl->setVariable('BL_ID', $this->getBlockId());
209 
210  $a_tpl->setVariable(
211  'PREV_MONTH',
212  $ilCtrl->getLinkTarget($this->getParentObject(), "")
213  );
214 
215  $myseed->increment(ilDateTime::MONTH, 2);
216  $ilCtrl->setParameter($this->getParentObject(), 'seed', $myseed->get(IL_CAL_DATE));
217  $a_tpl->setVariable(
218  'NEXT_MONTH',
219  $ilCtrl->getLinkTarget($this->getParentObject(), "")
220  );
221 
222  $ilCtrl->setParameter($this->getParentObject(), 'seed', "");
223  $a_tpl->parseCurrentBlock();
224  }
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
$i
Definition: disco.tpl.php:19
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 84 of file class.ilMiniCalendarGUI.php.

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

85  {
86  global $lng;
87 
88  $ftpl = new ilTemplate(
89  "tpl.calendar_block_frame.html",
90  true,
91  true,
92  "Services/Calendar"
93  );
94 
95  $tpl = new ilTemplate(
96  "tpl.calendar_block.html",
97  true,
98  true,
99  "Services/Calendar"
100  );
101  $this->addMiniMonth($tpl);
102 
103  $ftpl->setVariable("BLOCK_TITLE", $lng->txt("calendar"));
104  $ftpl->setVariable("CONTENT", $tpl->get());
105  return $ftpl->get();
106  }
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 76 of file class.ilMiniCalendarGUI.php.

Referenced by addMiniMonth().

77  {
78  return $this->parentobject;
79  }
+ 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 66 of file class.ilMiniCalendarGUI.php.

Referenced by __construct().

67  {
68  $this->parentobject = $a_parentobject;
69  }
+ 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: