• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CIBlockProperty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CIBlockProperty的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockProperty类的具体用法?PHP CIBlockProperty怎么用?PHP CIBlockProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CIBlockProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __IRM_InitReservation

 function __IRM_InitReservation($iblockId)
 {
     $arResult = array();
     $arResult["ALLOWED_FIELDS"] = array("ID" => array("NAME" => GetMessage("INAF_F_ID"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "int", "IS_FIELD" => true), "NAME" => array("NAME" => GetMessage("INAF_F_NAME"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "string", "IS_FIELD" => true), "DESCRIPTION" => array("NAME" => GetMessage("INAF_F_DESCRIPTION"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "text", "IS_FIELD" => true), "UF_FLOOR" => array("NAME" => GetMessage("INAF_F_FLOOR"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PLACE" => array("NAME" => GetMessage("INAF_F_PLACE"), "ORDERABLE" => true, "FILTERABLE" => true, "TYPE" => "integer", "IS_FIELD" => false), "UF_PHONE" => array("NAME" => GetMessage("INAF_F_PHONE"), "ORDERABLE" => false, "FILTERABLE" => false, "TYPE" => "string", "IS_FIELD" => false));
     $arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("IBLOCK_" . $iblockId . "_SECTION", 0, LANGUAGE_ID);
     $arKeys = Array_Keys($arResult["ALLOWED_FIELDS"]);
     foreach ($arKeys as $key) {
         if (!$arResult["ALLOWED_FIELDS"][$key]["IS_FIELD"]) {
             if (!Array_Key_Exists($key, $arUserFields)) {
                 $arFields = array("ENTITY_ID" => "IBLOCK_" . $iblockId . "_SECTION", "FIELD_NAME" => $key, "USER_TYPE_ID" => $arResult["ALLOWED_FIELDS"][$key]["TYPE"]);
                 $obUserField = new CUserTypeEntity();
                 $obUserField->Add($arFields);
             }
         }
     }
     $arResult["ALLOWED_ITEM_PROPERTIES"] = array("UF_PERSONS" => array("NAME" => GetMessage("INTASK_C29_UF_PERSONS"), "ACTIVE" => "Y", "SORT" => 300, "CODE" => "UF_PERSONS", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 5, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "UF_RES_TYPE" => array("NAME" => GetMessage("INTASK_C29_UF_RES_TYPE"), "ACTIVE" => "Y", "SORT" => 200, "CODE" => "UF_RES_TYPE", "PROPERTY_TYPE" => "L", "USER_TYPE" => false, "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "Y", "SEARCHABLE" => "Y", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "Y", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId, "VALUES" => array(array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEA"), "DEF" => "Y", "SORT" => 100, "XML_ID" => "A"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEB"), "DEF" => "N", "SORT" => 200, "XML_ID" => "B"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPEC"), "DEF" => "N", "SORT" => 200, "XML_ID" => "C"), array("VALUE" => GetMessage("INTASK_C29_UF_RES_TYPED"), "DEF" => "N", "SORT" => 300, "XML_ID" => "D"))), "UF_PREPARE_ROOM" => array("NAME" => GetMessage("INTASK_C29_UF_PREPARE_ROOM"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "UF_PREPARE_ROOM", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "Y", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_TYPE" => array("NAME" => GetMessage("INTASK_C29_PERIOD_TYPE"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_TYPE", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "NONE", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_COUNT" => array("NAME" => GetMessage("INTASK_C29_PERIOD_COUNT"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_COUNT", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "EVENT_LENGTH" => array("NAME" => GetMessage("INTASK_C29_EVENT_LENGTH"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "EVENT_LENGTH", "PROPERTY_TYPE" => "N", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId), "PERIOD_ADDITIONAL" => array("NAME" => GetMessage("INTASK_C29_PERIOD_ADDITIONAL"), "ACTIVE" => "Y", "SORT" => 500, "CODE" => "PERIOD_ADDITIONAL", "PROPERTY_TYPE" => "S", "USER_TYPE" => false, "DEFAULT_VALUE" => "", "ROW_COUNT" => 1, "COL_COUNT" => 30, "LINK_IBLOCK_ID" => 0, "WITH_DESCRIPTION" => "N", "FILTRABLE" => "N", "SEARCHABLE" => "N", "MULTIPLE" => "N", "MULTIPLE_CNT" => 5, "IS_REQUIRED" => "N", "FILE_TYPE" => "jpg, gif, bmp, png, jpeg", "LIST_TYPE" => "L", "IBLOCK_ID" => $iblockId));
     $dbIBlockProps = CIBlock::GetProperties($iblockId);
     while ($arIBlockProps = $dbIBlockProps->Fetch()) {
         if (Array_Key_Exists($arIBlockProps["CODE"], $arResult["ALLOWED_ITEM_PROPERTIES"])) {
             $arResult["ALLOWED_ITEM_PROPERTIES"][$arIBlockProps["CODE"]]["ID"] = $arIBlockProps["ID"];
         }
     }
     $keys = Array_Keys($arResult["ALLOWED_ITEM_PROPERTIES"]);
     foreach ($keys as $key) {
         if (IntVal($arResult["ALLOWED_ITEM_PROPERTIES"][$key]["ID"]) <= 0) {
             $ibp = new CIBlockProperty();
             $arResult["ALLOWED_ITEM_PROPERTIES"][$key]["ID"] = $ibp->Add($arResult["ALLOWED_ITEM_PROPERTIES"][$key]);
         }
     }
     return $arResult;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:init.php


示例2: 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;
     }
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:41,代码来源:Iblock.php


示例3: 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;
     }
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:65,代码来源:IblockType.php


示例4: testAdd

 public function testAdd()
 {
     $this->_injectDutyCollector();
     $ibType = \CIBlockType::GetList()->Fetch();
     $ib = new \CIBlock();
     $ibId = $ib->Add(array('IBLOCK_TYPE_ID' => $ibType['ID'], 'NAME' => 'New Iblock', 'SITE_ID' => 's1'));
     $this->assertNotEmpty($ibId, $this->errorMessage('not create iblock id', array(':lastError' => $ib->LAST_ERROR)));
     $prop = new \CIBlockProperty();
     $propId = $prop->Add(array('IBLOCK_ID' => $ibId, 'CODE' => 'propCode', 'NAME' => 'Property NAME'));
     $this->assertNotEmpty($propId, $this->errorMessage('not create property iblock id', array(':lastError' => $ib->LAST_ERROR)));
     $sec = new \CIBlockSection();
     $secId = $sec->Add(array('IBLOCK_ID' => $ibId, 'NAME' => 'Iblock Section'));
     $this->assertNotEmpty($secId, $this->errorMessage('not create section iblock id', array(':lastError' => $ib->LAST_ERROR)));
     // ¬ итоге должны получитс¤
     // данные по добавлению »Ѕ
     $this->assertNotEmpty($this->_getCollectorFixes(AddProcess::className(), IblockHandler::className()));
     // данные по добавлению свойства
     $this->assertNotEmpty($this->_getCollectorFixes(AddProcess::className(), IblockPropertyHandler::className()));
     // данные по добавлению секции
     $this->assertNotEmpty($this->_getCollectorFixes(AddProcess::className(), IblockSectionHandler::className()));
     $refFixes = $this->_getCollectorFixes('reference');
     // фиксаци¤ изменений
     Module::getInstance()->commitDutyChanges();
     // добавлены записи журнала обновлений (в базу)
     /** @var $logRecords AppliedChangesLogModel[] */
     $logRecords = AppliedChangesLogModel::find(array('order' => array('id' => 'desc'), 'limit' => 10));
     $this->assertTrue(count($logRecords) > 3);
     $iterationsCount = 0;
     foreach ($logRecords as $logRecord) {
         if ($logRecord->processName == Module::SPECIAL_PROCESS_FIX_REFERENCE) {
             continue;
         }
         if ($logRecord->processName != AddProcess::className()) {
             $this->throwError($this->errorMessage('last log records need been update process'), $logRecord->processName);
         }
         if (++$iterationsCount > 3) {
             break;
         }
         $data = $logRecord->updateData;
         switch ($logRecord->subjectName) {
             case IblockHandler::className():
                 (!$data['iblock'] || $data['iblock']['ID'] != $ibId) && $this->throwError($this->errorMessage('iblock not registered after update', array(':actual' => $data['iblock']['ID'], ':need' => $ibId)));
                 break;
             case IblockPropertyHandler::className():
                 $data['ID'] != $propId && $this->throwError($this->errorMessage('property iblock not registered after update', array(':original' => $propId, ':actual' => $data['ID'])));
                 break;
             case IblockSectionHandler::className():
                 $data['ID'] != $secId && $this->throwError($this->errorMessage('section iblock not registered after update', array(':original' => $secId, ':actual' => $data['ID'])));
                 break;
         }
     }
     // добавлены три вида ссылок в фиксаци¤х
     $this->assertEquals(3, count($refFixes), $this->errorMessage('links expected count', array(':count' => 3)));
     $this->_iblockId = $ibId;
     $this->_propertyId = $propId;
     $this->_sectionId = $secId;
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:57,代码来源:fixtestcase.php


示例5: onBeforeUpload

function onBeforeUpload($Params)
{
    CModule::IncludeModule("iblock");
    $_SESSION['arUploadedPhotos'] = array();
    $arParams = $Params['arParams'];
    $savedData = CImageUploader::GetSavedData();
    $savedData['UPLOADING_START'] = "Y";
    CImageUploader::SetSavedData($savedData);
    if ($savedData["SECTION_ID"] <= 0) {
        $arParams["SECTION_ID"] = GetAlbumId(array('id' => $Params['packageFields']['photo_album_id'], 'name' => $Params['packageFields']['new_album_name'], 'arParams' => $arParams, '~arResult' => $Params['~arResult']));
        $savedData = CImageUploader::GetSavedData();
        $savedData["SECTION_ID"] = $arParams["SECTION_ID"];
    } else {
        $arParams["SECTION_ID"] = $savedData["SECTION_ID"];
    }
    // Check and create properties
    if (count($savedData['arError']) == 0) {
        $arPropertiesNeed = array();
        // Array of properties needed to create
        foreach ($arParams['converters'] as $key => $val) {
            if ($val['code'] == "real_picture" || $val['code'] == "thumbnail") {
                continue;
            }
            $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $val['code']));
            if (!($db_res && ($res = $db_res->Fetch()))) {
                $arPropertiesNeed[] = $val['code'];
            }
        }
        if (count($arPropertiesNeed) > 0) {
            $obProperty = new CIBlockProperty();
            foreach ($arPropertiesNeed as $key) {
                $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "F", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . strToUpper($key))) > 0 ? GetMessage("P_" . strToUpper($key)) : strToUpper($key), "CODE" => strToUpper($key), "FILE_TYPE" => "jpg, gif, bmp, png, jpeg"));
            }
        }
        // Check Public property
        $arPropertiesNeed = array();
        foreach (array("PUBLIC_ELEMENT", "APPROVE_ELEMENT") as $key) {
            $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key));
            if (!$db_res || !($res = $db_res->Fetch())) {
                $arPropertiesNeed[] = $key;
            }
        }
        if (count($arPropertiesNeed) > 0) {
            $obProperty = new CIBlockProperty();
            foreach ($arPropertiesNeed as $key) {
                $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "S", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . $key)) > 0 ? GetMessage("P_" . $key) : $key, "DEFAULT_VALUE" => "N", "CODE" => $key));
            }
        }
    }
    CImageUploader::SetSavedData($savedData);
    return true;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:52,代码来源:functions.php


