ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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
setParentObject($a_parentobject)
Set Parent GUI object.
global $ilUser
Definition: imgupload.php:15
+ 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 107 of file class.ilMiniCalendarGUI.php.

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

108  {
109  global $ilCtrl, $lng,$ilUser;
110 
111  // weekdays
112  include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
113  $a_tpl->setCurrentBlock('month_header_col');
114  $a_tpl->setVariable('TXT_WEEKDAY', $lng->txt("cal_week_abbrev"));
115  $a_tpl->parseCurrentBlock();
116  for($i = (int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++)
117  {
118  $a_tpl->setCurrentBlock('month_header_col');
119  $a_tpl->setVariable('TXT_WEEKDAY',ilCalendarUtil::_numericDayToString($i,false));
120  $a_tpl->parseCurrentBlock();
121  }
122 
123  include_once('Services/Calendar/classes/class.ilCalendarSchedule.php');
124  $this->scheduler = new ilCalendarSchedule($this->seed,ilCalendarSchedule::TYPE_MONTH);
125  $this->scheduler->calculate();
126 
127  $counter = 0;
128  foreach(ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE,'m'),
129  $this->seed->get(IL_CAL_FKT_DATE,'Y'),
130  $this->user_settings->getWeekStart())->get() as $date)
131  {
132  $counter++;
133  //$this->showEvents($date);
134 
135 
136  $a_tpl->setCurrentBlock('month_col');
137 
138  if(count($this->scheduler->getByDay($date,$ilUser->getTimeZone())))
139  {
140  $a_tpl->setVariable('DAY_CLASS','calminiapp');
141  #$a_tpl->setVariable('TD_CLASS','calminiapp');
142  }
143 
144  include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
145  if(ilCalendarUtil::_isToday($date))
146  {
147  $a_tpl->setVariable('TD_CLASS','calminitoday');
148  }
149  #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY))
150  #{
151  # $a_tpl->setVariable('TD_CLASS','calmininow');
152  #}
153  elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_MONTH))
154  {
155  $a_tpl->setVariable('TD_CLASS','calministd');
156  }
157  elseif(ilDateTime::_before($date,$this->seed,IL_CAL_MONTH))
158  {
159  $a_tpl->setVariable('TD_CLASS','calminiprev');
160  }
161  else
162  {
163  $a_tpl->setVariable('TD_CLASS','calmininext');
164  }
165 
166  $day = $date->get(IL_CAL_FKT_DATE,'j');
167  $month = $date->get(IL_CAL_FKT_DATE,'n');
168 
169  $month_day = $day;
170 
171  $ilCtrl->clearParametersByClass('ilcalendardaygui');
172  $ilCtrl->setParameterByClass('ilcalendardaygui','seed',$date->get(IL_CAL_DATE));
173  $a_tpl->setVariable('OPEN_DAY_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendardaygui',''));
174  $ilCtrl->clearParametersByClass('ilcalendardaygui');
175 
176  $a_tpl->setVariable('MONTH_DAY',$month_day);
177  //$this->tpl->setVariable('NEW_SRC',ilUtil::getImagePath('new.png','calendar'));
178  //$this->tpl->setVariable('NEW_ALT',$this->lng->txt('cal_new_app'));
179  //$this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
180  //$this->ctrl->setParameterByClass('ilcalendarappointmentgui','seed',$date->get(IL_CAL_DATE));
181  //$this->tpl->setVariable('ADD_LINK',$this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui','add'));
182 
183  //$this->tpl->setVariable('OPEN_SRC',ilUtil::getImagePath('open.png','calendar'));
184  $a_tpl->parseCurrentBlock();
185 
186  if($counter and !($counter % 7))
187  {
188  $a_tpl->setCurrentBlock('month_row');
189  $ilCtrl->clearParametersByClass('ilcalendarweekgui');
190  $ilCtrl->setParameterByClass('ilcalendarweekgui','seed',$date->get(IL_CAL_DATE));
191  $a_tpl->setVariable('OPEN_WEEK_VIEW', $ilCtrl->getLinkTargetByClass('ilcalendarweekgui',''));
192  $ilCtrl->clearParametersByClass('ilcalendarweekgui');
193  $a_tpl->setVariable('TD_CLASS','calminiweek');
194  $a_tpl->setVariable('WEEK',
195  $date->get(IL_CAL_FKT_DATE,'W'));
196  $a_tpl->parseCurrentBlock();
197  }
198  }
199  $a_tpl->setCurrentBlock('mini_month');
200  $a_tpl->setVariable('TXT_MONTH_OVERVIEW', $lng->txt("cal_month_overview"));
201  $a_tpl->setVariable('TXT_MONTH',
202  $lng->txt('month_'.$this->seed->get(IL_CAL_FKT_DATE,'m').'_long').
203  ' '.$this->seed->get(IL_CAL_FKT_DATE,'Y'));
204  $myseed = clone($this->seed);
205  $ilCtrl->setParameterByClass('ilcalendarmonthgui','seed',$myseed->get(IL_CAL_DATE));
206  $a_tpl->setVariable('OPEN_MONTH_VIEW',$ilCtrl->getLinkTargetByClass('ilcalendarmonthgui',''));
207 
208  $myseed->increment(ilDateTime::MONTH, -1);
209  $ilCtrl->setParameter($this->getParentObject(),'seed',$myseed->get(IL_CAL_DATE));
210 
211  //$a_tpl->setVariable('BL_TYPE', $this->getBlockType());
212  //$a_tpl->setVariable('BL_ID', $this->getBlockId());
213 
214  $a_tpl->setVariable('PREV_MONTH',
215  $ilCtrl->getLinkTarget($this->getParentObject(), ""));
216 
217  $myseed->increment(ilDateTime::MONTH, 2);
218  $ilCtrl->setParameter($this->getParentObject(),'seed',$myseed->get(IL_CAL_DATE));
219  $a_tpl->setVariable('NEXT_MONTH',
220  $ilCtrl->getLinkTarget($this->getParentObject(), ""));
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
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
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
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, addMiniMonth(), and ilUtil\getImagePath().

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("IMG_BLOCK", ilUtil::getImagePath("icon_cals_s.png"));
97  $ftpl->setVariable("BLOCK_TITLE", $lng->txt("calendar"));
98  $ftpl->setVariable("CONTENT", $tpl->get());
99  $ftpl->setVariable("ALT_BLOCK", $lng->txt("icon")." ".$lng->txt("calendar"));
100  return $ftpl->get();
101  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
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: