mirror of https://github.com/itflow-org/itflow
Feature: Calendar Names and Colors can now be edited
This commit is contained in:
parent
851542bcc1
commit
c573687fa1
|
|
@ -0,0 +1,42 @@
|
|||
<div class="modal" id="editCalendarModal<?php echo $calendar_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-circle mr-2" style="color:<?php echo $calendar_color; ?>"></i><?php echo $calendar_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="calendar_id" value="<?php echo $calendar_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name your calendar" value="<?php echo $calendar_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Color <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-paint-brush"></i></span>
|
||||
</div>
|
||||
<input type="color" class="form-control col-3" name="color" value="<?php echo $calendar_color; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_calendar" class="btn btn-primary"><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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -39,9 +39,12 @@ if (isset($_GET['calendar_id'])) {
|
|||
?>
|
||||
<div class="form-group">
|
||||
<i class="fas fa-fw fa-circle mr-2" style="color:<?php echo $calendar_color; ?>;"></i><?php echo $calendar_name; ?>
|
||||
<i class="fas fa-fw fa-pencil-alt text-secondary float-right"></i>
|
||||
<button type="button" class="btn btn-link btn-sm float-right" data-toggle="modal" data-target="#editCalendarModal<?php echo $calendar_id; ?>"><i class="fas fa-fw fa-pencil-alt text-secondary"></i></button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
require "calendar_edit_modal.php";
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,23 @@ if (isset($_POST['add_calendar'])) {
|
|||
|
||||
}
|
||||
|
||||
if (isset($_POST['edit_calendar'])) {
|
||||
|
||||
$calendar_id = intval($_POST['calendar_id']);
|
||||
$name = sanitizeInput($_POST['name']);
|
||||
$color = sanitizeInput($_POST['color']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE calendars SET calendar_name = '$name', calendar_color = '$color' WHERE calendar_id = $calendar_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Calendar', log_action = 'Edit', log_description = '$session_name Edited calendar $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $calendar_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Calendar <strong>$name</strong> edited";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['add_event'])) {
|
||||
|
||||
require_once 'post/event_model.php';
|
||||
|
|
|
|||
Loading…
Reference in New Issue