示例6: 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;
 }
开发者ID:notamedia,项目名称:bitrix-i18n,代码行数:19,代码来源:elementconverter.php


示例7: addLinkField

	public static function addLinkField($iblock_id) {
		$iblock_property = new CIBlockProperty;
		return $iblock_property->Add(
			array(
				'NAME' => 'Ссылка',
				'ACTIVE' => 'Y',
				'SORT' => 500,
				'CODE' => 'LINK',
				'PROPERTY_TYPE' => 'S',
				'IBLOCK_ID' => $iblock_id,
			)
		);
	}
开发者ID:ASDAFF,项目名称:bx_ichannels,代码行数:13,代码来源:cichannelsrssmapperbylink.php


示例8: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("forum")) {
         return CBPActivityExecutionStatus::Closed;
     }
     if (!CModule::IncludeModule("iblock")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $forumId = intval($this->ForumId);
     if ($forumId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $iblockId = $this->IBlockId;
     $dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
     $arResult = $dbResult->Fetch();
     if (!$arResult) {
         $obProperty = new CIBlockProperty();
         $obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum topic", "CODE" => "FORUM_TOPIC_ID"));
         $obProperty->Add(array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => "Forum message count", "CODE" => "FORUM_MESSAGE_CNT"));
         $dbResult = CIBlockElement::GetProperty($iblockId, $documentId[2], false, false, array("CODE" => "FORUM_TOPIC_ID"));
         $arResult = $dbResult->Fetch();
     }
     $forumTopicId = intval($arResult["VALUE"]);
     $arForumUserTmp = $this->ForumUser;
     $arForumUser = CBPHelper::ExtractUsers($arForumUserTmp, $documentId, true);
     $forumUserId = 1;
     $forumUserName = "Admin";
     if ($arForumUser != null) {
         $forumUserId = $arForumUser;
         $dbResult = CUser::GetByID($forumUserId);
         if ($arResult = $dbResult->Fetch()) {
             $forumUserName = CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arResult, true);
         }
     }
     $newTopic = "N";
     if ($forumTopicId <= 0) {
         $documentService = $this->workflow->GetService("DocumentService");
         $document = $documentService->GetDocument($documentId);
         $newTopic = "Y";
         $arFields = array("TITLE" => $document["NAME"], "FORUM_ID" => $forumId, "USER_START_ID" => $forumUserId, "USER_START_NAME" => $forumUserName, "LAST_POSTER_NAME" => $forumUserName, "APPROVED" => "Y");
         $forumTopicId = CForumTopic::Add($arFields);
         CIBlockElement::SetPropertyValues($documentId[2], $iblockId, $forumTopicId, "FORUM_TOPIC_ID");
     }
     $arFields = array("POST_MESSAGE" => $this->ForumPostMessage, "AUTHOR_ID" => $forumUserId, "AUTHOR_NAME" => $forumUserName, "FORUM_ID" => $forumId, "TOPIC_ID" => $forumTopicId, "APPROVED" => "Y", "NEW_TOPIC" => $newTopic, "PARAM2" => $documentId[2]);
     $forumMessageId = CForumMessage::Add($arFields, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:49,代码来源:forumreviewactivity.php


示例9: _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;
}
开发者ID:rschweppes,项目名称:bitrix-helpers,代码行数:29,代码来源:getproperties.php


