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

PHP CIBlock类代码示例

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

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



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

示例1: 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


示例2: Add

 /**
  * Add
  * @param $arFields
  * @return bool
  * @throws \Exception
  */
 public static function Add($arFields)
 {
     $iblock = new \CIBlock();
     if (isset($arFields['SORT'])) {
         if (!is_int($arFields['SORT'])) {
             if (intval($arFields['SORT'])) {
                 $arFields['SORT'] = intval($arFields['SORT']);
             } else {
                 $arFields['SORT'] = 500;
             }
         }
     } else {
         $arFields['SORT'] = 500;
     }
     # default
     $arDefaultValues = array('MULTIPLE' => false, 'IS_REQUIRED' => false, 'ACTIVE' => true, 'PROPERTY_TYPE' => 'S', 'USER_TYPE' => false, 'FILE_TYPE' => '', 'LIST_TYPE' => 'L', 'ROW_COUNT' => 1, 'COL_COUNT' => 30, 'LINK_IBLOCK_ID' => null, 'DEFAULT_VALUE' => null, 'WITH_DESCRIPTION' => 'N', 'SEARCHABLE' => 'N', 'FILTRABLE' => 'N', 'MULTIPLE_CNT' => 5, 'HINT' => '', 'SECTION_PROPERTY' => 'Y', 'SMART_FILTER' => 'N', 'USER_TYPE_SETTINGS' => array(), 'VALUES' => array());
     if ($arFields['IBLOCK_CODE']) {
         unset($arFields['IBLOCK_ID']);
         $rsIBlock = $iblock->GetList(array(), array('CODE' => $arFields['IBLOCK_CODE'], 'CHECK_PERMISSIONS' => 'N'));
         if ($arIBlock = $rsIBlock->Fetch()) {
             $arFields['IBLOCK_ID'] = $arIBlock['ID'];
         } else {
             throw new BimException(__METHOD__ . ' Not found iblock with code ' . $arFields['IBLOCK_CODE']);
         }
     }
     if (!strlen($arFields['CODE'])) {
         throw new BimException(__METHOD__ . ' Not found property code');
     }
     $iblockPropDbRes = \CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $arFields['IBLOCK_ID'], 'CODE' => $arFields['CODE']));
     if ($iblockPropDbRes !== false && $iblockPropDbRes->SelectedRowsCount()) {
         throw new BimException(__METHOD__ . 'Property with code = "' . $arFields['CODE'] . '" ');
     }
     if ($arFields['LINK_IBLOCK_CODE']) {
         unset($arFields['LINK_IBLOCK_ID']);
         $rsIBlock = $iblock->GetList(array(), array('CODE' => $arFields['LINK_IBLOCK_CODE'], 'CHECK_PERMISSIONS' => 'N'));
         if ($arIBlock = $rsIBlock->Fetch()) {
             $arFields['LINK_IBLOCK_ID'] = $arIBlock['ID'];
         }
     }
     foreach ($arDefaultValues as $DefaultName => $DefaultValue) {
         if (!isset($arFields[$DefaultName]) || empty($arFields[$DefaultName])) {
             $arFields[$DefaultName] = $DefaultValue;
         }
     }
     $objCIBlockProperty = new \CIBlockProperty();
     unset($arFields['ID']);
     $iId = $objCIBlockProperty->Add($arFields);
     if ($iId) {
         return $iId;
     } else {
         throw new BimException(__METHOD__ . ' ' . $objCIBlockProperty->LAST_ERROR);
     }
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:59,代码来源:IblockPropertyIntegrate.php


示例3: __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


示例4: onPrepareComponentParams

 public function onPrepareComponentParams($params)
 {
     $this->arIBlock = CIBlock::GetArrayByID($params["IBLOCK_ID"]);
     $this->arResult["IBLOCK"] = htmlspecialcharsex($this->arIBlock);
     $this->arResult["IBLOCK_ID"] = $this->arIBlock["ID"];
     $this->arResult["GRID_ID"] = "lists_list_elements_" . $this->arResult["IBLOCK_ID"];
     $this->arResult["ANY_SECTION"] = isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0;
     $this->arResult["SECTIONS"] = array();
     $this->arResult["SECTION_ID"] = false;
     $this->arResult["LIST_SECTIONS"] = array();
     if (isset($_GET["list_section_id"])) {
         $sectionId = intval($_GET["list_section_id"]);
     } else {
         $sectionId = intval($params["SECTION_ID"]);
     }
     $rsSections = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $this->arIBlock["ID"], "GLOBAL_ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"));
     while ($arSection = $rsSections->GetNext()) {
         $this->arResult["SECTIONS"][$arSection["ID"]] = array("ID" => $arSection["ID"], "NAME" => $arSection["NAME"]);
         if ($arSection["ID"] == $sectionId) {
             $this->arResult["SECTION"] = $arSection;
             $this->arResult["SECTION_ID"] = $arSection["ID"];
         }
         $this->arResult["LIST_SECTIONS"][$arSection["ID"]] = str_repeat(" . ", $arSection["DEPTH_LEVEL"]) . $arSection["NAME"];
     }
     return $params;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:class.php


