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


PHP CIBlockElement::GetByID方法代码示例

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


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

示例1: getJobName

 public static function getJobName($id)
 {
     if (empty($id)) {
         return false;
     }
     $result = false;
     $obCache = new CPHPCache();
     $dir = '/companies/names';
     if ($obCache->InitCache(9999999999, md5($id), $dir)) {
         $result = $obCache->GetVars();
     } elseif ($obCache->StartDataCache() && \Bitrix\Main\Loader::includeModule('iblock')) {
         if ($result = CIBlockElement::GetByID($id)->Fetch()) {
             if (defined('BX_COMP_MANAGED_CACHE')) {
                 $GLOBALS['CACHE_MANAGER']->StartTagCache($dir);
                 $GLOBALS['CACHE_MANAGER']->RegisterTag('iblock_id_' . $result['IBLOCK_ID']);
             }
             $result = $result['NAME'];
             if (defined('BX_COMP_MANAGED_CACHE')) {
                 $GLOBALS['CACHE_MANAGER']->EndTagCache();
             }
         }
         $obCache->EndDataCache($result);
     }
     return $result;
 }
开发者ID:Tvaruga,项目名称:ae,代码行数:25,代码来源:CInc.php

示例2: getCradoBaners

 /**
  * ’эндлер, отслеживающий изменени¤ в инфоблоках
  * @param $arFields
  * @return bool
  */
 static function getCradoBaners()
 {
     //$arResult = array();
     CModule::IncludeModule('iblock');
     global $DB;
     $result = $DB->Query('SELECT * FROM b_cradobaners');
     $arResult = array();
     $i = 0;
     while ($res = $result->fetch()) {
         $arResult[$i]['ID'] = $res['ID'];
         $arResult[$i]['COUNT_CLICK'] = $res['UF_COUNTCLICK'];
         $arResult[$i]['COUNT_VIEW'] = $res['UF_COUNTVIEW'];
         $arResult[$i]['DATE_LAST_CLICK'] = $res['UF_DATECLICK'];
         $obElement = CIBlockElement::GetByID($res['UF_IDBANERS']);
         if ($arEl = $obElement->GetNext()) {
             //$arResult[$i]['BANNER'] = $arEl;
             $arResult[$i]['BANNER']['ID'] = $arEl['ID'];
             $arResult[$i]['BANNER']['NAME'] = $arEl['NAME'];
             //Баннер в категории
             if ($arEl['PREVIEW_PICTURE'] != '') {
                 $arResult[$i]['BANNER']['BANNER_CATEGORY'] = CFile::ResizeImageGet($arEl['PREVIEW_PICTURE'], array('width' => 140, 'height' => 95), BX_RESIZE_IMAGE_PROPORTIONAL, true);
             }
             if ($arEl['DETAIL_PICTURE'] != '') {
                 $arResult[$i]['BANNER']['BANNER_ELEMENT'] = CFile::ResizeImageGet($arEl['DETAIL_PICTURE'], array('width' => 82, 'height' => 140), BX_RESIZE_IMAGE_PROPORTIONAL, true);
             }
         }
         $i++;
     }
     return $arResult;
 }
开发者ID:CheBurashka334,项目名称:crado,代码行数:35,代码来源:cCradoBaners.php

示例3: getByID

 /**
  * @param int $id ID элемента
  * @param int $type тип возвращаемого результата
  * @return array|mixed элемент
  */
 public static function getByID($id, $type = asst::FETCH)
 {
     $result = array();
     if (self::getCache('element', $id, $type)) {
         return self::getCache('element', $id, $type);
     }
     if (CModule::IncludeModule('iblock')) {
         $rsResult = CIBlockElement::GetByID($id);
         switch ($type) {
             case self::FETCH:
                 while ($ob = $rsResult->Fetch()) {
                     $result = $ob;
                 }
                 break;
             case self::NEXT:
                 while ($ob = $rsResult->GetNext()) {
                     $result = $ob;
                 }
                 break;
             case self::NEXT_ELEMENT:
                 while ($ob = $rsResult->GetNextElement()) {
                     $fields = $ob->GetFields();
                     $fields['DISPLAY_PROPERTIES'] = $ob->GetProperties();
                     $result = $fields;
                 }
                 break;
         }
         $put['element'][$id][$type] = $result;
         self::writeCache($put);
     }
     return $result;
 }