示例10: onBeforeElementAddHandler

 static function onBeforeElementAddHandler($arFields)
 {
     $IBLOCK_ID = Config\Option::get("citfact.replaceurl", "IBLOCK_ID", "");
     $SECTION_ID = Config\Option::get("citfact.replaceurl", "SECTION_BREND_ID", "BRENDI");
     $CODE_PROP = Config\Option::get("citfact.replaceurl", "PROPERTY_CODE_BRENDI", "BRENDI");
     if ($IBLOCK_ID == $arFields["IBLOCK_ID"]) {
         $propertyBrand = \CIBlockProperty::GetByID($CODE_PROP, $arFields["IBLOCK_ID"]);
         if ($arResultProperty = $propertyBrand->GetNext()) {
             $propertyBrandValue = \CIBlockPropertyEnum::GetByID($arFields["PROPERTY_VALUES"][$arResultProperty["ID"]][0]["VALUE"]);
         }
         $rqParentSection = \CIBlockSection::GetByID($SECTION_ID);
         if ($arParentSection = $rqParentSection->GetNext()) {
             $arFilter = array('IBLOCK_ID' => $arParentSection['IBLOCK_ID'], '>LEFT_MARGIN' => $arParentSection['LEFT_MARGIN'], '<RIGHT_MARGIN' => $arParentSection['RIGHT_MARGIN'], '>DEPTH_LEVEL' => $arParentSection['DEPTH_LEVEL']);
             // выберет потомков без учета активности
             $rqSectChild = \CIBlockSection::GetList(array('left_margin' => 'asc'), $arFilter);
             while ($arSectChild = $rqSectChild->GetNext()) {
                 $arSections[$arSectChild["NAME"]] = $arSectChild["ID"];
             }
         }
         if (array_key_exists($propertyBrandValue["VALUE"], $arSections)) {
             $arFields["IBLOCK_SECTION"][] = $arSections[$propertyBrandValue["VALUE"]];
         } else {
             $arParams = array("replace_space" => "-", "replace_other" => "-");
             $trans = \Cutil::translit($propertyBrandValue["VALUE"], "ru", $arParams);
             $bs = new \CIBlockSection();
             $arFieldsNewSection = array("ACTIVE" => "Y", "IBLOCK_SECTION_ID" => $SECTION_ID, "IBLOCK_ID" => $IBLOCK_ID, "NAME" => $propertyBrandValue["VALUE"], "CODE" => $trans);
             $resultAdd = $bs->Add($arFieldsNewSection);
             $arFields["IBLOCK_SECTION"][] = $resultAdd;
         }
     }
     return true;
 }
