ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMiniCalendarGUI Class Reference
+ Collaboration diagram for ilMiniCalendarGUI:

Public Member Functions

 __construct (ilDate $seed, object $a_par_obj)
 
 setParentObject (object $a_parentobject)
 
 getParentObject ()
 
 getHTML ()
 Get HTML for calendar. More...
 
 addMiniMonth (ilTemplate $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

ilDate $seed
 
ilCalendarUserSettings $user_settings
 
ilGlobalTemplateInterface $tpl
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilObjUser $user
 
object $parentobject
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, $ilUser, $lng, $seed, ilCalendarUserSettings\_getInstanceByUserId(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), setParentObject(), and ILIAS\Repository\user().

43  {
44  global $DIC;
45 
46  $ilUser = $DIC['ilUser'];
47  $lng = $DIC['lng'];
48 
49  $this->user = $DIC->user();
50  $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
51  $this->ctrl = $DIC->ctrl();
52  $this->lng = $lng;
53  $this->lng->loadLanguageModule('dateplaner');
54  $this->seed = $seed;
55  $this->setParentObject($a_par_obj);
56  }
static _getInstanceByUserId(int $a_user_id)
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
setParentObject(object $a_parentobject)
+ Here is the call graph for this function:

Member Function Documentation

◆ addMiniMonth()

ilMiniCalendarGUI::addMiniMonth ( ilTemplate  $a_tpl)

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

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

References $i, ilDateTime\_before(), ilCalendarUtil\_buildMonthDayList(), ilDateTime\_equals(), ilCalendarUtil\_isToday(), ilCalendarUtil\_numericDayToString(), ILIAS\Repository\ctrl(), getParentObject(), IL_CAL_DATE, IL_CAL_FKT_DATE, IL_CAL_MONTH, ILIAS\Repository\int(), ILIAS\Repository\lng(), ilDateTime\MONTH, ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilCalendarSchedule\TYPE_MONTH.

Referenced by getHTML().

97  : void
98  {
99  // weekdays
100  $a_tpl->setCurrentBlock('month_header_col');
101  $a_tpl->setVariable('TXT_WEEKDAY', $this->lng->txt("cal_week_abbrev"));
102  $a_tpl->parseCurrentBlock();
103  for ($i = $this->user_settings->getWeekStart(); $i < (7 + $this->user_settings->getWeekStart()); $i++) {
104  $a_tpl->setCurrentBlock('month_header_col');
105  $a_tpl->setVariable('TXT_WEEKDAY', ilCalendarUtil::_numericDayToString($i, false));
106  $a_tpl->parseCurrentBlock();
107  }
108 
109  $scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_MONTH);
110  $scheduler->calculate();
111 
112  $counter = 0;
114  (int) $this->seed->get(IL_CAL_FKT_DATE, 'm'),
115  (int) $this->seed->get(IL_CAL_FKT_DATE, 'Y'),
116  $this->user_settings->getWeekStart()
117  )->get() as $date) {
118  $counter++;
119  //$this->showEvents($date);
120 
121  $a_tpl->setCurrentBlock('month_col');
122 
123  if (count($scheduler->getByDay($date, $this->user->getTimeZone()))) {
124  $a_tpl->setVariable('DAY_CLASS', 'calminiapp');
125  #$a_tpl->setVariable('TD_CLASS','calminiapp');
126  }
127 
128  if (ilCalendarUtil::_isToday($date)) {
129  $a_tpl->setVariable('TD_CLASS', 'calminitoday');
130  } elseif (ilDateTime::_equals($date, $this->seed, IL_CAL_MONTH)) {
131  $a_tpl->setVariable('TD_CLASS', 'calministd');
132  } elseif (ilDateTime::_before($date, $this->seed, IL_CAL_MONTH)) {
133  $a_tpl->setVariable('TD_CLASS', 'calminiprev');
134  } else {
135  $a_tpl->setVariable('TD_CLASS', 'calmininext');
136  }
137 
138  $day = $date->get(IL_CAL_FKT_DATE, 'j');
139  $month = $date->get(IL_CAL_FKT_DATE, 'n');
140 
141  $month_day = $day;
142 
143  $this->ctrl->clearParametersByClass('ilcalendardaygui');
144  $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE));
145  $a_tpl->setVariable('OPEN_DAY_VIEW', $this->ctrl->getLinkTargetByClass('ilcalendardaygui', ''));
146  $this->ctrl->clearParametersByClass('ilcalendardaygui');
147 
148  $a_tpl->setVariable('MONTH_DAY', $month_day);
149  $a_tpl->parseCurrentBlock();
150 
151  if ($counter and !($counter % 7)) {
152  $a_tpl->setCurrentBlock('week');
153  $a_tpl->setVariable(
154  'WEEK',
155  $date->get(IL_CAL_FKT_DATE, 'W')
156  );
157  $a_tpl->parseCurrentBlock();
158 
159  $a_tpl->setCurrentBlock('month_row');
160  $this->ctrl->clearParametersByClass('ilcalendarweekgui');
161  $this->ctrl->setParameterByClass('ilcalendarweekgui', 'seed', $date->get(IL_CAL_DATE));
162  $this->ctrl->clearParametersByClass('ilcalendarweekgui');
163  $a_tpl->setVariable('TD_CLASS', 'calminiweek');
164  $a_tpl->parseCurrentBlock();
165  }
166  }
167  $a_tpl->setCurrentBlock('mini_month');
168  //$a_tpl->setVariable('TXT_MONTH_OVERVIEW', $lng->txt("cal_month_overview"));
169  $a_tpl->setVariable(
170  'TXT_MONTH',
171  $this->lng->txt('month_' . $this->seed->get(IL_CAL_FKT_DATE, 'm') . '_long') .
172  ' ' . $this->seed->get(IL_CAL_FKT_DATE, 'Y')
173  );
174  $myseed = clone($this->seed);
175  $this->ctrl->setParameterByClass('ilcalendarmonthgui', 'seed', $myseed->get(IL_CAL_DATE));
176  $a_tpl->setVariable('OPEN_MONTH_VIEW', $this->ctrl->getLinkTargetByClass('ilcalendarmonthgui', ''));
177 
178  $myseed->increment(ilDateTime::MONTH, -1);
179  $this->ctrl->setParameter($this->getParentObject(), 'seed', $myseed->get(IL_CAL_DATE));
180 
181  $a_tpl->setVariable(
182  'PREV_MONTH',
183  $this->ctrl->getLinkTarget($this->getParentObject(), "")
184  );
185 
186  $myseed->increment(ilDateTime::MONTH, 2);
187  $this->ctrl->setParameter($this->getParentObject(), 'seed', $myseed->get(IL_CAL_DATE));
188  $a_tpl->setVariable(
189  'NEXT_MONTH',
190  $this->ctrl->getLinkTarget($this->getParentObject(), "")
191  );
192 
193  $this->ctrl->setParameter($this->getParentObject(), 'seed', "");
194  $a_tpl->parseCurrentBlock();
195  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static _buildMonthDayList(int $a_month, int $a_year, int $weekstart)
Build a month day list.
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
const IL_CAL_MONTH
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
const IL_CAL_FKT_DATE
static _numericDayToString(int $a_day, bool $a_long=true)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
const IL_CAL_DATE
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
static _isToday(ilDateTime $date)
$i
Definition: metadata.php:41
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 71 of file class.ilMiniCalendarGUI.php.

