54        $this->timezone = $this->
user->getTimeZone();
 
   67        $ilCtrl = 
$DIC[
'ilCtrl'];
 
   70        $this->ctrl->saveParameter($this, 
'seed');
 
   72        $next_class = $ilCtrl->getNextClass();
 
   73        switch ($next_class) {
 
   74            case "ilcalendarappointmentpresentationgui":
 
   75                $this->ctrl->setReturn($this, 
"");
 
   76                include_once(
"./Services/Calendar/classes/class.ilCalendarAppointmentPresentationGUI.php");
 
   78                $this->ctrl->forwardCommand($gui);
 
   80            case 'ilcalendarappointmentgui':
 
   81                $this->ctrl->setReturn($this, 
'');
 
   82                $this->tabs_gui->setSubTabActive(
$_SESSION[
'cal_last_tab']);
 
   87                include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
 
   89                $this->ctrl->forwardCommand(
$app);
 
   93                $time = microtime(
true);
 
   94                $cmd = $this->ctrl->getCmd(
"show");
 
   96                $tpl->setContent($this->tpl->get());
 
   97                #echo "Zeit: ".(microtime(true) - $time);
 
  113        $evening_aggr = $this->user_settings->getDayEnd() * 60;
 
  115        $this->tpl = 
new ilTemplate(
'tpl.week_view.html', 
true, 
true, 
'Services/Calendar');
 
  117        include_once(
'./Services/YUI/classes/class.ilYuiUtil.php');
 
  121        $this->tpl->setVariable(
'NAVIGATION', $navigation->getHTML());
 
  125        include_once(
'Services/Calendar/classes/class.ilCalendarSchedule.php');
 
  127        $this->scheduler->addSubitemCalendars(
true);
 
  128        $this->scheduler->calculate();
 
  132        $all_fullday = array();
 
  134            $daily_apps = $this->scheduler->getByDay($date, $this->timezone);
 
  135            if (!$this->view_with_appointments && count($daily_apps)) {
 
  136                $this->view_with_appointments = 
true;
 
  147            $this->weekdays[] = $date;
 
  149            $num_apps[$date->get(
IL_CAL_DATE)] = count($daily_apps);
 
  151            $all_fullday[] = $daily_apps;
 
  157        include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
 
  163            $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'seed', $date->get(
IL_CAL_DATE));
 
  164            $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'idate', $date->get(
IL_CAL_DATE));
 
  165            $this->ctrl->setParameterByClass(
'ilcalendardaygui', 
'seed', $date->get(
IL_CAL_DATE));
 
  167            if (!$this->no_add) {
 
  173            $this->tpl->setCurrentBlock(
'day_header_row');
 
  174            $this->tpl->setVariable(
'DAY_COLSPAN', max($this->colspans[$counter], 1));
 
  175            $this->tpl->parseCurrentBlock();
 
  186        $this->tpl->setVariable(
"TXT_TIME", $this->lng->txt(
"time"));
 
  198        $event_tpl = 
new ilTemplate(
'tpl.day_event_view.html', 
true, 
true, 
'Services/Calendar');
 
  201        if ($a_app[
'event']->isMilestone()) {
 
  202            $event_tpl->setCurrentBlock(
'fullday_ms_icon');
 
  203            $event_tpl->setVariable(
'ALT_FD_MS', $this->lng->txt(
"cal_milestone"));
 
  205            $event_tpl->parseCurrentBlock();
 
  208        $event_tpl->setCurrentBlock(
'fullday_app');
 
  210        $compl = ($a_app[
'event']->isMilestone() && $a_app[
'event']->getCompletion() > 0)
 
  211            ? 
" (" . $a_app[
'event']->getCompletion() . 
"%)" 
  216        $title = $shy . $compl;
 
  218        $event_tpl->setVariable(
'EVENT_CONTENT', $title);
 
  220        $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
 
  223        $event_tpl->setVariable(
'F_APP_BGCOLOR', $color);
 
  224        $event_tpl->setVariable(
'F_APP_FONTCOLOR', $font_color);
 
  226        $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
 
  227        $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'app_id', $a_app[
'event']->getEntryId());
 
  228        $event_tpl->setVariable(
'F_APP_EDIT_LINK', $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui', 
'edit'));
 
  230        if ($event_html_by_plugin = $this->
getContentByPlugins($a_app[
'event'], $a_app[
'dstart'], $title, $event_tpl)) {
 
  231            $event_html = $event_html_by_plugin;
 
  233            $event_tpl->parseCurrentBlock();
 
  234            $event_html = $event_tpl->get();
 
  237        $this->tpl->setCurrentBlock(
"content_fd");
 
  238        $this->tpl->setVariable(
"CONTENT_EVENT_FD", $event_html);
 
  239        $this->tpl->parseCurrentBlock();
 
  241        $this->num_appointments++;
 
  252        $event_tpl = 
new ilTemplate(
'tpl.week_event_view.html', 
true, 
true, 
'Services/Calendar');
 
  256        if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
 
  257            $this->tpl->setCurrentBlock(
'not_empty');
 
  259            $this->tpl->setCurrentBlock(
'scrd_not_empty');
 
  262        $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
 
  263        $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'app_id', $a_app[
'event']->getEntryId());
 
  265        $color = $this->app_colors->getColorByAppointment($a_app[
'event']->getEntryId());
 
  266        $style = 
