/** * Stop calendar sharing */ protected function unshare() { global $ilUser; if (!$_GET['category_id']) { ilUtil::sendFailure($this->lng->txt('select_one'), true); $this->ctrl->returnToParent($this); } $this->readPermissions(); $this->checkVisible(); include_once './Services/Calendar/classes/class.ilCalendarSharedStatus.php'; $status = new ilCalendarSharedStatus($ilUser->getId()); include_once './Services/Calendar/classes/class.ilCalendarShared.php'; if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $_GET['category_id'])) { ilUtil::sendFailure($this->lng->txt('permission_denied')); $this->inbox(); return false; } $status->decline($_GET['category_id']); ilUtil::sendSuccess($this->lng->txt('settings_saved'), true); $this->ctrl->redirect($this, 'manage'); }
/** * accept shared calendar * * @access protected * @return */ protected function declineShared() { global $ilUser; if (!$_POST['cal_ids'] or !is_array($_POST['cal_ids'])) { ilUtil::sendFailure($this->lng->txt('select_one')); $this->inbox(); return false; } include_once './Services/Calendar/classes/class.ilCalendarSharedStatus.php'; $status = new ilCalendarSharedStatus($ilUser->getId()); include_once './Services/Calendar/classes/class.ilCalendarShared.php'; foreach ($_POST['cal_ids'] as $calendar_id) { if (!ilCalendarShared::isSharedWithUser($ilUser->getId(), $calendar_id)) { ilUtil::sendFailure($this->lng->txt('permission_denied')); $this->inbox(); return false; } $status->decline($calendar_id); } ilUtil::sendSuccess($this->lng->txt('settings_saved')); $this->inbox(); return true; }