当前位置: 首页>>代码示例>>PHP>>正文


PHP CIBlockType::GetByID方法代码示例

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


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

示例1: check

 public static function check($type, $data = false)
 {
     $data = self::canonizeData($type, $data);
     $type = trim($data['ID']);
     $result = \CIBlockType::GetByID($type);
     $cdata = $result->Fetch();
     if ($cdata) {
         $cdata['LANG'] = array();
         foreach (array_keys(\TAO::getLangs()) as $lang) {
             $l = \CIBlockType::GetByIDLang($type, $lang);
             $cdata['LANG'][$lang] = array('NAME' => $l['NAME'], 'ELEMENT_NAME' => $l['ELEMENT_NAME'], 'SECTION_NAME' => $l['SECTION_NAME']);
         }
         $cdata = \TAO::mergeArgs($cdata, $data);
         self::updateType($cdata);
     } else {
         self::addNewType($data);
     }
 }
开发者ID:techart,项目名称:bitrix.tao,代码行数:18,代码来源:type.php

示例2: CheckIBlockTypeID

function CheckIBlockTypeID($strIBlockTypeID, $strNewIBlockTypeID, $strNeedAdd)
{
    $arResult = false;
    $strNeedAdd = 'Y' == $strNeedAdd ? 'Y' : 'N';
    $strNewIBlockTypeID = trim($strNewIBlockTypeID);
    $strIBlockTypeID = trim($strIBlockTypeID);
    if ('Y' == $strNeedAdd) {
        $obIBlockType = new CIBlockType();
        if ('' != $strNewIBlockTypeID) {
            $rsIBlockTypes = CIBlockType::GetByID($strNewIBlockTypeID);
            if ($arIBlockType = $rsIBlockTypes->Fetch()) {
                $arResult = array('RESULT' => 'OK', 'VALUE' => $strNewIBlockTypeID);
            } else {
                $arFields = array('ID' => $strNewIBlockTypeID, 'SECTIONS' => 'N', 'IN_RSS' => 'N', 'SORT' => 500);
                $rsLanguages = CLanguage::GetList($by = "sort", $order = "desc", array('ACTIVE' => 'Y'));
                while ($arLanguage = $rsLanguages->Fetch()) {
                    $arFields['LANG'][$arLanguage['LID']]['NAME'] = $strNewIBlockTypeID;
                }
                $mxOffersType = $obIBlockType->Add($arFields);
                if (false == $mxOffersType) {
                    $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => $obIBlockType->LAST_ERROR);
                } else {
                    $arResult = array('RESULT' => 'OK', 'VALUE' => $strNewIBlockTypeID);
                }
            }
        } else {
            $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => GetMessage('IB_E_OF_ERR_NEW_IBLOCK_TYPE_ABSENT'));
        }
    } else {
        if ('' == $strIBlockTypeID) {
            $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => GetMessage('IB_E_OF_ERR_IBLOCK_TYPE_ABSENT'));
        } else {
            $rsIBlockTypes = CIBlockType::GetByID($strIBlockTypeID);
            if (!($arIBlockType = $rsIBlockTypes->Fetch())) {
                $arResult = array('RESULT' => 'ERROR', 'MESSAGE' => GetMessage('IB_E_OF_ERR_IBLOCK_TYPE_BAD'));
            } else {
                $arResult = array('RESULT' => 'OK', 'VALUE' => $strIBlockTypeID);
            }
        }
    }
    return $arResult;
}
开发者ID:Satariall,项目名称:izurit,代码行数:42,代码来源:iblock_edit.php

示例3: CheckIBlockType

function CheckIBlockType($ID, $SECTIONS = "Y")
{
    $obType = new CIBlockType();
    $rsType = $obType->GetByID($ID);
    if ($arType = $rsType->Fetch()) {
        return $arType["ID"];
    } else {
        $arFields = array("ID" => $ID, "SECTIONS" => $SECTIONS, "LANG" => array());
        $rsLanguages = CLanguage::GetList($by = "sort", $order = "asc");
        while ($arLanguage = $rsLanguages->Fetch()) {
            $MY_MESS = IncludeModuleLangFile(__FILE__, $arLanguage["LID"], true);
            $arFields["LANG"][$arLanguage["LID"]] = array("NAME" => $MY_MESS["IBLOCK_INSTALL_" . strtoupper($ID) . "_NAME"], "SECTION_NAME" => $MY_MESS["IBLOCK_INSTALL_" . strtoupper($ID) . "_SECTIONS_NAME"], "ELEMENT_NAME" => $MY_MESS["IBLOCK_INSTALL_" . strtoupper($ID) . "_ELEMENTS_NAME"]);
        }
        $result = $obType->Add($arFields);
        if ($result) {
            return $result;
        } else {
            return false;
        }
    }
}
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:step2.php

