コード例 #1
0
 /**
  * read permissions
  *
  * @access private
  * @param
  * @return
  */
 private function readPermissions()
 {
     global $ilUser, $rbacsystem, $ilAccess;
     $this->editable = false;
     $this->visible = false;
     $this->importable = false;
     include_once './Services/Calendar/classes/class.ilCalendarShared.php';
     $shared = ilCalendarShared::getSharedCalendarsForUser($ilUser->getId());
     $cat = new ilCalendarCategory((int) $_GET['category_id']);
     switch ($cat->getType()) {
         case ilCalendarCategory::TYPE_USR:
             if ($cat->getObjId() == $ilUser->getId()) {
                 $this->visible = true;
                 $this->editable = true;
                 $this->importable = true;
             } elseif (isset($shared[$cat->getCategoryID()])) {
                 $this->visible = true;
             }
             break;
         case ilCalendarCategory::TYPE_GLOBAL:
             $this->importable = $this->editable = $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId());
             $this->visible = true;
             break;
         case ilCalendarCategory::TYPE_OBJ:
             $this->editable = false;
             $refs = ilObject::_getAllReferences($cat->getObjId());
             foreach ($refs as $ref) {
                 if ($ilAccess->checkAccess('read', '', $ref)) {
                     $this->visible = true;
                 }
                 if ($ilAccess->checkAccess('edit_event', '', $ref)) {
                     $this->importable = true;
                 }
             }
             break;
         case ilCalendarCategory::TYPE_BOOK:
         case ilCalendarCategory::TYPE_CH:
             $this->editable = $ilUser->getId() == $cat->getCategoryID();
             $this->visible = true;
             $this->importable = false;
             break;
     }
 }
コード例 #2
0
 /**
  * show inbox
  *
  * @access protected
  * @return
  */
 protected function inbox()
 {
     global $ilCtrl;
     $this->tpl = new ilTemplate('tpl.inbox.html', true, true, 'Services/Calendar');
     include_once './Services/Calendar/classes/class.ilCalendarInboxSharedTableGUI.php';
     include_once './Services/Calendar/classes/class.ilCalendarShared.php';
     $table = new ilCalendarInboxSharedTableGUI($this, 'inbox');
     $table->setCalendars(ilCalendarShared::getSharedCalendarsForUser());
     if ($table->parse()) {
         $this->tpl->setVariable('SHARED_CAL_TABLE', $table->getHTML());
     }
     include_once './Services/Calendar/classes/class.ilCalendarChangedAppointmentsTableGUI.php';
     $table_gui = new ilCalendarChangedAppointmentsTableGUI($this, 'inbox');
     $schedule = new ilCalendarSchedule(new ilDate(time(), IL_CAL_UNIX), ilCalendarSchedule::TYPE_INBOX);
     $schedule->setEventsLimit($table_gui->getLimit());
     $schedule->addSubitemCalendars(true);
     $schedule->calculate();
     if (isset($_GET['changed'])) {
         $title = $this->lng->txt('cal_changed_events_header');
         $events = $schedule->getChangedEvents(true);
         $ilCtrl->setParameter($this, 'changed', 1);
     } else {
         // type inbox will show upcoming events (today or later)
         $title = $this->lng->txt('cal_upcoming_events_header');
         //$events = $schedule->getEvents();
         $events = $schedule->getScheduledEvents();
     }
     $table_gui->setTitle($title);
     $table_gui->setAppointments($events);
     $this->tpl->setVariable('CHANGED_TABLE', $table_gui->getHTML());
 }