本文整理汇总了PHP中CFile::GetFileSRC方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::GetFileSRC方法的具体用法?PHP CFile::GetFileSRC怎么用?PHP CFile::GetFileSRC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::GetFileSRC方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPrepareComments
function OnPrepareComments()
{
$arResult =& $this->component->arResult;
$arParams =& $this->component->arParams;
$arMessages =& $arResult['MESSAGES'];
$arResult['FILES'] = array();
if (!empty($arMessages)) {
$res = array_keys($arMessages);
$arFilter = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"], "APPROVED_AND_MINE" => $GLOBALS["USER"]->GetId(), ">MESSAGE_ID" => intVal(min($res)) - 1, "<MESSAGE_ID" => intVal(max($res)) + 1);
if ($arResult["USER"]["RIGHTS"]["MODERATE"] == "Y") {
unset($arFilter["APPROVED_AND_MINE"]);
}
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), $arFilter);
if ($db_files && ($res = $db_files->Fetch())) {
do {
$res["SRC"] = CFile::GetFileSRC($res);
if ($arMessages[$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"]) {
// attach for custom
$arMessages[$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
$arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0, $this->imageSize, $this->imageSize, true, "border=0", false);
$arMessages[$res["MESSAGE_ID"]]["ATTACH_FILE"] = $arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"];
}
$arMessages[$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
$arResult['FILES'][$res["FILE_ID"]] = $res;
} while ($res = $db_files->Fetch());
}
}
}
示例2: fetchSrc
protected function fetchSrc()
{
if (!isset($this->src)) {
if (!($this->src = \CFile::GetFileSRC($this->data))) {
throw new \Exception('Source for image with id ' . $this->data['ID'] . ' does not exist');
}
}
return $this->src;
}
示例3: getImageUrl
public function getImageUrl($key)
{
if (!$this->hasImage($key)) {
throw new \Exception(__CLASS__ . ' with ID ' . $this->id . ' does not have image ' . $key);
}
if (empty($this->imagesSrc[$key])) {
if ($file = \CFile::GetByID($this->getImageId($key))->GetNext()) {
$this->imagesSrc[$key] = \CFile::GetFileSRC($file);
}
}
return $this->imagesSrc[$key];
}
示例4: array
$res["profile_view"] = $res["URL"]["AUTHOR"];
$res["MESSAGE_ANCHOR"] = $res["URL"]["MESSAGE"];
$res["message_link"] = $res["URL"]["MESSAGE"];
$res["email"] = $res["URL"]["AUTHOR_EMAIL"];
$res["icq"] = $res["URL"]["AUTHOR_ICQ"];
$res["pm_edit"] = $res["URL"]["AUTHOR_PM"];
/************** For custom templates/*******************************/
$arResult["MESSAGE_LIST"][$res["ID"]] = $res;
}
/************** Attach files ***************************************/
if (!empty($arResult["MESSAGE_LIST"])) {
$arFilter = array("@FILE_MESSAGE_ID" => array_keys($arResult["MESSAGE_LIST"]));
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), $arFilter);
if ($db_files && ($res = $db_files->Fetch())) {
do {
$res["SRC"] = CFile::GetFileSRC($res);
if ($arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"]) {
// attach for custom
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0, $arParams["IMAGE_SIZE"], $arParams["IMAGE_SIZE"], true, "border=0", false);
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["ATTACH_FILE"] = $arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["ATTACH_IMG"];
}
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
$arResult["FILES"][$res["FILE_ID"]] = $res;
} while ($res = $db_files->Fetch());
}
/************** Message info ***************************************/
$parser->arFiles = $arResult["FILES"];
foreach ($arResult["MESSAGE_LIST"] as $iID => $res) {
$arResult["MESSAGE_LIST"][$iID]["POST_MESSAGE_TEXT"] = $parser->convert($res["~POST_MESSAGE_TEXT"], $res["ALLOW"]);
$arResult["MESSAGE_LIST"][$iID]["FILES_PARSED"] = $parser->arFilesIDParsed;
示例5: ViewByUser
function ViewByUser($arFile, $arOptions = array())
{
/** @global CMain $APPLICATION */
global $APPLICATION;
$fastDownload = COption::GetOptionString('main', 'bx_fast_download', 'N') == 'Y';
$content_type = "";
$specialchars = false;
$force_download = false;
$cache_time = 10800;
$fromClouds = false;
if (is_array($arOptions)) {
if (array_key_exists("content_type", $arOptions)) {
$content_type = $arOptions["content_type"];
}
if (array_key_exists("specialchars", $arOptions)) {
$specialchars = $arOptions["specialchars"];
}
if (array_key_exists("force_download", $arOptions)) {
$force_download = $arOptions["force_download"];
}
if (array_key_exists("cache_time", $arOptions)) {
$cache_time = intval($arOptions["cache_time"]);
}
}
if ($content_type == '') {
if ($arFile["tmp_name"] != '') {
$content_type = CFile::GetContentType($arFile["tmp_name"], true);
} else {
$content_type = "text/html; charset=" . LANG_CHARSET;
}
}
if ($force_download) {
$specialchars = false;
}
if ($cache_time < 0) {
$cache_time = 0;
}
if (is_array($arFile)) {
if (array_key_exists("SRC", $arFile)) {
$filename = $arFile["SRC"];
} elseif (array_key_exists("tmp_name", $arFile)) {
$filename = "/" . ltrim(substr($arFile["tmp_name"], strlen($_SERVER["DOCUMENT_ROOT"])), "/");
} else {
$filename = CFile::GetFileSRC($arFile);
}
} else {
if ($arFile = CFile::GetFileArray($arFile)) {
$filename = $arFile["SRC"];
} else {
$filename = '';
}
}
if ($filename == '') {
return false;
}
if ($arFile["ORIGINAL_NAME"] != '') {
$name = $arFile["ORIGINAL_NAME"];
} elseif ($arFile["name"] != '') {
$name = $arFile["name"];
} else {
$name = $arFile["FILE_NAME"];
}
if (array_key_exists("EXTENSION_SUFFIX", $arFile) && $arFile["EXTENSION_SUFFIX"] != '') {
$name = substr($name, 0, -strlen($arFile["EXTENSION_SUFFIX"]));
}
// ie filename error fix
$ua = strtolower($_SERVER["HTTP_USER_AGENT"]);
if (strpos($ua, "opera") === false && strpos($ua, "msie") !== false) {
if (SITE_CHARSET != "UTF-8") {
$name = $APPLICATION->ConvertCharset($name, SITE_CHARSET, "UTF-8");
}
$name = str_replace(" ", "%20", $name);
$name = urlencode($name);
$name = str_replace(array("%2520", "%2F"), array("%20", "/"), $name);
} else {
$name = str_replace(array("\n", "\r"), '', $name);
}
$io = CBXVirtualIo::GetInstance();
$src = null;
if (substr($filename, 0, 1) == "/") {
$src = fopen($io->GetPhysicalName($_SERVER["DOCUMENT_ROOT"] . $filename), "rb");
if (!$src) {
return false;
}
} else {
if (!$fastDownload) {
$src = new CHTTP();
$src->follow_redirect = true;
} elseif (intval($arFile['HANDLER_ID']) > 0) {
$fromClouds = true;
}
}
$APPLICATION->RestartBuffer();
while (ob_end_clean()) {
}
$cur_pos = 0;
$filesize = intval($arFile["FILE_SIZE"]) > 0 ? $arFile["FILE_SIZE"] : $arFile["size"];
$size = $filesize - 1;
$p = strpos($_SERVER["HTTP_RANGE"], "=");
if (intval($p) > 0) {
//.........这里部分代码省略.........
示例6: Search
public static function Search($arQuery, $arTypes = array())
{
global $DB;
$err_mess = CMedialibCollection::GetErrorMess() . "<br>Function: CMedialibItem::Search<br>Line: ";
$strSql = "SELECT\n\t\t\t\t\tMI.*, MI.*,MCI.COLLECTION_ID, F.HEIGHT, F.WIDTH, F.FILE_SIZE, F.CONTENT_TYPE, F.SUBDIR, F.FILE_NAME, F.HANDLER_ID,\n\t\t\t\t\t" . $DB->DateToCharFunction("MI.DATE_UPDATE") . " as DATE_UPDATE2\n\t\t\t\tFROM b_medialib_item MI\n\t\t\t\tINNER JOIN b_medialib_collection_item MCI ON (MI.ID=MCI.ITEM_ID)\n\t\t\t\tINNER JOIN b_file F ON (F.ID=MI.SOURCE_ID)\n\t\t\t\tWHERE 1=1";
$l = count($arQuery);
if ($l == 0) {
return array();
}
for ($i = 0; $i < $l; $i++) {
$strSql .= " AND MI.SEARCHABLE_CONTENT LIKE '%" . $DB->ForSql($arQuery[$i]) . "%'";
}
$strSql .= " ORDER BY MI.ID DESC";
$res = $DB->Query($strSql, false, $err_mess);
$arResult = array();
$rootPath = CSite::GetSiteDocRoot(false);
$tmbW = COption::GetOptionInt('fileman', "ml_thumb_width", 140);
$tmbH = COption::GetOptionInt('fileman', "ml_thumb_height", 105);
$elId2Index = array();
$colId2Index = array();
$arCol = CMedialibCollection::GetList(array('arFilter' => array('ACTIVE' => 'Y', "TYPES" => $arTypes)));
for ($i = 0, $l = count($arCol); $i < $l; $i++) {
$colId2Index[$arCol[$i]['ID']] = $i;
}
while ($arRes = $res->Fetch()) {
$colId = $arRes['COLLECTION_ID'];
if (!isset($colId2Index[$colId]) || !CMedialibCollection::IsViewable($arCol[$colId2Index[$colId]], $arCol)) {
continue;
}
if (isset($elId2Index[$arRes['ID']])) {
$arResult[$elId2Index[$arRes['ID']]]['collections'][] = $colId;
} else {
$elId2Index[$arRes['ID']] = count($arResult);
$arRes['collections'] = array($colId);
$arRes['perm'] = array('edit' => true, 'del' => true);
CMedialibItem::GenerateThumbnail($arRes, array('rootPath' => $rootPath, 'width' => $tmbW, 'height' => $tmbH));
$arRes['PATH'] = CFile::GetFileSRC($arRes);
$arResult[] = $arRes;
}
}
return $arResult;
}
示例7: Fetch
function Fetch()
{
global $DB;
$arFields = array();
if ($res = parent::Fetch()) {
if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" || COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$res["POST_MESSAGE_HTML"] = trim($res["POST_MESSAGE_HTML"]);
$res["POST_MESSAGE_FILTER"] = trim($res["POST_MESSAGE_FILTER"]);
if (empty($res["POST_MESSAGE_HTML"]) && COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" || empty($res["POST_MESSAGE_FILTER"]) && COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$arForum = CForumNew::GetByID($res["FORUM_ID"]);
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y" && empty($res["POST_MESSAGE_FILTER"])) {
$arFields["POST_MESSAGE_FILTER"] = CFilterUnquotableWords::Filter($res["POST_MESSAGE"]);
$arFields["POST_MESSAGE_FILTER"] = empty($arFields["POST_MESSAGE_FILTER"]) ? "*" : $arFields["POST_MESSAGE_FILTER"];
}
if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y" && empty($res["POST_MESSAGE_HTML"])) {
/* Info about one file is saved in old table field ATTACH_IMG */
$arFiles = false;
if (intval($res["ATTACH_IMG"]) > 0) {
$arFiles = array();
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("MESSAGE_ID" => $res["ID"]));
if ($db_files && ($res_file = $db_files->Fetch())) {
do {
$res_file["SRC"] = CFile::GetFileSRC($res);
$arFiles[$res_file["ID"]] = $res_file;
} while ($res_file = $db_files->Fetch());
}
}
$parser = new forumTextParser(LANGUAGE_ID);
$allow = forumTextParser::GetFeatures($arForum);
$allow['SMILES'] = $res["USE_SMILES"] == "Y" ? $allow['SMILES'] : "N";
$POST_MESSAGE_HTML = is_set($arFields, "POST_MESSAGE_FILTER") ? $arFields["POST_MESSAGE_FILTER"] : $res["POST_MESSAGE"];
$arFields["POST_MESSAGE_HTML"] = $parser->convert($POST_MESSAGE_HTML, $allow, "html", $arFiles);
}
$strUpdate = $DB->PrepareUpdate("b_forum_message", $arFields);
$strSql = "UPDATE b_forum_message SET " . $strUpdate . " WHERE ID = " . intVal($res["ID"]);
if ($DB->QueryBind($strSql, $arFields, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
foreach ($arFields as $key => $val) {
$res[$key] = $val;
}
}
}
}
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
if (is_set($res, "HTML") || is_set($res, "FM_HTML")) {
$arr = @unserialize(is_set($res, "HTML") ? $res["HTML"] : $res["FM_HTML"]);
if (empty($arr) || !is_array($arr)) {
$arr = array("AUTHOR_NAME" => $res["AUTHOR_NAME"], "AUTHOR_EMAIL" => $res["AUTHOR_EMAIL"], "EDITOR_NAME" => $res["EDITOR_NAME"], "EDITOR_EMAIL" => $res["EDITOR_EMAIL"], "EDIT_REASON" => $res["EDIT_REASON"]);
foreach ($arr as $key => $val) {
if (!empty($val)) {
$val = CFilterUnquotableWords::Filter($val);
$arr[$key] = empty($val) ? "*" : $val;
} else {
$arr[$key] = '';
}
}
$arFields = array("HTML" => serialize($arr));
$strUpdate = $DB->PrepareUpdate("b_forum_message", $arFields);
$strSql = "UPDATE b_forum_message SET " . $strUpdate . " WHERE ID = " . intVal($res["ID"]);
$DB->QueryBind($strSql, $arFields, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
foreach ($arr as $key => $val) {
$res["~" . $key] = $res[$key];
$res["" . $key] = $val;
}
}
if (!empty($res["FT_HTML"])) {
$arr = @unserialize($res["FT_HTML"]);
if (is_array($arr) && !empty($arr["TITLE"])) {
foreach ($arr as $key => $val) {
$res["~FT_" . $key] = $res["FT_" . $key];
$res["FT_" . $key] = $val;
}
}
}
if (!empty($res["F_HTML"])) {
$arr = @unserialize($res["F_HTML"]);
if (is_array($arr)) {
foreach ($arr as $key => $val) {
$res["~F_" . $key] = $res["F_" . $key];
$res["F_" . $key] = $val;
}
}
if (!empty($res["FT_TITLE"])) {
$res["F_TITLE"] = $res["FT_TITLE"];
}
}
}
if (!empty($this->sNameTemplate)) {
$arTmp = array();
foreach (array("AUTHOR_ID" => "AUTHOR_NAME", "EDITOR_ID" => "EDITOR_NAME", "USER_START_ID" => "USER_START_NAME") as $id => $name) {
if (array_key_exists($id, $res)) {
$tmp = "";
if (!empty($res[$id])) {
if (in_array($res[$id], $arTmp)) {
$tmp = $arTmp[$res[$id]];
} else {
$arTmp[$res[$id]] = $tmp = !empty($res[$name . "_FRMT"]) ? $res[$name . "_FRMT"] : CForumUser::GetFormattedNameByUserID($res[$id], $this->sNameTemplate, $id == "AUTHOR_ID" ? $res : array());
}
}
$res[$name] = !empty($tmp) ? $tmp : $res[$name];
//.........这里部分代码省略.........
示例8: _processFileCallback
function _processFileCallback($matches)
{
static $sImageAlign = '';
$bLink = false;
if ($matches[1] == ':') {
$bLink = true;
}
// if the internal file then get it
$sFile = $sFileName = $sPath = trim($matches[3]);
$bOur = false;
if (is_numeric($sFile) && in_array($sFile, $this->arFile)) {
$arFile = CFile::GetFileArray($sFile);
if ($arFile != false) {
$bOur = true;
$sPath = $arFile['SRC'];
$sFileName = $arFile['ORIGINAL_NAME'];
}
} else {
if (isset($this->arVersionFile[strtolower($sFile)])) {
$sPath = $this->arVersionFile[strtolower($sFile)];
$sFileName = $sFile;
} else {
if (!empty($this->arFile)) {
$arFilter = array('@ID' => implode(',', $this->arFile));
$rsFile = CFile::GetList(array(), $arFilter);
while ($arFile = $rsFile->Fetch()) {
if ($arFile['ORIGINAL_NAME'] == $sFile) {
$bOur = true;
$sFile = $arFile['ID'];
$sPath = CFile::GetFileSRC($arFile);
$sFileName = $arFile['ORIGINAL_NAME'];
break;
}
}
}
}
}
// if the image is processed as a picture
$sName = bx_basename($sPath);
if (CFile::IsImage($sName)) {
if ($bOur) {
$imageFile = CFile::MakeFileArray($sPath);
$checkRes = CFile::CheckImageFile($imageFile);
if ($checkRes != null) {
return $checkRes;
}
if ($bLink) {
$sReturn = '<a href="' . htmlspecialcharsbx($sPath) . '" title="' . ($s = htmlspecialcharsbx($sFileName)) . '">' . $s . '</a>';
} else {
$sReturn = CFile::ShowImage($sFile, COption::GetOptionString('wiki', 'image_max_width', 600), COption::GetOptionString('wiki', 'image_max_height', 600), 'border="0" align="' . $sImageAlign . '"');
}
} else {
if ($bLink) {
$sReturn = '<a href="' . htmlspecialcharsbx($sPath) . '" title="' . ($s = htmlspecialcharsbx($sName)) . '">' . $s . '</a>';
} else {
$sReturn = '<img src="' . htmlspecialcharsbx($sPath) . '" alt="' . htmlspecialcharsbx($sFileName) . '"/>';
}
}
} else {
if (strpos($sPath, 'http://') === 0) {
$sReturn = ' [ <a href="' . htmlspecialcharsbx($sFile) . '" title="' . GetMessage('FILE_FILE_DOWNLOAD') . '">' . GetMessage('FILE_DOWNLOAD') . '</a> ] ';
} else {
$sReturn = '[' . GetMessage('FILE_NAME') . ':' . htmlspecialcharsbx(is_numeric($sFile) || empty($sFileName) ? $sFile : $sFileName) . ']';
}
}
return $sReturn;
}
示例9: intval
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arParams["LIVEFEED_ID"]));
}
}
$arFileID = array();
$arFilter = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "CHECK_PERMISSIONS" => "Y", "SECTION_ID" => $arResult["SECTION"]["ID"], "INCLUDE_SUBSECTIONS" => "N", "ACTIVE" => "Y");
$rsElement = CIBlockElement::GetList(array("ID" => "DESC"), $arFilter, false, false, array("ID", "DETAIL_PICTURE", "PROPERTY_REAL_PICTURE"));
while ($arElement = $rsElement->Fetch()) {
if (intval($arElement["PROPERTY_REAL_PICTURE_VALUE"]) > 0) {
$arFileID[] = $arElement["PROPERTY_REAL_PICTURE_VALUE"];
}
}
if (count($arFileID) > 0) {
$strFileID = implode(",", $arFileID);
$rsFile = CFile::GetList(array("ID" => "DESC"), array("@ID" => $strFileID));
while ($arFile = $rsFile->Fetch()) {
$arResult["SECTION_ELEMENTS_SRC"][$arFile["ID"]] = CFile::GetFileSRC($arFile, false, $arFile["HANDLER_ID"] > 0);
}
}
if (is_object($cache)) {
$arCacheData = array("SECTION_ELEMENTS_SRC" => $arResult["SECTION_ELEMENTS_SRC"]);
$cache->EndDataCache($arCacheData);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
}
示例10: GetFileArray
function GetFileArray($FILE_ID, $upload_dir = false)
{
if (!is_array($FILE_ID) && intval($FILE_ID) > 0) {
if (CACHED_b_file === false) {
$res = CFile::GetByID($FILE_ID, true);
$arFile = $res->Fetch();
} else {
$res = CFile::GetFromCache($FILE_ID);
$arFile = $res[$FILE_ID];
}
if ($arFile) {
if (array_key_exists("~src", $arFile)) {
if ($arFile["~src"]) {
$arFile["SRC"] = $arFile["~src"];
} else {
$arFile["SRC"] = CFile::GetFileSRC($arFile, $upload_dir, false);
}
} else {
$arFile["SRC"] = CFile::GetFileSRC($arFile, $upload_dir);
}
return $arFile;
}
}
return false;
}
示例11: ListAddEnumFieldsValue
//.........这里部分代码省略.........
$dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $VALUE['CONTACT']));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY]['CONTACT'][$arRes['ID']] = $arRes;
}
}
if (isset($VALUE['COMPANY']) && !empty($VALUE['COMPANY'])) {
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), array('ID' => $VALUE['COMPANY']));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY]['COMPANY'][$arRes['ID']] = $arRes;
}
}
if (isset($VALUE['DEAL']) && !empty($VALUE['DEAL'])) {
$dbRes = CCrmDeal::GetList(array('TITLE' => 'ASC'), array('ID' => $VALUE['DEAL']));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY]['DEAL'][$arRes['ID']] = $arRes;
}
}
}
// assemble multi data
foreach ($VALUE['FIELD'] as $ID => $arFIELD_NAME) {
foreach ($arFIELD_NAME as $FIELD_NAME => $FIELD_VALUE) {
foreach ($FIELD_VALUE as $FIELD_VALUE_NAME => $FIELD_VALUE_ID) {
if ($KEY == 'iblock_section') {
$sname = htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['NAME']);
$arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
}
if ($KEY == 'iblock_element') {
$sname = htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['NAME']);
if (!$textonly) {
$surl = GetIBlockElementLinkById($arList[$KEY][$FIELD_VALUE_ID]['ID']);
if ($surl && strlen($surl) > 0) {
$sname = '<a href="' . $surl . '">' . $sname . '</a>';
}
}
$arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
} else {
if ($KEY == 'employee') {
$sname = CUser::FormatName(CSite::GetNameFormat(false), $arList[$KEY][$FIELD_VALUE_ID], false, true);
if (!$textonly) {
$ar['PATH_TO_USER_PROFILE'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_user_profile'), array('user_id' => $arList[$KEY][$FIELD_VALUE_ID]['ID']));
$sname = '<a href="' . $ar['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arParams['GRID_ID'] . '_' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . '">' . $sname . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . ', "balloon_' . $arParams['GRID_ID'] . '_' . $arList[$KEY][$FIELD_VALUE_ID]['ID'] . '", "");</script>';
}
$arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
} else {
if ($KEY == 'enumeration') {
$arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['VALUE']);
} else {
if ($KEY == 'file') {
$fileInfo = $arList[$KEY][$FIELD_VALUE_ID];
if ($textonly) {
$fileUrl = CFile::GetFileSRC($fileInfo);
} else {
$fileUrlTemplate = isset($arOptions['FILE_URL_TEMPLATE']) ? $arOptions['FILE_URL_TEMPLATE'] : '';
$fileUrl = $fileUrlTemplate === '' ? CFile::GetFileSRC($fileInfo) : CComponentEngine::MakePathFromTemplate($fileUrlTemplate, array('owner_id' => $ID, 'field_name' => $FIELD_NAME, 'file_id' => $fileInfo['ID']));
}
$sname = $textonly ? $fileUrl : '<a href="' . htmlspecialcharsbx($fileUrl) . '" target="_blank">' . htmlspecialcharsbx($arList[$KEY][$FIELD_VALUE_ID]['FILE_NAME']) . '</a>';
$arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
} else {
if ($KEY == 'crm') {
foreach ($FIELD_VALUE_ID as $CID) {
$link = '';
$title = '';
$prefix = '';
if ($FIELD_VALUE_NAME == 'LEAD') {
$link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $CID));
$title = $arList[$KEY]['LEAD'][$CID]['TITLE'];
$prefix = 'L';
} elseif ($FIELD_VALUE_NAME == 'CONTACT') {
$link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $CID));
$title = CCrmContact::GetFullName($arList[$KEY]['CONTACT'][$CID], true);
$prefix = 'C';
} elseif ($FIELD_VALUE_NAME == 'COMPANY') {
$link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $CID));
$title = $arList[$KEY]['COMPANY'][$CID]['TITLE'];
$prefix = 'CO';
} elseif ($FIELD_VALUE_NAME == 'DEAL') {
$link = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $CID));
$title = $arList[$KEY]['DEAL'][$CID]['TITLE'];
$prefix = 'D';
}
$sname = htmlspecialcharsbx($title);
if (!$textonly) {
$tooltip = '<script type="text/javascript">BX.tooltip(' . $CID . ', "balloon_' . $ID . '_' . $FIELD_NAME . '_' . $FIELD_VALUE_NAME . '_' . $CID . '", "/bitrix/components/bitrix/crm.' . strtolower($FIELD_VALUE_NAME) . '.show/card.ajax.php", "crm_balloon' . ($FIELD_VALUE_NAME == 'LEAD' || $FIELD_VALUE_NAME == 'DEAL' || $FIELD_VALUE_NAME == 'QUOTE' ? '_no_photo' : '_' . strtolower($FIELD_VALUE_NAME)) . '", true);</script>';
$sname = '<a href="' . $link . '" target="_blank" id="balloon_' . $ID . '_' . $FIELD_NAME . '_' . $FIELD_VALUE_NAME . '_' . $CID . '">' . $sname . '</a>' . $tooltip;
} else {
$sname = "[{$prefix}]{$sname}";
}
$arReplaceValue[$ID][$FIELD_NAME] .= (!empty($arReplaceValue[$ID][$FIELD_NAME]) ? $delimiter : '') . $sname;
}
}
}
}
}
}
}
}
}
}
}
}
示例12: getIBlocks
function getIBlocks($arFilter = array(), $baseURL = null)
{
$retval = array();
$res = CIBlock::GetList(array(), array_merge(array('SITE_ID' => SITE_ID, 'ACTIVE' => 'Y', 'CNT_ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'), $arFilter), true);
while ($iblock = $res->Fetch()) {
if ($file = CFile::GetByID($iblock['PICTURE'])->GetNext()) {
$iblock['IMAGE_SRC'] = CFile::GetFileSRC($file);
}
$retval[] = $iblock;
}
return $retval;
}
示例13: GetFilesData
public static function GetFilesData($arInput, $arFrom = null)
{
$arFiles = array();
if (is_array($arInput) && count($arInput) > 0) {
$dbFiles = CFile::GetList(array(), array("@ID" => implode(",", array_keys($arInput))));
while ($arFile = $dbFiles->GetNext()) {
$fileSrc = intval($arInput[$arFile['ID']]);
$fileUrl = CFile::GetFileSRC($arFile);
$fileLink = $fileUrl;
if (is_array($arFrom)) {
$fileLink = '/bitrix/tools/ajax_meeting.php?fileId=' . $arFile['ID'];
if ($arFrom['REPORT']) {
$fileLink .= '&reportId=' . intval($arFrom['REPORT']);
} elseif ($arFrom['ITEM']) {
$fileLink .= '&itemId=' . intval($arFrom['ITEM']);
} elseif ($arFrom['MEETING']) {
$fileLink .= '&meetingId=' . intval($arFrom['MEETING']);
}
}
$arFiles[] = array('ID' => $arFile['ID'], 'ORIGINAL_NAME' => $arFile['ORIGINAL_NAME'], 'FILE_SIZE' => $arFile['FILE_SIZE'], 'DOWNLOAD_URL' => CHTTP::URN2URI($fileLink), 'FILE_SIZE_FORMATTED' => CFile::FormatSize($arFile['FILE_SIZE']), 'FILE_SRC' => $fileSrc);
}
}
return $arFiles;
}
示例14: array_keys
$res = array_keys($arResult["MESSAGE_LIST"]);
$arFilter[">MESSAGE_ID"] = intVal($res[0]) - 1;
$arFilter["<MESSAGE_ID"] = intVal($res[count($res) - 1]) + 1;
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), $arFilter);
$bNeedLoop = $bBreakLoop = false;
if ($db_files && ($res = $db_files->Fetch())) {
$bNeedLoop = true;
} elseif ($bNeedFirstMessage) {
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("MESSAGE_ID" => $arResult["MESSAGE_FIRST"]["ID"]));
if ($db_files && ($res = $db_files->Fetch())) {
$bNeedLoop = $bBreakLoop = true;
}
}
while ($bNeedLoop) {
do {
$res["SRC"] = CFile::GetFileSRC($res["FILE_NAME"]);
if ($arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"]) {
// attach for custom
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["ATTACH_FILE"] = $arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0, $arParams["IMAGE_SIZE"], $arParams["IMAGE_SIZE"], true, "border=0", false);
}
if ($arResult["MESSAGE_FIRST"]["ID"] == $res["MESSAGE_ID"]) {
$arResult["MESSAGE_FIRST"]["FILES"][$res["FILE_ID"]] = $res;
if (!$bNeedFirstMessage) {
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
}
} else {
$arResult["MESSAGE_LIST"][$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
}
$arResult["FILES"][$res["FILE_ID"]] = $res;
} while ($res = $db_files->Fetch());
示例15: getAppFiles
/**
* Return files of the application
* @param $appCode - application code
* @return array
*/
public static function getAppFiles($appCode)
{
$result = AppTable::getById($appCode);
$appData = $result->fetchAll();
$files = array();
if (count($appData) > 0) {
//TODO fix, use module_id in the filter
$result = \CFile::GetList(array("ID" => "desc"), array("@ID" => implode(",", $appData[0]["FILES"])));
while ($file = $result->Fetch()) {
$image = \CFile::ResizeImageGet($file["ID"], array("width" => self::PREVIEW_IMAGE_SIZE, "height" => self::PREVIEW_IMAGE_SIZE), BX_RESIZE_IMAGE_EXACT, false, false, true);
$files["file_" . $file["ID"]] = array("id" => $file["ID"], "src" => \CFile::GetFileSRC($file), "preview" => $image["src"]);
}
}
return $files;
}