示例5: storeResult

function storeResult($arResult, $arParams) {
    $iblock = CIBlock::GetList(
        array(),
        array(
            'TYPE' => $arParams['IBLOCK_TYPE'],
            'CODE' => $arParams['IBLOCK_CODE'],
        )
    );
    $iblock = $iblock->Fetch();
    
    $el = new CIBlockElement;

    $props = array();
    foreach ($arResult['FIELDS_LIST'] as $arField) {
        if ($arField['FIELD_TYPE'] == 'TEXT' || $arField['FIELD_TYPE'] == 'NUMBER') {
            $props[$arField['CODE']] = array(
                'VALUE' => $arResult['POST_DATA']['~'.$arField['CODE']],
            );
        } elseif ($arField['FIELD_TYPE'] == 'TEXTAREA') {
            $props[$arField['CODE']] = array(
                'VALUE' => array(
                    'TYPE' => 'text',
                    'TEXT' => $arResult['POST_DATA']['~'.$arField['CODE']],
                ),
            );
        } elseif ($arField['FIELD_TYPE'] == 'LIST') {
            $propEnum = CIBlockPropertyEnum::GetList(
                array(),
                array(
                    'XML_ID' => $arResult['POST_DATA']['~'.$arField['CODE']],
                    'CODE' => $arField['CODE'],
                    'IBLOCK_ID' => $iblock['ID'],
                )
            );
            $propEnum = $propEnum->Fetch();
            if ( ! $propEnum) return false;

            $props[$arField['CODE']] = array(
                'VALUE' => $propEnum['ID'],
            );
        }
    }

    $res = $el->Add(array(
        'IBLOCK_TYPE' => $arParams['IBLOCK_TYPE'],
        'IBLOCK_ID' => $iblock['ID'],
        'ACTIVE' => 'Y',
        'PROPERTY_VALUES' => $props,
        'ACTIVE_FROM' => ConvertTimeStamp(time()+CTimeZone::GetOffset(), 'FULL'),
        'NAME' => 'Form result', # !!! NEED TO REPLACE TO DEFAULT VALUE
    ));

    if (!$res) {
        return array(
            'MESSAGE' => $el->LAST_ERROR,
        );
    }

    return true;
}
开发者ID:ASDAFF,项目名称:bitrix-advanced-form,代码行数:60,代码来源:store_result.php


