mirror of
https://github.com/itflow-org/itflow
synced 2026-08-16 12:35:11 +00:00
Feature: Calendars are now exportable shareable so Third Party Calendar services can read them, also added recoccurence to calendar, and all day along with sperating the time fields and click in a box to add calendar event is possible
This commit is contained in:
@@ -13,6 +13,18 @@ $event_location = escapeHtml($row['event_location']);
|
||||
$event_start = escapeHtml($row['event_start']);
|
||||
$event_end = escapeHtml($row['event_end']);
|
||||
$event_repeat = escapeHtml($row['event_repeat']);
|
||||
$event_all_day = intval($row['event_all_day'] ?? 0);
|
||||
|
||||
// Split the stored datetimes into the four fields the form now uses. An empty
|
||||
// event_end previously fed strtotime('') and rendered as 1970 - fall back to the
|
||||
// start instead.
|
||||
$event_start_ts = strtotime($event_start) ?: time();
|
||||
$event_end_ts = !empty($row['event_end']) ? (strtotime($event_end) ?: $event_start_ts) : $event_start_ts;
|
||||
|
||||
$event_start_date = date('Y-m-d', $event_start_ts);
|
||||
$event_start_time = date('H:i', $event_start_ts);
|
||||
$event_end_date = date('Y-m-d', $event_end_ts);
|
||||
$event_end_time = date('H:i', $event_end_ts);
|
||||
$calendar_id = intval($row['calendar_id']);
|
||||
$calendar_name = escapeHtml($row['calendar_name']);
|
||||
$calendar_color = escapeHtml($row['calendar_color']);
|
||||
@@ -89,22 +101,61 @@ ob_start();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($event_repeat)) { ?>
|
||||
<div class="alert alert-info">
|
||||
<i class="fas fa-fw fa-redo mr-2"></i>
|
||||
This event repeats <strong>every <?= strtolower($event_repeat) ?></strong>.
|
||||
Saving or deleting affects <strong>every occurrence</strong> — a single
|
||||
occurrence cannot be moved or cancelled on its own.
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Start / End <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-check"></i></span>
|
||||
</div>
|
||||
<input type="datetime-local" class="form-control" name="start" value="<?= date('Y-m-d\TH:i:s', strtotime($event_start)) ?>" required>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input event-all-day-toggle" id="event_edit_all_day" name="all_day" value="1" <?php if ($event_all_day) { echo "checked"; } ?>>
|
||||
<label class="custom-control-label" for="event_edit_all_day">All day</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-day"></i></span>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label>Date from <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-check"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control event-start-date" id="event_edit_start_date" name="start_date" value="<?= $event_start_date ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>Date to <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar-day"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" id="event_edit_end_date" name="end_date" value="<?= $event_end_date ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row<?= $event_all_day ? ' d-none' : '' ?>" id="event_edit_time_fields">
|
||||
<div class="form-group col-md-6">
|
||||
<label>Time from <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="time" class="form-control event-start-time" id="event_edit_start_time" name="start_time" value="<?= $event_start_time ?>"<?= $event_all_day ? '' : ' required' ?>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>Time to <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="time" class="form-control" id="event_edit_end_time" name="end_time" value="<?= $event_end_time ?>"<?= $event_all_day ? '' : ' required' ?>>
|
||||
</div>
|
||||
<input type="datetime-local" class="form-control" name="end" value="<?= date('Y-m-d\TH:i:s', strtotime($event_end)) ?>"required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -114,7 +165,7 @@ ob_start();
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="repeat" disabled>
|
||||
<select class="form-control select2" name="repeat">
|
||||
<option <?php if (empty($event_repeat)) { echo "selected"; } ?> value="">Never</option>
|
||||
<option <?php if ($event_repeat == "Day") { echo "selected"; } ?>>Day</option>
|
||||
<option <?php if ($event_repeat == "Week") { echo "selected"; } ?>>Week</option>
|
||||
@@ -190,7 +241,7 @@ ob_start();
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-default text-danger mr-auto" href="post.php?delete_event=<?= $event_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"><i class="fa fa-calendar-times mr-2"></i>Delete</a>
|
||||
<a class="btn btn-default text-danger mr-auto confirm-link" href="post.php?delete_event=<?= $event_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"><i class="fa fa-calendar-times mr-2"></i><?= empty($event_repeat) ? 'Delete' : 'Delete series' ?></a>
|
||||
<button type="submit" name="edit_event" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user