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


PHP CFile::getByID方法代码示例

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


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

示例1: formatValuePrintable

 /**
  * @param FieldType $fieldType
  * @param $value
  * @return string
  */
 protected static function formatValuePrintable(FieldType $fieldType, $value)
 {
     $value = (int) $value;
     $iterator = \CFile::getByID($value);
     if ($file = $iterator->fetch()) {
         return '[url=/bitrix/tools/bizproc_show_file.php?f=' . urlencode($file['FILE_NAME']) . '&i=' . $value . '&h=' . md5($file['SUBDIR']) . ']' . htmlspecialcharsbx($file['ORIGINAL_NAME']) . '[/url]';
     }
     return '';
 }
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:14,代码来源:file.php

示例2: exec

 public function exec($mode = "basic", $params = array())
 {
     $res = $this->check($params);
     if ($this->check($params)) {
         $this->file = \CFile::getByID($this->id)->fetch();
         if ($mode == "resize" && ($file = \CFile::ResizeImageGet($this->id, $params, BX_RESIZE_IMAGE_PROPORTIONAL, true)) && $file) {
             $this->file["SRC"] = $file["src"];
             $this->file["WIDTH"] = $file["width"];
             $this->file["HEIGHT"] = $file["height"];
             $this->file["FILE_SIZE"] = $file["size"];
         }
         \CFile::ViewByUser($this->file, array("force_download" => false, 'cache_time' => 0));
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:14,代码来源:fileinputunclouder.php

示例3: GetFieldInputValuePrintable

 public function GetFieldInputValuePrintable($documentType, $fieldType, $fieldValue)
 {
     $result = $fieldValue;
     switch ($fieldType['Type']) {
         case "user":
             if (!is_array($fieldValue)) {
                 $fieldValue = array($fieldValue);
             }
             $result = CBPHelper::usersArrayToString($fieldValue, null, array("lists", get_called_class(), $documentType));
             break;
         case "bool":
             if (is_array($fieldValue)) {
                 $result = array();
                 foreach ($fieldValue as $r) {
                     $result[] = strtoupper($r) != "N" && !empty($r) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO");
                 }
             } else {
                 $result = strtoupper($fieldValue) != "N" && !empty($fieldValue) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO");
             }
             break;
         case "file":
             if (is_array($fieldValue)) {
                 $result = array();
                 foreach ($fieldValue as $r) {
                     $r = intval($r);
                     $imgQuery = CFile::getByID($r);
                     if ($img = $imgQuery->fetch()) {
                         $result[] = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($img["FILE_NAME"]) . "&i=" . $r . "&h=" . md5($img["SUBDIR"]) . "]" . htmlspecialcharsbx($img["ORIGINAL_NAME"]) . "[/url]";
                     }
                 }
             } else {
                 $fieldValue = intval($fieldValue);
                 $imgQuery = CFile::getByID($fieldValue);
                 if ($img = $imgQuery->fetch()) {
                     $result = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($img["FILE_NAME"]) . "&i=" . $fieldValue . "&h=" . md5($img["SUBDIR"]) . "]" . htmlspecialcharsbx($img["ORIGINAL_NAME"]) . "[/url]";
                 }
             }
             break;
         case "select":
             if (is_array($fieldType["Options"])) {
                 if (is_array($fieldValue)) {
                     $result = array();
                     foreach ($fieldValue as $r) {
                         if (array_key_exists($r, $fieldType["Options"])) {
                             $result[] = $fieldType["Options"][$r];
                         }
                     }
                 } else {
                     if (array_key_exists($fieldValue, $fieldType["Options"])) {
                         $result = $fieldType["Options"][$fieldValue];
                     }
                 }
             }
             break;
     }
     if (strpos($fieldType['Type'], ":") !== false) {
         if ($fieldType["Type"] == "S:employee") {
             $fieldValue = CBPHelper::stripUserPrefix($fieldValue);
         }
         $customType = CIBlockProperty::getUserType(substr($fieldType['Type'], 2));
         if (array_key_exists("GetPublicViewHTML", $customType)) {
             if (is_array($fieldValue) && !CBPHelper::isAssociativeArray($fieldValue)) {
                 $result = array();
                 foreach ($fieldValue as $value) {
                     $r = call_user_func_array($customType["GetPublicViewHTML"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $value), ""));
                     $result[] = HTMLToTxt($r);
                 }
             } else {
                 $result = call_user_func_array($customType["GetPublicViewHTML"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $fieldValue), ""));
                 $result = HTMLToTxt($result);
             }
         }
     }
     return $result;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:75,代码来源:bizprocdocument.php

示例4: getFile

 /**
  * Returns file (@see CFile::getById());
  * @return array|null
  * @throws \Bitrix\Main\NotImplementedException
  */
 public function getFile()
 {
     if (!$this->fileId) {
         return null;
     }
     if (isset($this->file) && $this->fileId == $this->file['ID']) {
         return $this->file;
     }
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $this->file = \CFile::getByID($this->fileId)->fetch();
     if (!$this->file) {
         return array();
     }
     return $this->file;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:20,代码来源:file.php


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