Beispiel #1
0
    public static function DialogEditEvent($Params)
    {
        require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/tools/clock.php";
        global $APPLICATION, $USER_FIELD_MANAGER;
        $id = $Params['id'];
        $event = $Params['event'];
        $event['~DT_FROM_TS'] = $event['DT_FROM_TS'];
        $event['~DT_TO_TS'] = $event['DT_TO_TS'];
        $event['DT_FROM_TS'] = $Params['fromTs'];
        $event['DT_TO_TS'] = $Params['fromTs'] + $event['DT_LENGTH'];
        $UF = $USER_FIELD_MANAGER->GetUserFields("CALENDAR_EVENT", $event['ID'], LANGUAGE_ID);
        $event['UF_CRM_CAL_EVENT'] = $UF['UF_CRM_CAL_EVENT'];
        if (empty($event['UF_CRM_CAL_EVENT']['VALUE'])) {
            $event['UF_CRM_CAL_EVENT'] = false;
        }
        $event['UF_WEBDAV_CAL_EVENT'] = $UF['UF_WEBDAV_CAL_EVENT'];
        if (empty($event['UF_WEBDAV_CAL_EVENT']['VALUE'])) {
            $event['UF_WEBDAV_CAL_EVENT'] = false;
        }
        $userId = CCalendar::GetCurUserId();
        $arHost = CCalendar::GetUser($userId, true);
        $arHost['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($arHost);
        $arHost['URL'] = CCalendar::GetUserUrl($event['MEETING_HOST'], $Params["PATH_TO_USER"]);
        $arHost['DISPLAY_NAME'] = CCalendar::GetUserName($arHost);
        $Params['host'] = $arHost;
        if ($event['IS_MEETING']) {
            $attendees = array('y' => array('users' => array(), 'count' => 4, 'countMax' => 8, 'title' => GetMessage('EC_ATT_Y'), 'id' => "bxview-att-cont-y-" . $event['ID']), 'n' => array('users' => array(), 'count' => 2, 'countMax' => 3, 'title' => GetMessage('EC_ATT_N'), 'id' => "bxview-att-cont-n-" . $event['ID']), 'q' => array('users' => array(), 'count' => 2, 'countMax' => 3, 'title' => GetMessage('EC_ATT_Q'), 'id' => "bxview-att-cont-q-" . $event['ID']));
            $userIds = array();
            if (is_array($event['~ATTENDEES']) && count($event['~ATTENDEES']) > 0) {
                foreach ($event['~ATTENDEES'] as $i => $att) {
                    $userIds[] = $att["USER_ID"];
                    if ($userId == $att["USER_ID"]) {
                        $curUserStatus = $att['STATUS'];
                    }
                    $att['AVATAR_SRC'] = CCalendar::GetUserAvatarSrc($att);
                    $att['URL'] = CCalendar::GetUserUrl($att["USER_ID"], $Params["PATH_TO_USER"]);
                    $attendees[strtolower($att['STATUS'])]['users'][] = $att;
                }
                $acc = CCalendar::CheckUsersAccessibility(array('users' => $userIds, 'from' => $event['DT_FROM'], 'to' => $event['DT_TO'], 'eventId' => $event['ID']));
                foreach ($event['~ATTENDEES'] as $i => $att) {
                    $event['~ATTENDEES'][$i]['ACC'] = $acc[$att['USER_ID']];
                }
            }
        }
        if ($event['IS_MEETING'] && empty($event['ATTENDEES_CODES'])) {
            $event['ATTENDEES_CODES'] = CCalendarEvent::CheckEndUpdateAttendeesCodes($event);
        }
        $Params['event'] = $event;
        $Params['UF'] = $UF;
        $arTabs = array(array('name' => GetMessage('EC_EDEV_EVENT'), 'title' => GetMessage('EC_EDEV_EVENT_TITLE'), 'id' => $id . "ed-tab-0", 'active' => true), array('name' => GetMessage('EC_T_DESC'), 'title' => GetMessage('EC_T_DESC_TITLE'), 'id' => $id . "ed-tab-1"), array('name' => GetMessage('EC_EDEV_GUESTS'), 'title' => GetMessage('EC_EDEV_GUESTS_TITLE'), 'id' => $id . "ed-tab-2", "show" => !!$Params['bSocNet']), array('name' => GetMessage('EC_EDEV_ADD_TAB'), 'title' => GetMessage('EC_EDEV_ADD_TAB_TITLE'), 'id' => $id . "ed-tab-3"));
        $addWidthStyle = IsAmPmMode() ? ' ampm-width' : '';
        ?>

<script>
	window.__ATTENDEES_ACC = null;
		<?php 
        if ($event['IS_MEETING'] && is_array($event['~ATTENDEES'])) {
            ?>
	window.__ATTENDEES_ACC = <?php 
            echo CUtil::PhpToJSObject($event['~ATTENDEES']);
            ?>
;
	<?php 
        }
        ?>
</script>
<form enctype="multipart/form-data" method="POST" name="event_edit_form" id="<?php 
        echo $id;
        ?>
_form">
<input type="hidden" value="Y" name="skip_unescape"/>
<input id="event-id<?php 
        echo $id;
        ?>
" type="hidden" value="0" name="id"/>
<input id="event-month<?php 
        echo $id;
        ?>
" type="hidden" value="0" name="month"/>
<input id="event-year<?php 
        echo $id;
        ?>
" type="hidden" value="0" name="year"/>
<div id="bxec_edit_ed_<?php 
        echo $id;
        ?>
" class="bxec-popup">
	<div style="width: 610px; height: 1px;"></div>
	<div class="bxec-d-tabs" id="<?php 
        echo $id;
        ?>
_edit_tabs">
		<?php 
        foreach ($arTabs as $tab) {
            ?>
			<div class="bxec-d-tab <?php 
            if ($tab['active']) {
                echo 'bxec-d-tab-act';
            }
            ?>
" title="<?php 
            echo $tab['title'];
            ?>
" id="<?php 
            echo $tab['id'];
            ?>
" <?php 
            if ($tab['show'] === false) {
                echo 'style="display:none;"';
            }
            ?>
>
				<b></b><div><span><?php 
            echo $tab['name'];
            ?>
</span></div><i></i>
			</div>
		<?php 
        }
        ?>
	</div>
	<div class="bxec-d-cont"  id="<?php 
        echo $id;
        ?>
_edit_ed_d_tabcont">
		<?php 
        /* ####### TAB 0 : MAIN ####### */
        ?>
		<div id="<?php 
        echo $id;
        ?>
ed-tab-0-cont" class="bxec-d-cont-div" style="display: block;">
			<div class="bxc-meeting-edit-note"><?php 
        echo GetMessage('EC_EDIT_MEETING_NOTE');
        ?>
</div>

			<div class="bxec-from-to-reminder" id="feed-cal-from-to-cont<?php 
        echo $id;
        ?>
">
				<input id="event-from-ts<?php 
        echo $id;
        ?>
" type="hidden" value="" name="from_ts"/>
				<input id="event-to-ts<?php 
        echo $id;
        ?>
" type="hidden" value="" name="to_ts"/>
				<div class="bxec-from-to-reminder-inner">
			<span class="bxec-date">
				<label class="bxec-date-label" for="<?php 
        echo $id;
        ?>
edev-from"><?php 
        echo GetMessage('EC_EDEV_FROM_DATE_TIME');
        ?>
</label>
				<label class="bxec-date-label-full-day" for="<?php 
        echo $id;
        ?>
edev-from"><?php 
        echo GetMessage('EC_EDEV_DATE_FROM');
        ?>
</label>
				<input id="feed-cal-event-from<?php 
        echo $id;
        ?>
" type="text" class="calendar-inp calendar-inp-cal"/>
			</span>
			<span class="bxec-time<?php 
        echo $addWidthStyle;
        ?>
"><?php 
        CClock::Show(array('inputId' => 'feed_cal_event_from_time' . $id, 'inputTitle' => GetMessage('EC_EDEV_TIME_FROM'), 'showIcon' => false));
        ?>
</span>
			<span class="bxec-mdash">&mdash;</span>
			<span class="bxec-date">
				<label class="bxec-date-label" for="<?php 
        echo $id;
        ?>
edev-from"><?php 
        echo GetMessage('EC_EDEV_TO_DATE_TIME');
        ?>
</label>
				<label class="bxec-date-label-full-day" for="<?php 
        echo $id;
        ?>
edev-from"><?php 
        echo GetMessage('EC_EDEV_DATE_TO');
        ?>
</label>
				<input id="feed-cal-event-to<?php 
        echo $id;
        ?>
" type="text" class="calendar-inp calendar-inp-cal"/>
			</span>
			<span class="bxec-time<?php 
        echo $addWidthStyle;
        ?>
"><?php 
        CClock::Show(array('inputId' => 'feed_cal_event_to_time' . $id, 'inputTitle' => GetMessage('EC_EDEV_TIME_TO'), 'showIcon' => false));
        ?>
</span>

					<div class="bxec-reminder-collapsed" id="feed-cal-reminder-cont<?php 
        echo $id;
        ?>
">
						<input class="bxec-check" type="checkbox" id="event-reminder<?php 
        echo $id;
        ?>
" value="Y" name="remind[checked]"/>
						<label class="bxec-rem-lbl" for="event-reminder<?php 
        echo $id;
        ?>
"><?php 
        echo GetMessage('EC_EDEV_REMIND_EVENT');
        ?>
</label>
						<label class="bxec-rem-lbl-for" for="event-reminder<?php 
        echo $id;
        ?>
"><?php 
        echo GetMessage('EC_EDEV_REMIND_FOR');
        ?>
:</label>
						<span class="bxec-rem-value">
							<input class="calendar-inp" id="event_remind_count<?php 
        echo $id;
        ?>
" type="text" style="width: 30px" size="2" name="remind[count]">
							<select id="event_remind_type<?php 
        echo $id;
        ?>
" class="calendar-select" name="remind[type]" style="width: 106px;">
								<option value="min" selected="true"><?php 
        echo GetMessage('EC_EDEV_REM_MIN');
        ?>
</option>
								<option value="hour"><?php 
        echo GetMessage('EC_EDEV_REM_HOUR');
        ?>
</option>
								<option value="day"><?php 
        echo GetMessage('EC_EDEV_REM_DAY');
        ?>
</option>
							</select>
							<?php 
        echo GetMessage('ECLF_REM_DE_VORHER');
        ?>
						</span>
					</div>

					<div style="display:none;"><?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 class="bxec-full-day">
					<input type="checkbox" id="event-full-day<?php 
        echo $id;
        ?>
" value="Y" name="skip_time"/>
					<label style="display: inline-block;" for="event-full-day<?php 
        echo $id;
        ?>
"><?php 
        echo GetMessage('EC_FULL_DAY');
        ?>
</label>
				</div>
			</div>

			<div class="bxec-popup-row">
				<input name="name" placeholder="<?php 
        echo GetMessage('EC_T_EVENT_NAME');
        ?>
" type="text" id="<?php 
        echo $id;
        ?>
_edit_ed_name" class="calendar-inp bxec-inp-active" style="width: 500px; font-size: 18px!important;"/>
			</div>

			<div class="bxec-popup-row" id="<?php 
        echo $id;
        ?>
_location_cnt">
				<span class="bxec-field-label-edev"><label for="<?php 
        echo $id;
        ?>
_planner_location1"><?php 
        echo GetMessage('EC_LOCATION');
        ?>
:</label></span>
				<span class="bxec-field-val-2 bxecpl-loc-cont" >
				<input class="calendar-inp" style="width: 272px;" id="<?php 
        echo $id;
        ?>
_planner_location1" type="text"  title="<?php 
        echo GetMessage('EC_LOCATION_TITLE');
        ?>
" value="<?php 
        echo GetMessage('EC_PL_SEL_MEET_ROOM');
        ?>
" class="ec-label" />
				</span>
				<input id="event-location-old<?php 
        echo $id;
        ?>
" type="hidden" value="" name="location[OLD]"/>
				<input id="event-location-new<?php 
        echo $id;
        ?>
" type="hidden" value="" name="location[NEW]"/>
			</div>

			<?php 
        if ($Params['bIntranet']) {
            ?>
			<div class="bxec-popup-row bxec-ed-meeting-vis">
				<span class="bxec-field-label-edev"><label for="<?php 
            echo $id;
            ?>
_bxec_accessibility"><?php 
            echo GetMessage('EC_ACCESSIBILITY');
            ?>
:</label></span>
				<span class="bxec-field-val-2" >
				<select  class="calendar-select" id="<?php 
            echo $id;
            ?>
_bxec_accessibility" name="accessibility" style="width: 310px;">
					<option value="busy" title="<?php 
            echo GetMessage('EC_ACCESSIBILITY_B');
            ?>
"><?php 
            echo GetMessage('EC_ACCESSIBILITY_B');
            ?>
</option>
					<option value="quest" title="<?php 
            echo GetMessage('EC_ACCESSIBILITY_Q');
            ?>
"><?php 
            echo GetMessage('EC_ACCESSIBILITY_Q');
            ?>
</option>
					<option value="free" title="<?php 
            echo GetMessage('EC_ACCESSIBILITY_F');
            ?>
"><?php 
            echo GetMessage('EC_ACCESSIBILITY_F');
            ?>
</option>
					<option value="absent" title="<?php 
            echo GetMessage('EC_ACCESSIBILITY_A');
            ?>
 (<?php 
            echo GetMessage('EC_ACC_EX');
            ?>
)"><?php 
            echo GetMessage('EC_ACCESSIBILITY_A');
            ?>
 (<?php 
            echo GetMessage('EC_ACC_EX');
            ?>
)</option>
				</select>
				</span>
			</div>
			<?php 
        }
        ?>

			<div class="bxec-popup-row" id="<?php 
        echo $id;
        ?>
_sect_cnt">
				<span class="bxec-field-label-edev"><label for="<?php 
        echo $id;
        ?>
_edit_ed_calend_sel"><?php 
        echo GetMessage('EC_T_CALENDAR');
        ?>
:</label></span>
				<span class="bxec-field-val-2" >
				<select name="section" id="<?php 
        echo $id;
        ?>
_edit_ed_calend_sel" class="calendar-select" style="width: 310px;"></select><span id="<?php 
        echo $id;
        ?>
_edit_sect_sel_warn" class="bxec-warn" style="display: none;"><?php 
        echo GetMessage('EC_T_CALEN_DIS_WARNING');
        ?>
</span>
				</span>
			</div>

		</div>
		<?php 
        /* ####### END TAB 0 ####### */
        ?>

		<?php 
        /* ####### TAB 1 : DESCRIPTION - LHE ####### */
        ?>
		<div id="<?php 
        echo $id;
        ?>
ed-tab-1-cont" class="bxec-d-cont-div bxec-d-cont-div-lhe">
			<!-- Description + files -->
			<?php 
        $APPLICATION->IncludeComponent("bitrix:main.post.form", "", array("FORM_ID" => "event_edit_form", "SHOW_MORE" => "Y", "PARSER" => array("Bold", "Italic", "Underline", "Strike", "ForeColor", "FontList", "FontSizeList", "RemoveFormat", "Quote", "Code", "CreateLink", "Image", "UploadFile", "InputVideo", "Table", "Justify", "InsertOrderedList", "InsertUnorderedList", "Source", "MentionUser", "Spoiler"), "BUTTONS" => array("UploadFile", "CreateLink", "InputVideo", "Quote"), "TEXT" => array("ID" => $id . '_edit_ed_desc', "NAME" => "desc", "VALUE" => $Params['event']['DESCRIPTION'], "HEIGHT" => "280px"), "UPLOAD_WEBDAV_ELEMENT" => $Params['UF']['UF_WEBDAV_CAL_EVENT'], "UPLOAD_FILE_PARAMS" => array("width" => 400, "height" => 400), "FILES" => array("VALUE" => array(), "DEL_LINK" => '', "SHOW" => "N"), "SMILES" => array("VALUE" => array()), "LHE" => array("id" => $Params['id'] . '_event_editor', "documentCSS" => "", "jsObjName" => $Params['id'] . '_event_editor', "fontFamily" => "'Helvetica Neue', Helvetica, Arial, sans-serif", "fontSize" => "12px", "lazyLoad" => false, "setFocusAfterShow" => false)), false, array("HIDE_ICONS" => "Y"));
        ?>
		</div>
		<?php 
        /* ####### END TAB 1 ####### */
        ?>

		<?php 
        /* ####### TAB 2 : GUESTS ####### */
        if ($Params['bSocNet']) {
            ?>
		<div id="<?php 
            echo $id;
            ?>
ed-tab-2-cont" class="bxec-d-cont-div">
			<a id="<?php 
            echo $id;
            ?>
_planner_link" href="javascript:void(0);" title="<?php 
            echo GetMessage('EC_PLANNER_TITLE');
            ?>
" class="bxex-planner-link"><i></i><?php 
            echo GetMessage('EC_PLANNER2');
            ?>
</a>
			<?php 
            CCalendarSceleton::__ShowAttendeesDestinationHtml($Params);
            ?>
			<div class="bxc-att-cont-cont">
				<span class="bxc-add-guest-link"  id="<?php 
            echo $id;
            ?>
_user_control_link"></span>
				<div id="<?php 
            echo $id;
            ?>
_attendees_cont" class="bxc-attendees-cont" style="display: none;">
					<div class="bxc-owner-cont">
						<div class="bxc-owner-cont">
							<span class="bxc-owner-title"><span><?php 
            echo GetMessage('EC_EDEV_HOST');
            ?>
:</span></span>
							<span class="bxc-owner-value"><a id="<?php 
            echo $id;
            ?>
edit_host_link" href="javascript:void(0);"></a></span>
						</div>
					</div>
					<div class="bxc-no-att-notice"> - <?php 
            echo GetMessage('EC_NO_ATTENDEES');
            ?>
 - </div>
					<div class="bxc-att-title">
						<span><?php 
            echo GetMessage('EC_EDEV_GUESTS');
            ?>
:</span>
						<div id="<?php 
            echo $id;
            ?>
_att_summary"></div>
					</div>
					<div class="bxc-att-cont" id="<?php 
            echo $id;
            ?>
_attendees_list" style="height: 200px;"></div>
				</div>
			</div>

		</div>
		<?php 
            /* ####### END TAB 2 ####### */
            ?>
		<?php 
        }
        /* bSocNet */
        ?>

		<?php 
        /* ####### TAB 3 : ADDITIONAL INFO ####### */
        ?>
		<div id="<?php 
        echo $id;
        ?>
ed-tab-3-cont" class="bxec-d-cont-div">
			<div class="bxec-popup-row-title"><?php 
        echo GetMessage('EC_T_REPEATING');
        ?>
</div>

			<div class="bxec-popup-row-repeat" id="<?php 
        echo $id;
        ?>
_edit_ed_rep_cont">
				<div class="bxec-popup-row-2" id="<?php 
        echo $id;
        ?>
_edit_ed_rep_tr">
					<input id="event-rrule-byday<?php 
        echo $id;
        ?>
" type="hidden" value="0" name="rrule[BYDAY]"/>
					<input id="event-rrule-until<?php 
        echo $id;
        ?>
" type="hidden" value="0" name="rrule[UNTIL]"/>
					<input id="<?php 
        echo $id;
        ?>
_edit_ed_rep_check" type="checkbox" value="Y" name="rrule_enabled"/>
					<label for="<?php 
        echo $id;
        ?>
_edit_ed_rep_check" style="display: inline-block; margin: 3px 0 0 0; vertical-align:top;"><?php 
        echo GetMessage('EC_T_REPEAT_CHECK_LABEL');
        ?>
</label>
				</div>

				<div class="bxec-popup-row-bordered bxec-popup-repeat-details">

					<label for="<?php 
        echo $id;
        ?>
_edit_ed_rep_sel" class="event-grid-repeat-label"><?php 
        echo GetMessage('EC_T_REPEAT');
        ?>
:</label>
					<select id="<?php 
        echo $id;
        ?>
_edit_ed_rep_sel" class="calendar-select" name="rrule[FREQ]" style="width: 175px;">
						<option value="DAILY"><?php 
        echo GetMessage('EC_T_REPEAT_DAILY');
        ?>
</option>
						<option value="WEEKLY"><?php 
        echo GetMessage('EC_T_REPEAT_WEEKLY');
        ?>
</option>
						<option value="MONTHLY"><?php 
        echo GetMessage('EC_T_REPEAT_MONTHLY');
        ?>
</option>
						<option value="YEARLY"><?php 
        echo GetMessage('EC_T_REPEAT_YEARLY');
        ?>
</option>
					</select>

					<span class="event-grid-repeat-cont">
						<span class="event-grid-rep-phrases" id="<?php 
        echo $id;
        ?>
_edit_ed_rep_phrase1"></span>
						<select id="<?php 
        echo $id;
        ?>
_edit_ed_rep_count" class="calendar-select" name="rrule[INTERVAL]">
							<?php 
        for ($i = 1; $i < 36; $i++) {
            ?>
								<option value="<?php 
            echo $i;
            ?>
"><?php 
            echo $i;
            ?>
</option>
							<?php 
        }
        ?>
						</select>
						<span class="event-grid-rep-phrases" id="<?php 
        echo $id;
        ?>
_edit_ed_rep_phrase2"></span>

						<span id="<?php 
        echo $id;
        ?>
_edit_ed_rep_week_days" class="bxec-rep-week-days">
							<?php 
        $week_days = CCalendarSceleton::GetWeekDays();
        for ($i = 0; $i < 7; $i++) {
            $id_ = $id . 'bxec_week_day_' . $i;
            ?>
								<input id="<?php 
            echo $id_;
            ?>
" type="checkbox" value="<?php 
            echo $week_days[$i][2];
            ?>
">
								<label for="<?php 
            echo $id_;
            ?>
" title="<?php 
            echo $week_days[$i][0];
            ?>
"><?php 
            echo $week_days[$i][1];
            ?>
</label>
								<?php 
            if ($i == 2) {
                echo '<br>';
            }
            ?>
							<?php 
        }
        ?>
						</span>
					</span>

				</div>

				<div class="bxec-popup-row-bordered bxec-popup-repeat-details">
					<label for="<?php 
        echo $id_;
        ?>
edit-ev-rep-diap-to" style="display: inline-block; margin: 8px 3px 0 0; vertical-align:top;"><?php 
        echo GetMessage('EC_T_DIALOG_STOP_REPEAT');
        ?>
:</label>
					<input class="calendar-inp calendar-inp-cal" id="<?php 
        echo $id;
        ?>
edit-ev-rep-diap-to" type="text" style="width: 150px;"/>
				</div>
			</div>

			<div class="bxec-popup-row-title"><?php 
        echo GetMessage('EC_EDEV_ADD_TAB');
        ?>
</div>
			<div class="bxec-popup-row-2">
				<?php 
        echo GetMessage('EC_IMPORTANCE_TITLE');
        ?>
:
				<select id="<?php 
        echo $id;
        ?>
_bxec_importance" class="calendar-select" name="importance" style="width: 250px;">
					<option value="high" style="font-weight: bold;"><?php 
        echo GetMessage('EC_IMPORTANCE_H');
        ?>
</option>
					<option value="normal" selected="true"><?php 
        echo GetMessage('EC_IMPORTANCE_N');
        ?>
</option>
					<option value="low" style="color: #909090;"><?php 
        echo GetMessage('EC_IMPORTANCE_L');
        ?>
</option>
				</select>
			</div>

			<?php 
        if ($Params['type'] == 'user') {
            ?>
			<div class="bxec-popup-row-bordered bxec-popup-row-private">
				<input id="<?php 
            echo $id;
            ?>
_bxec_private" type="checkbox" value="Y" title="<?php 
            echo GetMessage('EC_PRIVATE_NOTICE');
            ?>
" name="private_event">
				<label for="<?php 
            echo $id;
            ?>
_bxec_private" title="<?php 
            echo GetMessage('EC_PRIVATE_NOTICE');
            ?>
"><?php 
            echo GetMessage('EC_PRIVATE_EVENT');
            ?>
</label>
				<div><?php 
            echo GetMessage('EC_PRIVATE_NOTICE');
            ?>
</div>
			</div>
			<?php 
        }
        ?>

			<!-- Color -->
			<div class="bxec-popup-row-bordered bxec-popup-row-color">
				<input id="<?php 
        echo $id;
        ?>
_bxec_color" type="hidden" value="" name="color" />
				<input id="<?php 
        echo $id;
        ?>
_bxec_text_color" type="hidden" value="" name="text_color" />
				<label class="bxec-color-label" for="<?php 
        echo $id;
        ?>
-event-color-inp"><?php 
        echo GetMessage('EC_T_COLOR');
        ?>
:</label>
				<div class="bxec-color-selector-cont">
				<?php 
        CCalendarSceleton::DisplayColorSelector($id, 'event');
        ?>
				</div>
			</div>

			<!-- Userfields -->
			<?php 
        if (isset($UF['UF_CRM_CAL_EVENT'])) {
            ?>
			<div id="<?php 
            echo $id;
            ?>
bxec_uf_group" class="bxec-popup-row-bordered">
				<?php 
            $crmUF = $UF['UF_CRM_CAL_EVENT'];
            ?>
				<label for="event-crm<?php 
            echo $id;
            ?>
" class="bxec-uf-crm-label"><?php 
            echo htmlspecialcharsbx($crmUF["EDIT_FORM_LABEL"]);
            ?>
:</label>
				<div class="bxec-uf-crm-cont">
					<?php 
            $APPLICATION->IncludeComponent("bitrix:system.field.edit", $crmUF["USER_TYPE"]["USER_TYPE_ID"], array("bVarsFromForm" => false, "arUserField" => $crmUF, "form_name" => 'event_edit_form'), null, array("HIDE_ICONS" => "Y"));
            ?>
				</div>
			</div>
			<?php 
        }
        ?>
		</div>
		<?php 
        /* ####### END TAB 3 ####### */
        ?>
	</div>
</div>
</form>
<?php 
    }
Beispiel #2
0
echo GetMessage('EC_T_DIALOG_STOP_REPEAT');
?>
:</label>
									<input name="EVENT_RRULE[UNTIL]" class="calendar-inp calendar-inp-cal" id="event-repeat-to-value<?php 
echo $id;
?>
" type="hidden"/>
									<input class="calendar-inp calendar-inp-cal" id="event-repeat-to<?php 
echo $id;
?>
" type="text" style="width: 100px; font-size: 13px;"/>
								</span>
							</div>
							<div class="feed-cal-week-days-cont">
								<?php 
$week_days = CCalendarSceleton::GetWeekDays();
for ($i = 0; $i < 7; $i++) {
    $id_ = $id . 'bxec_week_day_' . $i;
    ?>
									<input id="<?php 
    echo $id_;
    ?>
" type="checkbox" value="<?php 
    echo $week_days[$i][2];
    ?>
" name="EVENT_RRULE[BYDAY][]">
									<label for="<?php 
    echo $id_;
    ?>
" title="<?php 
    echo $week_days[$i][0];
Beispiel #3
0
	public function Show($Params = array())
	{
		global $APPLICATION, $USER, $EC_UserFields;
		$arType = false;

		foreach(self::$arTypes as $t)
			if (self::$type == $t['XML_ID'])
				$arType = $t;

		if (!$arType)
			return $APPLICATION->ThrowException('[EC_WRONG_TYPE]'.GetMessage('EC_WRONG_TYPE'));

		if (!CCalendarType::CanDo('calendar_type_view', self::$type))
			return $APPLICATION->ThrowException(GetMessage("EC_ACCESS_DENIED"));

		$arStartupEvent = false;
		$showNewEventDialog = false;
		//Show new event dialog
		if ($_GET['EVENT_ID'] == 'NEW')
		{
			$showNewEventDialog = true;
		}
		// Show popup event at start
		elseif ($arStartupEvent = self::GetStartUpEvent($_GET['EVENT_ID']))
		{
			if ($arStartupEvent['DT_FROM'])
			{
				$ts = self::Timestamp($arStartupEvent['DT_FROM']);
				$init_month = date('m', $ts);
				$init_year = date('Y', $ts);
			}
		}

		if (!$init_month && !$init_year && strlen($Params["initDate"]) > 0 && strpos($Params["initDate"], '.') !== false)
		{
			$ts = self::Timestamp($Params["initDate"]);
			$init_month = date('m', $ts);
			$init_year = date('Y', $ts);
		}

		if (!isset($init_month))
			$init_month = date("m");
		if (!isset($init_year))
			$init_year = date("Y");

		$id = 'EC'.rand();

		$weekHolidays = array();
		if (isset(self::$settings['year_holidays']))
		{
			$days = array('MO' => 0, 'TU' => 1, 'WE' => 2,'TH' => 3,'FR' => 4,'SA' => 5,'SU' => 6);
			foreach(self::$settings['week_holidays'] as $day)
				$weekHolidays[] = $days[$day];
		}
		else
			$weekHolidays = array(5, 6);

		$yearHolidays = array();
		if (isset(self::$settings['year_holidays']))
		{
			foreach(explode(',', self::$settings['year_holidays']) as $date)
			{
				$date = trim($date);
				$ardate = explode('.', $date);
				if (count($ardate) == 2 && $ardate[0] && $ardate[1])
					$yearHolidays[] = intVal($ardate[0]).'.'.(intVal($ardate[1]) - 1);
			}
		}

		$yearWorkdays = array();
		if (isset(self::$settings['year_workdays']))
		{
			foreach(explode(',', self::$settings['year_workdays']) as $date)
			{
				$date = trim($date);
				$ardate = explode('.', $date);
				if (count($ardate) == 2 && $ardate[0] && $ardate[1])
					$yearWorkdays[] = intVal($ardate[0]).'.'.(intVal($ardate[1]) - 1);
			}
		}

		$bShowBanner = self::IsPersonal() && self::$userSettings['showBanner'];
		$bExchange = CCalendar::IsExchangeEnabled() && self::$type == 'user';
		$bExchangeConnected = $bExchange && CDavExchangeCalendar::IsExchangeEnabledForUser(self::$ownerId);
		$bCalDAV = CCalendar::IsCalDAVEnabled() && self::$type == "user";
		$bWebservice = CCalendar::IsWebserviceEnabled();
		$bExtranet = CCalendar::IsExtranetEnabled();

		if (!self::$bIntranet && !$bExchange && !$bCalDAV)
			$bShowBanner = false;

		$JSConfig = Array(
			'id' => $id,
			'type' => self::$type,
			'userId' => self::$userId,
			'userName' => self::GetUserName(self::$userId),
			'ownerId' => self::$ownerId,
			'perm' => $arType['PERM'], // Permissions from type
			'permEx' => self::$perm,
			'bTasks' => self::$bTasks,
			'sectionControlsDOMId' => self::$SectionsControlsDOMId,
			'week_holidays' => $weekHolidays,
			'year_holidays' => $yearHolidays,
			'year_workdays' => $yearWorkdays,
			'week_start' => self::GetWeekStart(),
			'week_days' => CCalendarSceleton::GetWeekDaysEx(self::GetWeekStart()),
			'init_month' => $init_month,
			'init_year' => $init_year,
			'pathToUser' => self::$pathToUser,
			'path' => self::$path,
			'page' => self::$actionUrl,
			'settings' => self::$settings,
			'userSettings' => self::$userSettings,
			'bShowBanner' => $bShowBanner,
			'bAnonym' => self::$bAnonym,
			'bIntranet' => self::$bIntranet,
			'bWebservice' => $bWebservice,
			'bExtranet' => $bExtranet,
			'bSocNet' => self::$bSocNet,
			'bExchange' => $bExchangeConnected,
			'startupEvent' => $arStartupEvent,
			//'superposeExportLink' => $this->superposeExportLink,
			'canAddToSuperpose' => self::$bCanAddToSuperpose,
			'workTime' => array(self::$settings['work_time_start'], self::$settings['work_time_end']),

			'meetingRooms' => self::GetMeetingRoomList(array(
				'RMiblockId' => self::$settings['rm_iblock_id'],
				'pathToMR' => self::$pathesForSite['path_to_rm'],
				'VMiblockId' => self::$settings['vr_iblock_id'],
				'pathToVR' => self::$pathesForSite['path_to_vr']
			)),
			'allowResMeeting' => self::$allowReserveMeeting,
			'allowVideoMeeting' => self::$allowVideoMeeting,
			'plannerSettings' => CCalendarPlanner::GetUserOptions(),
			'bAMPM' => self::$bAMPM,
			'bWideDate' => self::$bWideDate
		);

		$lastSection = CUserOptions::GetOption("calendar", "last_section", false, self::$userId);
		if (isset($lastSection[self::$type.'_'.self::$ownerId]))
			$JSConfig['lastSection'] = $lastSection[self::$type.'_'.self::$ownerId];

		// Access permissons for type
		if (CCalendarType::CanDo('calendar_type_access', self::$type))
			$JSConfig['TYPE_ACCESS'] = $arType['ACCESS'];

		if ($bCalDAV)
			self::InitCalDavParams($JSConfig);

		// If enabled superposed sections - fetch it
		$arAddSections = array();
		if (self::$bSuperpose)
			$arAddSections = self::GetDisplayedSuperposed(self::$userId);

		if (!is_array($arAddSections))
			$arAddSections = array();

		$arSectionIds = array();
		$hiddenSections = CCalendarSect::Hidden(self::$userId);

		$arDisplayedSPSections = array();
		foreach($arAddSections as $sect)
			$arDisplayedSPSections[] = $sect;

		self::$userMeetingSection = CCalendar::GetCurUserMeetingSection();

		//  **** GET SECTIONS ****
		$arSections = self::GetSectionList(array(
			'ADDITIONAL_IDS' => $arDisplayedSPSections
		));

		$bReadOnly = !self::$perm['edit'] && !self::$perm['section_edit'];
		if (self::$type == 'user' && self::$ownerId != self::$userId)
			$bReadOnly = true;
		if (!$USER->IsAuthorized())
			$bReadOnly = true;
		$bCreateDefault = true;

		if (self::$type == 'user')
			$bCreateDefault = self::$ownerId == self::$userId;

		$noEditAccessedCalendars = true;
		$additonalMeetingsId = array();

		foreach ($arSections as $i => $section)
		{
			$arSections[$i]['~IS_MEETING_FOR_OWNER'] = $section['CAL_TYPE'] == 'user' && $section['OWNER_ID'] != self::$userId && CCalendar::GetMeetingSection($section['OWNER_ID']) == $section['ID'];

			if (!in_array($section['ID'], $hiddenSections))
			{
				$arSectionIds[] = $section['ID'];
				// It's superposed calendar of the other user and it's need to show user's meetings
				if ($arSections[$i]['~IS_MEETING_FOR_OWNER'])
					$additonalMeetingsId[] = array('ID' => $section['OWNER_ID'], 'SECTION_ID' => $section['ID']);
			}

			// We check access only for main sections because we can't edit superposed section
			if ($arSections[$i]['CAL_TYPE'] == self::$type && $arSections[$i]['OWNER_ID'] == self::$ownerId)
			{
				if ($noEditAccessedCalendars && $section['PERM']['edit'])
					$noEditAccessedCalendars = false;

				if ($bReadOnly && ($section['PERM']['edit'] || $section['PERM']['edit_section']))
					$bReadOnly = false;
			}

			if (self::$bSuperpose && in_array($section['ID'], $arAddSections))
				$arSections[$i]['SUPERPOSED'] = true;

			if ($bCreateDefault && $section['CAL_TYPE'] == self::$type && $section['OWNER_ID'] == self::$ownerId)
				$bCreateDefault = false;
		}

		if ($noEditAccessedCalendars && !$bCreateDefault)
			$bReadOnly = true;

		if (self::$bSuperpose && $bReadOnly && count($arAddSections) <= 0)
			self::$bSuperpose = false;

		self::$bReadOnly = $bReadOnly;
		if (!$bReadOnly && $showNewEventDialog)
		{
			$JSConfig['showNewEventDialog'] = true;
			$JSConfig['bChooseMR'] = isset($_GET['CHOOSE_MR']) && $_GET['CHOOSE_MR'] == "Y";
		}

		//  **** GET EVENTS ****
		// NOTICE: Attendees for meetings selected inside this method and returns as array by link '$arAttendees'
		$arAttendees = array(); // List of attendees for each event Array([ID] => Array(), ..,);

		$arEvents = self::GetEventList(array(
			'type' => self::$type,
			'section' => $arSectionIds,
			'fromLimit' => self::Date(mktime(0, 0, 0, $init_month - 1, 20, $init_year), false),
			'toLimit' => self::Date(mktime(0, 0, 0, $init_month + 1, 10, $init_year), false),
			'additonalMeetingsId' => $additonalMeetingsId
		), $arAttendees);

		$arTaskIds = array();
		//  **** GET TASKS ****
		if (self::$bTasks && !in_array('tasks', $hiddenSections))
		{
			$arTasks = self::GetTaskList(array(
				'fromLimit' => self::Date(mktime(0, 0, 0, $init_month - 1, 20, $init_year), false),
				'toLimit' => self::Date(mktime(0, 0, 0, $init_month + 1, 10, $init_year), false)
			), $arTaskIds);

			if (count($arTasks) > 0)
				$arEvents = array_merge($arEvents, $arTasks);
		}

		// We don't have any section
		if ($bCreateDefault)
		{
			$defCalendar = CCalendarSect::CreateDefault(array(
				'type' => CCalendar::GetType(),
				'ownerId' => CCalendar::GetOwnerId()
			));
			$arSectionIds[] = $defCalendar['ID'];
			$arSections[] = $defCalendar;
			self::$userMeetingSection = $defCalendar['ID'];
		}

		if (CCalendarType::CanDo('calendar_type_edit', self::$type))
			$JSConfig['new_section_access'] = CCalendarSect::GetDefaultAccess(self::$type, self::$ownerId);

		if ($bReadOnly && (!count($arSections) || count($arSections) == 1 && !self::$bIntranet))
			$bShowSections = false;
		else
			$bShowSections = true;

		$arColors = array(
			'#CEE669','#E6A469','#98AEF6','#7DDEC2','#B592EC','#D98E85','#F6EA68','#DDBFEB','#FF8D89','#FFCEFF',
			'#3ABF54','#BF793A','#1C1CD8','#4BB798','#855CC5','#B25D52','#FFBD26','#C48297','#E53D37','#7DF5FF'
		);

		// Build calendar base html and dialogs
		CCalendarSceleton::Build(array(
			'id' => $id,
			'type' => self::$type,
			'ownerId' => self::$ownerId,
			'bShowSections' => $bShowSections,
			'bShowSuperpose' => self::$bSuperpose,
			'bShowBanner' => $bShowBanner,
			'bOutlook' => self::$bIntranet && self::$bWebservice,
			'bExtranet' => $bExtranet,
			'bReadOnly' => $bReadOnly,
			'bShowTasks' => self::$bTasks,
			'arTaskIds' => $arTaskIds,
			'bSocNet' => self::$bSocNet,
			'bIntranet' => self::$bIntranet,
			'week_days' => CCalendarSceleton::GetWeekDays(),
			'bCalDAV' => $bCalDAV,
			'bExchange' => $bExchange,
			'bExchangeConnected' => $bExchangeConnected,
			'inPersonalCalendar' => self::IsPersonal(),
			'colors' => $arColors,
			'bAMPM' => self::$bAMPM
		));

		$JSConfig['arCalColors'] = $arColors;
		$JSConfig['events'] = $arEvents;
		$JSConfig['attendees'] = $arAttendees;
		$JSConfig['sections'] = $arSections;
		$JSConfig['sectionsIds'] = $arSectionIds;
		$JSConfig['hiddenSections'] = $hiddenSections;
		$JSConfig['readOnly'] = $bReadOnly;
		$JSConfig['accessNames'] = self::GetAccessNames();
		$JSConfig['bSuperpose'] = self::$bSuperpose;
		$JSConfig['additonalMeetingsId'] = $additonalMeetingsId;

		// Append Javascript files and CSS files, and some base configs
		CCalendarSceleton::InitJS($JSConfig);
	}