开发者ID:safindr,项目名称:snippets,代码行数:37,代码来源:asst.php

示例4: getSefviceMediaspect

 public static function getSefviceMediaspect($service_id, $section_id = false)
 {
     $result = false;
     if (!$section_id) {
         $res = CIBlockElement::GetByID($service_id);
         if ($element = $res->GetNext()) {
             $section_id = $element["IBLOCK_SECTION_ID"];
         }
     }
     if ($section_id) {
         $section = DrclinicsHelper::getMediaspects($section_id);
         $section = end($section);
         if ($section) {
             $result = $section;
         } else {
             $nav = CIBlockSection::GetNavChain(false, $section_id, array("ID", "CODE", "SECTION_PAGE_URL", "DEPTH_LEVEL"));
             while (($arSectionPath = $nav->GetNext()) && $arSectionPath["DEPTH_LEVEL"] != 2) {
             }
             if ($arSectionPath) {
                 $result = $arSectionPath;
             }
         }
     }
     return $result;
 }
开发者ID:romlg,项目名称:bitrixcode,代码行数:25,代码来源:DrclinicsServicesHelper.php

示例5: getFieldHtml

 protected function getFieldHtml($arProperty)
 {
     $rsElement = CIBlockElement::GetByID(intval($_REQUEST['ID']));
     $arResult['ELEMENT'] = $rsElement->Fetch();
     $rsUsers = \CUser::GetList($by = 'id', $order = 'asc', array('ID' => $arResult['ELEMENT']['MODIFIED_BY'] . ' | ' . $arResult['ELEMENT']['CREATED_BY']), array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME')));
     while ($arUser = $rsUsers->Fetch()) {
         $arResult['USERS'][$arUser['ID']] = $arUser;
     }
     include_once __DIR__ . '/templates/' . basename(__FILE__);
 }
开发者ID:ASDAFF,项目名称:nik.elementary,代码行数:10,代码来源:whocreate.php

示例6: genListHTML

 public function genListHTML(&$row, $data)
 {
     $elementId = $this->getValue();
     if ($elementId) {
         $dbRes = \CIBlockElement::GetByID($elementId);
         $arRes = $dbRes->GetNext();
         $strElement = '<a href="/bitrix/admin/iblock_element_edit.php?IBLOCK_ID=' . $arRes['IBLOCK_ID'] . '&type=' . $arRes['IBLOCK_TYPE_ID'] . '&ID=' . $elementId . '&lang=ru">[' . $elementId . '] ' . $arRes['NAME'] . '</a>';
     } else {
         $strElement = '';
     }
     $row->AddViewField($this->getCode(), $strElement);
 }
开发者ID:Reprezo,项目名称:digitalwand.admin_helper,代码行数:12,代码来源:IblockElementWidget.php

示例7: getStructure

function getStructure($id, $section=false) {
  $id = (int)$id;
  if (!$id) { return false; }
  if (!$section) {
    $res = CIBlockElement::GetByID($id);
    if ( $ar = $res->GetNext() ){
      $id = $ar['IBLOCK_SECTION_ID'];
    } else { return false; }
  }
  $res = CIBlockSection::GetNavChain(false, $id);
  $arStructure = array();
  while($ar = $res->GetNext()){
    $arStructure[] = $ar;
  }
  return $arStructure;
}
开发者ID:ASDAFF,项目名称:bitrix-2,代码行数:16,代码来源:getStructure.php

示例8: Copy

 /**
  * Функция копирования
  * @param $From - откуда $To - куда, $ID
  * @return bool
  */
 static function Copy($From, $To, $ID)
 {
     $result = array();
     foreach ($ID as $key => $value) {
         $res = CIBlockElement::GetByID($value);
         while ($ob = $res->GetNextElement()) {
             $arFields = $ob->GetFields();
             $arProps = $ob->GetProperties();
         }
         foreach ($arProps as $key => $value) {
             $arProp[$key] = $value["VALUE"];
         }
         $el = new CIBlockElement();
         $arLoadProductArray = array("NAME" => str_replace("&nbsp;", " ", htmlspecialchars_decode($arFields["NAME"])), "IBLOCK_ID" => $To, "ACTIVE" => $arFields["ACTIVE"], "DATE_ACTIVE_FROM" => $arFields["DATE_ACTIVE_FROM"], "DATE_ACTIVE_TO" => $arFields["DATE_ACTIVE_TO"], "SORT" => $arFields["SORT"], "PREVIEW_PICTURE" => CFile::MakeFileArray($arFields["PREVIEW_PICTURE"]), "PREVIEW_TEXT" => str_replace("&nbsp;", " ", htmlspecialchars_decode($arFields["PREVIEW_TEXT"])), "PREVIEW_TEXT_TYPE" => $arFields["PREVIEW_TEXT_TYPE"], "DETAIL_PICTURE" => CFile::MakeFileArray($arFields["DETAIL_PICTURE"]), "DETAIL_TEXT" => str_replace("&nbsp;", " ", htmlspecialchars_decode($arFields["DETAIL_TEXT"])), "DETAIL_TEXT_TYPE" => $arFields["DETAIL_TEXT_TYPE"], "SEARCHABLE_CONTENT" => $arFields["SEARCHABLE_CONTENT"], "DATE_CREATE" => $arFields["DATE_CREATE"], "CREATED_BY" => $arFields["CREATED_BY"], "CREATED_USER_NAME" => $arFields["CREATED_USER_NAME"], "TIMESTAMP_X" => $arFields["TIMESTAMP_X"], "MODIFIED_BY" => $arFields["MODIFIED_BY"], "USER_NAME" => $arFields["USER_NAME"], "LANG_DIR" => $arFields["LANG_DIR"], "LIST_PAGE_URL" => $arFields["LIST_PAGE_URL"], "DETAIL_PAGE_URL" => $arFields["DETAIL_PAGE_URL"], "SHOW_COUNTER" => $arFields["SHOW_COUNTER"], "SHOW_COUNTER_START" => $arFields["SHOW_COUNTER_START"], "WF_COMMENTS" => $arFields["WF_COMMENTS"], "WF_STATUS_ID" => $arFields["WF_STATUS_ID"], "LOCK_STATUS" => $arFields["LOCK_STATUS"], "TAGS" => $arFields["TAGS"], "PROPERTY_VALUES" => $arProp);
         if ($PRODUCT_ID = $el->Add($arLoadProductArray)) {
             $result[] = "Yes";
         }
     }
     return $result;
 }
开发者ID:ASDAFF,项目名称:Module-redun,代码行数:25,代码来源:cMainredun.php

示例9: array

<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (CModule::IncludeModule("catalog")) {
    $ajaxResult = array();
    if (IntVal($_REQUEST["PRODUCT_ID"]) > 0) {
        $itemId = Add2BasketByProductID(IntVal($_REQUEST["PRODUCT_ID"]));
        if ($itemId !== false) {
            $arInfo = CIBlockElement::GetByID(IntVal($_REQUEST["PRODUCT_ID"]))->GetNext();
            $strImageStorePath = COption::GetOptionString("main", "upload_dir", "upload");
            $imageId = empty($arInfo["DETAIL_PICTURE"]) ? $arInfo["PREVIEW_PICTURE"] : $arInfo["DETAIL_PICTURE"];
            if (!empty($imageId)) {
                $sPath = CFile::GetByID($imageId)->GetNext();
                $sPath = "/" . $strImageStorePath . "/" . $sPath["SUBDIR"] . "/" . $sPath["FILE_NAME"];
            } else {
                $sPath = "";
            }
            $ajaxResult["MSG"]["NAME"] = $arInfo["NAME"];
            $ajaxResult["MSG"]["URL"] = $arInfo["DETAIL_PAGE_URL"];
            $ajaxResult["MSG"]["IMG"] = $sPath;
        } else {
            $ajaxResult["MSG"] = "Ошибка добавления товара в корзину";
        }
        echo json_encode($ajaxResult);
    }
}
开发者ID:lenchv,项目名称:meblya,代码行数:28,代码来源:ajax.php

示例10: ShowError

     $arFilter["ID"] = -1;
 }
 //check for access to current element
 if ($arParams["ID"] > 0) {
     if (empty($arFilter["ID"])) {
         $arFilter["ID"] = $arParams["ID"];
     }
     // get current iblock element
     //echo "<pre>"; print_r($arFilter); echo "</pre>";
     $rsIBlockElements = CIBlockElement::GetList(array("SORT" => "ASC"), $arFilter);
     if ($arElement = $rsIBlockElements->Fetch()) {
         $bAllowAccess = true;
         if ($bWorkflowIncluded) {
             $LAST_ID = CIBlockElement::WF_GetLast($arElement['ID']);
             if ($LAST_ID != $arElement["ID"]) {
                 $rsElement = CIBlockElement::GetByID($LAST_ID);
                 $arElement = $rsElement->Fetch();
             }
             if (!in_array($arElement["WF_STATUS_ID"], $arParams["STATUS"])) {
                 echo ShowError(GetMessage("IBLOCK_ADD_ACCESS_DENIED"));
                 $bAllowAccess = false;
             }
         } else {
             if (in_array("INACTIVE", $arParams["STATUS"]) === true && $arElement["ACTIVE"] !== "N") {
                 echo ShowError(GetMessage("IBLOCK_ADD_ACCESS_DENIED"));
                 $bAllowAccess = false;
             }
         }
     } else {
         echo ShowError(GetMessage("IBLOCK_ADD_ELEMENT_NOT_FOUND"));
         $bAllowAccess = false;
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:component.php

示例11: array

}
$arUsers = array();
uasort($arDocumentStates, "__bp_sort_in_template_by_modified");
?>
<div class="bizproc-page-document">
<?php 
if (!isset($arParams["TASK_ID"])) {
    ?>
<form action="<?php 
    echo POST_FORM_ACTION_URI;
    ?>
" method="POST" class="bizproc-form" name="start_workflow_form1" id="start_workflow_form1">
	<?php 
    echo bitrix_sessid_post();
    $docId = $arParams['DOCUMENT_ID'][2];
    $dbRes = CIBlockElement::GetByID($docId);
    if ($dbRes) {
        if ($doc = $dbRes->Fetch()) {
            if (isset($doc['WF_PARENT_ELEMENT_ID'])) {
                $docId = $doc['WF_PARENT_ELEMENT_ID'];
            }
        }
    }
    $back_url = CComponentEngine::MakePathFromTemplate($arParams["WEBDAV_BIZPROC_VIEW_URL"], array("ELEMENT_ID" => $docId));
    unset($doc);
    ?>
	<input type="hidden" name="back_url" value="<?php 
    echo htmlspecialcharsbx($back_url);
    ?>
" />
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:template.php

示例12: array_unique

if ($arResult["REQUEST"]["~TAGS"]) {
    $res = array_unique(explode(",", $arResult["REQUEST"]["~TAGS"]));
    $url = array();
    foreach ($res as $key => $tags) {
        $tags = trim($tags);
        if (!empty($tags)) {
            $url_without = $res;
            unset($url_without[$key]);
            $url[$tags] = $tags;
            $result = array("TAG_NAME" => htmlspecialcharsex($tags), "TAG_PATH" => $APPLICATION->GetCurPageParam("tags=" . urlencode(implode(",", $url)), array("tags")), "TAG_WITHOUT" => $APPLICATION->GetCurPageParam(count($url_without) > 0 ? "tags=" . urlencode(implode(",", $url_without)) : "", array("tags")));
            $arResult["TAGS_CHAIN"][] = $result;
        }
    }
}
CModule::IncludeModule("iblock");
$arResult["ITEMS"] = array();
$arResult["SECTIONS"] = array();
$arResult["TEMP"] = array();
foreach ($arResult["SEARCH"] as $arItem) {
    if ($arItem["PARAM1"] == "catalog") {
        $arResult["ITEMS"][] = $arItem["ITEM_ID"];
        $dbEl = CIBlockElement::GetByID($arItem["ITEM_ID"]);
        $rsEl = $dbEl->GetNext();
        $arResult["TEMP"][] = $rsEl;
        if (isset($arResult["SECTIONS"][$rsEl["IBLOCK_SECTION_ID"]])) {
            $arResult["SECTIONS"][$rsEl["IBLOCK_SECTION_ID"]]++;
        } else {
            $arResult["SECTIONS"][$rsEl["IBLOCK_SECTION_ID"]] = 1;
        }
    }
}
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:result_modifier.php

示例13: ConvertTimeStamp

		$str_ACTIVE_TO = ConvertTimeStamp(time() + intval($arIBlock["FIELDS"]["ACTIVE_TO"]["DEFAULT_VALUE"])*24*60*60 + CTimeZone::GetOffset(), "FULL");

	$str_PREVIEW_TEXT_TYPE = $arIBlock["FIELDS"]["PREVIEW_TEXT_TYPE"]["DEFAULT_VALUE"] !== "html"? "text": "html";
	$str_PREVIEW_TEXT = htmlspecialcharsbx($arIBlock["FIELDS"]["PREVIEW_TEXT"]["DEFAULT_VALUE"]);
	$str_DETAIL_TEXT_TYPE = $arIBlock["FIELDS"]["DETAIL_TEXT_TYPE"]["DEFAULT_VALUE"] !== "html"? "text": "html";
	$str_DETAIL_TEXT = htmlspecialcharsbx($arIBlock["FIELDS"]["DETAIL_TEXT"]["DEFAULT_VALUE"]);

	if ($historyId > 0)
	{
		$view = "Y";
		foreach ($arResult["DOCUMENT"]["FIELDS"] as $k => $v)
			${"str_".$k} = $v;
	}
	else
	{
		$result = CIBlockElement::GetByID($WF_ID);

		if($arElement = $result->ExtractFields("str_"))
		{
			if($str_IN_SECTIONS=="N")
			{
				$str_IBLOCK_ELEMENT_SECTION[] = 0;
			}
			else
			{
				$result = CIBlockElement::GetElementGroups($WF_ID, true, array('ID', 'IBLOCK_ELEMENT_ID'));
				while($ar = $result->Fetch())
					$str_IBLOCK_ELEMENT_SECTION[] = $ar["ID"];
			}
			$ipropTemlates = new \Bitrix\Iblock\InheritedProperty\ElementTemplates($IBLOCK_ID, $WF_ID);
		}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:iblock_element_edit.php

示例14: intval

<?php

require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule("iblock");
$id = intval($_GET["event_id"]);
$like = intval($_GET["like"]);
$UID = $USER->GetID();
$ib_id = 6;
$resObj = CIBlockElement::GetByID($id);
$item = $resObj->GetNextElement(true, false);
/*$propItems = $item->GetProperty("USERS");*/
if ($like) {
    $el = new CIBlockElement();
    $PROP = array();
    $PROP['LIKE'] = array("n0" => array("VALUE" => $id, "DESCRIPTION" => ""));
    $PROP['USER'] = array("n0" => array("VALUE" => $UID, "DESCRIPTION" => ""));
    $arLoadProductArray = array("IBLOCK_SECTION" => false, "IBLOCK_ID" => $ib_id, "PROPERTY_VALUES" => $PROP, "NAME" => "like");
    $PRODUCT_ID = id_element;
    $res = $el->Add($arLoadProductArray);
} else {
    $res = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 6, "PROPERTY_LIKE" => $id, "PROPERTY_USER" => $USER->GetID()));
    $ob = $res->GetNextElement();
    //echo "<xmp>";print_r($ob);echo "</xmp>";
    if ($ob) {
        $obs = $ob->GetFields();
        $ELEMENT_ID = $obs["ID"];
        CIBlockElement::Delete($ELEMENT_ID);
    }
}
开发者ID:dayAlone,项目名称:MyQube,代码行数:29,代码来源:like_event.php

示例15: intval

		$ID = intval(substr($ID,1));

		if($TYPE == "E")
		{
			$arRes = CIBlockElement::GetByID($ID);
			$arRes = $arRes->Fetch();
			if(!$arRes)
				continue;

			$WF_ID = $ID;
			if($bWorkFlow)
			{
				$WF_ID = CIBlockElement::WF_GetLast($ID);
				if($WF_ID!=$ID)
				{
					$rsData2 = CIBlockElement::GetByID($WF_ID);
					if($arRes = $rsData2->Fetch())
						$WF_ID = $arRes["ID"];
					else
						$WF_ID = $ID;
				}

				if($arRes["LOCK_STATUS"]=='red' && !($_REQUEST['action']=='unlock' && CWorkflow::IsAdmin()))
				{
					$lAdmin->AddUpdateError(GetMessage("IBLIST_A_UPDERR_LOCKED", array("#ID#" => $ID)), $TYPE.$ID);
					continue;
				}
			}
			elseif ($bBizproc)
			{
				if (call_user_func(array(ENTITY, "IsDocumentLocked"), $ID, "") && !($_REQUEST['action']=='unlock' && CBPDocument::IsAdmin()))
开发者ID:nycmic,项目名称:bittest,代码行数:31,代码来源:iblock_list_admin.php


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