本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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__);
}
示例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);
}
示例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;
}
示例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(" ", " ", 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(" ", " ", htmlspecialchars_decode($arFields["PREVIEW_TEXT"])), "PREVIEW_TEXT_TYPE" => $arFields["PREVIEW_TEXT_TYPE"], "DETAIL_PICTURE" => CFile::MakeFileArray($arFields["DETAIL_PICTURE"]), "DETAIL_TEXT" => str_replace(" ", " ", 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;
}
示例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);
}
}
示例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;
示例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);
?>
" />
示例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;
}
}
}
示例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);
}
示例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);
}
}
示例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()))