當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HighloadBlockTable::compileEntity方法代碼示例

本文整理匯總了PHP中Bitrix\Highloadblock\HighloadBlockTable::compileEntity方法的典型用法代碼示例。如果您正苦於以下問題:PHP HighloadBlockTable::compileEntity方法的具體用法?PHP HighloadBlockTable::compileEntity怎麽用?PHP HighloadBlockTable::compileEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bitrix\Highloadblock\HighloadBlockTable的用法示例。


在下文中一共展示了HighloadBlockTable::compileEntity方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Delete

 /**
  * Delete
  * @param $entityName
  * @param $fieldName
  * @return mixed
  * @throws \Exception
  */
 public static function Delete($entityName, $fieldName)
 {
     if (empty($entityName)) {
         throw new \Exception('entityName is required');
     }
     if (empty($fieldName)) {
         throw new \Exception('fieldName is required.');
     }
     $filter = array('NAME' => $entityName);
     $hlBlockDbRes = HL\HighloadBlockTable::getList(array("filter" => $filter));
     if (!$hlBlockDbRes->getSelectedRowsCount()) {
         throw new \Exception('Not found highloadBlock with entityName = ' . $entityName);
     }
     $hlBlockRow = $hlBlockDbRes->fetch();
     $entity = HL\HighloadBlockTable::compileEntity($hlBlockRow);
     $entityDataClass = $entity->getDataClass();
     $obList = $entityDataClass::getList(array("select" => array("ID")));
     if ($obList->getSelectedRowsCount() > 0) {
         throw new \Exception('Unable to remove a highloadBlock[ ' . $entityName . ' ], because it has elements');
     }
     $userFieldEntity = self::_getEntityId($entityName);
     $typeEntityDbRes = \CUserTypeEntity::GetList(array(), array("ENTITY_ID" => $userFieldEntity, "FIELD_NAME" => $fieldName));
     if ($typeEntityDbRes->SelectedRowsCount() > 0) {
         $hlBlockFieldData = $typeEntityDbRes->Fetch();
         $userType = new \CUserTypeEntity();
         if (!$userType->Delete($hlBlockFieldData['ID'])) {
             throw new \Exception('Not delete Hlblock field');
         }
         return $hlBlockFieldData['ID'];
     }
 }
開發者ID:cjp2600,項目名稱:bim-core,代碼行數:38,代碼來源:HighloadblockFieldIntegrate.php

示例2: getPropDirectory

function getPropDirectory(&$property)
{
    if (empty($property)) {
        return false;
    }
    if (!is_array($property)) {
        return false;
    }
    if (!isset($property['USER_TYPE_SETTINGS']['TABLE_NAME']) || empty($property['USER_TYPE_SETTINGS']['TABLE_NAME'])) {
        return false;
    }
    $highLoadInclude = \Bitrix\Main\Loader::includeModule('highloadblock');
    $highBlock = \Bitrix\Highloadblock\HighloadBlockTable::getList(array("filter" => array('TABLE_NAME' => $property['USER_TYPE_SETTINGS']['TABLE_NAME'])))->fetch();
    if (!isset($highBlock['ID'])) {
        return false;
    }
    $entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($highBlock);
    $entityDataClass = $entity->getDataClass();
    $entityList = $entityDataClass::getList();
    while ($arEntityItem = $entityList->Fetch()) {
        $val =& $property["VALUES"][$arEntityItem["UF_XML_ID"]];
        //foreach($property["VALUES"] as &$val){
        if (!empty($arEntityItem["UF_FILE"])) {
            $property["PICTURE_INCLUDED"] = true;
            $arEntityItem["~UF_FILE"] = $arEntityItem["UF_FILE"];
            $arEntityItem["PICTURE"] = CFile::GetPath($arEntityItem["~UF_FILE"]);
        }
        if (!empty($arEntityItem)) {
            $val = array_merge($val, $arEntityItem);
        }
        //}
        //echo'<pre>';print_r($arEntityItem);echo'</pre>';
    }
    return true;
}
開發者ID:sharapudinov,項目名稱:lovestore.top,代碼行數:35,代碼來源:functions.php

示例3:

 function __construct($hlblockid)
 {
     $this->hlBlockID = $hlblockid;
     $hlblock = HL\HighloadBlockTable::getById($hlblockid)->fetch();
     $entity = HL\HighloadBlockTable::compileEntity($hlblock);
     $this->hlHandler = $entity->getDataClass();
 }
開發者ID:akniyev,項目名稱:itprom_dobrohost,代碼行數:7,代碼來源:highloadblocks.php

示例4: connectToBlock

function connectToBlock($blockId)
{
    $hlblock_requests = HL\HighloadBlockTable::getById($blockId)->fetch();
    //requests
    $entity_requests = HL\HighloadBlockTable::compileEntity($hlblock_requests);
    $entity_requests_data_class = $entity_requests->getDataClass();
    return $entity_requests_data_class;
}
開發者ID:spas-viktor,項目名稱:books,代碼行數:8,代碼來源:block_funcs.php

示例5: __construct

 public function __construct($name, $id = false)
 {
     // получаем id hlblock по его имени
     $objBlock = HL\HighloadBlockTable::getList(array("filter" => array("NAME" => $name)));
     $blockEl = $objBlock->Fetch();
     $this->hlblock = $blockEl["ID"];
     $this->entity = HL\HighloadBlockTable::compileEntity($blockEl);
     $this->id = $id;
     $this->arCache = array("path" => self::CACHE_PATH . $this->id . '/', "cachePeriod" => self::CACHE_PERIOD);
     return $this;
 }
開發者ID:aak74,項目名稱:hlblock,代碼行數:11,代碼來源:CHLReference.php

示例6: getUserType

/**
 * Check last user type in logs
 * @param $userID
 *
 * @return string
 */
function getUserType($userID)
{
    global $USER;
    $hbKPI = HL\HighloadBlockTable::getById(HLBLOCK_KPIAMPLIFIER)->fetch();
    $entityKPI = HL\HighloadBlockTable::compileEntity($hbKPI);
    $entity_data_class = $entityKPI->getDataClass();
    $arUserType2R = array("38" => "1", "39" => "2", "40" => "3", "41" => "4", "42" => "5", "44" => "5");
    $rsDataHLAll = $entity_data_class::getList(array("select" => array("*"), "order" => array("ID" => "DESC"), "filter" => array("UF_AMPLIFIER" => $USER->GetID(), "UF_USER" => IntVal($userID))));
    if ($ar_fieldsGoodAll = $rsDataHLAll->Fetch()) {
        return $arUserType2R[$ar_fieldsGoodAll['UF_TYPE_2']];
    } else {
        return '2';
    }
}
開發者ID:dayAlone,項目名稱:MyQube,代碼行數:20,代碼來源:app.php

示例7: getEntity

 /**
  * @param $hblockId
  * @return \Bitrix\Main\Entity\Base
  * @throws \Exception
  */
 protected static function getEntity($hblockId)
 {
     $hblockId = intval($hblockId);
     if (self::$hblockEntities[$hblockId]) {
         return self::$hblockEntities[$hblockId];
     }
     $hlData = HighloadBlockTable::getById($hblockId)->fetch();
     if (!$hlData) {
         throw new \Exception("Hblock {$hblockId} not found");
     }
     // описание полей hl блока
     $obUserField = new \CUserTypeManager();
     self::$hblockEntityFields[$hblockId] = $obUserField->GetUserFields('HLBLOCK_' . $hlData['ID'], 0, LANGUAGE_ID);
     return self::$hblockEntities[$hblockId] = HighloadBlockTable::compileEntity($hlData);
 }
開發者ID:ASDAFF,項目名稱:Bitrix,代碼行數:20,代碼來源:HblockObject.php

示例8: changeUserStatus

function changeUserStatus($ID, $PARENT, $CURRENT, $NEW, $text)
{
    CModule::IncludeModule("iblock");
    CModule::IncludeModule("highloadblock");
    global $APPLICATION;
    $fields = getValuesList('UF_STATUS', 'USER', 'ID');
    $flipFields = array_flip($fields);
    $types = array(getValuesList('UF_TYPE', 'HLBLOCK_2', 'ID'), getValuesList('UF_TYPE_2', 'HLBLOCK_2', 'ID'));
    $raw = new CUser();
    $raw->Update($ID, array('UF_INVITE_STATUS' => 1, 'UF_STATUS' => $fields[$NEW]));
    $hbKPI = HL\HighloadBlockTable::getById(2)->fetch();
    $entityKPI = HL\HighloadBlockTable::compileEntity($hbKPI);
    $logKPI = $entityKPI->getDataClass();
    $logKPI::add(array('UF_USER' => intval($ID), 'UF_AMPLIFIER' => intval($PARENT), 'UF_EVENT' => 0, 'UF_DATE_TIME' => date("Y-m-d H:i:s"), 'UF_ACTION_CODE' => 103, 'UF_ACTION_TEXT' => "change_status", 'UF_TYPE' => $CURRENT ? $types[0][$flipFields[$CURRENT]] : 1, 'UF_TYPE_2' => $types[1][$NEW]));
    $hbLOG = HL\HighloadBlockTable::getById(4)->fetch();
    $entityLOG = HL\HighloadBlockTable::compileEntity($hbLOG);
    $logLOG = $entityLOG->getDataClass();
    $res = $logLOG::add(array('UF_USER' => intval($ID), 'UF_AMPLIFIER' => intval($PARENT), 'UF_EVENT' => 0, 'UF_DATE_TIME' => date("d.m.Y H:i:s", time()), "UF_ACTION_CODE" => 104, "UF_ACTION_TEXT" => $text, "UF_TYPE" => $CURRENT ? $flipFields[$CURRENT] : 1, "UF_TYPE_2" => $NEW));
}
開發者ID:dayAlone,項目名稱:MyQube,代碼行數:19,代碼來源:helpers.php

示例9: getFiles

 /**
  * {@inheritdoc}
  */
 public function getFiles($insertId, array $attachFields)
 {
     $filesList = array();
     $builderData = $this->builder->getBuilderData();
     $enity = HL\HighloadBlockTable::compileEntity($builderData['DATA']);
     $enity = $enity->getDataClass();
     $resultDb = $enity::getList(array('filter' => array('ID' => $insertId)));
     if (!($fields = $resultDb->fetch())) {
         return $filesList;
     }
     foreach ($fields as $key => $value) {
         if (!in_array($key, $attachFields)) {
             continue;
         }
         if (is_numeric($value)) {
             $filesList[] = $value;
         } elseif (is_array($value)) {
             $filesList = array_merge_recursive($filesList, $value);
         }
     }
     return $filesList;
 }
開發者ID:ASDAFF,項目名稱:citfact.form,代碼行數:25,代碼來源:UserFieldAttach.php

示例10: compile

 /**
  * Возвращает класс для указанной сущности
  * @param string $entity
  * @return string
  */
 public static function compile($entity)
 {
     $entity = trim($entity);
     if ($entity === '') {
         return null;
     }
     if (empty(self::$_compiled[$entity]) || !array_key_exists($entity, self::$_compiled[$entity])) {
         if (class_exists($entity)) {
             self::$_compiled[$entity] = $entity;
         } else {
             //проверяем существует ли сущность
             $hlblock = self::getEntityByName($entity);
             if (!empty($hlblock['ID'])) {
                 $entityObj = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
                 self::$_compiled[$entity] = $entityObj->getDataClass();
             } else {
                 self::$_compiled[$entity] = null;
             }
         }
     }
     return self::$_compiled[$entity];
 }
開發者ID:marvin255,項目名稱:bxar,代碼行數:27,代碼來源:HlEntity.php

示例11: GetCityList

    public static function GetCityList() {

        $arResult = array();

        $rsData = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter'=>array('NAME'=>CITY_LIST_HLB)));
        if ( !($arData = $rsData->fetch()) ){
            echo 'Инфоблок не найден';
        } else {
            $Entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($arData);

            $Query = new \Bitrix\Main\Entity\Query($Entity);
            $Query->setSelect(array('*'));

            $result = $Query->exec();
            $result = new CDBResult($result);

            while ($row = $result->Fetch()){
                $arResult[$row['UF_CITY_CODE']] = $row['UF_CITY_NAME'];
            }

        }
        return $arResult;

    }
開發者ID:AlexPrya,項目名稱:iShop,代碼行數:24,代碼來源:CISCity.php

示例12: array

);
if ($dbHblock->Fetch())
	return;

$data = array(
	'NAME' => 'ColorReference',
	'TABLE_NAME' => 'eshop_color_reference',
);

$result = HL\HighloadBlockTable::add($data);
$ID = $result->getId();

