当前位置: 首页>>代码示例>>PHP>>正文


PHP CCalendar::SaveSection方法代码示例

本文整理汇总了PHP中CCalendar::SaveSection方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::SaveSection方法的具体用法?PHP CCalendar::SaveSection怎么用?PHP CCalendar::SaveSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCalendar的用法示例。


在下文中一共展示了CCalendar::SaveSection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetStsSyncURL

 function GetStsSyncURL($arSectionParams, $type = 'calendar', $employees = false)
 {
     global $USER, $APPLICATION;
     if (!is_array($arSectionParams)) {
         $arSectionParams = array('ID' => intval($arSectionParams));
     }
     //if (!$arSectionParams['ID'])
     //	return false;
     $arAllowedTypes = array('calendar', 'tasks', 'contacts');
     if (!in_array($type, $arAllowedTypes)) {
         $type = 'calendar';
     }
     if ($type == 'calendar') {
         $calendar2 = COption::GetOptionString("intranet", "calendar_2", "N") == "Y" && CModule::IncludeModule("calendar");
         $fld_EXTERNAL_ID = 'XML_ID';
         if ($calendar2) {
             // $arSectionParams = array(
             // 'ID' => int
             // 'XML_ID' => string
             // 'NAME' => string
             // 'PREFIX' => string
             // 'LINK_URL' => string
             // 'TYPE' => string
             // )
             if (strlen($arSectionParams['XML_ID']) !== 32) {
                 $arSectionParams[$fld_EXTERNAL_ID] = md5($arSectionParams['TYPE'] . '_' . $arSectionParams['ID'] . '_' . RandString(8));
                 // Set XML_ID
                 CCalendar::SaveSection(array('arFields' => array('ID' => $arSectionParams['ID'], 'XML_ID' => $arSectionParams[$fld_EXTERNAL_ID]), 'bAffectToDav' => false, 'bCheckPermissions' => false));
             }
         } else {
             if (!$arSectionParams['IBLOCK_ID'] || !$arSectionParams['NAME'] || !$arSectionParams[$fld_EXTERNAL_ID]) {
                 $dbRes = CIBlockSection::GetByID($arSectionParams['ID']);
                 $arSection = $dbRes->Fetch();
                 if ($arSection) {
                     $arSectionParams['IBLOCK_ID'] = $arSection['IBLOCK_ID'];
                     $arSectionParams['NAME'] = $arSection['NAME'];
                     $arSectionParams[$fld_EXTERNAL_ID] = $arSection[$fld_EXTERNAL_ID];
                 } else {
                     return false;
                 }
             }
             if (strlen($arSectionParams[$fld_EXTERNAL_ID]) !== 32) {
                 $arSectionParams[$fld_EXTERNAL_ID] = md5($arSectionParams['IBLOCK_ID'] . '_' . $arSectionParams['ID'] . '_' . RandString(8));
                 $obSect = new CIBlockSection();
                 if (!$obSect->Update($arSectionParams['ID'], array($fld_EXTERNAL_ID => $arSectionParams[$fld_EXTERNAL_ID]), false, false)) {
                     return false;
                 }
             }
         }
         if (!$arSectionParams['PREFIX']) {
             $rsSites = CSite::GetByID(SITE_ID);
             $arSite = $rsSites->Fetch();
             if (strlen($arSite["NAME"]) > 0) {
                 $arSectionParams['PREFIX'] = $arSite["NAME"];
             } else {
                 $arSectionParams['PREFIX'] = COption::GetOptionString('main', 'site_name', GetMessage('INTR_OUTLOOK_PREFIX_CONTACTS'));
             }
         }
         $GUID = CIntranetUtils::makeGUID($arSectionParams[$fld_EXTERNAL_ID]);
     } elseif ($type == 'contacts') {
         if (!$arSectionParams['LINK_URL']) {
             if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
                 $arSectionParams['LINK_URL'] = SITE_DIR . 'contacts/';
             } else {
                 $arSectionParams['LINK_URL'] = SITE_DIR . 'company/';
             }
         }
         if (!$arSectionParams['NAME']) {
             if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite() && !$employees) {
                 $arSectionParams['NAME'] = GetMessage('INTR_OUTLOOK_TITLE_CONTACTS_EXTRANET');
             } else {
                 $arSectionParams['NAME'] = GetMessage('INTR_OUTLOOK_TITLE_CONTACTS');
             }
         }
         if (!$arSectionParams['PREFIX']) {
             $rsSites = CSite::GetByID(SITE_ID);
             $arSite = $rsSites->Fetch();
             if (strlen($arSite["NAME"]) > 0) {
                 $arSectionParams['PREFIX'] = $arSite["NAME"];
             } else {
                 $arSectionParams['PREFIX'] = COption::GetOptionString('main', 'site_name', GetMessage('INTR_OUTLOOK_PREFIX_CONTACTS'));
             }
         }
         $SERVER_NAME = $_SERVER['SERVER_NAME'];
         $GUID_DATA = $SERVER_NAME . '|' . $type;
         if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
             $GUID_DATA .= "|extranet";
             if ($employees) {
                 $GUID_DATA .= "|employees";
             }
         }
         $GUID = CIntranetUtils::makeGUID(md5($GUID_DATA));
     } elseif ($type == 'tasks') {
         if (!$arSectionParams['LINK_URL']) {
             if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
                 $arSectionParams['LINK_URL'] = SITE_DIR . 'contacts/personal/user/' . $USER->GetID() . '/tasks/';
             } else {
                 $arSectionParams['LINK_URL'] = SITE_DIR . 'company/personal/user/' . $USER->GetID() . '/tasks/';
             }
         }
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:utils.php

示例2: SyncCalendars

 public static function SyncCalendars($connectionType, $arCalendars, $entityType, $entityId, $connectionId = null)
 {
     self::$silentErrorMode = true;
     //Array(
     //	[0] => Array(
     //		[XML_ID] => calendar
     //		[NAME] => calendar
     //	)
     //	[1] => Array(
     //		[XML_ID] => AQATAGFud...
     //		[NAME] => geewgvwe 1
     //		[DESCRIPTION] => gewgvewgvw
     //		[COLOR] => #FF0000
     //		[MODIFICATION_LABEL] => af720e7c7b6a
     //	)
     //)
     $entityType = strtolower($entityType);
     $entityId = intVal($entityId);
     $tempUser = self::TempUser(false, true);
     $arCalendarNames = array();
     foreach ($arCalendars as $value) {
         $arCalendarNames[$value["XML_ID"]] = $value;
     }
     if ($connectionType == 'exchange') {
         $xmlIdField = "DAV_EXCH_CAL";
         $xmlIdModLabel = "DAV_EXCH_MOD";
     } elseif ($connectionType == 'caldav') {
         $xmlIdField = "CAL_DAV_CAL";
         $xmlIdModLabel = "CAL_DAV_MOD";
     } else {
         return array();
     }
     $arFilter = array('CAL_TYPE' => $entityType, 'OWNER_ID' => $entityId, '!' . $xmlIdField => false);
     if ($connectionType == 'caldav') {
         $arFilter["CAL_DAV_CON"] = $connectionId;
     }
     if ($connectionType == 'exchange') {
         $arFilter["IS_EXCHANGE"] = 1;
     }
     $arResult = array();
     $res = CCalendarSect::GetList(array('arFilter' => $arFilter, 'checkPermissions' => false));
     foreach ($res as $section) {
         $xmlId = $section[$xmlIdField];
         $modificationLabel = $section[$xmlIdModLabel];
         if (empty($xmlId)) {
             continue;
         }
         if (!array_key_exists($xmlId, $arCalendarNames)) {
             CCalendarSect::Delete($section["ID"]);
         } else {
             if ($modificationLabel != $arCalendarNames[$xmlId]["MODIFICATION_LABEL"]) {
                 CCalendarSect::Edit(array('arFields' => array("ID" => $section["ID"], "NAME" => $arCalendarNames[$xmlId]["NAME"], "OWNER_ID" => $entityType == 'user' ? $entityId : 0, "CREATED_BY" => $entityType == 'user' ? $entityId : 0, "DESCRIPTION" => $arCalendarNames[$xmlId]["DESCRIPTION"], "COLOR" => $arCalendarNames[$xmlId]["COLOR"], $xmlIdModLabel => $arCalendarNames[$xmlId]["MODIFICATION_LABEL"])));
             }
             if (empty($modificationLabel) || $modificationLabel != $arCalendarNames[$xmlId]["MODIFICATION_LABEL"]) {
                 $arResult[] = array("XML_ID" => $xmlId, "CALENDAR_ID" => array($section["ID"], $entityType, $entityId));
             }
             unset($arCalendarNames[$xmlId]);
         }
     }
     foreach ($arCalendarNames as $key => $value) {
         $arFields = array('CAL_TYPE' => $entityType, 'OWNER_ID' => $entityId, 'NAME' => $value["NAME"], 'DESCRIPTION' => $value["DESCRIPTION"], 'COLOR' => $value["COLOR"], 'EXPORT' => array('ALLOW' => false), "CREATED_BY" => $entityType == 'user' ? $entityId : 0, 'ACCESS' => array(), $xmlIdField => $key, $xmlIdModLabel => $value["MODIFICATION_LABEL"]);
         if ($connectionType == 'caldav') {
             $arFields["CAL_DAV_CON"] = $connectionId;
         }
         if ($entityType == 'user') {
             $arFields["CREATED_BY"] = $entityId;
         }
         if ($connectionType == 'exchange') {
             $arFields["IS_EXCHANGE"] = 1;
         }
         $id = intVal(CCalendar::SaveSection(array('arFields' => $arFields, 'bAffectToDav' => false)));
         if ($id) {
             $arResult[] = array("XML_ID" => $key, "CALENDAR_ID" => array($id, $entityType, $entityId));
         }
     }
     self::TempUser($tempUser, false);
     self::$silentErrorMode = false;
     return $arResult;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:79,代码来源:calendar.php

示例3: array

<?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));
}
开发者ID:spas-viktor,项目名称:books,代码行数:21,代码来源:index.php

