- Модуль: intranet
- Путь к файлу: ~/bitrix/modules/intranet/lib/integration/templates/bitrix24/themepicker.php
- Класс: BitrixIntranetIntegrationTemplatesBitrix24ThemePicker
- Вызов: ThemePicker::setDefaultTheme
public function setDefaultTheme($themeId, $currentUserId = 0): bool
{
if (
!$this->isValidTheme($themeId)
|| $this->getEntityType() !== self::ENTITY_TYPE_USER
)
{
return false;
}
$currentUserId = (int)$currentUserId;
if ($currentUserId <= 0)
{
$currentUserId = (is_object($GLOBALS["USER"]) ? (int)$GLOBALS["USER"]->getID() : 0);
}
if ($currentUserThemeFields = ThemeTable::getList([
'filter' => [
'=USER_ID' => $currentUserId,
'=ENTITY_TYPE' => $this->getEntityType(),
'=ENTITY_ID' => $currentUserId,
'=CONTEXT' => $this->getContext(),
],
'select' => [ 'ID' ]
])->fetch())
{
ThemeTable::delete($currentUserThemeFields['ID']);
}
return ThemeTable::set([
'THEME_ID' => $themeId,
'USER_ID' => $currentUserId,
'ENTITY_TYPE' => $this->getEntityType(),
'ENTITY_ID' => 0,
'CONTEXT' => $this->getContext(),
]);
}