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


PHP Disk\Driver类代码示例

本文整理汇总了PHP中Bitrix\Disk\Driver的典型用法代码示例。如果您正苦于以下问题:PHP Driver类的具体用法?PHP Driver怎么用?PHP Driver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * Constructor of Externalizer.
  * @param Service\Base $service Service which provides methods for REST.
  * @param \CRestServer $restServer REST server object.
  */
 public function __construct(Service\Base $service, \CRestServer $restServer)
 {
     $this->urlManager = Disk\Driver::getInstance()->getUrlManager();
     $this->host = $this->urlManager->getHostUrl();
     $this->restServer = $restServer;
     $this->service = $service;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:12,代码来源:externalizer.php

示例2: loadData

 private function loadData()
 {
     if (empty($this->arParams['PARAMS']['arUserField'])) {
         return array();
     }
     $userId = $this->getUser()->getId();
     $values = $this->arParams['PARAMS']['arUserField']['VALUE'];
     if (!is_array($this->arParams['PARAMS']['arUserField']['VALUE'])) {
         $values = array($values);
     }
     $urlManager = \Bitrix\Disk\Driver::getInstance()->getUrlManager();
     $versions = array();
     foreach ($values as $value) {
         $attachedObjectId = (int) $value;
         if ($attachedObjectId <= 0) {
             continue;
         }
         /** @var \Bitrix\Disk\AttachedObject $attachedModel */
         $attachedModel = \Bitrix\Disk\AttachedObject::loadById($attachedObjectId, array('VERSION.OBJECT'));
         if (!$attachedModel) {
             continue;
         }
         $version = $attachedModel->getVersion();
         if (!$version) {
             continue;
         }
         $extension = $version->getExtension();
         $versions[] = array('ID' => $attachedModel->getId(), 'NAME' => $version->getName(), 'CONVERT_EXTENSION' => DocumentHandler::isNeedConvertExtension($extension), 'EDITABLE' => DocumentHandler::isEditable($extension), 'CAN_UPDATE' => $attachedModel->canUpdate($userId), 'FROM_EXTERNAL_SYSTEM' => $version->getObject()->getContentProvider() && $version->getObject()->getCreatedBy() == $userId, 'EXTENSION' => $extension, 'SIZE' => \CFile::formatSize($version->getSize()), 'HISTORY_URL' => $urlManager->getUrlUfController('history', array('attachedId' => $attachedModel->getId())), 'DOWNLOAD_URL' => $urlManager->getUrlUfController('download', array('attachedId' => $attachedModel->getId())), 'COPY_TO_ME_URL' => $urlManager->getUrlUfController('copyTome', array('attachedId' => $attachedModel->getId())), 'VIEW_URL' => $urlManager->getUrlToShowAttachedFileByService($attachedModel->getId(), 'gvdrive'), 'EDIT_URL' => $urlManager->getUrlToStartEditUfFileByService($attachedModel->getId(), 'gdrive'), 'GLOBAL_CONTENT_VERSION' => $version->getGlobalContentVersion(), 'ATTRIBUTES_FOR_VIEWER' => Ui\Viewer::getAttributesByAttachedObject($attachedModel, array('version' => $version->getGlobalContentVersion(), 'canUpdate' => $attachedModel->canUpdate($userId), 'showStorage' => false, 'externalId' => false, 'relativePath' => false)));
     }
     unset($value);
     return $versions;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:32,代码来源:class.php

示例3: getGridData

 private function getGridData($gridId)
 {
     $grid = array('ID' => $gridId);
     $securityContext = $this->storage->getCurrentUserSecurityContext();
     $parameters = array('with' => array('FILE', 'CREATE_USER'), 'filter' => array('IS_EXPIRED' => false, 'OBJECT.STORAGE_ID' => $this->storage->getId(), 'CREATED_BY' => $this->getUser()->getId()));
     $parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('OBJECT_ID', 'OBJECT.CREATED_BY'));
     $items = ExternalLink::getModelList($parameters);
     Collection::sortByColumn($items, array('CREATE_TIME' => array(SORT_NUMERIC, SORT_ASC)));
     $urlManager = Driver::getInstance()->getUrlManager();
     $rows = array();
     foreach ($items as $externalLink) {
         /** @var ExternalLink $externalLink */
         $exportData = $externalLink->toArray();
         $nameSpecialChars = htmlspecialcharsbx($externalLink->getFile()->getName());
         $createDateText = htmlspecialcharsbx((string) $externalLink->getCreateTime());
         $columnName = "\n\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$externalLink->getId()}\" class=\"draggable bx-file-icon-container-small bx-disk-file-icon\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$externalLink->getId()}\" href=\"\" data-bx-dateModify=\"{$createDateText}\">{$nameSpecialChars}</a></td>\n\t\t\t\t</tr></table>\n\t\t\t";
         $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $externalLink->getCreatedBy()));
         $rows[] = array('data' => $exportData, 'columns' => array('CREATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'UPDATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'NAME' => $columnName, 'FORMATTED_SIZE' => CFile::formatSize($externalLink->getFile()->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($externalLink->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t\t"), 'actions' => array(array("PSEUDO_NAME" => "download", "DEFAULT" => true, "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($externalLink->getFile()) . "')"), array("PSEUDO_NAME" => "disable_external_link", "ICONCLASS" => "disable_external_link", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK'), "SHORT_TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK_SHORT'), "ONCLICK" => "BX.Disk['ExternalLinkListClass_{$this->getComponentId()}'].disableExternalLink({$externalLink->getId()}, {$externalLink->getObjectId()})")));
     }
     unset($externalLink);
     $grid['MODE'] = 'list';
     $grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'default' => false, 'show_checkbox' => true), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_NAME'), 'default' => true), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_TIME'), 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_USER'), 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_FORMATTED_SIZE'), 'default' => true));
     $grid['ROWS'] = $rows;
     $grid['ROWS_COUNT'] = count($rows);
     $grid['FOOTER'] = array();
     return $grid;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:27,代码来源:class.php