示例4: applySnapshot

 public function applySnapshot($data, $dbVersion = null)
 {
     $iblockData = $this->handleNullValues($data['iblock']);
     $typeData = $this->handleNullValues($data['type']);
     $res = new ApplyResult();
     $type = new \CIBlockType();
     if (!\CIBlockType::GetByID($typeData['ID'])->Fetch()) {
         $res->setSuccess($type->Add($typeData));
     } else {
         $res->setSuccess($type->Update($typeData['ID'], $typeData));
     }
     if (!$res->isSuccess()) {
         return $res->setMessage($type->LAST_ERROR);
     }
     $extId = $iblockData['ID'];
     if ($dbVersion) {
         $id = $this->getCurrentVersionId($extId, $dbVersion);
     } else {
         $id = $extId;
     }
     if (!$dbVersion && !IblockTable::getById($id)->fetch()) {
         $addRes = IblockTable::add(array('ID' => $id, 'IBLOCK_TYPE_ID' => $typeData['ID'], 'NAME' => 'add'));
         if (!$addRes->isSuccess()) {
             throw new \Exception('add iblock error ' . implode(', ', $addRes->getErrorMessages()));
         }
     }
     $iblock = new \CIBlock();
     if ($id && ($currentData = IblockTable::getById($id)->fetch())) {
         $iblockData['PICTURE'] = $currentData['PICTURE'];
         $res->setSuccess((bool) $iblock->Update($id, $iblockData));
     } else {
         unset($iblockData['PICTURE']);
         $res->setSuccess((bool) ($id = $iblock->Add($iblockData)));
         $this->registerCurrentVersionId($id, $this->getReferenceValue($extId, $dbVersion));
     }
     $res->setId($id);
     return $res->setMessage($iblock->LAST_ERROR);
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:38,代码来源:iblockhandler.php

示例5: Rel2Abs

 }
 if (strlen($DATA_FILE_NAME) <= 0) {
     if (strlen($URL_FILE_1C) > 0) {
         $URL_FILE_1C = Rel2Abs("/", $URL_FILE_1C);
         if (file_exists($_SERVER["DOCUMENT_ROOT"] . $URL_FILE_1C) && is_file($_SERVER["DOCUMENT_ROOT"] . $URL_FILE_1C)) {
             $DATA_FILE_NAME = $_SERVER["DOCUMENT_ROOT"] . $URL_FILE_1C;
         }
     }
 }
 if (strlen($DATA_FILE_NAME) <= 0) {
     $strImportErrorMessage .= GetMessage("CICML_NO_LOAD_FILE") . "<br>";
 }
 global $IBLOCK_TYPE_ID;
 $IBLOCK_TYPE_ID = trim(strval($IBLOCK_TYPE_ID));
 if (0 < strlen($IBLOCK_TYPE_ID)) {
     $rsIBlockTypes = CIBlockType::GetByID($IBLOCK_TYPE_ID);
     if (!($arIBlockType = $rsIBlockTypes->Fetch())) {
         $IBLOCK_TYPE_ID = '';
     }
 }
 if (strlen($IBLOCK_TYPE_ID) <= 0) {
     $IBLOCK_TYPE_ID = COption::GetOptionString("catalog", "default_catalog_1c", "");
 }
 if (strlen($IBLOCK_TYPE_ID) <= 0) {
     ClearVars('f_');
     $iblocks = CIBlockType::GetList(array('SORT' => 'ASC'));
     if ($iblocks->ExtractFields("f_")) {
         $IBLOCK_TYPE_ID = $f_ID;
     }
 }
 if (strlen($IBLOCK_TYPE_ID) <= 0) {
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:commerceml_g_run.php

示例6: CheckFields

 public function CheckFields(&$arFields, $ID = false)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     $this->LAST_ERROR = "";
     $NAME = isset($arFields["NAME"]) ? $arFields["NAME"] : "";
     if (($ID === false || array_key_exists("NAME", $arFields)) && strlen($NAME) <= 0) {
         $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_NAME") . "<br>";
     }
     if ($ID === false && !is_set($arFields, "IBLOCK_TYPE_ID")) {
         $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_BLOCK_TYPE") . "<br>";
     }
     if ($ID === false) {
         //For new record take default values
         $WORKFLOW = array_key_exists("WORKFLOW", $arFields) ? $arFields["WORKFLOW"] : "Y";
         $BIZPROC = array_key_exists("BIZPROC", $arFields) ? $arFields["BIZPROC"] : "N";
     } else {
         //For existing one read old values
         $arIBlock = CIBlock::GetArrayByID($ID);
         $WORKFLOW = array_key_exists("WORKFLOW", $arFields) ? $arFields["WORKFLOW"] : $arIBlock["WORKFLOW"];
         $BIZPROC = array_key_exists("BIZPROC", $arFields) ? $arFields["BIZPROC"] : $arIBlock["BIZPROC"];
         if ($BIZPROC != "Y") {
             $BIZPROC = "N";
         }
         //This is cache compatibility issue
     }
     if ($WORKFLOW == "Y" && $BIZPROC == "Y") {
         $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_WORKFLOW_AND_BIZPROC") . "<br>";
     }
     if (is_set($arFields, "IBLOCK_TYPE_ID")) {
         $r = CIBlockType::GetByID($arFields["IBLOCK_TYPE_ID"]);
         if (!$r->Fetch()) {
             $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_BLOCK_TYPE_ID") . "<br>";
         }
     }
     if (is_array($arFields["PICTURE"]) && array_key_exists("bucket", $arFields["PICTURE"]) && is_object($arFields["PICTURE"]["bucket"])) {
         //This is trusted image from xml import
     } elseif (isset($arFields["PICTURE"]) && is_array($arFields["PICTURE"]) && isset($arFields["PICTURE"]["name"])) {
         $error = CFile::CheckImageFile($arFields["PICTURE"]);
         if (strlen($error) > 0) {
             $this->LAST_ERROR .= $error . "<br>";
         }
     }
     if ($ID === false && !is_set($arFields, "LID") || is_set($arFields, "LID") && (is_array($arFields["LID"]) && count($arFields["LID"]) <= 0 || !is_array($arFields["LID"]) && strlen($arFields["LID"]) <= 0)) {
         $this->LAST_ERROR .= GetMessage("IBLOCK_BAD_SITE_ID_NA") . "<br>";
     } elseif (is_set($arFields, "LID")) {
         if (!is_array($arFields["LID"])) {
             $arFields["LID"] = array($arFields["LID"]);
         }
         foreach ($arFields["LID"] as $v) {
             $r = CSite::GetByID($v);
             if (!$r->Fetch()) {
                 $this->LAST_ERROR .= "'" . $v . "' - " . GetMessage("IBLOCK_BAD_SITE_ID") . "<br>";
             }
         }
     }
     $APPLICATION->ResetException();
     if ($ID === false) {
         $db_events = GetModuleEvents("iblock", "OnBeforeIBlockAdd", true);
     } else {
         $arFields["ID"] = $ID;
         $db_events = GetModuleEvents("iblock", "OnBeforeIBlockUpdate", true);
     }
     foreach ($db_events as $arEvent) {
         $bEventRes = ExecuteModuleEventEx($arEvent, array(&$arFields));
         if ($bEventRes === false) {
             if ($err = $APPLICATION->GetException()) {
                 $this->LAST_ERROR .= $err->GetString() . "<br>";
             } else {
                 $APPLICATION->ThrowException("Unknown error");
                 $this->LAST_ERROR .= "Unknown error.<br>";
             }
             break;
         }
     }
     /****************************** QUOTA ******************************/
     if (empty($this->LAST_ERROR) && COption::GetOptionInt("main", "disk_space") > 0) {
         $quota = new CDiskQuota();
         if (!$quota->checkDiskQuota($arFields)) {
             $this->LAST_ERROR = $quota->LAST_ERROR;
         }
     }
     /****************************** QUOTA ******************************/
     if (strlen($this->LAST_ERROR) > 0) {
         return false;
     }
     return true;
 }
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:88,代码来源:iblock.php

