<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("calendar")) { return; } $bSocNet = CModule::IncludeModule("socialnetwork"); $arComponentParameters = array(); $arTypes = array(); $types = CCalendarType::GetList(); if (is_array($types)) { foreach ($types as $type) { $arTypes[$type["XML_ID"]] = "[" . $type["XML_ID"] . "] " . $type["NAME"]; } } $arParams = array(); // $arComponentParameters["PARAMETERS"] $arParams["CALENDAR_TYPE"] = array("PARENT" => "BASE", "NAME" => GetMessage("EC_TYPE"), "TYPE" => "LIST", "VALUES" => $arTypes, "REFRESH" => 'Y'); if (!isset($arCurrentValues) && count($arTypes) > 0) { $arCurrentValues["CALENDAR_TYPE"] = each($arTypes); $arCurrentValues["CALENDAR_TYPE"] = $arCurrentValues["CALENDAR_TYPE"]["key"]; } if ($arCurrentValues["CALENDAR_TYPE"] != 'user' && $arCurrentValues["CALENDAR_TYPE"] != 'group') { $Sect = CCalendar::GetSectionList(array('CAL_TYPE' => $arCurrentValues["CALENDAR_TYPE"])); if (count($Sect) > 0) { $arSections = array('0' => '- ' . GetMessage("EC_CALENDAR_SECTION_ALL") . ' -'); foreach ($Sect as $section) { $arSections[$section["ID"]] = "[" . $section["ID"] . "] " . $section["NAME"]; }
function InstallEvents() { global $DB; $arCurPhpVer = Explode(".", PhpVersion()); if (IntVal($arCurPhpVer[0]) < 5) return true; $sIn = "'CALENDAR_INVITATION'"; $rs = $DB->Query("SELECT count(*) C FROM b_event_type WHERE EVENT_NAME IN (".$sIn.") ", false, "File: ".__FILE__."<br>Line: ".__LINE__); $ar = $rs->Fetch(); if($ar["C"] <= 0) include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/calendar/install/events.php"); if (!IsModuleInstalled('intranet')) { COption::SetOptionString("intranet", "calendar_2", "Y"); CModule::IncludeModule('calendar'); CCalendar::ClearCache(); CCalendar::CacheTime(0); $arTypes = CCalendarType::GetList(); if (!$arTypes || !count($arTypes)) { CCalendarType::Edit(array( 'NEW' => true, 'arFields' => array( 'XML_ID' => 'events', 'NAME' => GetMessage('CAL_DEFAULT_TYPE'), 'ACCESS' => array( 'G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view') ) ) )); } } return true; }
public static function DialogSettings($Params) { $id = $Params['id']; $arTabs = array(array('name' => GetMessage('EC_SET_TAB_PERSONAL'), 'title' => GetMessage('EC_SET_TAB_PERSONAL_TITLE'), 'id' => $id . "set-tab-0"), array('name' => GetMessage('EC_SET_TAB_BASE'), 'title' => GetMessage('EC_SET_TAB_BASE_TITLE'), 'id' => $id . "set-tab-1", 'show' => CCalendarType::CanDo('calendar_type_access', $Params['type'])), array('name' => GetMessage('EC_SECT_ACCESS_TAB'), 'title' => GetMessage('EC_SECT_ACCESS_TAB'), 'id' => $id . "set-tab-2", 'show' => CCalendarType::CanDo('calendar_type_access', $Params['type']))); $arDays = self::GetWeekDays(); $arWorTimeList = array(); for ($i = 0; $i < 24; $i++) { $arWorTimeList[strval($i)] = CCalendar::FormatTime($i, 0); $arWorTimeList[strval($i) . '.30'] = CCalendar::FormatTime($i, 30); } $timezoneList = CCalendar::GetTimezoneList(); $bInPersonal = $Params['inPersonalCalendar']; ?> <div id="bxec_uset_<?php echo $id; ?> " class="bxec-popup"> <div style="width: 500px; height: 1px;"></div> <div class="bxec-d-tabs" id="<?php echo $id; ?> _set_tabs"> <?php foreach ($arTabs as $tab) { ?> <div class="bxec-d-tab <?php if ($tab['active']) { echo 'bxec-d-tab-act'; } ?> " title="<?php echo isset($tab['title']) ? $tab['title'] : $tab['name']; ?> " id="<?php echo $tab['id']; ?> " <?php if ($tab['show'] === false) { echo 'style="display:none;"'; } ?> > <b></b><div><span><?php echo $tab['name']; ?> </span></div><i></i> </div> <?php } ?> </div> <div class="bxec-d-cont" id="<?php echo $id; ?> _set_tabcont"> <?php /* ####### TAB 0 : PERSONAL ####### */ ?> <div id="<?php echo $id; ?> set-tab-0-cont" class="bxec-d-cont-div" style="display: block;"> <!-- default meeting calendar --> <?php if ($bInPersonal) { ?> <div class="bxec-popup-row"> <span class="bxec-field-label-3"><label for="<?php echo $id; ?> _set_tz_sel"><?php echo GetMessage('EC_TIMEZONE'); ?> :</label></span> <span class="bxec-field-val-2"> <select id="<?php echo $id; ?> _set_tz_sel" style="max-width: 235px;"> <option value=""> - </option> <?php foreach ($timezoneList as $tz) { ?> <option value="<?php echo $tz['timezone_id']; ?> "><?php echo htmlspecialcharsEx($tz['title']); ?> </option> <?php } ?> </select> </span> </div> <div class="bxec-popup-row"> <span class="bxec-field-label-3"><label for="<?php echo $id; ?> _uset_calend_sel"><?php echo GetMessage('EC_ADV_MEETING_CAL'); ?> :</label></span> <span class="bxec-field-val-2"> <select id="<?php echo $id; ?> _set_sect_sel"></select> </span> </div> <!-- blinking option --> <div class="bxec-popup-row"> <span class="bxec-field-label-1"><input id="<?php echo $id; ?> _uset_blink" type="checkbox" /></span> <span class="bxec-field-val-2"> <label for="<?php echo $id; ?> _uset_blink"><?php echo GetMessage('EC_BLINK_SET'); ?> </label> </span> </div> <!-- show banner --> <div class="bxec-popup-row"> <span class="bxec-field-label-1"><input id="<?php echo $id; ?> _show_banner" type="checkbox" /></span> <span class="bxec-field-val-2"> <label for="<?php echo $id; ?> _show_banner"><?php echo GetMessage('EC_SHOW_BANNER', array('#DAV_EXAMPLE#' => CCalendar::IsBitrix24() ? 'CalDAV, MS Outlook' : 'Exchange, CalDAV, MS Outlook')); ?> </label> </span> </div> <!-- show declined --> <div class="bxec-popup-row"> <span class="bxec-field-label-1"><input id="<?php echo $id; ?> _show_declined" type="checkbox" /></span> <span class="bxec-field-val-2"> <label for="<?php echo $id; ?> _show_declined"><?php echo GetMessage('EC_OPTION_SHOW_DECLINED'); ?> </label> </span> </div> <?php } /*if($bInPersonal)*/ ?> <!-- show declined --> <div class="bxec-popup-row"> <span class="bxec-field-label-1"><input id="<?php echo $id; ?> _show_muted" type="checkbox" /></span> <span class="bxec-field-val-2"> <label for="<?php echo $id; ?> _show_muted"><?php echo GetMessage('EC_OPTION_SHOW_MUTED'); ?> </label> </span> </div> <?php if ($Params['bShowSuperpose']) { ?> <div class="bxec-popup-row"> <a id="<?php echo $id; ?> -set-manage-sp" href="javascript:void(0);" title="<?php echo GetMessage('EC_MANAGE_SP_CALENDARS_TITLE'); ?> "><?php echo GetMessage('EC_MANAGE_SP_CALENDARS'); ?> </a> </div> <?php } ?> <?php if ($Params['bCalDAV'] && $bInPersonal) { ?> <div class="bxec-popup-row"> <a id="<?php echo $id; ?> _manage_caldav" href="javascript:void(0);" title="<?php echo GetMessage('EC_MANAGE_CALDAV_TITLE'); ?> "><?php echo GetMessage('EC_MANAGE_CALDAV'); ?> </a> </div> <?php } ?> <div class="bxec-popup-row"> <a id="<?php echo $id; ?> _uset_clear" href="javascript:void(0);"><?php echo GetMessage('EC_CLEAR_PERS_SETTINGS'); ?> </a> </div> </div> <?php /* ####### END TAB 0 ####### */ ?> <?php /* ####### TAB 1 : CALENDAR SETTINGS ####### */ ?> <div id="<?php echo $id; ?> set-tab-1-cont" class="bxec-d-cont-div"> <!-- Work time --> <div class="bxec-popup-row"> <span class="bxec-field-label-3"><label for="<?php echo $id; ?> work_time_start"><?php echo GetMessage("EC_WORK_TIME"); ?> :</label></span> <span class="bxec-field-val-2"> <select id="<?php echo $id; ?> work_time_start"> <?php foreach ($arWorTimeList as $key => $val) { ?> <option value="<?php echo $key; ?> "><?php echo $val; ?> </option> <?php } ?> </select> — <select id="<?php echo $id; ?> work_time_end"> <?php foreach ($arWorTimeList as $key => $val) { ?> <option value="<?php echo $key; ?> "><?php echo $val; ?> </option> <?php } ?> </select> </span> </div> <!-- Week holidays --> <div class="bxec-popup-row"> <span class="bxec-field-label-3"><label for="<?php echo $id; ?> week_holidays"><?php echo GetMessage('EC_WEEK_HOLIDAYS'); ?> :</label></span> <span class="bxec-field-val-2"> <select size="7" multiple=true id="<?php echo $id; ?> week_holidays"> <?php foreach ($arDays as $day) { ?> <option value="<?php echo $day[2]; ?> " ><?php echo $day[0]; ?> </option> <?php } ?> </select> </span> </div> <!-- year holidays --> <div class="bxec-popup-row"> <span class="bxec-field-label-3"><label for="<?php echo $id; ?> year_holidays"><?php echo GetMessage('EC_YEAR_HOLIDAYS'); ?> :</label></span> <span class="bxec-field-val-2"><input type="text" id="<?php echo $id; ?> year_holidays" value=""/></span> </div> <!-- year workdays --> <div class="bxec-popup-row"> <span class="bxec-field-label-3"><label for="<?php echo $id; ?> year_workdays"><?php echo GetMessage('EC_YEAR_WORKDAYS'); ?> :</label></span> <span class="bxec-field-val-2"><input type="text" id="<?php echo $id; ?> year_workdays" value=""/></span> </div> <!-- week start --> <div class="bxec-popup-row" style="display: none;"> <span class="bxec-field-label-3"><label for="<?php echo $id; ?> week_start"><?php echo GetMessage('EC_WEEK_START'); ?> :</label></span> <span class="bxec-field-val-2"> <select id="<?php echo $id; ?> week_start"> <?php foreach ($arDays as $day) { ?> <option value="<?php echo $day[2]; ?> " ><?php echo $day[0]; ?> </option> <?php } ?> </select> </span> </div> <?php if (!CCalendar::IsBitrix24()) { ?> <div class="bxec-popup-row"> <a href="/bitrix/admin/settings.php?mid=calendar&tabControl_active_tab=edit2" title="<?php echo GetMessage('EC_MANAGE_CALENDAR_TYPES_TITLE'); ?> " target="_blank"><?php echo GetMessage('EC_MANAGE_CALENDAR_TYPES'); ?> </a> </div> <div class="bxec-popup-row"> <a href="/bitrix/admin/settings.php?mid=calendar&tabControl_active_tab=edit1" title="<?php echo GetMessage('EC_MANAGE_SETTING_TITLE'); ?> " target="_blank"><?php echo GetMessage('EC_MANAGE_SETTING'); ?> </a> </div> <?php } ?> </div> <?php /* ####### END TAB 1 ####### */ ?> <?php /* ####### TAB 2 : PERMISSIONS ####### */ ?> <div id="<?php echo $id; ?> set-tab-2-cont" class="bxec-d-cont-div"> <div class="bxec-popup-row"> <div class="bxec-popup-row-title"><?php echo GetMessage('EC_SECT_ACCESS_TAB'); ?> </div> <div class="bxec-access-cont-row"> <div id="<?php echo $id; ?> type-access-values-cont" class="bxec-access-cont"></div> <?php self::GetAccessHTML('calendar_type'); ?> <div class="bxec-access-link-cont"><a href="javascript:void(0);" id="<?php echo $id; ?> type-access-link" class="bxec-access-link"><?php echo GetMessage('EC_T_ADD'); ?> </a></div> </div> </div> </div> <?php /* ####### END TAB 2 ####### */ ?> </div> </div> <?php }
public static function GetTypeByExternalId($externalId = false) { if ($externalId) { $res = CCalendarType::GetList(array('arFilter' => array('EXTERNAL_ID' => $externalId))); if ($res && $res[0]) { return $res[0]['XML_ID']; } } return false; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("calendar") || WIZARD_IS_RERUN) { return; } COption::SetOptionString("intranet", "calendar_2", "Y"); // company calendar calendar type CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'company_calendar', 'NAME' => GetMessage('CAL_TYPE_COMPANY_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view'))))); // Sections $sectId0 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_0"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_0"), 'COLOR' => '#855CC5', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false))); $sectId1 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_1"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_1"), 'COLOR' => '#7DDEC2', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false))); $sectId2 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'ID' => 0, 'NAME' => GetMessage("CAL_COMPANY_SECT_2"), 'DESCRIPTION' => GetMessage("CAL_COMPANY_SECT_DESC_2"), 'COLOR' => '#F6EA68', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false))); // Events for company_calendar CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_0"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_0"), 'DT_FROM' => GetTime(mktime(9, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(16, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'UNTIL' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1), "SHORT"), 'BYDAY' => 'TU'), 'SECTIONS' => $sectId0), 'userId' => 1)); CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_1"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_1"), 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 2, date("Y")), "SHORT"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 2, date("Y")), "SHORT"), 'RRULE' => array('FREQ' => 'MONTHLY', 'INTERVAL' => 1, 'UNTIL' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1), "SHORT")), 'SECTIONS' => $sectId0), 'userId' => 1)); CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_2"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_2"), 'DT_FROM' => GetTime(mktime(10, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(12, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'MO'), 'SECTIONS' => $sectId1), 'userId' => 1)); CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_3"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_3"), 'DT_FROM' => GetTime(mktime(9, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(18, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'TU'), 'SECTIONS' => $sectId2), 'userId' => 1)); CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_4"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_4"), 'DT_FROM' => GetTime(mktime(12, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(17, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'FR'), 'SECTIONS' => $sectId2), 'userId' => 1)); CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'company_calendar', 'OWNER_ID' => 1, 'NAME' => GetMessage("CAL_COMP_EVENT_NAME_5"), 'DESCRIPTION' => GetMessage("CAL_COMP_EVENT_DESC_5"), 'DT_FROM' => GetTime(mktime(16, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(21, 0, 0, date("m"), date("d"), date("Y")), "FULL"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 1, 'BYDAY' => 'SA'), 'SECTIONS' => $sectId1), 'userId' => 1)); // User's calendar type CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'user', 'NAME' => GetMessage('CAL_TYPE_USER_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_edit'))))); // Group's calendar type CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'group', 'NAME' => GetMessage('CAL_TYPE_GROUP_NAME'), 'DESCRIPTION' => '', 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_edit'))))); $id = CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'user', 'OWNER_ID' => 1, 'NAME' => GetMessage("W_IB_CALENDAR_EMP_ABS"), 'DT_FROM' => GetTime(mktime(12, 0, 0, date("m"), date("d") + 1, date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(14, 0, 0, date("m"), date("d") + 1, date("Y")), "FULL"), 'DESCRIPTION' => ''), 'userId' => 1, 'autoDetectSection' => true, 'autoCreateSection' => true));
// Create types if (isset($_POST["set_params"]) && $_POST["set_params"] == 'Y') { $types = array(); foreach ($_POST['types'] as $type) { if (isset($type['allow']) && $type['allow'] == "Y") { $types[$type['key']] = array('iblockType' => $type['iblock_type'], 'iblockId' => $type['iblock_id'], 'name' => $type['title'], 'desc' => $type['desc']); $typeAccess = array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_edit')); if ($type['key'] != 'user' && $type['key'] != 'group') { $arGroupPerm = CIBlock::GetGroupPermissions($type['iblock_id']); $taskByLetter = array('D' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_denied'), 'R' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view'), 'W' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_edit'), 'X' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_access')); foreach ($arGroupPerm as $groupId => $letter) { $typeAccess['G' . $groupId] = $taskByLetter[$letter]; } } CCalendarConvert::CreateSectionProperty($type['iblock_id']); $XML_ID = CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => $type['key'], 'NAME' => $type['title'], 'DESCRIPTION' => trim($type['desc']), 'EXTERNAL_ID' => 'iblock_' . $type['iblock_id'], 'ACCESS' => $typeAccess))); } } CCalendarConvert::SetOption('__convert', $types); CCalendarConvert::Log(GetMessage('CAL_CONVERT_STAGE_SAVE')); CCalendarConvert::Log(GetMessage('CAL_CONVERT_STAGE_CREATE_TYPES')); $stage = 'go'; } else { $stage = CCalendarConvert::DoConvertStep(); } if ($stage == 'stop') { COption::SetOptionString("intranet", "calendar_2", "Y"); CCalendarConvert::Log(GetMessage('CAL_CONVERT_SUCCESS')); CCalendarConvert::DropSectionProperty(); $io = CBXVirtualIo::GetInstance(); $io->Delete(CTempFile::GetAbsoluteRoot() . "/cal_convert");
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("calendar")) { return; } COption::SetOptionString("intranet", "calendar_2", "Y"); if (WIZARD_FIRST_INSTAL != 'Y') { // calendar type $arTypes = CCalendarType::GetList(array("arFilter" => array("XML_ID" => 'events_info'))); if (!$arTypes || count($arTypes) <= 0) { CCalendarType::Edit(array('NEW' => true, 'arFields' => array('XML_ID' => 'events_info', 'NAME' => GetMessage('CAL_DEFAULT_TYPE'), 'ACCESS' => array('G2' => CCalendar::GetAccessTasksByName('calendar_type', 'calendar_type_view'))))); } // Sections $sectId0 = CCalendar::SaveSection(array('arFields' => array('CAL_TYPE' => 'events_info', 'ID' => 0, 'NAME' => GetMessage("CAL_TYPE_COMPANY_NAME"), 'DESCRIPTION' => "", 'COLOR' => '#855CC5', 'TEXT_COLOR' => '', 'OWNER_ID' => '', 'EXPORT' => array('ALLOW' => true, 'SET' => '3_9'), 'ACCESS' => array(), 'IS_EXCHANGE' => false))); // Events for company_calendar CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'events_info', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_EVENT_1_NAME"), 'DESCRIPTION' => "", 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 4, date("Y")), "FULL"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d") + 4, date("Y")), "FULL"), 'RRULE' => array(), 'SECTIONS' => $sectId0), 'userId' => 1)); CCalendar::SaveEvent(array('arFields' => array('CAL_TYPE' => 'events', 'OWNER_ID' => 0, 'NAME' => GetMessage("CAL_EVENT_2_NAME"), 'DESCRIPTION' => "", 'COLOR' => '#FFFF80', 'DT_FROM' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y")), "SHORT"), 'DT_TO' => GetTime(mktime(0, 0, 0, date("m"), date("d"), date("Y")), "SHORT"), 'RRULE' => array('FREQ' => 'WEEKLY', 'INTERVAL' => 3, 'BYDAY' => 'SA'), 'SECTIONS' => $sectId0), 'userId' => 1)); }
if ($arTypes_[0]) { OutputTypeHtml($arTypes_[0]); } } } } die; } if ($REQUEST_METHOD == "POST" && strlen($Update . $Apply . $RestoreDefaults) > 0 && check_bitrix_sessid()) { if (strlen($RestoreDefaults) > 0) { COption::RemoveOption("calendar"); } else { // Save permissions for calendar types foreach ($_POST['cal_type_perm'] as $xml_id => $perm) { // Save type permissions CCalendarType::Edit(array('NEW' => false, 'arFields' => array('XML_ID' => $xml_id, 'ACCESS' => $perm))); } $SET = array('work_time_start' => $_REQUEST['work_time_start'], 'work_time_end' => $_REQUEST['work_time_end'], 'year_holidays' => $_REQUEST['year_holidays'], 'year_workdays' => $_REQUEST['year_workdays'], 'week_holidays' => implode('|', $_REQUEST['week_holidays']), 'user_name_template' => $_REQUEST['user_name_template'], 'user_show_login' => isset($_REQUEST['user_show_login']), 'path_to_user' => $_REQUEST['path_to_user'], 'path_to_user_calendar' => $_REQUEST['path_to_user_calendar'], 'path_to_group' => $_REQUEST['path_to_group'], 'path_to_group_calendar' => $_REQUEST['path_to_group_calendar'], 'path_to_vr' => $_REQUEST['path_to_vr'], 'path_to_rm' => $_REQUEST['path_to_rm'], 'rm_iblock_type' => $_REQUEST['rm_iblock_type'], 'rm_iblock_id' => $_REQUEST['rm_iblock_id'], 'vr_iblock_id' => $_REQUEST['vr_iblock_id'], 'denied_superpose_types' => array(), 'pathes_for_sites' => isset($_REQUEST['pathes_for_sites']), 'pathes' => $_REQUEST['pathes'], 'dep_manager_sub' => isset($_REQUEST['dep_manager_sub'])); foreach ($arTypes as $type) { if (!in_array($type['XML_ID'], $_REQUEST['denied_superpose_types'])) { $SET['denied_superpose_types'][] = $type['XML_ID']; } } $CUR_SET = CCalendar::GetSettings(array('getDefaultForEmpty' => false)); foreach ($CUR_SET as $key => $value) { if (!isset($SET[$key]) && isset($value)) { $SET[$key] = $value; } } CCalendar::SetSettings($SET); }
public static function SectionAdd($arParams = array(), $nav = null, $server = null) { $userId = CCalendar::GetCurUserId(); $methodName = "calendar.section.add"; $DEFAULT_COLOR = '#E6A469'; $DEFAULT_TEXT_COLOR = '#000000'; if (isset($arParams['type'])) { $type = $arParams['type']; } else { throw new Exception(GetMessage('CAL_REST_PARAM_EXCEPTION', array('#REST_METHOD#' => $methodName, '#PARAM_NAME#' => 'type'))); } if (isset($arParams['ownerId'])) { $ownerId = intval($arParams['ownerId']); } elseif ($type == 'user') { $ownerId = $userId; } else { throw new Exception(GetMessage('CAL_REST_PARAM_EXCEPTION', array('#REST_METHOD#' => $methodName, '#PARAM_NAME#' => 'ownerId'))); } $perm = CCalendar::GetPermissions(array('type' => $type, 'ownerId' => $ownerId, 'userId' => $userId, 'setProperties' => false)); if ($type == 'group' || $type == 'user') { if (!$perm['section_edit']) { throw new Exception(GetMessage('CAL_REST_ACCESS_DENIED')); } } else { if (!CCalendarType::CanDo('calendar_type_edit_section')) { throw new Exception(GetMessage('CAL_REST_ACCESS_DENIED')); } } $arFields = array('CAL_TYPE' => $type, 'OWNER_ID' => $ownerId, 'NAME' => isset($arParams['name']) && trim($arParams['name']) != '' ? trim($arParams['name']) : '', 'DESCRIPTION' => isset($arParams['description']) && trim($arParams['description']) != '' ? trim($arParams['description']) : ''); if (isset($arParams['export']) && isset($arParams['export']['ALLOW']) && isset($arParams['export']['SET'])) { $arFields['EXPORT'] = array('ALLOW' => !!$arParams['export']['ALLOW'], 'SET' => $arParams['export']['SET']); } if (isset($arParams['color'])) { $arFields['COLOR'] = CCalendar::Color($arParams['color'], $DEFAULT_COLOR); } else { $arFields['COLOR'] = $DEFAULT_COLOR; } if (isset($arParams['text_color'])) { $arFields['TEXT_COLOR'] = CCalendar::Color($arParams['text_color'], $DEFAULT_TEXT_COLOR); } else { $arFields['TEXT_COLOR'] = $DEFAULT_TEXT_COLOR; } if (isset($arParams['access']) && is_array($arParams['access'])) { $arFields['ACCESS'] = $arParams['access']; } $id = CCalendar::SaveSection(array('bAffectToDav' => false, 'arFields' => $arFields)); if (!$id) { throw new Exception(GetMessage('CAL_REST_SECTION_NEW_ERROR')); } CCalendarSect::SetClearOperationCache(true); return $id; }