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


PHP CCalendar::Init方法代码示例

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


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

示例1: SaveCalendarEvent

 protected static function SaveCalendarEvent(&$arFields)
 {
     $responsibleID = isset($arFields['RESPONSIBLE_ID']) ? intval($arFields['RESPONSIBLE_ID']) : 0;
     $typeID = isset($arFields['TYPE_ID']) ? intval($arFields['TYPE_ID']) : CCrmActivityType::Undefined;
     if (!($responsibleID > 0 && ($typeID === CCrmActivityType::Call || $typeID === CCrmActivityType::Meeting))) {
         return false;
     }
     if (!(IsModuleInstalled('calendar') && CModule::IncludeModule('calendar'))) {
         return false;
     }
     $arCalEventFields = array('CAL_TYPE' => 'user', 'OWNER_ID' => $responsibleID, 'NAME' => isset($arFields['SUBJECT']) ? $arFields['SUBJECT'] : '', 'DT_FROM' => isset($arFields['START_TIME']) ? $arFields['START_TIME'] : '', 'DT_TO' => isset($arFields['END_TIME']) ? $arFields['END_TIME'] : '', 'IMPORTANCE' => CCrmActivityPriority::ToCalendarEventImportance(isset($arFields['PRIORITY']) ? intval($arFields['PRIORITY']) : CCrmActivityPriority::Low), 'DESCRIPTION' => isset($arFields['DESCRIPTION']) ? $arFields['DESCRIPTION'] : '');
     $associatedEntityID = isset($arFields['ASSOCIATED_ENTITY_ID']) ? intval($arFields['ASSOCIATED_ENTITY_ID']) : 0;
     if ($associatedEntityID > 0) {
         $arCalEventFields['ID'] = $associatedEntityID;
         $arPresentEventFields = CCalendarEvent::GetById($associatedEntityID, false);
         if (is_array($arPresentEventFields)) {
             if (isset($arPresentEventFields['RRULE']) && $arPresentEventFields['RRULE'] != '') {
                 $arCalEventFields['RRULE'] = CCalendarEvent::ParseRRULE($arPresentEventFields['RRULE']);
             }
             if (isset($arPresentEventFields['DT_LENGTH'])) {
                 $arCalEventFields['DT_LENGTH'] = $arPresentEventFields['DT_LENGTH'];
             }
         }
     }
     if (isset($arFields['NOTIFY_TYPE']) && $arFields['NOTIFY_TYPE'] != CCrmActivityNotifyType::None) {
         $arCalEventFields['REMIND'] = array(array('type' => CCrmActivityNotifyType::ToCalendarEventRemind($arFields['NOTIFY_TYPE']), 'count' => isset($arFields['NOTIFY_VALUE']) ? intval($arFields['NOTIFY_VALUE']) : 15));
     }
     self::$IGNORE_CALENDAR_EVENTS = true;
     // We must initialize CCalendar!
     $calendar = new CCalendar();
     $calendar->Init(array('type' => 'user', 'userId' => $responsibleID, 'ownerId' => $responsibleID));
     $result = $calendar->SaveEvent(array('arFields' => $arCalEventFields, 'userId' => $responsibleID, 'autoDetectSection' => true, 'autoCreateSection' => true));
     $eventID = intval($result);
     $ownerID = intval($arFields['OWNER_ID']);
     $ownerTypeID = intval($arFields['OWNER_TYPE_ID']);
     $arBindings = isset($arFields['BINDINGS']) ? $arFields['BINDINGS'] : array();
     if (empty($arBindings) && $ownerID > 0 && $ownerTypeID > 0) {
         $arBindings[] = array('OWNER_TYPE_ID' => $ownerTypeID, 'OWNER_ID' => $ownerID);
     }
     if ($eventID > 0 && !empty($arBindings)) {
         $arUserFields = array();
         foreach ($arBindings as &$arBinding) {
             $arUserFields[] = CUserTypeCrm::GetShortEntityType(CCrmOwnerType::ResolveName($arBinding['OWNER_TYPE_ID'])) . '_' . $arBinding['OWNER_ID'];
         }
         unset($arBinding);
         CCalendarEvent::UpdateUserFields($eventID, array('UF_CRM_CAL_EVENT' => $arUserFields));
     }
     self::$IGNORE_CALENDAR_EVENTS = false;
     return $result;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:50,代码来源:crm_activity.php

示例2: ShowError

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("calendar")) {
    return ShowError("EC_CALENDAR_MODULE_NOT_INSTALLED");
}
CModule::IncludeModule("socialnetwork");
$APPLICATION->ResetException();
$Params = array('type' => $arParams["CALENDAR_TYPE"], 'ownerId' => $arParams["OWNER_ID"], 'pageUrl' => htmlspecialcharsback(POST_FORM_ACTION_URI), 'allowSuperpose' => $arParams["ALLOW_SUPERPOSE"] == 'Y', 'allowResMeeting' => $arParams["ALLOW_RES_MEETING"] != 'N', 'allowVideoMeeting' => $arParams["ALLOW_RES_MEETING"] != 'N', 'SectionControlsDOMId' => 'sidebar', 'user_name_template' => empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]));
if (isset($arParams["SIDEBAR_DOM_ID"])) {
    $Params['SectionControlsDOMId'] = $arParams["SIDEBAR_DOM_ID"];
}
// Create new instance of Event Calendar object
$EC = new CCalendar();
$EC->Init($Params);
// Init with $Params array
if (isset($_REQUEST['action'])) {
    $EC->Request($_REQUEST['action']);
} else {
    $EC->Show();
}
if ($ex = $APPLICATION->GetException()) {
    return ShowError($ex->GetString());
}
// Set title and navigation
$arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "Y" ? "Y" : "N";
$arParams["SET_NAV_CHAIN"] = $arParams["SET_NAV_CHAIN"] == "Y" ? "Y" : "N";
//Turn OFF by default
if ($arParams["STR_TITLE"]) {
    $arParams["STR_TITLE"] = trim($arParams["STR_TITLE"]);
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:component.php


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