示例6: getProductInfo

 /** Returns an array, containing information about the product block on its ID.
  * @param $elementId
  * @return array|string
  */
 public static function getProductInfo($elementId)
 {
     $elementId = intval($elementId);
     $result = "";
     if ($elementId <= 0) {
         return $result;
     }
     $dbProduct = CIBlockElement::GetList(array(), array("ID" => $elementId), false, false, array('ID', 'IBLOCK_ID', 'IBLOCK_SECTION_ID', 'DETAIL_PICTURE', 'PREVIEW_PICTURE', 'NAME', 'XML_ID'));
     while ($arProduct = $dbProduct->GetNext()) {
         $imgCode = "";
         if ($arProduct["IBLOCK_ID"] > 0) {
             $arProduct["EDIT_PAGE_URL"] = CIBlock::GetAdminElementEditLink($arProduct["IBLOCK_ID"], $elementId, array("find_section_section" => $arProduct["IBLOCK_SECTION_ID"]));
         }
         if ($arProduct["DETAIL_PICTURE"] > 0) {
             $imgCode = $arProduct["DETAIL_PICTURE"];
         } elseif ($arProduct["PREVIEW_PICTURE"] > 0) {
             $imgCode = $arProduct["PREVIEW_PICTURE"];
         }
         $arProduct["NAME"] = $arProduct["NAME"];
         $arProduct["DETAIL_PAGE_URL"] = htmlspecialcharsex($arProduct["DETAIL_PAGE_URL"]);
         if ($imgCode > 0) {
             $arFile = CFile::GetFileArray($imgCode);
             $arImgProduct = CFile::ResizeImageGet($arFile, array('width' => 80, 'height' => 80), BX_RESIZE_IMAGE_PROPORTIONAL, false, false);
             $arProduct["IMG_URL"] = $arImgProduct['src'];
         }
         return $arProduct;
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:store_utility.php


示例7: OnSearchGetURL

 function OnSearchGetURL($arFields)
 {
     global $DB, $BX_NEWS_DETAIL_URL, $BX_NEWS_SECTION_URL;
     static $arIBlockCache = array();
     if ($arFields["MODULE_ID"] !== "iblock" || substr($arFields["URL"], 0, 1) !== "=") {
         return $arFields["URL"];
     }
     if (!CModule::IncludeModule('iblock')) {
         return "";
     }
     $IBLOCK_ID = IntVal($arFields["PARAM2"]);
     if (!array_key_exists($IBLOCK_ID, $arIBlockCache)) {
         $res = $DB->Query("\n\t\t\t\tSELECT\n\t\t\t\t\tDETAIL_PAGE_URL,\n\t\t\t\t\tSECTION_PAGE_URL,\n\t\t\t\t\tCODE as IBLOCK_CODE,\n\t\t\t\t\tXML_ID as IBLOCK_EXTERNAL_ID,\n\t\t\t\t\tIBLOCK_TYPE_ID\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock\n\t\t\t\tWHERE ID = " . $IBLOCK_ID . "\n\t\t\t");
         $arIBlockCache[$IBLOCK_ID] = $res->Fetch();
     }
     if (!is_array($arIBlockCache[$IBLOCK_ID])) {
         return "";
     }
     $arFields["URL"] = LTrim($arFields["URL"], " =");
     parse_str($arFields["URL"], $arr);
     $arr = $arIBlockCache[$IBLOCK_ID] + $arr;
     $arr["LANG_DIR"] = $arFields["DIR"];
     if (substr($arFields["ITEM_ID"], 0, 1) !== 'S') {
         return CIBlock::ReplaceDetailUrl($BX_NEWS_DETAIL_URL, $arr, true, "E");
     } else {
         return CIBlock::ReplaceDetailUrl($BX_NEWS_SECTION_URL, $arr, true, "S");
     }
 }
开发者ID:spas-viktor,项目名称:books,代码行数:28,代码来源:newstools.php


示例8: AddProduct

 function AddProduct($NAME)
 {
     $iblock_permission = CIBlock::GetPermission(IBLOCK_ID);
     if ($iblock_permission < "W") {
         $GLOBALS["USER"]->RequiredHTTPAuthBasic();
         return new CSOAPFault('Server Error', 'Unable to authorize user.');
     }
     $code = self::translit($NAME);
     $i = 1;
     while (true) {
         $res = CIBlockElement::Getlist(array(), array("CODE" => $code), false, array("CODE"));
         if ($res->Fetch()) {
             $code = self::translit($NAME) . $i;
         } else {
             break;
         }
         $i++;
     }
     $arFields = array("IBLOCK_ID" => IBLOCK_ID, "NAME" => $NAME);
     $ib_element = new CIBlockElement();
     $result = $ib_element->Add($arFields);
     if ($result > 0) {
         return $result;
     }
     return new CSOAPFault('Server Error', 'Error: ' . $ib_element->LAST_ERROR);
 }
开发者ID:doppler324,项目名称:componentforworkingwithbitrix,代码行数:26,代码来源:HelperProduct.php


示例9: Delete

 /**
  * Delete
  * @param $IblockTypeCode
  * @return bool
  * @throws \Exception
  */
 public static function Delete($IblockTypeCode)
 {
     $Iblock = new \CIBlock();
     $iblockEl = new \CIBlockElement();
     $dbIblock = $Iblock->GetList(array(), array('TYPE' => $IblockTypeCode));
     while ($dbRow = $dbIblock->Fetch()) {
         $iblockElDbRes = $iblockEl->GetList(array(), array('IBLOCK_ID' => $dbRow['ID']));
         if ($iblockElDbRes !== false && $iblockElDbRes->SelectedRowsCount()) {
             throw new BimException('Can not delete iblock type: iblock id =' . $dbRow['ID'] . ' have elements');
         }
     }
     if (!\CIBlockType::Delete($IblockTypeCode)) {
         throw new BimException('Delete iblock type error!');
     }
     return true;
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:22,代码来源:IblockTypeIntegrate.php


示例10: _getIBlockMode

 function _getIBlockMode($ib, $object = false, $object_id = false)
 {
     if ($object === false) {
         $arIBlock = CIBlock::GetArrayByID($ib);
         if ($arIBlock["WORKFLOW"] == "Y") {
             return "WF";
         } elseif ($arIBlock["BIZPROC"] == "Y") {
             return "BP";
         } else {
             return "";
         }
     } else {
         $arFilter = array("IBLOCK_ID" => $ib, "SOCNET_GROUP_ID" => false, "CHECK_PERMISSIONS" => "N", "SECTION_ID" => 0);
         if ($object == "user") {
             $arFilter["CREATED_BY"] = $object_id;
         } else {
             $arFilter["SOCNET_GROUP_ID"] = $object_id;
         }
         $arLibrary = array();
         $db_res = CIBlockSection::GetList(array(), $arFilter, false, array("ID", "UF_USE_BP"));
         if ($db_res && ($arLibrary = $db_res->GetNext())) {
             return $arLibrary["UF_USE_BP"] == "N" ? "" : "BP";
         } else {
             return "";
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:27,代码来源:functions.php


示例11: Init

 function Init(&$next_step, $files_dir, $arParams = array())
 {
     $this->next_step =& $next_step;
     $this->files_dir = $files_dir;
     $this->arParams = $arParams;
     //if (is_array($this->next_step['_TEMPORARY']['DEPARTMENTS']))
     $this->arSectionCache =& $this->next_step['_TEMPORARY']['DEPARTMENTS'];
     $this->DEPARTMENTS_IBLOCK_ID = $this->arParams['DEPARTMENTS_IBLOCK_ID'];
     $this->ABSENCE_IBLOCK_ID = $this->arParams['ABSENCE_IBLOCK_ID'];
     $this->STATE_HISTORY_IBLOCK_ID = $this->arParams['STATE_HISTORY_IBLOCK_ID'];
     $dbRes = CIBlock::GetList(array(), array('TYPE' => $arParams['IBLOCK_TYPE'] ? $arParams['IBLOCK_TYPE'] : 'STRUCTURE', 'ID' => array($this->DEPARTMENTS_IBLOCK_ID, $this->ABSENCE_IBLOCK_ID, $this->STATE_HISTORY_IBLOCK_ID)));
     $bError = false;
     if (intval($dbRes->SelectedRowsCount()) < 3) {
         if (ToUpper($GLOBALS['DBType']) != 'MYSQL') {
             $i = 0;
             while ($arRes = $dbRes->Fetch()) {
                 $i++;
             }
             $bError = $i < 3;
         } else {
             $bError = true;
         }
     }
     if ($bError) {
         $GLOBALS['APPLICATION']->ThrowException(GetMessage('IBLOCK_XML2_USER_ERROR_IBLOCK_MISSING'));
         return false;
     }
     $def_group = COption::GetOptionString("main", "new_user_registration_def_group", "");
     if ($def_group != "") {
         $this->arUserGroups = explode(",", $def_group);
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:cml2.php


示例12: onPrepareComponentParams

 public function onPrepareComponentParams($params)
 {
     $this->arIBlock = CIBlock::GetArrayByID($params["IBLOCK_ID"]);
     $this->arResult["IBLOCK"] = htmlspecialcharsex($this->arIBlock);
     $this->arResult["IBLOCK_ID"] = $this->arIBlock["ID"];
     $this->arResult["GRID_ID"] = "lists_list_elements_" . $this->arResult["IBLOCK_ID"];
     $this->arResult["ANY_SECTION"] = isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0;
     $this->arResult["SECTIONS"] = array();
     $this->arResult["SECTION_ID"] = false;
     $this->arResult["LIST_SECTIONS"] = array();
     if (isset($_GET["list_section_id"])) {
         $sectionId = intval($_GET["list_section_id"]);
     } else {
         $sectionId = intval($params["SECTION_ID"]);
     }
     $rsSections = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $this->arIBlock["ID"], "GLOBAL_ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"));
     while ($arSection = $rsSections->GetNext()) {
         $this->arResult["SECTIONS"][$arSection["ID"]] = array("ID" => $arSection["ID"], "NAME" => $arSection["NAME"]);
         if ($arSection["ID"] == $sectionId) {
             $this->arResult["SECTION"] = $arSection;
             $this->arResult["SECTION_ID"] = $arSection["ID"];
         }
         $this->arResult["LIST_SECTIONS"][$arSection["ID"]] = str_repeat(" . ", $arSection["DEPTH_LEVEL"]) . $arSection["NAME"];
     }
     $this->arResult["IS_SOCNET_GROUP_CLOSED"] = false;
     if (intval($params["~SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork")) {
         $arSonetGroup = CSocNetGroup::GetByID(intval($params["~SOCNET_GROUP_ID"]));
         if (is_array($arSonetGroup) && $arSonetGroup["CLOSED"] == "Y" && !CSocNetUser::IsCurrentUserModuleAdmin() && ($arSonetGroup["OWNER_ID"] != $GLOBALS["USER"]->GetID() || COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y")) {
             $this->arResult["IS_SOCNET_GROUP_CLOSED"] = true;
         }
     }
     return $params;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:33,代码来源:class.php


示例13: __wd_get_root_section

 function __wd_get_root_section($IBLOCK_ID, $object, $object_id)
 {
     $result = CIBlockWebdavSocnet::GetSectionID($IBLOCK_ID, $object, $object_id);
     if (intval($result) > 0) {
         return $result;
     } else {
         __wd_check_uf_use_bp_property($arParams["IBLOCK_ID"]);
         $arFields = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE" => "Y", "SOCNET_GROUP_ID" => false, "IBLOCK_SECTION_ID" => 0, "UF_USE_BP" => "N");
         if ($object == "user") {
             $dbUser = CUser::GetByID($object_id);
             $arUser = $dbUser->Fetch();
             $arFields["NAME"] = trim($arUser['LAST_NAME'] . " " . $arUser['FIRST_NAME']);
             $arFields["NAME"] = trim(!empty($arFields["NAME"]) ? $arFields["NAME"] : $arUser['LOGIN']);
             $arFields['CREATED_BY'] = $arUser['ID'];
             $arFields['MODIFIED_BY'] = $arUser['ID'];
             if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") {
                 $arTasks = CWebDavIblock::GetTasks();
                 $arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'U' . $object_id, 'TASK_ID' => $arTasks['X']));
             }
         } else {
             /*		$res = CSocNetGroup::GetByID($arResult["VARIABLES"]["group_id"]);
             				if (!$res)
             				{
             					$arParams["ERROR_MESSAGE"] = GetMessage("SONET_GROUP_NOT_EXISTS");
             					return 0;
             				} */
             $arFields["SOCNET_GROUP_ID"] = $object_id;
             //$arGroup = CSocNetGroup::GetByID($object_id);
             $arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $object_id;
             $dbGroup = CSocNetGroup::GetList(array(), array("ID" => (int) $object_id), false, false, array("ID", "SITE_ID", "NAME"));
             if ($arGroup = $dbGroup->Fetch()) {
                 $arFields["NAME"] = GetMessage("SONET_GROUP_PREFIX") . $arGroup["NAME"];
             }
             if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E") {
                 $arTasks = CWebDavIblock::GetTasks();
                 $arFields['RIGHTS'] = array('n0' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_A', 'TASK_ID' => $arTasks['X']), 'n1' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_E', 'TASK_ID' => $arTasks['W']), 'n2' => array('GROUP_CODE' => 'SG' . $arFields["SOCNET_GROUP_ID"] . '_K', 'TASK_ID' => $arTasks['W']));
             }
         }
         if (\Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk')) {
             \Bitrix\Disk\Driver::getInstance()->addGroupStorage($arFields["SOCNET_GROUP_ID"]);
         }
         $GLOBALS["UF_USE_BP"] = $arFields["UF_USE_BP"];
         $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $IBLOCK_ID . "_SECTION", $arFields);
         $bs = new CIBlockSection();
         $sectionID = $bs->Add($arFields);
         if (!$sectionID) {
             $arParams["ERROR_MESSAGE"] = $bs->LAST_ERROR;
             return 0;
         }
         WDClearComponentCache(array("webdav.element.edit", "webdav.element.hist", "webdav.element.upload", "webdav.element.view", "webdav.menu", "webdav.section.edit", "webdav.section.list"));
         return true;
         /*
         	if ($ob->workflow == 'bizproc')
         	{
         		__wd_create_default_bp_user_and_groups($arBizProcParameters);
         	}
         */
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:59,代码来源:webdav_settings.php


示例14: DeleteByIBlock

	public static function DeleteByIBlock($IBLOCK_ID)
	{
		global $DB;
		$IBLOCK_ID = intval($IBLOCK_ID);
		$DB->Query("DELETE FROM b_iblock_section_property WHERE IBLOCK_ID = ".$IBLOCK_ID);
		$DB->Query("UPDATE b_iblock SET SECTION_PROPERTY = 'N' WHERE ID = ".$IBLOCK_ID);
		CIBlock::CleanCache($IBLOCK_ID);
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:8,代码来源:section_property.php


示例15: showIblockListSelect

 static function showIblockListSelect()
 {
     $res = CIBlock::GetList(array("ID" => "ASC"), array(), false);
     echo '<select name="IBLOCK_ID">';
     while ($ar_res = $res->Fetch()) {
         echo "<option value='{$ar_res['ID']}'>[{$ar_res['ID']}] {$ar_res['NAME']}</option>";
     }
     echo '</select>';
 }
开发者ID:ASDAFF,项目名称:bitrix-modules-iblocktools,代码行数:9,代码来源:formsHelper.php


示例16: _getIblocks

/**
 * Собирает массив индентификаторов инфоблоков CODE => ID
 * @return array Массив идентификаторов инфоблоков в виде array(CODE => ID)
 */
function _getIblocks()
{
    $resIblocks = \CIBlock::GetList(array('ID' => 'ASC'), array());
    $arIb = array();
    while ($ar = $resIblocks->Fetch()) {
        $arIb[$ar['CODE']] = $ar['ID'];
    }
    return $arIb;
}
开发者ID:rschweppes,项目名称:bitrix-helpers,代码行数:13,代码来源:getiblocks.php


示例17: getElementLink

 public function getElementLink($aElement)
 {
     static $aIBTypeCache = array();
     if (!isset($aIBTypeCache[$aElement['IBLOCK_ID']])) {
         $aIBTypeCache[$aElement['IBLOCK_ID']] = CIBlock::GetByID($aElement['IBLOCK_ID'])->Fetch();
         $aIBTypeCache[$aElement['IBLOCK_ID']] = $aIBTypeCache[$aElement['IBLOCK_ID']]['IBLOCK_TYPE_ID'];
     }
     return '<a href="/bitrix/admin/iblock_element_edit.php?WF=Y&ID=' . $aElement['ID'] . '&type=' . $aIBTypeCache[$aElement['IBLOCK_ID']] . '&lang=ru&IBLOCK_ID=' . $aElement['IBLOCK_ID'] . '&find_section_section=-1">' . @$aElement['NAME'] . ' </a>';
 }
开发者ID:ASDAFF,项目名称:Bitrix.TagsManager,代码行数:9,代码来源:CTagsManagerDriver_IBlock.class.php


示例18: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $type = $input->getArgument('type');
     \CModule::IncludeModule('iblock');
     $resIBlocks = \CIBlock::GetList(array('NAME' => 'asc'), array('TYPE' => $type));
     while ($arIBlock = $resIBlocks->Fetch()) {
         $output->writeln("<info>" . $arIBlock['NAME'] . " (" . $arIBlock['ID'] . ") </info>");
     }
 }
开发者ID:ASDAFF,项目名称:bitrix-console-tool,代码行数:9,代码来源:IBlockListCommand.php


示例19: GetIdByCode

 /**
  * @param string $code код инфблока
  * @return int ID инфоблока
  */
 public static function GetIdByCode($code)
 {
     $res = CIBlock::GetList(array(), array('TYPE' => 'bizproc_iblockx', 'SITE_ID' => SITE_ID, 'ACTIVE' => 'Y', "CODE" => $code), true);
     if (empty($res)) {
         ShowError("Инфоблок с кодом=" . $code . " не найден");
         return 0;
     }
     $data = $res->GetNext();
     return $data["ID"];
 }
开发者ID:st7art22,项目名称:bitrix,代码行数:14,代码来源:ciblockwrapper.php


示例20: AttachUsersToIBlock


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CIBlockElement类代码示例发布时间:2022-05-23
下一篇:
PHP CI类代码示例发布时间: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