示例4: AddBlogPost

 public static function AddBlogPost($arFields)
 {
     if (!is_array($_POST)) {
         $_POST = array();
     }
     $_POST = array_merge($_POST, array("apply" => "Y", "decode" => "N"), $arFields);
     $strPathToPost = COption::GetOptionString("socialnetwork", "userblogpost_page", false, SITE_ID);
     $strPathToSmile = COption::GetOptionString("socialnetwork", "smile_page", false, SITE_ID);
     $BlogGroupID = COption::GetOptionString("socialnetwork", "userbloggroup_id", false, SITE_ID);
     $arBlogComponentParams = array("IS_REST" => "Y", "ID" => "new", "PATH_TO_POST" => $strPathToPost, "PATH_TO_SMILE" => $strPathToSmile, "GROUP_ID" => $BlogGroupID, "USER_ID" => $GLOBALS["USER"]->GetID(), "USE_SOCNET" => "Y", "MICROBLOG" => "Y");
     ob_start();
     $result = $GLOBALS["APPLICATION"]->IncludeComponent("bitrix:socialnetwork.blog.post.edit", "", $arBlogComponentParams, false, array("HIDE_ICONS" => "Y"));
     ob_end_clean();
     if (!$result) {
         throw new Exception('Error');
     } else {
         if (isset($arFields["FILES"]) && \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk') && ($storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($GLOBALS["USER"]->GetID())) && ($folder = $storage->getFolderForUploadedFiles($GLOBALS["USER"]->GetID()))) {
             // upload to storage
             $arResultFile = array();
             foreach ($arFields["FILES"] as $tmp) {
                 $arFile = CRestUtil::saveFile($tmp);
                 if (is_array($arFile)) {
                     $file = $folder->uploadFile($arFile, array('NAME' => $arFile["name"], 'CREATED_BY' => $GLOBALS["USER"]->GetID()), array(), true);
                     if ($file) {
                         $arResultFile[] = \Bitrix\Disk\Uf\FileUserType::NEW_FILE_PREFIX . $file->getId();
                     }
                 }
             }
             if (!empty($arResultFile)) {
                 CBlogPost::Update($result, array("HAS_PROPS" => "Y", "UF_BLOG_POST_FILE" => $arResultFile));
             }
         }
         return $result;
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:35,代码来源:rest.php

示例5: needProxyToDiskByDocType

 private static function needProxyToDiskByDocType($documentType)
 {
     if (!(\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk'))) {
         return false;
     }
     if (empty($documentType)) {
         return false;
     }
     $storage = null;
     if (substr($documentType, 0, 7) == 'STORAGE') {
         $storageId = (int) substr($documentType, 8);
         if ($storageId) {
             $storage = \Bitrix\Disk\Storage::loadById($storageId);
         }
         if ($storage) {
             return $storage;
         }
     }
     list(, $iblockId, $typeLib, $entityId) = explode('_', $documentType);
     if ($typeLib == 'user') {
         $storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($entityId);
     } elseif ($typeLib == 'group') {
         $storage = \Bitrix\Disk\Driver::getInstance()->getStorageByGroupId($entityId);
     } else {
         return false;
     }
     return $storage;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:28,代码来源:iblocksocnetbizproc.php

示例6: uploadFile

 protected static function uploadFile($name, $content, array $parameters = array())
 {
     static::includeDisk();
     $storage = Driver::getInstance()->getStorageByUserId($parameters['USER_ID']);
     if (!$storage) {
         throw new RestException("Could not find storage for user '" . $parameters['USER_ID'] . "'.", RestException::ERROR_NOT_FOUND);
     }
     $folder = $storage->getFolderForUploadedFiles();
     if (!$folder) {
         return false;
     }
     $securityContext = $storage->getCurrentUserSecurityContext();
     if (!$folder->canAdd($securityContext)) {
         throw new AccessException();
     }
     $fileData = \CRestUtil::saveFile($content);
     if (!$fileData) {
         throw new RestException('Could not save file');
     }
     $file = $folder->uploadFile($fileData, array('NAME' => $name, 'CREATED_BY' => $parameters['USER_ID']), array(), true);
     if (!$file) {
         //$folder->getErrors();
         throw new RestException("Could not upload file to the storage");
     }
     return $file->getId();
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:attachment.php

示例7: getDocument

 public static function getDocument($documentId)
 {
     $documentId = (int) $documentId;
     if ($documentId <= 0) {
         throw new CBPArgumentNullException("documentId");
     }
     $file = File::loadById($documentId);
     if (!$file) {
         return null;
     }
     $ufFields = Driver::getInstance()->getUserFieldManager()->getFieldsForObject($file);
     $ufFileRow = array();
     if (!empty($ufFields)) {
         foreach ($ufFields as $fieldKey => $fieldData) {
             $ufFileRow[$fieldKey] = $fieldData['VALUE'];
             $ufFileRow[$fieldData['XML_ID']] = $fieldData['VALUE'];
         }
     }
     $fileRow = File::getList(array('with' => array('CREATE_USER', 'UPDATE_USER', 'DELETE_USER'), 'filter' => array('ID' => $documentId)))->fetch();
     if (!$fileRow) {
         return null;
     }
     if (empty($fileRow["CODE"])) {
         $fileRow["CODE"] = Loc::getMessage("DISK_BZ_D_NAME_NOT_CODE");
     }
     return array_merge(array("ID" => $fileRow["ID"], "CREATE_TIME" => $fileRow["CREATE_TIME"], "CREATED_BY" => $fileRow["CREATED_BY"], "CREATED_BY_PRINTABLE" => $fileRow['CREATE_USERREF_NAME'] . ' ' . $fileRow['CREATE_USERREF_LAST_NAME'], "UPDATE_TIME" => $fileRow["UPDATE_TIME"], "UPDATED_BY" => $fileRow["UPDATED_BY"], "UPDATED_BY_PRINTABLE" => $fileRow['UPDATE_USERREF_NAME'] . ' ' . $fileRow['UPDATE_USERREF_LAST_NAME'], "DELETE_TIME" => $fileRow["DELETE_TIME"], "DELETED_BY" => $fileRow["DELETED_BY"], "DELETED_BY_PRINTABLE" => $fileRow['DELETE_USERREF_NAME'] . ' ' . $fileRow['DELETE_USERREF_LAST_NAME'], "STORAGE_ID" => $fileRow["STORAGE_ID"], "NAME" => $fileRow["NAME"], "SIZE" => $fileRow["SIZE"], "CODE" => $fileRow["CODE"], "TIMESTAMP_X" => $fileRow["UPDATE_TIME"], "MODIFIED_BY" => $fileRow["CREATED_BY"], "MODIFIED_BY_PRINTABLE" => $fileRow['UPDATE_USERREF_NAME'] . ' ' . $fileRow['UPDATE_USERREF_LAST_NAME'], "DATE_CREATE" => $fileRow["CREATE_TIME"], "FILE_SIZE" => $fileRow["SIZE"]), $ufFileRow);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:27,代码来源:bizprocdocumentcompatible.php

示例8: __wd_get_root_section

 function __wd_get_root_section($IBLOCK_ID, $object, $object_id)
 {
     $result = CIBlockWebdavSocnet::GetSectionID($IBLOCK_ID, $object, $object_id);
     if (intval($result) > 0) {
         return $result;
     } else {
         __wd_check_uf_use_bp_property($arParams["IBLOCK_ID"]);
         $arFields = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "SOCNET_GROUP_ID" => false, "IBLOCK_SECTION_ID" => 0, "UF_USE_BP" => "N");
         if ($object == "user") {
             $dbUser = CUser::GetByID($object_id);
             $arUser = $dbUser->Fetch();
             $arFields["NAME"] = trim($arUser['LAST_NAME'] . " " . $arUser['FIRST_NAME']);
             $arFields["NAME"] = trim(!empty($arFields["NAME"]) ? $arFields["NAME"] : $arUser['LOGIN']);
             $arFields['CREATED_BY'] = $arUser['ID'];
             $arFields['MODIFIED_BY'] = $arUser['ID'];
             if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") {
                 $arTasks = CWebDavIblock::GetTasks();
                 $arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'U' . $object_id, 'TASK_ID' => $arTasks['X']));
             }
         } else {
             /*		$res = CSocNetGroup::GetByID($arResult["VARIABLES"]["group_id"]);
             				if (!$res)
             				{
             					$arParams["ERROR_MESSAGE"] = GetMessage("SONET_GROUP_NOT_EXISTS");
             					return 0;
             				} */
             $arFields["SOCNET_GROUP_ID"] = $object_id;
             //$arGroup = CSocNetGroup::GetByID($object_id);
             $arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $object_id;
             $dbGroup = CSocNetGroup::GetList(array(), array("ID" => (int) $object_id), false, false, array("ID", "SITE_ID", "NAME"));
             if ($arGroup = $dbGroup->Fetch()) {
                 $arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $arGroup["NAME"];
             }
             if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") {
                 $arTasks = CWebDavIblock::GetTasks();
                 $arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_A', 'TASK_ID' => $arTasks['X']), 'n1' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_E', 'TASK_ID' => $arTasks['W']), 'n2' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_K', 'TASK_ID' => $arTasks['W']));
             }
         }
         if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
             \Bitrix\Disk\Driver::getInstance()->addGroupStorage($arFields["SOCNET_GROUP_ID"]);
         }
         $GLOBALS["UF_USE_BP"] = $arFields["UF_USE_BP"];
         $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $IBLOCK_ID . "_SECTION", $arFields);
         $bs = new CIBlockSection();
         $sectionID = $bs->Add($arFields);
         if (!$sectionID) {
             $arParams["ERROR_MESSAGE"] = $bs->LAST_ERROR;
             return 0;
         }
         WDClearComponentCache(array("webdav.element.edit", "webdav.element.hist", "webdav.element.upload", "webdav.element.view", "webdav.menu", "webdav.section.edit", "webdav.section.list"));
         return true;
         /*
         	if ($ob->workflow == 'bizproc')
         	{
         		__wd_create_default_bp_user_and_groups($arBizProcParameters);
         	}
         */
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:59,代码来源:webdav_settings.php

