/**
  * get singleton instance
  *
  * @access public
  * @param int $a_usr_id user id
  * @return ilCalendarCategories
  * @static
  */
 public static function _getInstance($a_usr_id = 0)
 {
     if (self::$instance) {
         return self::$instance;
     }
     return self::$instance = new ilCalendarCategories($a_usr_id);
 }
 /**
  * Constructor
  *
  * @access public
  * @param
  * @return
  */
 public function __construct($a_parent_obj, $a_parent_cmd, $a_category_id)
 {
     global $lng, $ilCtrl;
     $this->categories = ilCalendarCategories::_getInstance();
     $this->cat_id = $a_category_id;
     $this->is_editable = $this->categories->isEditable($this->cat_id);
     $this->lng = $lng;
     $this->lng->loadLanguageModule('dateplaner');
     $this->ctrl = $ilCtrl;
     $this->setId('calcalapps');
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setFormName('appointments');
     $this->addColumn('', 'f', "1");
     $this->addColumn($this->lng->txt('cal_start'), 'dt_sort', "30%");
     $this->addColumn($this->lng->txt('title'), 'title', "60%");
     $this->addColumn($this->lng->txt('cal_duration'), 'duration', "20%");
     $this->addColumn($this->lng->txt('cal_recurrences'), 'frequence', "10%");
     if ($this->is_editable) {
         $this->addMultiCommand('askDeleteAppointments', $this->lng->txt('delete'));
         $this->enable('select_all');
     } else {
         $this->disable('select_all');
     }
     $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.show_appointment_row.html", "Services/Calendar");
     $this->setShowRowsSelector(true);
     $this->enable('sort');
     $this->enable('header');
     $this->enable('numinfo');
     $this->setDefaultOrderField('dt_sort');
     $this->setSelectAllCheckbox('appointments');
 }
 /**
  * Handle Request
  * @return 
  */
 public function handleRequest()
 {
     $this->initIlias();
     $this->initTokenHandler();
     if ($this->getTokenHandler()->getIcal() and !$this->getTokenHandler()->isIcalExpired()) {
         ilUtil::deliverData($this->getTokenHandler(), 'calendar.ics', 'text/calendar', 'utf-8');
     }
     include_once './Services/Calendar/classes/Export/class.ilCalendarExport.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     if ($this->getTokenHandler()->getSelectionType() == ilCalendarAuthenticationToken::SELECTION_CALENDAR) {
         #$export = new ilCalendarExport(array($this->getTokenHandler()->getCalendar()));
         $cats = ilCalendarCategories::_getInstance();
         $cats->initialize(ilCalendarCategories::MODE_REMOTE_SELECTED, $this->getTokenHandler()->getCalendar());
         $export = new ilCalendarExport($cats->getCategories(true));
     } else {
         $cats = ilCalendarCategories::_getInstance();
         $cats->initialize(ilCalendarCategories::MODE_REMOTE_ACCESS);
         $export = new ilCalendarExport($cats->getCategories(true));
     }
     $export->export();
     $this->getTokenHandler()->setIcal($export->getExportString());
     $this->getTokenHandler()->storeIcal();
     $GLOBALS['ilAuth']->logout();
     ilUtil::deliverData($export->getExportString(), 'calendar.ics', 'text/calendar', 'utf-8');
     #echo $export->getExportString();
     #echo nl2br($export->getExportString());
     #$fp = fopen('ilias.ics', 'w');
     #fwrite($fp,$export->getExportString());
     exit;
 }
 /**
  * Constructor
  *
  * @access public
  * @param int user_id
  * @return
  */
 public function __construct($a_user_id)
 {
     global $ilDB;
     $this->db = $ilDB;
     $this->user_id = $a_user_id;
     $this->categories = ilCalendarCategories::_getInstance();
     $this->read();
 }
 /**
  * init categories
  *
  * @access protected
  * @param
  * @return
  */
 protected function initCategories()
 {
     include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
     if (ilCalendarUserSettings::_getInstance()->getCalendarSelectionType() == ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP) {
         $this->mode = ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP;
     } else {
         $this->mode = ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS;
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     ilCalendarCategories::_getInstance()->initialize($this->mode, (int) $_GET['ref_id'], true);
 }
Exemplo n.º 6
0
 /**
  * Get tail dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
 {
     if ($a_entity == "personal_data") {
         include_once "./Services/Calendar/classes/class.ilCalendarCategories.php";
         $cal_ids = array();
         foreach ($a_ids as $user_id) {
             foreach (ilCalendarCategories::lookupPrivateCategories($user_id) as $ct) {
                 $cal_ids[] = $ct["cat_id"];
             }
         }
         return array(array("component" => "Services/User", "entity" => "usr_profile", "ids" => $a_ids), array("component" => "Services/User", "entity" => "usr_multi", "ids" => $a_ids), array("component" => "Services/User", "entity" => "usr_setting", "ids" => $a_ids), array("component" => "Services/Bookmarks", "entity" => "bookmarks", "ids" => $a_ids), array("component" => "Services/Notes", "entity" => "user_notes", "ids" => $a_ids), array("component" => "Services/Calendar", "entity" => "calendar", "ids" => $cal_ids));
     }
     return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
 }
 /**
  * init mini-calendar
  *
  * Used to display personal appointments and bookings in the minicalendar
  * copied from ilPDBlockCalendar
  *
  * @access protected
  */
 private function initCalendar()
 {
     global $ilUser;
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     $cats = ilCalendarCategories::_getInstance($ilUser->getId());
     include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
     if (ilCalendarUserSettings::_getInstance()->getCalendarSelectionType() == ilCalendarUserSettings::CAL_SELECTION_MEMBERSHIP) {
         $cats->initialize(ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP);
     } else {
         $cats->initialize(ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS);
     }
     //if there was no calendar-category before or the calendar was deleted
     $categoriesInfo = $cats->getCategoriesInfo();
     if ($this->cal_cat_id == 0 || !isset($categoriesInfo[$this->cal_cat_id])) {
         //create a new calendar-category
         $this->cal_cat_id = $this->createBookingsCalendarCategory();
     }
 }
 /**
  * Constructor
  *
  * @access public
  * @param
  * @return
  */
 public function __construct($a_parent_obj, $a_parent_cmd)
 {
     global $lng, $ilCtrl;
     $this->categories = ilCalendarCategories::_getInstance();
     $this->lng = $lng;
     $this->lng->loadLanguageModule('dateplaner');
     $this->ctrl = $ilCtrl;
     $this->setId('calinbox');
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setFormName('appointments');
     $this->addColumn($this->lng->txt('date'), 'begin', "30%");
     $this->addColumn($this->lng->txt('title'), 'title', "40%");
     #$this->addColumn($this->lng->txt('cal_duration'),'duration',"15%");
     $this->addColumn($this->lng->txt('cal_recurrences'), 'frequence', "15%");
     $this->addColumn($this->lng->txt('last_update'), 'last_update', "15%");
     $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.show_changed_appointment_row.html", "Services/Calendar");
     $this->setShowRowsSelector(true);
     $this->enable('sort');
     $this->enable('header');
     $this->enable('numinfo');
     $this->setDefaultOrderField('last_update');
     $this->setDefaultOrderDirection('desc');
 }
 /**
  * Read events (will be moved to another class, since only active and/or visible calendars are shown)
  *
  * @access protected
  */
 public function getEvents()
 {
     global $ilDB;
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     $cats = ilCalendarCategories::_getInstance($this->user->getId())->getCategories($this->enabledSubitemCalendars());
     if (!$this->filter_bookings) {
         $cats = $this->hidden_cat->filterHidden($cats, ilCalendarCategories::_getInstance($this->user->getId())->getCategoriesInfo());
     }
     if (!count($cats)) {
         return array();
     }
     // TODO: optimize
     $query = "SELECT ce.cal_id cal_id FROM cal_entries ce LEFT JOIN cal_recurrence_rules crr ON ce.cal_id = crr.cal_id " . "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id ";
     if ($this->type != self::TYPE_INBOX) {
         $query .= "WHERE ((starta <= " . $this->db->quote($this->end->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . " " . "AND enda >= " . $this->db->quote($this->start->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ") " . "OR (starta <= " . $this->db->quote($this->end->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . " " . "AND NOT rule_id IS NULL)) ";
     } else {
         $date = new ilDateTime(mktime(0, 0, 0), IL_CAL_UNIX);
         $query .= "WHERE starta >= " . $this->db->quote($date->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp');
     }
     $query .= "AND " . $ilDB->in('ca.cat_id', $cats, false, 'integer') . " " . "ORDER BY starta";
     $res = $this->db->query($query);
     $events = array();
     include_once 'Services/Booking/classes/class.ilBookingEntry.php';
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         if (!$this->hidden_cat->isAppointmentVisible($row->cal_id) || $this->filter_bookings) {
             $event = new ilCalendarEntry($row->cal_id);
             if (!$this->filter_bookings) {
                 $events[] = $event;
             } else {
                 $booking = new ilBookingEntry($event->getContextId());
                 if (!$booking->isBookedOut($row->cal_id, true)) {
                     $events[] = $event;
                 }
             }
         }
     }
     return $events;
 }
 /**
  * Get calendars
  */
 public function getCalendars()
 {
     global $ilUser, $tree;
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     include_once './Services/Calendar/classes/class.ilCalendarHidden.php';
     $hidden_obj = ilCalendarHidden::_getInstanceByUserId($ilUser->getId());
     $hidden = $hidden_obj->getHidden();
     $cats = ilCalendarCategories::_getInstance($ilUser->getId());
     $all = $cats->getCategoriesInfo();
     $tmp_title_counter = array();
     $categories = array();
     foreach ($all as $category) {
         $tmp_arr['obj_id'] = $category['obj_id'];
         $tmp_arr['id'] = $category['cat_id'];
         $tmp_arr['hidden'] = (bool) in_array($category['cat_id'], $hidden);
         $tmp_arr['title'] = $category['title'];
         $tmp_arr['type'] = $category['type'];
         // Append object type to make type sortable
         $tmp_arr['type_sortable'] = ilCalendarCategory::lookupCategorySortIndex($category['type']);
         if ($category['type'] == ilCalendarCategory::TYPE_OBJ) {
             $tmp_arr['type_sortable'] .= '_' . ilObject::_lookupType($category['obj_id']);
         }
         $tmp_arr['color'] = $category['color'];
         $tmp_arr['editable'] = $category['editable'];
         $categories[] = $tmp_arr;
         // count title for appending the parent container if there is more than one entry.
         $tmp_title_counter[$category['type'] . '_' . $category['title']]++;
     }
     $path_categories = array();
     foreach ($categories as $cat) {
         if ($cat['type'] == ilCalendarCategory::TYPE_OBJ) {
             if ($tmp_title_counter[$cat['type'] . '_' . $cat['title']] > 1) {
                 foreach (ilObject::_getAllReferences($cat['obj_id']) as $ref_id) {
                     $cat['path'] = $this->buildPath($ref_id);
                     break;
                 }
             }
         }
         $path_categories[] = $cat;
     }
     $path_categories = ilUtil::sortArray($path_categories, 'title', "asc");
     $this->calendars = $path_categories;
 }
 /**
  * get shared calendars of user
  *
  * @access public
  * @param int user id
  * @return array shared calendar info
  * @static
  */
 public static function getSharedCalendarsForUser($a_usr_id = 0)
 {
     global $ilDB, $ilUser, $rbacreview;
     if (!$a_usr_id) {
         $a_usr_id = $ilUser->getId();
     }
     $query = "SELECT * FROM cal_shared " . "WHERE obj_type = " . $ilDB->quote(self::TYPE_USR, 'integer') . " " . "AND obj_id = " . $ilDB->quote($a_usr_id, 'integer') . " " . "ORDER BY create_date";
     $res = $ilDB->query($query);
     $calendars = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $calendars[] = $row->cal_id;
         $shared[$row->cal_id]['cal_id'] = $row->cal_id;
         $shared[$row->cal_id]['create_date'] = $row->create_date;
         $shared[$row->cal_id]['obj_type'] = $row->obj_type;
     }
     $assigned_roles = $rbacreview->assignedRoles($ilUser->getId());
     $query = "SELECT * FROM cal_shared " . "WHERE obj_type = " . $ilDB->quote(self::TYPE_ROLE, 'integer') . " " . "AND " . $ilDB->in('obj_id', $assigned_roles, false, 'integer');
     $res = $ilDB->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         if (in_array($row->cal_id, $calendars)) {
             continue;
         }
         if (ilCalendarCategories::_isOwner($ilUser->getId(), $row->cal_id)) {
             continue;
         }
         $shared[$row->cal_id]['cal_id'] = $row->cal_id;
         $shared[$row->cal_id]['create_date'] = $row->create_date;
         $shared[$row->cal_id]['obj_type'] = $row->obj_type;
     }
     return $shared ? $shared : array();
     // TODO: return also role calendars
 }
 /**
  * delete category
  *
  * @access public
  * @param
  * @return
  * @static
  */
 public static function deleteCategory($a_obj_id)
 {
     global $ilLog;
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     if (!($cat_id = ilCalendarCategories::_lookupCategoryIdByObjId($a_obj_id))) {
         $ilLog->write(__METHOD__ . ': Cannot find calendar category for obj_id ' . $a_obj_id);
         return false;
     }
     $category = new ilCalendarCategory($cat_id);
     $category->delete();
 }
 public function __construct($a_user_id, $a_consultation_hour_group_ids = null)
 {
     $this->user_id = $a_user_id;
     $this->group_ids = $a_consultation_hour_group_ids;
     $this->cats = ilCalendarCategories::_getInstance();
 }
 /**
  * Sync external calendars
  */
 protected function synchroniseExternalCalendars()
 {
     global $ilUser;
     if (!ilCalendarSettings::_getInstance()->isWebCalSyncEnabled()) {
         return false;
     }
     // @todo make this thread safe
     $limit = new ilDateTime(time(), IL_CAL_UNIX);
     $limit->increment(IL_CAL_HOUR, -1 * ilCalendarSettings::_getInstance()->getWebCalSyncHours());
     $cats = ilCalendarCategories::_getInstance($ilUser->getId());
     foreach ($cats->getCategoriesInfo() as $cat_id => $info) {
         if ($info['remote']) {
             // Check for execution
             $category = new ilCalendarCategory($cat_id);
             if (ilDateTime::_before($category->getRemoteSyncLastExecution(), $limit)) {
                 // update in any case to avoid multiple updates of invalid calendar sources.
                 $category->setRemoteSyncLastExecution(new ilDateTime(time(), IL_CAL_UNIX));
                 $category->update();
                 include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
                 $remote = new ilCalendarRemoteReader($category->getRemoteUrl());
                 $remote->setUser($category->getRemoteUser());
                 $remote->setPass($category->getRemotePass());
                 $remote->read();
                 $remote->import($category);
                 break;
             }
         }
     }
 }
Exemplo n.º 15
0
 /**
  * Generate Calendar Entries
  *
  * @param
  * @return
  */
 function generateCalendarEntries($a_num_per_course = 10)
 {
     include_once "./Services/Calendar/classes/class.ilDateTime.php";
     include_once "./Services/Calendar/classes/class.ilCalendarEntry.php";
     include_once "./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php";
     include_once "./Services/Calendar/classes/class.ilCalendarCategories.php";
     $this->log("Creating Calendar Entries");
     $crs_ref_ids = ilUtil::_getObjectsByOperations("crs", "read", 0, $limit = 1000000);
     $cnt = 1;
     foreach ($crs_ref_ids as $rid) {
         $obj_id = ilObject::_lookupObjId($rid);
         $cat_id = ilCalendarCategories::_lookupCategoryIdByObjId($obj_id);
         $start = new ilDate(time(), IL_CAL_UNIX);
         $end = new ilDate(time(), IL_CAL_UNIX);
         $end->increment(IL_CAL_HOUR, 2);
         for ($i = 1; $i <= $a_num_per_course; $i++) {
             $this->log("Event " . $cnt);
             $entry = new ilCalendarEntry();
             $entry->setStart($start);
             //ilDateTiem
             $entry->setEnd($end);
             //ilDateTiem
             $entry->setFullday(false);
             //ilDateTiem
             $entry->setTitle("Event " . $cnt);
             //ilDateTiem
             $entry->save();
             $id = $entry->getEntryId();
             $ass = new ilCalendarCategoryAssignments($id);
             $ass->addAssignment($cat_id);
             $start->increment(IL_CAL_DAY, 1);
             $end->increment(IL_CAL_DAY, 1);
             //echo "-$cat_id-";
             //echo "+".ilDatePresentation::formatDate($start)."+";
             $cnt++;
         }
     }
 }
 /**
  * show info screen
  *
  * @access protected
  * @return
  */
 protected function showInfoScreen()
 {
     global $tpl, $ilUser;
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     $info->setFormAction($this->ctrl->getFormAction($this));
     if ($this->app->isMilestone()) {
         $info->addSection($this->lng->txt('cal_ms_details'));
     } else {
         $info->addSection($this->lng->txt('cal_details'));
     }
     // Appointment
     $info->addProperty($this->lng->txt('appointment'), ilDatePresentation::formatPeriod($this->app->getStart(), $this->app->getEnd()));
     $info->addProperty($this->lng->txt('title'), $this->app->getPresentationTitle());
     // Description
     if (strlen($desc = $this->app->getDescription())) {
         $info->addProperty($this->lng->txt('description'), $desc);
     }
     // Location
     if (strlen($loc = $this->app->getLocation())) {
         $info->addProperty($this->lng->txt('cal_where'), $loc);
     }
     // completion
     if ($this->app->isMilestone() && $this->app->getCompletion() > 0) {
         $info->addProperty($this->lng->txt('cal_task_completion'), $this->app->getCompletion() . " %");
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
     $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
     $type = ilObject::_lookupType($cat_info['obj_id']);
     if ($this->app->isMilestone() && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ && ($type == "grp" || $type == "crs")) {
         // users responsible
         $users = $this->app->readResponsibleUsers();
         $delim = "";
         foreach ($users as $r) {
             $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
             $delim = "<br />";
         }
         if (count($users) > 0) {
             $info->addProperty($this->lng->txt('cal_responsible'), $value);
         }
     }
     $category = new ilCalendarCategory($cat_id);
     if ($category->getType() == ilCalendarCategory::TYPE_OBJ) {
         $info->addSection($this->lng->txt('additional_info'));
         $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
         $refs = ilObject::_getAllReferences($cat_info['obj_id']);
         include_once './Services/Link/classes/class.ilLink.php';
         $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($cat_info['obj_id']), true);
         $info->addProperty($this->lng->txt('perma_link'), '<a class="small" href="' . $href . '" target="_top">' . $href . '</a>');
     }
     $tpl->setContent($info->getHTML());
 }
Exemplo n.º 17
0
 /**
  * fill data section
  *
  * @access public
  * 
  */
 public function show()
 {
     global $tpl, $ilUser;
     $this->tpl = new ilTemplate('tpl.month_view.html', true, true, 'Services/Calendar');
     include_once './Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initDragDrop();
     ilYuiUtil::initPanel();
     $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::MONTH);
     $this->tpl->setVariable('NAVIGATION', $navigation->getHTML());
     for ($i = (int) $this->user_settings->getWeekStart(); $i < 7 + (int) $this->user_settings->getWeekStart(); $i++) {
         $this->tpl->setCurrentBlock('month_header_col');
         $this->tpl->setVariable('TXT_WEEKDAY', ilCalendarUtil::_numericDayToString($i, true));
         $this->tpl->parseCurrentBlock();
     }
     if (isset($_GET["bkid"])) {
         $user_id = $_GET["bkid"];
         $disable_empty = true;
         $no_add = true;
     } else {
         if ($ilUser->getId() == ANONYMOUS_USER_ID) {
             $user_id = $ilUser->getId();
             $disable_empty = false;
             $no_add = true;
         } else {
             $user_id = $ilUser->getId();
             $disable_empty = false;
             $no_add = false;
         }
     }
     $is_portfolio_embedded = false;
     if (ilCalendarCategories::_getInstance()->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) {
         $no_add = true;
         $is_portfolio_embedded = true;
     }
     include_once 'Services/Calendar/classes/class.ilCalendarSchedule.php';
     $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_MONTH, $user_id);
     $this->scheduler->addSubitemCalendars(true);
     if (sizeof($this->schedule_filters)) {
         foreach ($this->schedule_filters as $filter) {
             $this->scheduler->addFilter($filter);
         }
     }
     $this->scheduler->calculate();
     include_once 'Services/Calendar/classes/class.ilCalendarSettings.php';
     $settings = ilCalendarSettings::_getInstance();
     $counter = 0;
     foreach (ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE, 'm'), $this->seed->get(IL_CAL_FKT_DATE, 'Y'), $this->user_settings->getWeekStart())->get() as $date) {
         $counter++;
         $has_events = (bool) $this->showEvents($date);
         if (!$no_add) {
             include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php";
             $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
             $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE));
             $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
             $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add');
             if ($settings->getEnableGroupMilestones()) {
                 $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
                 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE));
                 $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE));
                 $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone');
                 $this->tpl->setCurrentBlock("new_ms");
                 $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX));
                 $this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD));
                 $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url);
                 $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app'));
                 $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url);
                 $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms'));
                 $this->tpl->parseCurrentBlock();
             } else {
                 $this->tpl->setCurrentBlock("new_app");
                 $this->tpl->setVariable('ADD_LINK', $new_app_url);
                 $this->tpl->setVariable('NEW_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app')));
                 $this->tpl->parseCurrentBlock();
             }
         }
         $day = $date->get(IL_CAL_FKT_DATE, 'j');
         $month = $date->get(IL_CAL_FKT_DATE, 'n');
         if ($day == 1) {
             $month_day = '1 ' . ilCalendarUtil::_numericMonthToString($month, false);
         } else {
             $month_day = $day;
         }
         if (!$is_portfolio_embedded && (!$disable_empty || $has_events)) {
             $this->tpl->setCurrentBlock('month_day_link');
             $this->ctrl->clearParametersByClass('ilcalendardaygui');
             $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE));
             $this->tpl->setVariable('OPEN_DAY_VIEW', $this->ctrl->getLinkTargetByClass('ilcalendardaygui', ''));
             $this->ctrl->clearParametersByClass('ilcalendardaygui');
         } else {
             $this->tpl->setCurrentBlock('month_day_no_link');
         }
         $this->tpl->setVariable('MONTH_DAY', $month_day);
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock('month_col');
         include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
         if (ilCalendarUtil::_isToday($date)) {
             $this->tpl->setVariable('TD_CLASS', 'caltoday');
         } elseif (ilDateTime::_equals($date, $this->seed, IL_CAL_MONTH)) {
             $this->tpl->setVariable('TD_CLASS', 'calstd');
         } elseif (ilDateTime::_before($date, $this->seed, IL_CAL_MONTH)) {
             $this->tpl->setVariable('TD_CLASS', 'calprev');
         } else {
             $this->tpl->setVariable('TD_CLASS', 'calnext');
         }
         $this->tpl->parseCurrentBlock();
         if ($counter and !($counter % 7)) {
             $this->tpl->setCurrentBlock('month_row');
             $this->tpl->parseCurrentBlock();
         }
     }
 }
 /**
  * init categories
  *
  * @access protected
  * @param
  * @return
  */
 protected function initCategories()
 {
     $this->mode = ilCalendarCategories::MODE_REPOSITORY;
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     if (!isset($_GET['bkid'])) {
         ilCalendarCategories::_getInstance()->initialize(ilCalendarCategories::MODE_REPOSITORY, (int) $_GET['ref_id'], true);
     } else {
         ilCalendarCategories::_getInstance()->initialize(ilCalendarCategories::MODE_CONSULTATION, (int) $_GET['bkid'], true);
     }
 }
 public function filterCategories(array $a_cats)
 {
     return $this->hidden_cat->filterHidden($a_cats, ilCalendarCategories::_getInstance($this->user_id)->getCategoriesInfo());
 }
