本文整理汇总了PHP中CIBlockProperty::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockProperty::GetList方法的具体用法?PHP CIBlockProperty::GetList怎么用?PHP CIBlockProperty::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockProperty
的用法示例。
在下文中一共展示了CIBlockProperty::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($iblock_id)
{
if (!$iblock_id) {
return false;
}
$this->iblock_id = $iblock_id;
$this->obCache = new CPHPCache();
if ($this->obCache->InitCache(self::$config['CACHE_TIME'], md5($this->iblock_id . __METHOD__), self::$config['CACHE_DIR'])) {
$this->props = $this->obCache->GetVars();
} elseif ($this->obCache->StartDataCache()) {
CModule::IncludeModule('iblock');
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache(self::$config['CACHE_DIR']);
$CACHE_MANAGER->RegisterTag("iblock_id_" . $this->iblock_id);
$CACHE_MANAGER->RegisterTag(self::$config['CACHE_TAG']);
$CACHE_MANAGER->EndTagCache();
$properties = CIBlockProperty::GetList(array("sort" => "asc"), array("ACTIVE" => "Y", "IBLOCK_ID" => $this->iblock_id));
while ($prop_fields = $properties->GetNext()) {
$propArr = array('ID' => $prop_fields['ID'], 'PROPERTY_NAME' => $prop_fields['NAME'], 'PROPERTY_TYPE' => $prop_fields['PROPERTY_TYPE'], 'CODE' => $prop_fields['CODE']);
foreach (array('LINK_IBLOCK_ID', 'USER_TYPE') as $code) {
if (isset($prop_fields[$code])) {
$propArr[$code] = $prop_fields[$code];
}
}
if ($prop_fields["USER_TYPE_SETTINGS"]["TABLE_NAME"]) {
$propArr['TABLE_NAME'] = $prop_fields["USER_TYPE_SETTINGS"]["TABLE_NAME"];
}
$this->props[$prop_fields["CODE"]] = $propArr;
}
$this->obCache->EndDataCache($this->props);
}
}
示例2: generateAddCode
/**
* generateAddCode
* @param array $params
* @return bool|string
*/
public function generateAddCode($params)
{
$iBlock = new \CIBlock();
$IblockCode = $params['iblockCode'];
$PropertyCode = $params['propertyCode'];
$IblockProperty = new \CIBlockProperty();
$dbIblockProperty = $IblockProperty->GetList(array(), array('IBLOCK_CODE' => $IblockCode, 'CODE' => $PropertyCode));
if ($arIblockProperty = $dbIblockProperty->Fetch()) {
if ($arIblockProperty['PROPERTY_TYPE'] == 'L') {
$arIblockProperty['VALUES'] = $this->getEnumItemList($arIblockProperty['IBLOCK_ID'], $arIblockProperty['ID']);
}
if (isset($arIblockProperty['LINK_IBLOCK_ID'])) {
$res = $iBlock->GetByID($arIblockProperty['LINK_IBLOCK_ID']);
if ($ar_res = $res->GetNext()) {
unset($arIblockProperty['LINK_IBLOCK_ID']);
$arIblockProperty['LINK_IBLOCK_CODE'] = $ar_res['CODE'];
}
}
unset($arIblockProperty['ID']);
unset($arIblockProperty['IBLOCK_ID']);
$arIblockProperty['IBLOCK_CODE'] = $IblockCode;
return $this->getMethodContent('Bim\\Db\\Iblock\\IblockPropertyIntegrate', 'Add', array($arIblockProperty));
} else {
return false;
}
}
示例3: _getPropertiesEx
function _getPropertiesEx($arParams)
{
$arFilter = array();
$arProperties = array();
$arPropListIds = array();
if (notEmpty($arParams["type"])) {
$arFilter["PROPERTY_TYPE"] = $arParams["type"];
}
if (notEmpty($arParams["iblock_id"])) {
$arFilter["IBLOCK_ID"] = iblock($arParams["iblock_id"]);
}
$resProperties = \CIBlockProperty::GetList(array(), $arFilter);
while ($arProperty = $resProperties->Fetch()) {
$arProperties[$arProperty["CODE"]] = $arProperty;
if ($arProperty["PROPERTY_TYPE"] == "L") {
$arPropListIds[] = $arProperty["ID"];
}
}
// В фильтр CIBlockPropertyEnum::GetList() нельзя передать
// PROPERTY_ID в виде массива ID, поэтому перебираем
// каждое свойство в цикле
foreach ($arPropListIds as $propListId) {
$resPropValues = \CIBlockPropertyEnum::GetList(array('SORT' => 'ASC', 'VALUE' => 'ASC'), array('PROPERTY_ID' => $propListId));
while ($arPropValue = $resPropValues->Fetch()) {
$arProperties[$arPropValue["PROPERTY_CODE"]]["VALUES"][$arPropValue["XML_ID"]] = $arPropValue["ID"];
}
}
return $arProperties;
}
示例4: testAdd
public function testAdd()
{
/** @var $dbList \CDBResult */
$dbList = \CIBlock::GetList();
$ibCountBefore = $dbList->SelectedRowsCount();
$beforeIds = array();
while ($arIblock = $dbList->Fetch()) {
$beforeIds[] = $arIblock['ID'];
}
$this->_applyFixtures(self::FIXTURE_TYPE_ADD);
$dbList = \CIBlock::GetList();
$ibCountAfter = $dbList->SelectedRowsCount();
$afterIds = array();
while ($arIblock = $dbList->Fetch()) {
$afterIds[] = $arIblock['ID'];
}
$aAddedId = array_diff($afterIds, $beforeIds);
$this->_processIblockId = array_shift($aAddedId);
$this->assertNotEmpty($ibCountAfter, $this->errorMessage('record IB must be present'));
$this->assertNotEquals($ibCountAfter, $ibCountBefore, $this->errorMessage('not also recording information block'));
$this->assertNotEmpty($this->_processIblockId, $this->errorMessage('unavailable identifier of the new information block'));
$rsProps = \CIBlockProperty::GetList(null, array('IBLOCK_ID' => $this->_processIblockId));
$this->assertNotEmpty($rsProps->AffectedRowsCount(), $this->errorMessage('added properties not available information block', array(':iblockId' => $this->_processIblockId)));
$rsSections = \CIBlockSection::getList(null, array('IBLOCK_ID' => $this->_processIblockId), false, array('ID'));
$this->assertNotEmpty($rsSections->AffectedRowsCount(), $this->errorMessage('added sections not available information block'));
$registerRef = (bool) DbVersionReferencesTable::getList(array('filter' => array('=DB_VERSION' => Module::getInstance()->getDbVersion(), '=GROUP' => ReferenceController::GROUP_IBLOCK, '=ITEM_ID' => $this->_processIblockId)))->fetch();
$this->assertTrue($registerRef, $this->errorMessage('In added apply not created iblock reference ' . $this->_processIblockId));
}
示例5: generateAddCode
/**
* Генерация создания Информационного блока
*
* generateAddCode
* @param array $IblockCode
* @return bool|string
*/
public function generateAddCode($IblockCode)
{
$return = array();
$iblockObject = $this->iblock->GetList(array(), array('CODE' => $IblockCode, 'CHECK_PERMISSIONS' => 'N'));
if ($item = $iblockObject->Fetch()) {
# Установка групп пользователей
$this->setUserGroupId($item['ID'], $item);
$item['FIELDS'] = \CIBlock::GetFields($item['ID']);
Helper::unsetFields(array('ID'), $item);
if ($return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockIntegrate', 'Add', array($item))) {
$IblockProperty = new \CIBlockProperty();
$iblockPropertyQuery = $IblockProperty->GetList(array(), array('IBLOCK_CODE' => $item['CODE']));
while ($iblockProperty = $iblockPropertyQuery->Fetch()) {
Helper::unsetFields(array('ID'), $iblockProperty);
$iblockProperty['IBLOCK_CODE'] = $item['CODE'];
$propertyQuery = \CIBlockPropertyEnum::GetList(array(), array("IBLOCK_ID" => $iblockProperty['IBLOCK_ID'], "CODE" => $iblockProperty['CODE']));
while ($propertyValues = $propertyQuery->Fetch()) {
Helper::unsetFields(array('ID', 'PROPERTY_ID'), $propertyValues);
$iblockProperty['VALUES'][] = $propertyValues;
}
if (!is_null($iblockProperty['LINK_IBLOCK_ID'])) {
$linkedIBlock = $this->iblock->GetList(array(), array('ID' => $iblockProperty['LINK_IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N'))->Fetch();
$iblockProperty['LINK_IBLOCK_CODE'] = $linkedIBlock['CODE'];
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockPropertyIntegrate', 'Add', array($iblockProperty));
}
return implode(PHP_EOL, $return);
} else {
return false;
}
} else {
return false;
}
}
示例6: generateAddCode
/**
* Генерация создания
*
* generateAddCode
* @param array $IblockTypeId
* @return bool|string
*/
public function generateAddCode($IblockTypeId)
{
$iBlock = new \CIBlock();
$CIblockType = new \CIBlockType();
$lang = new \CLanguage();
$return = array();
$dbIblockType = $CIblockType->GetByID($IblockTypeId);
if ($arIblockType = $dbIblockType->GetNext()) {
$Iblock = new \CIBlock();
$dbIblock = $Iblock->GetList(array(), array('TYPE' => $IblockTypeId, 'CHECK_PERMISSIONS' => 'N'));
while ($arIblock = $dbIblock->GetNext()) {
$IblockProperty = new \CIBlockProperty();
$dbIblockProperty = $IblockProperty->GetList(array(), array('IBLOCK_CODE' => $arIblock['CODE'], 'CHECK_PERMISSIONS' => 'N'));
while ($arIblockProperty = $dbIblockProperty->GetNext()) {
$dbPropertyValues = \CIBlockPropertyEnum::GetList(array(), array("IBLOCK_ID" => $arIblockProperty['IBLOCK_ID'], "CODE" => $arIblockProperty['CODE']));
while ($arPropertyValues = $dbPropertyValues->Fetch()) {
$arIblockProperty['VALUES'][$arPropertyValues['ID']] = $arPropertyValues;
}
Helper::unsetFields(array('ID', '~ID', 'IBLOCK_ID', '~IBLOCK_ID'), $arIblockProperty);
$arIblockProperty['IBLOCK_CODE'] = $arIblock['CODE'];
foreach ($arIblockProperty as $k => $v) {
if (strstr($k, "~") || is_null($v)) {
unset($arIblockProperty[$k]);
}
}
if (isset($arIblockProperty['LINK_IBLOCK_ID'])) {
$res = $iBlock->GetList(array(), array("ID" => $arIblockProperty['LINK_IBLOCK_ID'], 'CHECK_PERMISSIONS' => 'N'));
if ($ar_res = $res->GetNext()) {
unset($arIblockProperty['LINK_IBLOCK_ID']);
$arIblockProperty['LINK_IBLOCK_CODE'] = $ar_res['CODE'];
}
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockPropertyIntegrate', 'Add', array($arIblockProperty));
}
foreach ($arIblock as $k => $v) {
if (strstr($k, "~") || $k == 'ID') {
unset($arIblock[$k]);
}
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockIntegrate', 'Add', array($arIblock));
}
foreach ($arIblockType as $k => $v) {
if (strstr($k, "~") || is_null($v)) {
unset($arIblockType[$k]);
}
}
$rsLang = $lang->GetList($by = "lid", $order = "desc");
while ($arLang = $rsLang->Fetch()) {
$arTypeLang = $CIblockType->GetByIDLang($IblockTypeId, $arLang['LID']);
$arIblockType["LANG"][$arLang['LID']] = array('NAME' => $arTypeLang['NAME'], 'SECTION_NAME' => $arTypeLang['SECTION_NAME'], 'ELEMENT_NAME' => $arTypeLang['ELEMENT_NAME']);
}
$return[] = $this->getMethodContent('Bim\\Db\\Iblock\\IblockTypeIntegrate', 'Add', array($arIblockType));
$return = array_reverse($return);
return implode(PHP_EOL, $return);
} else {
return false;
}
}
示例7: getIBlockProperties
function getIBlockProperties($IBlockId)
{
$Props = array();
$rsProperty = CIBlockProperty::GetList(array('sort' => 'asc'), array('ACTIVE' => 'Y', 'IBLOCK_ID' => $IBlockId));
while ($arProperty = $rsProperty->Fetch()) {
$Props[] = 'PROPERTY_' . $arProperty['CODE'];
}
return $Props;
}
示例8: getProperties
public function getProperties()
{
if (!isset($this->properties)) {
$this->properties = array();
$rs = \CIBlockProperty::GetList(array('sort' => 'asc'), array('IBLOCK_ID' => $this->id));
while ($ar = $rs->Fetch()) {
$this->properties[$ar['CODE']] = new Property($ar);
}
}
return $this->properties;
}
示例9: findId
function findId($code)
{
if (CModule::IncludeModule("iblock")) {
$properties = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", 'CODE' => $code));
while ($prop_fields = $properties->GetNext()) {
$temp = $prop_fields['ID'];
}
return $temp;
} else {
return false;
}
}
示例10: checkExistProperty
/**
* @param string $propCode
* @param string $userType
* @return bool
* @throws PropertyAlreadyExistException
*/
protected function checkExistProperty($propCode, $userType)
{
$propertyModel = new \CIBlockProperty();
$rsProperty = $propertyModel->GetList([], ['IBLOCK_ID' => $this->getIblockId(), 'CODE' => $propCode]);
if ($property = $rsProperty->Fetch()) {
if ($property['USER_TYPE'] !== $userType) {
throw new PropertyAlreadyExistException($propCode);
} else {
return true;
}
}
return false;
}
示例11: Delete
/**
* Delete
* @param $sIBlockCode
* @param $sPropertyCode
* @return array
* @throws \Exception
*/
public static function Delete($sIBlockCode, $sPropertyCode)
{
$rsProperty = \CIBlockProperty::GetList(array(), array('IBLOCK_CODE' => $sIBlockCode, 'CODE' => $sPropertyCode));
if ($arProperty = $rsProperty->Fetch()) {
if (\CIBlockProperty::Delete($arProperty['ID'])) {
return true;
} else {
throw new BimException(__METHOD__ . "Iblock property delete error!");
}
} else {
throw new BimException(__METHOD__ . 'Not find property with code ' . $sPropertyCode);
}
}
示例12: SendRemindEventAgent
function SendRemindEventAgent($iblockId, $taskId, $pathTemplate)
{
if (!CModule::IncludeModule("socialnetwork") && !CModule::IncludeModule("iblock")) {
return;
}
$iblockId = IntVal($iblockId);
$taskId = IntVal($taskId);
if (!isset($GLOBALS["USER"]) || !is_object($GLOBALS["USER"])) {
$bTmpUser = True;
$GLOBALS["USER"] = new CUser();
}
$arTasksCustomProps = array();
$dbTasksCustomProps = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", "IBLOCK_ID" => $iblockId, "CHECK_PERMISSIONS" => "N"));
while ($arTasksCustomProp = $dbTasksCustomProps->Fetch()) {
$ind = StrLen($arTasksCustomProp["CODE"]) > 0 ? $arTasksCustomProp["CODE"] : $arTasksCustomProp["ID"];
$arTasksCustomProps[StrToUpper($ind)] = $arTasksCustomProp;
}
$dbTasksList = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "ID" => $taskId, "CHECK_PERMISSIONS" => "N"), false, false, array("ID", "NAME", "IBLOCK_ID", "CREATED_BY", "PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"]));
while ($arTask = $dbTasksList->GetNext()) {
$ar = array();
$dbElementSections = CIBlockElement::GetElementGroups($arTask["ID"]);
while ($arElementSection = $dbElementSections->Fetch()) {
if ($arElementSection["IBLOCK_ID"] == $iblockId) {
$ar[] = $arElementSection["ID"];
}
}
if (Count($ar) <= 0) {
continue;
}
$taskType = "";
$taskOwnerId = 0;
$dbSectionsChain = CIBlockSection::GetNavChain($iblockId, $ar[0]);
if ($arSect = $dbSectionsChain->Fetch()) {
$taskType = $arSect["XML_ID"] == "users_tasks" ? "user" : "group";
$taskOwnerId = IntVal($taskType == "user" ? $arTask["PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"] . "_VALUE"] : $arSect["XML_ID"]);
}
if (!In_Array($taskType, array("user", "group")) || $taskOwnerId <= 0) {
continue;
}
$path2view = ($GLOBALS["APPLICATION"]->IsHTTPS() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . CComponentEngine::MakePathFromTemplate($pathTemplate, array("owner_id" => $taskOwnerId, "task_id" => $arTask["ID"], "action" => "view"));
$arMessageFields = array("=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "FROM_USER_ID" => $arTask["CREATED_BY"], "TO_USER_ID" => $arTask["PROPERTY_" . $arTasksCustomProps["TASKASSIGNEDTO"]["ID"] . "_VALUE"], "MESSAGE" => str_replace(array("#URL_VIEW#", "#NAME#"), array($path2view, $arTask["NAME"]), GetMessage("INTE_REMIND_TASK_MESSAGE")));
CSocNetMessages::Add($arMessageFields);
//CIBlockElement::SetPropertyValueCode($arTask["ID"], $arTasksCustomProps["TASKREMIND"]["ID"], false);
}
if ($bTmpUser) {
unset($GLOBALS["USER"]);
}
//return "CIntranetTasks::SendRemindEventAgent($iblockId, $taskId, \"$pathTemplate\");";
}
示例13: getOffers
protected function getOffers()
{
$arPropertyMap = array();
$arSelectedPropTypes = array('S', 'N', 'L', 'E', 'G');
$this->arSelectOfferProps = array();
$arOffers = \CCatalogSKU::GetInfoByProductIBlock($this->iBlockId);
if (empty($arOffers['IBLOCK_ID'])) {
return array();
}
$this->intOfferIBlockID = $arOffers['IBLOCK_ID'];
$rsOfferIBlocks = \CIBlock::GetByID($this->intOfferIBlockID);
if (!($this->arOfferIBlock = $rsOfferIBlocks->Fetch())) {
throw new SystemException("Bad offers iBlock ID (" . __CLASS__ . "::" . __METHOD__ . ")");
}
$rsProps = \CIBlockProperty::GetList(array('SORT' => 'ASC', 'NAME' => 'ASC'), array('IBLOCK_ID' => $this->intOfferIBlockID, 'ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'));
while ($arProp = $rsProps->Fetch()) {
$arProp['ID'] = (int) $arProp['ID'];
if ($arOffers['SKU_PROPERTY_ID'] != $arProp['ID']) {
$arProp['USER_TYPE'] = (string) $arProp['USER_TYPE'];
$arProp['CODE'] = (string) $arProp['CODE'];
$this->arIblock['OFFERS_PROPERTY'][$arProp['ID']] = $arProp;
$this->arProperties[$arProp['ID']] = $arProp;
if (in_array($arProp['PROPERTY_TYPE'], $arSelectedPropTypes)) {
$this->arSelectOfferProps[] = $arProp['ID'];
}
if ($arProp['CODE'] !== '') {
foreach ($this->arIblock['PROPERTY'] as &$arMainProp) {
if ($arMainProp['CODE'] == $arProp['CODE']) {
$arPropertyMap[$arProp['ID']] = $arMainProp['CODE'];
break;
}
}
if (isset($arMainProp)) {
unset($arMainProp);
}
}
}
}
$this->arOfferIBlock['LID'] = $this->arIblock['LID'];
$this->arOfferIBlock['PROPERTY'] = array();
$rsProps = \CIBlockProperty::GetList(array('SORT' => 'ASC', 'NAME' => 'ASC'), array('IBLOCK_ID' => $this->intOfferIBlockID, 'ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'));
while ($arProp = $rsProps->Fetch()) {
$arProp['ID'] = (int) $arProp['ID'];
$arProp['USER_TYPE'] = (string) $arProp['USER_TYPE'];
$arProp['CODE'] = (string) $arProp['CODE'];
$this->arOfferIBlock['PROPERTY'][$arProp['ID']] = $arProp;
}
return $arOffers;
}
示例14: checkLinkField
public static function checkLinkField($iblock_id) {
$rResult = CIBlockProperty::GetList(
array('SORT' => 'ASC'),
array(
'IBLOCK_ID' => $iblock_id,
'CODE' => 'LINK',
'ACTIVE' => 'Y',
)
);
$arResult = array();
while (false != ($property = $rResult->GetNext())) {
$arResult[] = $property;
}
return !empty($arResult);
}
示例15: getPropName
function getPropName($code,$iblock_id){
$properties = CIBlockProperty::GetList(Array("sort"=>"asc", "name"=>"asc"), Array("ACTIVE"=>"Y", "IBLOCK_ID"=>$iblock_id, "CODE"=>$code));
while ($prop_fields = $properties->GetNext())
{
$res=$prop_fields["NAME"];
}
/*
foreach( $arResult["NAV_RESULT"]->arIBlockAllProps as $i=>$arPropFields){
if( $arPropFields["CODE"] == $code ){
return $arPropFields["NAME"];
}
}*/
if ($res)
return $res;
return false;
}