'background-color: ' . $color . 
';';
 
  271        if (!$a_app[
'event']->isFullDay()) {
 
  274            $td_style .= $a_app[
'event']->getPresentationStyle();
 
  279        $title = ($time != 
"")? $time . 
" " . $shy : $shy;
 
  281        $event_tpl->setCurrentBlock(
'event_cell_content');
 
  282        if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
 
  283            $event_tpl->setVariable(
"STYLE", $style);
 
  285        $event_tpl->setVariable(
'EVENT_CONTENT', $title);
 
  287        if ($event_html_by_plugin = $this->
getContentByPlugins($a_app[
'event'], $a_app[
'dstart'], $title, $event_tpl)) {
 
  288            $event_html = $event_html_by_plugin;
 
  290            $event_tpl->parseCurrentBlock();
 
  291            $event_html = $event_tpl->get();
 
  294        $this->tpl->setVariable(
'GRID_CONTENT', $event_html);
 
  296        if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
 
  298            $this->tpl->parseCurrentBlock();
 
  300            $this->tpl->setCurrentBlock(
'day_cell');
 
  302            $this->tpl->setVariable(
'DAY_ID', 
'a'.$this->num_appointments);
 
  303            $this->tpl->setVariable(
'TD_ROWSPAN', $a_app[
'rowspan']);
 
  304            $this->tpl->setVariable(
'TD_STYLE',$a_app[
'event']->getPresentationStyle());
 
  305            $this->tpl->setVariable(
'TD_CLASS', 
'calevent il_calevent');
 
  307            $this->tpl->parseCurrentBlock();
 
  310            $this->tpl->setVariable(
'DIV_STYLE', $style);
 
  311            $this->tpl->parseCurrentBlock();
 
  314        $this->num_appointments++;
 
  323    protected function parseHourInfo($daily_apps, $date, $num_day, $hours = 
null, $morning_aggr, $evening_aggr)
 
  330            $hours[
$i][$num_day][
'apps_start'] = array();
 
  331            $hours[
$i][$num_day][
'apps_num'] = 0;
 
  332            switch ($this->user_settings->getTimeFormat()) {
 
  334                    if ($morning_aggr > 0 && 
$i == $morning_aggr) {
 
  335                        $hours[
$i][$num_day][
'txt'] = sprintf(
'%02d:00', 0) . 
' - ' .
 
  336                            sprintf(
'%02d:00', ceil((
$i + 1) / 60));
 
  338                        $hours[
$i][$num_day][
'txt'] .= sprintf(
'%02d:%02d', floor(
$i / 60), 
$i % 60);
 
  340                    if ($evening_aggr < 23 * 60 && 
$i == $evening_aggr) {
 
  341                        $hours[
$i][$num_day][
'txt'] .= 
' - ' . sprintf(
'%02d:00', 0);
 
  346                    if ($morning_aggr > 0 && 
$i == $morning_aggr) {
 
  347                        $hours[
$i][$num_day][
'txt'] =
 
  348                            date(
'h a', mktime(0, 0, 0, 1, 1, 2000)) . 
' - ' .
 
  349                            date(
'h a', mktime($this->user_settings->getDayStart(), 0, 0, 1, 1, 2000));
 
  351                        $hours[
$i][$num_day][
'txt'] .= date(
'h a', mktime(floor(
$i / 60), 
$i % 60, 0, 1, 1, 2000));
 
  353                    if ($evening_aggr < 23 * 60 && 
$i == $evening_aggr) {
 
  354                        $hours[
$i][$num_day][
'txt'] =
 
  355                            date(
'h a', mktime($this->user_settings->getDayEnd(), 0, 0, 1, 1, 
'2000')) . 
' - ' .
 
  356                            date(
'h a', mktime(0, 0, 0, 1, 1, 2000));
 
  365        foreach ($daily_apps as 
$app) {
 
  367            if (
$app[
'fullday']) {
 
  372            if (
$app[
'start_info'][
'mday'] != $date_info[
'mday']) {
 
  375                $start = 
$app[
'start_info'][
'hours'] * 60 + 
$app[
'start_info'][
'minutes'];
 
  381            if (
$app[
'end_info'][
'mday'] != $date_info[
'mday']) {
 
  383            } elseif (
$app[
'start_info'][
'hours'] == 
$app[
'end_info'][
'hours']) {
 
  386                $end = 
$app[
'end_info'][
'hours'] * 60 + 
$app[
'end_info'][
'minutes'];
 
  392            if (
$ilUser->prefs[
"screen_reader_optimization"]) {
 
  396            if ($start < $morning_aggr) {
 
  397                $start = $morning_aggr;
 
  399            if ($end <= $morning_aggr) {
 
  402            if ($start > $evening_aggr) {
 
  403                $start = $evening_aggr;
 
  405            if ($end > $evening_aggr + $this->raster) {
 
  408            if ($end <= $start) {
 
  419                    if (!
$ilUser->prefs[
"screen_reader_optimization"]) {
 
  420                        $app[
'rowspan'] = ceil(($end - $start) / $this->raster);
 
  424                    $hours[
$i][$num_day][
'apps_start'][] = 
$app;
 
  427                $hours[
$i][$num_day][
'apps_num']++;
 
  446        foreach ($hours as $hour_num => $hours_per_day) {
 
  447            foreach ($hours_per_day as $num_day => $hour) {
 
  448                $this->colspans[$num_day] = max($this->colspans[$num_day], $hour[
'apps_num']);
 
  451                if (
$ilUser->prefs[
"screen_reader_optimization"]) {
 
  452                    $this->colspans[$num_day] = 1;
 
  463        if ($this->user_settings->getDayStart()) {
 
  465            $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $this->raster);
 
  470        return $morning_aggr;
 
  479        $new_app_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui', 
'add');
 
  481        if ($this->cal_settings->getEnableGroupMilestones()) {
 
  482            $new_ms_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui', 
'addMilestone');
 
  484            $this->tpl->setCurrentBlock(
"new_ms");
 
  485            $this->tpl->setVariable(
'DD_ID', $date->get(
IL_CAL_UNIX));
 
  486            $this->tpl->setVariable(
'DD_TRIGGER', $this->ui_renderer->render($this->ui_factory->symbol()->glyph()->add()));
 
  487            $this->tpl->setVariable(
'URL_DD_NEW_APP', $new_app_url);
 
  488            $this->tpl->setVariable(
'TXT_DD_NEW_APP', $this->lng->txt(
'cal_new_app'));
 
  489            $this->tpl->setVariable(
'URL_DD_NEW_MS', $new_ms_url);
 
  490            $this->tpl->setVariable(
'TXT_DD_NEW_MS', $this->lng->txt(
'cal_new_ms'));
 
  491            $this->tpl->parseCurrentBlock();
 
  493            $this->tpl->setCurrentBlock(
"new_app");
 
  495            $this->tpl->setVariable(
'NEW_APP_GLYPH', $this->ui_renderer->render(
 
  496                $this->ui_factory->symbol()->glyph()->add($new_app_url)
 
  499            $this->tpl->parseCurrentBlock();
 
  502        $this->ctrl->clearParametersByClass(
'ilcalendarappointmentgui');
 
  510        if (isset(
$_GET[
"bkid"])) {
 
  511            $this->user_id = 
$_GET[
"bkid"];
 
  512            $this->disable_empty = 
true;
 
  513            $this->no_add = 
true;
 
  516            $this->disable_empty = 
false;
 
  517            $this->no_add = 
true;
 
  520            $this->disable_empty = 
false;
 
  521            $this->no_add = 
false;
 
  533        $daydate = $dayname . 
' ' . $date_info[
'mday'] . 
'.';
 
  535        if (!$this->disable_empty || $num_apps[$date->get(
IL_CAL_DATE)] > 0) {
 
  536            $link = $this->ctrl->getLinkTargetByClass(
'ilcalendardaygui', 
'');
 
  537            $this->ctrl->clearParametersByClass(
'ilcalendardaygui');
 
  539            $this->tpl->setCurrentBlock(
"day_view_link");
 
  540            $this->tpl->setVariable(
'HEADER_DATE', $daydate);
 
  541            $this->tpl->setVariable(
'DAY_VIEW_LINK', $link);
 
  542            $this->tpl->parseCurrentBlock();
 
  544            $this->tpl->setCurrentBlock(
"day_view_no_link");
 
  545            $this->tpl->setVariable(
'HEADER_DATE', $daydate);
 
  546            $this->tpl->parseCurrentBlock();
 
  556        foreach ($all_fullday as $daily_apps) {
 
  557            foreach ($daily_apps as $event) {
 
  558                if ($event[
'fullday']) {
 
  562            $this->tpl->setCurrentBlock(
'f_day_row');
 
  563            $this->tpl->setVariable(
'COLSPAN', max($this->colspans[$counter], 1));
 
  564            $this->tpl->parseCurrentBlock();
 
  567        $this->tpl->setCurrentBlock(
'fullday_apps');
 
  568        $this->tpl->setVariable(
'TXT_F_DAY', $this->lng->txt(
"cal_all_day"));
 
  569        $this->tpl->parseCurrentBlock();
 
  582        $renderer = 
$DIC->ui()->renderer();
 
  584        $new_link_counter = 0;
 
  586        foreach ($hours as $num_hour => $hours_per_day) {
 
  588            foreach ($hours_per_day as $num_day => $hour) {
 
  590                #ADD the hours in the left side of the grid. 
  592                    if (!($num_hour % 60) || ($num_hour == $morning_aggr && $morning_aggr) ||
 
  593                        ($num_hour == $evening_aggr && $evening_aggr)) {
 
  597                        if (($num_hour == $morning_aggr && $morning_aggr) ||
 
  598                            ($num_hour == $evening_aggr && $evening_aggr)) {
 
  599                            $this->tpl->setVariable(
'TIME_ROWSPAN', 1);
 
  603                            $this->tpl->setVariable(
'TIME_ROWSPAN', 60 / $this->raster);
 
  606                        $this->tpl->setCurrentBlock(
'time_txt');
 
  608                        $this->tpl->setVariable(
'TIME', $hour[
'txt']);
 
  609                        $this->tpl->parseCurrentBlock();
 
  613                foreach ($hour[
'apps_start'] as 
$app) {
 
  618                if ($this->
user->prefs[
"screen_reader_optimization"]) {
 
  619                    $this->tpl->setCurrentBlock(
'scrd_day_cell');
 
  620                    $this->tpl->setVariable(
'TD_CLASS', 
'calstd');
 
  621                    $this->tpl->parseCurrentBlock();
 
  624                #echo "NUMDAY: ".$num_day;
 
  625                #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />';
 
  626                $num_apps = $hour[
'apps_num'];
 
  627                $colspan = max($this->colspans[$num_day], 1);
 
  630                if (!$hour[
'apps_num'] && !$this->
user->prefs[
"screen_reader_optimization"] && !$this->no_add) {
 
  631                    $this->tpl->setCurrentBlock(
'new_app_link');
 
  633                    $this->ctrl->clearParameterByClass(
'ilcalendarappointmentgui', 
'app_id');
 
  635                    $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'idate', $this->weekdays[$num_day]->
get(
IL_CAL_DATE));
 
  636                    $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'seed', $this->seed->get(
IL_CAL_DATE));
 
  637                    $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui', 
'hour', floor($num_hour / 60));
 
  640                    $new_app_url = $this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui', 
'add');
 
  641                    $this->tpl->setVariable(
"DAY_NEW_APP_LINK", $renderer->render(
$ui_factory->symbol()->glyph()->add($new_app_url)));
 
  644                    $this->tpl->setVariable(
'DAY_NEW_ID', ++$new_link_counter);
 
  645                    $this->tpl->parseCurrentBlock();
 
  648                for (
$i = $colspan;
$i > $hour[
'apps_num'];
$i--) {
 
  649                    if ($this->
user->prefs[
"screen_reader_optimization"]) {
 
  652                    $this->tpl->setCurrentBlock(
'day_cell');
 
  656                    if ($num_hour % 60 == 60 - $this->raster ||
 
  657                        ($num_hour == $morning_aggr && $morning_aggr) ||
 
  658                        ($num_hour == $evening_aggr && $evening_aggr)) {
 
  659                        $empty_border = 
' calempty_border';
 
  662                    $this->tpl->setVariable(
'TD_CLASS', 
'calempty createhover' . $empty_border);
 
  664                    $this->tpl->setVariable(
'DAY_ID', ++$day_id_counter);
 
  665                    $this->tpl->setVariable(
'TD_ROWSPAN', 1);
 
  666                    $this->tpl->parseCurrentBlock();
 
  670            $this->tpl->touchBlock(
'time_row');
 
  681        switch ($this->user_settings->getTimeFormat()) {
 
  691        if ($this->
user->prefs[
"screen_reader_optimization"]) {
 
  692            switch ($this->user_settings->getTimeFormat()) {
 
An exception for terminatinating execution or to throw for unit testing.
Administrate calendar appointments.
static _getInstance(ilDate $seed, $a_app)
get singleton instance
Model for a calendar entry.
getEnd()
get end @access public
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 _numericDayToString($a_day, $a_long=true)
get
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
getAppointmentShyButton($a_calendar_entry, $a_dstart, $a_title_forced="")
const CAL_PRESENTATION_WEEK
getCurrentApp()
Get app for id.
getContentByPlugins($a_cal_entry, $a_start_date, $a_content, $a_tpl)
getAppointmentTimeString(ilCalendarEntry $a_event)
setUpCalendar()
Set values for: user_id, disable_empty, no_add.
addTimedEvents($hours, $morning_aggr, $evening_aggr)
__construct(ilDate $seed_date)
Constructor.
addHeaderDate($date, $num_apps)
showFulldayAppointment($a_app)
show fullday appointment
calculateColspans($hours)
calculate colspan
executeCommand()
Execute command.
addFullDayEvents($all_fullday)
addAppointmentLink($date)
Add the links to create an appointment or milestone.
showAppointment($a_app)
show appointment
parseHourInfo($daily_apps, $date, $num_day, $hours=null, $morning_aggr, $evening_aggr)
calculate overlapping hours
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initDragDrop(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc