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


PHP CFile::formatSize方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getEditFormHTML

 public static function getEditFormHTML($userField, $htmlControl)
 {
     $html = '';
     $values = $userField['VALUE'];
     if (!is_array($values)) {
         $values = array($userField['VALUE']);
     }
     $urlManager = Driver::getInstance()->getUrlManager();
     foreach ($values as $value) {
         if (!$value) {
             continue;
         }
         list($type, $realValue) = self::detectType($value);
         if ($type == self::TYPE_ALREADY_ATTACHED) {
             $attachedObject = AttachedObject::loadById($realValue, array('OBJECT'));
             $name = htmlspecialcharsbx($attachedObject->getObject()->getName());
             $size = \CFile::formatSize($attachedObject->getObject()->getSize());
             $html .= '<br/><a href="' . $urlManager->getUrlUfController('download', array('attachedId' => $realValue)) . '">' . $name . ' (' . $size . ')</a>';
         }
     }
     return $html;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:22,代码来源:fileusertype.php

示例4: listFolder

 /**
  * Lists folder contents
  * @param $path
  * @param $folderId
  * @return mixed
  */
 public function listFolder($path, $folderId)
 {
     if ($path === '/') {
         $folderId = 'root';
     }
     $http = new HttpClient(array('socketTimeout' => 10, 'streamTimeout' => 30, 'version' => HttpClient::HTTP_1_1));
     $http->setHeader('Content-Type', 'application/json; charset=UTF-8');
     $http->setHeader('Authorization', "Bearer {$this->getAccessToken()}");
     if ($http->get(self::API_URL_V2 . "/files?q='{$folderId}'+in+parents") === false) {
         $errorString = implode('; ', array_keys($http->getError()));
         $this->errorCollection->add(array(new Error($errorString, self::ERROR_HTTP_LIST_FOLDER)));
         return null;
     }
     if (!$this->checkHttpResponse($http)) {
         return null;
     }
     $items = Json::decode($http->getResult());
     if ($items === null) {
         $this->errorCollection->add(array(new Error('Could not decode response as json', self::ERROR_BAD_JSON)));
         return null;
     }
     if (!isset($items['items'])) {
         $this->errorCollection->add(array(new Error('Could not find items in response', self::ERROR_HTTP_LIST_FOLDER)));
         return null;
     }
     $reformatItems = array();
     foreach ($items['items'] as $item) {
         $isFolder = $item['mimeType'] === 'application/vnd.google-apps.folder';
         $dateTime = new \DateTime($item['modifiedDate']);
         $reformatItems[$item['id']] = array('id' => $item['id'], 'name' => $item['title'], 'type' => $isFolder ? 'folder' : 'file', 'size' => $isFolder ? '' : \CFile::formatSize($item['fileSize']), 'sizeInt' => $isFolder ? '' : $item['fileSize'], 'modifyBy' => '', 'modifyDate' => $dateTime->format('d.m.Y'), 'modifyDateInt' => $dateTime->getTimestamp(), 'provider' => static::getCode());
         if (!$isFolder && empty($item['fileSize'])) {
             //Google.Drive doesn't show size of google documents. We should export docs
             $reformatItems[$item['id']]['size'] = $reformatItems[$item['id']]['sizeInt'] = '';
         }
         if (!$isFolder) {
             $reformatItems[$item['id']]['ext'] = getFileExtension($item['title']);
         }
     }
     unset($item);
     return $reformatItems;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:47,代码来源:googlehandler.php

示例5: getGridData


//.........这里部分代码省略.........
                    $actions[] = array("ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_GET_EXT_LINK'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].getExternalLink({$objectId});");
                    $downloadLink = $urlManager->getUrlForShowFile($object, array(), true);
                    $actions[] = array("ICONCLASS" => "show", 'PSEUDO_NAME' => 'internal_link', 'PSEUDO_VALUE' => $downloadLink, "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_COPY_INTERNAL_LINK'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].getInternalLink('{$downloadLink}');");
                    $actions[] = array("ICONCLASS" => "history", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_HISTORY'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $exportData['OPEN_URL'] . "#tab-history')");
                }
            }
            if ($object->canRename($securityContext)) {
                $actions[] = array("TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_RENAME'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].renameInline({$objectId})");
            }
            if ((!empty($sharedObjectIds[$objectId]) || $object->isLink()) && $object->canRead($securityContext)) {
                $tileActions['SHARE_INFO'] = array("ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_DETAIL_SHARE_INFO'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showShareInfoSmallView({\n\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t }\n\t\t\t\t\t})");
            }
            $columnsBizProc = array('BIZPROC' => '');
            $bizprocIcon = array('BIZPROC' => '');
            if ($this->arParams['STATUS_BIZPROC'] && !$isFolder) {
                list($actions, $columnsBizProc, $bizprocIcon) = $this->getBizProcData($object, $securityContext, $actions, $columnsBizProc, $bizprocIcon, $exportData);
            }
            if ($object->canDelete($securityContext)) {
                if ($object->isLink()) {
                    $actions[] = array("PSEUDO_NAME" => "detach", "ICONCLASS" => "detach", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_DETACH_BUTTON'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openConfirmDetach({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                } elseif ($object->getCode() !== Folder::CODE_FOR_UPLOADED_FILES) {
                    $actions[] = array("PSEUDO_NAME" => "delete", "ICONCLASS" => "delete", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_MARK_DELETED'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openConfirmDelete({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t },\n\t\t\t\t\t\t\t\tcanDelete: {$object->canDelete($securityContext)}\n\t\t\t\t\t\t\t})");
                }
            }
            $iconClass = Ui\Icon::getIconClassByObject($object, !empty($sharedObjectIds[$objectId]));
            $dataAttributesForViewer = '';
            if ($isFolder) {
                $dataAttributesForViewer = Ui\Viewer::getAttributesByObject($object);
                if ($grid['MODE'] === 'tile') {
                    $exportData['VIEWER_ATTRS'] = $dataAttributesForViewer;
                    $dataAttributesForViewer = '';
                }
                $nameSpecialChars = htmlspecialcharsbx($name);
                $columnName = "\n\t\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$objectId}\" class=\"draggable bx-file-icon-container-small {$iconClass}\"></div></td>\n\t\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$objectId}\" href=\"{$exportData['OPEN_URL']}\" {$dataAttributesForViewer}>{$nameSpecialChars}</a></td>\n\t\t\t\t\t</tr></table>\n\t\t\t\t";
            } else {
                $externalId = '';
                if ($isDesktopDiskInstall && $isStorageCurrentUser) {
                    $externalId = "st{$this->storage->getId()}|{$this->storage->getRootObjectId()}|f{$objectId}";
                }
                $dataAttributesForViewer = Ui\Viewer::getAttributesByObject($object, array('canUpdate' => $object->canUpdate($securityContext), 'relativePath' => $relativePath . '/' . $name, 'externalId' => $externalId));
                if ($grid['MODE'] === 'tile') {
                    $exportData['VIEWER_ATTRS'] = $dataAttributesForViewer;
                    $dataAttributesForViewer = '';
                }
                $nameSpecialChars = htmlspecialcharsbx($name);
                $columnName = "\n\t\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=\"{$objectId}\" class=\"draggable bx-file-icon-container-small {$iconClass}\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$objectId}\" href=\"{$exportData['OPEN_URL']}\" {$dataAttributesForViewer}>{$nameSpecialChars}</a></td>\n\t\t\t\t\t\t<td>{$bizprocIcon['BIZPROC']}</td>\n\t\t\t\t\t</tr></table>\n\t\t\t\t";
            }
            $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $object->getCreatedBy()));
            $timestampCreate = $object->getCreateTime()->toUserTime()->getTimestamp();
            $timestampUpdate = $object->getUpdateTime()->toUserTime()->getTimestamp();
            $columns = array('CREATE_TIME' => $nowTime - $timestampCreate > 158400 ? formatDate($fullFormatWithoutSec, $timestampCreate, $nowTime) : formatDate('x', $timestampCreate, $nowTime), 'UPDATE_TIME' => $nowTime - $timestampCreate > 158400 ? formatDate($fullFormatWithoutSec, $timestampUpdate, $nowTime) : formatDate('x', $timestampUpdate, $nowTime), 'NAME' => $columnName, 'FORMATTED_SIZE' => $isFolder ? '' : CFile::formatSize($object->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($object->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t");
            if ($this->arParams['STATUS_BIZPROC']) {
                $columns['BIZPROC'] = $columnsBizProc["BIZPROC"];
            }
            $exportData['ICON_CLASS'] = $iconClass;
            if ($grid['MODE'] === 'tile') {
                $exportData['IS_IMAGE'] = $isFolder ? false : \Bitrix\Disk\TypeFile::isImage($object);
                if ($exportData['IS_IMAGE']) {
                    $exportData['SRC_IMAGE'] = $urlManager->getUrlForShowFile($object, array('exact' => 'Y', 'width' => 64, 'height' => 64));
                }
                $exportData['UPDATE_TIME'] = $columns['UPDATE_TIME'];
            }
            $exportData['IS_SHARED'] = !empty($sharedObjectIds[$objectId]);
            $exportData['IS_LINK'] = $object->isLink();
            $tildaExportData = array();
            foreach ($exportData as $exportName => $exportValue) {
                $tildaExportData['~' . $exportName] = $exportValue;
            }
            unset($exportRow);
            $rows[] = array('data' => array_merge($exportData, $tildaExportData), 'columns' => $columns, 'actions' => $actions, 'tileActions' => $tileActions, 'TYPE' => $exportData['TYPE'], 'NAME' => $exportData['NAME'], 'UPDATE_TIME' => $object->getUpdateTime()->getTimestamp(), 'SIZE' => $isFolder ? 0 : $object->getSize());
        }
        unset($object);
        if (!$needPagination) {
            Collection::sortByColumn($rows, $sortingColumns);
        }
        $grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'sort' => isset($possibleColumnForSorting['ID']) ? 'ID' : false, 'default' => false), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_NAME'), 'sort' => isset($possibleColumnForSorting['NAME']) ? 'NAME' : false, 'default' => true, 'editable' => array('size' => 45)), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_CREATE_TIME'), 'sort' => isset($possibleColumnForSorting['CREATE_TIME']) ? 'CREATE_TIME' : false, 'default' => false), array('id' => 'UPDATE_TIME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_UPDATE_TIME'), 'sort' => isset($possibleColumnForSorting['UPDATE_TIME']) ? 'UPDATE_TIME' : false, 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_CREATE_USER'), 'sort' => isset($possibleColumnForSorting['CREATE_USER']) ? 'CREATE_USER' : false, 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_FORMATTED_SIZE'), 'sort' => isset($possibleColumnForSorting['FORMATTED_SIZE']) ? 'FORMATTED_SIZE' : false, 'default' => true));
        if ($this->arParams['STATUS_BIZPROC']) {
            $grid['HEADERS'][] = array('id' => 'BIZPROC', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_BIZPROC'), 'default' => false);
        }
        $grid['DATA_FOR_PAGINATION'] = array('ENABLED' => $needPagination);
        if ($needPagination) {
            $grid['DATA_FOR_PAGINATION']['SHOW_NEXT_PAGE'] = $needShowNextPagePagination;
            $grid['DATA_FOR_PAGINATION']['CURRENT_PAGE'] = $pageNumber;
        }
        $grid['COLUMN_FOR_SORTING'] = $possibleColumnForSorting;
        $grid['ROWS'] = $rows;
        $grid['ROWS_COUNT'] = count($rows);
        $grid['FOOTER'] = array();
        if (isModuleInstalled('bitrix24')) {
            list($freeSpace, $diskSize) = $this->getDiskSpace();
            $freeSpace = CFile::formatSize($freeSpace);
            $diskSize = CFile::formatSize($diskSize);
            $grid['FOOTER'] = array(array('custom_html' => '
						<td class="tar" style="width: 100%;">' . Loc::getMessage('DISK_FOLDER_LIST_B24_LABEL_DISK_SPACE', array('#FREE_SPACE#' => '<span>' . $freeSpace, '#DISK_SIZE#' => $diskSize . '</span>')) . '</span></td>
					'), array('custom_html' => '
						<td class="tar"><a class="bx-disk-mp-link-addhdd" href="' . Loc::getMessage('DISK_FOLDER_LIST_B24_URL_DISK_SPACE') . '" target="_blank">+ <span>' . Loc::getMessage('DISK_FOLDER_LIST_B24_APPEND_DISK_SPACE') . '</span></a></td>
					'));
        }
        return $grid;
    }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:class.php

示例6: loadFilesData

 private function loadFilesData()
 {
     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);
     }
     $files = array();
     $driver = \Bitrix\Disk\Driver::getInstance();
     $urlManager = $driver->getUrlManager();
     $userFieldManager = $driver->getUserFieldManager();
     $userFieldManager->loadBatchAttachedObject($values);
     foreach ($values as $id) {
         $attachedModel = null;
         list($type, $realValue) = FileUserType::detectType($id);
         if ($realValue <= 0) {
             continue;
         } elseif ($type == FileUserType::TYPE_NEW_OBJECT) {
             /** @var File $fileModel */
             $fileModel = File::loadById($realValue);
             if (!$fileModel || !$fileModel->canRead($fileModel->getStorage()->getCurrentUserSecurityContext())) {
                 continue;
             }
         } else {
             /** @var \Bitrix\Disk\AttachedObject $attachedModel */
             $attachedModel = $userFieldManager->getAttachedObjectById($realValue);
             if (!$attachedModel) {
                 continue;
             }
             if (!$this->editMode) {
                 $attachedModel->setOperableEntity(array('ENTITY_ID' => $this->arParams['PARAMS']['arUserField']['ENTITY_ID'], 'ENTITY_VALUE_ID' => $this->arParams['PARAMS']['arUserField']['ENTITY_VALUE_ID']));
             }
             /** @var File $fileModel */
             $fileModel = $attachedModel->getFile();
         }
         $name = $fileModel->getName();
         $data = array('ID' => $id, 'NAME' => $name, 'CONVERT_EXTENSION' => DocumentHandler::isNeedConvertExtension($fileModel->getExtension()), 'EDITABLE' => DocumentHandler::isEditable($fileModel->getExtension()), 'CAN_UPDATE' => $attachedModel ? $attachedModel->canUpdate($userId) : $fileModel->canUpdate($fileModel->getStorage()->getCurrentUserSecurityContext()), 'FROM_EXTERNAL_SYSTEM' => $fileModel->getContentProvider() && $fileModel->getCreatedBy() == $userId, 'EXTENSION' => $fileModel->getExtension(), 'SIZE' => \CFile::formatSize($fileModel->getSize()), 'XML_ID' => $fileModel->getXmlId(), 'FILE_ID' => $fileModel->getId(), 'VIEW_URL' => $urlManager->getUrlToShowAttachedFileByService($id, 'gvdrive'), 'EDIT_URL' => $urlManager->getUrlToStartEditUfFileByService($id, 'gdrive'), 'DOWNLOAD_URL' => $urlManager->getUrlUfController('download', array('attachedId' => $id)), 'COPY_TO_ME_URL' => $urlManager->getUrlUfController('copyToMe', array('attachedId' => $id)), 'DELETE_URL' => "");
         if (\Bitrix\Disk\TypeFile::isImage($fileModel)) {
             $this->arParams['PARAMS']['THUMB_SIZE'] = $this->arParams['PARAMS']['THUMB_SIZE'] > 0 ? $this->arParams['PARAMS']['THUMB_SIZE'] : 100;
             $data["PREVIEW_URL"] = $attachedModel === null ? $urlManager->getUrlForShowFile($fileModel) : $urlManager->getUrlUfController('show', array('attachedId' => $id));
             $data["IMAGE"] = $fileModel->getFile();
         }
         if ($this->editMode) {
             $data['STORAGE'] = $fileModel->getStorage()->getProxyType()->getTitleForCurrentUser() . ' / ' . $fileModel->getParent()->getName();
         } else {
             $data['ATTRIBUTES_FOR_VIEWER'] = Ui\Viewer::getAttributesByAttachedObject($attachedModel, array('canUpdate' => $data['CAN_UPDATE'], 'canFakeUpdate' => true, 'showStorage' => false, 'externalId' => false, 'relativePath' => false));
         }
         $files[] = $data;
     }
     unset($id);
     return $files;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:55,代码来源:class.php

示例7: listFolder

 /**
  * Lists folder contents
  * @param $path
  * @param $folderId
  * @return mixed
  */
 public function listFolder($path, $folderId)
 {
     if ($path === '/') {
         $folderId = '';
     } else {
         $folderId = $this->getForApiDecodedId($folderId);
     }
     $http = new HttpClient(array('socketTimeout' => 10, 'streamTimeout' => 30, 'version' => HttpClient::HTTP_1_1));
     $http->setHeader('Content-Type', 'application/json; charset=UTF-8');
     $http->setHeader('Authorization', "Bearer {$this->getAccessToken()}");
     if ($http->get(self::API_URL . "/metadata/auto/{$folderId}") === false) {
         $errorString = implode('; ', array_keys($http->getError()));
         $this->errorCollection->add(array(new Error($errorString, self::ERROR_HTTP_LIST_FOLDER)));
         return null;
     }
     if (!$this->checkHttpResponse($http)) {
         return null;
     }
     $items = Json::decode($http->getResult());
     if ($items === null) {
         $this->errorCollection->add(array(new Error('Could not decode response as json', self::ERROR_BAD_JSON)));
         return null;
     }
     if (!isset($items['contents'])) {
         $this->errorCollection->add(array(new Error('Could not find items in response', self::ERROR_HTTP_LIST_FOLDER)));
         return null;
     }
     $reformatItems = array();
     foreach ($items['contents'] as $item) {
         $isFolder = (bool) $item['is_dir'];
         $dateTime = \DateTime::createFromFormat('D, d M Y H:i:s T', $item['modified']);
         $pseudoId = base64_encode($item['path']);
         $reformatItems[$pseudoId] = array('id' => $pseudoId, 'name' => bx_basename($item['path']), 'type' => $isFolder ? 'folder' : 'file', 'size' => $isFolder ? '' : \CFile::formatSize($item['bytes']), 'sizeInt' => $isFolder ? '' : $item['bytes'], 'modifyBy' => '', 'modifyDate' => $dateTime->format('d.m.Y'), 'modifyDateInt' => $dateTime->getTimestamp(), 'provider' => static::getCode());
         if (!$isFolder) {
             $reformatItems[$pseudoId]['storage'] = '';
             $reformatItems[$pseudoId]['ext'] = getFileExtension($reformatItems[$pseudoId]['name']);
         }
     }
     unset($item);
     return $reformatItems;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:47,代码来源:dropboxhandler.php

示例8: getFileListByUser

 public function getFileListByUser($user, array $filter = array())
 {
     $items = array();
     $urlManager = Driver::getInstance()->getUrlManager();
     foreach ($this->getFileModelListByUser($user, $filter) as $file) {
         $id = FileUserType::NEW_FILE_PREFIX . $file->getId();
         $items[$id] = array('id' => $id, 'name' => $file->getName(), 'type' => 'file', 'size' => \CFile::formatSize($file->getSize()), 'sizeInt' => $file->getSize(), 'modifyBy' => $file->getUpdateUser()->getFormattedName(), 'modifyDate' => $file->getUpdateTime()->format('d.m.Y'), 'modifyDateInt' => $file->getUpdateTime()->getTimestamp(), 'ext' => $file->getExtension());
         if (TypeFile::isImage($file)) {
             $items[$id]['previewUrl'] = $urlManager->getUrlForShowFile($file);
         }
     }
     unset($file);
     return $items;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:recentlyusedmanager.php

示例9: processActionPublishBlank

 protected function processActionPublishBlank()
 {
     $this->checkRequiredGetParams(array('type'));
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $fileData = new BlankFileData($this->request->getQuery('type'));
     if ($this->request->getPost('targetFolderId')) {
         $folder = Folder::loadById((int) $this->request->getPost('targetFolderId'), array('STORAGE'));
         if (!$folder) {
             $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_LOCAL_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_FOLDER'), self::ERROR_COULD_NOT_FIND_FOLDER)));
             $this->sendJsonErrorResponse();
         }
     } else {
         $userStorage = Driver::getInstance()->getStorageByUserId($this->getUser()->getId());
         if (!$userStorage) {
             $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_LOCAL_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_STORAGE'), self::ERROR_COULD_NOT_FIND_STORAGE)));
             $this->sendJsonErrorResponse();
         }
         $folder = $userStorage->getFolderForCreatedFiles();
     }
     if (!$folder) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_LOCAL_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_FOLDER_FOR_CREATED_FILES'), self::ERROR_COULD_NOT_FIND_FOLDER_FOR_CREATED_FILES)));
         $this->sendJsonErrorResponse();
     }
     $storage = $folder->getStorage();
     if (!$folder->canAdd($storage->getCurrentUserSecurityContext())) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_LOCAL_DOC_CONTROLLER_ERROR_BAD_RIGHTS'), self::ERROR_BAD_RIGHTS)));
         $this->sendJsonErrorResponse();
     }
     $newFile = $folder->addBlankFile(array('NAME' => $fileData->getName(), 'CREATED_BY' => $this->getUser()->getId(), 'MIME_TYPE' => $fileData->getMimeType()), array(), true);
     if (!$newFile) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_LOCAL_DOC_CONTROLLER_ERROR_COULD_NOT_CREATE_FILE'), self::ERROR_COULD_NOT_CREATE_FILE)));
         $this->errorCollection->add($folder->getErrors());
         $this->sendJsonErrorResponse();
     }
     $this->sendJsonSuccessResponse(array('ufValue' => FileUserType::NEW_FILE_PREFIX . $newFile->getId(), 'id' => $newFile->getId(), 'object' => array('id' => $newFile->getId(), 'name' => $newFile->getName(), 'sizeInt' => $newFile->getSize(), 'size' => \CFile::formatSize($newFile->getSize()), 'extension' => $newFile->getExtension(), 'nameWithoutExtension' => getFileNameWithoutExtension($newFile->getName())), 'folderName' => $storage->getProxyType()->getTitleForCurrentUser() . ' / ' . $folder->getName(), 'link' => Driver::getInstance()->getUrlManager()->getUrlForStartEditFile($newFile->getId(), self::CODE)));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:38,代码来源:localdocumentcontroller.php

示例10: processActionHandleFile

 function processActionHandleFile($hash, &$file, &$package, &$upload, &$error)
 {
     $errorCollection = new ErrorCollection();
     $storage = Driver::getInstance()->getStorageByUserId($this->getUser()->getId());
     if (!$storage) {
         $errorCollection->add(array(new Error(Loc::getMessage('DISK_UF_CONTROLLER_ERROR_COULD_NOT_FIND_USER_STORAGE'), self::ERROR_COULD_NOT_FIND_USER_STORAGE)));
         $error = implode(" ", $errorCollection->toArray());
         return false;
     }
     $folder = $storage->getFolderForUploadedFiles($this->getUser()->getId());
     if (!$folder) {
         $errorCollection->add(array(new Error(Loc::getMessage('DISK_UF_CONTROLLER_ERROR_COULD_NOT_FIND_FIND_FOLDER'), self::ERROR_COULD_NOT_FIND_FOLDER)));
         $error = implode(" ", $errorCollection->toArray());
         return false;
     }
     $urlManager = Driver::getInstance()->getUrlManager();
     if ($folder->canAdd($storage->getCurrentUserSecurityContext())) {
         $fileModel = $folder->uploadFile($file["files"]["default"], array('NAME' => $file['name'], 'CREATED_BY' => $this->getUser()->getId()), array(), true);
         if ($fileModel) {
             $name = $fileModel->getName();
             $id = FileUserType::NEW_FILE_PREFIX . $fileModel->getId();
             $file = array_merge($file, array('id' => $id, 'originalId' => $fileModel->getId(), 'name' => $name, 'label' => getFileNameWithoutExtension($name), 'ext' => $fileModel->getExtension(), 'size' => \CFile::formatSize($fileModel->getSize()), 'sizeInt' => $fileModel->getSize(), 'storage' => $storage->getProxyType()->getTitleForCurrentUser() . ' / ' . $folder->getName(), 'deleteUrl' => $urlManager->getUrlUfController('deleteFile', array('attachedId' => $id)), 'canChangeName' => true), TypeFile::isImage($name) ? array('previewUrl' => $urlManager->getUrlForShowFile($fileModel, array("width" => 100, "height" => 100))) : array());
         } else {
             $error = is_array($folder->getErrors()) ? implode(" ", $folder->getErrors()) : 'The file has not been saved';
         }
     }
     return empty($error);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:28,代码来源:controller.php

示例11: processActionSaveSettingsExternalLink

 protected function processActionSaveSettingsExternalLink()
 {
     /** @var File $file */
     /** @var ExternalLink $extLink */
     list($file, $extLink) = $this->getFileAndExternalLink();
     if (!$extLink) {
         $this->sendJsonErrorResponse();
     }
     if ($this->request->getPost('deathTime')) {
         $extLink->changeDeathTime(DateTime::createFromTimestamp(time() + (int) $this->request->getPost('deathTime')));
     }
     if ($this->request->getPost('password')) {
         $extLink->changePassword($this->request->getPost('password'));
     }
     $this->sendJsonSuccessResponse(array('object' => array('name' => $file->getName(), 'size' => \CFile::formatSize($file->getSize()), 'date' => (string) $file->getUpdateTime()), 'linkData' => array('hasPassword' => $extLink->hasPassword(), 'hasDeathTime' => $extLink->hasDeathTime(), 'hash' => $extLink->getHash(), 'link' => Driver::getInstance()->getUrlManager()->getShortUrlExternalLink(array('hash' => $extLink->getHash(), 'action' => 'default'), true))));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:16,代码来源:ajax.php

示例12: getVersionGridData

 private function getVersionGridData($gridId)
 {
     $grid = array('ID' => $gridId);
     $gridOptions = new CGridOptions($grid['ID']);
     $gridSort = $gridOptions->getSorting(array('sort' => array('ID' => 'desc'), 'vars' => array('by' => 'by', 'order' => 'order')));
     $grid['SORT'] = $gridSort['sort'];
     $grid['SORT_VARS'] = $gridSort['vars'];
     $this->arResult['ITEMS'] = $this->file->getVersions(array('with' => array('CREATE_USER'), 'order' => $gridSort['sort']));
     $urlManager = \Bitrix\Disk\Driver::getInstance()->getUrlManager();
     $rows = array();
     foreach ($this->arResult['ITEMS'] as $version) {
         /** @var $version Version */
         $objectArray = $version->toArray();
         $actions = array(array("ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_FILE_VIEW_HISTORY_ACT_DOWNLOAD'), "DEFAULT" => true, "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadVersion($version) . "')"));
         $securityContext = $this->storage->getCurrentUserSecurityContext();
         if ($this->file->canRestore($securityContext)) {
             $actions[] = array("ICONCLASS" => "restore", "TEXT" => Loc::getMessage('DISK_FILE_VIEW_HISTORY_ACT_RESTORE'), "DEFAULT" => true, "ONCLICK" => "BX.Disk['FileViewClass_{$this->getComponentId()}'].openConfirmRestore({\n\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\tid: {$this->file->getId()},\n\t\t\t\t\t\t\t\tname: '{$this->file->getName()}'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tversion: {\n\t\t\t\t\t\t\t\tid: {$version->getId()}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})");
         }
         if ($this->file->canRestore($securityContext) && $this->file->canDelete($securityContext)) {
             $actions[] = array("ICONCLASS" => "delete", "TEXT" => Loc::getMessage('DISK_FILE_VIEW_HISTORY_ACT_DELETE'), "DEFAULT" => true, "ONCLICK" => "BX.Disk['FileViewClass_{$this->getComponentId()}'].openConfirmDeleteVersion({\n\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\tid: {$this->file->getId()},\n\t\t\t\t\t\t\t\tname: '{$this->file->getName()}'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tversion: {\n\t\t\t\t\t\t\t\tid: {$version->getId()}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})");
         }
         $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $version->getCreatedBy()));
         $dataAttributesForViewer = Ui\Viewer::getAttributesByVersion($version);
         $rows[] = array('data' => $objectArray, 'columns' => array('FORMATTED_SIZE' => CFile::formatSize($version->getSize()), 'NAME' => "<a href='' {$dataAttributesForViewer}>" . $version->getName() . "</a>", 'CREATE_USER' => "\n\t\t\t\t\t\t<div class=\"bx-disk-user-link\"><span class=\"bx-disk-filepage-fileinfo-ownner-avatar\" style=\"background-image: url({$version->getCreateUser()->getAvatarSrc()});\"></span><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($version->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t\t", 'CREATE_TIME_VERSION' => $version->getCreateTime(), 'CREATE_TIME_FILE' => $version->getObjectCreateTime(), 'UPDATE_TIME_FILE' => $version->getObjectUpdateTime()), 'actions' => $actions);
     }
     unset($version);
     $grid['ROWS'] = $rows;
     $grid['ROWS_COUNT'] = count($rows);
     $grid['HEADERS'] = array(array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_FILE_VIEW_VERSION_COLUMN_CREATE_USER_2'), 'default' => true), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_FILE_VIEW_VERSION_COLUMN_NAME'), 'default' => true), array('id' => 'CREATE_TIME_VERSION', 'name' => Loc::getMessage('DISK_FILE_VIEW_VERSION_COLUMN_CREATE_TIME_2'), 'default' => true), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_FILE_VIEW_VERSION_COLUMN_FORMATTED_SIZE'), 'default' => true), array('id' => 'ID', 'name' => 'ID', 'default' => false, 'show_checkbox' => true));
     return $grid;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:class.php

示例13: processActionSaveBlank

 protected function processActionSaveBlank()
 {
     $this->checkRequiredGetParams(array('type'));
     $this->checkRequiredPostParams(array('editSessionId'));
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $currentSession = $this->getEditSessionByCurrentUser((int) $this->request->getPost('editSessionId'));
     if (!$currentSession) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_EDIT_SESSION'), self::ERROR_COULD_NOT_FIND_EDIT_SESSION)));
         $this->sendJsonErrorResponse();
     }
     $tmpFile = \CTempFile::getFileName(uniqid('_wd'));
     checkDirPath($tmpFile);
     $fileData = new BlankFileData($this->request->getQuery('type'));
     $fileData->setId($currentSession->getServiceFileId());
     $fileData->setSrc($tmpFile);
     $fileData = $this->documentHandler->downloadFile($fileData);
     if (!$fileData) {
         if ($this->documentHandler->isRequiredAuthorization()) {
             $this->sendNeedAuth();
         }
         $this->errorCollection->add($this->documentHandler->getErrors());
         $this->sendJsonErrorResponse();
     }
     $fileArray = \CFile::makeFileArray($tmpFile);
     $fileArray['name'] = $fileData->getName();
     $fileArray['type'] = $fileData->getMimeType();
     $fileArray['MODULE_ID'] = Driver::INTERNAL_MODULE_ID;
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $fileId = \CFile::saveFile($fileArray, Driver::INTERNAL_MODULE_ID);
     if (!$fileId) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_SAVE_FILE'), self::ERROR_COULD_NOT_SAVE_FILE)));
         $this->sendJsonErrorResponse();
     }
     $folder = null;
     if (!empty($_REQUEST['targetFolderId'])) {
         $folder = $this->getFolderToSaveFile((int) $_REQUEST['targetFolderId']);
     }
     if (!$folder) {
         $userStorage = Driver::getInstance()->getStorageByUserId($this->getUser()->getId());
         if (!$userStorage) {
             \CFile::delete($fileId);
             $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_STORAGE'), self::ERROR_COULD_NOT_FIND_STORAGE)));
             $this->sendJsonErrorResponse();
         }
         $folder = $userStorage->getFolderForCreatedFiles();
     }
     if (!$folder) {
         \CFile::delete($fileId);
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_FIND_FOLDER_FOR_CREATED_FILES'), self::ERROR_COULD_NOT_FIND_FOLDER_FOR_CREATED_FILES)));
         $this->sendJsonErrorResponse();
     }
     if (!$folder->canAdd($folder->getStorage()->getCurrentUserSecurityContext())) {
         \CFile::delete($fileId);
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_BAD_RIGHTS'), self::ERROR_BAD_RIGHTS)));
         $this->sendJsonErrorResponse();
     }
     $newFile = $folder->addFile(array('NAME' => $fileData->getName(), 'FILE_ID' => $fileId, 'SIZE' => $fileArray['size'], 'CREATED_BY' => $this->getUser()->getId()), array(), true);
     if (!$newFile) {
         \CFile::delete($fileId);
         $this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_CREATE_FILE'), self::ERROR_COULD_NOT_CREATE_FILE)));
         $this->errorCollection->add($folder->getErrors());
         $this->sendJsonErrorResponse();
     }
     $this->deleteEditSession($currentSession);
     $this->deleteFile($currentSession, $fileData);
     $this->sendJsonSuccessResponse(array('folderName' => $folder->getName(), 'objectId' => $newFile->getId(), 'sizeInt' => $newFile->getSize(), 'size' => \CFile::formatSize($newFile->getSize()), 'name' => $newFile->getName(), 'extension' => $newFile->getExtension(), 'nameWithoutExtension' => getFileNameWithoutExtension($newFile->getName())));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:69,代码来源:documentcontroller.php

示例14: processActionSearchFile

 protected function processActionSearchFile($entityType, $entityId, $searchQuery)
 {
     $models = $this->searchObjects($entityType, $entityId, $searchQuery);
     if ($models === null) {
         $this->sendJsonErrorResponse();
     }
     $urlManager = Driver::getInstance()->getUrlManager();
     $urlForLoadItems = $urlManager->getUrlUfController('loadItems');
     $response = array();
     foreach ($models as $item) {
         /** @var File|Folder $item */
         $isFolder = $item instanceof Folder;
         if ($isFolder) {
             continue;
         }
         $id = FileUserType::NEW_FILE_PREFIX . $item->getId();
         $response[$id] = array('id' => $id, 'type' => 'file', 'link' => $urlForLoadItems, 'name' => $item->getName(), 'size' => $isFolder ? '' : \CFile::formatSize($item->getSize()), 'sizeInt' => $isFolder ? '' : $item->getSize(), 'modifyBy' => $item->getUpdateUser()->getFormattedName(), 'modifyDate' => $item->getUpdateTime()->format('d.m.Y'), 'modifyDateInt' => $item->getUpdateTime()->getTimestamp(), 'ext' => $item->getExtension());
     }
     unset($item);
     $this->sendJsonSuccessResponse(array('items' => $response));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:controller.php

示例15: htmlspecialcharsbx

echo $arResult['FILE']['CREATE_USER']['AVA'];
?>
);"></span>
													<?php 
echo htmlspecialcharsbx($arResult['FILE']['CREATE_USER']['NAME']);
?>
												</a>
											</td>
										</tr>
										<tr>
											<td class="bx-disk-filepage-fileinfo-param"><?php 
echo Loc::getMessage('DISK_FILE_VIEW_FILE_SIZE');
?>
:</td>
											<td class="bx-disk-filepage-fileinfo-value"><?php 
echo CFile::formatSize($arResult['FILE']['SIZE']);
?>
</td>
										</tr>
										<tr>
											<td class="bx-disk-filepage-fileinfo-param"><?php 
echo Loc::getMessage('DISK_FILE_VIEW_FILE_UPDATE_TIME');
?>
:</td>
											<td class="bx-disk-filepage-fileinfo-value"><?php 
echo $arResult['FILE']['UPDATE_TIME'];
?>
</td>
										</tr
									</tbody>
								</table>
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:template.php


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