示例7: CPHPCache

 $arParams["PHOTO_COMMENTS_TYPE"] = $parent->arParams["PHOTO_COMMENTS_TYPE"];
 $arParams["PHOTO_FORUM_ID"] = $parent->arParams["PHOTO_FORUM_ID"];
 $arParams["PHOTO_BLOG_URL"] = $parent->arParams["PHOTO_BLOG_URL"];
 $arParams["PHOTO_USE_CAPTCHA"] = $parent->arParams["PHOTO_USE_CAPTCHA"];
 if ((strlen($arParams["PHOTO_GROUP_IBLOCK_TYPE"]) <= 0 || intval($arParams["PHOTO_GROUP_IBLOCK_ID"]) <= 0) && CModule::IncludeModule("iblock")) {
     $ttl = 60 * 60 * 24;
     $cache_id = 'sonet_group_photo_iblock_' . SITE_ID;
     $cache_dir = '/bitrix/sonet_group_photo_iblock';
     $obCache = new CPHPCache();
     if ($obCache->InitCache($ttl, $cache_id, $cache_dir)) {
         $cacheData = $obCache->GetVars();
         $arParams["PHOTO_GROUP_IBLOCK_TYPE"] = $cacheData["PHOTO_GROUP_IBLOCK_TYPE"];
         $arParams["PHOTO_GROUP_IBLOCK_ID"] = $cacheData["PHOTO_GROUP_IBLOCK_ID"];
         unset($cacheData);
     } else {
         $rsIBlockType = CIBlockType::GetByID("photos");
         if ($arIBlockType = $rsIBlockType->Fetch()) {
             $rsIBlock = CIBlock::GetList(array("SORT" => "ASC"), array("IBLOCK_TYPE" => $arIBlockType["ID"], "CODE" => array("group_photogallery", "group_photogallery_" . SITE_ID), "ACTIVE" => "Y", "SITE_ID" => SITE_ID));
             if ($arIBlock = $rsIBlock->Fetch()) {
                 $arParams["PHOTO_GROUP_IBLOCK_TYPE"] = $arIBlock["IBLOCK_TYPE_ID"];
                 $arParams["PHOTO_GROUP_IBLOCK_ID"] = $arIBlock["ID"];
             }
         }
         if ($obCache->StartDataCache()) {
             $obCache->EndDataCache(array("PHOTO_GROUP_IBLOCK_TYPE" => $arIBlock["IBLOCK_TYPE_ID"], "PHOTO_GROUP_IBLOCK_ID" => $arIBlock["ID"]));
         }
     }
     unset($obCache);
 }
 $arParams["PHOTO_COUNT"] = $parent->arParams["LOG_PHOTO_COUNT"];
 $arParams["PHOTO_THUMBNAIL_SIZE"] = $parent->arParams["LOG_PHOTO_THUMBNAIL_SIZE"];
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例8: CheckIblockType

 private function CheckIblockType()
 {
     if ($arIblockType = CIBlockType::GetByID($this->ModuleIblockType)->Fetch()) {
         $this->arResult["INSTALLATION"]["IBLOCK_TYPE_INSTALL"] = false;
         $this->arResult["INSTALLATION"]["IBLOCK_TYPE_ID"] = $this->ModuleIblockType;
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:7,代码来源:step1.php

示例9: getTestIBlockType

 public function getTestIBlockType()
 {
     if (self::$_arTestIBlockType !== null) {
         return self::$_arTestIBlockType;
     }
     $testIBlockType = 'obx_test_type';
     $rsIBlockType = \CIBlockType::GetByID($testIBlockType);
     self::$_arTestIBlockType = $rsIBlockType->Fetch();
     if (!self::$_arTestIBlockType) {
         $arIBlockTypeFields = array('ID' => $testIBlockType, 'SECTIONS' => 'Y', 'IN_RSS' => 'N', 'SORT' => 1000, 'LANG' => array('en' => array('NAME' => 'OpenBX: Test info blocks', 'SECTION_NAME' => 'Sections', 'ELEMENT_NAME' => 'Elements'), 'ru' => array('NAME' => 'OpenBX: Test info blocks', 'SECTION_NAME' => 'Sections', 'ELEMENT_NAME' => 'Elements')));
         $obBlockType = new \CIBlockType();
         global $DB;
         /** @global \CDatabase $DB */
         $DB->StartTransaction();
         $res = $obBlockType->Add($arIBlockTypeFields);
         if (!$res) {
             $DB->Rollback();
             $this->fail('Error: ' . $obBlockType->LAST_ERROR);
         } else {
             $DB->Commit();
             $rsIBlockType = \CIBlockType::GetByID($testIBlockType);
             self::$_arTestIBlockType = $rsIBlockType->Fetch();
         }
     }
     return self::$_arTestIBlockType;
 }
开发者ID:OpenBX,项目名称:obx.core,代码行数:26,代码来源:testcase.php

示例10: checkParams

 /**
  * Абстрактный метод проверки передаваемых параметров
  *
  * checkParams
  * @param array $params
  * @return mixed|void
  * @throws \Exception
  */
 public function checkParams($params)
 {
     $CIblockType = new \CIBlockType();
     if (!isset($params['iblockTypeId']) || !strlen($params['iblockTypeId'])) {
         throw new BimException('В параметрах не найден iblockTypeId');
     }
     $iblockTypeDbRes = $CIblockType->GetByID($params['iblockTypeId']);
     if ($iblockTypeDbRes === false || !$iblockTypeDbRes->SelectedRowsCount()) {
         throw new BimException('В системе не найден тип инфоблока с id = ' . $params['iblockTypeId']);
     }
     $this->ownerItemDbData = $iblockTypeDbRes->Fetch();
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:20,代码来源:IblockType.php

示例11: genIblocktypeDelete

 /**
  * genIblocktypeDelete
  * @param array $args
  * @param array $options
  */
 public function genIblocktypeDelete(array $args, array $options = array())
 {
     $dialog = new \ConsoleKit\Widgets\Dialog($this->console);
     $iblockTypeId = isset($options['typeId']) ? $options['typeId'] : false;
     if (!$iblockTypeId) {
         $do = true;
         while ($do) {
             $desk = "Put block type id - no default/required";
             $iblockTypeId = $dialog->ask($desk . PHP_EOL . $this->color('[IBLOCK_TYPE_ID]:', \ConsoleKit\Colors::YELLOW), '', false);
             $iblockDbRes = \CIBlockType::GetByID($iblockTypeId);
             if ($iblockDbRes->SelectedRowsCount()) {
                 $do = false;
             } else {
                 $this->error('Iblock with id = "' . $iblockTypeId . '" not exist.');
             }
         }
     }
     # get description options
     $desc = isset($options['d']) ? $options['d'] : "";
     $autoTag = "delete";
     $this->_save($this->generateObject->generateDeleteCode($iblockTypeId), $this->generateObject->generateAddCode($iblockTypeId), $desc, $autoTag);
 }
开发者ID:cjp2600,项目名称:bim-core,代码行数:27,代码来源:GenCommand.php

示例12: defined

            $arMESS[$lang] = $MESS;
        }
        return $arMESS[$lang];
    }
}
$SITE_ID = defined("SITE_ID") && strLen(SITE_ID) > 0 ? SITE_ID : "s1";
$arLangs = array();
$arMess = array();
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
// Get language
$db_res = CLangAdmin::GetList($b = "sort", $o = "asc");
while ($res = $db_res->Fetch()) {
    $arLangs[] = $res["LID"];
}
// 1. Create iblock type
$iblockType = CIBlockType::GetByID("gallery");
if (!($iblockType && $iblockType->Fetch())) {
    $arFields = array('ID' => 'gallery', 'SECTIONS' => 'Y', 'IN_RSS' => 'N', 'SORT' => 100, 'LANG' => array());
    foreach ($arLangs as $lang_id) {
        $res = array('NAME' => GetMessage("P_NAME"), 'SECTION_NAME' => GetMessage("P_SECTION_NAME"), 'ELEMENT_NAME' => GetMessage("P_ELEMENT_NAME"));
        if ($lang_id != LANGUAGE_ID) {
            $arMess[$lang_id] = __GetMessageArray($lang_id);
            $res['NAME'] = trim($arMess[$lang_id]["P_NAME"]);
            $res['SECTION_NAME'] = trim($arMess[$lang_id]["P_SECTION_NAME"]);
            $res['ELEMENT_NAME'] = trim($arMess[$lang_id]["P_ELEMENT_NAME"]);
        }
        $res['NAME'] = !empty($res['NAME']) ? $res['NAME'] : 'Gallery';
        $res['SECTION_NAME'] = !empty($res['SECTION_NAME']) ? $res['SECTION_NAME'] : 'Albums';
        $res['ELEMENT_NAME'] = !empty($res['ELEMENT_NAME']) ? $res['ELEMENT_NAME'] : 'Photos';
        $arFields["LANG"][$lang_id] = $res;
    }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:index.php

示例13: GetContent

    function GetContent($arParams)
    {
        if (!CModule::IncludeModule('iblock')) {
            return false;
        }
        if ($_POST['library_resource_type'] != "folder") {
            //iblock
            $iblock_type = '';
            $iblock_id = 0;
            if ($_POST['library_IBLOCK_TYPE'] != '') {
                $res = CIBlockType::GetByID($_POST['library_IBLOCK_TYPE']);
                if ($res_arr = $res->Fetch()) {
                    $iblock_type = $res_arr["ID"];
                }
                if ($iblock_type != '') {
                    if ($_POST['library_NEW_IBLOCK'] == 'Y') {
                        //new iblock
                        $ib = new CIBlock();
                        $arFields = array("ACTIVE" => "Y", "VERSION" => 1, "LIST_PAGE_URL" => $arParams['path'], "DETAIL_PAGE_URL" => $arParams['path'] . 'element/view/#ID#/', "NAME" => $_POST['library_TITLE'], "IBLOCK_TYPE_ID" => $iblock_type, "LID" => array($arParams['site']), "SORT" => "500", "WORKFLOW" => "N", "BIZPROC" => "N", "SECTION_CHOOSER" => "L");
                        if (is_array($_POST['library_PERMISSION'])) {
                            $arPerm = array();
                            foreach ($_POST['library_PERMISSION'] as $grp => $perm) {
                                if ($perm == 'R' || $perm == 'U' || $perm == 'W') {
                                    $arPerm[$grp] = $perm;
                                }
                                if ($perm == 'U') {
                                    $arFields['BIZPROC'] = 'Y';
                                }
                            }
                            $arFields["GROUP_ID"] = $arPerm;
                        }
                        $iblock_id = $ib->Add($arFields);
                    } elseif (intval($_POST['library_IBLOCK_ID']) > 0) {
                        //existing iblock: need check permissions
                        if (CIBlock::GetPermission($_POST['library_IBLOCK_ID']) >= "X") {
                            $iblock_id = intval($_POST['library_IBLOCK_ID']);
                        }
                    }
                }
            }
            //forum for comments
            $forum_id = 0;
            if ($_POST['library_USE_COMMENTS'] == 'Y') {
                if ($_POST['library_NEW_FORUM'] == 'Y') {
                    CModule::IncludeModule('forum');
                    //new forum
                    $arFields = array("NAME" => GetMessage("library_wizard_forum_name") . " \"" . $_POST['library_TITLE'] . "\"", "SITES" => array($arParams['site'] => $arParams["path"] . "element/view/#PARAM2#/"), "ACTIVE" => "Y", "INDEXATION" => "N", "SORT" => 150, "ALLOW_ANCHOR" => "Y", "ALLOW_BIU" => "Y", "ALLOW_IMG" => "Y", "ALLOW_LIST" => "Y", "ALLOW_QUOTE" => "Y", "ALLOW_CODE" => "Y", "ALLOW_FONT" => "Y", "ALLOW_SMILES" => "Y", "ALLOW_TOPIC_TITLED" => "Y");
                    if (is_array($_POST['library_FORUM_PERMISSION'])) {
                        $arPerm = array();
                        foreach ($_POST['library_FORUM_PERMISSION'] as $grp => $perm) {
                            if ($perm == 'E' || $perm == 'M') {
                                $arPerm[$grp] = $perm;
                            }
                        }
                        $arFields["GROUP_ID"] = $arPerm;
                    }
                    $forum_id = CForumNew::Add($arFields);
                } elseif (intval($_POST['library_FORUM_ID']) > 0) {
                    $forum_id = intval($_POST['library_FORUM_ID']);
                }
            }
            //file size
            $iUploadMaxFilesize = intval(ini_get('upload_max_filesize'));
            $iPostMaxSize = intval(ini_get('post_max_size'));
            $iUploadMaxFilesize = min($iUploadMaxFilesize, $iPostMaxSize);
            //bizproc templates
            if ($_POST['library_NEW_IBLOCK'] == 'Y' && $iblock_id > 0 && CModule::IncludeModule("bizproc")) {
                $documentType = array("webdav", "CIBlockDocumentWebdav", "iblock_" . $iblock_id);
                if (!function_exists("__wd_replace_user_and_groups")) {
                    function __wd_replace_user_and_groups(&$val, $key, $params = array())
                    {
                        if ($key == "MailText") {
                            $val = str_replace("/company/personal/bizproc/{=Workflow:id}/", $params["path"], $val);
                        }
                        return true;
                    }
                }
                if ($handle = opendir($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/bizproc/templates')) {
                    $arr = array("path" => str_replace("//", "/", $arParams["path"] . "/webdav_bizproc_view/{=Document:ID}/"));
                    while (false !== ($file = readdir($handle))) {
                        if (!is_file($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/bizproc/templates/' . $file)) {
                            continue;
                        }
                        $arFields = false;
                        include $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/bizproc/templates/' . $file;
                        array_walk_recursive($arFields["TEMPLATE"], "__wd_replace_user_and_groups", $arr);
                        if ($file == "status.php") {
                            $arFields["AUTO_EXECUTE"] = CBPDocumentEventType::Create;
                        }
                        if (is_array($arFields)) {
                            $arFields["DOCUMENT_TYPE"] = $documentType;
                            $arFields["SYSTEM_CODE"] = $file;
                            if (is_object($GLOBALS['USER'])) {
                                $arFields["USER_ID"] = $GLOBALS['USER']->GetID();
                            }
                            try {
                                CBPWorkflowTemplateLoader::Add($arFields);
                            } catch (Exception $e) {
                            }
                        }
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:template.php

示例14: IblockTypeCreate

 /**
  * @param array $data
  * @param bool $deleteIfExists
  */
 protected function IblockTypeCreate(array $data, $deleteIfExists = false)
 {
     global $DB;
     if (empty(trim($data['ID']))) {
         throw new \Exception('You must set iblock type ID');
     }
     $name = trim($data['ID']);
     $fire = false;
     $res = \CIBlockType::GetByID($name);
     if ($ob = $res->Fetch()) {
         if ($deleteIfExists) {
             $this->IblockTypeDelete($name);
             $fire = true;
         }
     } else {
         $fire = true;
     }
     if ($fire) {
         $obBlocktype = new \CIBlockType();
         $DB->StartTransaction();
         $res = $obBlocktype->Add(array_merge(['ID' => $name, 'SECTIONS' => 'Y', 'IN_RSS' => 'N', 'SORT' => 500], $data));
         if (!$res) {
             $DB->Rollback();
             $error = "Can't create {$name} iblock type";
         } else {
             echo "Add {$name} iblock type\r\n";
         }
         $DB->Commit();
         if (isset($error)) {
             throw new \Exception($error);
         }
     }
     return $name;
 }
开发者ID:marvin255,项目名称:bxmigrate,代码行数:38,代码来源:Coded.php

示例15: CheckIBlockType

 function CheckIBlockType($ID)
 {
     $obType = new CIBlockType();
     $rsType = $obType->GetByID($ID);
     if ($arType = $rsType->Fetch()) {
         return $arType["ID"];
     } else {
         $rsType = $obType->GetByID("1c_catalog");
         if ($arType = $rsType->Fetch()) {
             return $arType["ID"];
         } else {
             $result = $obType->Add(array("ID" => "1c_catalog", "SECTIONS" => "Y", "LANG" => array("ru" => array("NAME" => GetMessage("IBLOCK_XML2_CATALOG_NAME"), "SECTION_NAME" => GetMessage("IBLOCK_XML2_CATALOG_SECTION_NAME"), "ELEMENT_NAME" => GetMessage("IBLOCK_XML2_CATALOG_ELEMENT_NAME")))));
             if ($result) {
                 return $result;
             } else {
                 return false;
             }
         }
     }
 }
开发者ID:nycmic,项目名称:bittest,代码行数:20,代码来源:cml2.php


注:本文中的CIBlockType::GetByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。