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


PHP CCalendar::IsCalDAVEnabled方法代码示例

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


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

示例1: DoSaveToDav

 public static function DoSaveToDav($Params = array(), &$arFields, $oCurEvent = false)
 {
     $sectionId = $Params['sectionId'];
     $bExchange = $Params['bExchange'];
     $bCalDav = $Params['bCalDav'];
     if (isset($oCurEvent['DAV_XML_ID'])) {
         $arFields['DAV_XML_ID'] = $oCurEvent['DAV_XML_ID'];
     }
     if (isset($oCurEvent['DAV_EXCH_LABEL'])) {
         $arFields['DAV_EXCH_LABEL'] = $oCurEvent['DAV_EXCH_LABEL'];
     }
     if (isset($oCurEvent['CAL_DAV_LABEL'])) {
         $arFields['CAL_DAV_LABEL'] = $oCurEvent['CAL_DAV_LABEL'];
     }
     $oSect = CCalendarSect::GetById($sectionId);
     if ($oCurEvent) {
         if ($oCurEvent['SECT_ID'] != $sectionId) {
             $bCalDav = CCalendar::IsCalDAVEnabled() && $oCurEvent['CAL_TYPE'] == 'user' && strlen($oCurEvent['CAL_DAV_LABEL']) > 0;
             $bExchangeEnabled = CCalendar::IsExchangeEnabled() && $oCurEvent['CAL_TYPE'] == 'user';
             if ($bExchangeEnabled || $bCalDav) {
                 $res = CCalendar::DoDeleteToDav(array('bCalDav' => $bCalDav, 'bExchangeEnabled' => $bExchangeEnabled, 'sectionId' => $oCurEvent['SECT_ID']), $oCurEvent);
                 if ($res !== true) {
                     return CCalendar::ThrowError($res);
                 }
             }
         }
     }
     $fromTs = CCalendar::Timestamp($arFields['DT_FROM']);
     $toTs = CCalendar::Timestamp($arFields['DT_TO']);
     if (!isset($arFields['DT_FROM_TS'])) {
         $arFields['DT_FROM_TS'] = $fromTs;
     }
     if (!isset($arFields['DT_TO_TS'])) {
         $arFields['DT_TO_TS'] = $toTs;
     }
     $arDavFields = $arFields;
     CCalendarEvent::CheckFields($arDavFields);
     if ($arDavFields['RRULE'] != '') {
         $arDavFields['RRULE'] = $arFields['RRULE'];
     }
     $arDavFields['DETAIL_TEXT'] = $arDavFields['DESCRIPTION'];
     $arDavFields['DETAIL_TEXT_TYPE'] = 'text';
     $arDavFields['ACTIVE_FROM'] = $arDavFields['DT_FROM'];
     $arDavFields['ACTIVE_TO'] = $arDavFields['DT_TO'];
     $arDavFields['PROPERTY_LOCATION'] = $arDavFields['LOCATION']['NEW'];
     if ($arDavFields['PROPERTY_LOCATION'] !== '') {
         $arDavFields['PROPERTY_LOCATION'] = CCalendar::GetTextLocation($arDavFields['PROPERTY_LOCATION']);
     }
     $arDavFields['PROPERTY_IMPORTANCE'] = $arDavFields['IMPORTANCE'];
     $arDavFields['REMIND_SETTINGS'] = '';
     if ($arFields['REMIND'] && is_array($arFields['REMIND']) && is_array($arFields['REMIND'][0])) {
         $arDavFields['REMIND_SETTINGS'] = floatVal($arFields['REMIND'][0]['count']) . '_' . $arFields['REMIND'][0]['type'];
     }
     // RRULE
     $arDavFields['PROPERTY_PERIOD_TYPE'] = 'NONE';
     if (is_array($arFields['RRULE']) && isset($arFields['RRULE']['FREQ']) && in_array($arFields['RRULE']['FREQ'], array('HOURLY', 'DAILY', 'MONTHLY', 'YEARLY', 'WEEKLY'))) {
         $arDavFields['PROPERTY_PERIOD_TYPE'] = $arFields['RRULE']['FREQ'];
         // Interval
         $arDavFields['PROPERTY_PERIOD_COUNT'] = isset($arFields['RRULE']['INTERVAL']) && intVal($arFields['RRULE']['INTERVAL']) > 1 ? intVal($arFields['RRULE']['INTERVAL']) : 1;
         if ($arFields['RRULE']['FREQ'] == 'WEEKLY' && isset($arFields['RRULE']['BYDAY'])) {
             //PROPERTY_PERIOD_ADDITIONAL
             $BYDAYS = array();
             $days = array('SU' => 0, 'MO' => 1, 'TU' => 2, 'WE' => 3, 'TH' => 4, 'FR' => 5, 'SA' => 6);
             $bydays = explode(',', $arFields['RRULE']['BYDAY']);
             foreach ($bydays as $day) {
                 $BYDAYS[] = $days[$day];
             }
             $arDavFields['PROPERTY_PERIOD_ADDITIONAL'] = implode(',', $BYDAYS);
         }
         $h24 = 60 * 60 * 24;
         if ($fromTs == $toTs) {
             $arDavFields['PROPERTY_EVENT_LENGTH'] = $h24;
         } else {
             $arDavFields['PROPERTY_EVENT_LENGTH'] = intVal($toTs - $fromTs);
             if ($arDavFields['PROPERTY_EVENT_LENGTH'] % $h24 == 0) {
                 // We have dates without times
                 $arDavFields['PROPERTY_EVENT_LENGTH'] += $h24;
             }
         }
         // Until date
         if (isset($arFields['RRULE']['UNTIL'])) {
             $periodTs = $arFields['RRULE']['UNTIL'];
         } else {
             $periodTs = CCalendar::GetMaxTimestamp();
         }
         $arDavFields['ACTIVE_TO'] = CCalendar::Date($periodTs);
     }
     // **** Synchronize with CalDav ****
     if ($bCalDav && $oSect['CAL_DAV_CON'] > 0) {
         // New event or move existent event to DAV calendar
         if ($arFields['ID'] <= 0 || $oCurEvent && !$oCurEvent['CAL_DAV_LABEL']) {
             $DAVRes = CDavGroupdavClientCalendar::DoAddItem($oSect['CAL_DAV_CON'], $oSect['CAL_DAV_CAL'], $arDavFields);
         } else {
             // Edit existent event
             $DAVRes = CDavGroupdavClientCalendar::DoUpdateItem($oSect['CAL_DAV_CON'], $oSect['CAL_DAV_CAL'], $oCurEvent['DAV_XML_ID'], $oCurEvent['CAL_DAV_LABEL'], $arDavFields);
         }
         if (!is_array($DAVRes) || !array_key_exists("XML_ID", $DAVRes)) {
             return CCalendar::CollectCalDAVErros($DAVRes);
         }
         // // It's ok, we successfuly save event to caldav calendar - and save it to DB
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:calendar.php

示例2: GetList

 public static function GetList($Params = array())
 {
     global $DB, $USER;
     $arFilter = $Params['arFilter'];
     $arOrder = isset($Params['arOrder']) ? $Params['arOrder'] : array('SORT' => 'asc');
     $Params['joinTypeInfo'] = !!$Params['joinTypeInfo'];
     $checkPermissions = $Params['checkPermissions'] !== false;
     $bCache = CCalendar::CacheTime() > 0;
     if ($bCache) {
         $cache = new CPHPCache();
         $cacheId = serialize(array('section_list', $arFilter, $arOrder, $Params['joinTypeInfo'], CCalendar::IsIntranetEnabled()));
         $cachePath = CCalendar::CachePath() . 'section_list';
         if ($cache->InitCache(CCalendar::CacheTime(), $cacheId, $cachePath)) {
             $res = $cache->GetVars();
             $arResult = $res["arResult"];
             $arSectionIds = $res["arSectionIds"];
         }
     }
     if (!$bCache || !isset($arSectionIds)) {
         $arFields = self::GetFields();
         $arSqlSearch = array();
         if (is_array($arFilter)) {
             $filter_keys = array_keys($arFilter);
             for ($i = 0, $l = count($filter_keys); $i < $l; $i++) {
                 $n = strtoupper($filter_keys[$i]);
                 $val = $arFilter[$filter_keys[$i]];
                 if (is_string($val) && strlen($val) <= 0 || strval($val) == "NOT_REF") {
                     continue;
                 }
                 if ($n == 'ID' || $n == 'XML_ID' || $n == 'OWNER_ID') {
                     $arSqlSearch[] = GetFilterQuery("CS." . $n, $val, 'N');
                 } elseif ($n == 'CAL_TYPE' && is_array($val)) {
                     $strType = "";
                     foreach ($val as $type) {
                         $strType .= ",'" . CDatabase::ForSql($type) . "'";
                     }
                     $arSqlSearch[] = "CS.CAL_TYPE in (" . trim($strType, ", ") . ")";
                     $arSqlSearch[] = "CT.ACTIVE='Y'";
                 } elseif (isset($arFields[$n])) {
                     $arSqlSearch[] = GetFilterQuery($arFields[$n]["FIELD_NAME"], $val, isset($arFields[$n]["PROCENT"]) && $arFields[$n]["PROCENT"] == "N" ? "N" : "Y");
                 }
             }
         }
         $strOrderBy = '';
         foreach ($arOrder as $by => $order) {
             if (isset($arFields[strtoupper($by)])) {
                 $strOrderBy .= $arFields[strtoupper($by)]["FIELD_NAME"] . ' ' . (strtolower($order) == 'desc' ? 'desc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS LAST" : "") : 'asc' . (strtoupper($DB->type) == "ORACLE" ? " NULLS FIRST" : "")) . ',';
             }
         }
         if (strlen($strOrderBy) > 0) {
             $strOrderBy = "ORDER BY " . rtrim($strOrderBy, ",");
         }
         $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
         if (isset($arFilter['ADDITIONAL_IDS']) && is_array($arFilter['ADDITIONAL_IDS']) && count($arFilter['ADDITIONAL_IDS']) > 0) {
             $strTypes = "";
             foreach ($arFilter['ADDITIONAL_IDS'] as $adid) {
                 $strTypes .= "," . IntVal($adid);
             }
             $strSqlSearch = '(' . $strSqlSearch . ') OR ID in(' . trim($strTypes, ', ') . ')';
         }
         $select = 'CS.*';
         $from = 'b_calendar_section CS';
         // Fetch types info into selection
         if ($Params['joinTypeInfo']) {
             $select .= ", CT.NAME AS TYPE_NAME, CT.DESCRIPTION AS TYPE_DESC";
             $from .= "\n INNER JOIN b_calendar_type CT ON (CS.CAL_TYPE=CT.XML_ID)";
         }
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\t{$select}\n\t\t\t\tFROM\n\t\t\t\t\t{$from}\n\t\t\t\tWHERE\n\t\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strOrderBy}";
         $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $arResult = array();
         $arSectionIds = array();
         $isExchangeEnabled = CCalendar::IsExchangeEnabled();
         $isCalDAVEnabled = CCalendar::IsCalDAVEnabled();
         while ($arRes = $res->Fetch()) {
             $arRes['COLOR'] = CCalendar::Color($arRes['COLOR'], true);
             $arSectionIds[] = $arRes['ID'];
             if (isset($arRes['EXPORT']) && $arRes['EXPORT'] != "") {
                 $arRes['EXPORT'] = unserialize($arRes['EXPORT']);
                 if (is_array($arRes['EXPORT']) && $arRes['EXPORT']['ALLOW']) {
                     $arRes['EXPORT']['LINK'] = self::GetExportLink($arRes['ID'], $arRes['CAL_TYPE'], $arRes['OWNER_ID']);
                 }
             }
             if (!is_array($arRes['EXPORT'])) {
                 $arRes['EXPORT'] = array('ALLOW' => false, 'SET' => false, 'LINK' => false);
             }
             // Outlook js
             if (CCalendar::IsIntranetEnabled()) {
                 $arRes['OUTLOOK_JS'] = CCalendarSect::GetOutlookLink(array('ID' => intVal($arRes['ID']), 'XML_ID' => $arRes['XML_ID'], 'TYPE' => $arRes['CAL_TYPE'], 'NAME' => $arRes['NAME'], 'PREFIX' => CCalendar::GetOwnerName($arRes['CAL_TYPE'], $arRes['OWNER_ID']), 'LINK_URL' => CCalendar::GetOuterUrl()));
             }
             if ($arRes['CAL_TYPE'] == 'user') {
                 $arRes['IS_EXCHANGE'] = strlen($arRes["DAV_EXCH_CAL"]) > 0 && $isExchangeEnabled;
                 if ($arRes["CAL_DAV_CON"] && $isCalDAVEnabled) {
                     $arRes["CAL_DAV_CON"] = intVal($arRes["CAL_DAV_CON"]);
                     $resCon = CDavConnection::GetList(array("ID" => "ASC"), array("ID" => $arRes["CAL_DAV_CON"]));
                     if ($con = $resCon->Fetch()) {
                         $arRes['CAL_DAV_CON'] = $arRes["CAL_DAV_CON"];
                     } else {
                         $arRes['CAL_DAV_CON'] = false;
                     }
                 }
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:calendar_sect.php

示例3: Build

    public static function Build($Params)
    {
        global $APPLICATION;
        $id = $Params['id'];
        $Tabs = array(array('name' => GetMessage('EC_TAB_MONTH'), 'title' => GetMessage('EC_TAB_MONTH_TITLE'), 'id' => $id . "_tab_month"), array('name' => GetMessage('EC_TAB_WEEK'), 'title' => GetMessage('EC_TAB_WEEK_TITLE'), 'id' => $id . "_tab_week"), array('name' => GetMessage('EC_TAB_DAY'), 'title' => GetMessage('EC_TAB_DAY_TITLE'), 'id' => $id . "_tab_day"));
        $bCalDAV = CCalendar::IsCalDAVEnabled() && $Params['type'] == 'user';
        // Here can be added user's dialogs, scripts, html
        foreach (GetModuleEvents("calendar", "OnBeforeBuildSceleton", true) as $arEvent) {
            ExecuteModuleEventEx($arEvent);
        }
        $days = self::GetWeekDaysEx(CCalendar::GetWeekStart());
        ?>
<script>
/* Event handler for user control*/
function bxcUserSelectorOnchange(arUsers){BX.onCustomEvent(window, 'onUserSelectorOnChange', [arUsers]);}
</script>
		<?php 
        if ($Params['bShowSections'] || $Params['bShowSuperpose'] || $Params['bShowBanner']) {
            ?>
<div class="bxec-sect-cont" id="<?php 
            echo $id;
            ?>
_sect_cont">
	<b class="r2"></b><b class="r1"></b><b class="r0"></b>
		<?php 
            if ($Params['bShowSections']) {
                ?>
		<span class="bxec-sect-cont-wrap" id="<?php 
                echo $id;
                ?>
sections">
			<b class="r-2"></b><b class="r-1"></b><b class="r-0"></b>
			<div class="bxec-sect-cont-inner">
				<div class="bxec-sect-title"><span class="bxec-spr bxec-flip"></span><span class="bxec-sect-title-text"><?php 
                echo GetMessage('EC_T_CALENDARS');
                ?>
</span>
				<a id="<?php 
                echo $id;
                ?>
-add-section" class="bxec-sect-top-action" href="javascript:void(0);" title="<?php 
                echo GetMessage('EC_ADD_CAL_TITLE');
                ?>
"  hidefocus="true" style="visibility:hidden;"><?php 
                echo strtolower(GetMessage('EC_T_ADD'));
                ?>
</a>
				</div>
				<div class="bxec-sect-cont-white">
					<div id="<?php 
                echo $id;
                ?>
sections-cont"></div>
					<?php 
                if ($Params['bShowTasks']) {
                    ?>
					<div id="<?php 
                    echo $id;
                    ?>
tasks-sections-cont"></div>
					<?php 
                }
                ?>
					<div id="<?php 
                echo $id;
                ?>
caldav-sections-cont"></div>
				</div>
			</div>
			<i class="r-0"></i><i class="r-1"></i><i class="r-2"></i>
		</span>
		<?php 
            }
            /*bShowSections*/
            ?>

		<?php 
            if ($Params['bShowSuperpose']) {
                ?>
		<span class="bxec-sect-cont-wrap" id="<?php 
                echo $id;
                ?>
sp-sections">
			<b class="r-2"></b><b class="r-1"></b><b class="r-0"></b>
			<div class="bxec-sect-cont-inner bxec-sect-superpose">
				<div class="bxec-sect-title"><span class="bxec-spr bxec-flip"></span><span class="bxec-sect-title-text"><?php 
                echo GetMessage('EC_T_SP_CALENDARS');
                ?>
</span>
				<a id="<?php 
                echo $id;
                ?>
-manage-superpose" class="bxec-sect-top-action" href="javascript:void(0);" title="<?php 
                echo GetMessage('EC_ADD_EX_CAL_TITLE');
                ?>
"  hidefocus="true" style="visibility:hidden;"><?php 
                echo strtolower(GetMessage('EC_ADD_EX_CAL'));
                ?>
</a>
				</div>
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:calendar_sceleton.php

示例4: DoSaveToDav

 public static function DoSaveToDav($Params = array(), &$arFields, $oCurEvent = false)
 {
     $sectionId = $Params['sectionId'];
     $bExchange = $Params['bExchange'];
     $bCalDav = $Params['bCalDav'];
     if (isset($oCurEvent['DAV_XML_ID'])) {
         $arFields['DAV_XML_ID'] = $oCurEvent['DAV_XML_ID'];
     }
     if (isset($oCurEvent['DAV_EXCH_LABEL'])) {
         $arFields['DAV_EXCH_LABEL'] = $oCurEvent['DAV_EXCH_LABEL'];
     }
     if (isset($oCurEvent['CAL_DAV_LABEL'])) {
         $arFields['CAL_DAV_LABEL'] = $oCurEvent['CAL_DAV_LABEL'];
     }
     $oSect = CCalendarSect::GetById($sectionId);
     if ($oCurEvent) {
         if ($oCurEvent['SECT_ID'] != $sectionId) {
             $bCalDavCur = CCalendar::IsCalDAVEnabled() && $oCurEvent['CAL_TYPE'] == 'user' && strlen($oCurEvent['CAL_DAV_LABEL']) > 0;
             $bExchangeEnabledCur = CCalendar::IsExchangeEnabled() && $oCurEvent['CAL_TYPE'] == 'user';
             if ($bExchangeEnabledCur || $bCalDavCur) {
                 $res = CCalendar::DoDeleteToDav(array('bCalDav' => $bCalDavCur, 'bExchangeEnabled' => $bExchangeEnabledCur, 'sectionId' => $oCurEvent['SECT_ID']), $oCurEvent);
                 if ($oCurEvent['DAV_EXCH_LABEL']) {
                     $oCurEvent['DAV_EXCH_LABEL'] = '';
                 }
                 if ($res !== true) {
                     return CCalendar::ThrowError($res);
                 }
             }
         }
     }
     $arDavFields = $arFields;
     CCalendarEvent::CheckFields($arDavFields);
     if ($arDavFields['RRULE'] != '') {
         $arDavFields['RRULE'] = $arFields['RRULE'];
     }
     $arDavFields['PROPERTY_LOCATION'] = $arDavFields['LOCATION']['NEW'];
     if ($arDavFields['PROPERTY_LOCATION'] !== '') {
         $arDavFields['PROPERTY_LOCATION'] = CCalendar::GetTextLocation($arDavFields['PROPERTY_LOCATION']);
     }
     $arDavFields['PROPERTY_IMPORTANCE'] = $arDavFields['IMPORTANCE'];
     $arDavFields['REMIND_SETTINGS'] = '';
     if ($arFields['REMIND'] && is_array($arFields['REMIND']) && is_array($arFields['REMIND'][0])) {
         $arDavFields['REMIND_SETTINGS'] = floatVal($arFields['REMIND'][0]['count']) . '_' . $arFields['REMIND'][0]['type'];
     }
     // **** Synchronize with CalDav ****
     if ($bCalDav && $oSect['CAL_DAV_CON'] > 0) {
         // New event or move existent event to DAV calendar
         if ($arFields['ID'] <= 0 || $oCurEvent && !$oCurEvent['CAL_DAV_LABEL']) {
             $DAVRes = CDavGroupdavClientCalendar::DoAddItem($oSect['CAL_DAV_CON'], $oSect['CAL_DAV_CAL'], $arDavFields);
         } else {
             // Edit existent event
             $DAVRes = CDavGroupdavClientCalendar::DoUpdateItem($oSect['CAL_DAV_CON'], $oSect['CAL_DAV_CAL'], $oCurEvent['DAV_XML_ID'], $oCurEvent['CAL_DAV_LABEL'], $arDavFields);
         }
         if (!is_array($DAVRes) || !array_key_exists("XML_ID", $DAVRes)) {
             return CCalendar::CollectCalDAVErros($DAVRes);
         }
         // // It's ok, we successfuly save event to caldav calendar - and save it to DB
         $arFields['DAV_XML_ID'] = $DAVRes['XML_ID'];
         $arFields['CAL_DAV_LABEL'] = $DAVRes['MODIFICATION_LABEL'];
     } elseif ($bExchange && $oSect['IS_EXCHANGE'] && strlen($oSect['DAV_EXCH_CAL']) > 0 && $oSect['DAV_EXCH_CAL'] !== 0) {
         $ownerId = $arFields['OWNER_ID'];
         $fromTo = CCalendarEvent::GetEventFromToForUser($arDavFields, $ownerId);
         $arDavFields["DATE_FROM"] = $fromTo['DATE_FROM'];
         $arDavFields["DATE_TO"] = $fromTo['DATE_TO'];
         // Convert BBcode to HTML for exchange
         $arDavFields["DESCRIPTION"] = CCalendarEvent::ParseText($arDavFields['DESCRIPTION']);
         // New event  or move existent event to Exchange calendar
         if ($arFields['ID'] <= 0 || $oCurEvent && !$oCurEvent['DAV_EXCH_LABEL']) {
             $exchRes = CDavExchangeCalendar::DoAddItem($ownerId, $oSect['DAV_EXCH_CAL'], $arDavFields);
         } else {
             $exchRes = CDavExchangeCalendar::DoUpdateItem($ownerId, $oCurEvent['DAV_XML_ID'], $oCurEvent['DAV_EXCH_LABEL'], $arDavFields);
         }
         if (!is_array($exchRes) || !array_key_exists("XML_ID", $exchRes)) {
             return CCalendar::CollectExchangeErrors($exchRes);
         }
         // It's ok, we successfuly save event to exchange calendar - and save it to DB
         $arFields['DAV_XML_ID'] = $exchRes['XML_ID'];
         $arFields['DAV_EXCH_LABEL'] = $exchRes['MODIFICATION_LABEL'];
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:81,代码来源:calendar.php


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