public static function GetLastDepartment() { $arLastSelected = CUserOptions::GetOption("socialnetwork", "log_destination", array()); if ( is_array($arLastSelected) && strlen($arLastSelected['department']) > 0 && $arLastSelected['department'] != '"{}"' ) { $arLastSelected = array_reverse(CUtil::JsObjectToPhp($arLastSelected['department'])); } else $arLastSelected = array(); $count = 0; $arDepartment = Array(); foreach ($arLastSelected as $depId) { if ($count < 4) $count++; else break; $arDepartment[$depId] = $depId; } return array_reverse($arDepartment); }
function __InTaskDeleteView($delViewId, $iblockId, $taskType, $ownerId) { $delViewId = IntVal($delViewId); $iblockId = IntVal($iblockId); $ownerId = IntVal($ownerId); if ($delViewId <= 0 || $iblockId <= 0 || $ownerId <= 0) { return ""; } $errorMessage = ""; $userSettingsCategory = "IntranetTasks"; $userSettingsNamePart = "Settings_"; $arUserSettings = CUserOptions::GetOption($userSettingsCategory, $userSettingsNamePart . $delViewId, false, $GLOBALS["USER"]->GetID()); if (!$arUserSettings) { $errorMessage .= GetMessage("INTL_VIEW_NOT_FOUND") . "."; } if (StrLen($errorMessage) <= 0) { if ($arUserSettings["IBLOCK_ID"] != $iblockId || $arUserSettings["TASK_TYPE"] != $taskType || $arUserSettings["OWNER_ID"] != $ownerId) { $errorMessage .= GetMessage("INTL_WRONG_VIEW") . "."; } } if (StrLen($errorMessage) <= 0) { if ($arUserSettings["COMMON"] != "N") { $canModifyCommon = $taskType == 'user' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $ownerId, "tasks", 'modify_common_views') || $taskType == 'group' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $ownerId, "tasks", 'modify_common_views'); if (!$canModifyCommon) { $errorMessage .= GetMessage("INTL_NO_VIEW_PERMS") . "."; } } } if (StrLen($errorMessage) <= 0) { CUserOptions::DeleteOption($userSettingsCategory, $userSettingsNamePart . $delViewId, $arUserSettings["COMMON"] == "Y" ? true : false, $GLOBALS["USER"]->GetID()); } return $errorMessage; }
public static function Show() { IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/interface/prolog_main_admin.php'); $supportFinishDate = COption::GetOptionString('main', '~support_finish_date', ''); if ($supportFinishDate != '' && is_array($aSupportFinishDate = ParseDate($supportFinishDate, 'ymd'))) { $aGlobalOpt = CUserOptions::GetOption("global", "settings", array()); if ($aGlobalOpt['messages']['support'] != 'N') { $supportFinishStamp = mktime(0, 0, 0, $aSupportFinishDate[1], $aSupportFinishDate[0], $aSupportFinishDate[2]); $supportDateDiff = ceil(($supportFinishStamp - time()) / 86400); $sSupportMess = ''; $sSupWIT = " (<span onclick=\"BX.toggle(BX('supdescr'))\" style='border-bottom: 1px dashed #1c91e7; color: #1c91e7; cursor: pointer;'>" . GetMessage("prolog_main_support_wit") . "</span>)"; if ($supportDateDiff >= 0 && $supportDateDiff <= 30) { $sSupportMess = GetMessage("prolog_main_support11", array('#FINISH_DATE#' => GetTime($supportFinishStamp), '#DAYS_AGO#' => $supportDateDiff == 0 ? GetMessage("prolog_main_today") : GetMessage('prolog_main_support_days', array('#N_DAYS_AGO#' => $supportDateDiff)), '#LICENSE_KEY#' => md5(LICENSE_KEY), '#WHAT_IS_IT#' => $sSupWIT, '#SUP_FINISH_DATE#' => GetTime(mktime(0, 0, 0, $aSupportFinishDate[1] + 1, $aSupportFinishDate[0], $aSupportFinishDate[2])))); } elseif ($supportDateDiff < 0 && $supportDateDiff >= -30) { $sSupportMess = GetMessage("prolog_main_support21", array('#FINISH_DATE#' => GetTime($supportFinishStamp), '#DAYS_AGO#' => -$supportDateDiff, '#LICENSE_KEY#' => md5(LICENSE_KEY), '#WHAT_IS_IT#' => $sSupWIT, '#SUP_FINISH_DATE#' => GetTime(mktime(0, 0, 0, $aSupportFinishDate[1] + 1, $aSupportFinishDate[0], $aSupportFinishDate[2])))); } elseif ($supportDateDiff < -30) { $sSupportMess = GetMessage("prolog_main_support31", array('#FINISH_DATE#' => GetTime($supportFinishStamp), '#LICENSE_KEY#' => md5(LICENSE_KEY), '#WHAT_IS_IT#' => $sSupWIT)); } if ($sSupportMess != '') { $sSupportMess .= GetMessage('ACRIT_EXPORTPRO_BUY_LICENCE'); $userOption = CUserOptions::GetOption("main", "admSupInf"); if (mktime() > $userOption["showInformerDate"]) { $prolongUrl = "/bitrix/admin/buy_support.php?lang=" . LANGUAGE_ID; if (!in_array(LANGUAGE_ID, array("ru", "ua")) || IntVal(COption::GetOptionString("main", "~PARAM_PARTNER_ID")) <= 0) { require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/update_client.php"; $prolongUrl = "http://www.acrit-studio.ru/shop/list/lupd/"; } echo BeginNote('style="position: relative; top: -15px;"'); ?> <div style="float: right; padding-left: 50px; margin-top: -5px; text-align: center;"> <a href="<?php echo $prolongUrl; ?> " target="_blank" class="adm-btn adm-btn-save" style="margin-bottom: 4px;"><?php echo GetMessage("prolog_main_support_button_prolong"); ?> </a><br /> <a href="http://www.acrit-studio.ru/market/" target="_blank"><?php echo GetMessage("prolog_main_support_button_prolong_modules"); ?> </a> </div> <?php echo $sSupportMess; ?> <div id="supdescr" style="display: none;"><br /><br /><b><?php echo GetMessage("prolog_main_support_wit_descr1"); ?> </b><hr><?php echo GetMessage("prolog_main_support_wit_descr2"); ?> </div> <?php echo EndNote(); } } } } }
public static function OnUserDelete($ID) { global $DB; if (!CSocNetGroup::__ValidateID($ID)) { return false; } $ID = IntVal($ID); $bSuccess = True; if (!CSocNetGroup::DeleteNoDemand($ID)) { if ($ex = $GLOBALS["APPLICATION"]->GetException()) { $err = $ex->GetString(); } $GLOBALS["APPLICATION"]->ThrowException($err); $bSuccess = false; } if ($bSuccess) { CSocNetUserRelations::DeleteNoDemand($ID); CSocNetUserPerms::DeleteNoDemand($ID); CSocNetUserEvents::DeleteNoDemand($ID); CSocNetMessages::DeleteNoDemand($ID); CSocNetUserToGroup::DeleteNoDemand($ID); CSocNetLogEvents::DeleteNoDemand($ID); CSocNetLog::DeleteNoDemand($ID); CSocNetLogComments::DeleteNoDemand($ID); CSocNetFeatures::DeleteNoDemand($ID); CSocNetSubscription::DeleteEx($ID); CUserOptions::DeleteOption("socialnetwork", "~menu_" . SONET_ENTITY_USER . "_" . $ID, false, 0); } return $bSuccess; }
/** * Deactivates banner for current user by name. * @param string $name Banner name. * @return bool */ public static function deactivate($name) { global $USER; if ($USER->getId() <= 0) { return false; } return \CUserOptions::setOption(Driver::INTERNAL_MODULE_ID, '~banner-offer', array($name => true), false, $USER->getId()); }
function InputTags($sName="", $sValue="", $arSites=array(), $sHTML="", $sId="") { if(!$sId) $sId = GenerateUniqId($sName); TagsShowScript(); $order = class_exists("cuseroptions")? CUserOptions::GetOption("search_tags", "order", "CNT"): "CNT"; return '<input name="'.htmlspecialcharsbx($sName).'" id="'.htmlspecialcharsbx($sId).'" type="text" autocomplete="off" value="'.htmlspecialcharsex($sValue).'" onfocus="'.htmlspecialcharsbx('window.oObject[this.id] = new JsTc(this, '.CUtil::PhpToJSObject($arSites).');').'" '.$sHTML.'/><input type="checkbox" id="ck_'.$sId.'" name="ck_'.htmlspecialcharsbx($sName).'" '.($order=="NAME"? "checked": "").' title="'.GetMessage("SEARCH_TAGS_SORTING_TIP").'">'; }
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); }
/** * @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; }
public static function setOffline($userId = false) { global $USER; if (!$userId) { $userId = $USER->GetId(); } $userId = intval($userId); if ($userId <= 0) { return false; } \CUserOptions::DeleteOption('mobile', 'lastActivityDate', false, $userId); return false; }
private static function isEditMode() { if (isset($_SESSION["SESS_INCLUDE_AREAS"]) && $_SESSION["SESS_INCLUDE_AREAS"]) { return true; } if (isset($_GET["bitrix_include_areas"]) && $_GET["bitrix_include_areas"] == "Y") { return true; } $aUserOpt = CUserOptions::GetOption("global", "settings"); if (isset($aUserOpt["panel_dynamic_mode"]) && $aUserOpt["panel_dynamic_mode"] == "Y") { return true; } return false; }
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); }
public static function getDocumentServiceCode() { static $service = null; if ($service !== null) { return $service; } /** @noinspection PhpParamsInspection */ $userSettings = \CUserOptions::getOption(Driver::INTERNAL_MODULE_ID, 'doc_service', array('default' => '')); if (empty($userSettings['default'])) { $userSettings['default'] = ''; } $service = $userSettings['default']; return $userSettings['default']; }
public function executeComponent() { global $APPLICATION; $this->arParams['LAST_MAIL_CHECK'] = null; $this->arParams['IS_TIME_TO_MAIL_CHECK'] = null; $settedUp = null; if (defined('SKIP_MAIL_CHECK') && SKIP_MAIL_CHECK == true) { $settedUp = false; } if (defined('ADMIN_SECTION') && ADMIN_SECTION == true) { $settedUp = false; } if ($settedUp !== false) { $isMobileInstalled = COption::GetOptionString('main', 'wizard_mobile_installed', 'N', SITE_ID) == 'Y'; $isMobileVersion = strpos($APPLICATION->GetCurPage(), SITE_DIR . 'm/') === 0; if ($isMobileInstalled && $isMobileVersion) { $settedUp = false; } } if ($settedUp !== false) { if (!is_callable(array('CIntranetUtils', 'IsExternalMailAvailable')) || !CIntranetUtils::IsExternalMailAvailable()) { $settedUp = false; } } if ($settedUp !== false) { $lastMailCheck = CUserOptions::GetOption('global', 'last_mail_check_' . SITE_ID, null); if (isset($lastMailCheck) && intval($lastMailCheck) < 0) { $settedUp = false; } } if ($settedUp !== false) { $isTimeToMailCheck = true; if (isset($lastMailCheck)) { $settedUp = true; $isTimeToMailCheck = false; if (intval($lastMailCheck) >= 0) { $checkInterval = COption::GetOptionString('intranet', 'mail_check_period', 10) * 60; $isTimeToMailCheck = time() - intval($lastMailCheck) >= $checkInterval; } } } if ($settedUp !== false) { $this->arParams['LAST_MAIL_CHECK'] = $lastMailCheck; $this->arParams['IS_TIME_TO_MAIL_CHECK'] = $isTimeToMailCheck; } $this->arParams['SETTED_UP'] = $settedUp; $this->includeComponentTemplate(); }
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); } } }
protected function processActionDefault() { if ($this->request->getPost('installDisk')) { \Bitrix\Disk\Desktop::setDesktopDiskInstalled(); $this->sendJsonSuccessResponse(); } if ($this->request->getPost('uninstallDisk')) { \Bitrix\Disk\Desktop::setDesktopDiskUninstalled(); $this->sendJsonSuccessResponse(); } if ($this->request->getPost('reInstallDisk')) { \CUserOptions::setOption('disk', 'DesktopDiskReInstall', true, false, $this->getUser()->getId()); \Bitrix\Disk\Desktop::setDesktopDiskInstalled(); $this->sendJsonSuccessResponse(); } }
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); } }
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); }
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); }
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); }
public static function ShowBlockInfo($top, $bottom, $id) { $aOpt = CUserOptions::GetOption("sysupdate", "hidden_blocks", array()); $s = CUpdateOutput::ShowScript(); $s .= ' <div class="update-block-info"> <table cellspacing="0" cellpadding="0" border="0" class="update-block-info"> <tr class="top"> <td class="left"><div class="empty"></div></td> <td><div class="empty"></div></td> <td class="right"><div class="empty"></div></td> </tr> <tr> <td class="left"><div class="empty"></div></td> <td class="content"> <div class="top"> <table cellspacing="0" width="100%"> <tr> <td class="caption">' . $top . '</td> <td align="right"><a class="button ' . ($aOpt[$id] == "off" ? "button-down" : "button-up") . '" title="' . ($aOpt[$id] == "off" ? GetMessage("SUP_EXPAND") : GetMessage("SUP_COLLAPSE")) . '" href="javascript:void(0);" onclick="ToggleInfo(\'' . $id . '\', this)"></a></td> </tr> </table> </div> <div class="bottom" id="' . $id . '" style="display:' . ($aOpt[$id] == "off" ? "none" : "block") . '">' . $bottom . '</div> </td> <td class="right"><div class="empty"></div></td> </tr> <tr class="bottom"> <td class="left"><div class="empty"></div></td> <td><div class="empty"></div></td> <td class="right"><div class="empty"></div></td> </tr> </table> </div> '; return $s; }
public static function GetTheme($grid_id) { $aOptions = CUserOptions::GetOption("main.interface.grid", $grid_id, array()); if ($aOptions["theme"] == '') { $aGlobalOptions = CUserOptions::GetOption("main.interface", "global", array(), 0); if ($aGlobalOptions["theme_template"][SITE_TEMPLATE_ID] != '') { $theme = $aGlobalOptions["theme_template"][SITE_TEMPLATE_ID]; } else { $theme = ""; } } else { $theme = $aOptions["theme"]; } if ($theme != '') { $theme = preg_replace("/[^a-z0-9_.-]/i", "", $theme); } return $theme; }
if ($arParams['IN_COMPLEX'] == 'Y' && $arParams['SEF_MODE'] == 'Y') { $arParams['PATH_TO_USER'] = $this->GetParent()->arParams['PATH_TO_USER']; } } $arResult['PREVIEW'] = !empty($_POST['preview']) && $_POST['preview'] == 'Y' ? 'Y' : 'N'; $arResult['IMAGE_UPLOAD'] = isset($_GET['image_upload']) || $_POST['do_upload'] ? 'Y' : 'N'; $arResult['INSERT_LINK'] = isset($_GET['insert_link']) ? 'Y' : 'N'; $arResult['INSERT_IMAGE'] = isset($_GET['insert_image']) ? 'Y' : 'N'; $arResult['INSERT_CATEGORY'] = isset($_GET['insert_category']) ? 'Y' : 'N'; $arResult['LOAD_EDITOR'] = isset($_GET['load_editor']) ? 'Y' : 'N'; $arResult['DEL_DIALOG'] = isset($_GET['del_dialog']) ? 'Y' : 'N'; if (isset($_REQUEST['post_to_feed'])) { $arResult['POST_TO_FEED'] = $_REQUEST['post_to_feed']; CUserOptions::SetOption("wiki", "POST_TO_FEED", $arResult['POST_TO_FEED']); } else { $arResult['POST_TO_FEED'] = CUserOptions::GetOption("wiki", "POST_TO_FEED", "N"); } $arResult['WIKI_oper'] = 'edit'; if (isset($_REQUEST[$arParams['OPER_VAR']])) { $arResult['WIKI_oper'] = $_REQUEST[$arParams['OPER_VAR']]; } $GLOBALS['arParams'] = $arParams; if (!CModule::IncludeModule('wiki')) { ShowError(GetMessage('WIKI_MODULE_NOT_INSTALLED')); return; } $arResult['ALLOW_HTML'] = CWikiUtils::isAllowHTML() ? 'Y' : 'N'; if (!CModule::IncludeModule('iblock')) { ShowError(GetMessage('IBLOCK_MODULE_NOT_INSTALLED')); return; }
$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"]); } } }
if (isset($_REQUEST["report_action"]) && (isset($_REQUEST["report_id"]) && intval($_REQUEST["report_id"]))) { $report_id = intval($_REQUEST["report_id"]); CCheckListResult::Update($report_id, array('HIDDEN' => $_REQUEST['report_action'] == 'hide' ? 'Y' : 'N')); } LocalRedirect($APPLICATION->GetCurPage()."?lang=".LANG,true); } elseif ($_REQUEST["ACTION"] == "CHANGELISTPROP") { if ($_REQUEST["showHiddenReports"] == "Y") $showHiddenReports = "Y"; else $showHiddenReports = "N"; CUserOptions::SetOption("checklist","show_hidden", $showHiddenReports); LocalRedirect($APPLICATION->GetCurPage()."?lang=".LANG,true); } elseif ($_REQUEST["ACTION"] == "ADDREPORT")//add report { $report_id = $checklist->AddReport(); CCheckListResult::Update($report_id, array('REPORT' => 'Y')); LocalRedirect($APPLICATION->GetCurPage()."?lang=".LANG,true); } elseif ($_REQUEST["ACTION"] == "ADDSENDREPORT")//add report and send to bitrix { if (isset($_REQUEST['report_id'])) { $report_id = intval($_REQUEST['report_id']); $dbReport = CCheckListResult::GetList(Array(),Array("REPORT"=>"Y", "ID" => $report_id)); if ($arReport = $dbReport->Fetch())
} } $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);
function Show() { /** @global CMain $APPLICATION */ global $APPLICATION; //Save form defined tabs $this->arSavedTabs = $this->tabs; $this->arSystemTabs = array(); $this->arReqiredTabs = array(); foreach($this->tabs as $arTab) { $this->arSystemTabs[$arTab["DIV"]] = $arTab; if(is_array($arTab["FIELDS"])) { foreach($arTab["FIELDS"] as $arField) $this->arFields[$arField["id"]] = $arField; } if ($arTab["required"] && is_array($arTab["FIELDS"])) { $this->arReqiredTabs[$arTab["DIV"]] = $arTab; } } //Save form defined fields $this->arSystemFields = $this->arFields; $arCustomTabs = CAdminFormSettings::getTabsArray($this->name); if (!empty($arCustomTabs)) { $this->bCustomFields = true; $this->tabs = array(); foreach($arCustomTabs as $tab_id => $arTab) { if(array_key_exists($tab_id, $this->arSystemTabs)) { $arNewTab = $this->arSystemTabs[$tab_id]; $arNewTab["TAB"] = $arTab["TAB"]; $arNewTab["FIELDS"] = array(); } else { $arNewTab = array( "DIV" => $tab_id, "TAB" => $arTab["TAB"], "ICON" => "main_user_edit", "TITLE" => "", "FIELDS" => array(), ); } $bHasFields = false; foreach($arTab["FIELDS"] as $field_id => $content) { if(array_key_exists($field_id, $this->arSystemFields)) { $arNewField = $this->arSystemFields[$field_id]; $arNewField["content"] = $content; $bHasFields = true; } elseif(array_key_exists($field_id, $this->arForbiddenFields)) { $arNewField = false; } elseif(strlen($content) > 0) { $arNewField = array( "id" => $field_id, "content" => $content, "html" => '<td colspan="2">'.htmlspecialcharsex($content).'</td>', "delimiter" => true, ); } else { $arNewField = false; } if(is_array($arNewField)) { $this->arFields[$field_id] = $arNewField; $arNewTab["FIELDS"][] = $arNewField; foreach ($this->arReqiredTabs as $tab_id => $arReqTab) { foreach ($arReqTab["FIELDS"] as $i => $arReqTabField) { if ($arReqTabField["id"] == $field_id) unset($this->arReqiredTabs[$tab_id]["FIELDS"][$i]); } } } } if ($bHasFields) $this->tabs[] = $arNewTab; } foreach ($this->arReqiredTabs as $arReqTab) { if (!empty($arReqTab["FIELDS"])) { $this->tabs[] = $arReqTab; foreach ($arReqTab["FIELDS"] as $arReqTabField) { $this->arFields[$arReqTabField["id"]] = $arReqTabField; } } } } if($_REQUEST["mode"] == "settings") { ob_end_clean(); $this->ShowSettings($this->arFields); die(); } else { ob_end_flush(); } if(!is_array($_SESSION["ADMIN_CUSTOM_FIELDS"])) $_SESSION["ADMIN_CUSTOM_FIELDS"] = array(); $arDisabled = CUserOptions::GetOption("form", $this->name."_disabled", "N"); if(is_array($arDisabled) && $arDisabled["disabled"] === "Y") { $_SESSION["ADMIN_CUSTOM_FIELDS"][$this->name] = true; $this->tabs = $this->arSavedTabs; $this->arFields = $this->arSystemFields; } else { unset($_SESSION["ADMIN_CUSTOM_FIELDS"][$this->name]); } if(isset($_REQUEST[$this->name."_active_tab"])) $this->selectedTab = $_REQUEST[$this->name."_active_tab"]; else $this->selectedTab = $this->tabs[0]["DIV"]; //To show $arHiddens = $this->arFields; echo $this->sPrologContent; if(array_key_exists("FORM_ACTION", $this->arParams)) $action = htmlspecialcharsbx($this->arParams["FORM_ACTION"]); else $action = htmlspecialcharsbx($APPLICATION->GetCurPage()); echo '<form method="POST" action="'.$action.'" enctype="multipart/form-data" id="'.$this->name.'_form" name="'.$this->name.'_form"'.($this->arParams["FORM_ATTRIBUTES"] <> ''? ' '.$this->arParams["FORM_ATTRIBUTES"]:'').'>'; $htmlGroup = ""; if($this->group) { if (!empty($arCustomTabs)) { foreach($this->tabs as $arTab) { if(is_array($arTab["FIELDS"])) { foreach($arTab["FIELDS"] as $arField) { if( (strlen($this->arFields[$arField["id"]]["custom_html"]) > 0) || (strlen($this->arFields[$arField["id"]]["html"]) > 0) ) { $p = array_search($arField["id"], $this->arFields[$this->group]["group"]); if($p !== false) unset($this->arFields[$this->group]["group"][$p]); } } } } } if(!empty($this->arFields[$this->group]["group"])) { $htmlGroup .= '<tr class="heading" id="tr_'.$this->arFields[$this->group]["id"].'">' .$this->arFields[$this->group]["html"].'</tr>' ."\n"; } } $this->OnAdminTabControlBegin(); $this->tabIndex = 0; while($this->tabIndex < count($this->tabs)) { ob_start();//Start of the tab content $arTab = $this->tabs[$this->tabIndex]; if(is_array($arTab["FIELDS"])) { foreach($arTab["FIELDS"] as $arField) { if(isset($this->arFields[$arField["id"]]["group"])) { if(!empty($this->arFields[$arField["id"]]["group"])) { echo $htmlGroup; foreach($this->arFields[$arField["id"]]["group"] as $p) { if($this->arFields[$p]["custom_html"]) echo preg_replace("/^\\s*<tr/is", "<tr class=\"bx-in-group\"", $this->arFields[$p]["custom_html"]); elseif($this->arFields[$p]["html"] && !$this->arFields[$p]["delimiter"]) echo '<tr class="bx-in-group" '.($this->arFields[$p]["valign"] <> ''? ' valign="'.$this->arFields[$p]["valign"].'"':'').' id="tr_'.$p.'">', $this->arFields[$p]["html"], "</tr>\n"; unset($arHiddens[$this->arFields[$p]["id"]]); $this->arFields[$p] = array(); } } } elseif(strlen($this->arFields[$arField["id"]]["custom_html"]) > 0) { if($this->group_ajax) echo preg_replace("#<script[^>]*>.*?</script>#im".FX_UTF_PCRE_MODIFIER, "", $this->arFields[$arField["id"]]["custom_html"]); else echo $this->arFields[$arField["id"]]["custom_html"]; } elseif(strlen($this->arFields[$arField["id"]]["html"]) > 0) { $rowClass = ( array_key_exists("rowClass", $this->arFields[$arField["id"]]) ? ' class="'.$this->arFields[$arField["id"]]["rowClass"].'"' : '' ); if($this->arFields[$arField["id"]]["delimiter"]) echo '<tr class="heading" id="tr_'.$arField["id"].'"'.$rowClass.'>'; else echo '<tr'.($this->arFields[$arField["id"]]["valign"] <> ''? ' valign="'.$this->arFields[$arField["id"]]["valign"].'"':'').' id="tr_'.$arField["id"].'"'.$rowClass.'>'; echo $this->arFields[$arField["id"]]["html"].'</tr>'."\n"; } unset($arHiddens[$arField["id"]]); } } $tabContent = ob_get_contents(); ob_end_clean(); //Dispose tab content if ($tabContent == "") { array_splice($this->tabs, $this->tabIndex, 1); // forget about tab } else { $this->tabs[$this->tabIndex]["CONTENT"] = $tabContent; $this->tabIndex++; } } //sometimes form settings are incorrect but we must show required fields $requiredFields = ''; foreach($arHiddens as $arField) { if($arField["required"]) { if(strlen($this->arFields[$arField["id"]]["custom_html"]) > 0) { $requiredFields .= $this->arFields[$arField["id"]]["custom_html"]; } elseif(strlen($this->arFields[$arField["id"]]["html"]) > 0) { if($this->arFields[$arField["id"]]["delimiter"]) $requiredFields .= '<tr class="heading">'; else $requiredFields .= '<tr>'; $requiredFields .= $this->arFields[$arField["id"]]["html"].'</tr>'; } unset($arHiddens[$arField["id"]]); } } if($requiredFields <> '') { $this->tabs[] = array( "CONTENT" => $requiredFields, "DIV" => "bx_req", "TAB" => GetMessage("admin_lib_required"), "TITLE" => GetMessage("admin_lib_required"), ); } parent::Begin(); while($this->tabIndex < count($this->tabs)) { $this->BeginNextTab(); echo $this->tabs[$this->tabIndex]["CONTENT"]; } parent::Buttons($this->arButtonsParams); echo $this->sButtonsContent; $this->End(); echo $this->sEpilogContent; echo '<span class="bx-fields-hidden">'; foreach($arHiddens as $arField) { echo $arField["hidden"]; } echo '</span>'; echo '</form>'; }
function GDCSaveSettings($arParams, $POS) { /** @global CMain $APPLICATION */ global $APPLICATION; if ($arParams["DEFAULT_ID"]) { $user_option_id = 0; $arUserOptionsDefault = CUserOptions::GetOption("intranet", "~gadgets_" . $arParams["DEFAULT_ID"], false, $user_option_id); } else { $user_option_id = false; $arUserOptionsDefault = false; } $arUserOptions = CUserOptions::GetOption("intranet", "~gadgets_" . $arParams["ID"], $arUserOptionsDefault, $user_option_id); if (!$arUserOptions && !$user_option_id) { $tmp_desktop_id = false; if (in_array($APPLICATION->GetCurPage(), array(SITE_DIR . "index.php", SITE_DIR, "/"))) { $tmp_desktop_id = "mainpage"; } elseif (in_array($APPLICATION->GetCurPage(), array(SITE_DIR . "desktop.php", "/desktop.php"))) { $tmp_desktop_id = "dashboard"; } if ($tmp_desktop_id !== false) { $arUserOptions = CUserOptions::GetOption("intranet", "~gadgets_" . $tmp_desktop_id, false, false); } } if ($arParams["MULTIPLE"] == "Y") { $arUserOptionsTmp = $arUserOptions; $arUserOptions = $arUserOptions[$arParams["DESKTOP_PAGE"]]; } if (!is_array($arUserOptions)) { $arUserOptions = array("GADGETS" => array()); } $arNewUserOptions = array("GADGETS" => array()); if (array_key_exists("COLS", $arUserOptions)) { $arNewUserOptions["COLS"] = $arUserOptions["COLS"]; } if (array_key_exists("arCOLUMN_WIDTH", $arUserOptions)) { $arNewUserOptions["arCOLUMN_WIDTH"] = $arUserOptions["arCOLUMN_WIDTH"]; } if (array_key_exists("NAME", $arUserOptions)) { $arNewUserOptions["NAME"] = $arUserOptions["NAME"]; } foreach ($POS as $col => $items) { foreach ($items as $row => $gdId) { if (substr($gdId, -2, 2) == "*H") { $gdId = substr($gdId, 0, -2); $bHided = true; } else { $bHided = false; } if (is_array($arUserOptions["GADGETS"][$gdId])) { $arNewUserOptions["GADGETS"][$gdId] = $arUserOptions["GADGETS"][$gdId]; } else { $arNewUserOptions["GADGETS"][$gdId] = array(); } $arNewUserOptions["GADGETS"][$gdId]["COLUMN"] = $col; $arNewUserOptions["GADGETS"][$gdId]["ROW"] = $row; $arNewUserOptions["GADGETS"][$gdId]["HIDE"] = $bHided ? "Y" : "N"; } } if ($arParams["MULTIPLE"] == "Y") { $arUserOptionsTmp[$arParams["DESKTOP_PAGE"]] = $arNewUserOptions; $arNewUserOptions = $arUserOptionsTmp; } CUserOptions::SetOption("intranet", "~gadgets_" . $arParams["ID"], $arNewUserOptions, false, $user_option_id); }
public static function GetLastRecentlyUsed($provider) { $res = CUserOptions::GetOption("access_dialog_recent", $provider, array()); if (!is_array($res)) { $res = array(); } return $res; }
$arParams["PICTURES_INFO"] = @unserialize(COption::GetOptionString("photogallery", "pictures")); $arParams["PICTURES_INFO"] = is_array($arParams["PICTURES_INFO"]) ? $arParams["PICTURES_INFO"] : array(); foreach ($arParams["PICTURES_INFO"] as $key => $val) { if (in_array(str_pad($key, 5, "_") . $val["code"], $arParams["ADDITIONAL_SIGHTS"])) { $arParams["PICTURES"][$val["code"]] = array("size" => $arParams["PICTURES_INFO"][$key]["size"], "quality" => $arParams["PICTURES_INFO"][$key]["quality"], "title" => $arParams["PICTURES_INFO"][$key]["title"]); } } if (empty($arParams["PICTURES_SIGHT"]) && !empty($arParams["PICTURES"])) { if ($GLOBALS["USER"]->IsAuthorized()) { require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . strToLower($GLOBALS["DB"]->type) . "/favorites.php"; $arTemplateParams = CUserOptions::GetOption('photogallery', 'template'); $arTemplateParams = !is_array($arTemplateParams) ? array() : $arTemplateParams; $arParams["PICTURES_SIGHT"] = $arTemplateParams['sight']; if ($_REQUEST["PICTURES_SIGHT"] && check_bitrix_sessid() && $arTemplateParams["sight"] != $_REQUEST["PICTURES_SIGHT"]) { $arTemplateParams['sight'] = $arParams["PICTURES_SIGHT"] = $_REQUEST["PICTURES_SIGHT"]; CUserOptions::SetOption('photogallery', 'template', $arTemplateParams); } } else { if (!empty($_SESSION['photogallery']['sight'])) { $arParams["PICTURES_SIGHT"] = $_SESSION['photogallery']['sight']; } if (!empty($_REQUEST["PICTURES_SIGHT"])) { $_SESSION['photogallery']['sight'] = $arParams["PICTURES_SIGHT"] = $_REQUEST["PICTURES_SIGHT"]; } } } elseif ($arParams["PICTURES_SIGHT"] != "real" && $arParams["PICTURES_SIGHT"] != "detail") { $arParams["PICTURES_SIGHT"] = substr($arParams["PICTURES_SIGHT"], 5); } } if ($arParams["PICTURES_SIGHT"] != "real" && $arParams["PICTURES_SIGHT"] != "detail") { $arParams["PICTURES_SIGHT"] = in_array($arParams["PICTURES_SIGHT"], array_keys($arParams["PICTURES"])) ? $arParams["PICTURES_SIGHT"] : "standart";
$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();