本文整理汇总了PHP中CSite::getDefSite方法的典型用法代码示例。如果您正苦于以下问题:PHP CSite::getDefSite方法的具体用法?PHP CSite::getDefSite怎么用?PHP CSite::getDefSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSite
的用法示例。
在下文中一共展示了CSite::getDefSite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadDataProcesses
protected function loadDataProcesses()
{
$this->arResult['SYSTEM_PROCESSES'] = array();
$this->arResult['USER_PROCESSES'] = array();
try {
$defaultSiteId = CSite::getDefSite();
$iterator = CSite::getByID($defaultSiteId);
$site = $iterator->fetch();
$defaultLang = $site ? $site['LANGUAGE_ID'] : 'en';
if ($defaultLang == 'ua') {
$defaultLang = 'ru';
}
\Bitrix\Lists\Importer::loadDataProcesses($defaultLang, true, $this->arResult['SYSTEM_PROCESSES']);
\Bitrix\Lists\Importer::loadDataProcesses($defaultLang, false, $this->arResult['USER_PROCESSES']);
$this->checkForIblock($this->arResult['SYSTEM_PROCESSES']);
$this->checkForIblock($this->arResult['USER_PROCESSES']);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
if (empty($this->arResult['SYSTEM_PROCESSES']) && empty($this->arResult['USER_PROCESSES'])) {
$this->errors[] = Loc::getMessage('CC_LCP_NOT_PROCESSES');
}
}
示例2: getUserStorageId
/**
* @return array
* @throws Exception
*/
protected function getUserStorageId()
{
if ($this->enableDiskModule) {
$storage = \Bitrix\Disk\Driver::getInstance()->getStorageByUserId($this->getUser()->getId());
if (!$storage) {
$storage = \Bitrix\Disk\Driver::getInstance()->addUserStorage($this->getUser()->getId());
}
if ($storage) {
return array('IBLOCK_ID' => $storage->getId(), 'IBLOCK_SECTION_ID' => $storage->getRootObjectId());
}
}
$userFilesOptions = COption::getOptionString('webdav', 'user_files', null);
if ($userFilesOptions == null) {
throw new Exception('Where are options "user_files"?');
}
$userFilesOptions = unserialize($userFilesOptions);
$iblockId = $userFilesOptions[CSite::getDefSite()]['id'];
$userSectionId = CWebDavIblock::getRootSectionIdForUser($iblockId, $this->getUser()->getId());
if (!$userSectionId) {
throw new Exception('Wrong section for user ' . $this->getUser()->getLastName());
}
return array('IBLOCK_ID' => $iblockId, 'IBLOCK_SECTION_ID' => $userSectionId);
}