public function onPrepareComponentParams($arParams) { $arParams['FILTER_NAME'] = $this->initFilterName($arParams['FILTER_NAME']); $this->initExternalValues($arParams['FILTER_NAME']); $arParams['USERS_PER_PAGE'] = intval($arParams['USERS_PER_PAGE']); $arParams['NAV_TITLE'] = !empty($arParams['NAV_TITLE']) ? $arParams['NAV_TITLE'] : GetMessage('INTR_ISL_PARAM_NAV_TITLE_DEFAULT'); $arParams['DATE_FORMAT'] = !empty($arParams['DATE_FORMAT']) ? $arParams['DATE_FORMAT'] : CComponentUtil::GetDateFormatDefault(false); $arParams['DATE_FORMAT_NO_YEAR'] = !empty($arParams['DATE_FORMAT_NO_YEAR']) ? $arParams['DATE_FORMAT_NO_YEAR'] : CComponentUtil::GetDateFormatDefault(true); InitBVar($arParams['FILTER_1C_USERS']); InitBVar($arParams['FILTER_SECTION_CURONLY']); InitBVar($arParams['SHOW_NAV_TOP']); InitBVar($arParams['SHOW_NAV_BOTTOM']); InitBVar($arParams['SHOW_UNFILTERED_LIST']); InitBVar($arParams['SHOW_DEP_HEAD_ADDITIONAL']); !isset($arParams["CACHE_TIME"]) && ($arParams["CACHE_TIME"] = 3600); if ($arParams['CACHE_TYPE'] == 'A') { $arParams['CACHE_TYPE'] = COption::GetOptionString("main", "component_cache_on", "Y"); } $arParams['DETAIL_URL'] = COption::GetOptionString('intranet', 'search_user_url', '/user/#ID#/'); if (!array_key_exists("PM_URL", $arParams)) { $arParams["PM_URL"] = "/company/personal/messages/chat/#USER_ID#/"; } if (!array_key_exists("PATH_TO_USER_EDIT", $arParams)) { $arParams["PATH_TO_USER_EDIT"] = '/company/personal/user/#user_id#/edit/'; } if (!array_key_exists("PATH_TO_CONPANY_DEPARTMENT", $arParams)) { $arParams["PATH_TO_CONPANY_DEPARTMENT"] = "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#"; } if (IsModuleInstalled("video") && !array_key_exists("PATH_TO_VIDEO_CALL", $arParams)) { $arParams["PATH_TO_VIDEO_CALL"] = "/company/personal/video/#USER_ID#/"; } if (!$this->getUser()->CanDoOperation("edit_all_users") && isset($arParams["SHOW_USER"]) && $arParams["SHOW_USER"] != "fired") { $arParams["SHOW_USER"] = "******"; } return parent::onPrepareComponentParams($arParams); }
public static function GetDateFormatField($name = "", $parent = "", $no_year = false) { $timestamp = mktime(0, 0, 0, 2, 6, 2010); return array("PARENT" => $parent, "NAME" => $name, "TYPE" => "LIST", "VALUES" => $no_year ? array("d-m" => FormatDate("d-m", $timestamp), "m-d" => FormatDate("m-d", $timestamp), "d.m" => FormatDate("d.m", $timestamp), "d.M" => FormatDate("d.M", $timestamp), "m.d" => FormatDate("m.d", $timestamp), "j M" => FormatDate("j M", $timestamp), "M j" => FormatDate("M j", $timestamp), "j F" => FormatDate("j F", $timestamp), "f j" => FormatDate("f j", $timestamp), CComponentUtil::GetDateFormatDefault($no_year) => GetMessage('COMP_PARAM_DATE_FORMAT_SITE')) : array("d-m-Y" => FormatDate("d-m-Y", $timestamp), "m-d-Y" => FormatDate("m-d-Y", $timestamp), "Y-m-d" => FormatDate("Y-m-d", $timestamp), "d.m.Y" => FormatDate("d.m.Y", $timestamp), "d.M.Y" => FormatDate("d.M.Y", $timestamp), "m.d.Y" => FormatDate("m.d.Y", $timestamp), "j M Y" => FormatDate("j M Y", $timestamp), "M j, Y" => FormatDate("M j, Y", $timestamp), "j F Y" => FormatDate("j F Y", $timestamp), "f j, Y" => FormatDate("f j, Y", $timestamp), "SHORT" => GetMessage('COMP_PARAM_DATE_FORMAT_SITE')), "DEFAULT" => CComponentUtil::GetDateFormatDefault($no_year), "ADDITIONAL_VALUES" => "Y"); }
ShowError(GetMessage('CRM_PERMISSION_DENIED')); return; } $arResult['USER_ID'] = $userID; $listID = isset($arParams['LIST_ID']) ? $arParams['LIST_ID'] : ''; if ($listID === '') { $listID = uniqid('birthdays_'); } $arResult['LIST_ID'] = $listID; $arResult['ERRORS'] = array(); $arResult['MESSAGES'] = array(); $arParams['NAME_FORMAT'] = isset($arParams['NAME_FORMAT']) ? $arParams['NAME_FORMAT'] : ''; $arResult['NAME_FORMAT'] = $arParams['NAME_FORMAT'] !== '' ? $arParams['NAME_FORMAT'] : \Bitrix\Crm\Format\PersonNameFormatter::getFormat(); $utils = new CComponentUtil(); $arParams['DATE_FORMAT'] = isset($arParams['DATE_FORMAT']) ? $arParams['DATE_FORMAT'] : ''; $arResult['DATE_FORMAT'] = $arParams['DATE_FORMAT'] !== '' ? $arParams['DATE_FORMAT'] : $utils->GetDateFormatDefault(true); $arParams['INTERVAL_IN_DAYS'] = isset($arParams['INTERVAL_IN_DAYS']) ? (int) $arParams['INTERVAL_IN_DAYS'] : 7; $intervalInDays = $arParams['INTERVAL_IN_DAYS'] > 0 ? $arParams['INTERVAL_IN_DAYS'] : 7; $arParams['CHECK_PERMISSIONS'] = isset($arParams['CHECK_PERMISSIONS']) ? strtoupper($arParams['CHECK_PERMISSIONS']) : 'Y'; $enablePermissionCheck = $arParams['CHECK_PERMISSIONS'] !== 'N'; $arParams['LIMIT'] = isset($arParams['LIMIT']) ? (int) $arParams['LIMIT'] : 5; $limit = $arParams['LIMIT'] > 0 ? $arParams['LIMIT'] : 5; $currentDate = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'SHORT', SITE_ID); $items = array(); if ($canReadLead) { $items = array_merge(BirthdayReminder::getNearestEntities(\CCrmOwnerType::Lead, $currentDate, '', $intervalInDays, $enablePermissionCheck, $limit), $items); } if ($canReadContact) { $items = array_merge(BirthdayReminder::getNearestEntities(\CCrmOwnerType::Contact, $currentDate, '', $intervalInDays, $enablePermissionCheck, $limit), $items); } sortByColumn($items, 'BIRTHDAY_SORT');
if (strlen(trim($arParams["NAME_TEMPLATE"])) <= 0) { $arParams["NAME_TEMPLATE"] = CSite::GetNameFormat(); } $arParams['SHOW_LOGIN'] = $arParams['SHOW_LOGIN'] != "N" ? "Y" : "N"; if (!array_key_exists("PM_URL", $arParams)) { $arParams["~PM_URL"] = $arParams["PM_URL"] = "/company/personal/messages/chat/#USER_ID#/"; } if (!array_key_exists("PATH_TO_CONPANY_DEPARTMENT", $arParams)) { $arParams["~PATH_TO_CONPANY_DEPARTMENT"] = $arParams["PATH_TO_CONPANY_DEPARTMENT"] = "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#"; } if (IsModuleInstalled("video") && !array_key_exists("PATH_TO_VIDEO_CALL", $arParams)) { $arParams["~PATH_TO_VIDEO_CALL"] = $arParams["PATH_TO_VIDEO_CALL"] = "/company/personal/video/#USER_ID#/"; } $arParams['SHOW_YEAR'] = $arParams['SHOW_YEAR'] == 'Y' ? 'Y' : ($arParams['SHOW_YEAR'] == 'M' ? 'M' : 'N'); if (!$arParams['DATE_FORMAT']) { $arParams['DATE_FORMAT'] = CComponentUtil::GetDateFormatDefault(); } if (!$arParams['DATE_TIME_FORMAT']) { $arParams['DATE_TIME_FORMAT'] = CComponentUtil::GetDateTimeFormatDefault(); } $arResult['MODES_LIST'] = array('now', 'today', 'tomorrow'); $arParams['mode'] = $_GET['absence_mode']; if (!in_array($arParams['mode'], $arResult['MODES_LIST'])) { //$arParams['mode'] = 'all'; $arParams['mode'] = 'now'; } if (!isset($arParams["CACHE_TIME"])) { $arParams["CACHE_TIME"] = 3600; } if (!isset($arParams["CACHE_TYPE"])) { $arParams["CACHE_TYPE"] = 'A';
$arParams['SHOW_LOGIN'] = $arParams['SHOW_LOGIN'] != "N" ? "Y" : "N"; if (!array_key_exists("PM_URL", $arParams)) { $arParams["~PM_URL"] = $arParams["PM_URL"] = "/company/personal/messages/chat/#USER_ID#/"; } if (!array_key_exists("PATH_TO_CONPANY_DEPARTMENT", $arParams)) { $arParams["~PATH_TO_CONPANY_DEPARTMENT"] = $arParams["PATH_TO_CONPANY_DEPARTMENT"] = "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#"; } if (IsModuleInstalled("video") && !array_key_exists("PATH_TO_VIDEO_CALL", $arParams)) { $arParams["~PATH_TO_VIDEO_CALL"] = $arParams["PATH_TO_VIDEO_CALL"] = "/company/personal/video/#USER_ID#/"; } $arParams['SHOW_YEAR'] = $arParams['SHOW_YEAR'] == 'Y' ? 'Y' : ($arParams['SHOW_YEAR'] == 'M' ? 'M' : 'N'); if (!$arParams['DATE_FORMAT']) { $arParams['DATE_FORMAT'] = CComponentUtil::GetDateFormatDefault(); } if (!$arParams['DATE_FORMAT_NO_YEAR']) { $arParams['DATE_FORMAT_NO_YEAR'] = CComponentUtil::GetDateFormatDefault(true); } $arParams['DETAIL_URL'] = trim($arParams['DETAIL_URL']); if (!$arParams['DETAIL_URL']) { $arParams['~DETAIL_URL'] = $arParams['DETAIL_URL'] = COption::GetOptionString('intranet', 'search_user_url', '/user/#ID#/'); } $arParams['DEPARTMENT'] = intval($arParams['DEPARTMENT']); $arParams['bShowFilter'] = $arParams['DEPARTMENT'] <= 0; // for bitrix:main.user.link $arTooltipFieldsDefault = serialize(array("EMAIL", "PERSONAL_MOBILE", "WORK_PHONE", "PERSONAL_ICQ", "PERSONAL_PHOTO", "PERSONAL_CITY", "WORK_COMPANY", "WORK_POSITION")); $arTooltipPropertiesDefault = serialize(array("UF_DEPARTMENT", "UF_PHONE_INNER")); if (!array_key_exists("SHOW_FIELDS_TOOLTIP", $arParams)) { $arParams["SHOW_FIELDS_TOOLTIP"] = unserialize(COption::GetOptionString("socialnetwork", "tooltip_fields", $arTooltipFieldsDefault)); } if (!array_key_exists("USER_PROPERTY_TOOLTIP", $arParams)) { $arParams["USER_PROPERTY_TOOLTIP"] = unserialize(COption::GetOptionString("socialnetwork", "tooltip_properties", $arTooltipPropertiesDefault));
} $arParams['IBLOCK_CHANGED'] = $arParams['IBLOCK_ID'] != COption::GetOptionInt('intranet', 'iblock_absence'); $arParams['CALENDAR_IBLOCK_ID'] = intval($arParams['CALENDAR_IBLOCK_ID']); if ($arParams['CALENDAR_IBLOCK_ID'] !== -1) { if ($arParams['CALENDAR_IBLOCK_ID'] <= 0) { $arParams['CALENDAR_IBLOCK_ID'] = COption::GetOptionInt('intranet', 'iblock_calendar'); } } $arResult['ABSENCE_TYPES'] = array(); $dbTypeRes = CIBlockPropertyEnum::GetList(array("SORT" => "ASC", "VALUE" => "ASC"), array('IBLOCK_ID' => $arParams['IBLOCK_ID'], 'PROPERTY_ID' => 'ABSENCE_TYPE')); while ($arTypeValue = $dbTypeRes->GetNext()) { $arResult['ABSENCE_TYPES'][$arTypeValue['ID']] = $arTypeValue; } $arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]); if (!$arParams['DATE_FORMAT']) { $arParams['DATE_FORMAT'] = isset($_SESSION['intranet_absence_calendar_date_format']) ? $_SESSION['intranet_absence_calendar_date_format'] : CComponentUtil::GetDateFormatDefault(); } elseif (!$arParams['AJAX_CALL']) { $_SESSION['intranet_absence_calendar_date_format'] = $arParams['DATE_FORMAT']; } if (!$arParams['DATETIME_FORMAT']) { $arParams['DATETIME_FORMAT'] = isset($_SESSION['intranet_absence_calendar_datetime_format']) ? $_SESSION['intranet_absence_calendar_datetime_format'] : CComponentUtil::GetDateTimeFormatDefault(); } elseif (!$arParams['AJAX_CALL']) { $_SESSION['intranet_absence_calendar_datetime_format'] = $arParams['DATETIME_FORMAT']; } if ($arParams['AJAX_CALL'] == 'DATA') { if (!check_bitrix_sessid()) { return; } if ($arParams['IBLOCK_ID'] <= 0) { return; }