本文整理汇总了PHP中CUserOptions::SetOption方法的典型用法代码示例。如果您正苦于以下问题:PHP CUserOptions::SetOption方法的具体用法?PHP CUserOptions::SetOption怎么用?PHP CUserOptions::SetOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUserOptions
的用法示例。
在下文中一共展示了CUserOptions::SetOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetReportCurrencyID
public static function SetReportCurrencyID($currencyID)
{
$currencyID = strval($currencyID);
if (!isset($currencyID[0])) {
$currencyID = CCrmCurrency::GetBaseCurrencyID();
}
if ($currencyID === self::$REPORT_CURRENCY_ID) {
return;
}
self::$REPORT_CURRENCY_ID = $currencyID;
CUserOptions::SetOption('crm', 'report_currency_id', $currencyID);
}
示例2: getCurrentView
/**
* @param $arParams
* @return string
*/
protected function getCurrentView($arParams)
{
$currentView = $arParams['DEFAULT_VIEW'] === 'list' ? 'list' : 'table';
$UserCurrentView = CUserOptions::GetOption('search_structure', 'current_view_' . $arParams['FILTER_NAME']);
if (isset($_REQUEST['current_view']) && $_REQUEST['current_view'] !== $UserCurrentView) {
$currentView = $_REQUEST['current_view'] === 'list' ? 'list' : 'table';
CUserOptions::SetOption('search_structure', 'current_view_' . $arParams['FILTER_NAME'], $currentView);
} elseif ($UserCurrentView) {
$currentView = $UserCurrentView === 'list' ? 'list' : 'table';
}
return $currentView;
}
示例3: SwitchGroupMode
private static function SwitchGroupMode($yn)
{
// Get User Id
$uid = static::GetUserId(false);
if ($uid === false) {
return;
}
if ($yn === 'Y') {
$value = 'Y';
} else {
$value = 'N';
}
CUserOptions::SetOption(static::listModeCategoryName, static::listModeParamName, $value, $bCommon = false, $uid);
}
示例4: CheckMenuUserSections
function CheckMenuUserSections(&$userMenuSectionsOption, $arTitles)
{
if (is_array($userMenuSectionsOption)) {
$isChanged = false;
foreach ($userMenuSectionsOption as $key => $section) {
if (!in_array($section, $arTitles)) {
unset($userMenuSectionsOption[$key]);
$isChanged = true;
}
}
$userMenuSectionsOption = array_unique(array_merge($userMenuSectionsOption, $arTitles));
if ($isChanged) {
CUserOptions::SetOption("bitrix24", "user_menu_sections_" . SITE_ID, $userMenuSectionsOption);
}
}
}
示例5: MenuSaveSettings
function MenuSaveSettings($arParams, $POS)
{
$arUserOptions = CUserOptions::GetOption("socialnetwork", "~menu_" . $arParams["ENTITY_TYPE"] . "_" . $arParams["ENTITY_ID"], false, 0);
if (!is_array($arUserOptions)) {
$arUserOptions = array("FEATURES" => array(), "MAX_ITEMS" => 6);
}
$arNewUserOptions = array("FEATURES" => array(), "MAX_ITEMS" => $arUserOptions["MAX_ITEMS"]);
foreach ($POS as $col => $itemId) {
if (is_array($arUserOptions["FEATURES"][$itemId])) {
$arNewUserOptions["FEATURES"][$itemId] = $arUserOptions["FEATURES"][$itemId];
} else {
$arNewUserOptions["FEATURES"][$itemId] = array();
}
$arNewUserOptions["FEATURES"][$itemId]["INDEX"] = $col;
}
CUserOptions::SetOption("socialnetwork", "~menu_" . $arParams["ENTITY_TYPE"] . "_" . $arParams["ENTITY_ID"], $arNewUserOptions, false, 0);
}
示例6: saveOptions
public function saveOptions($path = "", $arOpts)
{
$result = true;
$opts = self::getOptions();
$arTmp =& $opts;
$arPath = explode("/", $path);
if (is_array($arPath)) {
foreach ($arPath as $pathItem) {
if (!isset($arTmp[$pathItem]) || !is_array($arTmp[$pathItem])) {
$arTmp[$pathItem] = array();
}
$arTmp =& $arTmp[$pathItem];
}
$arTmp = $arOpts;
}
return CUserOptions::SetOption('mobileapp', 'push_options', $opts);
}
示例7: EnsureAllResponsibilityImported
public static function EnsureAllResponsibilityImported($userID, $reset = false)
{
$userID = intval($userID);
if ($userID <= 0) {
$userID = CCrmSecurityHelper::GetCurrentUser();
}
$reset = (bool) $reset;
$optionName = 'sl_subscr_import';
if ($reset || CUserOptions::GetOption('crm', $optionName, 'N', $userID) !== 'Y') {
self::EnsureResponsibilityImported(CCrmOwnerType::Lead, $userID);
self::EnsureResponsibilityImported(CCrmOwnerType::Contact, $userID);
self::EnsureResponsibilityImported(CCrmOwnerType::Company, $userID);
self::EnsureResponsibilityImported(CCrmOwnerType::Deal, $userID);
self::EnsureResponsibilityImported(CCrmOwnerType::Activity, $userID);
CUserOptions::SetOption('crm', $optionName, 'Y', false, $userID);
}
}
示例8: buildElementList
public function buildElementList($iblockId, $columns = array(), $params = array())
{
$this->initializeVars($iblockId);
/** @example */
/*
$columns = array(
'NAME',
'SORT',
'ID',
'PROPERTY_LINK',
); */
$opts = array();
foreach ($columns as $columnCode) {
$opts[] = $this->prepareCode($columnCode);
}
$opts = implode(',', $opts);
$params = array_merge(array('name_prefix' => 'tbl_iblock_element_', 'category' => 'list', 'page_size' => 20, 'order' => 'desc', 'by' => 'id'), $params);
$name = $params['name_prefix'] . md5($this->iblock['IBLOCK_TYPE_ID'] . "." . $iblockId);
$value = array('columns' => $opts, 'order' => $params['order'], 'by' => $params['by'], 'page_size' => $params['page_size']);
\CUserOptions::DeleteOptionsByName($params['category'], $name);
\CUserOptions::SetOption($params['category'], $name, $value, true);
}
示例9: setOnline
public static function setOnline($userId = false, $cache = true)
{
global $USER;
if (!$userId) {
$userId = $USER->GetId();
}
$userId = intval($userId);
if ($userId <= 0) {
return false;
}
if ($cache && $userId == $USER->GetId()) {
if (isset($_SESSION['MOBILE_LAST_ONLINE_' . $userId]) && intval($_SESSION['MOBILE_LAST_ONLINE_' . $userId]) + 60 > time()) {
return false;
}
$_SESSION['MOBILE_LAST_ONLINE_' . $userId] = time();
}
$time = time();
\CUserOptions::SetOption('mobile', 'lastActivityDate', $time, false, $userId);
if (\CModule::IncludeModule("im")) {
\CIMStatus::SetMobile($userId, true);
}
return true;
}
示例10: array
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "SALELEADER"));
$arFields = array();
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "NEWPRODUCT"));
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "CODE" => "SPECIALOFFER"));
while ($arProperty = $dbProperty->GetNext()) {
$arFields["find_el_property_" . $arProperty["ID"]] = "";
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/interface/admin_lib.php";
CAdminFilter::AddPresetToBase(array("NAME" => GetMessage("WIZ_PRECET"), "FILTER_ID" => "tbl_product_admin_" . md5($iblockType . "." . $IBLOCK_CATALOG_ID) . "_filter", "LANGUAGE_ID" => $lang, "FIELDS" => $arFields));
CUserOptions::SetOption("filter", "tbl_product_admin_" . md5($iblockType . "." . $IBLOCK_CATALOG_ID) . "_filter", array("rows" => "find_el_name, find_el_active, find_el_timestamp_from, find_el_timestamp_to"), true);
CAdminFilter::SetDefaultRowsOption("tbl_product_admin_" . md5($iblockType . "." . $IBLOCK_CATALOG_ID) . "_filter", array("miss-0", "IBEL_A_F_PARENT"));
//delete 1c props
$arPropsToDelete = array("CML2_TAXES", "CML2_BASE_UNIT", "CML2_TRAITS", "CML2_ATTRIBUTES", "CML2_ARTICLE", "CML2_BAR_CODE", "CML2_FILES", "CML2_MANUFACTURER", "CML2_PICTURES");
foreach ($arPropsToDelete as $code) {
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_CATALOG_ID, "XML_ID" => $code));
if ($arProperty = $dbProperty->GetNext()) {
CIBlockProperty::Delete($arProperty["ID"]);
}
if ($IBLOCK_OFFERS_ID) {
$dbProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $IBLOCK_OFFERS_ID, "XML_ID" => $code));
if ($arProperty = $dbProperty->GetNext()) {
CIBlockProperty::Delete($arProperty["ID"]);
}
}
}
示例11: LocalRedirect
}
}
$isPost = $_SERVER['REQUEST_METHOD'] === 'POST';
if ($isPost && !check_bitrix_sessid()) {
LocalRedirect($arParams['PATH_TO_REPORT_LIST']);
}
$helperClassName = $arResult['HELPER_CLASS'] = isset($arParams['REPORT_HELPER_CLASS']) ? $arParams['REPORT_HELPER_CLASS'] : '';
if ($isPost && isset($_POST['HELPER_CLASS'])) {
$helperClassName = $arResult['HELPER_CLASS'] = $_POST['HELPER_CLASS'];
}
$ownerId = $arResult['OWNER_ID'] = call_user_func(array($helperClassName, 'getOwnerId'));
// auto create fresh default reports only if some reports alredy exist
$userReportVersion = CUserOptions::GetOption('report', '~U_' . $ownerId, call_user_func(array($helperClassName, 'getFirstVersion')));
$sysReportVersion = call_user_func(array($helperClassName, 'getCurrentVersion'));
if ($sysReportVersion !== $userReportVersion && CheckVersion($sysReportVersion, $userReportVersion)) {
CUserOptions::SetOption('report', '~U_' . $ownerId, $sysReportVersion);
if (CReport::GetCountInt($ownerId) > 0) {
$dReports = call_user_func(array($helperClassName, 'getDefaultReports'));
foreach ($dReports as $moduleVer => $vReports) {
if ($moduleVer !== $userReportVersion && CheckVersion($moduleVer, $userReportVersion)) {
// add fresh vReports
CReport::addFreshDefaultReports($vReports, $ownerId);
}
}
}
}
// create default reports by user request
if ($isPost && !empty($_POST['CREATE_DEFAULT'])) {
$dReports = call_user_func(array($helperClassName, 'getDefaultReports'));
foreach ($dReports as $moduleVer => $vReports) {
CReport::addFreshDefaultReports($vReports, $ownerId);
示例12: setTabsArray
public static function setTabsArray($formId, $arCustomTabs, $common = false, $userID = false)
{
$option = "";
if (is_array($arCustomTabs))
{
foreach($arCustomTabs as $arCustomTabID => $arTab)
{
if (is_array($arTab) && isset($arTab["TAB"]))
{
$option .= $arCustomTabID.'--#--'.$arTab["TAB"];
if (isset($arTab["FIELDS"]) && is_array($arTab["FIELDS"]))
{
foreach ($arTab["FIELDS"] as $arCustomFieldID => $arCustomFieldName)
{
$option .= '--,--'.$arCustomFieldID.'--#--'.$arCustomFieldName;
}
}
}
$option .= '--;--';
}
}
CUserOptions::SetOption("form", $formId, array("tabs" => $option), $common, $userID);
}
示例13: unset
$arGadget["USERDATA"] = $arUserOptions["GADGETS"][$gdid]["USERDATA"];
}
$arGadget["CONTENT"] = BXGadget::GetGadgetContent($arGadget, $arParams);
$arResult["GADGETS"][$gadgetUserSettings["COLUMN"]][$gadgetUserSettings["ROW"]] = $arGadget;
if ($arGadget["FORCE_REDIRECT"]) {
$bForceRedirect = true;
}
} else {
unset($arUserOptions["GADGETS"][$gdid]);
}
}
}
for ($i = 0; $i < $arResult["COLS"]; $i++) {
ksort($arResult["GADGETS"][$i], SORT_NUMERIC);
}
$arResult["GADGETS_LIST"] = array_unique($arResult["GADGETS_LIST"]);
if ($bForceRedirect) {
if ($arParams["MULTIPLE"] == "Y") {
$arUserOptionsTmp[$arParams["DESKTOP_PAGE"]] = $arUserOptions;
$arUserOptions = $arUserOptionsTmp;
}
CUserOptions::SetOption("intranet", "~gadgets_" . $arParams["ID"], $arUserOptions, false, $user_option_id);
LocalRedirect($APPLICATION->GetCurPageParam($arParams["MULTIPLE"] == "Y" ? "dt_page=" . $arParams["DESKTOP_PAGE"] : "", array("dt_page")));
}
}
$APPLICATION->AddHeadScript('/bitrix/js/main/utils.js');
$APPLICATION->AddHeadScript('/bitrix/js/main/popup_menu.js');
$APPLICATION->AddHeadScript('/bitrix/js/main/ajax.js');
$APPLICATION->SetAdditionalCSS('/bitrix/themes/.default/pubstyles.css');
CUtil::InitJSCore(array("ajax"));
$this->IncludeComponentTemplate();
示例14: IsExternalMailAvailable
/**
* duplicate CIMMail::IsExternalMailAvailable()
* for performance reasons
*/
public static function IsExternalMailAvailable()
{
global $USER;
if (!is_object($USER) || !$USER->IsAuthorized()) {
return false;
}
if (!IsModuleInstalled('mail')) {
return false;
}
if (COption::GetOptionString('intranet', 'allow_external_mail', 'Y') != 'Y') {
return false;
}
if (COption::GetOptionString('extranet', 'extranet_site', '') == SITE_ID) {
return false;
}
if (isset($_SESSION['aExtranetUser_' . $USER->GetID()][SITE_ID])) {
if (!$_SESSION['aExtranetUser_' . $USER->GetID()][SITE_ID]) {
return false;
}
} else {
if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
return false;
}
}
if (!IsModuleInstalled('dav')) {
return true;
}
if (COption::GetOptionString('dav', 'exchange_server', '') == '') {
return true;
}
if (COption::GetOptionString('dav', 'agent_mail', 'N') != 'Y') {
return true;
}
if (COption::GetOptionString('dav', 'exchange_use_login', 'Y') == 'Y') {
return false;
}
if (!CUserOptions::GetOption('global', 'davex_mailbox')) {
$arUser = CUser::GetList($by = 'ID', $order = 'ASC', array('ID_EQUAL_EXACT' => $USER->GetID()), array('SELECT' => array('UF_BXDAVEX_MAILBOX'), 'FIELDS' => array('ID')))->Fetch();
CUserOptions::SetOption('global', 'davex_mailbox', empty($arUser['UF_BXDAVEX_MAILBOX']) ? 'N' : 'Y');
}
if (CUserOptions::GetOption('global', 'davex_mailbox') == 'Y') {
return false;
}
return true;
}
示例15: array
break;
case 'calendar_add':
if (!CBXFeatures::IsFeatureEnabled('Calendar')) {
break;
}
$arParams = array('calendar_id' => $_REQUEST['cal'], 'site_id' => $_REQUEST['site_id'], 'from' => $_REQUEST['from'], 'to' => $_REQUEST['to'], 'name' => $_REQUEST['name'], 'absence' => $_REQUEST['absence'], 'cal_set_default' => $_REQUEST['cal_set_default']);
$res = CTimeManCalendar::Add($arParams);
$bReturnRes = is_array($res);
break;
case 'admin_data_report_full':
$bReturnRes = true;
$amount = 30;
$res = array('DEPARTMENTS' => array(), 'USERS' => array(), 'NAV' => array());
$bShowAll = $_REQUEST['show_all'] == 'Y';
CUserOptions::SetOption("timeman.report.weekly", "show_all", $_REQUEST['show_all'], false, $USER->GetID());
CUserOptions::SetOption("timeman.report.weekly", "department_id", intval($_REQUEST['department']), false, $USER->GetID());
$page = intval($_REQUEST['page']);
if ($page <= 0) {
$page = 1;
}
$arAccessUsers = CTimeMan::GetAccess();
if (count($arAccessUsers['READ']) > 0) {
$bCanEditAll = in_array('*', $arAccessUsers['WRITE']);
$date_to = ConvertTimeStamp($_POST["tf"]);
$date_from = ConvertTimeStamp($_POST["ts"]);
$datefomat = CSite::GetDateFormat("SHORT", SITE_ID);
$bCanReadAll = in_array('*', $arAccessUsers['READ']);
$section_id = 0;
if ($_REQUEST['department']) {
$section_id = intval($_REQUEST['department']);
$arFilter['UF_DEPARTMENT'] = CIntranetUtils::GetIBlockSectionChildren(intval($_REQUEST['department']));