Changeset 3398617
- Timestamp:
- 11/19/2025 08:14:14 AM (4 months ago)
- Location:
- occupancy-plan/trunk
- Files:
-
- 1 added
- 31 edited
-
admin/class-occupancy-plan-admin.php (modified) (7 diffs)
-
admin/controller/class-occupancy-plan-block-exceptions.php (modified) (3 diffs)
-
admin/controller/class-occupancy-plan-blocks.php (modified) (13 diffs)
-
admin/controller/class-occupancy-plan-court-names.php (modified) (2 diffs)
-
admin/controller/class-occupancy-plan-plans.php (modified) (1 diff)
-
admin/controller/class-occupancy-plan-prepared-blocks.php (modified) (2 diffs)
-
admin/controller/class-occupancy-plan-time-slots.php (modified) (2 diffs)
-
admin/js/occupancy-plan-admin.js (modified) (1 diff)
-
admin/partials/occupancy-plan-block-exception.php (modified) (2 diffs)
-
admin/partials/occupancy-plan-block.php (modified) (5 diffs)
-
admin/partials/occupancy-plan-blocks.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-court-name.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-court-names.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-plan.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-plans.php (modified) (2 diffs)
-
admin/partials/occupancy-plan-prepared-block.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-prepared-blocks.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-preview.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-provisional-blocks.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-time-slot.php (modified) (3 diffs)
-
admin/partials/occupancy-plan-time-slots.php (modified) (3 diffs)
-
admin/table/class-occupancy-plan-block-exceptions.php (modified) (3 diffs)
-
admin/table/class-occupancy-plan-blocks.php (modified) (3 diffs)
-
admin/table/class-occupancy-plan-court-names.php (modified) (3 diffs)
-
admin/table/class-occupancy-plan-prepared-blocks.php (modified) (3 diffs)
-
admin/table/class-occupancy-plan-time-slots.php (modified) (3 diffs)
-
includes/class-occupancy-plan-main.php (modified) (2 diffs)
-
includes/class-occupancy-plan-plugin.php (modified) (4 diffs)
-
includes/occupancy-plan-transient.php (added)
-
occupancy-plan.php (modified) (2 diffs)
-
public/class-occupancy-plan-public.php (modified) (8 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
occupancy-plan/trunk/admin/class-occupancy-plan-admin.php
r3383502 r3398617 71 71 require_once plugin_dir_path(dirname(__FILE__)) . 'admin/controller/class-occupancy-plan-block-exceptions.php'; 72 72 } 73 74 require_once plugin_dir_path(dirname(__FILE__)) . 'includes/occupancy-plan-transient.php'; 73 75 74 76 class Occupancy_Plan_Admin … … 358 360 public function load_admin_plans() 359 361 { 360 $tab = (isset($_GET['tab']))? esc_attr($_GET['tab']) : ((isset($_SESSION['op_tabid']))? esc_attr($_SESSION['op_tabid']) : '0');361 $_SESSION['op_tabid'] = $tab;362 $tab = (isset($_GET['tab']))? esc_attr($_GET['tab']) : esc_attr(occupancy_plan_get_state_value('op_tabid', 0)); 363 occupancy_plan_set_state_value('op_tabid', $tab); 362 364 if ($tab == '0') 363 365 { … … 925 927 * 1.3.17 - Import of field 'authorizedusers' 926 928 * 1.4.3 - Add 'checkblockconflict' column 929 * 1.4.13 - Add 'priority' column 927 930 */ 928 931 public function csv_import($planID, $importblocks) … … 1136 1139 'provisional' => ($datalen > 26)? intval($csvdata[26]) : 0, 1137 1140 'confirmed' => ($datalen > 27)? intval($csvdata[27]) : null, 1138 'authorizedusers' => ($datalen > 28)? sanitize_text_field($csvdata[28]) : '' 1141 'authorizedusers' => ($datalen > 28)? sanitize_text_field($csvdata[28]) : '', 1142 'priority' => ($datalen > 29)? intval($csvdata[29]) : 0 1139 1143 ); 1140 1144 $format = array('%d','%s','%s','%s','%d','%d','%d', 1141 1145 '%s','%s','%s','%s','%d','%d', 1142 1146 '%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s', 1143 '%s','%d','%s','%s' );1147 '%s','%d','%s','%s','%d'); 1144 1148 if ($wpdb->insert($table_block, $blockdata, $format) != false) 1145 1149 { … … 1390 1394 'created', 'createdby', 'lastmodified', 'lastmodifiedby', 1391 1395 'customfield1', 'customfield2', 'customfield3', 'customfield4', 1392 'mailaddress','provisional','confirmed', 'authorizedusers' );1396 'mailaddress','provisional','confirmed', 'authorizedusers', 'priority'); 1393 1397 fputcsv($file, $csv_header, $delimiter); 1394 1398 … … 1399 1403 created,createdby,lastmodified,lastmodifiedby, 1400 1404 customfield1,customfield2,customfield3,customfield4, 1401 mailaddress,provisional,confirmed,authorizedusers 1405 mailaddress,provisional,confirmed,authorizedusers,priority 1402 1406 FROM $table_block WHERE planid = $planID"; 1403 1407 $blocks = $wpdb->get_results($sql, ARRAY_A); … … 1425 1429 Occupancy_Plan_Plugin::update_db_check(); 1426 1430 } 1427 1428 /**1429 * Start the session1430 *1431 * @since 1.41432 *1433 * 1.4.3 - Fix: Error An active PHP session was detected1434 * 1.4.10 - Changed to session_status check1435 * 1.4.11 - Set of 'read_and_close' to 'true'1436 * 1.4.12 - Set of 'read_and_close' to 'true' deleted1437 */1438 public function start_session()1439 {1440 if (session_status() !== PHP_SESSION_ACTIVE) {1441 session_start();1442 }1443 }1444 1445 /**1446 * Destroy the session1447 *1448 * @since 1.41449 *1450 * 1.4.6 - Fix: Check if PHP session is active1451 */1452 public function end_session()1453 {1454 if (session_status() === PHP_SESSION_ACTIVE)1455 {1456 session_destroy();1457 }1458 }1459 1431 } -
occupancy-plan/trunk/admin/controller/class-occupancy-plan-block-exceptions.php
r3068435 r3398617 101 101 $wpdb->delete($table_block_exception, array('id' => (int) $courtid)); 102 102 103 $_SESSION["op_msgid"] = 61;103 occupancy_plan_set_state_value("op_msgid", 61); 104 104 } 105 105 } … … 129 129 $this->internal_save_block_exception($exceptionid, $blockid, $exceptiondata); 130 130 131 $_SESSION["op_msgid"] = ($exceptionid == 0)? 63:62; 132 $_SESSION["op_tabid"] = 1; 133 $_SESSION["op_blockid"] = $blockid; 131 $state = occupancy_plan_get_state(); 132 $state["op_msgid"] = ($exceptionid == 0)? 63:62; 133 $state["op_tabid"] = 1; 134 $state["op_blockid"] = $blockid; 135 occupancy_plan_set_state($state); 134 136 135 137 wp_redirect(admin_url("admin.php?page=occupancy-plan-block")); … … 148 150 $format = array('%d','%s','%s','%s','%s','%d'); 149 151 150 $_SESSION["op_blockid"] = $blockid;152 occupancy_plan_set_state_value("op_blockid", $blockid); 151 153 152 154 if ((isset($exceptionid)) && ($exceptionid > 0)) -
occupancy-plan/trunk/admin/controller/class-occupancy-plan-blocks.php
r3291549 r3398617 22 22 * 1.2.4 - Add 'provisional' flag to block 23 23 * 1.3.14 - Use schedule default color for new block in backend 24 * 1.4.13 - Add column priority 24 25 */ 25 26 public function new_block($plan) … … 55 56 $block->customfield4 = ''; 56 57 $block->provisional = 0; 58 $block->priority = 1; 57 59 58 60 return $block; … … 134 136 $result = $wpdb->delete($table_block, array('id' => (int) $blockid)); 135 137 138 $state = occupancy_plan_get_state(); 136 139 if (isset($_POST['is_provisional'])) 137 140 { 138 $ _SESSION["op_tabid"] = 2;139 $ _SESSION["op_msgid"] = 21;141 $state["op_tabid"] = 2; 142 $state["op_msgid"] = 21; 140 143 } 141 144 else 142 145 { 143 $_SESSION["op_tabid"] = 1; 144 $_SESSION["op_msgid"] = 11; 145 } 146 $state["op_tabid"] = 1; 147 $state["op_msgid"] = 11; 148 } 149 occupancy_plan_set_state($state); 146 150 } 147 151 … … 193 197 } 194 198 195 $_SESSION["op_tabid"] = 2; 196 $_SESSION["op_msgid"] = 24; 197 $_SESSION["op_planid"] = $planid; 199 $state = occupancy_plan_get_state(); 200 $state["op_tabid"] = 2; 201 $state["op_msgid"] = 24; 202 $state["op_planid"] = $planid; 203 occupancy_plan_set_state($state); 198 204 } 199 205 … … 237 243 $result = $wpdb->delete($table_block, array('id' => (int) $block->id)); 238 244 239 $_SESSION["op_tabid"] = 2; 240 $_SESSION["op_msgid"] = 25; 241 $_SESSION["op_planid"] = $planid; 245 $state = occupancy_plan_get_state(); 246 $state["op_tabid"] = 2; 247 $state["op_msgid"] = 25; 248 $state["op_planid"] = $planid; 249 occupancy_plan_set_state($state); 242 250 } 243 251 … … 260 268 $result = $this->internal_save_block(); 261 269 262 $_SESSION["op_tabid"] = ($is_provisional)? 2 : 1; 263 $_SESSION["op_planid"] = $planid; 270 $state = occupancy_plan_get_state(); 271 $state["op_tabid"] = ($is_provisional)? 2 : 1; 272 $state["op_planid"] = $planid; 264 273 265 274 if (false === $result) … … 267 276 if ($is_provisional) 268 277 { 269 $ _SESSION["op_msgid"] = ($blockid > 0)? 26 : 27;278 $state["op_msgid"] = ($blockid > 0)? 26 : 27; 270 279 } 271 280 else 272 281 { 273 $ _SESSION["op_msgid"] = ($blockid > 0)? 16 : 17;282 $state["op_msgid"] = ($blockid > 0)? 16 : 17; 274 283 } 275 284 return $wpdb->last_error; … … 279 288 if ($is_provisional) 280 289 { 281 $ _SESSION["op_msgid"] = ($blockid > 0)? 22 : 23;290 $state["op_msgid"] = ($blockid > 0)? 22 : 23; 282 291 } 283 292 else 284 293 { 285 $_SESSION["op_msgid"] = ($blockid > 0)? 12 : 13; 286 } 287 } 294 $state["op_msgid"] = ($blockid > 0)? 12 : 13; 295 } 296 } 297 occupancy_plan_set_state($state); 298 288 299 wp_redirect(admin_url("admin.php?page=occupancy-plan")); 289 300 } … … 459 470 'customfield4' => sanitize_text_field($_POST['customfield4']), 460 471 'provisional' => isset($_POST['provisional'])? intval($_POST['provisional']) : 0, 472 'priority' => isset($_POST['priority'])? intval($_POST['priority']) : 0 461 473 ); 462 474 … … 464 476 465 477 $format = array('%d','%s','%s','%s','%d','%d','%d','%s','%s','%s','%s','%d', 466 '%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%d' );478 '%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%d','%d'); 467 479 $id = intval($_POST['id']); 468 480 // Update existing booking block record … … 492 504 'mailaddress' => (isset($_POST['mailaddress']))? sanitize_text_field($_POST['mailaddress']) : '', 493 505 'comment' => $comment, 506 'authorizedusers' => (isset($_POST['authorizedusers']))? sanitize_textarea_field($_POST['authorizedusers']) : '', 494 507 'created' => (isset($_POST['created']))? sanitize_text_field($_POST['created']) : date("Y-m-d H:i"), 495 508 'createdby' => (isset($_POST['createdby']))? sanitize_text_field($_POST['createdby']) : wp_get_current_user()->user_login, … … 501 514 'customfield4' => sanitize_text_field($_POST['customfield4']), 502 515 'provisional' => isset($_POST['provisional'])? intval($_POST['provisional']) : 0, 516 'priority' => isset($_POST['priority'])? intval($_POST['priority']) : 0 503 517 ); 504 518 … … 506 520 507 521 $format = array('%d','%s','%s','%s','%d','%d','%d','%s','%s','%s','%s','%d', 508 '%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','% d');522 '%d','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%d','%d'); 509 523 510 524 // Insert a new booking block record -
occupancy-plan/trunk/admin/controller/class-occupancy-plan-court-names.php
r3208007 r3398617 104 104 array('%d')); 105 105 106 $_SESSION["op_tabid"] = 4; 107 $_SESSION["op_msgid"] = 41; 106 $state = occupancy_plan_get_state(); 107 $state["op_tabid"] = 4; 108 $state["op_msgid"] = 41; 109 occupancy_plan_set_state($state); 108 110 } 109 111 … … 147 149 array('%d')); 148 150 149 $_SESSION["op_msgid"] = ($courtid == 0)? 43:42; 150 $_SESSION["op_tabid"] = 4; 151 $_SESSION["op_planid"] = $planid; 151 $state = occupancy_plan_get_state(); 152 $state["op_msgid"] = ($courtid == 0)? 43:42; 153 $state["op_tabid"] = 4; 154 $state["op_planid"] = $planid; 155 occupancy_plan_set_state($state); 152 156 153 157 wp_redirect(admin_url("admin.php?page=occupancy-plan")); -
occupancy-plan/trunk/admin/controller/class-occupancy-plan-plans.php
r3208007 r3398617 690 690 return __('Time Slot successfully created!', 'occupancy-plan'); 691 691 case 56: 692 return $_SESSION["op_delcount"]. ' '. __('Time Slots deleted!', 'occupancy-plan');692 return occupancy_plan_get_state_value("op_delcount", 0) . ' '. __('Time Slots deleted!', 'occupancy-plan'); 693 693 } 694 694 } -
occupancy-plan/trunk/admin/controller/class-occupancy-plan-prepared-blocks.php
r3208007 r3398617 101 101 $result = $wpdb->delete($table_prepared_block, array('id' => (int) $blockID)); 102 102 103 $_SESSION["op_tabid"] = 3; 104 $_SESSION["op_msgid"] = 31; 103 $state = occupancy_plan_get_state(); 104 $state["op_tabid"] = 3; 105 $state["op_msgid"] = 31; 106 occupancy_plan_set_state($state); 105 107 } 106 108 … … 133 135 $this->internal_save_prepared_block($blockid, $planid, $blockdata); 134 136 135 $_SESSION["op_msgid"] = ($blockid == 0)? 33:32; 136 $_SESSION["op_tabid"] = 3; 137 $_SESSION["op_planid"] = $planid; 137 $state = occupancy_plan_get_state(); 138 $state["op_msgid"] = ($blockid == 0)? 33:32; 139 $state["op_tabid"] = 3; 140 $state["op_planid"] = $planid; 141 occupancy_plan_set_state($state); 138 142 139 143 wp_redirect(admin_url("admin.php?page=occupancy-plan")); -
occupancy-plan/trunk/admin/controller/class-occupancy-plan-time-slots.php
r3208007 r3398617 89 89 $wpdb->delete($table_time_slot, array('id' => (int) $timeID)); 90 90 91 $_SESSION["op_tabid"] = 5; 92 $_SESSION["op_msgid"] = 51; 91 $state = occupancy_plan_get_state(); 92 $state["op_tabid"] = 5; 93 $state["op_msgid"] = 51; 94 occupancy_plan_set_state($state); 93 95 } 94 96 … … 117 119 $this->internal_save_time_slot($timeid, $planid, $timedata); 118 120 119 $_SESSION["op_msgid"] = ($timeid == 0)? 53:52; 120 $_SESSION["op_tabid"] = 5; 121 $_SESSION["op_planid"] = $planid; 121 $state = occupancy_plan_get_state(); 122 $state["op_msgid"] = ($timeid == 0)? 53:52; 123 $state["op_tabid"] = 5; 124 $state["op_planid"] = $planid; 125 occupancy_plan_set_state($state); 122 126 123 127 wp_redirect(admin_url("admin.php?page=occupancy-plan")); -
occupancy-plan/trunk/admin/js/occupancy-plan-admin.js
r3068435 r3398617 199 199 200 200 $('.op-intervalselect').change(function() { 201 201 202 var interval = $(this).val(); 202 203 if (interval == 1) 203 204 { 204 $(' div.op-singledate').show();205 $(' td.op-intervalinfo').hide();206 $(' div.op-multidate').hide();207 $(' select.op-intervalinfoselect-3').hide();208 $(' select.op-intervalinfoselect-5').hide();205 $('.op-singledate').show(); 206 $('.op-intervalinfo').hide(); 207 $('.op-multidate').hide(); 208 $('.op-intervalinfoselect-3').hide(); 209 $('.op-intervalinfoselect-5').hide(); 209 210 } 210 211 else if (interval == 2) 211 212 { 212 $(' div.op-singledate').hide();213 $(' td.op-intervalinfo').hide();214 $(' div.op-multidate').show();215 $(' select.op-intervalinfoselect-3').hide();216 $(' select.op-intervalinfoselect-5').hide();213 $('.op-singledate').hide(); 214 $('.op-intervalinfo').hide(); 215 $('v.op-multidate').show(); 216 $('.op-intervalinfoselect-3').hide(); 217 $('.op-intervalinfoselect-5').hide(); 217 218 } 218 219 else if (interval == 3) 219 220 { 220 $(' div.op-singledate').hide();221 $(' td.op-intervalinfo').show();222 $(' div.op-multidate').show();223 $(' select.op-intervalinfoselect-3').show();224 $(' select.op-intervalinfoselect-5').hide();221 $('.op-singledate').hide(); 222 $('.op-intervalinfo').show(); 223 $('.op-multidate').show(); 224 $('.op-intervalinfoselect-3').show(); 225 $('.op-intervalinfoselect-5').hide(); 225 226 } 226 227 else if (interval == 4) 227 228 { 228 $(' div.op-singledate').hide();229 $(' td.op-intervalinfo').hide();230 $(' div.op-multidate').show();231 $(' select.op-intervalinfoselect-3').hide();232 $(' select.op-intervalinfoselect-5').hide();229 $('.op-singledate').hide(); 230 $('.op-intervalinfo').hide(); 231 $('.op-multidate').show(); 232 $('.op-intervalinfoselect-3').hide(); 233 $('.op-intervalinfoselect-5').hide(); 233 234 } 234 235 else if (interval == 5) 235 236 { 236 $(' div.op-singledate').hide();237 $(' td.op-intervalinfo').show();238 $(' div.op-multidate').show();239 $(' select.op-intervalinfoselect-3').hide();240 $(' select.op-intervalinfoselect-5').show();237 $('.op-singledate').hide(); 238 $('.op-intervalinfo').show(); 239 $('.op-multidate').show(); 240 $('.op-intervalinfoselect-3').hide(); 241 $('.op-intervalinfoselect-5').show(); 241 242 } 242 243 }); -
occupancy-plan/trunk/admin/partials/occupancy-plan-block-exception.php
r3383502 r3398617 18 18 } 19 19 20 // error_log(print_r($_SESSION, true)); 20 // Load current state 21 $state = occupancy_plan_get_state(); 22 23 // error_log(print_r($state, true)); 21 24 22 25 if (isset($_GET['mode'])) … … 48 51 } 49 52 50 $_SESSION["op_msgid"] = 0; 51 $lastpage = $_SESSION["op_lastpage"]; 52 $_SESSION["op_lastpage"] = 'block-exception'; 53 $state["op_msgid"] = 0; 54 $lastpage = $state["op_lastpage"]; 55 $state["op_lastpage"] = 'block-exception'; 56 57 // Save current state 58 occupancy_plan_set_state($state); 53 59 ?> 54 60 -
occupancy-plan/trunk/admin/partials/occupancy-plan-block.php
r3383502 r3398617 19 19 } 20 20 21 // error_log(print_r($_SESSION, true)); 21 // Load current state 22 $state = occupancy_plan_get_state(); 22 23 23 24 if (isset($_GET['mode'])) … … 31 32 $block = $this->blocks->get_block(intval($_GET['blockID'])); 32 33 } 33 else if ((isset($ _SESSION['op_blockid'])) && (intval($_SESSION['op_blockid']) > 0))34 else if ((isset($state['op_blockid'])) && (intval($state['op_blockid']) > 0)) 34 35 { 35 $block = $this->blocks->get_block(intval($ _SESSION['op_blockid']));36 $block = $this->blocks->get_block(intval($state['op_blockid'])); 36 37 } 37 38 else if (isset($_GET['planID'])) … … 55 56 56 57 $courts = $this->blocks->get_court_names($plan); 57 $message = (isset($ _SESSION["op_msgid"]))? $this->blocks->get_message(intval($_SESSION["op_msgid"])) : NULL;58 $ _SESSION["op_blockid"] = $block->id;59 $ _SESSION["op_planid"] = $block->planid;58 $message = (isset($state["op_msgid"]))? $this->blocks->get_message(intval($state["op_msgid"])) : NULL; 59 $state["op_blockid"] = $block->id; 60 $state["op_planid"] = $block->planid; 60 61 } 61 62 else … … 64 65 } 65 66 66 $_SESSION["op_tabid"] = ($block->provisional == 1)? 2:1; 67 $_SESSION["op_msgid"] = 0; 68 $lastpage = (isset($_SESSION["op_lastpage"]))? $_SESSION["op_lastpage"] : 'plan'; 69 $_SESSION["op_lastpage"] = 'block'; 67 $state["op_tabid"] = ($block->provisional == 1)? 2:1; 68 $state["op_msgid"] = 0; 69 $lastpage = (isset($state["op_lastpage"]))? $state["op_lastpage"] : 'plan'; 70 $state["op_lastpage"] = 'block'; 71 72 // Save current state 73 occupancy_plan_set_state($state); 70 74 ?> 71 75 … … 284 288 <div class="op-admin-form-group"> 285 289 <div class="op-admin-form-col-4"> 290 <label class="op-admin-label" for="priority"><?php echo __('Priority', 'occupancy-plan');?></label> 291 </div> 292 <div class="op-admin-form-col-8"> 293 <input class="op-admin-input-25" type="text" name="priority" maxlength="1" value="<?php echo esc_attr($block->priority)?>" <?php echo (isset($mode))? '':'readonly'?> /> 294 <span class="op-help-tip" data-tooltip="<?php echo __('Bookings with smaller values are displayed in the foreground', 'occupancy-plan');?>">?</span> 295 </div> 296 <div class="op-admin-form-col-4"> 286 297 <label class="op-admin-label "for="color"><?php echo __('Color', 'occupancy-plan');?></label> 287 298 </div> -
occupancy-plan/trunk/admin/partials/occupancy-plan-blocks.php
r3208007 r3398617 18 18 wp_die(); 19 19 } 20 21 // Load current state 22 $state = occupancy_plan_get_state(); 20 23 21 24 if ((isset( $_GET['export'])) && (isset($_GET['planID']))) … … 41 44 $planID = intval($_GET['planID']); 42 45 } 43 else if (isset($ _SESSION['op_planid']))46 else if (isset($state['op_planid'])) 44 47 { 45 $planID = intval($ _SESSION['op_planid']);48 $planID = intval($state['op_planid']); 46 49 } 47 50 else … … 76 79 $planID = $plans[0]->id; 77 80 } 78 $ _SESSION['op_planid'] = $planID;79 $ _SESSION['op_blockid'] = null;81 $state['op_planid'] = $planID; 82 $state['op_blockid'] = null; 80 83 $blocksTable = new Occupancy_Plan_Blocks(false, false); 81 84 $blocksTable->prepare_items(); 85 86 // Save current state 87 occupancy_plan_set_state($state); 82 88 ?> 83 89 -
occupancy-plan/trunk/admin/partials/occupancy-plan-court-name.php
r3208007 r3398617 20 20 } 21 21 22 // Load current state 23 $state = occupancy_plan_get_state(); 24 22 25 if (isset($_GET['mode'])) 23 26 { … … 30 33 $court = $this->courtnames->get_court_name(intval($_GET['courtID'])); 31 34 } 32 else if ((isset($_GET['planID'])) || (isset($ _SESSION['planID'])))35 else if ((isset($_GET['planID'])) || (isset($state['planID']))) 33 36 { 34 $court = $this->courtnames->new_court_name(intval(isset($_GET['planID'])? $_GET['planID'] : $ _SESSION['planID']));37 $court = $this->courtnames->new_court_name(intval(isset($_GET['planID'])? $_GET['planID'] : $state['planID'])); 35 38 $mode = 'create'; 36 39 } … … 45 48 } 46 49 47 $_SESSION["op_tabid"] = 4; 48 $_SESSION["op_msgid"] = 0; 49 $lastpage = $_SESSION["op_lastpage"]; 50 $_SESSION["op_lastpage"] = 'court-name'; 50 $state["op_tabid"] = 4; 51 $state["op_msgid"] = 0; 52 $lastpage = $state["op_lastpage"]; 53 $state["op_lastpage"] = 'court-name'; 54 55 // Save current state 56 occupancy_plan_set_state($state); 51 57 ?> 52 58 -
occupancy-plan/trunk/admin/partials/occupancy-plan-court-names.php
r3191380 r3398617 19 19 } 20 20 21 // Load current state 22 $state = occupancy_plan_get_state(); 23 21 24 if (isset($_POST['planID'])) 22 25 { … … 27 30 $planID = intval($_GET['planID']); 28 31 } 29 else if (isset($ _SESSION['op_planid']))32 else if (isset($state['op_planid'])) 30 33 { 31 $planID = intval($ _SESSION['op_planid']);34 $planID = intval($state['op_planid']); 32 35 } 33 36 else … … 57 60 $planID = $plans[0]->id; 58 61 } 59 $ _SESSION['op_planid'] = $planID;62 $state['op_planid'] = $planID; 60 63 $courtNamesTable = new Occupancy_Plan_Court_Names(false); 61 64 $courtNamesTable->prepare_items(); 65 66 // Save current state 67 occupancy_plan_set_state($state); 62 68 ?> 63 69 -
occupancy-plan/trunk/admin/partials/occupancy-plan-plan.php
r3291549 r3398617 18 18 } 19 19 20 // Load current state 21 $state = occupancy_plan_get_state(); 22 20 23 if ((isset($_GET['export'])) && (isset($_GET['planID']))) 21 24 { … … 42 45 { 43 46 $planID = intval($_GET['planID']); 44 $ _SESSION['op_planid'] = $planID;45 } 46 else if ((isset($ _SESSION['op_planid'])) && (intval($_SESSION['op_planid']) > 0))47 { 48 $planID = intval($ _SESSION['op_planid']);47 $state['op_planid'] = $planID; 48 } 49 else if ((isset($state['op_planid'])) && (intval($state['op_planid']) > 0)) 50 { 51 $planID = intval($state['op_planid']); 49 52 } 50 53 … … 72 75 if (isset($plan)) 73 76 { 74 $message = (isset($ _SESSION["op_msgid"]))? $this->plans->get_message(intval($_SESSION["op_msgid"])) : NULL;75 $errormessage = (isset($ _SESSION["op_msgid"]))? $this->plans->get_error_message(intval($_SESSION["op_msgid"])) : NULL;76 $tab = (isset($ _SESSION['op_tabid']))? intval($_SESSION['op_tabid']) : 1;77 $message = (isset($state["op_msgid"]))? $this->plans->get_message(intval($state["op_msgid"])) : NULL; 78 $errormessage = (isset($state["op_msgid"]))? $this->plans->get_error_message(intval($state["op_msgid"])) : NULL; 79 $tab = (isset($state['op_tabid']))? intval($state['op_tabid']) : 1; 77 80 } 78 81 else 79 82 { 80 83 $errormessage = __('Schedule not found!', 'occupancy-plan'); 81 $_SESSION["op_planid"] = 0; 82 } 83 84 $_SESSION["op_tabid"] = 0; 85 $_SESSION["op_msgid"] = 0; 86 $lastpage = (isset($_SESSION["op_lastpage"]))? $_SESSION["op_lastpage"] : 'plan'; 87 $_SESSION["op_lastpage"] = 'plan'; 88 $_SESSION["op_blockid"] = 0; 84 $state["op_planid"] = 0; 85 } 86 87 $state["op_tabid"] = 0; 88 $state["op_msgid"] = 0; 89 $lastpage = (isset($state["op_lastpage"]))? $state["op_lastpage"] : 'plan'; 90 $state["op_lastpage"] = 'plan'; 91 $state["op_blockid"] = 0; 92 93 // Save current state 94 occupancy_plan_set_state($state); 89 95 ?> 90 96 -
occupancy-plan/trunk/admin/partials/occupancy-plan-plans.php
r3068435 r3398617 19 19 wp_die(); 20 20 } 21 22 // Load current state 23 $state = occupancy_plan_get_state(); 21 24 22 25 if (isset($_GET['msg'])) … … 44 47 $plans = $this->plans->get_plans(); 45 48 46 $_SESSION["op_tabid"] = 5; 47 $_SESSION["op_msgid"] = 0; 48 $_SESSION["op_planid"] = 0; 49 $state["op_tabid"] = 5; 50 $state["op_msgid"] = 0; 51 $state["op_planid"] = 0; 52 53 // Save current state 54 occupancy_plan_set_state($state); 49 55 ?> 50 56 -
occupancy-plan/trunk/admin/partials/occupancy-plan-prepared-block.php
r3208007 r3398617 20 20 } 21 21 22 // Load current state 23 $state = occupancy_plan_get_state(); 24 22 25 if (isset($_GET['mode'])) 23 26 { … … 30 33 $block = $this->preparedblocks->get_prepared_block(intval($_GET['blockID'])); 31 34 } 32 else if ((isset($_GET['planID'])) || (isset($ _SESSION['planID'])))35 else if ((isset($_GET['planID'])) || (isset($state['planID']))) 33 36 { 34 37 // Create a new prepared block 35 $block = $this->preparedblocks->new_prepared_block(intval(isset($_GET['planID'])? $_GET['planID'] : $ _SESSION['planID']));38 $block = $this->preparedblocks->new_prepared_block(intval(isset($_GET['planID'])? $_GET['planID'] : $state['planID'])); 36 39 $mode = 'create'; 37 40 } … … 46 49 } 47 50 48 $_SESSION["op_tabid"] = 3; 49 $_SESSION["op_msgid"] = 0; 50 $lastpage = $_SESSION["op_lastpage"]; 51 $_SESSION["op_lastpage"] = 'prepared-block'; 51 $state["op_tabid"] = 3; 52 $state["op_msgid"] = 0; 53 $lastpage = $state["op_lastpage"]; 54 $state["op_lastpage"] = 'prepared-block'; 55 56 // Save current state 57 occupancy_plan_set_state($state); 52 58 ?> 53 59 -
occupancy-plan/trunk/admin/partials/occupancy-plan-prepared-blocks.php
r3191380 r3398617 19 19 } 20 20 21 // Load current state 22 $state = occupancy_plan_get_state(); 23 21 24 if (isset($_POST['planID'])) 22 25 { … … 27 30 $planID = intval($_GET['planID']); 28 31 } 29 else if (isset($ _SESSION['op_planid']))32 else if (isset($state['op_planid'])) 30 33 { 31 $planID = intval($ _SESSION['op_planid']);34 $planID = intval($state['op_planid']); 32 35 } 33 36 else … … 57 60 $planID = $plans[0]->id; 58 61 } 59 $ _SESSION['op_planid'] = $planID;62 $state['op_planid'] = $planID; 60 63 $blocksTable = new Occupancy_Plan_Prepared_Blocks(false); 61 64 $blocksTable->prepare_items(); 65 66 // Save current state 67 occupancy_plan_set_state($state); 62 68 ?> 63 69 -
occupancy-plan/trunk/admin/partials/occupancy-plan-preview.php
r3191380 r3398617 19 19 } 20 20 21 // Load current state 22 $state = occupancy_plan_get_state(); 23 21 24 if (isset($_POST['planID'])) 22 25 { … … 27 30 $planID = intval($_GET['planID']); 28 31 } 29 else if (isset($ _SESSION['op_planid']))32 else if (isset($state['op_planid'])) 30 33 { 31 $planID = intval($ _SESSION['op_planid']);34 $planID = intval($state['op_planid']); 32 35 } 33 36 else … … 51 54 $planID = $plans[0]->id; 52 55 } 53 $_SESSION['op_planid'] = $planID; 56 $state['op_planid'] = $planID; 57 58 // Save current state 59 occupancy_plan_set_state($state); 54 60 ?> 55 61 -
occupancy-plan/trunk/admin/partials/occupancy-plan-provisional-blocks.php
r3191380 r3398617 19 19 } 20 20 21 // Load current state 22 $state = occupancy_plan_get_state(); 23 21 24 if (isset($_POST['planID'])) 22 25 { … … 27 30 $planID = intval($_GET['planID']); 28 31 } 29 else if (isset($ _SESSION['op_planid']))32 else if (isset($state['op_planid'])) 30 33 { 31 $planID = intval($ _SESSION['op_planid']);34 $planID = intval($state['op_planid']); 32 35 } 33 36 else … … 63 66 $planID = $plans[0]->id; 64 67 } 65 $ _SESSION['op_planid'] = $planID;68 $state['op_planid'] = $planID; 66 69 $blocksTable = new Occupancy_Plan_Blocks(true, false); 67 70 $blocksTable->prepare_items(); 71 72 // Save current state 73 occupancy_plan_set_state($state); 68 74 ?> 69 75 -
occupancy-plan/trunk/admin/partials/occupancy-plan-time-slot.php
r3208007 r3398617 21 21 } 22 22 23 // Load current state 24 $state = occupancy_plan_get_state(); 25 23 26 if (isset($_GET['mode'])) 24 27 { … … 31 34 $time = $this->timeslots->get_time_slot(intval($_GET['timeID'])); 32 35 } 33 else if ((isset($_GET['planID'])) || (isset($ _SESSION['planID'])))36 else if ((isset($_GET['planID'])) || (isset($state['planID']))) 34 37 { 35 $time = $this->timeslots->new_time_slot(intval(isset($_GET['planID'])? $_GET['planID'] : $ _SESSION['planID']));38 $time = $this->timeslots->new_time_slot(intval(isset($_GET['planID'])? $_GET['planID'] : $state['planID'])); 36 39 $mode = 'create'; 37 40 } … … 45 48 } 46 49 47 $_SESSION["op_tabid"] = 5; 48 $_SESSION["op_msgid"] = 0; 49 $lastpage = $_SESSION["op_lastpage"]; 50 $_SESSION["op_lastpage"] = 'time-slot'; 50 $state["op_tabid"] = 5; 51 $state["op_msgid"] = 0; 52 $lastpage = $state["op_lastpage"]; 53 $state["op_lastpage"] = 'time-slot'; 54 55 // Save current state 56 occupancy_plan_set_state($state); 51 57 ?> 52 58 -
occupancy-plan/trunk/admin/partials/occupancy-plan-time-slots.php
r3191380 r3398617 20 20 } 21 21 22 // Load current state 23 $state = occupancy_plan_get_state(); 24 22 25 if (isset($_POST['planID'])) 23 26 { … … 28 31 $planID = intval($_GET['planID']); 29 32 } 30 else if (isset($ _SESSION['op_planid']))33 else if (isset($state['op_planid'])) 31 34 { 32 $planID = intval($ _SESSION['op_planid']);35 $planID = intval($state['op_planid']); 33 36 } 34 37 else … … 58 61 $planID = $plans[0]->id; 59 62 } 60 $ _SESSION['op_planid'] = $planID;63 $state['op_planid'] = $planID; 61 64 $timeSlotsTable = new Occupancy_Plan_Time_Slots(false); 62 65 $timeSlotsTable->prepare_items(); 66 67 // Save current state 68 occupancy_plan_set_state($state); 63 69 ?> 64 70 -
occupancy-plan/trunk/admin/table/class-occupancy-plan-block-exceptions.php
r3068435 r3398617 209 209 $sql .= " WHERE (blockid = " . esc_sql($_GET['blockID']) . ")"; 210 210 } 211 else if (isset($_SESSION['blockID'])) 212 { 213 $sql .= " WHERE (blockid = " . esc_sql($_SESSION['blockID']) . ")"; 211 else 212 { 213 $blockid = occupancy_plan_get_state_value('blockID', 0); 214 if ($blockid > 0) 215 { 216 $sql .= " WHERE (blockid = " . esc_sql($blockid) . ")"; 217 } 214 218 } 215 219 … … 256 260 $selecteditems = array_map('sanitize_text_field', $_POST['bulk-item-selection']); 257 261 $selecteditems = implode(',', $selecteditems); 258 $_SESSION["op_delcount"] = count($_POST['bulk-item-selection']);262 occupancy_plan_set_state_value("op_delcount", count($_POST['bulk-item-selection'])); 259 263 } 260 264 else … … 269 273 $wpdb->query("DELETE FROM $table_block_exception WHERE id IN ($selecteditems)"); 270 274 271 $_SESSION["op_msgid"] = 66;275 occupancy_plan_set_state_value("op_msgid", 66); 272 276 } 273 277 } -
occupancy-plan/trunk/admin/table/class-occupancy-plan-blocks.php
r3068435 r3398617 412 412 JOIN $table_plan AS plan ON plan.id = block.planid"; 413 413 414 if (isset($_SESSION['op_planid'])) 415 { 416 $sql .= " WHERE (plan.id = " . esc_sql($_SESSION['op_planid']) . ")"; 414 $planid = occupancy_plan_get_state_value('op_planid', 0); 415 if ($planid > 0) 416 { 417 $sql .= " WHERE (plan.id = " . esc_sql($planid) . ")"; 417 418 } 418 419 … … 503 504 $selecteditems = array_map('sanitize_text_field', $_POST['bulk-item-selection']); 504 505 $selecteditems = implode(',', $selecteditems); 505 $_SESSION["op_delcount"] = count($_POST['bulk-item-selection']);506 occupancy_plan_set_state_value("op_delcount", count($_POST['bulk-item-selection'])); 506 507 } 507 508 else … … 515 516 $table_block = "{$wpdb->prefix}occupancy_plan_block"; 516 517 $wpdb->query("DELETE FROM $table_block WHERE id IN ($selecteditems)"); 517 $_SESSION["op_msgid"] = ($this->is_provisional)? 26 : 16;518 occupancy_plan_set_state_value("op_msgid", ($this->is_provisional)? 26 : 16); 518 519 } 519 520 } -
occupancy-plan/trunk/admin/table/class-occupancy-plan-court-names.php
r3068435 r3398617 236 236 JOIN $table_plan AS plan ON plan.id = court.planid"; 237 237 238 if (isset($_SESSION['op_planid'])) 239 { 240 $sql .= " WHERE (plan.id = " . esc_sql($_SESSION['op_planid']) . ")"; 238 $planid = occupancy_plan_get_state_value('op_planid', 0); 239 if ($planid > 0) 240 { 241 $sql .= " WHERE (plan.id = " . esc_sql($planid) . ")"; 241 242 } 242 243 … … 286 287 $selecteditems = array_map('sanitize_text_field', $_POST['bulk-item-selection']); 287 288 $selecteditems = implode(',', $selecteditems); 288 $_SESSION["op_delcount"] = count($_POST['bulk-item-selection']);289 occupancy_plan_set_state_value("op_delcount", count($_POST['bulk-item-selection'])); 289 290 } 290 291 else … … 319 320 } 320 321 321 $_SESSION["op_msgid"] = 46;322 occupancy_plan_set_state_value("op_msgid", 46); 322 323 } 323 324 } -
occupancy-plan/trunk/admin/table/class-occupancy-plan-prepared-blocks.php
r3068435 r3398617 242 242 JOIN $table_plan AS plan ON plan.id = block.planid"; 243 243 244 if (isset($_SESSION['op_planid'])) 245 { 246 $sql .= " WHERE (plan.id = " . esc_sql($_SESSION['op_planid']) . ")"; 244 $planid = occupancy_plan_get_state_value('op_planid', 0); 245 if ($planid > 0) 246 { 247 $sql .= " WHERE (plan.id = " . esc_sql($planid) . ")"; 247 248 } 248 249 … … 291 292 $selecteditems = array_map('sanitize_text_field', $_POST['bulk-item-selection']); 292 293 $selecteditems = implode(',', $selecteditems); 293 $_SESSION["op_delcount"] = count($_POST['bulk-item-selection']);294 occupancy_plan_set_state_value("op_delcount", count($_POST['bulk-item-selection'])); 294 295 } 295 296 else … … 303 304 $table_prepared_block = "{$wpdb->prefix}occupancy_plan_prepared_block"; 304 305 $wpdb->query("DELETE FROM $table_prepared_block WHERE id IN ($selecteditems)"); 305 $_SESSION["op_msgid"] = 36;306 occupancy_plan_set_state_value("op_msgid", 36); 306 307 } 307 308 } -
occupancy-plan/trunk/admin/table/class-occupancy-plan-time-slots.php
r3208007 r3398617 229 229 JOIN $table_plan AS plan ON plan.id = timeslot.planid"; 230 230 231 if (isset($_SESSION['op_planid'])) 232 { 233 $sql .= " WHERE (plan.id = " . esc_sql($_SESSION['op_planid']) . ")"; 231 $planid = occupancy_plan_get_state_value('op_planid', 0); 232 if ($planid > 0) 233 { 234 $sql .= " WHERE (plan.id = " . esc_sql($planid) . ")"; 234 235 } 235 236 … … 276 277 $selecteditems = array_map('sanitize_text_field', $_POST['bulk-item-selection']); 277 278 $selecteditems = implode(',', $selecteditems); 278 $_SESSION["op_delcount"] = count($_POST['bulk-item-selection']);279 occupancy_plan_set_state_value("op_delcount", count($_POST['bulk-item-selection'])); 279 280 } 280 281 else … … 288 289 $table_time_slot= "{$wpdb->prefix}occupancy_plan_time_slot"; 289 290 $wpdb->query("DELETE FROM $table_time_slot WHERE id IN ($selecteditems)"); 290 $_SESSION["op_msgid"] = 56;291 occupancy_plan_set_state_value("op_msgid", 56); 291 292 wp_redirect(admin_url("admin.php?page=occupancy-plan")); 292 293 } -
occupancy-plan/trunk/includes/class-occupancy-plan-main.php
r3383502 r3398617 148 148 * 1.2.5 - Add 'plugins_loaded' action to perfrom db check 149 149 * 1.2.6 - Add of 'confirm_block' and 'reject_block' actions 150 * 1.4.13 - remove session handling 150 151 */ 151 152 private function define_admin_hooks() … … 188 189 189 190 add_action('plugins_loaded', array($plugin_admin, 'db_check')); 190 191 add_action('init', array($plugin_admin, 'start_session'), 1);192 add_action('wp_logout', array($plugin_admin, 'end_session'));193 add_action('wp_login', array($plugin_admin, 'end_session'));194 191 } 195 192 -
occupancy-plan/trunk/includes/class-occupancy-plan-plugin.php
r3103274 r3398617 15 15 16 16 global $occupancy_plan_db_version; 17 $occupancy_plan_db_version = '1.4. 3';17 $occupancy_plan_db_version = '1.4.13'; 18 18 19 19 class Occupancy_Plan_Plugin … … 49 49 * 1.4 - Add block exceptions 50 50 * 1.4.3 - Add 'checkblockconflict' column 51 * 1.4.13 - Add 'priority' column 51 52 * 52 53 */ … … 224 225 confirmed datetime NULL, 225 226 authorizedusers varchar(256) NULL, 227 priority tinyint NULL, 226 228 UNIQUE KEY id (id) 227 229 ) $charset_collate;"; … … 260 262 confirmed datetime NULL, 261 263 authorizedusers varchar(256) NULL, 264 priority tinyint NULL, 262 265 FOREIGN KEY (planid) REFERENCES {$table_plan}(id) ON DELETE CASCADE, 263 266 UNIQUE KEY id (id) -
occupancy-plan/trunk/occupancy-plan.php
r3383502 r3398617 16 16 * Plugin URI: https://www.software-kunze.de/plugins/occupancy-plan/ 17 17 * Description: Management of Occupancy Plans 18 * Version: 1.4.1 218 * Version: 1.4.13 19 19 * Author: Alexander Kunze Software Consulting 20 20 * Author URI: https://www.software-kunze.de … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define('Occupancy_Plan', '1.4.1 2');38 define('Occupancy_Plan', '1.4.13'); 39 39 40 40 /** -
occupancy-plan/trunk/public/class-occupancy-plan-public.php
r3208007 r3398617 656 656 * 1.3.19 - Add weekday property 657 657 * 1.3.22 -Check block exceptions 658 * 1.4.13 - Order by priority 658 659 */ 659 660 private function get_month_blocks($month, $week, $courtID, $plan, $court_names) … … 719 720 AND ((`interval` <> 3) OR ((intervalinfo = {$weekdayinmonth}) AND (weekday = {$weekday}))) 720 721 AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek})) 722 ORDER BY priority 721 723 LIMIT 1"; 722 724 … … 796 798 * 1.3.22 - If frontend is not anoymized then show detailed tooltip 797 799 * - Check block exceptions 800 * 1.4.13 - Order by priority 798 801 */ 799 802 private function get_week_blocks($week, $time, $plan, $court_names, $courtID) … … 829 832 AND ((`interval` <> 3) OR (intervalinfo = {$weekdayinmonth})) 830 833 AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek})) 834 ORDER BY priority 831 835 LIMIT 1"; 832 836 … … 917 921 * 1.3.22 - If frontend is not anoymized then show detailed tooltip 918 922 * - Check block exceptions 923 * 1.4.13 - Order by priority 919 924 */ 920 925 private function get_day_blocks($singledate, $time, $plan, $court_names, $courtID) … … 967 972 AND ((`interval` <> 3) OR (intervalinfo = {$weekdayinmonth})) 968 973 AND ((`interval` <> 5) OR (intervalinfo = {$calendarweek})) 974 ORDER BY priority 969 975 LIMIT 1"; 970 976 … … 1361 1367 'customfield4' => $block->customfield4, 1362 1368 'provisional' => $block->provisional, 1363 'authorizedusers' => $block->authorizedusers 1369 'authorizedusers' => $block->authorizedusers, 1370 'priority' => $block->priority 1364 1371 ); 1365 1372 … … 2041 2048 $block->customfield4 = ''; 2042 2049 $block->provisional = $details['provisional']; 2050 $block->priority = 1; 2043 2051 2044 2052 return $block; -
occupancy-plan/trunk/readme.txt
r3383502 r3398617 5 5 Requires at least: 4.9 6 6 Tested up to: 6.8.3 7 Stable tag: 1.4.1 27 Stable tag: 1.4.13 8 8 Requires PHP: 5.2.4 9 9 License: GPLv2 or later … … 50 50 == Changelog == 51 51 52 = 1.4.13 = 53 * Add of block priority 54 * Fix: Interval change script error corrected 55 * Fix: Changed Session handling to transient 56 52 57 = 1.4.12 = 53 58 * Fix: Select correct block after save block exception
Note: See TracChangeset
for help on using the changeset viewer.