示例9: preloadOperationsForChildren

 public function preloadOperationsForChildren($parentObjectId)
 {
     $rightsManager = Driver::getInstance()->getRightsManager();
     foreach ($rightsManager->getUserOperationsForChildren($parentObjectId, $this->userId) as $objectId => $operations) {
         $this->operationsCache[$objectId] = $operations;
     }
     unset($operations);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:8,代码来源:disksecuritycontext.php

示例10: buildByAttachedObject

 /**
  * @param AttachedObject $attachedObject
  * @return static
  * @throws \Bitrix\Main\SystemException
  */
 public static function buildByAttachedObject(AttachedObject $attachedObject)
 {
     /** @var Entry $cloudImport */
     $cloudImport = $attachedObject->getObject()->getLastCloudImportEntry();
     $documentHandler = Driver::getInstance()->getDocumentHandlersManager()->getHandlerByCode($cloudImport->getService());
     if (!$documentHandler) {
         return null;
     }
     return new static($documentHandler);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:importmanager.php

示例11: getTasks

 /**
  * Returns tasks by module Disk.
  * @return array
  */
 protected function getTasks()
 {
     $rightsManager = Driver::getInstance()->getRightsManager();
     $tasks = array($rightsManager->getTaskById($rightsManager->getTaskIdByName($rightsManager::TASK_FULL)), $rightsManager->getTaskById($rightsManager->getTaskIdByName($rightsManager::TASK_EDIT)), $rightsManager->getTaskById($rightsManager->getTaskIdByName($rightsManager::TASK_READ)));
     foreach ($tasks as &$task) {
         $task = array_intersect_key($task, array('ID' => true, 'NAME' => true, 'TITLE' => true));
     }
     unset($task);
     return $tasks;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:rights.php

示例12: onRestAppDelete

 /**
  * Deletes application storage.
  * @param array $fields Fields describes application.
  * @return void
  */
 public static function onRestAppDelete(array $fields)
 {
     if (empty($fields['APP_ID']) || empty($fields['CLEAN'])) {
         return;
     }
     $storage = Driver::getInstance()->getStorageByRestApp($fields['APP_ID']);
     if (!$storage) {
         return;
     }
     $storage->delete(SystemUser::SYSTEM_USER_ID);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:16,代码来源:restmanager.php

示例13: processActionDefault

 protected function processActionDefault()
 {
     $validPassword = true;
     if ($this->externalLink->hasPassword()) {
         $validPassword = $this->checkPassword();
     }
     $file = $this->externalLink->getFile();
     $downloadToken = Random::getString(12);
     $this->storeDownloadToken($file, $downloadToken);
     $this->arResult = array('FILE' => array('ID' => $file->getId(), 'IS_IMAGE' => TypeFile::isImage($file->getName()), 'ICON_CLASS' => Icon::getIconClassByObject($file), 'UPDATE_TIME' => $file->getUpdateTime(), 'NAME' => $file->getName(), 'SIZE' => $file->getSize(), 'DOWNLOAD_URL' => \Bitrix\Disk\Driver::getInstance()->getUrlManager()->getUrlExternalLink(array('hash' => $this->externalLink->getHash(), 'action' => 'download', 'token' => $downloadToken)), 'SHOW_PREVIEW_URL' => \Bitrix\Disk\Driver::getInstance()->getUrlManager()->getUrlExternalLink(array('hash' => $this->externalLink->getHash(), 'action' => 'showPreview', 'token' => $downloadToken)), 'SHOW_FILE_URL' => \Bitrix\Disk\Driver::getInstance()->getUrlManager()->getUrlExternalLink(array('hash' => $this->externalLink->getHash(), 'action' => 'showFile', 'token' => $downloadToken)), 'VIEW_URL' => \Bitrix\Disk\Driver::getInstance()->getUrlManager()->getShortUrlExternalLink(array('hash' => $this->externalLink->getHash(), 'action' => 'default'), true), 'VIEW_FULL_URL' => \Bitrix\Disk\Driver::getInstance()->getUrlManager()->getUrlExternalLink(array('hash' => $this->externalLink->getHash(), 'action' => 'default'))), 'PROTECTED_BY_PASSWORD' => $this->externalLink->hasPassword(), 'VALID_PASSWORD' => $validPassword);
     $this->includeComponentTemplate();
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:12,代码来源:class.php

示例14: add

 /**
  * Adds row to entity table, fills error collection and builds model.
  * @param array           $data Data.
  * @param ErrorCollection $errorCollection Error collection.
  * @return \Bitrix\Disk\Internals\Model|static|null
  * @throws \Bitrix\Main\NotImplementedException
  * @internal
  */
 public static function add(array $data, ErrorCollection $errorCollection)
 {
     $result = FileTable::add($data);
     if (!$result->isSuccess()) {
         $errorCollection->addFromResult($result);
         return null;
     }
     $file = static::buildFromResult($result);
     if ($file && $file->getCreatedBy()) {
         $driver = Driver::getInstance();
         $driver->getRecentlyUsedManager()->push($file->getCreatedBy(), $file->getId());
     }
     return $file;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:22,代码来源:filelink.php

示例15: processActionGenerateExternalLink

 protected function processActionGenerateExternalLink()
 {
     /** @var File $file */
     list($file, $extLink) = $this->getFileAndExternalLink();
     if (!$extLink) {
         $extLink = $file->addExternalLink(array('CREATED_BY' => $this->getUser()->getId(), 'TYPE' => ExternalLinkTable::TYPE_MANUAL));
     }
     if (!$extLink) {
         $this->errorCollection->addOne(new Error(Loc::getMessage('DISK_FILE_VIEW_ERROR_COULD_NOT_CREATE_FIND_EXT_LINK'), self::ERROR_COULD_NOT_CREATE_FIND_EXT_LINK));
         $this->errorCollection->add($file->getErrors());
         $this->sendJsonErrorResponse();
     }
     $this->sendJsonSuccessResponse(array('hash' => $extLink->getHash(), 'link' => Driver::getInstance()->getUrlManager()->getShortUrlExternalLink(array('hash' => $extLink->getHash(), 'action' => 'default'), true)));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:14,代码来源:ajax.php


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