本文整理汇总了PHP中Sabre\DAV\INode::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP INode::getId方法的具体用法?PHP INode::getId怎么用?PHP INode::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre\DAV\INode
的用法示例。
在下文中一共展示了INode::getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleGetProperties
/**
* Adds tags and favorites properties to the response,
* if requested.
*
* @param PropFind $propFind
* @param \Sabre\DAV\INode $node
* @return void
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
{
if (!$node instanceof File && !$node instanceof Directory) {
return;
}
$propFind->handle(self::PROPERTY_NAME_COUNT, function () use($node) {
return $this->commentsManager->getNumberOfCommentsForObject('files', strval($node->getId()));
});
$propFind->handle(self::PROPERTY_NAME_HREF, function () use($node) {
return $this->getCommentsLink($node);
});
$propFind->handle(self::PROPERTY_NAME_UNREAD, function () use($node) {
return $this->getUnreadCount($node);
});
}
示例2: handleGetProperties
/**
* Adds tags and favorites properties to the response,
* if requested.
*
* @param PropFind $propFind
* @param \Sabre\DAV\INode $node
* @return void
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node)
{
if (!$node instanceof \OCA\DAV\Connector\Sabre\Node) {
return;
}
// need prefetch ?
if ($node instanceof \OCA\DAV\Connector\Sabre\Directory && $propFind->getDepth() !== 0 && (!is_null($propFind->getStatus(self::TAGS_PROPERTYNAME)) || !is_null($propFind->getStatus(self::FAVORITE_PROPERTYNAME)))) {
// note: pre-fetching only supported for depth <= 1
$folderContent = $node->getChildren();
$fileIds[] = (int) $node->getId();
foreach ($folderContent as $info) {
$fileIds[] = (int) $info->getId();
}
$tags = $this->getTagger()->getTagsForObjects($fileIds);
if ($tags === false) {
// the tags API returns false on error...
$tags = array();
}
$this->cachedTags = $this->cachedTags + $tags;
$emptyFileIds = array_diff($fileIds, array_keys($tags));
// also cache the ones that were not found
foreach ($emptyFileIds as $fileId) {
$this->cachedTags[$fileId] = [];
}
}
$tags = null;
$isFav = null;
$propFind->handle(self::TAGS_PROPERTYNAME, function () use($tags, &$isFav, $node) {
list($tags, $isFav) = $this->getTagsAndFav($node->getId());
return new TagList($tags);
});
$propFind->handle(self::FAVORITE_PROPERTYNAME, function () use($isFav, $node) {
if (is_null($isFav)) {
list(, $isFav) = $this->getTagsAndFav($node->getId());
}
return $isFav;
});
}
示例3: updateProperties
/**
* Updates tags and favorites properties, if applicable.
*
* @param string $path
* @param \Sabre\DAV\INode $node
* @param array $requestedProperties
* @param array $returnedProperties
* @return bool success status
*/
public function updateProperties(array &$properties, array &$result, \Sabre\DAV\INode $node)
{
if (!$node instanceof \OC_Connector_Sabre_Node) {
return;
}
$fileId = $node->getId();
if (isset($properties[self::TAGS_PROPERTYNAME])) {
$tagsProp = $properties[self::TAGS_PROPERTYNAME];
unset($properties[self::TAGS_PROPERTYNAME]);
$this->updateTags($fileId, $tagsProp->getTags());
$result[200][self::TAGS_PROPERTYNAME] = new TagList($tagsProp->getTags());
}
if (isset($properties[self::FAVORITE_PROPERTYNAME])) {
$favState = $properties[self::FAVORITE_PROPERTYNAME];
unset($properties[self::FAVORITE_PROPERTYNAME]);
if ((int) $favState === 1 || $favState === 'true') {
$favState = true;
$this->getTagger()->tagAs($fileId, self::TAG_FAVORITE);
} else {
$favState = false;
$this->getTagger()->unTag($fileId, self::TAG_FAVORITE);
}
$result[200][self::FAVORITE_PROPERTYNAME] = $favState;
}
return true;
}
示例4: handleGetProperties
/**
* Adds shares to propfind response
*
* @param PropFind $propFind propfind object
* @param \Sabre\DAV\INode $sabreNode sabre node
*/
public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $sabreNode)
{
if (!$sabreNode instanceof \OCA\DAV\Connector\Sabre\Node) {
return;
}
// need prefetch ?
if ($sabreNode instanceof \OCA\DAV\Connector\Sabre\Directory && $propFind->getDepth() !== 0 && !is_null($propFind->getStatus(self::SHARETYPES_PROPERTYNAME))) {
$folderNode = $this->userFolder->get($propFind->getPath());
$children = $folderNode->getDirectoryListing();
$this->cachedShareTypes[$folderNode->getId()] = $this->getShareTypes($folderNode);
foreach ($children as $childNode) {
$this->cachedShareTypes[$childNode->getId()] = $this->getShareTypes($childNode);
}
}
$propFind->handle(self::SHARETYPES_PROPERTYNAME, function () use($sabreNode) {
if (isset($this->cachedShareTypes[$sabreNode->getId()])) {
$shareTypes = $this->cachedShareTypes[$sabreNode->getId()];
} else {
$node = $this->userFolder->get($sabreNode->getPath());
$shareTypes = $this->getShareTypes($node);
}
return new ShareTypeList($shareTypes);
});
}