ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 36 of file class.ilMiniCalendarGUI.php.

37 {
38 global $DIC;
39
40 $ilUser = $DIC['ilUser'];
41 $lng = $DIC['lng'];
42
43 $this->user = $DIC->user();
44 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $lng;
47 $this->lng->loadLanguageModule('dateplaner');
48 $this->seed = $seed;
49 $this->setParentObject($a_par_obj);
50 }
static _getInstanceByUserId(int $a_user_id)
setParentObject(object $a_parentobject)
global $DIC
Definition: shib_login.php:26

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

+ 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 91 of file class.ilMiniCalendarGUI.php.

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

References $counter, 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\lng(), ilDateTime\MONTH, ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilCalendarSchedule\TYPE_MONTH.

Referenced by getHTML().

+ 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 65 of file class.ilMiniCalendarGUI.php.

65 : string
66 {
67 $ftpl = new ilTemplate(
68 "tpl.calendar_block_frame.html",
69 true,
70 true,
71 "components/ILIAS/Calendar"
72 );
73
74 $tpl = new ilTemplate(
75 "tpl.calendar_block.html",
76 true,
77 true,
78 "components/ILIAS/Calendar"
79 );
80 $this->addMiniMonth($tpl);
81
82 $ftpl->setVariable("BLOCK_TITLE", $this->lng->txt("calendar"));
83 $ftpl->setVariable("CONTENT", $tpl->get());
84 return $ftpl->get();
85 }
ilGlobalTemplateInterface $tpl
addMiniMonth(ilTemplate $a_tpl)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.
special template class to simplify handling of ITX/PEAR
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References $tpl, addMiniMonth(), ILIAS\UICore\GlobalTemplate\get(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getParentObject()

ilMiniCalendarGUI::getParentObject ( )

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

57 : object
58 {
60 }

References $parentobject.

Referenced by addMiniMonth().

+ Here is the caller graph for this function:

◆ setParentObject()

ilMiniCalendarGUI::setParentObject ( object  $a_parentobject)

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

52 : void
53 {
54 $this->parentobject = $a_parentobject;
55 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilMiniCalendarGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilMiniCalendarGUI::$lng
protected

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

Referenced by __construct().

◆ $parentobject

object ilMiniCalendarGUI::$parentobject
protected

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

Referenced by getParentObject().

◆ $seed

ilDate ilMiniCalendarGUI::$seed
protected

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

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilMiniCalendarGUI::$tpl
protected

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

Referenced by getHTML().

◆ $user

ilObjUser ilMiniCalendarGUI::$user
protected

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

◆ $user_settings

ilCalendarUserSettings ilMiniCalendarGUI::$user_settings
protected

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

◆ PRESENTATION_CALENDAR

const ilMiniCalendarGUI::PRESENTATION_CALENDAR = 1

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


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