Changeset 3414331
- Timestamp:
- 12/08/2025 01:27:33 PM (4 months ago)
- Location:
- occupancy-plan/trunk
- Files:
-
- 4 edited
-
admin/partials/occupancy-plan-plan.php (modified) (1 diff)
-
occupancy-plan.php (modified) (2 diffs)
-
public/class-occupancy-plan-public.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
occupancy-plan/trunk/admin/partials/occupancy-plan-plan.php
r3398617 r3414331 322 322 <div class="op-admin-form-col-8"> 323 323 <input class="op-admin-input-25" type="number" name="breakbetween" min="0" max="90" maxlength="1" size="3" value="<?php echo esc_attr($plan->breakbetween)?>" <?php echo (isset($mode))? '':'readonly'?> /> 324 <span class="op-help-tip" data-tooltip="<?php echo __('Break time in minutes', 'occupancy-plan');?>">?</span> 324 325 </div> 325 326 <div class="op-admin-form-col-4"> -
occupancy-plan/trunk/occupancy-plan.php
r3398617 r3414331 16 16 * Plugin URI: https://www.software-kunze.de/plugins/occupancy-plan/ 17 17 * Description: Management of Occupancy Plans 18 * Version: 1.4.1 318 * Version: 1.4.14 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 3');38 define('Occupancy_Plan', '1.4.14'); 39 39 40 40 /** -
occupancy-plan/trunk/public/class-occupancy-plan-public.php
r3398617 r3414331 393 393 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext, 394 394 'data' => $this->get_week_blocks($week, $starttime, $plan, $court_names, $courtID)); 395 }396 }397 }398 else399 {400 $currenttime = date_create_from_format('H:i:s', mysql2date('H:i:s', $plan->starttime));401 $endtime = date_create_from_format('H:i:s', mysql2date('H:i:s', $plan->endtime));402 403 $rows[] = array('time' => $currenttime->format(__('g:i a', 'occupancy-plan')),404 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext,405 'data' => $this->get_week_blocks($week, $currenttime, $plan, $court_names, $courtID));406 407 while ($currenttime < $endtime)408 {409 switch ($plan->timeinterval)410 {411 case 5:412 $currenttime->add(new DateInterval('PT05M'));413 break;414 case 10:415 $currenttime->add(new DateInterval('PT10M'));416 break;417 case 15:418 $currenttime->add(new DateInterval('PT15M'));419 break;420 case 20:421 $currenttime->add(new DateInterval('PT20M'));422 break;423 case 30:424 $currenttime->add(new DateInterval('PT30M'));425 break;426 case 45:427 $currenttime->add(new DateInterval('PT45M'));428 break;429 case 60:430 $currenttime->add(new DateInterval('PT60M'));431 break;432 case 90:433 $currenttime->add(new DateInterval('PT90M'));434 break;435 default:436 $currenttime->add(new DateInterval('PT60M'));437 break;438 }439 440 if ($currenttime < $endtime)441 {442 $rows[] = array('time' => $currenttime->format(__('g:i a', 'occupancy-plan')),443 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext,444 'data' => $this->get_week_blocks($week, $currenttime, $plan, $court_names, $courtID));445 }446 }447 }448 return $rows;449 }450 451 /**452 * Get the plan row elements for a specific day453 *454 * @since 1.0.0455 *456 * 1.0.9 - Court range457 * 1.1.2 - Break start/end time458 * 1.4 - Support of time slot display names459 */460 private function get_day_rows($singledate, $plan, $court_names, $courtID)461 {462 global $wpdb;463 $table_time_slot = "{$wpdb->prefix}occupancy_plan_time_slot";464 $timeslots = $wpdb->get_results("SELECT * FROM $table_time_slot WHERE planid = {$plan->id} ORDER BY starttime");465 466 if ((isset($plan->usetimeslots)) && ($plan->usetimeslots == 1) && (count($timeslots) > 0))467 {468 foreach ($timeslots as $timeslot)469 {470 if (isset($timeslot->displayname) && (strlen($timeslot->displayname) > 0))471 {472 $rows[] = array('time' => $starttime->displayname,473 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext,474 'data' => $this->get_day_blocks($singledate, $starttime, $plan, $court_names, $courtID));475 }476 else477 {478 $starttime = date_create_from_format('H:i:s', mysql2date('H:i:s', $timeslot->starttime));479 $endtime = date_create_from_format('H:i:s', mysql2date('H:i:s', $timeslot->endtime));480 481 $rows[] = array('time' => $starttime->format(__('g:i a', 'occupancy-plan')),482 'end' => $endtime->format(__('g:i a', 'occupancy-plan')),483 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext,484 'data' => $this->get_day_blocks($singledate, $starttime, $plan, $court_names, $courtID));485 395 } 486 396 } … … 529 439 530 440 $rows[] = array('time' => $currenttime->format(__('g:i a', 'occupancy-plan')), 441 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext, 442 'data' => $this->get_week_blocks($week, $currenttime, $plan, $court_names, $courtID)); 443 444 if ((isset($plan->breakbetween)) && ($plan->breakbetween > 0)) 445 { 446 $currenttime->add(new DateInterval('PT' . $plan->breakbetween . 'M')); 447 } 448 449 while ($currenttime < $endtime) 450 { 451 if (($currenttime >= $breakstarttime) && ($currenttime < $breakendtime)) 452 { 453 $currenttime = $breakendtime; 454 } 455 else 456 { 457 switch ($plan->timeinterval) 458 { 459 case 5: 460 $currenttime->add(new DateInterval('PT05M')); 461 break; 462 case 10: 463 $currenttime->add(new DateInterval('PT10M')); 464 break; 465 case 15: 466 $currenttime->add(new DateInterval('PT15M')); 467 break; 468 case 20: 469 $currenttime->add(new DateInterval('PT20M')); 470 break; 471 case 30: 472 $currenttime->add(new DateInterval('PT30M')); 473 break; 474 case 45: 475 $currenttime->add(new DateInterval('PT45M')); 476 break; 477 case 60: 478 $currenttime->add(new DateInterval('PT60M')); 479 break; 480 case 90: 481 $currenttime->add(new DateInterval('PT90M')); 482 break; 483 default: 484 $currenttime->add(new DateInterval('PT60M')); 485 break; 486 } 487 } 488 489 if ((isset($plan->breakbetween)) && ($plan->breakbetween > 0)) 490 { 491 $nexttime = clone $currenttime; 492 493 switch ($plan->timeinterval) 494 { 495 case 5: 496 $nexttime ->add(new DateInterval('PT05M')); 497 break; 498 case 10: 499 $nexttime ->add(new DateInterval('PT10M')); 500 break; 501 case 15: 502 $nexttime ->add(new DateInterval('PT15M')); 503 break; 504 case 20: 505 $nexttime ->add(new DateInterval('PT20M')); 506 break; 507 case 30: 508 $nexttime ->add(new DateInterval('PT30M')); 509 break; 510 case 45: 511 $nexttime ->add(new DateInterval('PT45M')); 512 break; 513 case 60: 514 $nexttime ->add(new DateInterval('PT60M')); 515 break; 516 case 90: 517 $nexttime ->add(new DateInterval('PT90M')); 518 break; 519 default: 520 $nexttime ->add(new DateInterval('PT60M')); 521 break; 522 } 523 524 if (($nexttime > $breakstarttime) && ($nexttime < $breakendtime)) 525 { 526 $nexttime = $breakstarttime; 527 } 528 529 if ($nexttime > $endtime) 530 { 531 $nexttime = $endtime; 532 } 533 } 534 if (($currenttime < $endtime) && 535 (($currenttime < $breakstarttime) || ($currenttime >= $breakendtime))) 536 { 537 $rows[] = array('time' => $currenttime->format(__('g:i a', 'occupancy-plan')), 538 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext, 539 'data' => $this->get_week_blocks($week, $currenttime, $plan, $court_names, $courtID)); 540 } 541 542 if ((isset($plan->breakbetween)) && ($plan->breakbetween > 0)) 543 { 544 $currenttime->add(new DateInterval('PT' . $plan->breakbetween . 'M')); 545 } 546 } 547 } 548 return $rows; 549 } 550 551 /** 552 * Get the plan row elements for a specific day 553 * 554 * @since 1.0.0 555 * 556 * 1.0.9 - Court range 557 * 1.1.2 - Break start/end time 558 * 1.4 - Support of time slot display names 559 */ 560 private function get_day_rows($singledate, $plan, $court_names, $courtID) 561 { 562 global $wpdb; 563 $table_time_slot = "{$wpdb->prefix}occupancy_plan_time_slot"; 564 $timeslots = $wpdb->get_results("SELECT * FROM $table_time_slot WHERE planid = {$plan->id} ORDER BY starttime"); 565 566 if ((isset($plan->usetimeslots)) && ($plan->usetimeslots == 1) && (count($timeslots) > 0)) 567 { 568 foreach ($timeslots as $timeslot) 569 { 570 if (isset($timeslot->displayname) && (strlen($timeslot->displayname) > 0)) 571 { 572 $rows[] = array('time' => $starttime->displayname, 573 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext, 574 'data' => $this->get_day_blocks($singledate, $starttime, $plan, $court_names, $courtID)); 575 } 576 else 577 { 578 $starttime = date_create_from_format('H:i:s', mysql2date('H:i:s', $timeslot->starttime)); 579 $endtime = date_create_from_format('H:i:s', mysql2date('H:i:s', $timeslot->endtime)); 580 581 $rows[] = array('time' => $starttime->format(__('g:i a', 'occupancy-plan')), 582 'end' => $endtime->format(__('g:i a', 'occupancy-plan')), 583 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext, 584 'data' => $this->get_day_blocks($singledate, $starttime, $plan, $court_names, $courtID)); 585 } 586 } 587 } 588 else 589 { 590 $currenttime = date_create_from_format('H:i:s', mysql2date('H:i:s', $plan->starttime)); 591 $endtime = date_create_from_format('H:i:s', mysql2date('H:i:s', $plan->endtime)); 592 $breakstarttime = date_create_from_format('H:i:s', mysql2date('H:i:s', $plan->breakstarttime)); 593 $breakendtime = date_create_from_format('H:i:s', mysql2date('H:i:s', $plan->breakendtime)); 594 595 if ((isset($plan->breakbetween)) && ($plan->breakbetween > 0)) 596 { 597 $nexttime = clone $currenttime; 598 switch ($plan->timeinterval) 599 { 600 case 5: 601 $nexttime ->add(new DateInterval('PT05M')); 602 break; 603 case 10: 604 $nexttime ->add(new DateInterval('PT10M')); 605 break; 606 case 15: 607 $nexttime ->add(new DateInterval('PT15M')); 608 break; 609 case 20: 610 $nexttime ->add(new DateInterval('PT20M')); 611 break; 612 case 30: 613 $nexttime ->add(new DateInterval('PT30M')); 614 break; 615 case 45: 616 $nexttime ->add(new DateInterval('PT45M')); 617 break; 618 case 60: 619 $nexttime ->add(new DateInterval('PT60M')); 620 break; 621 case 90: 622 $nexttime ->add(new DateInterval('PT90M')); 623 break; 624 default: 625 $nexttime ->add(new DateInterval('PT60M')); 626 break; 627 } 628 } 629 630 $rows[] = array('time' => $currenttime->format(__('g:i a', 'occupancy-plan')), 531 631 'next' => (isset($nexttime))? $nexttime->format(__('g:i a', 'occupancy-plan')) : null, 532 632 'halfhour' => $plan->halfhour, 'free' => $plan->bookabletext, … … 639 739 } 640 740 641 // error_log(print_r($rows, true));642 741 return $rows; 643 742 } -
occupancy-plan/trunk/readme.txt
r3398617 r3414331 4 4 Tags: Occupancy Plan, Belegungsplan, Booking, Buchungen, Hallenbelegung, Reservierung 5 5 Requires at least: 4.9 6 Tested up to: 6. 8.37 Stable tag: 1.4.1 36 Tested up to: 6.9 7 Stable tag: 1.4.14 8 8 Requires PHP: 5.2.4 9 9 License: GPLv2 or later … … 50 50 == Changelog == 51 51 52 = 1.4.14 = 53 * Support for break times also in the weekly view 54 * Tested with WordPress version 6.9 55 52 56 = 1.4.13 = 53 57 * Add of block priority … … 62 66 = 1.4.11 = 63 67 * Fix: Save correct interval value form backend booking 64 * Test with WordPress version 6.8.168 * Tested with WordPress version 6.8.1 65 69 66 70 = 1.4.10 = 67 71 * Fix: Correct backend session handling 68 * Test with WordPress version 6.7.172 * Tested with WordPress version 6.7.1 69 73 70 74 = 1.4.9 =
Note: See TracChangeset
for help on using the changeset viewer.