This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning
- Author
- Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e ilCalendarWeekGUI: ilCalendarAppointmentGUI ilCalendarWeekGUI: ilCalendarAppointmentPresentationGUI
Definition at line 27 of file class.ilCalendarWeekGUI.php.
◆ __construct()
ilCalendarWeekGUI::__construct |
( |
ilDate |
$seed_date | ) |
|
◆ addAppointmentLink()
ilCalendarWeekGUI::addAppointmentLink |
( |
ilDateTime |
$date | ) |
|
|
protected |
Definition at line 417 of file class.ilCalendarWeekGUI.php.
References ILIAS\Repository\ctrl(), ilDateTime\get(), IL_CAL_UNIX, and ILIAS\Repository\lng().
Referenced by show().
419 $new_app_url = $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add');
421 if ($this->cal_settings->getEnableGroupMilestones()) {
422 $new_ms_url = $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'addMilestone');
424 $this->tpl->setCurrentBlock(
"new_ms");
426 $this->tpl->setVariable(
428 $this->ui_renderer->render($this->ui_factory->symbol()->glyph()->add())
430 $this->tpl->setVariable(
'URL_DD_NEW_APP', $new_app_url);
431 $this->tpl->setVariable(
'TXT_DD_NEW_APP', $this->
lng->txt(
'cal_new_app'));
432 $this->tpl->setVariable(
'URL_DD_NEW_MS', $new_ms_url);
433 $this->tpl->setVariable(
'TXT_DD_NEW_MS', $this->
lng->txt(
'cal_new_ms'));
434 $this->tpl->parseCurrentBlock();
436 $this->tpl->setCurrentBlock(
"new_app");
438 $this->tpl->setVariable(
'NEW_APP_GLYPH', $this->ui_renderer->render(
439 $this->ui_factory->symbol()->glyph()->add($new_app_url)
442 $this->tpl->parseCurrentBlock();
445 $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
◆ addFullDayEvents()
ilCalendarWeekGUI::addFullDayEvents |
( |
|
$all_fullday | ) |
|
|
protected |
Definition at line 485 of file class.ilCalendarWeekGUI.php.
References ILIAS\Repository\lng(), and showFulldayAppointment().
Referenced by show().
488 foreach ($all_fullday as $daily_apps) {
489 foreach ($daily_apps as $event) {
490 if ($event[
'fullday']) {
494 $this->tpl->setCurrentBlock(
'f_day_row');
495 $this->tpl->setVariable(
'COLSPAN', max($this->colspans[$counter], 1));
496 $this->tpl->parseCurrentBlock();
499 $this->tpl->setCurrentBlock(
'fullday_apps');
500 $this->tpl->setVariable(
'TXT_F_DAY', $this->
lng->txt(
"cal_all_day"));
501 $this->tpl->parseCurrentBlock();
showFulldayAppointment(array $a_app)
◆ addHeaderDate()
ilCalendarWeekGUI::addHeaderDate |
( |
|
$date, |
|
|
|
$num_apps |
|
) |
| |
|
protected |
Definition at line 464 of file class.ilCalendarWeekGUI.php.
References ilCalendarUtil\_numericDayToString(), ILIAS\Repository\ctrl(), IL_CAL_DATE, IL_CAL_FKT_DATE, and IL_CAL_FKT_GETDATE.
Referenced by show().
468 $daydate = $dayname .
' ' . $date_info[
'mday'] .
'.';
470 if (!$this->disable_empty || $num_apps[$date->get(
IL_CAL_DATE)] > 0) {
471 $link = $this->
ctrl->getLinkTargetByClass(
'ilcalendardaygui',
'');
472 $this->
ctrl->clearParametersByClass(
'ilcalendardaygui');
474 $this->tpl->setCurrentBlock(
"day_view_link");
475 $this->tpl->setVariable(
'HEADER_DATE', $daydate);
476 $this->tpl->setVariable(
'DAY_VIEW_LINK', $link);
477 $this->tpl->parseCurrentBlock();
479 $this->tpl->setCurrentBlock(
"day_view_no_link");
480 $this->tpl->setVariable(
'HEADER_DATE', $daydate);
481 $this->tpl->parseCurrentBlock();
static _numericDayToString(int $a_day, bool $a_long=true)
◆ addTimedEvents()
ilCalendarWeekGUI::addTimedEvents |
( |
array |
$hours, |
|
|
int |
$morning_aggr, |
|
|
int |
$evening_aggr |
|
) |
| |
|
protected |
Definition at line 504 of file class.ilCalendarWeekGUI.php.
References $app, $i, ILIAS\Repository\ctrl(), IL_CAL_DATE, and showAppointment().
Referenced by show().
506 $new_link_counter = 0;
508 foreach ($hours as $num_hour => $hours_per_day) {
510 foreach ($hours_per_day as $num_day => $hour) {
512 #ADD the hours in the left side of the grid. 514 if (!($num_hour % 60) || ($num_hour == $morning_aggr && $morning_aggr) ||
515 ($num_hour == $evening_aggr && $evening_aggr)) {
519 if (($num_hour == $morning_aggr && $morning_aggr) ||
520 ($num_hour == $evening_aggr && $evening_aggr)) {
521 $this->tpl->setVariable(
'TIME_ROWSPAN', 1);
524 $this->tpl->setVariable(
'TIME_ROWSPAN', 60 / $this->raster);
527 $this->tpl->setCurrentBlock(
'time_txt');
529 $this->tpl->setVariable(
'TIME', $hour[
'txt']);
530 $this->tpl->parseCurrentBlock();
534 foreach ($hour[
'apps_start'] as
$app) {
537 $num_apps = $hour[
'apps_num'];
538 $colspan = max($this->colspans[$num_day], 1);
541 if (!$hour[
'apps_num'] && !$this->no_add) {
542 $this->tpl->setCurrentBlock(
'new_app_link');
544 $this->
ctrl->clearParameterByClass(
'ilcalendarappointmentgui',
'app_id');
546 $this->
ctrl->setParameterByClass(
547 'ilcalendarappointmentgui',
551 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $this->seed->get(
IL_CAL_DATE));
552 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'hour', floor($num_hour / 60));
555 $new_app_url = $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'add');
556 $this->tpl->setVariable(
558 $this->ui_renderer->render($this->ui_factory->symbol()->glyph()->add($new_app_url))
560 $this->tpl->setVariable(
'DAY_NEW_ID', ++$new_link_counter);
561 $this->tpl->parseCurrentBlock();
564 for (
$i = $colspan;
$i > $hour[
'apps_num'];
$i--) {
565 $this->tpl->setCurrentBlock(
'day_cell');
569 if ($num_hour % 60 == 60 - $this->raster ||
570 ($num_hour == $morning_aggr && $morning_aggr) ||
571 ($num_hour == $evening_aggr && $evening_aggr)) {
572 $empty_border =
' calempty_border';
575 $this->tpl->setVariable(
'TD_CLASS',
'calempty createhover' . $empty_border);
577 $this->tpl->setVariable(
'DAY_ID', ++$day_id_counter);
578 $this->tpl->setVariable(
'TD_ROWSPAN', 1);
579 $this->tpl->parseCurrentBlock();
582 $this->tpl->touchBlock(
'time_row');
showAppointment(array $a_app)
◆ calculateColspans()
ilCalendarWeekGUI::calculateColspans |
( |
array |
$hours | ) |
|
|
protected |
Definition at line 396 of file class.ilCalendarWeekGUI.php.
Referenced by show().
398 foreach ($hours as $hour_num => $hours_per_day) {
399 foreach ($hours_per_day as $num_day => $hour) {
400 $this->colspans[$num_day] = max($this->colspans[$num_day] ?? 0, $hour[
'apps_num'] ?? 0);
◆ executeCommand()
ilCalendarWeekGUI::executeCommand |
( |
| ) |
|
Definition at line 62 of file class.ilCalendarWeekGUI.php.
References $app, ilCalendarAppointmentPresentationGUI\_getInstance(), ILIAS\Repository\ctrl(), ilSession\get(), ilCalendarViewGUI\getCurrentApp(), IL_CAL_DATE, ilCalendarViewGUI\initAppointmentIdFromQuery(), and ilCalendarViewGUI\initInitialDateFromQuery().
64 $this->
ctrl->saveParameter($this,
'seed');
65 $next_class = $this->
ctrl->getNextClass();
66 switch ($next_class) {
67 case "ilcalendarappointmentpresentationgui":
68 $this->
ctrl->setReturn($this,
"");
70 $this->
ctrl->forwardCommand($gui);
72 case 'ilcalendarappointmentgui':
73 $this->
ctrl->setReturn($this,
'');
74 $this->tabs_gui->setSubTabActive((
string)
ilSession::get(
'cal_last_tab'));
83 $time = microtime(
true);
84 $cmd = $this->
ctrl->getCmd(
"show");
86 $this->main_tpl->setContent($this->tpl->get());
static _getInstance(ilDate $seed, array $a_app)
get singleton instance
static get(string $a_var)
initAppointmentIdFromQuery()
initInitialDateFromQuery()
Administrate calendar appointments.
◆ getAppointmentTimeString()
◆ getMorningAggr()
ilCalendarWeekGUI::getMorningAggr |
( |
| ) |
|
|
protected |
Definition at line 405 of file class.ilCalendarWeekGUI.php.
Referenced by show().
407 if ($this->user_settings->getDayStart()) {
409 $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $this->raster);
414 return $morning_aggr;
◆ initialize()
ilCalendarWeekGUI::initialize |
( |
int |
$a_calendar_presentation_type | ) |
|
◆ parseHourInfo()
ilCalendarWeekGUI::parseHourInfo |
( |
array |
$daily_apps, |
|
|
ilDateTime |
$date, |
|
|
int |
$num_day, |
|
|
array |
$hours = null , |
|
|
int |
$morning_aggr = 0 , |
|
|
int |
$evening_aggr = 0 |
|
) |
| |
|
protected |
calculate overlapping hours protected
- Returns
- array hours
Definition at line 282 of file class.ilCalendarWeekGUI.php.
References $app, $i, $raster, ilDateTime\get(), IL_CAL_FKT_GETDATE, ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.
Referenced by show().
291 $hours[
$i][$num_day][
'apps_start'] = array();
292 $hours[
$i][$num_day][
'apps_num'] = 0;
293 switch ($this->user_settings->getTimeFormat()) {
295 if ($morning_aggr > 0 &&
$i == $morning_aggr) {
296 $hours[
$i][$num_day][
'txt'] = sprintf(
'%02d:00', 0) .
' - ' .
297 sprintf(
'%02d:00', ceil((
$i + 1) / 60));
299 if (!isset($hours[
$i][$num_day][
'txt'])) {
300 $hours[
$i][$num_day][
'txt'] = sprintf(
'%02d:%02d', floor(
$i / 60),
$i % 60);
302 $hours[
$i][$num_day][
'txt'] .= sprintf(
'%02d:%02d', floor(
$i / 60),
$i % 60);
305 if ($evening_aggr < 23 * 60 &&
$i == $evening_aggr) {
306 if (!isset($hours[
$i][$num_day][
'txt'])) {
307 $hours[
$i][$num_day][
'txt'] =
' - ' . sprintf(
'%02d:00', 0);
309 $hours[
$i][$num_day][
'txt'] .=
' - ' . sprintf(
'%02d:00', 0);
315 if ($morning_aggr > 0 &&
$i == $morning_aggr) {
316 $hours[
$i][$num_day][
'txt'] =
317 date(
'h a', mktime(0, 0, 0, 1, 1, 2000)) .
' - ' .
318 date(
'h a', mktime($this->user_settings->getDayStart(), 0, 0, 1, 1, 2000));
320 if (!isset($hours[
$i][$num_day][
'txt'])) {
321 $hours[
$i][$num_day][
'txt'] = date(
'h a', mktime((
int) floor(
$i / 60),
$i % 60, 0, 1, 1, 2000));
323 $hours[
$i][$num_day][
'txt'] .= date(
'h a', mktime((
int) floor(
$i / 60),
$i % 60, 0, 1, 1, 2000));
326 if ($evening_aggr < 23 * 60 &&
$i == $evening_aggr) {
327 $hours[
$i][$num_day][
'txt'] =
328 date(
'h a', mktime($this->user_settings->getDayEnd(), 0, 0, 1, 1, 2000)) .
' - ' .
329 date(
'h a', mktime(0, 0, 0, 1, 1, 2000));
337 foreach ($daily_apps as
$app) {
339 if ($app[
'fullday']) {
344 if ($app[
'start_info'][
'mday'] != $date_info[
'mday']) {
347 $start = $app[
'start_info'][
'hours'] * 60 + $app[
'start_info'][
'minutes'];
353 if ($app[
'end_info'][
'mday'] != $date_info[
'mday']) {
355 } elseif ($app[
'start_info'][
'hours'] == $app[
'end_info'][
'hours']) {
358 $end = $app[
'end_info'][
'hours'] * 60 + $app[
'end_info'][
'minutes'];
363 if ($start < $morning_aggr) {
364 $start = $morning_aggr;
366 if ($end <= $morning_aggr) {
369 if ($start > $evening_aggr) {
370 $start = $evening_aggr;
372 if ($end > $evening_aggr + $this->raster) {
375 if ($end <= $start) {
386 $app[
'rowspan'] = ceil(($end - $start) / $this->raster);
387 $hours[
$i][$num_day][
'apps_start'][] =
$app;
390 $hours[
$i][$num_day][
'apps_num']++;
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
◆ setUpCalendar()
ilCalendarWeekGUI::setUpCalendar |
( |
| ) |
|
|
protected |
◆ show()
ilCalendarWeekGUI::show |
( |
| ) |
|
Definition at line 91 of file class.ilCalendarWeekGUI.php.
References $disable_empty, ilCalendarUtil\_buildWeekDayList(), ilCalendarSettings\_getInstance(), addAppointmentLink(), addFullDayEvents(), addHeaderDate(), ilCalendarSchedule\addSubitemCalendars(), addTimedEvents(), calculateColspans(), ILIAS\Repository\ctrl(), getMorningAggr(), IL_CAL_DATE, ilYuiUtil\initDragDrop(), ILIAS\Repository\lng(), parseHourInfo(), setUpCalendar(), ilCalendarSchedule\TYPE_WEEK, ILIAS\Repository\user(), and ilDateTime\WEEK.
95 $evening_aggr = $this->user_settings->getDayEnd() * 60;
97 $this->tpl =
new ilTemplate(
'tpl.week_view.html',
true,
true,
'Services/Calendar');
102 $this->tpl->setVariable(
'NAVIGATION', $navigation->getHTML());
108 $this->
user->getId(),
112 $scheduler->calculate();
116 $all_fullday = array();
118 $daily_apps = $scheduler->getByDay($date, $this->timezone);
119 if (!$this->view_with_appointments && count($daily_apps)) {
120 $this->view_with_appointments =
true;
130 $this->weekdays[] = $date;
132 $num_apps[$date->get(
IL_CAL_DATE)] = count($daily_apps);
134 $all_fullday[] = $daily_apps;
145 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'seed', $date->get(
IL_CAL_DATE));
146 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'idate', $date->get(
IL_CAL_DATE));
147 $this->
ctrl->setParameterByClass(
'ilcalendardaygui',
'seed', $date->get(
IL_CAL_DATE));
149 if (!$this->no_add) {
155 $this->tpl->setCurrentBlock(
'day_header_row');
156 $this->tpl->setVariable(
'DAY_COLSPAN', max($this->colspans[$counter], 1));
157 $this->tpl->parseCurrentBlock();
168 $this->tpl->setVariable(
"TXT_TIME", $this->
lng->txt(
"time"));
addAppointmentLink(ilDateTime $date)
calculateColspans(array $hours)
static _buildWeekDayList(ilDate $a_day, int $a_weekstart)
build week day list public
addFullDayEvents($all_fullday)
static initDragDrop(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop used in Modules/Survey, Services/Calendar, Services/COPage, Services/Form (Jan 2022)
parseHourInfo(array $daily_apps, ilDateTime $date, int $num_day, array $hours=null, int $morning_aggr=0, int $evening_aggr=0)
calculate overlapping hours protected
addSubitemCalendars(bool $a_status)
addTimedEvents(array $hours, int $morning_aggr, int $evening_aggr)
addHeaderDate($date, $num_apps)
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
◆ showAppointment()
ilCalendarWeekGUI::showAppointment |
( |
array |
$a_app | ) |
|
|
protected |
Definition at line 222 of file class.ilCalendarWeekGUI.php.
References $ilUser, ilCalendarViewGUI\$user, ilCalendarUtil\calculateFontColor(), ILIAS\Repository\ctrl(), ilCalendarViewGUI\getAppointmentShyButton(), getAppointmentTimeString(), and ilCalendarViewGUI\getContentByPlugins().
Referenced by addTimedEvents().
225 $event_tpl =
new ilTemplate(
'tpl.week_event_view.html',
true,
true,
'Services/Calendar');
229 $this->tpl->setCurrentBlock(
'not_empty');
231 $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
232 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
234 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
235 $style =
'background-color: ' . $color .
';';
239 if (!$a_app[
'event']->isFullDay()) {
242 $td_style .= $a_app[
'event']->getPresentationStyle();
247 $title = ($time !=
"") ? $time .
" " . $shy : $shy;
249 $event_tpl->setCurrentBlock(
'event_cell_content');
250 $event_tpl->setVariable(
"STYLE", $style);
251 $event_tpl->setVariable(
'EVENT_CONTENT', $title);
253 if ($event_html_by_plugin = $this->
getContentByPlugins($a_app[
'event'], $a_app[
'dstart'], $title, $event_tpl)) {
254 $event_html = $event_html_by_plugin;
256 $event_tpl->parseCurrentBlock();
257 $event_html = $event_tpl->get();
260 $this->tpl->setVariable(
'GRID_CONTENT', $event_html);
263 $this->tpl->parseCurrentBlock();
265 $this->tpl->setCurrentBlock(
'day_cell');
267 $this->tpl->setVariable(
'DAY_ID',
'a' . $this->num_appointments);
268 $this->tpl->setVariable(
'TD_ROWSPAN', $a_app[
'rowspan']);
269 $this->tpl->setVariable(
'TD_STYLE', $a_app[
'event']->getPresentationStyle());
270 $this->tpl->setVariable(
'TD_CLASS',
'calevent il_calevent');
272 $this->tpl->parseCurrentBlock();
274 $this->num_appointments++;
getContentByPlugins(ilCalendarEntry $a_cal_entry, int $a_start_date, string $a_content, ilTemplate $a_tpl)
getAppointmentTimeString(ilCalendarEntry $a_event)
static calculateFontColor(string $a_html_color_code)
Calculate best font color from html hex color code.
getAppointmentShyButton(ilCalendarEntry $a_calendar_entry, string $a_dstart, string $a_title_forced="")
◆ showFulldayAppointment()
ilCalendarWeekGUI::showFulldayAppointment |
( |
array |
$a_app | ) |
|
|
protected |
Definition at line 171 of file class.ilCalendarWeekGUI.php.
References ilCalendarUtil\calculateFontColor(), ILIAS\Repository\ctrl(), ilCalendarViewGUI\getAppointmentShyButton(), ilCalendarViewGUI\getContentByPlugins(), ilUtil\getImagePath(), and ILIAS\Repository\lng().
Referenced by addFullDayEvents().
173 $event_tpl =
new ilTemplate(
'tpl.day_event_view.html',
true,
true,
'Services/Calendar');
176 if ($a_app[
'event']->isMilestone()) {
177 $event_tpl->setCurrentBlock(
'fullday_ms_icon');
178 $event_tpl->setVariable(
'ALT_FD_MS', $this->
lng->txt(
"cal_milestone"));
180 $event_tpl->parseCurrentBlock();
183 $event_tpl->setCurrentBlock(
'fullday_app');
185 $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
186 ?
" (" . $a_app[
'event']->getCompletion() .
"%)" 191 $title = $shy . $compl;
193 $event_tpl->setVariable(
'EVENT_CONTENT', $title);
195 $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
198 $event_tpl->setVariable(
'F_APP_BGCOLOR', $color);
199 $event_tpl->setVariable(
'F_APP_FONTCOLOR', $font_color);
201 $this->
ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
202 $this->
ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id', $a_app[
'event']->getEntryId());
203 $event_tpl->setVariable(
205 $this->
ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit')
208 if ($event_html_by_plugin = $this->
getContentByPlugins($a_app[
'event'], $a_app[
'dstart'], $title, $event_tpl)) {
209 $event_html = $event_html_by_plugin;
211 $event_tpl->parseCurrentBlock();
212 $event_html = $event_tpl->get();
215 $this->tpl->setCurrentBlock(
"content_fd");
216 $this->tpl->setVariable(
"CONTENT_EVENT_FD", $event_html);
217 $this->tpl->parseCurrentBlock();
219 $this->num_appointments++;
getContentByPlugins(ilCalendarEntry $a_cal_entry, int $a_start_date, string $a_content, ilTemplate $a_tpl)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static calculateFontColor(string $a_html_color_code)
Calculate best font color from html hex color code.
getAppointmentShyButton(ilCalendarEntry $a_calendar_entry, string $a_dstart, string $a_title_forced="")
◆ $app_colors
◆ $cal_settings
◆ $colspans
array ilCalendarWeekGUI::$colspans = [] |
|
protected |
◆ $disable_empty
bool ilCalendarWeekGUI::$disable_empty |
|
protected |
◆ $no_add
bool ilCalendarWeekGUI::$no_add |
|
protected |
◆ $num_appointments
int ilCalendarWeekGUI::$num_appointments = 1 |
|
protected |
◆ $raster
int ilCalendarWeekGUI::$raster = 15 |
|
protected |
◆ $seed_info
array ilCalendarWeekGUI::$seed_info = [] |
|
protected |
◆ $timezone
string ilCalendarWeekGUI::$timezone = 'UTC' |
|
protected |
◆ $user_id
int ilCalendarWeekGUI::$user_id = 0 |
|
protected |
◆ $user_settings
◆ $weekdays
array ilCalendarWeekGUI::$weekdays = array() |
|
protected |
The documentation for this class was generated from the following file: