24 include_once(
"Services/Block/classes/class.ilBlockGUI.php");
25 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
58 parent::__construct();
62 $lng->loadLanguageModule(
"dateplaner");
63 $ilHelp->addHelpSection(
"cal_block");
65 include_once(
"./Services/News/classes/class.ilNewsItem.php");
67 $ilCtrl->saveParameter($this,
'bkid');
81 if(!isset(
$_GET[
"bkid"]))
83 $title = $lng->txt(
"calendar");
92 $this->allow_moving =
false;
95 include_once(
'Services/Calendar/classes/class.ilDate.php');
96 include_once(
'Services/Calendar/classes/class.ilCalendarUserSettings.php');
99 if ((!isset(
$_GET[
"seed"]) ||
$_GET[
"seed"] ==
"") &&
102 $seed_str =
$_SESSION[
"il_cal_block_".$this->getBlockType().
"_".$this->
getBlockId().
"_seed"];
104 else if (isset(
$_GET[
"seed"]))
106 $seed_str =
$_GET[
"seed"];
109 if (isset(
$_GET[
"seed"]) &&
$_GET[
"seed"] !=
"")
125 $tpl->addCSS(
"./Services/Calendar/css/calendar.css");
127 $tpl->addCSS(
"./Services/Calendar/templates/default/delos.css");
129 $mode = $ilUser->getPref(
"il_pd_cal_mode");
140 return self::$block_type;
160 $cmd_class = $ilCtrl->getCmdClass();
162 if ($cmd_class ==
"ilcalendarappointmentgui" ||
163 $cmd_class ==
"ilcalendardaygui" ||
164 $cmd_class ==
"ilcalendarweekgui" ||
165 $cmd_class ==
"ilcalendarmonthgui" ||
166 $cmd_class ==
"ilcalendarinboxgui" ||
167 $cmd_class ==
"ilconsultationhoursgui" ||
168 $_GET[
'cmd'] ==
'showCalendarSubscription')
173 switch($ilCtrl->getCmd())
192 $next_class = $ilCtrl->getNextClass();
193 $cmd = $ilCtrl->getCmd(
"getHTML");
199 case "ilcalendarappointmentgui":
200 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
202 $ilCtrl->forwardCommand($app_gui);
205 case "ilcalendardaygui":
206 $ilTabs->setSubTabActive(
'app_day');
207 include_once(
'./Services/Calendar/classes/class.ilCalendarDayGUI.php');
209 $ilCtrl->forwardCommand($day_gui);
212 case "ilcalendarweekgui":
213 $ilTabs->setSubTabActive(
'app_week');
214 include_once(
'./Services/Calendar/classes/class.ilCalendarWeekGUI.php');
216 $ilCtrl->forwardCommand($week_gui);
219 case "ilcalendarmonthgui":
220 $ilTabs->setSubTabActive(
'app_month');
221 include_once(
'./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
223 $ilCtrl->forwardCommand($month_gui);
226 case "ilcalendarinboxgui":
227 include_once(
'./Services/Calendar/classes/class.ilCalendarInboxGUI.php');
229 $ilCtrl->forwardCommand($inbox);
232 case "ilconsultationhoursgui":
233 include_once(
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php');
235 $ilCtrl->forwardCommand($hours);
239 return $this->
$cmd();
250 $this->enable_edit = $a_enable_edit;
260 return $this->enable_edit;
272 $this->
setRowTemplate(
"tpl.pd_event_list.html",
"Services/Calendar");
282 "Services/Calendar");
303 include_once(
'Services/Calendar/classes/class.ilCalendarUtil.php');
304 $a_tpl->setCurrentBlock(
'month_header_col');
305 $a_tpl->setVariable(
'TXT_WEEKDAY', $lng->txt(
"cal_week_abbrev"));
306 $a_tpl->parseCurrentBlock();
307 for($i = (
int) $this->user_settings->getWeekStart();$i < (7 + (int) $this->user_settings->getWeekStart());$i++)
309 $a_tpl->setCurrentBlock(
'month_header_col');
311 $a_tpl->parseCurrentBlock();
314 if(isset(
$_GET[
"bkid"]))
316 $user_id =
$_GET[
"bkid"];
317 $disable_empty =
true;
321 $user_id = $ilUser->getId();
322 $disable_empty =
false;
324 include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
326 $this->scheduler->addSubitemCalendars(
true);
327 $this->scheduler->calculate();
332 $this->user_settings->getWeekStart())->
get() as $date)
336 $events = $this->scheduler->getByDay($date,$ilUser->getTimeZone());
337 $has_events = (bool)count($events);
338 if($has_events || !$disable_empty)
340 $a_tpl->setCurrentBlock(
'month_col_link');
344 $a_tpl->setCurrentBlock(
'month_col_no_link');
351 $a_tpl->setVariable(
'DAY_CLASS',
'calminiinactive');
355 $week_has_events =
true;
356 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
357 foreach($events as $event)
360 if($booking->hasBooked($event[
'event']->getEntryId()))
362 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
370 $week_has_events =
true;
371 $a_tpl->setVariable(
'DAY_CLASS',
'calminiapp');
380 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
381 $ilCtrl->setParameterByClass(
'ilcalendardaygui',
'seed',$date->get(
IL_CAL_DATE));
382 $a_tpl->setVariable(
'OPEN_DAY_VIEW', $ilCtrl->getLinkTargetByClass(
'ilcalendardaygui',
''));
383 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
385 $a_tpl->setVariable(
'MONTH_DAY',$month_day);
387 $a_tpl->parseCurrentBlock();
390 $a_tpl->setCurrentBlock(
'month_col');
392 include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
395 $a_tpl->setVariable(
'TD_CLASS',
'calminitoday');
397 #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY)) 399 # $a_tpl->setVariable('TD_CLASS','calmininow'); 403 $a_tpl->setVariable(
'TD_CLASS',
'calministd');
407 $a_tpl->setVariable(
'TD_CLASS',
'calminiprev');
411 $a_tpl->setVariable(
'TD_CLASS',
'calmininext');
414 $a_tpl->parseCurrentBlock();
419 if(!$disable_empty || $week_has_events)
421 $a_tpl->setCurrentBlock(
'month_row_link');
422 $ilCtrl->clearParametersByClass(
'ilcalendarweekgui');
423 $ilCtrl->setParameterByClass(
'ilcalendarweekgui',
'seed',$date->get(
IL_CAL_DATE));
424 $a_tpl->setVariable(
'OPEN_WEEK_VIEW', $ilCtrl->getLinkTargetByClass(
'ilcalendarweekgui',
''));
425 $ilCtrl->clearParametersByClass(
'ilcalendarweekgui');
429 $a_tpl->setCurrentBlock(
'month_row_no_link');
430 $a_tpl->setVariable(
'WEEK_CLASS',
'calminiinactive');
432 $a_tpl->setVariable(
'WEEK',
434 $a_tpl->parseCurrentBlock();
436 $a_tpl->setCurrentBlock(
'month_row');
437 $a_tpl->setVariable(
'TD_CLASS',
'calminiweek');
438 $a_tpl->parseCurrentBlock();
440 $week_has_events =
false;
443 $a_tpl->setCurrentBlock(
'mini_month');
444 $a_tpl->setVariable(
'TXT_MONTH_OVERVIEW', $lng->txt(
"cal_month_overview"));
445 $a_tpl->setVariable(
'TXT_MONTH',
448 $myseed = clone($this->seed);
449 $ilCtrl->setParameterByClass(
'ilcalendarmonthgui',
'seed',$myseed->get(
IL_CAL_DATE));
450 $a_tpl->setVariable(
'OPEN_MONTH_VIEW',$ilCtrl->getLinkTargetByClass(
'ilcalendarmonthgui',
''));
453 $ilCtrl->setParameter($this,
'seed',$myseed->get(
IL_CAL_DATE));
456 $a_tpl->setVariable(
'BL_ID', $this->
getBlockId());
458 $a_tpl->setVariable(
'PREV_MONTH',
459 $ilCtrl->getLinkTarget($this,
"setSeed"));
460 $a_tpl->setVariable(
'PREV_MONTH_ASYNC',
461 $ilCtrl->getLinkTarget($this,
"setSeed",
"",
true));
464 $ilCtrl->setParameter($this,
'seed',$myseed->get(
IL_CAL_DATE));
465 $a_tpl->setVariable(
'NEXT_MONTH',
466 $ilCtrl->getLinkTarget($this,
"setSeed"));
467 $a_tpl->setVariable(
'NEXT_MONTH_ASYNC',
468 $ilCtrl->getLinkTarget($this,
"setSeed",
"",
true));
470 $ilCtrl->setParameter($this,
'seed',
"");
471 $a_tpl->parseCurrentBlock();
487 #if ($this->getEnableEdit()) 492 include_once(
"./Services/News/classes/class.ilRSSButtonGUI.php");
494 $this->ctrl->getLinkTarget($this,
'showCalendarSubscription'),
495 $lng->txt(
'ical_export'),
503 if(!isset(
$_GET[
"bkid"]))
505 if($ilAccess->checkAccess(
'edit_event',
'',(
int)
$_GET[
'ref_id']))
507 $ilCtrl->setParameter($this,
"add_mode",
"block");
509 $ilCtrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI",
511 $lng->txt(
"add_appointment"));
512 $ilCtrl->setParameter($this,
"add_mode",
"");
515 global $ilObjDataCache;
517 include_once
"Modules/Course/classes/class.ilCourseParticipants.php";
518 $obj_id = $ilObjDataCache->lookupObjId((
int) $_GET[
'ref_id']);
520 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
522 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
524 foreach($users as $user_id)
526 if(!isset($_GET[
"bkid"]))
528 include_once
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
533 $next_app = end($appointments);
534 reset($appointments);
536 foreach($appointments as $entry)
543 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
545 if(!in_array($obj_id, $booking_entry->getTargetObjIds()))
550 if(!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(),
$GLOBALS[
'ilUser']->getId()))
558 $ilCtrl->setParameter($this,
"bkid", $user_id);
561 $ilCtrl->setParameter(
569 $ilCtrl->getLinkTargetByClass(
570 "ilCalendarMonthGUI",
575 $this->cal_footer[] =
array(
576 'link' => $ilCtrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''),
582 $ilCtrl->setParameter($this,
"bkid",
"");
583 $ilCtrl->setParameter($this,
'seed',
'');
587 $ilCtrl->setParameter($this,
"bkid",
"");
589 $ilCtrl->getLinkTarget($this),
591 $ilCtrl->setParameter($this,
"bkid", (
int)
$_GET[
"bkid"]);
598 $ilCtrl->getLinkTarget($this,
"editSettings"),
599 $lng->txt(
"settings"));
602 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed", isset(
$_GET[
"seed"]) ?
$_GET[
"seed"] :
"");
603 $ret = parent::getHTML();
604 $ilCtrl->setParameterByClass(
"ilcolumngui",
"seed",
"");
616 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
618 $events = $schedule->getChangedEvents(
true);
620 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed', 1);
621 $link =
'<a href='.$ilCtrl->getLinkTargetByClass(
'ilcalendarinboxgui',
'').
'>';
622 $ilCtrl->setParameterByClass(
'ilcalendarinboxgui',
'changed',
'');
623 $text =
'<div class="small">'.((int) count($events)).
" ".$lng->txt(
"cal_changed_events_header").
"</div>";
626 return $link.$text.$end_link;
633 $a_content_block->addHeaderCommand($ilCtrl->getParentReturn($this),
634 $lng->txt(
"close"),
true);
648 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
650 if(!isset(
$_GET[
'bkid']))
671 $ilTabs->clearSubTabs();
678 $ilTabs->addSubTabTarget(
'app_day',$this->ctrl->getLinkTargetByClass(
'ilCalendarDayGUI',
''));
679 $ilTabs->addSubTabTarget(
'app_week',$this->ctrl->getLinkTargetByClass(
'ilCalendarWeekGUI',
''));
680 $ilTabs->addSubTabTarget(
'app_month',$this->ctrl->getLinkTargetByClass(
'ilCalendarMonthGUI',
''));
695 if ($ilCtrl->isAsynch())
713 $ilCtrl->returnToParent($this);
721 $tpl =
new ilTemplate(
'tpl.show_calendar_subscription.html',
true,
true,
'Services/Calendar');
723 $tpl->setVariable(
'TXT_TITLE',$lng->txt(
'cal_subscription_header'));
724 $tpl->setVariable(
'TXT_INFO',$lng->txt(
'cal_subscription_info'));
725 $tpl->setVariable(
'TXT_CAL_URL',$lng->txt(
'cal_subscription_url'));
727 include_once
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
751 $token->setCalendar($calendar);
752 $hash = $token->add();
754 $url = ILIAS_HTTP_PATH.
'/calendar.php?client_id='.CLIENT_ID.
'&token='.$hash;
756 $tpl->setVariable(
'VAL_CAL_URL',
$url);
757 $tpl->setVariable(
'VAL_CAL_URL_TXT',
$url);
759 include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
761 $content_block->setContent(
$tpl->get());
762 $content_block->setTitle($lng->txt(
"calendar"));
763 $content_block->addHeaderCommand($this->ctrl->getParentReturn($this),
764 $lng->txt(
"selected_items_back"));
766 return $content_block->getHTML();
775 foreach((
array) $this->cal_footer as $link_info)
777 $this->tpl->setCurrentBlock(
'data_section');
778 $this->tpl->setVariable(
'DATA',
779 sprintf(
'<a href="%s">%s</a>',$link_info[
'link'],$link_info[
'txt'])
782 $this->tpl->parseCurrentBlock();
788 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
789 if ($this->tpl->blockExists(
"block_footer"))
791 $this->tpl->setCurrentBlock(
"block_footer");
792 $this->tpl->parseCurrentBlock();
811 $this->
addFooterLink($lng->txt(
"cal_upcoming_events_header"),
812 $ilCtrl->getLinkTarget($this,
"setPdModeEvents"),
813 $ilCtrl->getLinkTarget($this,
"setPdModeEvents",
"",
true),
815 false,
false, ($this->display_mode !=
'mmon'));
821 $ilCtrl->getLinkTarget($this,
"setPdModeMonth"),
822 $ilCtrl->getLinkTarget($this,
"setPdModeMonth",
"",
true),
824 false,
false, ($this->display_mode ==
'mmon'));
834 $ilUser->writePref(
"il_pd_cal_mode",
"evt");
835 $this->display_mode =
"evt";
836 if ($ilCtrl->isAsynch())
843 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
851 $ilUser->writePref(
"il_pd_cal_mode",
"mmon");
852 $this->display_mode =
"mmon";
853 if ($ilCtrl->isAsynch())
860 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
870 include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
872 $schedule->addSubitemCalendars(
true);
873 $schedule->setEventsLimit(20);
874 $schedule->calculate();
875 $events = $schedule->getScheduledEvents();
880 foreach($events as $item)
883 $end = $item[
"dend"];
895 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
896 $ilCtrl->setParameterByClass(
'ilcalendardaygui',
'seed',
$start->get(
IL_CAL_DATE));
897 $link = $ilCtrl->getLinkTargetByClass(
'ilcalendardaygui',
'');
898 $ilCtrl->clearParametersByClass(
'ilcalendardaygui');
902 "title" => $item[
"event"]->getPresentationTitle(),
912 "date" => $lng->txt(
"msg_no_search_result"),
static _buildMonthDayList($a_month, $a_year, $weekstart)
Build a month day list.
Consultation hours editor.
addFooterLink($a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
Add a footer text/link.
static _numericDayToString($a_day, $a_long=true)
get
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
static getScreenMode()
Get Screen Mode for current command.
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
static _lookupFullname($a_user_id)
Lookup Full Name.
static _getInstanceByUserId($a_user_id)
get singleton instance
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.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
showCalendarSubscription()
setEnableEdit($a_enable_edit=0)
Set EnableEdit.
executeCommand()
execute command
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
static getBlockType()
Get block type.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
getHTML()
Get bloch HTML code.
setColSpan($a_colspan)
Set Columns Span.
initCategories()
init categories
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
static lookupBookableUsersForObject($a_obj_id, $a_user_ids)
Consultation hours are offered if 1) consultation hour owner is admin or tutor and no object assignme...
returnToUpperContext()
Return to upper context.
fillDataSection()
Fill data section.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
static getAppointments($a_user_id)
Get all appointments.
static _lookupObjId($a_id)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
special template class to simplify handling of ITX/PEAR
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
addCloseCommand($a_content_block)
static _getInstance($a_usr_id=0)
get singleton instance
Create styles array
The data for the language used.
__construct($a_skip_init=false)
Constructor.
getBlockId()
Get Block Id.
setLimit($a_limit)
Set Limit.
Administrate calendar appointments.
Calendar blocks, displayed in different contexts, e.g.
getEnableEdit()
Get EnableEdit.
static lookupAuthToken($a_user_id, $a_selection, $a_calendar=0)
getColSpan()
Get Columns Span.
static isRepositoryObject()
Is this a repository object.
This class represents a block method of a block.
Handles calendar authentication tokens for external calendar subscriptions.
addMiniMonth($a_tpl)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab...
BlockGUI class for (centered) Content on Personal Desktop.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
setSelectionType($a_type)
set selection type
fillDataSection()
Standard implementation for row based data.
getOverview()
Get overview.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
static _isToday($date)
check if a date is today
getCurrentDetailLevel()
Get Current Detail Level.
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
const MODE_PERSONAL_DESKTOP_ITEMS