當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。