开发者ID:ASDAFF,项目名称:citfact.replaceurl,代码行数:32,代码来源:Event.php


示例11: _init

 private static function _init()
 {
     if (count(self::$types) == 0) {
         self::$types = array();
         //Element fields
         self::$types["NAME"] = new CListFieldType("NAME", GetMessage("LISTS_LIST_FIELD_NAME"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
         self::$types["SORT"] = new CListFieldType("SORT", GetMessage("LISTS_LIST_FIELD_SORT"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
         self::$types["ACTIVE_FROM"] = new CListFieldType("ACTIVE_FROM", GetMessage("LISTS_LIST_FIELD_ACTIVE_FROM"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
         self::$types["ACTIVE_TO"] = new CListFieldType("ACTIVE_TO", GetMessage("LISTS_LIST_FIELD_ACTIVE_TO"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
         self::$types["PREVIEW_PICTURE"] = new CListFieldType("PREVIEW_PICTURE", GetMessage("LISTS_LIST_FIELD_PREVIEW_PICTURE"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
         self::$types["PREVIEW_TEXT"] = new CListFieldType("PREVIEW_TEXT", GetMessage("LISTS_LIST_FIELD_PREVIEW_TEXT"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
         self::$types["DETAIL_PICTURE"] = new CListFieldType("DETAIL_PICTURE", GetMessage("LISTS_LIST_FIELD_DETAIL_PICTURE"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
         self::$types["DETAIL_TEXT"] = new CListFieldType("DETAIL_TEXT", GetMessage("LISTS_LIST_FIELD_DETAIL_TEXT"), CListFieldType::IS_FIELD, CListFieldType::NOT_READONLY);
         self::$types["DATE_CREATE"] = new CListFieldType("DATE_CREATE", GetMessage("LISTS_LIST_FIELD_DATE_CREATE"), CListFieldType::IS_FIELD, CListFieldType::IS_READONLY);
         self::$types["CREATED_BY"] = new CListFieldType("CREATED_BY", GetMessage("LISTS_LIST_FIELD_CREATED_BY"), CListFieldType::IS_FIELD, CListFieldType::IS_READONLY);
         self::$types["TIMESTAMP_X"] = new CListFieldType("TIMESTAMP_X", GetMessage("LISTS_LIST_FIELD_TIMESTAMP_X"), CListFieldType::IS_FIELD, CListFieldType::IS_READONLY);
         self::$types["MODIFIED_BY"] = new CListFieldType("MODIFIED_BY", GetMessage("LISTS_LIST_FIELD_MODIFIED_BY"), CListFieldType::IS_FIELD, CListFieldType::IS_READONLY);
         //Property types
         self::$types["S"] = new CListFieldType("S", GetMessage("LISTS_LIST_FIELD_S"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
         self::$types["N"] = new CListFieldType("N", GetMessage("LISTS_LIST_FIELD_N"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
         self::$types["L"] = new CListFieldType("L", GetMessage("LISTS_LIST_FIELD_L"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
         self::$types["F"] = new CListFieldType("F", GetMessage("LISTS_LIST_FIELD_F"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
         self::$types["G"] = new CListFieldType("G", GetMessage("LISTS_LIST_FIELD_G"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
         self::$types["E"] = new CListFieldType("E", GetMessage("LISTS_LIST_FIELD_E"), CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
         //User types
         foreach (CIBlockProperty::GetUserType() as $ar) {
             if (array_key_exists("GetPublicEditHTML", $ar)) {
                 self::$types[$ar["PROPERTY_TYPE"] . ":" . $ar["USER_TYPE"]] = new CListFieldType($ar["PROPERTY_TYPE"] . ":" . $ar["USER_TYPE"], $ar["DESCRIPTION"], CListFieldType::NOT_FIELD, CListFieldType::NOT_READONLY);
             }
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:32,代码来源:listfieldtypes.php


示例12: 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));
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:28,代码来源:updatetestcase.php


示例13: 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;
 }
开发者ID:AlexPrya,项目名称:redvent.ru,代码行数:9,代码来源:class.php


示例14: getOptions

 public function getOptions()
 {
     if (!isset($this->options)) {
         $res = \CIBlockProperty::GetPropertyEnum($this->data['ID'], array("SORT" => "asc"), array());
         while ($row = $res->Fetch()) {
             $this->options[] = $row;
         }
     }
     return $this->options;
 }
开发者ID:ASDAFF,项目名称:bitrix_lib,代码行数:10,代码来源:Property.class.php


示例15: 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;
     }
 }
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:12,代码来源:functions.php


示例16: 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);
     }
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:20,代码来源:IblockPropertyIntegrate.php


示例17: getIblockPropertyEnumId

 /**
  * Получить ID значения свойства типа "список" у инфоблока
  *
  * @param string $iblockCode
  * @param string $propertyCode
  * @param string $enumCode
  * @return int|bool
  */
 public static function getIblockPropertyEnumId($iblockCode, $propertyCode, $enumCode)
 {
     if (!empty(self::$iblockPropertyEnumId[$iblockCode][$propertyCode][$enumCode])) {
         return self::$iblockPropertyEnumId[$iblockCode][$propertyCode][$enumCode];
     }
     if (!($iblockId = self::getIblockId($iblockCode))) {
         return false;
     }
     if ($enum = \CIBlockProperty::GetPropertyEnum($propertyCode, [], ['IBLOCK_ID' => $iblockId, 'EXTERNAL_ID' => $enumCode])->fetch()) {
         self::$iblockPropertyEnumId[$iblockCode][$propertyCode][$enumCode] = $enum['ID'];
         return $enum['ID'];
     }
     return false;
 }
开发者ID:notagency,项目名称:notagency.base,代码行数:22,代码来源:iblocktools.php


示例18: getOffers

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CIBlockPropertyEnum类代码示例发布时间:2022-05-23
下一篇:
PHP CIBlockPriceTools类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap