本文整理匯總了PHP中Bitrix\Highloadblock\HighloadBlockTable::getById方法的典型用法代碼示例。如果您正苦於以下問題:PHP HighloadBlockTable::getById方法的具體用法?PHP HighloadBlockTable::getById怎麽用?PHP HighloadBlockTable::getById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bitrix\Highloadblock\HighloadBlockTable
的用法示例。
在下文中一共展示了HighloadBlockTable::getById方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Constructor.
*
* @param array $params
*
* @throws SkipHandlerException
*/
public function __construct($params)
{
$this->event = $params[0];
$eventParams = $this->event->getParameters();
$this->id = $eventParams['id']['ID'];
$this->fields = HighloadBlockTable::getById($this->id)->fetch();
}
示例2:
function __construct($hlblockid)
{
$this->hlBlockID = $hlblockid;
$hlblock = HL\HighloadBlockTable::getById($hlblockid)->fetch();
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
$this->hlHandler = $entity->getDataClass();
}
示例3: 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;
}
示例4: 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';
}
}
示例5: create
/**
* @inheritdoc
*/
public function create(ParameterDictionary $parameters)
{
$highLoadBlockId = (int) $parameters->get('ID');
$highLoadBlock = HL\HighloadBlockTable::getById($highLoadBlockId)->fetch();
if (empty($highLoadBlock)) {
throw new BuilderException(sprintf('Not found highloadblock with id = %d', $highLoadBlockId));
}
$highLoadBlockFields = $this->getUserFieldManager()->GetUserFields(sprintf('HLBLOCK_%d', $highLoadBlockId), 0, LANGUAGE_ID);
$this->setHighLoadBlockFields($highLoadBlockFields);
$this->setElementValue();
$this->setSectionValue();
$this->setEnumValue();
return array('DATA' => $highLoadBlock, 'FIELDS' => $this->getHighLoadBlockFields());
}
示例6: 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);
}
示例7: 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));
}
示例8: GetMessage
// admin initialization
define("ADMIN_MODULE_NAME", "highloadblock");
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
IncludeModuleLangFile(__FILE__);
IncludeModuleLangFile(__DIR__ . '/highloadblock_rows_list.php');
if (!$USER->IsAdmin()) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
if (!CModule::IncludeModule(ADMIN_MODULE_NAME)) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
use Bitrix\Highloadblock as HL;
$hlblock = null;
// get entity info
if (isset($_REQUEST['ENTITY_ID'])) {
$hlblock = HL\HighloadBlockTable::getById($_REQUEST['ENTITY_ID'])->fetch();
}
if (empty($hlblock)) {
// 404
if ($_REQUEST["mode"] == "list") {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_js.php";
} else {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
}
echo GetMessage('HLBLOCK_ADMIN_ROW_EDIT_NOT_FOUND');
if ($_REQUEST["mode"] == "list") {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin_js.php";
} else {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
}
die;
示例9: getHlRows
public static function getHlRows($userfield)
{
global $USER_FIELD_MANAGER;
$rows = array();
$hlblock_id = $userfield['SETTINGS']['HLBLOCK_ID'];
$hlfield_id = $userfield['SETTINGS']['HLFIELD_ID'];
if (!empty($hlblock_id)) {
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($hlblock_id)->fetch();
}
if (!empty($hlblock)) {
$userfield = null;
if ($hlfield_id == 0) {
$userfield = array('FIELD_NAME' => 'ID');
} else {
$userfields = $USER_FIELD_MANAGER->GetUserFields('HLBLOCK_' . $hlblock['ID'], 0, LANGUAGE_ID);
foreach ($userfields as $_userfield) {
if ($_userfield['ID'] == $hlfield_id) {
$userfield = $_userfield;
break;
}
}
}
if ($userfield) {
// validated successfully. get data
$hlDataClass = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock)->getDataClass();
$rows = $hlDataClass::getList(array('select' => array('ID', $userfield['FIELD_NAME']), 'order' => 'ID'))->fetchAll();
foreach ($rows as &$row) {
if ($userfield['FIELD_NAME'] == 'ID') {
$row['VALUE'] = $row['ID'];
} else {
$row['VALUE'] = $USER_FIELD_MANAGER->getListView($userfield, $row[$userfield['FIELD_NAME']]);
$row['VALUE'] .= ' [' . $row['ID'] . ']';
}
}
}
}
return $rows;
}
示例10: foreach
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (is_array($arResult['VALUE']) && count($arResult['VALUE']) > 0) {
if (!CModule::IncludeModule("highloadblock")) {
return;
}
global $USER_FIELD_MANAGER;
$userfields = $USER_FIELD_MANAGER->GetUserFields('HLBLOCK_' . $arParams['arUserField']['SETTINGS']['HLBLOCK_ID'], 0, LANGUAGE_ID);
foreach ($userfields as $_userfield) {
if ($_userfield['ID'] == $arParams['arUserField']['SETTINGS']['HLFIELD_ID']) {
$userfield = $_userfield;
break;
}
}
if ($userfield) {
$hlblock = \Bitrix\Highloadblock\HighloadBlockTable::getById($arParams['arUserField']['SETTINGS']['HLBLOCK_ID'])->fetch();
$hlDataClass = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hlblock)->getDataClass();
$rows = $hlDataClass::getList(array('select' => array('ID', $userfield['FIELD_NAME']), 'filter' => array('=ID' => $arResult['VALUE'])))->fetchAll();
$newValue = array();
foreach ($rows as &$row) {
if ($userfield['FIELD_NAME'] == 'ID') {
$row['VALUE'] = $row['ID'];
} else {
$newValue[] = $USER_FIELD_MANAGER->getListView($userfield, $row[$userfield['FIELD_NAME']]);
}
}
$arResult['VALUE'] = $newValue;
}
}
示例11: ShowError
foreach ($requiredModules as $requiredModule) {
if (!CModule::IncludeModule($requiredModule)) {
ShowError(GetMessage("F_NO_MODULE"));
return 0;
}
}
use Bitrix\Highloadblock as HL;
use Bitrix\Main\Entity;
global $USER_FIELD_MANAGER;
// hlblock info
$hlblock_id = $arParams['BLOCK_ID'];
if (empty($hlblock_id)) {
ShowError(GetMessage('HLBLOCK_VIEW_NO_ID'));
return 0;
}
$hlblock = HL\HighloadBlockTable::getById($hlblock_id)->fetch();
if (empty($hlblock)) {
ShowError('404');
return 0;
}
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
// row data
$main_query = new Entity\Query($entity);
$main_query->setSelect(array('*'));
$main_query->setFilter(array('=ID' => $arParams['ROW_ID']));
$result = $main_query->exec();
$result = new CDBResult($result);
$row = $result->Fetch();
$fields = $USER_FIELD_MANAGER->getUserFieldsWithReadyData('HLBLOCK_' . $hlblock['ID'], $row, LANGUAGE_ID);
if (empty($row)) {
ShowError(sprintf(GetMessage('HLBLOCK_VIEW_NO_ROW'), $arParams['ROW_ID']));
示例12: fieldsHaveBeenChanged
/**
* Determine if fields have been changed.
*
* @return bool
*/
protected function fieldsHaveBeenChanged()
{
$old = HighloadBlockTable::getById($this->id)->fetch();
$new = $this->fields + ['ID' => (string) $this->id];
return $new != $old;
}
示例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;
}
示例14: checkParams
/**
* Абстрактный метод проверки передаваемых параметров
*
* checkParams
* @param array $params
* @return mixed|void
* @throws \Exception
*/
public function checkParams($params)
{
if (!isset($params['hlblockId']) || empty($params['hlblockId'])) {
throw new BimException('В параметрах не найден hlblockId');
}
foreach ($params['hlblockId'] as $hlblockId) {
$hlBlock = HL\HighloadBlockTable::getById($hlblockId)->fetch();
if (!$hlBlock) {
throw new BimException('В системе не найден highload инфоблок с id = ' . $hlblockId);
}
$this->ownerItemDbData[] = $hlBlock;
}
}
示例15: getLikesList
function getLikesList($element, $user = false, $photos = false)
{
global $USER;
$cacheTime = 3600;
$cacheId = 'likes_' . $element;
$cachePath = '/likes';
$obCache = new CPHPCache();
if ($obCache->InitCache($cacheTime, $cacheId, $cachePath)) {
$vars = $obCache->GetVars();
return $vars['data'];
} else {
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache($cachePath);
$CACHE_MANAGER->RegisterTag($cacheId);
$requiredModules = array('highloadblock');
foreach ($requiredModules as $requiredModule) {
if (!CModule::IncludeModule($requiredModule)) {
ShowError(GetMessage("F_NO_MODULE"));
return 0;
}
}
if ($photos) {
foreach ($photos as $key => &$value) {
$value = 'photo_' . $value;
}
}
// hlblock info
$hlblock_id = IB_LIKE;
if (empty($hlblock_id)) {
ShowError(GetMessage('HLBLOCK_LIST_NO_ID'));
return 0;
}
$hlblock = HL\HighloadBlockTable::getById($hlblock_id)->fetch();
if (empty($hlblock)) {
ShowError('404');
return 0;
}
$entity = HL\HighloadBlockTable::compileEntity($hlblock);
// uf info
$fields = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields('HLBLOCK_' . $hlblock['ID'], 0, LANGUAGE_ID);
// pagination
$limit = array('nPageSize' => $arParams['ROWS_PER_PAGE'], 'iNumPage' => is_set($_GET['PAGEN_1']) ? $_GET['PAGEN_1'] : 1, 'bShowAll' => true);
// sort
$sort_id = 'ID';
$sort_type = 'DESC';
// execute query
$main_query = new Entity\Query($entity);
$main_query->setSelect(array('*'));
if ($user) {
$main_query->setFilter(array('UF_ELEMENT_ID' => $element, 'UF_USER_ID' => $user));
} else {
if ($photos) {
$main_query->setFilter(array('UF_ELEMENT_ID' => $photos));
} else {
$main_query->setFilter(array('UF_ELEMENT_ID' => $element));
}
}
$main_query->setOrder(array($sort_id => $sort_type));
//$main_query->setSelect($select)
// ->setFilter($filter)
// ->setGroup($group)
// ->setOrder($order)
// ->setOptions($options);
//$main_query->setLimit($limit['nPageSize']);
//$main_query->setOffset(($limit['iNumPage']-1) * $limit['nPageSize']);
$result = $main_query->exec();
$result = new CDBResult($result);
// build results
$rows = array();
$tableColumns = array();
$liked = false;
$userLike = false;
while ($row = $result->Fetch()) {
foreach ($row as $k => $v) {
if ($k === 'UF_USER_ID' && $USER->IsAuthorized() && $v == $USER->GetID()) {
$liked = true;
$userLike = $row;
}
if ($k == 'ID') {
$tableColumns['ID'] = true;
continue;
}
$arUserField = $fields[$k];
if ($arUserField["SHOW_IN_LIST"] != "Y") {
continue;
}
$html = call_user_func_array(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtml"), array($arUserField, array("NAME" => "FIELDS[" . $row['ID'] . "][" . $arUserField["FIELD_NAME"] . "]", "VALUE" => htmlspecialcharsbx($v))));
if ($html == '') {
$html = ' ';
}
$tableColumns[$k] = true;
$row[$k] = $html;
}
$rows[] = $row;
}
$data = array('rows' => $rows, 'fields' => $fields, 'colums' => $tableColumns, 'liked' => $liked, 'userLike' => $userLike);
$CACHE_MANAGER->EndTagCache();
if ($obCache->StartDataCache()) {
$obCache->EndDataCache(array("data" => $data));
}
//.........這裏部分代碼省略.........