$_SESSION["ESHOP_HBLOCK_ID"] = $ID;

$hldata = HL\HighloadBlockTable::getById($ID)->fetch();
$hlentity = HL\HighloadBlockTable::compileEntity($hldata);

//adding user fields
$arUserFields = array (
	array (
		'ENTITY_ID' => 'HLBLOCK_'.$ID,
		'FIELD_NAME' => 'UF_NAME',
		'USER_TYPE_ID' => 'string',
		'XML_ID' => 'UF_COLOR_NAME',
		'SORT' => '100',
		'MULTIPLE' => 'N',
		'MANDATORY' => 'N',
		'SHOW_FILTER' => 'N',
		'SHOW_IN_LIST' => 'Y',
		'EDIT_IN_LIST' => 'Y',
		'IS_SEARCHABLE' => 'Y',
開發者ID:ASDAFF,項目名稱:entask.ru,代碼行數:31,代碼來源:references.php

示例13: getListByTableNameHighload

 public static function getListByTableNameHighload($table_name, $arSelect)
 {
     global $DB;
     $hl_result = $DB->Query("SELECT * FROM b_hlblock_entity WHERE TABLE_NAME='{$table_name}'")->getNext();
     if (intval($hl_result['ID'])) {
         $hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hl_result['ID'])->fetch();
         $entity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock);
         $entity_data_class = $entity->getDataClass();
         return $entity_data_class::getList(array('select' => $arSelect));
     }
     return false;
 }
開發者ID:firestorm23,項目名稱:bxhelper,代碼行數:12,代碼來源:BXHelper.php

示例14: getEntityFieldsByFilter

	/**
	 * Returns entity data.
	 *
	 * @param string $tableName				HL table name.
	 * @param array $listDescr				Params for getList.
	 * @return array
	 */
	private static function getEntityFieldsByFilter($tableName, $listDescr = array())
	{
		$arResult = array();
		$tableName = (string)$tableName;
		if (!is_array($listDescr))
			$listDescr = array();
		if (!empty($tableName))
		{
			$hlblock = HL\HighloadBlockTable::getList(
				array(
					'select' => array('TABLE_NAME', 'NAME', 'ID'),
					'filter' => array('=TABLE_NAME' => $tableName)
				)
			)->fetch();
			if (isset($hlblock['ID']))
			{
				$entity = HL\HighloadBlockTable::compileEntity($hlblock);
				$entityDataClass = $entity->getDataClass();
				if (!isset(self::$directoryMap[$tableName]))
				{
					self::$directoryMap[$tableName] = $entityDataClass::getEntity()->getFields();
				}

				if (!isset(self::$directoryMap[$tableName]['UF_XML_ID']))
				{
					return $arResult;
				}

				$nameExist = isset(self::$directoryMap[$tableName]['UF_NAME']);
				if (!$nameExist)
					$listDescr['select'] = array('UF_XML_ID', 'ID');
				$fileExists = isset(self::$directoryMap[$tableName]['UF_FILE']);
				if ($fileExists)
					$listDescr['select'][] = 'UF_FILE';

				$sortExist = isset(self::$directoryMap[$tableName]['UF_SORT']);
				$listDescr['order'] = array();
				if ($sortExist)
				{
					$listDescr['order']['UF_SORT'] = 'ASC';
					$listDescr['select'][] = 'UF_SORT';
				}
				if ($nameExist)
					$listDescr['order']['UF_NAME'] = 'ASC';
				else
					$listDescr['order']['UF_XML_ID'] = 'ASC';
				$listDescr['order']['ID'] = 'ASC';

				$rsData = $entityDataClass::getList($listDescr);
				while($arData = $rsData->fetch())
				{
					if (!$nameExist)
						$arData['UF_NAME'] = $arData['UF_XML_ID'];
					$arData['SORT'] = ($sortExist ? $arData['UF_SORT'] : $arData['ID']);
					$arResult[] = $arData;
				}
			}
		}
		return $arResult;
	}
開發者ID:ASDAFF,項目名稱:1C_Bitrix_info_site,代碼行數:67,代碼來源:prop_directory.php

