| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package VikBooking |
| 4 | 4 | * @subpackage com_vikbooking |
| 5 | - * @author Alessio Gaggii - e4j - Extensionsforjoomla.com | |
| 6 | - * @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. | |
| 5 | + * @author Alessio Gaggii - E4J srl | |
| 6 | + * @copyright Copyright (C) 2025 E4J srl. All rights reserved. | |
| 7 | 7 | * @license GNU General Public License version 2 or later; see LICENSE |
| 8 | 8 | * @link https://vikwp.com |
| 9 | 9 | */ |
| 10 | 10 | |
| @@ -32,19 +32,38 @@ | ||
| 32 | 32 | $document->addStyleSheet(VCM_ADMIN_URI.'assets/css/vcm-channels.css'); |
| 33 | 33 | } |
| 34 | 34 | $session = JFactory::getSession(); |
| 35 | 35 | $cookie = JFactory::getApplication()->input->cookie; |
| 36 | - $pmonth = VikRequest::getString('month', '', 'request'); | |
| 37 | - $pmnum = VikRequest::getInt('mnum', '', 'request'); | |
| 36 | + $pmonth = VikRequest::getInt('month', 0, 'request'); | |
| 37 | + $pmnum = VikRequest::getInt('mnum', 0, 'request'); | |
| 38 | 38 | $cmnum = $cookie->get('vbOvwMnum', '', 'string'); |
| 39 | 39 | $punits_show_type = VikRequest::getString('units_show_type', '', 'request'); |
| 40 | + | |
| 40 | 41 | // category filter |
| 41 | 42 | $pcategory_id = VikRequest::getString('category_id', '', 'request'); |
| 42 | 43 | $scategory_id = $session->get('vbOvwCatid', 0); |
| 43 | 44 | $pcategory_id = !strlen($pcategory_id) && !empty($scategory_id) ? $scategory_id : $pcategory_id; |
| 44 | 45 | $session->set('vbOvwCatid', $pcategory_id); |
| 45 | - // | |
| 46 | - | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * Apply task manager filters. | |
| 49 | + * | |
| 50 | + * @since 1.18.0 (J) - 1.8.0 (WP) | |
| 51 | + */ | |
| 52 | + $tmfilters = (array) $app->input->get('tmfilters', [], 'array'); | |
| 53 | + if (empty($pmonth)) { | |
| 54 | + // overwrite the first month to display | |
| 55 | + if (($tmfilters['dates'] ?? '') && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}\s?:\s?[0-9]{4}-[0-9]{2}-[0-9]{2}$/', (string) $tmfilters['dates'])) { | |
| 56 | + // custom range of dates filter will overwrite the current month to display | |
| 57 | + $dparts = explode(':', $tmfilters['dates']); | |
| 58 | + $begin_ts = strtotime(trim($dparts[0])); | |
| 59 | + $pmonth = strtotime(date('Y-m-01', $begin_ts)); | |
| 60 | + } elseif (($tmfilters['calendar_month'] ?? '') && preg_match('/01$/', (string) $tmfilters['calendar_month'])) { | |
| 61 | + // overwrite the current month to display | |
| 62 | + $pmonth = strtotime($tmfilters['calendar_month']) ?: $pmonth; | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 47 | 66 | $pbmode = VikRequest::getString('bmode', '', 'request'); |
| 48 | 67 | if (!empty($pbmode) && ($pbmode == 'classic' || $pbmode == 'tags')) { |
| 49 | 68 | VikRequest::setCookie('vbTagsMode', $pbmode, (time() + (86400 * 365)), '/'); |
| 50 | 69 | $session->set('vbTagsMode', $pbmode); |
| @@ -52,9 +71,9 @@ | ||
| 52 | 71 | $cbmode = $cookie->get('vbTagsMode', '', 'string'); |
| 53 | 72 | $pbmode = (!empty($cbmode) && ($cbmode == 'classic' || $cbmode == 'tags') ? $cbmode : 'classic'); |
| 54 | 73 | VikRequest::setCookie('vbTagsMode', $pbmode, (time() + (86400 * 365)), '/'); |
| 55 | 74 | $session->set('vbTagsMode', $pbmode); |
| 56 | - } | |
| 75 | + } | |
| 57 | 76 | |
| 58 | 77 | if (!empty($punits_show_type)) { |
| 59 | 78 | $session->set('vbUnitsShowType', $punits_show_type); |
| 60 | 79 | } |