public function Execute() { if (!CModule::IncludeModule("calendar")) { return CBPActivityExecutionStatus::Closed; } $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $this->workflow->GetService("DocumentService"); $fromTs = CCalendar::Timestamp($this->CalendarFrom); $toTs = $this->CalendarTo == '' ? $fromTs : CCalendar::Timestamp($this->CalendarTo); $arFields = array("CAL_TYPE" => !$this->CalendarType ? 'user' : $this->CalendarType, "NAME" => trim($this->CalendarName) == '' ? GetMessage('EC_DEFAULT_EVENT_NAME') : $this->CalendarName, "DESCRIPTION" => $this->CalendarDesrc, "SKIP_TIME" => date('H:i', $fromTs) == '00:00' && date('H:i', $toTs) == '00:00', "IS_MEETING" => false, "RRULE" => false); if ($fromTs == $toTs && !$arFields["SKIP_TIME"]) { $toTs += 3600; } $arFields['DATE_FROM'] = CCalendar::Date($fromTs); $arFields['DATE_TO'] = CCalendar::Date($toTs); if ($this->CalendarSection && intVal($this->CalendarSection) > 0) { $arFields['SECTIONS'] = array(intVal($this->CalendarSection)); } if ($this->CalendarOwnerId || $arFields["CAL_TYPE"] != "user" && $arFields["CAL_TYPE"] != "group") { $arFields["OWNER_ID"] = $this->CalendarOwnerId; $eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true)); } else { $arCalendarUser = CBPHelper::ExtractUsers($this->CalendarUser, $documentId); foreach ($arCalendarUser as $calendarUser) { $arFields["CAL_TYPE"] = "user"; $arFields["OWNER_ID"] = $calendarUser; $eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true)); } } return CBPActivityExecutionStatus::Closed; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } $arResult['TIMEZONE_LIST'] = CCalendar::GetTimezoneList(); $this->IncludeComponentTemplate();
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; }
?> </span><?php ?> </a><?php } } ?> <?php if (!$bShowAll) { ?> <span id="feed-event-more-att-link-n-<?php echo $id; ?> " class="bxcal-more-attendees"><?php echo CCalendar::GetMoreAttendeesMessage(count($event['DECLINED_ATTENDEES']) - $arParams['ATTENDEES_SHOWN_COUNT']); ?> </span> <div id="feed-event-more-attendees-n-<?php echo $id; ?> " class="bxcal-more-attendees-popup" style="display: none;"> <?php echo $popupContent; ?> </div> <?php } ?> <?php }
public function UpdateListItems($listName, $updates) { global $USER; $arStatusValues = array_flip($this->arStatusValues); $arPriorityValues = array_flip($this->arPriorityValues); if (!$listName_original = CIntranetUtils::checkGUID($listName)) return new CSoapFault('Data error', 'Wrong GUID - '.$listName); $obResponse = new CXMLCreator('Results'); $listName = ToUpper(CIntranetUtils::makeGUID($listName_original)); $arSections = CCalendarSect::GetList(array('arFilter' => array('XML_ID' => $listName_original))); if (!$arSections || !is_array($arSections[0])) return new CSoapFault( 'List not found', 'List with '.$listName.' GUID not found' ); $arSection = $arSections[0]; $bGroup = $arSection['CAL_TYPE'] == 'group'; $calType = $arSection['CAL_TYPE']; $ownerId = $arSection['OWNER_ID']; if ($bGroup) { CModule::IncludeModule('socialnetwork'); $arGroupTmp = CSocNetGroup::GetByID($arSection['SOCNET_GROUP_ID']); if ($arGroupTmp["CLOSED"] == "Y") if (COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y") return new CSoapFault('Cannot modify archive group calendar', 'Cannot modify archive group calendar'); } $obBatch = $updates->children[0]; $atrONERROR = $obBatch->getAttribute('OnError'); $atrDATEINUTC = $obBatch->getAttribute('DateInUtc'); $atrPROPERTIES = $obBatch->getAttribute('Properties'); $arChanges = $obBatch->children; $arResultIDs = array(); $dateStart = ConvertTimeStamp(strtotime('-1 hour'), 'FULL'); $arResponseRows = array(); $arReplicationIDs = array(); $userId = (is_object($USER) && $USER->GetID()) ? $USER->GetID() : 1; foreach ($arChanges as $obMethod) { $arData = array('_command' => $obMethod->getAttribute('Cmd')); foreach ($obMethod->children as $obField) { $name = $obField->getAttribute('Name'); if ($name == 'MetaInfo') $name .= '_'.$obField->getAttribute('Property'); $arData[$name] = $obField->content; } if ($arData['_command'] == 'Delete') { $obRes = new CXMLCreator('Result'); $obRes->setAttribute('ID', $obMethod->getAttribute('ID').','.$arData['_command']); $obRes->setAttribute('List', $listName); $obRes->addChild($obNode = new CXMLCreator('ErrorCode')); $res = CCalendar::DeleteEvent($arData['ID']); if ($res === true) $obNode->setData('0x00000000'); else $obNode->setData('0x81020014'); /* 0x00000000 - ok 0x81020015 - data conflict 0x81020014 - generic error such as invalid value for Field 0x81020016 - item does not exist */ $obResponse->addChild($obRes); } elseif ($arData['_command'] == 'New' || $arData['_command'] == 'Update') { $q = ToLower($arData['Description']); if (($pos = strrpos($q, '</body>')) !== false) $arData['Description'] = substr($arData['Description'], 0, $pos); if (($pos = strpos($q, '<body>')) !== false) $arData['Description'] = substr($arData['Description'], $pos + 6); $arData['Description'] = str_replace('</DIV>', "\r\n</DIV>", $arData['Description']); $arData['Description'] = str_replace(array(" ", " "), "", $arData['Description']); $arData['Description'] = preg_replace("/<![^>]*>/", '', $arData['Description']); //$arData['Description'] = strip_tags($arData['Description']); $arData['Description'] = trim($arData['Description']); $arData['Location'] = trim($arData['Location']); if (isset($arData['EventDate'])) { $arData['EventDate'] = $this->__makeTS($arData['EventDate']); $arData['EndDate'] = $this->__makeTS($arData['EndDate']) + ($arData['fAllDayEvent'] ? -86340 : 0); $TZBias = intval(date('Z', $arData['EventDate'])); } $arData['EventType'] = intval($arData['EventType']); if ($arData['EventType'] == 2) $arData['EventType'] = 0; if ($arData['EventType'] > 2 /* || ($arData['EventType'] == 1 && !$arData['RecurrenceData'])*/) return new CSoapFault( 'Unsupported event type', 'Event type unsupported' ); $arData['fRecurrence'] = intval($arData['fRecurrence']); $arData['RRULE'] = ''; $id = $arData['_command'] == 'New' ? 0 : intVal($arData['ID']); if ($arData['RecurrenceData']) { //$xmlstr = $arData['XMLTZone']; //$arData['XMLTZone'] = new CDataXML(); //$arData['XMLTZone']->LoadString($xmlstr); $xmlstr = $arData['RecurrenceData']; $obRecurData = new CDataXML(); $obRecurData->LoadString($xmlstr); /* <recurrence> <rule> <firstDayOfWeek>mo</firstDayOfWeek> <repeat> <weekly mo='TRUE' tu='TRUE' th='TRUE' sa='TRUE' weekFrequency='1' /> </repeat> <repeatForever>FALSE</repeatForever> </rule> </recurrence> <deleteExceptions>true</deleteExceptions> */ $obRecurRule = $obRecurData->tree->children[0]->children[0]; $obRecurRepeat = $obRecurRule->children[1]; $obNode = $obRecurRepeat->children[0]; $arData['RRULE'] = array(); switch($obNode->name) { case 'daily': // hack. we have no "work days" daily recurence if ($obNode->getAttribute('weekday') == 'TRUE') { $arData['RRULE']['FREQ'] = 'WEEKLY'; $arData['RRULE']['BYDAY'] = 'MO,TU,WE,TH,FR'; $arData['RRULE']['INTERVAL'] = 1; } else { $arData['RRULE']['FREQ'] = 'DAILY'; $arData['RRULE']['INTERVAL'] = $obNode->getAttribute('dayFrequency'); } $time_end = strtotime( date(date('Y-m-d', $arData['EventDate']).' H:i:s', $arData['EndDate']) ); $arData['DT_LENGTH'] = $time_end - $arData['EventDate']; break; case 'weekly': $arData['RRULE']['FREQ'] = 'WEEKLY'; $arData['RRULE']['BYDAY'] = ''; $arWeekDays = array('mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'); foreach ($arWeekDays as $day => $value) { if ($obNode->getAttribute($value)) $arData['RRULE']['BYDAY'][] = strtoupper($value); } $arData['RRULE']['BYDAY'] = implode(',', $arData['RRULE']['BYDAY']); $arData['RRULE']['INTERVAL'] = $obNode->getAttribute('weekFrequency'); $time_end = strtotime(date(date('Y-m-d', $arData['EventDate']).' H:i:s', $arData['EndDate'])); $arData['DT_LENGTH'] = $time_end - $arData['EventDate']; break; case 'monthly': $arData['RRULE']['FREQ'] = 'MONTHLY'; $arData['RRULE']['INTERVAL'] = $obNode->getAttribute('monthFrequency'); $time_end = strtotime(date(date('Y-m', $arData['EventDate']).'-d H:i:s', $arData['EndDate'])); $arData['DT_LENGTH'] = $time_end - $arData['EventDate']; break; case 'yearly': $arData['RRULE']['FREQ'] = 'YEARLY'; $arData['RRULE']['INTERVAL'] = $obNode->getAttribute('yearFrequency'); $time_end = strtotime(date(date('Y', $arData['EventDate']).'-m-d H:i:s', $arData['EndDate'])); $arData['DT_LENGTH'] = $time_end - $arData['EventDate']; break; } if ($arData['DT_LENGTH'] == 0 && isset($arData['RRULE']['FREQ'])) $arData['DT_LENGTH'] = 86400; $obWhile = $obRecurRule->children[2]; if ($obWhile->name == 'repeatForever') { $arData['EndDate'] = MakeTimeStamp(''); } elseif ($obWhile->name == 'windowEnd') { $arData['EndDate'] = $this->__makeTS($obWhile->textContent()); $arData['RRULE']['UNTIL'] = ConvertTimeStamp($arData['EndDate'], 'FULL'); } } elseif($arData['fRecurrence'] == -1 && $id > 0) { $arData['RRULE'] = -1; } if (isset($arData['EventDate'])) { $skipTime = $arData['fAllDayEvent'] ? 'Y' : 'N'; $TZBias = $arData['fAllDayEvent'] ? 0 : $TZBias; $arData['EventDate'] += $TZBias; $arData['EndDate'] += $TZBias; // $arData["DT_FROM"] = ConvertTimeStamp($arData['EventDate'], 'FULL'); // $arData["DT_TO"] = ConvertTimeStamp($arData['EndDate'], 'FULL'); } else { $arData["DT_FROM"] = -1; $arData["DT_TO"] = -1; } // fields $arFields = array( "ID" => $id, 'CAL_TYPE' => $calType, 'OWNER_ID' => $ownerId, 'CREATED_BY' => $userId, 'DT_FROM_TS' => $arData['EventDate'], 'DT_TO_TS' => $arData['EndDate'], 'DT_SKIP_TIME' => $skipTime, // "DT_FROM" => $arData["DT_FROM"], // "DT_TO" => $arData["DT_TO"], 'NAME' => $arData['Title'], 'DESCRIPTION' => CCalendar::ParseHTMLToBB($arData['Description']), 'SECTIONS' => array($arSection['ID']), 'ACCESSIBILITY' => $arStatusValues[$arData['MetaInfo_BusyStatus']], 'IMPORTANCE' => $arPriorityValues[$arData['MetaInfo_Priority']], 'RRULE' => $arData['RRULE'], 'LOCATION' => CCalendar::UnParseTextLocation($arData['Location']) ); if (isset($arData['DT_LENGTH']) && $arData['DT_LENGTH'] > 0) $arFields['DT_LENGTH'] = $arData['DT_LENGTH']; $EventID = CCalendar::SaveEvent( array( 'arFields' => $arFields, 'fromWebservice' => true ) ); if ($EventID) { // dirty hack $arReplicationIDs[$EventID] = $arData['MetaInfo_ReplicationID']; $arResponseRows[$EventID] = new CXMLCreator('Result'); $arResponseRows[$EventID]->setAttribute('ID', $obMethod->getAttribute('ID').','.$arData['_command']); $arResponseRows[$EventID]->setAttribute('List', $listName); $arResponseRows[$EventID]->addChild($obNode = new CXMLCreator('ErrorCode')); $obNode->setData('0x00000000'); //$arResponseRows[$EventID]->setAttribute('Version', 3); } } } $userId = (is_object($USER) && $USER->GetID()) ? $USER->GetID() : 1; $fetchMeetings = CCalendar::GetMeetingSection($userId) == $arSection['ID']; $arEvents = CCalendarEvent::GetList( array( 'arFilter' => array( 'CAL_TYPE' => $calType, 'OWNER_ID' => $ownerId, 'SECTION' => $arSection['ID'], //'INCLUDE_INVITINGS' => 'N' ), 'getUserfields' => false, 'parseRecursion' => false, 'fetchAttendees' => false, 'fetchMeetings' => $fetchMeetings, 'userId' => $userId ) ); foreach ($arEvents as $key => $event) { if ($arResponseRows[$event['ID']]) { $obRow = $this->__getRow($event, $listName, $last_change = 0); $obRow->setAttribute('xmlns:z', "#RowsetSchema"); if ($arReplicationIDs[$event['ID']]) $obRow->setAttribute('MetaInfo_ReplicationID', $arReplicationIDs[$event['ID']]); $arResponseRows[$event['ID']]->addChild($obRow); } $obResponse->addChild($arResponseRows[$event['ID']]); } return array('UpdateListItemsResult' => $obResponse); }
public static function BuildDialog($Params) { global $APPLICATION; $id = $Params['id']; $bWideDate = strpos(FORMAT_DATETIME, 'MMMM') !== false; ?> <div id="bx-planner-popup<?php echo $id; ?> " class="bxc-planner bxec-popup<?php echo $bWideDate ? ' bxec-d-cont-div-wide-date' : ''; ?> "> <table class="bxec-edcal-frame"> <tr> <td colSpan="2"> <div id="<?php echo $id; ?> _plan_cont" class="bxec-plan-cont bxecpl-empty"> <div id="<?php echo $id; ?> _plan_top_cont" class="bxec-plan-top-cont"> <div style="width: 650px; height: 1px;"></div> <div class="bxec-popup-row bxec-popup-row-from-to"> <div class="bxec-field-label"> <label class="bxec-from-lbl" for="<?php echo $id; ?> planner-from"><?php echo GetMessage('EC_EDEV_DATE_FROM'); ?> </label> <label class="bxec-from-lbl" for="<?php echo $id; ?> planner-to"><?php echo GetMessage('EC_EDEV_DATE_TO'); ?> </label> <label for="<?php echo $id; ?> _pl_dur"><?php echo GetMessage('EC_EVENT_DURATION'); ?> </label> </div> <div> <span class="bxec-field-val-2 bxec-field-title-inner bxec-field-calendar"><input id="<?php echo $id; ?> planner-from" type="text"/></span> <span class="bxec-field-val-2 bxec-field-title-inner bxec-field-time"><?php CClock::Show(array('inputId' => $id . 'planner_from_time', 'inputTitle' => GetMessage('EC_EDEV_TIME_FROM'))); ?> <i class="bxec-time-icon"></i></span> — <span class="bxec-field-val-2 bxec-field-title-inner bxec-field-calendar"><input id="<?php echo $id; ?> planner-to" type="text"/></span> <span class="bxec-field-val-2 bxec-field-title-inner bxec-field-time"><?php CClock::Show(array('inputId' => $id . 'planner_to_time', 'inputTitle' => GetMessage('EC_EDEV_TIME_FROM'))); ?> <i class="bxec-time-icon"></i></span> <span class="bxec-field-duration" title="<?php echo GetMessage('EC_EVENT_DURATION_TITLE'); ?> "> <span class="bxec-field-val-2 bxec-field-title-inner"><input style="width: 57px;" id="<?php echo $id; ?> _pl_dur" type="text" title="<?php echo GetMessage('EC_EVENT_DURATION_TITLE'); ?> "/> </span> <span class="bxec-field-val-2 bxec-field-title-inner" style="height: 20px;"> <select id="<?php echo $id; ?> _pl_dur_type" style="width: 70px;"> <option value="min"><?php echo GetMessage('EC_EDEV_REM_MIN'); ?> </option> <option value="hour" selected="true"><?php echo GetMessage('EC_EDEV_REM_HOUR'); ?> </option> <option value="day"><?php echo GetMessage('EC_EDEV_REM_DAY'); ?> </option> </select> </span> <img src="/bitrix/images/1.gif" class="bxecpl-lock-dur" id="<?php echo $id; ?> _pl_dur_lock" title="<?php echo GetMessage('EC_EVENT_DUR_LOCK'); ?> "/> </span> <div class="bxec-cal-icon-bogus"><?php $APPLICATION->IncludeComponent("bitrix:main.calendar", "", array("FORM_NAME" => "", "INPUT_NAME" => "", "INPUT_VALUE" => "", "SHOW_TIME" => "N", "HIDE_TIMEBAR" => "Y", "SHOW_INPUT" => "N"), false, array("HIDE_ICONS" => "Y")); ?> </div> </div> </div> <div style="padding: 5px 0 0 0;"> <!-- Add users--> <span class="bxc-add-guest-link" id="<?php echo $id; ?> pl_user_control_link"></span> <!-- Location --> <span title="<?php echo GetMessage('EC_LOCATION_TITLE'); ?> " class="bxecpl-loc-cont bxec-field-location"> <label for="<?php echo $id; ?> _planner_location2"><?php echo GetMessage('EC_LOCATION'); ?> :</label> <input style="width: 200px;" id="<?php echo $id; ?> _planner_location2" type="text" title="<?php echo GetMessage('EC_LOCATION_TITLE'); ?> " value="<?php echo GetMessage('EC_PL_SEL_MEET_ROOM'); ?> " class="ec-label" /> </span> </div> </div> <div id="<?php echo $id; ?> _plan_grid_cont" class="bxec-plan-grid-cont"><table class="bxec-plan-grid-tbl"> <tr class="bxec-header"> <td class="bxec-scale-cont"><label for="<?php echo $id; ?> _plan_scale_sel"><?php echo GetMessage('EC_SCALE'); ?> :</label> <select id="<?php echo $id; ?> _plan_scale_sel"> <option value="0">30 <?php echo GetMessage('EC_EDEV_REM_MIN'); ?> </option> <option value="1">1 <?php echo GetMessage('EC_PL_DUR_HOUR1'); ?> </option> <option value="2">2 <?php echo GetMessage('EC_PL_DUR_HOUR2'); ?> </option> <option value="3">1 <?php echo GetMessage('EC_JS_DAY_P'); ?> </option> </select> </td> <td class="bxec-separator-gr" rowSpan="2"></td> <td rowSpan="2"><div class="bxec-grid-cont-title"></div></td> </tr> <tr class="bxec-header"> <td class="bxec-user"> <div><?php echo GetMessage('EC_EDEV_GUESTS'); ?> <span id="<?php echo $id; ?> pl-count"></span> <i class="bxplan-del bxplan-del-all" id="<?php echo $id; ?> _planner_del_all" title="<?php echo GetMessage('EC_DEL_ALL_GUESTS_TITLE'); ?> "></i> </div> </td> </tr> <tr> <td><div class="bxec-user-list-div"><div class="bxec-empty-list"> <?php echo GetMessage('EC_NO_ATTENDEES'); ?> </div></div></td> <td class="bxec-separator"></td> <td><div class="bxec-grid-cont"><div class="bxec-gacc-cont"></div> <div class="bxecp-selection" id="<?php echo $id; ?> _plan_selection" title="<?php echo GetMessage('EC_PL_EVENT'); ?> "><img src="/bitrix/images/1.gif" class="bxecp-sel-left" title="<?php echo GetMessage('EC_PL_EVENT_MOVE_LEFT'); ?> " /><img src="/bitrix/images/1.gif" class="bxecp-sel-right" title="<?php echo GetMessage('EC_PL_EVENT_MOVE_RIGHT'); ?> " /><img src="/bitrix/images/1.gif" class="bxecp-sel-mover" title="<?php echo GetMessage('EC_PL_EVENT_MOVE'); ?> " /></div> </div> <div class="bxec-empty-list2"><?php echo GetMessage('EC_NO_GUEST_MESS'); ?> </div> </td> </tr> </table> </div> </div> </td> </tr> </table> <script> function BXPlannerAttendeeOnchange(arUsers){BX.onCustomEvent(window, 'onPlannerAttendeeOnChange', [arUsers]);} </script> <?php $isExtranetGroup = false; if ($Params["bSocNet"] && $Params["type"] == "group" && intval($Params["ownerId"]) > 0 && CModule::IncludeModule("extranet")) { $isExtranetGroup = CExtranet::IsExtranetSocNetGroup($Params["ownerId"]); } $APPLICATION->IncludeComponent("bitrix:intranet.user.selector.new", "", array("MULTIPLE" => "Y", "NAME" => "BXPlannerUserSelect", "VALUE" => array(), "POPUP" => "Y", "ON_CHANGE" => "BXPlannerAttendeeOnchange", "SITE_ID" => SITE_ID, "NAME_TEMPLATE" => CCalendar::GetUserNameTemplate(), "SHOW_EXTRANET_USERS" => $isExtranetGroup ? "FROM_EXACT_GROUP" : "NONE", "EX_GROUP" => $isExtranetGroup ? $Params["ownerId"] : ""), null, array("HIDE_ICONS" => "Y")); ?> </div> <?php }
public static function GetServerPath() { if (!isset(self::$serverPath)) { self::$serverPath = (CMain::IsHTTPS() ? "https://" : "http://") . self::GetServerName(); } return self::$serverPath; }
die; } if (!CModule::IncludeModule("calendar")) { return; } $adv_mode = $arCurrentValues["ADVANCED_MODE_SETTINGS"] == 'Y'; $eventListMode = $arCurrentValues["EVENT_LIST_MODE"] == 'Y'; $bSocNet = CModule::IncludeModule("socialnetwork"); if ($bSocNet) { $bSocNet = class_exists('CSocNetUserToGroup') && CBXFeatures::IsFeatureEnabled("Calendar"); } $arTypes = array(); $types = CCalendarType::GetList(); if (is_array($types)) { foreach ($types as $type) { $arTypes[$type["XML_ID"]] = "[" . $type["XML_ID"] . "] " . $type["NAME"]; } } // * * * * * * * * * * * * Groups * * * * * * * * * * * * $arComponentParameters = array(); // $arComponentParameters["GROUPS"] = array( // "BASE_SETTINGS" => array("NAME" => GetMessage("EC_GROUP_BASE_SETTINGS"), "SORT" => "100") // ); //* * * * * * * * * * * Parameters * * * * * * * * * * * $arParams = array(); $arParams["CALENDAR_TYPE"] = array("PARENT" => "BASE", "NAME" => GetMessage("EC_TYPE"), "TYPE" => "LIST", "VALUES" => $arTypes); if (CCalendar::IsIntranetEnabled()) { $arParams["ALLOW_SUPERPOSE"] = array("PARENT" => "BASE", "NAME" => GetMessage("EC_P_ALLOW_SUPERPOSE"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"); $arParams["ALLOW_RES_MEETING"] = array("PARENT" => "BASE", "NAME" => GetMessage("EC_P_ALLOW_RES_MEETING"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"); } $arComponentParameters["PARAMETERS"] = $arParams;
} $arSelect[] = 'UF_CRM_CAL_EVENT'; if (!in_array('ID', $arSelect)) { $arSelect[] = 'ID'; } $obRes = CCrmActivityCalendar::GetList($arResult['SORT'], $arFilter, $arSelect, $nPageTop); if ($arResult['GADGET'] != 'Y') { $obRes->NavStart($arNav['nPageSize'], false); $arResult['DB_LIST'] = $obRes; } $obRes->bShowAll = false; $arResult['ROWS_COUNT'] = $obRes->NavRecordCount; $arResult['CAL'] = array(); $arCalList = array(); $i = 0; $arCalendarConf = CCalendar::GetSettings(); $arParams['PATH_TO_CAL_SHOW'] = $arCalendarConf['path_to_user_calendar']; while ($arCal = $obRes->GetNext()) { if (!isset($arCal['~UF_CRM_CAL_EVENT']) || !is_array($arCal['~UF_CRM_CAL_EVENT'])) { continue; } $iAddTask = -1; foreach ($arCal['~UF_CRM_CAL_EVENT'] as $sCalRel) { if ($nPageTop !== false && $i >= $nPageTop) { break 2; } $arCal['REL_ID'] = $sCalRel; $arCalEntityData = CCrmActivityCalendar::GetEntityDataByCalRel($sCalRel); if (isset($arResult['CAL'][$arCal['ID'] . '_' . $sCalRel])) { continue; }
// Webdaw upload file UF $arParams["UPLOAD_WEBDAV_ELEMENT"] = $arResult['USER_FIELDS']['UF_WEBDAV_CAL_EVENT']; $arParams['SECTIONS'] = CCalendar::GetSectionList(array( 'CAL_TYPE' => $arParams['OWNER_TYPE'], 'OWNER_ID' => $arParams['CUR_USER'] )); if (empty($arParams['SECTIONS'])) { $defCalendar = CCalendarSect::CreateDefault(array( 'type' => $arParams['OWNER_TYPE'], 'ownerId' => $arParams['CUR_USER'] )); $arParams['SECTIONS'][] = $defCalendar; CCalendar::SetCurUserMeetingSection($defCalendar['ID']); } $arParams['EVENT'] = CCalendarEvent::GetById($arParams['EVENT_ID']); $arParams["DESTINATION"] = (is_array($arParams["DESTINATION"]) && IsModuleInstalled("socialnetwork") ? $arParams["DESTINATION"] : array()); $arParams["DESTINATION"] = (array_key_exists("VALUE", $arParams["DESTINATION"]) ? $arParams["DESTINATION"]["VALUE"] : $arParams["DESTINATION"]); $users = array(); foreach ($arParams["DESTINATION"]['USERS'] as $key => $entry) { if ($entry['isExtranet'] == 'N') $users[$key] = $entry; } $arParams["DESTINATION"]['USERS'] = $users;
<?php 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"]) {
<?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)); }
$arResult["TIME_ZONE_LIST"] = CTimeZone::GetZones(); if (empty($arResult["ITEM"]["WORKTIME_TIMEZONE"])) { if (LANGUAGE_ID == "ru") { $arResult["ITEM"]["WORKTIME_TIMEZONE"] = "Europe/Moscow"; } elseif (LANGUAGE_ID == "de") { $arResult["ITEM"]["WORKTIME_TIMEZONE"] = "Europe/Berlin"; } elseif (LANGUAGE_ID == "ua") { $arResult["ITEM"]["WORKTIME_TIMEZONE"] = "Europe/Kiev"; } else { $arResult["ITEM"]["WORKTIME_TIMEZONE"] = "America/New_York"; } } $arResult["WEEK_DAYS"] = array('MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'); $arResult["WORKTIME_LIST_FROM"] = array(); $arResult["WORKTIME_LIST_TO"] = array(); if (CModule::IncludeModule("calendar")) { $arResult["WORKTIME_LIST_FROM"][strval(0)] = CCalendar::FormatTime(0, 0); for ($i = 0; $i < 24; $i++) { if ($i !== 0) { $arResult["WORKTIME_LIST_FROM"][strval($i)] = CCalendar::FormatTime($i, 0); $arResult["WORKTIME_LIST_TO"][strval($i)] = CCalendar::FormatTime($i, 0); } $arResult["WORKTIME_LIST_FROM"][strval($i) . '.30'] = CCalendar::FormatTime($i, 30); $arResult["WORKTIME_LIST_TO"][strval($i) . '.30'] = CCalendar::FormatTime($i, 30); } $arResult["WORKTIME_LIST_TO"][strval('23.59')] = CCalendar::FormatTime(23, 59); } if (!(isset($arParams['TEMPLATE_HIDE']) && $arParams['TEMPLATE_HIDE'] == 'Y')) { $this->IncludeComponentTemplate(); } return $arResult;
public static function FixForumCommentURL($arData) { if( in_array($arData["MODULE_ID"], array("forum", "FORUM")) && $arData['ENTITY_TYPE_ID'] === 'FORUM_POST' && intval($arData['PARAM1']) > 0 && preg_match('/^EVENT_([0-9]+)/', $arData["TITLE"], $match) ) { $arCalendarSettings = CCalendar::GetSettings(); $forumID = $arCalendarSettings["forum_id"]; $eventID = intval($match[1]); if ( intval($arData['PARAM1']) == $forumID && $eventID > 0 && !empty($arCalendarSettings["pathes"]) && ($arCalendarEvent = CCalendarEvent::GetById($eventID)) && strlen($arCalendarEvent["CAL_TYPE"]) > 0 && in_array($arCalendarEvent["CAL_TYPE"], array("user", "group")) && intval($arCalendarEvent["OWNER_ID"]) > 0 ) { foreach ($arData['LID'] as $siteId => $value) { $messageUrl = false; if ( array_key_exists($siteId, $arCalendarSettings["pathes"]) && is_array($arCalendarSettings["pathes"][$siteId]) && !empty($arCalendarSettings["pathes"][$siteId]) ) { if ($arCalendarEvent["CAL_TYPE"] == "user") { if ( array_key_exists("path_to_user_calendar", $arCalendarSettings["pathes"][$siteId]) && !empty($arCalendarSettings["pathes"][$siteId]["path_to_user_calendar"]) ) { $messageUrl = CComponentEngine::MakePathFromTemplate( $arCalendarSettings["pathes"][$siteId]["path_to_user_calendar"], array( "user_id" => $arCalendarEvent['OWNER_ID'], ) ); } } else { if ( array_key_exists("path_to_group_calendar", $arCalendarSettings["pathes"][$siteId]) && !empty($arCalendarSettings["pathes"][$siteId]["path_to_group_calendar"]) ) { $messageUrl = CComponentEngine::MakePathFromTemplate( $arCalendarSettings["pathes"][$siteId]["path_to_group_calendar"], array( "group_id" => $arCalendarEvent['OWNER_ID'], ) ); } } } $arData['LID'][$siteId] = ($messageUrl ? $messageUrl."?EVENT_ID=".$arCalendarEvent["ID"]."&MID=".$arData['ENTITY_ID']."#message".$arData['ENTITY_ID'] : ""); } return $arData; } return array( "TITLE" => "", "BODY" => "" ); } }
$today = CCalendar::Date(time(), false); $tomorrow = CCalendar::Date(time() + 86400, false); $bToday = false; $bTomorrow = false; $bLater = false; $use_sections = "YES"; $iconEvent = '/bitrix/templates/mobile_app/images/calendar/event.png'; $iconMeeting = '/bitrix/templates/mobile_app/images/calendar/meeting.png'; $iconInviting = '/bitrix/templates/mobile_app/images/calendar/meeting-q.png'; $dateFormat = GetMessage('MB_CAL_EVENT_DATE_FORMAT'); $timeFormat = IsAmPmMode() ? GetMessage('MB_CAL_EVENT_TIME_FORMAT_AMPM') : GetMessage('MB_CAL_EVENT_TIME_FORMAT'); $count = count($arEvents); for ($i = 0; $i < $count; $i++) { $event = $arEvents[$i]; $event['DT_FROM_TS'] = CCalendar::_fixTimestamp($event['DT_FROM_TS']); $event['DT_TO_TS'] = CCalendar::_fixTimestamp($event['DT_TO_TS']); $item = array("ID" => $event['ID'], "NAME" => CMobile::PrepareStrToJson($event['NAME']), "URL" => $url . "?event_id=" . $event['ID']); if ($event['IS_MEETING'] && $event['USER_MEETING']['STATUS'] == 'N') { continue; } if ($event['IS_MEETING']) { $item["IMAGE"] = $event['USER_MEETING']['STATUS'] == 'Q' ? $iconInviting : $iconMeeting; } else { $item["IMAGE"] = $iconEvent; } $bOneDay = $event['DT_LENGTH'] == 86400; // One full day $bDuringOneDay = !$bOneDay && FormatDate('d.m.Y', $event['DT_FROM_TS']) === FormatDate('d.m.Y', $event['DT_TO_TS']); $fromToMess = ''; // It's event for today if ($event['DT_FROM_TS'] <= $todayEndTs && $event['DT_TO_TS'] >= $todayStartTs) {
<?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));
?> </div> <?php if ($viewComments) { ?> <div class="bxec-d-cont-comments-title"> <?php echo GetMessage('EC_COMMENTS'); ?> </div> <div class="bxec-d-cont bxec-d-cont-comments"> <?php if ($userId == $event['CREATED_BY'] && ($event['PARENT_ID'] == $event['ID'] || !$event['PARENT_ID'])) { $permission = "Y"; } else { $permission = 'M'; } $set = CCalendar::GetSettings(); $eventCommentId = $event['PARENT_ID'] ? $event['PARENT_ID'] : $event['ID']; // A < E < I < M < Q < U < Y // A - NO ACCESS, E - READ, I - ANSWER // M - NEW TOPIC // Q - MODERATE, U - EDIT, Y - FULL_ACCESS $APPLICATION->IncludeComponent("bitrix:forum.comments", "bitrix24", array("FORUM_ID" => $set['forum_id'], "ENTITY_TYPE" => "EV", "ENTITY_ID" => $eventCommentId, "ENTITY_XML_ID" => "EVENT_" . $eventCommentId, "PERMISSION" => $permission, "URL_TEMPLATES_PROFILE_VIEW" => $set['path_to_user'], "SHOW_RATING" => "Y", "SHOW_LINK_TO_MESSAGE" => "N", "BIND_VIEWER" => "Y"), false, array('HIDE_ICONS' => 'Y')); ?> </div> <?php } ?> </div>
<?php /** * This is a Orange pagecontroller. * */ // Include the essential config-file which also creates the $Orange variable with its defaults. include __DIR__ . '/config.php'; // Do it and store it all in variables in the Orange container. $Orange['title'] = "Kalender"; $Orange['stylesheets'][] = 'css/calender.css'; //Create calender and set values $calender = new CCalendar(); $calender->getValues(); $calender->generateCalenderData(); $Orange['main'] = "<h1>Kalender</h1>\n" . $calender->printCalendar(); // Finally, leave it all to the rendering phase of Orange. include Orange_THEME_PATH;
public static function __ShowAttendeesDestinationHtml($Params = array()) { CSocNetTools::InitGlobalExtranetArrays(); $id = $Params['id']; $DESTINATION = CCalendar::GetSocNetDestination(false, $Params['event']['ATTENDEES_CODES']); ?> <div id="event-grid-att<?php echo $id; ?> " class="event-grid-dest-block"> <div class="event-grid-dest-wrap-outer"> <div class="event-grid-dest-label"><?php echo GetMessage("EC_EDEV_GUESTS"); ?> :</div> <div class="event-grid-dest-wrap" id="event-grid-dest-cont"> <span id="event-grid-dest-item"></span> <span class="feed-add-destination-input-box" id="event-grid-dest-input-box"> <input type="text" value="" class="feed-add-destination-inp" id="event-grid-dest-input"> </span> <a href="#" class="feed-add-destination-link" id="event-grid-dest-add-link"></a> <script> <?php if (is_array($GLOBALS["arExtranetGroupID"])) { ?> if (typeof window['arExtranetGroupID'] == 'undefined') { window['arExtranetGroupID'] = <?php echo CUtil::PhpToJSObject($GLOBALS["arExtranetGroupID"]); ?> ; } <?php } ?> BX.message({ 'BX_FPD_LINK_1':'<?php echo GetMessageJS("EC_DESTINATION_1"); ?> ', 'BX_FPD_LINK_2':'<?php echo GetMessageJS("EC_DESTINATION_2"); ?> ' }); window.editEventDestinationFormName = top.editEventDestinationFormName = 'edit_event_<?php echo randString(6); ?> '; // BX.SocNetLogDestination.init({ name : editEventDestinationFormName, searchInput : BX('event-grid-dest-input'), extranetUser : false, userSearchArea: 'I', bindMainPopup : { 'node' : BX('event-grid-dest-cont'), 'offsetTop' : '5px', 'offsetLeft': '15px'}, bindSearchPopup : { 'node' : BX('event-grid-dest-cont'), 'offsetTop' : '5px', 'offsetLeft': '15px'}, callback : { select : BxEditEventGridSelectCallback, unSelect : BxEditEventGridUnSelectCallback, openDialog : BxEditEventGridOpenDialogCallback, closeDialog : BxEditEventGridCloseDialogCallback, openSearch : BxEditEventGridOpenDialogCallback, closeSearch : BxEditEventGridCloseSearchCallback }, items : { users : <?php echo empty($DESTINATION['USERS']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['USERS']); ?> , groups : <?php echo $DESTINATION["EXTRANET_USER"] == 'Y' || array_key_exists("DENY_TOALL", $DESTINATION) && $DESTINATION["DENY_TOALL"] ? '{}' : "{'UA' : {'id':'UA','name': '" . (!empty($DESTINATION['DEPARTMENT']) ? GetMessageJS("MPF_DESTINATION_3") : GetMessageJS("MPF_DESTINATION_4")) . "'}}"; ?> , sonetgroups : <?php echo empty($DESTINATION['SONETGROUPS']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['SONETGROUPS']); ?> , department : <?php echo empty($DESTINATION['DEPARTMENT']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['DEPARTMENT']); ?> , departmentRelation : <?php echo empty($DESTINATION['DEPARTMENT_RELATION']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['DEPARTMENT_RELATION']); ?> }, itemsLast : { users : <?php echo empty($DESTINATION['LAST']['USERS']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['LAST']['USERS']); ?> , sonetgroups : <?php echo empty($DESTINATION['LAST']['SONETGROUPS']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['LAST']['SONETGROUPS']); ?> , department : <?php echo empty($DESTINATION['LAST']['DEPARTMENT']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['LAST']['DEPARTMENT']); ?> , groups : <?php echo $DESTINATION["EXTRANET_USER"] == 'Y' ? '{}' : "{'UA':true}"; ?> }, itemsSelected : <?php echo empty($DESTINATION['SELECTED']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['SELECTED']); ?> , destSort : <?php echo empty($DESTINATION['DEST_SORT']) ? '{}' : CUtil::PhpToJSObject($DESTINATION['DEST_SORT']); ?> }); </script> </div> </div> <!-- Meeting host --> <div class="event-grid-host-cont"> <span class="event-grid-host-cont-label"><?php echo GetMessage('EC_EDEV_HOST'); ?> :</span> <a title="<?php echo htmlspecialcharsbx($Params['host']['DISPLAY_NAME']); ?> " href="<?php echo $Params['host']['URL']; ?> " target="_blank" class="bxcal-user"><span class="bxcal-user-avatar-outer"><span class="bxcal-user-avatar"><img src="<?php echo $Params['host']['AVATAR_SRC']; ?> " width="<?php echo $Params['AVATAR_SIZE']; ?> " height="<?php echo $Params['AVATAR_SIZE']; ?> " /></span></span><span class="bxcal-user-name"><?php echo htmlspecialcharsbx($Params['host']['DISPLAY_NAME']); ?> </span></a> </div> <!-- Attendees cont --> <div class="event-grid-attendees-cont"> <div id="event-edit-att-y" class="event-grid-attendees-cont-y"></div> <div id="event-edit-att-n" class="event-grid-attendees-cont-n"></div> <div id="event-edit-att-q" class="event-grid-attendees-cont-q"></div> </div> </div> <div id="event-grid-meeting-params<?php echo $id; ?> " class="event-grid-params"> <div class="bxec-add-meet-text"><a id="<?php echo $id; ?> _add_meet_text" href="javascript:void(0);"><?php echo GetMessage('EC_ADD_METTING_TEXT'); ?> </a></div> <div class="bxec-meet-text" id="<?php echo $id; ?> _meet_text_cont"> <div class="bxec-mt-d"><?php echo GetMessage('EC_METTING_TEXT'); ?> (<a id="<?php echo $id; ?> _hide_meet_text" href="javascript:void(0);" title="<?php echo GetMessage('EC_HIDE_METTING_TEXT_TITLE'); ?> "><?php echo GetMessage('EC_HIDE'); ?> </a>): </div><br /> <textarea name="meeting_text" class="bxec-mt-t" cols="63" id="<?php echo $id; ?> _meeting_text" rows="3"></textarea> </div> <div class="bxec-popup-row bxec-popup-row-checkbox"> <input type="checkbox" id="<?php echo $id; ?> _ed_open_meeting" value="Y" name="open_meeting"/> <label style="display: inline-block;" for="<?php echo $id; ?> _ed_open_meeting"><?php echo GetMessage('EC_OPEN_MEETING'); ?> </label> </div> <div class="bxec-popup-row bxec-popup-row-checkbox"> <input type="checkbox" id="<?php echo $id; ?> _ed_notify_status" value="Y" name="meeting_notify"/> <label for="<?php echo $id; ?> _ed_notify_status"><?php echo GetMessage('EC_NOTIFY_STATUS'); ?> </label> </div> <div class="bxec-popup-row bxec-popup-row-checkbox" id="<?php echo $id; ?> _ed_reivite_cont"> <input type="checkbox" id="<?php echo $id; ?> _ed_reivite" value="Y" name="meeting_reinvite"/> <label for="<?php echo $id; ?> _ed_reivite"><?php echo GetMessage('EC_REINVITE'); ?> </label> </div> </div> <?php }
public static function EditCalendarEventEntry($arFields = array(), $arUFFields = array(), $arAccessCodes = array(), $params = array()) { global $DB; if ($arFields['SECTION']) { $arFields['SECTIONS'] = array($arFields['SECTION']); } $arFields["OWNER_ID"] = $params["userId"]; $arFields["CAL_TYPE"] = $params["type"]; // Add author for new event //if (!$arFields["ID"] && !empty($arAccessCodes)) if (!$arFields["ID"]) { $arAccessCodes[] = 'U' . $params["userId"]; } $arAccessCodes = array_unique($arAccessCodes); $arAttendees = CCalendar::GetDestinationUsers($arAccessCodes); if (trim($arFields["NAME"]) === '') { $arFields["NAME"] = GetMessage('EC_DEFAULT_EVENT_NAME'); } $arFields['IS_MEETING'] = !empty($arAttendees) && $arAttendees != array($params["userId"]); if (isset($arFields['RRULE']) && !empty($arFields['RRULE'])) { if (is_array($arFields['RRULE']['BYDAY'])) { $arFields['RRULE']['BYDAY'] = implode(',', $arFields['RRULE']['BYDAY']); } } if ($arFields['IS_MEETING']) { $arFields['ATTENDEES_CODES'] = $arAccessCodes; $arFields['ATTENDEES'] = $arAttendees; $arFields['MEETING_HOST'] = $params["userId"]; $arFields['MEETING'] = array('HOST_NAME' => CCalendar::GetUserName($params["userId"]), 'TEXT' => '', 'OPEN' => false, 'NOTIFY' => true, 'REINVITE' => false); } else { $arFields['ATTENDEES'] = false; } $eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true)); if ($eventId > 0) { if (count($arUFFields) > 0) { CCalendarEvent::UpdateUserFields($eventId, $arUFFields); } foreach ($arAccessCodes as $key => $value) { if ($value == "UA") { unset($arAccessCodes[$key]); $arAccessCodes[] = "G2"; break; } } if ($arFields['IS_MEETING'] && !empty($arUFFields['UF_WEBDAV_CAL_EVENT'])) { $UF = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields("CALENDAR_EVENT", $eventId, LANGUAGE_ID); CCalendar::UpdateUFRights($arUFFields['UF_WEBDAV_CAL_EVENT'], $arAccessCodes, $UF['UF_WEBDAV_CAL_EVENT']); } $arSoFields = array("ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_USER, "ENTITY_ID" => $params["userId"], "USER_ID" => $params["userId"], "=LOG_DATE" => $DB->CurrentTimeFunction(), "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => $arFields["NAME"], "MESSAGE" => '', "TEXT_MESSAGE" => ''); $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "calendar", "SOURCE_ID" => $eventId), false, false, array("ID")); $arCodes = array(); foreach ($arAccessCodes as $value) { if (substr($value, 0, 2) === 'SG') { $arCodes[] = $value . '_K'; } $arCodes[] = $value; } $arCodes = array_unique($arCodes); if ($arRes = $dbRes->Fetch()) { CSocNetLog::Update($arRes["ID"], $arSoFields); CSocNetLogRights::DeleteByLogID($arRes["ID"]); CSocNetLogRights::Add($arRes["ID"], $arCodes); } else { $arSoFields = array_merge($arSoFields, array("EVENT_ID" => "calendar", "SITE_ID" => SITE_ID, "SOURCE_ID" => $eventId, "ENABLE_COMMENTS" => "Y", "CALLBACK_FUNC" => false)); $logID = CSocNetLog::Add($arSoFields, false); CSocNetLogRights::Add($logID, $arCodes); } } }
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; }
public static function DoConvertStep() { $types = CCalendarConvert::GetOption('__convert'); $start_time = microtime(true); $time_limit = 2; $stage = 'stop'; $finished = false; self::$accessTasks = CCalendar::GetAccessTasks('calendar_section'); self::$userIblockId = $types['user']['iblockId']; foreach ($types as $key => $type) { $iblockId = $type['iblockId']; if ($iblockId < 0) { continue; } // Fetch type if ($key == 'user') { $arFilter = array('IBLOCK_ID' => $iblockId, "ACTIVE" => "Y", "CHECK_PERMISSIONS" => 'N', "DEPTH_LEVEL" => 1, "UF_CAL_CONVERTED" => false); $dbSections = CIBlockSection::GetList(array('ID' => 'ASC'), $arFilter); // For each user: while ($arSection = $dbSections->Fetch()) { $ownerId = $arSection["CREATED_BY"]; CCalendar::SetUserSettings(false, $ownerId); $res = CCalendarConvert::ConvertEntity('user', $ownerId, $arSection["ID"], $iblockId, $arSection["CREATED_BY"]); if ($res['sectCount'] > 0 || $res['eventsCount'] > 0) { CCalendarConvert::Log(GetMessage("CAL_CONVERT_STAGE_USER_CALS", array('#USER_NAME#' => $arSection['NAME'], '#SECT_COUNT#' => $res['sectCount'], '#EVENTS_COUNT#' => $res['eventsCount']))); } if ($res && ($res['sectCount'] > 0 || $res['eventsCount'] > 0) && microtime(true) - $start_time > $time_limit) { $stage = 'go'; break; } } } elseif ($key == 'group') { $arFilter = array('IBLOCK_ID' => $iblockId, "ACTIVE" => "Y", "CHECK_PERMISSIONS" => 'N', "DEPTH_LEVEL" => 1, "UF_CAL_CONVERTED" => false); $dbSections = CIBlockSection::GetList(array('ID' => 'ASC'), $arFilter); // For each group: while ($arSection = $dbSections->Fetch()) { $ownerId = $arSection["SOCNET_GROUP_ID"]; $res = CCalendarConvert::ConvertEntity('group', $ownerId, $arSection["ID"], $iblockId, $arSection["CREATED_BY"]); if ($res['sectCount'] > 0 || $res['eventsCount'] > 0) { CCalendarConvert::Log(GetMessage("CAL_CONVERT_STAGE_GROUP_CALS", array('#GROUP_NAME#' => $arSection['NAME'], '#SECT_COUNT#' => $res['sectCount'], '#EVENTS_COUNT#' => $res['eventsCount']))); } if ($res && ($res['sectCount'] > 0 || $res['eventsCount'] > 0) && microtime(true) - $start_time > $time_limit) { $stage = 'go'; break; } } } else { $res = CCalendarConvert::ConvertEntity($key, 0, 0, $iblockId, 1); if ($res['sectCount'] > 0 || $res['eventsCount'] > 0) { CCalendarConvert::Log(GetMessage("CAL_CONVERT_STAGE_TYPE", array('#TYPE_NAME#' => $type['name'], '#SECT_COUNT#' => $res['sectCount'], '#EVENTS_COUNT#' => $res['eventsCount']))); } if ($res && ($res['sectCount'] > 0 || $res['eventsCount'] > 0) && microtime(true) - $start_time > $time_limit) { $stage = 'go'; break; } } if ($stage == 'go') { break; } } return $stage; }
public static function DoDataSync($paramUserId, &$lastError) { if (DAV_EXCH_DEBUG) { CDav::WriteToLog("Starting EXCHANGE sync...", "SYNCE"); } $exchangeScheme = COption::GetOptionString("dav", "exchange_scheme", "http"); $exchangeServer = COption::GetOptionString("dav", "exchange_server", ""); $exchangePort = COption::GetOptionString("dav", "exchange_port", "80"); $exchangeUsername = COption::GetOptionString("dav", "exchange_username", ""); $exchangePassword = COption::GetOptionString("dav", "exchange_password", ""); if (empty($exchangeServer)) { CAgent::RemoveAgent("CDavExchangeCalendar::DataSync();", "dav"); COption::SetOptionString("dav", "agent_calendar", "N"); return null; } static $arWeekDayMap = array("sunday" => 6, "monday" => 0, "tuesday" => 1, "wednesday" => 2, "thursday" => 3, "friday" => 4, "saturday" => 5); $exchange = new CDavExchangeCalendar($exchangeScheme, $exchangeServer, $exchangePort, $exchangeUsername, $exchangePassword); if (GW_DEBUG) { $exchange->Debug(); } $exchangeMailbox = COption::GetOptionString("dav", "exchange_mailbox", ""); $exchangeUseLogin = COption::GetOptionString("dav", "exchange_use_login", "Y"); self::InitUserEntity(); $maxNumber = 15; $index = 0; $bShouldClearCache = null; $paramUserId = intval($paramUserId); $arUserFilter = array("ACTIVE" => "Y", "!UF_DEPARTMENT" => false); if ($paramUserId > 0) { $arUserFilter["ID_EQUAL_EXACT"] = $paramUserId; } if ($exchangeUseLogin == "N") { $arUserFilter["!UF_BXDAVEX_MAILBOX"] = false; } $dbUserList = CUser::GetList($by = "UF_BXDAVEX_CALSYNC", $order = "asc", $arUserFilter, array("SELECT" => array("ID", "LOGIN", "UF_BXDAVEX_MAILBOX", "UF_BXDAVEX_CALSYNC"))); while ($arUser = $dbUserList->Fetch()) { $index++; if ($index > $maxNumber) { break; } if (DAV_EXCH_DEBUG) { CDav::WriteToLog("Processing user [" . $arUser["ID"] . "] " . $arUser["LOGIN"], "SYNCE"); } $GLOBALS["USER_FIELD_MANAGER"]->Update("USER", $arUser["ID"], array("UF_BXDAVEX_CALSYNC" => ConvertTimeStamp(time(), FULL))); $mailbox = $exchangeUseLogin == "Y" ? $arUser["LOGIN"] . $exchangeMailbox : $arUser["UF_BXDAVEX_MAILBOX"]; if (empty($mailbox)) { $lastError = GetMessage("DAV_EC_EMPTY_MAILBOX"); continue; } $arCalendarsList = $exchange->GetCalendarsList(array("mailbox" => $mailbox)); $arErrorsTmp = $exchange->GetErrors(); if (count($arErrorsTmp) > 0) { $txt = ''; foreach ($arErrorsTmp as $v) { if (!empty($txt)) { $txt .= ", "; } $txt .= "[" . $v[0] . "] " . $v[1]; } if (DAV_EXCH_DEBUG) { CDav::WriteToLog("ERROR: " . $txt, "SYNCE"); } $lastError = $txt; continue; } if (!is_array($arCalendarsList)) { $lastError = "Incorrect Data from Exchange Server"; continue; } $bShouldClearCache = false; $arUserCalendars = array(array("XML_ID" => "calendar_" . $arUser["ID"], "NAME" => GetMessage("DAV_EC_CALENDAR"), "MODIFICATION_LABEL" => "")); foreach ($arCalendarsList as $value) { $arUserCalendars[] = array("XML_ID" => $value["XML_ID"], "NAME" => $value["NAME"], "MODIFICATION_LABEL" => $value["MODIFICATION_LABEL"]); } $tmpNumCals = count($arUserCalendars); $arUserCalendars = CCalendar::SyncCalendars("exchange", $arUserCalendars, "user", $arUser["ID"]); $tmpNumItems = 0; foreach ($arUserCalendars as $userCalendar) { $userCalendarXmlId = $userCalendar["XML_ID"]; $userCalendarXmlId = $userCalendarXmlId == "calendar_" . $arUser["ID"] ? "calendar" : $userCalendarXmlId; $arCalendarItemsList = $exchange->GetList(array("mailbox" => $mailbox, "CalendarId" => $userCalendarXmlId), array("ItemShape" => "IdOnly")); $arUserCalendarItems = array(); foreach ($arCalendarItemsList as $value) { $arUserCalendarItems[] = array("XML_ID" => $value["XML_ID"], "MODIFICATION_LABEL" => $value["MODIFICATION_LABEL"]); } $arModifiedUserCalendarItems = CCalendar::SyncCalendarItems("exchange", $userCalendar["CALENDAR_ID"], $arUserCalendarItems); $tmpNumItems += count($arModifiedUserCalendarItems); if (is_array($arModifiedUserCalendarItems)) { foreach ($arModifiedUserCalendarItems as $value) { $arModifiedCalendarItem = $exchange->GetById($value["XML_ID"]); if (is_array($arModifiedCalendarItem) && count($arModifiedCalendarItem) > 0) { $arModifiedCalendarItem = $arModifiedCalendarItem[0]; $arModifyEventArray = array("ID" => $value["ID"], "NAME" => $arModifiedCalendarItem["NAME"], "DESCRIPTION" => $arModifiedCalendarItem["DESCRIPTION"], "XML_ID" => $arModifiedCalendarItem["XML_ID"], "PROPERTY_LOCATION" => $arModifiedCalendarItem["PROPERTY_LOCATION"], "DATE_FROM" => $arModifiedCalendarItem["ACTIVE_FROM"], "DATE_TO" => $arModifiedCalendarItem["ACTIVE_TO"], "SKIP_TIME" => $arModifiedCalendarItem["SKIP_TIME"], "PROPERTY_IMPORTANCE" => $arModifiedCalendarItem["PROPERTY_IMPORTANCE"], "PROPERTY_ACCESSIBILITY" => $arModifiedCalendarItem["PROPERTY_FREEBUSY"], "PROPERTY_REMIND_SETTINGS" => $arModifiedCalendarItem["PROPERTY_REMIND_SETTINGS"], "PROPERTY_PERIOD_TYPE" => "NONE", "PROPERTY_BXDAVEX_LABEL" => $arModifiedCalendarItem["MODIFICATION_LABEL"], "PRIVATE_EVENT" => strtolower($arModifiedCalendarItem["PROPERTY_SENSITIVITY"]) == 'private'); if ($arModifiedCalendarItem["IS_RECURRING"]) { if ($arModifiedCalendarItem["RECURRING_TYPE"] == "MONTHLY_ABSOLUTE" || $arModifiedCalendarItem["RECURRING_TYPE"] == "MONTHLY_RELATIVE" || $arModifiedCalendarItem["RECURRING_TYPE"] == "MONTHLY") { $arModifyEventArray["PROPERTY_PERIOD_TYPE"] = "MONTHLY"; } elseif ($arModifiedCalendarItem["RECURRING_TYPE"] == "YEARLY_ABSOLUTE" || $arModifiedCalendarItem["RECURRING_TYPE"] == "YEARLY_RELATIVE" || $arModifiedCalendarItem["RECURRING_TYPE"] == "YEARLY") { $arModifyEventArray["PROPERTY_PERIOD_TYPE"] = "YEARLY"; } elseif ($arModifiedCalendarItem["RECURRING_TYPE"] == "WEEKLY") { $arModifyEventArray["PROPERTY_PERIOD_TYPE"] = "WEEKLY"; } elseif ($arModifiedCalendarItem["RECURRING_TYPE"] == "DAILY") { $arModifyEventArray["PROPERTY_PERIOD_TYPE"] = "DAILY"; } if (isset($arModifiedCalendarItem["RECURRING_INTERVAL"])) { $arModifyEventArray["PROPERTY_PERIOD_COUNT"] = $arModifiedCalendarItem["RECURRING_INTERVAL"]; } if ($arModifyEventArray["PROPERTY_PERIOD_TYPE"] == "WEEKLY") { if (isset($arModifiedCalendarItem["RECURRING_DAYSOFWEEK"])) { $ar = preg_split("/[;,\\s]/i", $arModifiedCalendarItem["RECURRING_DAYSOFWEEK"]); $ar1 = array(); foreach ($ar as $v) { $ar1[] = $arWeekDayMap[strtolower($v)]; } $arModifyEventArray["PROPERTY_PERIOD_ADDITIONAL"] = implode(",", $ar1); } } $arModifyEventArray["PROPERTY_EVENT_LENGTH"] = MakeTimeStamp($arModifyEventArray["ACTIVE_TO"]) - MakeTimeStamp($arModifyEventArray["ACTIVE_FROM"]); if ($arModifyEventArray["PROPERTY_EVENT_LENGTH"] <= 0) { $arModifyEventArray["PROPERTY_EVENT_LENGTH"] = 86400; } if (isset($arModifiedCalendarItem["RECURRING_ENDDATE"])) { $arModifyEventArray["ACTIVE_TO"] = $arModifiedCalendarItem["RECURRING_ENDDATE"]; } elseif (isset($arResultItem["RECURRING_NUMBEROFOCCURRENCES"])) { $eventTime = self::GetPeriodicEventTime(MakeTimeStamp($arModifyEventArray["ACTIVE_TO"]), array("freq" => $arModifyEventArray["PROPERTY_PERIOD_TYPE"], "interval" => $arModifyEventArray["PROPERTY_PERIOD_COUNT"], "byday" => $arModifyEventArray["PROPERTY_PERIOD_ADDITIONAL"]), $arResultItem["RECURRING_NUMBEROFOCCURRENCES"]); $arModifyEventArray["ACTIVE_TO"] = date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), $eventTime); } else { $arModifyEventArray["ACTIVE_TO"] = ConvertTimeStamp(mktime(0, 0, 0, 12, 31, 2025), "FULL"); } } CCalendar::ModifyEvent($userCalendar["CALENDAR_ID"], $arModifyEventArray); $bShouldClearCache = true; } } } } if (DAV_EXCH_DEBUG) { CDav::WriteToLog("Sync " . intval($tmpNumCals) . " calendars, " . intval($tmpNumItems) . " items", "SYNCE"); } } if ($bShouldClearCache) { CCalendar::SyncClearCache(); } if (DAV_EXCH_DEBUG) { CDav::WriteToLog("EXCHANGE sync finished", "SYNCE"); } return $bShouldClearCache; }
public function Delete($id, $siteId, $account, $arPath) { $calendarId = $this->GetCalendarId($siteId, $account, $arPath); if ($calendarId == null) { return '404 Not Found'; } $request = $this->groupdav->GetRequest(); $oldEvent = $this->GetEntry('DELETE', $id, $calendarId); if (!is_array($oldEvent)) { return $oldEvent; } CDav::Report("CDavCalendarHandler::Delete", "id", $id); return CCalendar::DeleteCalendarEvent($calendarId, $oldEvent["ID"], $request->GetPrincipal()->Id()); }
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"]; } $arParams["CALENDAR_SECTION_ID"] = array("PARENT" => "BASE", "NAME" => GetMessage("EC_CALENDAR_SECTION"), "TYPE" => "LIST", "VALUES" => $arSections); } } if (CCalendar::IsIntranetEnabled() && $bSocNet) { $arParams["B_CUR_USER_LIST"] = array("PARENT" => "BASE", "NAME" => GetMessage("ECL_P_CUR_USER_EVENT_LIST"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "REFRESH" => "Y"); } $arParams["INIT_DATE"] = array("PARENT" => "BASE", "NAME" => GetMessage("ECL_P_INIT_DATE"), "DEFAULT" => '-' . GetMessage("ECL_P_SHOW_CUR_DATE") . '-'); $arParams["FUTURE_MONTH_COUNT"] = array("PARENT" => "BASE", "TYPE" => "LIST", "NAME" => GetMessage("ECL_P_FUTURE_MONTH_COUNT"), "VALUES" => array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "12" => "12", "24" => "24"), "DEFAULT" => "2"); $arParams["DETAIL_URL"] = array("PARENT" => "BASE", "NAME" => GetMessage("ECL_P_DETAIL_URL"), "DEFAULT" => ""); $arParams["EVENTS_COUNT"] = array("PARENT" => "BASE", "NAME" => GetMessage("ECL_P_EVENTS_COUNT"), "DEFAULT" => "5"); $arParams["CACHE_TIME"] = array("PARENT" => "BASE", "NAME" => GetMessage("ECL_P_CACHE_TIME"), "DEFAULT" => "3600"); $arComponentParameters["PARAMETERS"] = $arParams;
var month = parseFloat(raw[1]) - 1; var year = parseFloat(raw[0]); if(month == 0){ //month > dec, change to 1(january), add 1 to yr month = 12; year = year - 1; } joms.jQuery('.events-list').html(''); joms.events.getCalendar(month,year); }); } </script> <div id="event"> <?php $time = time(); echo CCalendar::generate_calendar(date('Y', $time), date('n', $time)); ?> </div> <div class="community-calendar-result"> <strong class="happening_title" style="display:none"><?php echo JText::_('COM_COMMUNITY_EVENTS_HAPPENING_TITLE'); ?> :</strong> <img class="loading-icon" style="display:none" src="<?php echo JURI::root(); ?> components/com_community/assets/ajax-loader.gif"/> <div class="small"> <ul class="cEventNearby cResetList events-list" ></ul> </div> </div>
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/'; } } if (!$arSectionParams['NAME']) { $arSectionParams['NAME'] = GetMessage('INTR_OUTLOOK_TITLE_TASKS'); } 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"; } $GUID = CIntranetUtils::makeGUID(md5($GUID_DATA)); } if (substr($arSectionParams['LINK_URL'], -9) == 'index.php') { $arSectionParams['LINK_URL'] = substr($arSectionParams['LINK_URL'], 0, -9); } if (substr($arSectionParams['LINK_URL'], -4) != '.php' && substr($arSectionParams['LINK_URL'], -1) != '/') { $arSectionParams['LINK_URL'] .= '/'; } // another dirty hack to avoid some M$ stssync protocol restrictions if (substr($arSectionParams['LINK_URL'], -1) != '/') { $arSectionParams['LINK_URL'] .= '/'; } $GLOBALS['APPLICATION']->AddHeadScript('/bitrix/js/intranet/outlook.js'); $type_script = $type; if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) { $type_script .= "_extranet"; if ($employees) { $type_script .= "_emp"; } } $port = $APPLICATION->IsHTTPS() ? 443 : 80; if (\Bitrix\Main\Loader::includeModule('ldap')) { $port = CLdapUtil::getTargetPort(); } return 'jsOutlookUtils.Sync(\'' . $type . '\', \'/bitrix/tools/ws_' . $type_script . '\', \'' . $arSectionParams['LINK_URL'] . '\', \'' . CUtil::JSEscape(htmlspecialcharsbx($arSectionParams['PREFIX'])) . '\', \'' . CUtil::JSEscape($arSectionParams['NAME']) . '\', \'' . $GUID . '\', ' . intval($port) . ')'; }
public static function GetDefaultAccess($type, $ownerId) { if (CCalendar::IsIntranetEnabled()) { $access = array('G2' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view_time')); } else { $access = array('G2' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view')); } if ($type == 'user') { } elseif ($type == 'group' && $ownerId > 0) { $access['SG' . $ownerId . '_A'] = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_access'); $access['SG' . $ownerId . '_E'] = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit'); $access['SG' . $ownerId . '_K'] = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit'); } else { } // Creator of the section $access['U' . CCalendar::GetUserId()] = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_access'); $arAccessCodes = array(); foreach ($access as $code => $o) { $arAccessCodes[] = $code; } CCalendar::PushAccessNames($arAccessCodes); return $access; }
public static function CheckEndUpdateAttendeesCodes($event) { if ($event['ID'] > 0 && $event['IS_MEETING'] && empty($event['ATTENDEES_CODES']) && is_array($event['~ATTENDEES'])) { $event['ATTENDEES_CODES'] = array(); foreach ($event['~ATTENDEES'] as $attendee) { if (intval($attendee['USER_ID']) > 0) { $event['ATTENDEES_CODES'][] = 'U' . IntVal($attendee['USER_ID']); } } $event['ATTENDEES_CODES'] = array_unique($event['ATTENDEES_CODES']); global $DB; $strSql = "UPDATE b_calendar_event SET " . "ATTENDEES_CODES='" . implode(',', $event['ATTENDEES_CODES']) . "'" . " WHERE ID=" . IntVal($event['ID']); $DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__); CCalendar::ClearCache(array('event_list')); } return $event['ATTENDEES_CODES']; }
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } $arParams["IBLOCK_ID"] = trim($arParams["IBLOCK_ID"]); $arParams["IBLOCK_SECTION_ID"] = intVal($arParams["IBLOCK_SECTION_ID"]); $arParams['B_CUR_USER_LIST'] = $arParams['B_CUR_USER_LIST'] == 'Y'; $arParams["FUTURE_MONTH_COUNT"] = intVal($arParams["FUTURE_MONTH_COUNT"]); $curUserId = $USER->IsAuthorized() ? $USER->GetID() : ''; $from_ = strlen($arParams["INIT_DATE"]) == 0 && strpos($arParams["INIT_DATE"], '.') === false ? date("Ymd") : 0; $calendar2 = COption::GetOptionString("intranet", "calendar_2", "N") == "Y"; if ($calendar2 && CModule::IncludeModule("calendar")) { if ($arParams['B_CUR_USER_LIST'] == 'Y') { $type = 'user'; } else { $type = CCalendar::GetTypeByExternalId('iblock_' . $arParams['IBLOCK_ID']); } if ($type) { $arParams["CALENDAR_TYPE"] = $type; $arParams["RETURN_ARRAY"] = 'Y'; $arResult = $APPLICATION->IncludeComponent("bitrix:calendar.events.list", "", $arParams); $this->IncludeComponentTemplate(); return; } } if ($this->StartResultCache(false, array($arParams['B_CUR_USER_LIST'] ? $curUserId : 0, $from_, $arParams['EVENTS_COUNT']))) { if (!CModule::IncludeModule("intranet") || !class_exists("CEventCalendar")) { $this->AbortResultCache(); ShowError(GetMessage("EC_INTRANET_MODULE_NOT_INSTALLED")); return; }