Exemplo n.º 20
0
 /**
  * init categories
  *
  * @access protected
  * @param
  * @return
  */
 protected function initCategories()
 {
     $this->mode = ilCalendarCategories::MODE_REPOSITORY;
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     if (!isset($_GET['bkid'])) {
         ilCalendarCategories::_getInstance()->initialize(ilCalendarCategories::MODE_REPOSITORY, (int) $_GET['ref_id'], true);
     } else {
         // display consultation hours only (in course/group)
         ilCalendarCategories::_getInstance()->setCHUserId((int) $_GET['bkid']);
         ilCalendarCategories::_getInstance()->initialize(ilCalendarCategories::MODE_CONSULTATION, (int) $_GET['ref_id'], true);
     }
 }
Exemplo n.º 21
0
 /**
  * drop an item from user's personal desktop
  *
  * @param 	int		$a_usr_id		id of user object
  * @param	int		$a_item_id		ref_id for objects, that are in the main tree
  *									(learning modules, forums) obj_id for others
  * @param	string	$a_type			object type
  * @static
  */
 public static function _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
 {
     global $ilDB;
     $ilDB->manipulateF("DELETE FROM desktop_item WHERE " . " item_id = %s AND type = %s  AND user_id = %s", array("integer", "text", "integer"), array($a_item_id, $a_type, $a_usr_id));
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     ilCalendarCategories::deletePDItemsCache($a_usr_id);
 }
 protected function renderConsultationHours($a_user_id, $a_mode, $a_group_ids)
 {
     global $ilUser;
     if ($this->getOutputMode() == "preview") {
         return $this->renderConsultationHoursTeaser($a_user_id, $a_mode, $a_group_ids);
     }
     if ($this->getOutputMode() == "offline") {
         return;
     }
     // only if not owner
     if ($ilUser->getId() != $a_user_id) {
         $_GET["bkid"] = $a_user_id;
     }
     if ($a_mode != "manual") {
         $a_group_ids = null;
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     ilCalendarCategories::_getInstance()->setCHUserId($a_user_id);
     ilCalendarCategories::_getInstance()->initialize(ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION, null, true);
     if (!$_REQUEST["seed"]) {
         $seed = new ilDate(time(), IL_CAL_UNIX);
     } else {
         $seed = new ilDate($_REQUEST["seed"], IL_CAL_DATE);
     }
     include_once './Services/Calendar/classes/class.ilCalendarMonthGUI.php';
     $month_gui = new ilCalendarMonthGUI($seed);
     // custom schedule filter: handle booking group ids
     include_once './Services/Calendar/classes/class.ilCalendarScheduleFilterBookings.php';
     $filter = new ilCalendarScheduleFilterBookings($a_user_id, $a_group_ids);
     $month_gui->addScheduleFilter($filter);
     $this->tpl->addCss(ilUtil::getStyleSheetLocation('filesystem', 'delos.css', 'Services/Calendar'));
     return $this->ctrl->getHTML($month_gui);
 }
 /**
  * parse
  *
  * @access public
  * @return
  */
 public function parse()
 {
     global $ilUser, $tree;
     include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
     $cats = ilCalendarCategories::_getInstance($ilUser->getId());
     $cats->initialize(ilCalendarCategories::MODE_MANAGE);
     $tmp_title_counter = array();
     $categories = array();
     foreach ($cats->getCategoriesInfo() as $category) {
         $tmp_arr['obj_id'] = $category['obj_id'];
         $tmp_arr['id'] = $category['cat_id'];
         $tmp_arr['title'] = $category['title'];
         $tmp_arr['type'] = $category['type'];
         // Append object type to make type sortable
         $tmp_arr['type_sortable'] = ilCalendarCategory::lookupCategorySortIndex($category['type']);
         if ($category['type'] == ilCalendarCategory::TYPE_OBJ) {
             $tmp_arr['type_sortable'] .= '_' . ilObject::_lookupType($category['obj_id']);
         }
         $tmp_arr['color'] = $category['color'];
         $tmp_arr['editable'] = $category['editable'];
         $tmp_arr['accepted'] = $category['accepted'];
         $tmp_arr['remote'] = $category['remote'];
         $categories[] = $tmp_arr;
         // count title for appending the parent container if there is more than one entry.
         $tmp_title_counter[$category['type'] . '_' . $category['title']]++;
     }
     $path_categories = array();
     foreach ($categories as $cat) {
         if ($cat['type'] == ilCalendarCategory::TYPE_OBJ) {
             if ($tmp_title_counter[$cat['type'] . '_' . $cat['title']] > 1) {
                 foreach (ilObject::_getAllReferences($cat['obj_id']) as $ref_id) {
                     include_once './Services/Tree/classes/class.ilPathGUI.php';
                     $path = new ilPathGUI();
                     $path->setUseImages(false);
                     $path->enableTextOnly(false);
                     $cat['path'] = $path->getPath(ROOT_FOLDER_ID, $ref_id);
                     break;
                 }
             }
         }
         $path_categories[] = $cat;
     }
     $this->setData($path_categories);
 }
 /**
  * show assigned aapointments
  *
  * @access protected
  * @return
  */
 protected function showAssignedAppointments()
 {
     include_once './Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php';
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     include_once './Services/Calendar/classes/class.ilCalendarAppointmentsTableGUI.php';
     $table_gui = new ilCalendarAppointmentsTableGUI($this, 'details', (int) $_GET['category_id']);
     $table_gui->setTitle($this->lng->txt('cal_assigned_appointments'));
     $table_gui->setAppointments(ilCalendarCategoryAssignments::_getAssignedAppointments(ilCalendarCategories::_getInstance()->getSubitemCategories((int) $_GET['category_id'])));
     return $table_gui->getHTML();
 }
 /**
  * get HTML
  *
  * @access public
  * @param 
  * @return
  */
 public function getHTML($a_app)
 {
     global $tree, $lng, $ilUser;
     self::$counter++;
     $this->tpl = new ilTemplate('tpl.appointment_panel.html', true, true, 'Services/Calendar');
     // Panel variables
     $this->tpl->setVariable('PANEL_NUM', self::$counter);
     $this->tpl->setVariable('PANEL_TITLE', str_replace(' ()', '', $a_app['event']->getPresentationTitle(false)));
     if ($a_app["event"]->isMilestone()) {
         $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_ms_details'));
     } else {
         $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_details'));
     }
     $this->tpl->setVariable('PANEL_TXT_DATE', $this->lng->txt('date'));
     if ($a_app['fullday']) {
         $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(new ilDate($a_app['dstart'], IL_CAL_UNIX), new ilDate($a_app['dend'], IL_CAL_UNIX)));
     } else {
         $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX)));
     }
     if ($a_app['event']->getLocation()) {
         $this->tpl->setVariable('PANEL_TXT_WHERE', $this->lng->txt('cal_where'));
         $this->tpl->setVariable('PANEL_WHERE', ilUtil::makeClickable($a_app['event']->getLocation()), true);
     }
     if ($a_app['event']->getDescription()) {
         $this->tpl->setVariable('PANEL_TXT_DESC', $this->lng->txt('description'));
         $this->tpl->setVariable('PANEL_DESC', ilUtil::makeClickable(nl2br($a_app['event']->getDescription())));
     }
     if ($a_app['event']->isMilestone() && $a_app['event']->getCompletion() > 0) {
         $this->tpl->setVariable('PANEL_TXT_COMPL', $this->lng->txt('cal_task_completion'));
         $this->tpl->setVariable('PANEL_COMPL', $a_app['event']->getCompletion() . " %");
     }
     if ($a_app['event']->isMilestone()) {
         // users responsible
         $users = $a_app['event']->readResponsibleUsers();
         $delim = "";
         foreach ($users as $r) {
             $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
             $delim = "<br />";
         }
         if (count($users) > 0) {
             $this->tpl->setVariable('PANEL_TXT_RESP', $this->lng->txt('cal_responsible'));
             $this->tpl->setVariable('PANEL_RESP', $value);
         }
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     $cat_id = ilCalendarCategoryAssignments::_lookupCategory($a_app['event']->getEntryId());
     $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
     $entry_obj_id = isset($cat_info['subitem_obj_ids'][$cat_id]) ? $cat_info['subitem_obj_ids'][$cat_id] : $cat_info['obj_id'];
     $this->tpl->setVariable('PANEL_TXT_CAL_TYPE', $this->lng->txt('cal_cal_type'));
     switch ($cat_info['type']) {
         case ilCalendarCategory::TYPE_GLOBAL:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_system'));
             break;
         case ilCalendarCategory::TYPE_USR:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_personal'));
             break;
         case ilCalendarCategory::TYPE_OBJ:
             $type = ilObject::_lookupType($cat_info['obj_id']);
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_' . $type));
             // Course group appointment registration
             if ($this->settings->isCGRegistrationEnabled() and $type == 'crs' or type == 'grp') {
                 if (!$a_app['event']->isAutoGenerated()) {
                     include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
                     $reg = new ilCalendarRegistration($a_app['event']->getEntryId());
                     if ($reg->isRegistered($ilUser->getId(), new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX))) {
                         $this->tpl->setCurrentBlock('panel_cancel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']);
                         $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_reg_unregister'));
                         $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmUnregister'));
                         $this->tpl->parseCurrentBlock();
                     } else {
                         $this->tpl->setCurrentBlock('panel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']);
                         $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_reg_register'));
                         $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmRegister'));
                         $this->tpl->parseCurrentBlock();
                     }
                     include_once './Services/Link/classes/class.ilLink.php';
                     $registrations = array();
                     foreach ($reg->getRegisteredUsers(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX)) as $usr_data) {
                         $usr_id = $usr_data['usr_id'];
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $usr_id);
                         $registrations[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' . ilObjUser::_lookupFullname($usr_id);
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
                     }
                     if (count($registrations)) {
                         $this->tpl->setCurrentBlock('panel_current_booking');
                         $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_reg_registered_users'));
                         $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $registrations));
                         $this->tpl->parseCurrentBlock();
                     }
                 }
             }
             break;
         case ilCalendarCategory::TYPE_CH:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_ch'));
             include_once 'Services/Booking/classes/class.ilBookingEntry.php';
             $entry = new ilBookingEntry($a_app['event']->getContextId());
             $is_owner = $entry->isOwner();
             $user_entry = $cat_info['obj_id'] == $ilUser->getId();
             if ($user_entry && !$is_owner) {
                 // find source calendar entry in owner calendar
                 include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
                 $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $a_app['event']->getContextId(), $a_app['event']->getStart());
                 $ref_event = $apps[0];
             } else {
                 $ref_event = $a_app['event']->getEntryId();
             }
             $this->tpl->setCurrentBlock('panel_booking_owner');
             $this->tpl->setVariable('PANEL_TXT_BOOKING_OWNER', $this->lng->txt('cal_ch_booking_owner'));
             $this->tpl->setVariable('PANEL_BOOKING_OWNER', ilObjUser::_lookupFullname($entry->getObjId()));
             $this->tpl->parseCurrentBlock();
             $this->tpl->setCurrentBlock('panel_max_booking');
             $this->tpl->setVariable('PANEL_TXT_MAX_BOOKING', $this->lng->txt('cal_ch_num_bookings'));
             $this->tpl->setVariable('PANEL_MAX_BOOKING', $entry->getNumberOfBookings());
             $this->tpl->parseCurrentBlock();
             if (!$is_owner) {
                 if ($entry->hasBooked($ref_event)) {
                     if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) {
                         $this->tpl->setCurrentBlock('panel_cancel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
                         $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
                         $this->tpl->parseCurrentBlock();
                     }
                 } elseif ($entry->isAppointmentBookableForUser($ref_event, $GLOBALS['ilUser']->getId())) {
                     $this->tpl->setCurrentBlock('panel_book_link');
                     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
                     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                     $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_ch_book'));
                     $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'book'));
                     $this->tpl->parseCurrentBlock();
                 }
                 $this->tpl->setCurrentBlock('panel_current_booking');
                 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
                 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
                 $this->tpl->parseCurrentBlock();
             } else {
                 $obj_ids = $entry->getTargetObjIds();
                 foreach ($obj_ids as $obj_id) {
                     $title = ilObject::_lookupTitle($obj_id);
                     $refs = ilObject::_getAllReferences($obj_id);
                     include_once './Services/Link/classes/class.ilLink.php';
                     $this->tpl->setCurrentBlock('panel_booking_target_row');
                     $this->tpl->setVariable('PANEL_BOOKING_TARGET_TITLE', $title);
                     $this->tpl->setVariable('PANEL_BOOKING_TARGET', ilLink::_getLink(end($refs)));
                     $this->tpl->parseCurrentBlock();
                 }
                 if ($obj_ids) {
                     $this->tpl->setCurrentBlock('panel_booking_target');
                     $this->tpl->setVariable('PANEL_TXT_BOOKING_TARGET', $this->lng->txt('cal_ch_target_object'));
                     $this->tpl->parseCurrentBlock();
                 }
                 $link_users = true;
                 if (ilCalendarCategories::_getInstance()->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) {
                     $link_users = false;
                 }
                 include_once './Services/Link/classes/class.ilLink.php';
                 $bookings = array();
                 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', 1);
                 foreach ($entry->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) {
                     if ($link_users) {
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $user_id);
                         $bookings[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' . ilObjUser::_lookupFullname($user_id) . '</a>';
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
                     } else {
                         $bookings[] = ilObjUser::_lookupFullname($user_id);
                     }
                 }
                 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', '');
                 $this->tpl->setCurrentBlock('panel_current_booking');
                 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
                 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $bookings));
                 $this->tpl->parseCurrentBlock();
             }
             break;
         case ilCalendarCategory::TYPE_BOOK:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_booking'));
             $this->tpl->setCurrentBlock('panel_cancel_book_link');
             $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
             $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
             $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
             $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
             $this->tpl->parseCurrentBlock();
             break;
     }
     $this->tpl->setVariable('PANEL_TXT_CAL_NAME', $this->lng->txt('cal_calendar_name'));
     $this->tpl->setVariable('PANEL_CAL_NAME', $cat_info['title']);
     if ($cat_info['editable'] and !$a_app['event']->isAutoGenerated()) {
         $this->tpl->setCurrentBlock('panel_edit_link');
         $this->tpl->setVariable('TXT_PANEL_EDIT', $this->lng->txt('edit'));
         $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']);
         $this->tpl->setVariable('PANEL_EDIT_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askEdit'));
         $this->tpl->setCurrentBlock('panel_delete_link');
         $this->tpl->setVariable('TXT_PANEL_DELETE', $this->lng->txt('delete'));
         $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']);
         $this->tpl->setVariable('PANEL_DELETE_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askdelete'));
         $this->tpl->parseCurrentBlock();
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
     if ($cat_info['type'] == ilCalendarCategory::TYPE_OBJ) {
         $refs = ilObject::_getAllReferences($entry_obj_id);
         $type = ilObject::_lookupType($entry_obj_id);
         $title = ilObject::_lookupTitle($entry_obj_id) ? ilObject::_lookupTitle($entry_obj_id) : $lng->txt('obj_' . $type);
         include_once './Services/Link/classes/class.ilLink.php';
         $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($entry_obj_id));
         $parent = $tree->getParentId(current($refs));
         $parent_title = ilObject::_lookupTitle(ilObject::_lookupObjId($parent));
         $this->tpl->setVariable('PANEL_TXT_LINK', $this->lng->txt('ext_link'));
         $this->tpl->setVariable('PANEL_LINK_HREF', $href);
         $this->tpl->setVariable('PANEL_LINK_NAME', $title);
         $this->tpl->setVariable('PANEL_PARENT', $parent_title);
     }
     return $this->tpl->get();
 }