mirror of https://github.com/itflow-org/itflow
Calendar start day
Allow customising the calendar to start on a Monday instead of Sunday
This commit is contained in:
parent
5210fae3ec
commit
fbc87572e9
|
|
@ -261,6 +261,14 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||
?>
|
||||
],
|
||||
eventOrder: 'allDay,start,-duration,title',
|
||||
|
||||
<?php
|
||||
// User preference for Calendar start day (Sunday/Monday)
|
||||
// Fetch User Dashboard Settings
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_config_calendar_first_day FROM user_settings WHERE user_id = $session_user_id"));
|
||||
$user_config_calendar_first_day = intval($row['user_config_calendar_first_day']);
|
||||
?>
|
||||
firstDay: <?php echo $user_config_calendar_first_day ?>,
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
|
|
@ -293,4 +301,4 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||
// Update the end date field
|
||||
document.getElementById("event_add_end").value = new_end;
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1912,10 +1912,16 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
|||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.1'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.3.1') {
|
||||
// // Insert queries here required to update to DB version 1.3.1
|
||||
if (CURRENT_DATABASE_VERSION == '1.3.1') {
|
||||
mysqli_query($mysqli, "ALTER TABLE `user_settings` ADD `user_config_calendar_first_day` TINYINT(1) NOT NULL DEFAULT 0 AFTER `user_config_dashboard_technical_enable`");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.2'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.3.2') {
|
||||
// // Insert queries here required to update to DB version 1.3.2
|
||||
// // Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.2'");
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.3'");
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.3.1");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.3.2");
|
||||
|
|
|
|||
1
db.sql
1
db.sql
|
|
@ -1822,6 +1822,7 @@ CREATE TABLE `user_settings` (
|
|||
`user_config_records_per_page` int(11) NOT NULL DEFAULT 10,
|
||||
`user_config_dashboard_financial_enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`user_config_dashboard_technical_enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`user_config_calendar_first_day` tinyint(1) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
|
|
|||
|
|
@ -144,11 +144,18 @@ if (isset($_POST['edit_your_user_password'])) {
|
|||
header('Location: post.php?logout');
|
||||
}
|
||||
|
||||
if (isset($_POST['edit_your_user_browser_extention'])) {
|
||||
if (isset($_POST['edit_your_user_preferences'])) {
|
||||
|
||||
// CSRF Check
|
||||
validateCSRFToken($_POST['csrf_token']);
|
||||
|
||||
$calendar_first_day = intval($_POST['calendar_first_day']);
|
||||
|
||||
// Calendar
|
||||
if (isset($calendar_first_day)) {
|
||||
mysqli_query($mysqli, "UPDATE user_settings SET user_config_calendar_first_day = $calendar_first_day WHERE user_id = $session_user_id");
|
||||
}
|
||||
|
||||
// Enable extension access, only if it isn't already setup (user doesn't have cookie)
|
||||
if (isset($_POST['extension']) && $_POST['extension'] == 'Yes') {
|
||||
if (!isset($_COOKIE['user_extension_key'])) {
|
||||
|
|
|
|||
|
|
@ -1,30 +1,46 @@
|
|||
<?php
|
||||
require_once "inc_all_user.php";
|
||||
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_config_calendar_first_day FROM user_settings WHERE user_id = $session_user_id"));
|
||||
$user_config_calendar_first_day = intval($row['user_config_calendar_first_day']);
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-3">
|
||||
<h3 class="card-title"><i class="fas fa-fw fa-globe mr-2"></i>Browser Extension</h3>
|
||||
<h3 class="card-title"><i class="fas fa-fw fa-globe mr-2"></i>Preferences</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Calendar starts on<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>
|
||||
<select class="form-control select2" name="calendar_first_day" required>
|
||||
<option <?php if ($user_config_calendar_first_day == '0') { echo "selected"; } ?> value="0" >Sunday</option>
|
||||
<option <?php if ($user_config_calendar_first_day == '1') { echo "selected"; } ?> value="1" >Monday</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($session_user_role > 1) { ?>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" name="extension" id="extension" value="Yes" <?php if (isset($_COOKIE['user_extension_key'])) {echo "checked";} ?>>
|
||||
<input disabled="disabled" type="checkbox" class="form-check-input" name="extension" id="extension" value="Yes" <?php if (isset($_COOKIE['user_extension_key'])) {echo "checked";} ?>>
|
||||
<label class="form-check-label" for="extension">Enable Browser Extention?</label>
|
||||
<p class="small">Note: You must log out and back in again for these changes take effect.</p>
|
||||
<p class="small">Not currently in use / Note: You must log out and back in again for these changes take effect.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<button type="submit" name="edit_your_user_browser_extension" class="btn btn-primary btn-block mt-3"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="submit" name="edit_your_user_preferences" class="btn btn-primary btn-block mt-3"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
|
||||
</form>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue