当前位置: 首页>>代码示例>>PHP>>正文


PHP Folder::getById方法代码示例

本文整理汇总了PHP中OCP\Files\Folder::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::getById方法的具体用法?PHP Folder::getById怎么用?PHP Folder::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\Files\Folder的用法示例。


在下文中一共展示了Folder::getById方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createShare

 /**
  * Create a share object from an database row
  *
  * @param mixed[] $data
  * @return Share
  */
 private function createShare($data)
 {
     $share = new Share();
     $share->setId((int) $data['id'])->setShareType((int) $data['share_type'])->setPermissions((int) $data['permissions'])->setTarget($data['file_target'])->setShareTime((int) $data['stime'])->setMailSend((bool) $data['mail_send']);
     if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
         $share->setSharedWith($this->userManager->get($data['share_with']));
     } else {
         if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
             $share->setSharedWith($this->groupManager->get($data['share_with']));
         } else {
             if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
                 $share->setPassword($data['share_with']);
                 $share->setToken($data['token']);
             } else {
                 $share->setSharedWith($data['share_with']);
             }
         }
     }
     $share->setSharedBy($this->userManager->get($data['uid_owner']));
     // TODO: getById can return an array. How to handle this properly??
     $path = $this->userFolder->getById((int) $data['file_source']);
     $path = $path[0];
     $share->setPath($path);
     $owner = $path->getStorage()->getOwner('.');
     if ($owner !== false) {
         $share->setShareOwner($this->userManager->get($owner));
     }
     if ($data['expiration'] !== null) {
         $expiration = \DateTime::createFromFormat('Y-m-d H:i:s', $data['expiration']);
         $share->setExpirationDate($expiration);
     }
     return $share;
 }
开发者ID:hassanhawilo,项目名称:core,代码行数:39,代码来源:defaultshareprovider.php