References addMiniMonth(), ilGlobalTemplateInterface\get(), and ILIAS\Repository\lng().

71  : string
72  {
73  $ftpl = new ilTemplate(
74  "tpl.calendar_block_frame.html",
75  true,
76  true,
77  "Services/Calendar"
78  );
79 
80  $tpl = new ilTemplate(
81  "tpl.calendar_block.html",
82  true,
83  true,
84  "Services/Calendar"
85  );
86  $this->addMiniMonth($tpl);
87 
88  $ftpl->setVariable("BLOCK_TITLE", $this->lng->txt("calendar"));
89  $ftpl->setVariable("CONTENT", $tpl->get());
90  return $ftpl->get();
91  }
ilGlobalTemplateInterface $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
addMiniMonth(ilTemplate $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 ( )

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

References $parentobject.

Referenced by addMiniMonth().

63  : object
64  {
65  return $this->parentobject;
66  }
+ Here is the caller graph for this function:

◆ setParentObject()

ilMiniCalendarGUI::setParentObject ( object  $a_parentobject)

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

Referenced by __construct().

58  : void
59  {
60  $this->parentobject = $a_parentobject;
61  }
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilMiniCalendarGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilMiniCalendarGUI::$lng
protected

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

Referenced by __construct().

◆ $parentobject

object ilMiniCalendarGUI::$parentobject
protected

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

Referenced by getParentObject().

◆ $seed

ilDate ilMiniCalendarGUI::$seed
protected

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

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilMiniCalendarGUI::$tpl
protected

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

◆ $user

ilObjUser ilMiniCalendarGUI::$user
protected

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

◆ $user_settings

ilCalendarUserSettings ilMiniCalendarGUI::$user_settings
protected

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

◆ PRESENTATION_CALENDAR

const ilMiniCalendarGUI::PRESENTATION_CALENDAR = 1

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


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