本文整理汇总了PHP中CIBlock::getArrayByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::getArrayByID方法的具体用法?PHP CIBlock::getArrayByID怎么用?PHP CIBlock::getArrayByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::getArrayByID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param integer $iblockId Information block identifier.
*/
public function __construct($iblockId)
{
$this->iblockId = intval($iblockId);
$this->valid = \CIBlock::getArrayByID($this->iblockId, "PROPERTY_INDEX") === "Y";
if (Loader::includeModule("catalog")) {
$catalogInfo = \CCatalogSKU::getInfoByProductIBlock($this->iblockId);
if (!empty($catalogInfo) && is_array($catalogInfo)) {
$this->skuIblockId = $catalogInfo["IBLOCK_ID"];
$this->skuPropertyId = $catalogInfo["SKU_PROPERTY_ID"];
$this->valid = $this->valid && \CIBlock::getArrayByID($this->skuIblockId, "PROPERTY_INDEX") === "Y";
}
}
$this->dictionary = new \Bitrix\Iblock\PropertyIndex\Dictionary($this->iblockId);
$this->storage = new \Bitrix\Iblock\PropertyIndex\Storage($this->iblockId);
}
示例2: __construct
/**
* @param integer $iblockId Information block identifier.
*/
public function __construct($iblockId)
{
$this->iblockId = intval($iblockId);
$this->valid = \CIBlock::getArrayByID($this->iblockId, "PROPERTY_INDEX") === "Y";
if (self::$catalog === null) {
self::$catalog = \Bitrix\Main\Loader::includeModule("catalog");
}
if (self::$catalog) {
$catalogInfo = \CCatalogSKU::getInfoByProductIBlock($this->iblockId);
if (!empty($catalogInfo) && is_array($catalogInfo)) {
$this->skuIblockId = $catalogInfo["IBLOCK_ID"];
$this->skuPropertyId = $catalogInfo["SKU_PROPERTY_ID"];
$this->valid = $this->valid && \CIBlock::getArrayByID($this->skuIblockId, "PROPERTY_INDEX") === "Y";
}
}
$this->dictionary = new Dictionary($this->iblockId);
$this->storage = new Storage($this->iblockId);
$this->valid = $this->valid && $this->dictionary->isExists();
}
示例3: GetAllowableUserGroups
/**
* @param $documentType
* @param bool $withExtended
* @return array|bool
*/
public function GetAllowableUserGroups($documentType, $withExtended = false)
{
$documentType = trim($documentType);
if (strlen($documentType) <= 0) {
return false;
}
$iblockId = intval(substr($documentType, strlen("iblock_")));
$result = array("Author" => GetMessage("IBD_DOCUMENT_AUTHOR"));
$groupsId = array(1);
$extendedGroupsCode = array();
if (CIBlock::getArrayByID($iblockId, "RIGHTS_MODE") === "E") {
$rights = new CIBlockRights($iblockId);
foreach ($rights->getGroups() as $iblockGroupCode) {
if (preg_match("/^G(\\d+)\$/", $iblockGroupCode, $match)) {
$groupsId[] = $match[1];
} else {
$extendedGroupsCode[] = $iblockGroupCode;
}
}
} else {
foreach (CIBlock::getGroupPermissions($iblockId) as $groupId => $perm) {
if ($perm > "R") {
$groupsId[] = $groupId;
}
}
}
$groupsIterator = CGroup::getListEx(array("NAME" => "ASC"), array("ID" => $groupsId));
while ($group = $groupsIterator->fetch()) {
$result[$group["ID"]] = $group["NAME"];
}
if ($withExtended && $extendedGroupsCode) {
foreach ($extendedGroupsCode as $groupCode) {
$result['group_' . $groupCode] = CBPHelper::getExtendedGroupName($groupCode);
}
}
return $result;
}
示例4: setMessageLiveFeed
public static function setMessageLiveFeed($users, $elementId, $workflowId, $flagCompleteProcess)
{
$elementId = intval($elementId);
$elementObject = CIBlockElement::getList(array(), array('ID' => $elementId), false, false, array('ID', 'CREATED_BY', 'IBLOCK_NAME', 'NAME', 'IBLOCK_ID', 'LANG_DIR'));
$element = $elementObject->fetch();
if (!CLists::getLiveFeed($element["IBLOCK_ID"])) {
return false;
}
$params = serialize(array("ELEMENT_NAME" => $element['NAME']));
$element['NAME'] = preg_replace_callback('#^[^\\[\\]]+?\\[(\\d+)\\]#i', function ($matches) {
$userId = $matches[1];
$db = CUser::GetByID($userId);
if ($ar = $db->GetNext()) {
$ix = randString(5);
return '<a class="feed-post-user-name" id="bp_' . $userId . '_' . $ix . '" href="/company/personal/user/' . $userId . '/"
bx-post-author-id="' . $userId . '">' . CUser::FormatName(CSite::GetNameFormat(false), $ar, false, false) . '</a>
<script type="text/javascript">if (BX.tooltip) BX.tooltip(\'' . $userId . '\', "bp_' . $userId . '_' . $ix . '", "");</script>';
}
return $matches[0];
}, $element['NAME']);
$path = rtrim($element['LANG_DIR'], '/');
$urlElement = $path . COption::GetOptionString('lists', 'livefeed_url') . '?livefeed=y&list_id=' . $element["IBLOCK_ID"] . '&element_id=' . $elementId;
$createdBy = $element['CREATED_BY'];
if (!Loader::includeModule('socialnetwork') || $createdBy <= 0) {
return false;
}
$sourceId = CBPStateService::getWorkflowIntegerId($workflowId);
$logId = 0;
$userObject = CUser::getByID($createdBy);
$siteId = array();
$siteObject = CSite::getList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($site = $siteObject->fetch()) {
$siteId[] = $site['LID'];
}
if ($userObject->fetch()) {
global $DB;
$soFields = array('ENTITY_TYPE' => SONET_LISTS_NEW_POST_ENTITY, 'EVENT_ID' => 'lists_new_element', 'ENTITY_ID' => 1, '=LOG_UPDATE' => $DB->currentTimeFunction(), 'SOURCE_ID' => $sourceId, 'USER_ID' => $createdBy, 'MODULE_ID' => 'lists', 'TITLE_TEMPLATE' => $urlElement, 'TITLE' => $element['IBLOCK_NAME'], 'PARAMS' => $params, 'MESSAGE' => $workflowId, 'CALLBACK_FUNC' => false, 'SITE_ID' => $siteId, 'ENABLE_COMMENTS' => 'Y', 'RATING_TYPE_ID' => 'LISTS_NEW_ELEMENT', 'RATING_ENTITY_ID' => $sourceId, 'URL' => '#SITE_DIR#' . COption::GetOptionString('socialnetwork', 'user_page', false, SITE_ID) . 'log/');
$logObject = CSocNetLog::getList(array(), array('ENTITY_TYPE' => $soFields['ENTITY_TYPE'], 'ENTITY_ID' => $soFields['ENTITY_ID'], 'EVENT_ID' => $soFields['EVENT_ID'], 'SOURCE_ID' => $soFields['SOURCE_ID']));
$iblockPicture = CIBlock::getArrayByID($element['IBLOCK_ID'], 'PICTURE');
$imageFile = CFile::getFileArray($iblockPicture);
if ($imageFile !== false) {
$imageFile = CFile::ResizeImageGet($imageFile, array("width" => 36, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
}
if (empty($imageFile['src'])) {
$imageFile['src'] = '/bitrix/images/lists/default.png';
}
$soFields['TEXT_MESSAGE'] = '
<span class="bp-title-desc">
<span class="bp-title-desc-icon">
<img src="' . $imageFile['src'] . '" width="36" height="30" border="0" />
</span>
' . $element['NAME'] . '
</span>
';
if ($log = $logObject->fetch()) {
if (intval($log['ID']) > 0) {
if (empty($users)) {
CSocNetLog::update($log['ID'], $soFields);
} else {
$activeUsers = CBPTaskService::getWorkflowParticipants($workflowId);
$rights = self::getRights($activeUsers, $log['ID'], $createdBy, 'post');
$usersRight = self::getUserIdForRight($rights);
self::setSocnetFollow($usersRight, $log['ID'], 'Y', true);
/* Recipients tasks bp */
CSocNetLog::update($log['ID'], $soFields);
/* Increment the counter for participants */
CSocNetLogRights::deleteByLogID($log['ID']);
$rightsCounter = self::getRights($users, $log['ID'], $createdBy, 'counter');
CSocNetLogRights::add($log['ID'], $rightsCounter, false, false);
CSocNetLog::counterIncrement($log['ID'], $soFields['EVENT_ID'], false, 'L', false);
/* Return previous state rights */
CSocNetLogRights::deleteByLogID($log['ID']);
CSocNetLogRights::add($log['ID'], $rights, false, false);
self::setSocnetFollow($users, $log['ID'], 'Y');
self::setSocnetFollow($users, $log['ID'], 'N');
}
/* Completion of the process for the author */
if ($flagCompleteProcess) {
$activeUsers = CBPTaskService::getWorkflowParticipants($workflowId);
$rights = self::getRights($activeUsers, $log['ID'], $createdBy, 'post');
$usersRight = self::getUserIdForRight($rights);
/* Increment the counter for author */
$users[] = $createdBy;
CSocNetLogRights::deleteByLogID($log['ID']);
$rightsCounter = self::getRights($users, $log['ID'], $createdBy, 'counter');
CSocNetLogRights::add($log['ID'], $rightsCounter, false, false);
CSocNetLog::counterIncrement($log['ID'], $soFields['EVENT_ID'], false, 'L', false);
/* Return previous state rights */
CSocNetLogRights::deleteByLogID($log['ID']);
CSocNetLogRights::add($log['ID'], $rights, false, false);
self::setSocnetFollow($users, $log['ID'], 'Y');
self::setSocnetFollow($usersRight, $log['ID'], 'N');
}
}
} else {
$activeUsers = CBPTaskService::getWorkflowParticipants($workflowId);
$soFields['=LOG_DATE'] = $DB->currentTimeFunction();
$logId = CSocNetLog::add($soFields, false);
if (intval($logId) > 0) {
$rights = self::getRights($activeUsers, $logId, $createdBy, 'post');
//.........这里部分代码省略.........