示例2: getResourceFromId

 /**
  * Returns the resource identified by the given ID
  *
  * @param int $resourceId
  *
  * @return Node
  *
  * @throws NotFoundEnvException
  */
 public function getResourceFromId($resourceId)
 {
     $resourcesArray = $this->userFolder->getById($resourceId);
     if ($resourcesArray[0] === null) {
         throw new NotFoundEnvException('Could not locate file linked to ID: ' . $resourceId);
     }
     return $resourcesArray[0];
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:17,代码来源:environment.php

示例3: getFilesByTag

 /**
  * Get all files for the given tag
  *
  * @param array $tagName tag name to filter by
  * @return FileInfo[] list of matching files
  * @throws \Exception if the tag does not exist
  */
 public function getFilesByTag($tagName)
 {
     try {
         $fileIds = $this->tagger->getIdsForTag($tagName);
     } catch (\Exception $e) {
         return [];
     }
     $fileInfos = [];
     foreach ($fileIds as $fileId) {
         $nodes = $this->homeFolder->getById((int) $fileId);
         foreach ($nodes as $node) {
             /** @var \OC\Files\Node\Node $node */
             $fileInfos[] = $node->getFileInfo();
         }
     }
     return $fileInfos;
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:24,代码来源:tagservice.php

示例4: getFilesByTag

 /**
  * Get all files for the given tag
  *
  * @param string $tagName tag name to filter by
  * @return Node[] list of matching files
  * @throws \Exception if the tag does not exist
  */
 public function getFilesByTag($tagName)
 {
     try {
         $fileIds = $this->tagger->getIdsForTag($tagName);
     } catch (\Exception $e) {
         return [];
     }
     $allNodes = [];
     foreach ($fileIds as $fileId) {
         $allNodes = array_merge($allNodes, $this->homeFolder->getById((int) $fileId));
     }
     return $allNodes;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:20,代码来源:TagService.php

示例5: cover

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function cover()
 {
     // we no longer need the session to be kept open
     session_write_close();
     $albumId = $this->getIdFromSlug($this->params('albumIdOrSlug'));
     $album = $this->albumBusinessLayer->find($albumId, $this->userId);
     $nodes = $this->userFolder->getById($album->getCoverFileId());
     if (count($nodes) > 0) {
         // get the first valid node
         $node = $nodes[0];
         $mime = $node->getMimeType();
         $content = $node->getContent();
         return new FileResponse(array('mimetype' => $mime, 'content' => $content));
     }
     $r = new Response();
     $r->setStatus(Http::STATUS_NOT_FOUND);
     return $r;
 }
开发者ID:DevelopIdeas,项目名称:music,代码行数:22,代码来源:apicontroller.php

示例6: getFilePath

 /**
  * {@inheritDoc}
  */
 public function getFilePath($itemSource, $uidOwner)
 {
     try {
         $calendar = $this->calendars->find($itemSource, $uidOwner);
         $fileId = $calendar->getFileId();
         if ($fileId === null) {
             return false;
         }
         $files = $this->userFolder->getById($fileId);
         if (!$files || empty($files)) {
             return false;
         } else {
             return $files[0]->getPath();
         }
     } catch (BusinessLayer\Exception $ex) {
         return false;
     }
 }
开发者ID:amin-hedayati,项目名称:calendar-rework,代码行数:21,代码来源:calendar.php

示例7: getFilePath

 /**
  * {@inheritDoc}
  */
 public function getFilePath($itemSource, $uidOwner)
 {
     try {
         if (substr_count($itemSource, '::') === 0) {
             return false;
         }
         list($calendarId) = explode('::', $itemSource, 1);
         $calendar = $this->calendars->find($calendarId, $uidOwner);
         $fileId = $calendar->getFileId();
         if ($fileId === null) {
             return false;
         }
         $files = $this->userFolder->getById($fileId);
         if (!$files || empty($files)) {
             return false;
         } else {
             return $files[0]->getPath();
         }
     } catch (BusinessLayer\Exception $ex) {
         return false;
     }
 }
开发者ID:amin-hedayati,项目名称:calendar-rework,代码行数:25,代码来源:object.php

示例8: childExists

 /**
  * Checks if a child-node with the specified name exists
  *
  * @param string $name
  * @return bool
  */
 function childExists($name)
 {
     $nodes = $this->fileRoot->getById(intval($name));
     return !empty($nodes);
 }
开发者ID:matt407,项目名称:core,代码行数:11,代码来源:entitytypecollection.php

示例9: getFileById

 /**
  * @param Folder $folder
  * @param int $id
  * @throws NoteDoesNotExistException
  * @return \OCP\Files\File
  */
 private function getFileById($folder, $id)
 {
     $file = $folder->getById($id);
     if (count($file) <= 0 || !$this->isNote($file[0])) {
         throw new NoteDoesNotExistException();
     }
     return $file[0];
 }
开发者ID:ErikPel,项目名称:notes,代码行数:14,代码来源:notesservice.php

示例10: getFileById

 /**
  * @param Folder $folder
  * @param int $id
  * @throws NoteDoesNotExistException
  * @return \OCP\Files\File
  */
 private function getFileById($folder, $id)
 {
     $file = $folder->getById($id);
     if (count($file) <= 0 || $file[0]->getMimeType() !== 'text/plain') {
         throw new NoteDoesNotExistException();
     }
     return $file[0];
 }
开发者ID:sbambach,项目名称:notes,代码行数:14,代码来源:notesservice.php

示例11: getResourceFromFolderAndId

 /**
  * Returns the resource found in a specific folder and identified by the given ID
  *
  * @param Folder $folder
  * @param int $resourceId
  *
  * @return Node
  * @throws NotFoundEnvException
  */
 private function getResourceFromFolderAndId($folder, $resourceId)
 {
     $resourcesArray = $folder->getById($resourceId);
     if ($resourcesArray[0] === null) {
         throw new NotFoundEnvException('Could not locate node linked to ID: ' . $resourceId);
     }
     return $resourcesArray[0];
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:17,代码来源:environment.php


注:本文中的OCP\Files\Folder::getById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。