5include_once(
"Services/Block/classes/class.ilBlockGUI.php");
 
    6include_once 
'./Services/Calendar/classes/class.ilCalendarCategories.php';
 
   60        parent::__construct();
 
   62        $this->tabs = 
$DIC->tabs();
 
   63        $this->obj_data_cache = 
$DIC[
"ilObjDataCache"];
 
   64        $this->ui = 
$DIC->ui();
 
   70        $ilHelp = 
$DIC[
"ilHelp"];
 
   73        $lng->loadLanguageModule(
"dateplaner");
 
   74        $ilHelp->addHelpSection(
"cal_block");
 
   76        include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
   78        $ilCtrl->saveParameter($this, 
'bkid');
 
   99        $this->allow_moving = 
false;
 
  102        include_once(
'Services/Calendar/classes/class.ilDate.php');
 
  103        include_once(
'Services/Calendar/classes/class.ilCalendarUserSettings.php');
 
  106        if ((!isset(
$_GET[
"seed"]) || 
$_GET[
"seed"] == 
"") &&
 
  109        } elseif (isset(
$_GET[
"seed"])) {
 
  110            $seed_str = 
$_GET[
"seed"];
 
  113        if (isset(
$_GET[
"seed"]) && 
$_GET[
"seed"] != 
"") {
 
  118        if ($seed_str == 
"") {
 
  140        return ($this->
settings->getShowWeeks() && $this->user_settings->getShowWeeks());
 
  167        $this->parent_gui = $a_val;
 
  187        $this->force_month_view = $a_val;
 
  189            $this->display_mode = 
"mmon";
 
  212        $cmd_class = 
$ilCtrl->getCmdClass();
 
  214        if ($cmd_class == 
"ilcalendarappointmentgui" ||
 
  215            $cmd_class == 
"ilconsultationhoursgui" ||
 
  216            $_GET[
'cmd'] == 
'showCalendarSubscription') {
 
  240        $next_class = 
$ilCtrl->getNextClass();
 
  241        $cmd = 
$ilCtrl->getCmd(
"getHTML");
 
  245        switch ($next_class) {
 
  246            case "ilcalendarappointmentgui":
 
  247                include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
 
  249                $ilCtrl->forwardCommand($app_gui);
 
  252            case "ilconsultationhoursgui":
 
  253                include_once(
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php');
 
  255                $ilCtrl->forwardCommand($hours);
 
  258            case "ilcalendarappointmentpresentationgui":
 
  261                $ilCtrl->forwardCommand($presentation);
 
  264            case "ilcalendarmonthgui":
 
  265                $ilTabs->setSubTabActive(
'app_month');
 
  266                include_once(
'./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
 
  268                $ilCtrl->forwardCommand($month_gui);
 
  272                return $this->$cmd();
 
  283        $this->enable_edit = $a_enable_edit;
 
  293        return $this->enable_edit;
 
  304            $this->
setRowTemplate(
"tpl.pd_event_list.html", 
"Services/Calendar");
 
  311                    "tpl.calendar_block.html",
 
  333        $target_class = array();
 
  335            $target_class = array(
"ilpersonaldesktopgui", 
"ilcalendarpresentationgui");
 
  339                    $target_class = array(
"ilobjcoursegui", 
"ilcalendarpresentationgui");
 
  343                    $target_class = array(
"ilobjgroupgui", 
"ilcalendarpresentationgui");
 
  347        return $target_class;
 
  363        include_once(
'Services/Calendar/classes/class.ilCalendarUtil.php');
 
  365            $a_tpl->setCurrentBlock(
'month_header_col');
 
  366            $a_tpl->setVariable(
'TXT_WEEKDAY', 
$lng->txt(
"cal_week_abbrev"));
 
  367            $a_tpl->parseCurrentBlock();
 
  369        for (
$i = (
int) $this->user_settings->getWeekStart();
$i < (7 + (
int) $this->user_settings->getWeekStart());
$i++) {
 
  370            $a_tpl->setCurrentBlock(
'month_header_col');
 
  372            $a_tpl->parseCurrentBlock();
 
  375        if (isset(
$_GET[
"bkid"])) {
 
  376            $user_id = 
$_GET[
"bkid"];
 
  377            $disable_empty = 
true;
 
  380            $disable_empty = 
false;
 
  382        include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
 
  384        $this->scheduler->addSubitemCalendars(
true);
 
  385        $this->scheduler->calculate();
 
  391            $this->user_settings->getWeekStart()
 
  395            $events = $this->scheduler->getByDay($date, 
$ilUser->getTimeZone());
 
  396            $has_events = (bool) count(
$events);
 
  397            if ($has_events || !$disable_empty) {
 
  398                $a_tpl->setCurrentBlock(
'month_col_link');
 
  400                $a_tpl->setCurrentBlock(
'month_col_no_link');
 
  403            if ($disable_empty) {
 
  405                    $a_tpl->setVariable(
'DAY_CLASS', 
'calminiinactive');
 
  407                    $week_has_events = 
true;
 
  408                    include_once 
'Services/Booking/classes/class.ilBookingEntry.php';
 
  411                        if ($booking->hasBooked($event[
'event']->getEntryId())) {
 
  412                            $a_tpl->setVariable(
'DAY_CLASS', 
'calminiapp');
 
  417            } elseif ($has_events) {
 
  418                $week_has_events = 
true;
 
  419                $a_tpl->setVariable(
'DAY_CLASS', 
'calminiapp');
 
  429            if ($agenda_view_type = (
int) 
$_GET[
'cal_agenda_per']) {
 
  432            $a_tpl->setVariable(
'OPEN_DAY_VIEW', 
$ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(), 
''));
 
  434            $a_tpl->setVariable(
'MONTH_DAY', $month_day);
 
  436            $a_tpl->parseCurrentBlock();
 
  439            $a_tpl->setCurrentBlock(
'month_col');
 
  441            include_once(
'./Services/Calendar/classes/class.ilCalendarUtil.php');
 
  443                $a_tpl->setVariable(
'TD_CLASS', 
'calminitoday');
 
  445            #elseif(ilDateTime::_equals($date,$this->seed,IL_CAL_DAY)) 
  447            #   $a_tpl->setVariable('TD_CLASS','calmininow'); 
  450                $a_tpl->setVariable(
'TD_CLASS', 
'calministd');
 
  452                $a_tpl->setVariable(
'TD_CLASS', 
'calminiprev');
 
  454                $a_tpl->setVariable(
'TD_CLASS', 
'calmininext');
 
  457            $a_tpl->parseCurrentBlock();
 
  460            if ($counter and !($counter % 7)) {
 
  462                    $a_tpl->setCurrentBlock(
'week');
 
  467                    $a_tpl->parseCurrentBlock();
 
  470                $a_tpl->setCurrentBlock(
'month_row');
 
  472                $a_tpl->parseCurrentBlock();
 
  474                $week_has_events = 
false;
 
  477        $a_tpl->setCurrentBlock(
'mini_month');
 
  480        $first_of_month = substr($this->seed->get(
IL_CAL_DATE), 0, 7) . 
"-01";
 
  486        $prev_link = 
$ilCtrl->getLinkTarget($this, 
"setSeed", 
"", 
true);
 
  490        $next_link = 
$ilCtrl->getLinkTarget($this, 
"setSeed", 
"", 
true);
 
  492        $ilCtrl->setParameter($this, 
'seed', 
"");
 
  498        $b1 = 
$ui->factory()->button()->standard(
$lng->txt(
"previous"), 
"#")->withOnLoadCode(
function (
$id) use ($prev_link, $blockgui) {
 
  500                "$('#" . 
$id . 
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
 
  501                "_" . $blockgui->getBlockId() . 
"','" . $prev_link . 
"'); return false;});";
 
  505        $ilCtrl->clearParameterByClass(
"ilcalendarblockgui", 
'seed');
 
  506        $month_link = 
$ilCtrl->getLinkTarget($this, 
"setSeed", 
"", 
true, 
false);
 
  507        $seed_parts = explode(
"-", $this->seed->get(
IL_CAL_DATE));
 
  508        $b2 = 
$ui->factory()->button()->month($seed_parts[1] . 
"-" . $seed_parts[0])->withOnLoadCode(
function (
$id) use ($month_link, $blockgui) {
 
  509            return "$('#" . 
$id . 
"').on('il.ui.button.month.changed', function(el, id, month) { var m = month.split('-'); ilBlockJSHandler('block_" . $blockgui->getBlockType() .
 
  510                "_" . $blockgui->getBlockId() . 
"','" . $month_link . 
"' + '&seed=' + m[1] + '-' + m[0] + '-01'); return false;});";
 
  513        $b3 = 
$ui->factory()->button()->standard(
$lng->txt(
"next"), 
"#")->withOnLoadCode(
function (
$id) use ($next_link, $blockgui) {
 
  515                "$('#" . 
$id . 
"').click(function() { ilBlockJSHandler('block_" . $blockgui->getBlockType() .
 
  516                "_" . $blockgui->getBlockId() . 
"','" . $next_link . 
"'); return false;});";
 
  520        $vc = 
$ui->factory()->viewControl()->section($b1, $b2, $b3);
 
  521        $a_tpl->setVariable(
"VIEW_CTRL_SECTION", 
$ui->renderer()->render($vc));
 
  523        $a_tpl->parseCurrentBlock();
 
  535        $ui_factory = 
$DIC->ui()->factory();
 
  536        $ui_renderer = 
$DIC->ui()->renderer();
 
  539        $gui_path[] = 
"ilcalendarsubscriptiongui";
 
  540        $url = $this->ctrl->getLinkTargetByClass($gui_path, 
'getModalForSubscription', 
"", 
true, 
false);
 
  542        $roundtrip = $ui_factory->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
 
  544        $standard_button = $ui_factory->button()->standard(
$lng->txt(
'btn_ical'), 
'')->withOnClick(
 
  545            $roundtrip->getShowSignal()
 
  552        $out = $ui_renderer->render($components);
 
  560            '<span class="ilIcalIcon">' . 
$out . 
'</span>' 
  584            if (!isset(
$_GET[
"bkid"])) {
 
  596                include_once 
"Modules/Course/classes/class.ilCourseParticipants.php";
 
  597                $obj_id = $ilObjDataCache->lookupObjId((
int) 
$_GET[
'ref_id']);
 
  599                $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
 
  601                include_once 
'Services/Booking/classes/class.ilBookingEntry.php';
 
  603                foreach (
$users as $user_id) {
 
  604                    if (!isset(
$_GET[
"bkid"])) {
 
  605                        include_once 
'./Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
 
  610                        $next_app = end($appointments);
 
  611                        reset($appointments);
 
  613                        foreach ($appointments as $entry) {
 
  618                            include_once 
'Services/Booking/classes/class.ilBookingEntry.php';
 
  620                            if (!in_array($obj_id, $booking_entry->getTargetObjIds())) {
 
  624                            if (!$booking_entry->isAppointmentBookableForUser($entry->getEntryId(), 
$user->getId())) {
 
  656                            $this->cal_footer[] = array(
 
  657                                'link' => 
$ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(), 
'selectCHCalendarOfUser'),
 
  666                $ilCtrl->setParameter($this, 
"bkid", 
"");
 
  667                $ilCtrl->setParameter($this, 
'seed', 
'');
 
  669                $ilCtrl->setParameter($this, 
"bkid", 
"");
 
  674                $ilCtrl->setParameter($this, 
"bkid", (
int) 
$_GET[
"bkid"]);
 
  680                $ilCtrl->getLinkTarget($this, 
"editSettings"),
 
  681                $lng->txt(
"settings")
 
  686        $ret = parent::getHTML();
 
  692            $f = 
$DIC->ui()->factory()->legacy(
"");
 
  693            $ret .= 
$DIC->ui()->renderer()->renderAsync(
$f);
 
  708        include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
 
  710        $events = $schedule->getChangedEvents(
true);
 
  712        $ilCtrl->setParameterByClass(
'ilcalendarinboxgui', 
'changed', 1);
 
  713        $link = 
'<a href=' . 
$ilCtrl->getLinkTargetByClass(
'ilcalendarinboxgui', 
'') . 
'>';
 
  714        $ilCtrl->setParameterByClass(
'ilcalendarinboxgui', 
'changed', 
'');
 
  715        $text = 
'<div class="small">' . ((int) count(
$events)) . 
" " . 
$lng->txt(
"cal_changed_events_header") . 
"</div>";
 
  718        return $link . 
$text . $end_link;
 
  726        $a_content_block->addHeaderCommand(
 
  727            $ilCtrl->getParentReturn($this),
 
  748        elseif (!$cats->getMode()) {
 
  751                (
int) 
$_GET[
'ref_id'],
 
  766        $ilTabs->clearSubTabs();
 
  794        $ilCtrl->returnToParent($this);
 
  808        $tpl = 
new ilTemplate(
'tpl.show_calendar_subscription.html', 
true, 
true, 
'Services/Calendar');
 
  810        $tpl->setVariable(
'TXT_TITLE', 
$lng->txt(
'cal_subscription_header'));
 
  811        $tpl->setVariable(
'TXT_INFO', 
$lng->txt(
'cal_subscription_info'));
 
  812        $tpl->setVariable(
'TXT_CAL_URL', 
$lng->txt(
'cal_subscription_url'));
 
  814        include_once 
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
 
  816        switch ($this->mode) {
 
  832            $token->setSelectionType($selection);
 
  836        $url = ILIAS_HTTP_PATH . 
'/calendar.php?client_id=' . CLIENT_ID . 
'&token=' . $hash;
 
  838        $tpl->setVariable(
'VAL_CAL_URL', 
$url);
 
  839        $tpl->setVariable(
'VAL_CAL_URL_TXT', 
$url);
 
  841        include_once(
"./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
 
  843        $content_block->setContent(
$tpl->get());
 
  844        $content_block->setTitle(
$lng->txt(
"calendar"));
 
  845        $content_block->addHeaderCommand(
 
  846            $this->ctrl->getParentReturn($this),
 
  847            $lng->txt(
"selected_items_back")
 
  850        return $content_block->getHTML();
 
  856        foreach ((array) $this->cal_footer as $link_info) {
 
  857            $this->tpl->setCurrentBlock(
'data_section');
 
  858            $this->tpl->setVariable(
 
  860                sprintf(
'<a href="%s">%s</a>', $link_info[
'link'], $link_info[
'txt'])
 
  862            $this->tpl->parseCurrentBlock();
 
  868        $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
 
  869        if ($this->tpl->blockExists(
"block_footer")) {
 
  870            $this->tpl->setCurrentBlock(
"block_footer");
 
  871            $this->tpl->parseCurrentBlock();
 
  888                $lng->txt(
"cal_upcoming_events_header"),
 
  889                $ilCtrl->getLinkTarget($this, 
"setPdModeEvents"),
 
  890                $ilCtrl->getLinkTarget($this, 
"setPdModeEvents", 
"", 
true),
 
  891                "block_" . $this->getBlockType() . 
"_" . $this->block_id,
 
  894                ($this->display_mode != 
'mmon')
 
  898                $lng->txt(
"app_month"),
 
  899                $ilCtrl->getLinkTarget($this, 
"setPdModeMonth"),
 
  900                $ilCtrl->getLinkTarget($this, 
"setPdModeMonth", 
"", 
true),
 
  901                "block_" . $this->getBlockType() . 
"_" . $this->block_id,
 
  904                ($this->display_mode == 
'mmon')
 
  909                $ilCtrl->setParameterByClass(
'ilcalendarpresentationgui', 
'seed', 
'');
 
  911                    $lng->txt(
"cal_open_calendar"),
 
  912                    $ilCtrl->getLinkTargetByClass($this->getTargetGUIClassPath(), 
""),
 
  914                    "block_" . $this->getBlockType() . 
"_" . $this->block_id,
 
  919                $ilCtrl->setParameter($this, 
"add_mode", 
"");
 
  921                    $lng->txt(
"add_appointment"),
 
  922                    $ilCtrl->getLinkTargetByClass(
"ilCalendarAppointmentGUI", 
"add"),
 
  924                    "block_" . $this->getBlockType() . 
"_" . $this->block_id,
 
  928                $ilCtrl->setParameter($this, 
"add_mode", 
"");
 
  939        $ilUser->writePref(
"il_pd_cal_mode", 
"evt");
 
  940        $this->display_mode = 
"evt";
 
  945            $ilCtrl->redirectByClass(
"ilpersonaldesktopgui", 
"show");
 
  954        $ilUser->writePref(
"il_pd_cal_mode", 
"mmon");
 
  955        $this->display_mode = 
"mmon";
 
  960            $ilCtrl->redirectByClass(
"ilpersonaldesktopgui", 
"show");
 
  974        include_once(
'./Services/Calendar/classes/class.ilCalendarSchedule.php');
 
  976        $schedule->addSubitemCalendars(
true); 
 
  977        $schedule->setEventsLimit(20);
 
  978        $schedule->calculate();
 
  979        $ev = $schedule->getScheduledEvents(); 
 
  995                $this->ctrl->setParameter($this, 
"app_id", $item[
"event"]->getEntryId());
 
  996                $this->ctrl->setParameter($this, 
'dt', $item[
'dstart']);
 
  997                $url = $this->ctrl->getLinkTarget($this, 
"getModalForApp", 
"", 
true, 
false);
 
  998                $this->ctrl->setParameter($this, 
"app_id", 
$_GET[
"app_id"]);
 
  999                $this->ctrl->setParameter($this, 
"dt", 
$_GET[
"dt"]);
 
 1000                $modal = 
$f->modal()->roundtrip(
'', [])->withAsyncRenderUrl(
$url);
 
 1004                $comps = [
$f->button()->shy($item[
"event"]->getPresentationTitle(), 
"")->withOnClick($modal->getShowSignal()), $modal];
 
 1005                $renderer = 
$ui->renderer();
 
 1006                $shy = $renderer->render($comps);
 
 1010                    "title" => $item[
"event"]->getPresentationTitle(),
 
 1012                    "shy_button" => $shy
 
 1018                    "date" => 
$lng->txt(
"msg_no_search_result"),
 
 1037        $start = $item[
"dstart"];
 
 1038        $end = $item[
"dend"];
 
 1039        if ($item[
"fullday"]) {
 
 1046        return array(
"start" => 
$start, 
"end" => 
$end);
 
 1060        $f = 
$ui->factory();
 
 1061        $r = 
$ui->renderer();
 
 1066            if ($item[
"event"]->getEntryId() == (
int) 
$_GET[
"app_id"] && $item[
'dstart'] == (
int) 
$_GET[
'dt']) {
 
 1070                include_once(
"./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
 
 1072                $content = 
$ilCtrl->getHTML($next_gui);
 
 1075                echo 
$r->renderAsync($modal);
 
An exception for terminatinating execution or to throw for unit testing.
This class represents a block method of a block.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setLimit($a_limit)
Set Limit.
getCurrentDetailLevel()
Get Current Detail Level.
getBlockId()
Get Block Id.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
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.
getRepositoryMode()
Get RepositoryMode.
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
fillDataSection()
Standard implementation for row based data.
setColSpan($a_colspan)
Set Columns Span.
setTitle($a_title)
Set Title.
setBlockId($a_block_id=0)
Set Block Id.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getColSpan()
Get Columns Span.
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...
Administrate calendar appointments.
static _getInstance(ilDate $seed, $a_app)
get singleton instance
Handles calendar authentication tokens for external calendar subscriptions.
static lookupAuthToken($a_user_id, $a_selection, $a_calendar=0)
Calendar blocks, displayed in different contexts, e.g.
setParentGUI($a_val)
Set parent gui.
getEnableEdit()
Get EnableEdit.
setEnableEdit($a_enable_edit=0)
Set EnableEdit.
initCategories()
init categories
addMiniMonth($a_tpl)
Add mini version of monthly overview (Maybe extracted to another class, if used in pd calendar tab.
addCloseCommand($a_content_block)
isRepositoryObject()
Returns whether block has a corresponding repository object.bool
getDatesForItem($item)
Get start/end date for item.
fillDataSection()
Fill data section.
getModalForApp()
Get modal for appointment (see similar code in ilCalendarAgendaListGUI) todo use all this methods fro...
getShowWeeksColumn()
Show weeks column.
getHTML()
Get bloch HTML code.
addSubscriptionBlockCommand()
Add subscription block command.
executeCommand()
execute command
__construct()
Constructor.
getOverview()
Get overview.
static getScreenMode()
Get Screen Mode for current command.
getParentGUI()
Get parent gui.
returnToUpperContext()
Return to upper context.
showCalendarSubscription()
getTargetGUIClassPath()
Get target gui class path (for presenting the calendar)
getForceMonthView()
Get force month view.
setForceMonthView($a_val)
Set force month view.
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
const MODE_PERSONAL_DESKTOP_ITEMS
const MODE_REPOSITORY_CONTAINER_ONLY
static _getInstance($a_usr_id=0)
get singleton instance
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _getInstance()
get singleton instance
static _getInstanceByUserId($a_user_id)
get singleton instance
static _isToday($date)
check if a date is today
static _numericDayToString($a_day, $a_long=true)
get
static _buildMonthDayList($a_month, $a_year, $weekstart)
Build a month day list.
static getAppointments($a_user_id)
Get all appointments.
Consultation hours editor.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
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 _lookupFullname($a_user_id)
Lookup Full Name.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
BlockGUI class for (centered) Content on Personal Desktop.
special template class to simplify handling of ITX/PEAR
if(!array_key_exists('StateId', $_REQUEST)) $id