示例4: array

<?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));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:27,代码来源:index.php

示例5: SectionUpdate

 public static function SectionUpdate($arParams = array(), $nav = null, $server = null)
 {
     $userId = CCalendar::GetCurUserId();
     $methodName = "calendar.section.update";
     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')));
     }
     if (isset($arParams['id']) && intVal($arParams['id']) > 0) {
         $id = intVal($arParams['id']);
     } else {
         throw new Exception(GetMessage('CAL_REST_SECT_ID_EXCEPTION'));
     }
     if (!CCalendar::IsPersonal($type, $ownerId, $userId) && !CCalendarSect::CanDo('calendar_edit_section', $id, $userId)) {
         throw new Exception(GetMessage('CAL_REST_ACCESS_DENIED'));
     }
     $arFields = array('ID' => $id, 'CAL_TYPE' => $type, 'OWNER_ID' => $ownerId);
     if (isset($arParams['name']) && trim($arParams['name']) != '') {
         $arFields['NAME'] = trim($arParams['name']);
     }
     if (isset($arParams['description']) && trim($arParams['description']) != '') {
         $arFields['DESCRIPTION'] = trim($arParams['description']);
     }
     if (isset($arParams['color'])) {
         $arFields['COLOR'] = CCalendar::Color($arParams['color']);
     }
     if (isset($arParams['text_color'])) {
         $arFields['TEXT_COLOR'] = CCalendar::Color($arParams['text_color']);
     }
     if (isset($arParams['access']) && is_array($arParams['access'])) {
         $arFields['ACCESS'] = $arParams['access'];
     }
     $id = intVal(CCalendar::SaveSection(array('bAffectToDav' => false, 'arFields' => $arFields)));
     if (!$id) {
         throw new Exception(GetMessage('CAL_REST_SECTION_SAVE_ERROR'));
     }
     return $id;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:46,代码来源:calendar_restservice.php


注:本文中的CCalendar::SaveSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。