示例15: getTreeProperties

	public static function getTreeProperties($skuInfo, $propertiesCodes, $defaultFields = array())
	{
		$requireFields = array(
			'ID',
			'UF_XML_ID',
			'UF_NAME',
		);

		$result = array();
		if (empty($skuInfo))
			return $result;
		if (!is_array($skuInfo))
		{
			$skuInfo = (int)$skuInfo;
			if ($skuInfo <= 0)
				return $result;
			if (self::$catalogIncluded === null)
				self::$catalogIncluded = Loader::includeModule('catalog');
			if (!self::$catalogIncluded)
				return $result;
			$skuInfo = CCatalogSKU::GetInfoByProductIBlock($skuInfo);
			if (empty($skuInfo))
				return $result;
		}
		if (empty($propertiesCodes) || !is_array($propertiesCodes))
			return $result;

		$showMode = '';

		$propertyIterator = PropertyTable::getList(array(
			'select' => array(
				'ID', 'IBLOCK_ID', 'CODE', 'NAME', 'SORT', 'LINK_IBLOCK_ID', 'PROPERTY_TYPE', 'USER_TYPE', 'USER_TYPE_SETTINGS'
			),
			'filter' => array(
				'IBLOCK_ID' => $skuInfo['IBLOCK_ID'],
				'PROPERTY_TYPE' => array(
					PropertyTable::TYPE_LIST,
					PropertyTable::TYPE_ELEMENT,
					PropertyTable::TYPE_STRING
				),
				'ACTIVE' => 'Y', 'MULTIPLE' => 'N'
			),
			'order' => array(
				'SORT' => 'ASC', 'ID' => 'ASC'
			)
		));
		while ($propInfo = $propertyIterator->fetch())
		{
			$propInfo['ID'] = (int)$propInfo['ID'];
			if ($propInfo['ID'] == $skuInfo['SKU_PROPERTY_ID'])
				continue;
			$propInfo['CODE'] = (string)$propInfo['CODE'];
			if ($propInfo['CODE'] === '')
				$propInfo['CODE'] = $propInfo['ID'];
			if (!in_array($propInfo['CODE'], $propertiesCodes))
				continue;
			$propInfo['SORT'] = (int)$propInfo['SORT'];
			$propInfo['USER_TYPE'] = (string)$propInfo['USER_TYPE'];
			if ($propInfo['PROPERTY_TYPE'] == PropertyTable::TYPE_STRING)
			{
				if ('directory' != $propInfo['USER_TYPE'])
					continue;
				$propInfo['USER_TYPE_SETTINGS'] = (string)$propInfo['USER_TYPE_SETTINGS'];
				if ($propInfo['USER_TYPE_SETTINGS'] == '')
					continue;
				$propInfo['USER_TYPE_SETTINGS'] = unserialize($propInfo['USER_TYPE_SETTINGS']);
				if (!isset($propInfo['USER_TYPE_SETTINGS']['TABLE_NAME']) || empty($propInfo['USER_TYPE_SETTINGS']['TABLE_NAME']))
					continue;
				if (self::$highLoadInclude === null)
					self::$highLoadInclude = Loader::includeModule('highloadblock');
				if (!self::$highLoadInclude)
					continue;

				$highBlock = HighloadBlockTable::getList(array(
					'filter' => array('TABLE_NAME' => $propInfo['USER_TYPE_SETTINGS']['TABLE_NAME'])
				))->fetch();
				if (!isset($highBlock['ID']))
					continue;

				$entity = HighloadBlockTable::compileEntity($highBlock);
				$entityDataClass = $entity->getDataClass();
				$fieldsList = $entityDataClass::getEntity()->getFields();
				if (empty($fieldsList))
					continue;

				$flag = true;
				foreach ($requireFields as &$fieldCode)
				{
					if (!isset($fieldsList[$fieldCode]) || empty($fieldsList[$fieldCode]))
					{
						$flag = false;
						break;
					}
				}
				unset($fieldCode);
				if (!$flag)
					continue;
				$propInfo['USER_TYPE_SETTINGS']['FIELDS_MAP'] = $fieldsList;
				$propInfo['USER_TYPE_SETTINGS']['ENTITY'] = $entity;
			}
//.........這裏部分代碼省略.........
開發者ID:ASDAFF,項目名稱:1C_Bitrix_info_site,代碼行數:101,代碼來源:comp_pricetools.php


注:本文中的Bitrix\Highloadblock\HighloadBlockTable::compileEntity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。