本文整理汇总了PHP中OCP\Share::getItemSharedWithByLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Share::getItemSharedWithByLink方法的具体用法?PHP Share::getItemSharedWithByLink怎么用?PHP Share::getItemSharedWithByLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Share
的用法示例。
在下文中一共展示了Share::getItemSharedWithByLink方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemSharedWithByLinkCalendar
/**
* @NoAdminRequired
*
*
* @param integer $calendarid calendar id
* @param string $userid
*@return array || null
*/
public function getItemSharedWithByLinkCalendar($calendarid, $userid)
{
return Share::getItemSharedWithByLink(self::SHARECALENDAR, self::SHARECALENDARPREFIX . $calendarid, $userid);
}
示例2: rebuildLeftNavigation
/**
* @NoAdminRequired
*/
public function rebuildLeftNavigation()
{
$leftNavAktiv = $this->configInfo->getUserValue($this->userId, $this->appName, 'calendarnav');
//make it as template
if ($leftNavAktiv === 'true') {
$calendars = CalendarCalendar::allCalendars($this->userId, false);
//$mySharees=Object::getCalendarSharees();
$activeCal = $this->configInfo->getUserValue($this->userId, $this->appName, 'choosencalendar');
$outputAbo = '';
$output = '<div id="leftcontentInner">
<div class="view navigation-left button-group" style="float:none;">
<button class="button viewaction" data-action="agendaDay" data-view="true" data-weekends="true">' . $this->l10n->t('Day') . '</button>
<button class="button viewaction" data-action="agendaThreeDays" data-view="true" data-weekends="true">' . $this->l10n->t('3-Days') . '</button>
<button class="button viewaction" data-action="agendaWorkWeek" data-view="true" data-weekends="false">' . $this->l10n->t('W-Week') . '</button>
<button class="button viewaction" data-action="agendaWeek" data-view="true" data-weekends="true">' . $this->l10n->t('Week') . '</button>
<button class="button viewaction" data-action="month" data-view="true" data-weekends="true">' . $this->l10n->t('Month') . '</button>
<button class="button viewaction" data-action="list" data-view="true" data-weekends="true"><i class="ioc ioc-th-list" title="' . $this->l10n->t('List') . '"></i></button>
<button class="button viewaction" data-action="year" data-view="true" data-weekends="true">' . $this->l10n->t('Year') . '</button>
<br />
<button class="button" data-action="prev" data-view="false" data-weekends="false"><i class="ioc ioc-angle-left"></i></button>
<button class="button" data-action="next" data-view="false" data-weekends="false"><i class="ioc ioc-angle-right"></i></button>
</div>
<div id="datepickerNav"></div>
<h3><i class="ioc ioc-calendar"></i> ' . $this->l10n->t('Calendar') . '</h3>
<ul id="calendarList">';
$bShareApi = \OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes');
foreach ($calendars as $calInfo) {
$rightsOutput = '';
$share = '';
$checkBox = '';
$isActiveUserCal = '';
$addCheckClass = '';
$sharedescr = '';
if ($activeCal === $calInfo['id']) {
$isActiveUserCal = 'isActiveCal';
$addCheckClass = 'isActiveUserCal';
}
/*
if((is_array($mySharees) && array_key_exists($calInfo['id'], $mySharees))) {
$sharedescr=$mySharees[$calInfo['id']];
$share='<i class="ioc ioc-share toolTip" title="<b>'. $this->l10n->t('Shared with').'</b><br>'.$sharedescr.'"></i> ';
}*/
$shareLink = '';
if ($calInfo['permissions'] & \OCP\PERMISSION_SHARE && $bShareApi === 'yes') {
$shareLink = '<a href="#" class="share icon-share"
data-item-type="' . CalendarApp::SHARECALENDAR . '"
data-item="' . CalendarApp::SHARECALENDARPREFIX . $calInfo['id'] . '"
data-link="true"
data-title="' . $calInfo['displayname'] . '"
data-possible-permissions="' . $calInfo['permissions'] . '"
title="' . (string) $this->l10n->t('Share Calendar') . '"
style="float:right;"
>
</a>';
}
$displayName = '<span class="descr toolTip" title="' . $calInfo['displayname'] . '">' . $calInfo['displayname'] . '</span>' . $shareLink;
$checked = $calInfo['active'] ? ' checked="checked"' : '';
$notice = '';
$shareInfo = '';
if ($calInfo['userid'] !== $this->userId) {
if ($shareLink === '') {
if (\OCP\Share::getItemSharedWithByLink(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $calInfo['id'], $calInfo['userid'])) {
$notice = '<b>Notice</b><br>This calendar is also shared by Link for public!<br>';
}
$rightsOutput = CalendarCalendar::permissionReader($calInfo['permissions']);
$shareInfo = '<i style="float:right;" class="toolTip ioc ioc-info" title="' . $notice . (string) $this->l10n->t('by') . ' ' . $calInfo['userid'] . '<br />(' . $rightsOutput . ')"></i>';
}
$calShare = $calInfo['active'];
if ($this->configInfo->getUserValue($this->userId, 'calendar', 'calendar_' . $calInfo['id']) !== '') {
$calShare = $this->configInfo->getUserValue($this->userId, 'calendar', 'calendar_' . $calInfo['id']);
}
$checked = $calShare ? ' checked="checked"' : '';
$displayName = '<span class="descr toolTip" title="' . $calInfo['displayname'] . '">' . $calInfo['displayname'] . '</span>' . $shareLink . $shareInfo;
// $checkBox='';
}
$checkBox = '<input class="activeCalendarNav regular-checkbox" data-id="' . $calInfo['id'] . '" style="float:left;" id="edit_active_' . $calInfo['id'] . '" type="checkbox" ' . $checked . ' /><label style="float:left;margin-right:5px;" class="toolTip" title="' . $this->l10n->t('show / hide calendar') . '" for="edit_active_' . $calInfo['id'] . '"></label>';
if ((bool) $calInfo['issubscribe'] === false) {
$output .= '<li data-id="' . $calInfo['id'] . '" class="calListen ' . $isActiveUserCal . '">' . $checkBox . '<div class="colCal toolTip iCalendar ' . $addCheckClass . '" title="' . $this->l10n->t('choose calendar as default') . '" style="cursor:pointer;background:' . $calInfo['calendarcolor'] . '"> </div> ' . $displayName . '</li>';
} else {
if ($calInfo['userid'] === $this->userId) {
$refreshImage = '<i title="refresh" class="refreshSubscription ioc ioc-refresh" style="cursor:pointer;float:right;position:absolute;right:18px;"> </i>';
}
$outputAbo .= '<li data-id="' . $calInfo['id'] . '" class="calListen ' . $isActiveUserCal . '">' . $checkBox . '<div class="colCal" style="cursor:pointer;background:' . $calInfo['calendarcolor'] . '"> </div> ' . $displayName . $refreshImage . '</li>';
}
}
if ($outputAbo !== '') {
$outputAbo = '<br style="clear:both;"><br /><h3><i class="ioc ioc-rss-alt"></i> ' . $this->l10n->t('Subscription') . '</h3><ul>' . $outputAbo . '</ul>';
}
$output .= '</ul>' . $outputAbo . '<br />
<br style="clear:both;"><br />
<h3 data-id="lCategory" style=" cursor:pointer; line-height:24px;" ><label id="showCategory"><i style="font-size:22px;" class="ioc ioc-angle-down ioc-rotate-270"></i> <i class="ioc ioc-tags"></i> ' . $this->l10n->t('Tags') . '</label>
</h3>
<ul id="categoryCalendarList">
//.........这里部分代码省略.........
示例3: find
/**
* @brief Gets the data of one calendar
* @param integer $id
* @return associative array
*/
public static function find($id)
{
$stmt = \OCP\DB::prepare('SELECT * FROM `' . App::CldCalendarTable . '` WHERE `id` = ?');
$result = $stmt->execute(array($id));
$row = $result->fetchRow();
$user = \OCP\User::getUser();
if ($row['userid'] !== $user) {
$userExists = \OC::$server->getUserManager()->userExists($user);
if (!$userExists) {
$sharedCalendar = \OCP\Share::getItemSharedWithByLink(App::SHARECALENDAR, App::SHARECALENDARPREFIX . $id, $row['userid']);
} else {
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(App::SHARECALENDAR, App::SHARECALENDARPREFIX . $id);
}
if (!$sharedCalendar || !(isset($sharedCalendar['permissions']) && $sharedCalendar['permissions'] & \OCP\PERMISSION_READ)) {
return $row;
// I have to return the row so e.g. Object::getowner() works.
}
$row['permissions'] = $sharedCalendar['permissions'];
} else {
$row['permissions'] = \OCP\PERMISSION_ALL;
}
return $row;
}
示例4: getPermissions
/**
* @brief Get the permissions for a calendar / an event
* @param (int) $id - id of the calendar / event
* @param (string) $type - type of the id (calendar/event)
* @return (int) $permissions - CRUDS permissions
* @param (string) $accessclass - access class (rfc5545, section 3.8.1.3)
* @see \OCP\Share
*/
public static function getPermissions($id, $type, $accessclass = '')
{
$permissions_all = \OCP\PERMISSION_ALL;
if ($type == self::CALENDAR) {
$calendar = self::getCalendar($id, false, false);
if ($calendar['userid'] == \OCP\USER::getUser()) {
if (isset($calendar['issubscribe'])) {
$permissions_all = \OCP\PERMISSION_READ;
}
return $permissions_all;
} else {
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(self::SHARECALENDAR, App::SHARECALENDARPREFIX . $id);
if ($sharedCalendar) {
return $sharedCalendar['permissions'];
}
}
} elseif ($type == self::EVENT) {
$object = Object::find($id);
$cal = Calendar::find($object['calendarid']);
if ($cal['userid'] == \OCP\USER::getUser()) {
if ($cal['issubscribe']) {
$permissions_all = \OCP\PERMISSION_READ;
}
return $permissions_all;
} else {
if (\OCP\USER::isLoggedIn()) {
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(self::SHARECALENDAR, self::SHARECALENDARPREFIX . $object['calendarid']);
$sharedEvent = \OCP\Share::getItemSharedWithBySource(self::SHAREEVENT, self::SHAREEVENTPREFIX . $id);
$calendar_permissions = 0;
$event_permissions = 0;
if ($sharedCalendar) {
$calendar_permissions = $sharedCalendar['permissions'];
}
if ($sharedEvent) {
$event_permissions = $sharedEvent['permissions'];
}
}
if (!\OCP\USER::isLoggedIn()) {
//\OCP\Util::writeLog('calendar', __METHOD__ . ' id: ' . $id . ', NOT LOGGED IN: ', \OCP\Util::DEBUG);
$sharedByLinkCalendar = \OCP\Share::getItemSharedWithByLink(self::SHARECALENDAR, self::SHARECALENDARPREFIX . $object['calendarid'], $cal['userid']);
if ($sharedByLinkCalendar) {
$calendar_permissions = $sharedByLinkCalendar['permissions'];
$event_permissions = 0;
}
}
if ($accessclass === 'PRIVATE') {
return 0;
} elseif ($accessclass === 'CONFIDENTIAL') {
return \OCP\PERMISSION_READ;
} else {
return max($calendar_permissions, $event_permissions);
}
}
}
return 0;
}
示例5: find
/**
* @brief Gets the data of one calendar
* @param integer $id
* @return associative array
*/
public static function find($id)
{
$user = \OCP\User::getUser();
$dbObject = \OC::$server->getDb();
$calendarDB = new CalendarDAO($dbObject, $user);
$calendarInfo = $calendarDB->find($id);
if ($calendarInfo !== null) {
if ($calendarInfo['userid'] !== $user) {
$userExists = \OC::$server->getUserManager()->userExists($user);
if (!$userExists) {
$sharedCalendar = \OCP\Share::getItemSharedWithByLink(App::SHARECALENDAR, App::SHARECALENDARPREFIX . $id, $calendarInfo['userid']);
} else {
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(App::SHARECALENDAR, App::SHARECALENDARPREFIX . $id);
}
if (!$sharedCalendar || !(isset($sharedCalendar['permissions']) && $sharedCalendar['permissions'] & \OCP\PERMISSION_READ)) {
return $calendarInfo;
// I have to return the row so e.g. Object::getowner() works.
}
$calendarInfo['permissions'] = $sharedCalendar['permissions'];
} else {
$calendarInfo['permissions'] = \OCP\PERMISSION_ALL;
}
return $calendarInfo;
} else {
return null;
}
}
示例6: buildLeftNavigation
/**
* @NoAdminRequired
*/
public function buildLeftNavigation()
{
$calendars = CalendarCalendar::allCalendars($this->userId, true);
$bShareApi = \OC::$server->getAppConfig()->getValue('core', 'shareapi_enabled', 'yes');
$activeCalendars = '';
foreach ($calendars as $calendar) {
$isAktiv = $calendar['active'];
if ($this->configInfo->getUserValue($this->userId, CalendarApp::$appname, 'calendar_' . $calendar['id']) != '') {
$isAktiv = $this->configInfo->getUserValue($this->userId, CalendarApp::$appname, 'calendar_' . $calendar['id']);
}
if (!array_key_exists('active', $calendar)) {
$isAktiv = 1;
}
if ((int) $isAktiv === 1 && (int) $calendar['issubscribe'] === 0) {
$activeCalendars[] = $calendar;
}
}
$cDataTimeLine = new Timeline();
$cDataTimeLine->setCalendars($activeCalendars);
$outputTodoNav = $cDataTimeLine->generateTodoOutput();
$mySharees = Object::getCalendarSharees();
$activeCal = $this->configInfo->getUserValue($this->userId, CalendarApp::$appname, 'choosencalendar');
$outputCalendar = '';
foreach ($activeCalendars as $calInfo) {
$rightsOutput = '';
$share = '';
$isActiveUserCal = '';
$notice = '';
if ($activeCal === $calInfo['id']) {
$isActiveUserCal = 'isActiveCal';
}
$shareLink = '';
$calInfo['bShare'] = false;
if ($calInfo['permissions'] & $this->shareConnector->getShareAccess() && $bShareApi === 'yes') {
$calInfo['bShare'] = true;
$shareLink = '<a href="#" class="share icon-share"
data-item-type="' . $this->shareConnector->getConstShareCalendar() . '"
data-item="' . $this->shareConnector->getConstSharePrefixCalendar() . $calInfo['id'] . '"
data-link="true"
data-title="' . $calInfo['displayname'] . '"
data-possible-permissions="' . $calInfo['permissions'] . '"
title="' . (string) $this->l10n->t('Share Calendar') . '"
>
</a>';
}
$notice = '';
if ($calInfo['bShare'] === false) {
if ($this->shareConnector->getItemSharedWithByLinkCalendar($calInfo['id'], $calInfo['userid'])) {
$notice = '<b>Notice</b><br>This calendar is also shared by Link for public!<br>';
}
$calInfo['shareInfo'] = CalendarCalendar::permissionReader($calInfo['permissions']);
$shareLink = '<i class="toolTip ioc ioc-info" title="' . $notice . (string) $this->l10n->t('by') . ' ' . $calInfo['userid'] . '<br />(' . $calInfo['shareInfo'] . ')"></i>';
}
$displayName = '<span class="toolTip descr" title="' . $notice . (string) $this->l10n->t('Calendar') . ' ' . $calInfo['displayname'] . '">' . $calInfo['displayname'] . '</span>';
if ($calInfo['userid'] !== $this->userId) {
if (\OCP\Share::getItemSharedWithByLink(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $calInfo['id'], $calInfo['userid'])) {
$notice = '<b>Notice</b><br>' . (string) $this->l10n->t('This calendar is also shared by Link for public!') . '<br>';
}
$rightsOutput = CalendarCalendar::permissionReader($calInfo['permissions']);
$displayName = '<span class="toolTip descr" title="' . $notice . (string) $this->l10n->t('Calendar') . ' ' . $calInfo['displayname'] . '">' . $calInfo['displayname'] . '</span>';
}
$countCalEvents = 0;
if (array_key_exists($calInfo['id'], $outputTodoNav['aCountCalEvents'])) {
$countCalEvents = $outputTodoNav['aCountCalEvents'][(string) $calInfo['id']];
}
$actionCalender = '';
if ($calInfo['userid'] === $this->userId) {
//$actionCalender = '<li><i class="ioc ioc-rename"></i></li><li><i class="ioc ioc-delete"></i></li>';
}
$addMenu = '<div class="app-navigation-entry-utils-menu-button"><button></button>
<div class="app-navigation-entry-menu" data-calendarid="' . $calInfo['id'] . '">
<ul>
<li><i class="ioc ioc-globe"></i></li>
' . $actionCalender . '
</ul>
</div>
</div>';
$outputCalendar .= '<li class="calListen ' . $isActiveUserCal . '" data-permissions="' . $calInfo['permissions'] . '" data-id="' . $calInfo['id'] . '"><span class="colCal iCalendar toolTip" title="' . $this->l10n->t('choose calendar as default') . '" style="background-color:' . $calInfo['calendarcolor'] . ';"> </span> ' . $displayName . $shareLink . $addMenu . '<span class="iCount">' . $countCalEvents . '</span></li>';
}
$params = ['calendarslist' => $outputCalendar, 'tasksCount' => $outputTodoNav['tasksCount'], 'aTaskTime' => $outputTodoNav['aTaskTime']];
$response = new TemplateResponse($this->appName, 'tasks.list', $params, '');
return $response;
}
示例7: getPermissions
/**
* @brief Get the permissions for a calendar / an event
* @param (int) $id - id of the calendar / event
* @param (string) $type - type of the id (calendar/event)
* @return (int) $permissions - CRUDS permissions
* @param (string) $accessclass - access class (rfc5545, section 3.8.1.3)
* @see \OCP\Share
*/
public static function getPermissions($id, $type, $accessclass = '')
{
$permissions_all = \OCP\PERMISSION_ALL;
if ($type === self::CALENDAR) {
$calendar = self::getCalendar($id, false, false);
if ($calendar['userid'] === \OCP\USER::getUser()) {
return $permissions_all;
} else {
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $id);
if ($sharedCalendar) {
return $sharedCalendar['permissions'];
}
}
} elseif ($type == self::TODO) {
if (Object::getowner($id) === \OCP\USER::getUser()) {
return $permissions_all;
} else {
$object = Object::find($id);
$cal = Calendar::find($object['calendarid']);
if (\OCP\USER::isLoggedIn()) {
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $object['calendarid']);
$sharedEvent = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARETODO, CalendarApp::SHARETODOPREFIX . $id);
$calendar_permissions = 0;
$event_permissions = 0;
if ($sharedCalendar) {
$calendar_permissions = $sharedCalendar['permissions'];
}
if ($sharedEvent) {
$event_permissions = $sharedEvent['permissions'];
}
}
if (!\OCP\USER::isLoggedIn()) {
$sharedByLinkCalendar = \OCP\Share::getItemSharedWithByLink(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $object['calendarid'], $cal['userid']);
if ($sharedByLinkCalendar) {
$calendar_permissions = $sharedByLinkCalendar['permissions'];
$event_permissions = 0;
}
}
if ($accessclass === 'PRIVATE') {
return 0;
} elseif ($accessclass === 'CONFIDENTIAL') {
return \OCP\PERMISSION_READ;
} else {
return max($calendar_permissions, $event_permissions);
}
}
}
return 0;
}