controller.php
4 days ago
fieldcontrol.php
4 days ago
index.html
4 days ago
manager.php
4 days ago
toolbar.php
4 days ago
controller.php
79 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | VAPLoader::import('libraries.mvc.controllers.admin'); |
| 15 | |
| 16 | /** |
| 17 | * Employee area controller base class. |
| 18 | * |
| 19 | * @since 1.7 |
| 20 | */ |
| 21 | class VAPEmployeeAreaController extends VAPControllerAdmin |
| 22 | { |
| 23 | /** |
| 24 | * Constructor. |
| 25 | * |
| 26 | * @param array $config An optional associative array of configuration settings. |
| 27 | */ |
| 28 | public function __construct($config = array()) |
| 29 | { |
| 30 | // load administration language, since almost all the used texts are already defined |
| 31 | VikAppointments::loadLanguage(JFactory::getLanguage()->getTag(), JPATH_ADMINISTRATOR); |
| 32 | |
| 33 | // invoke parent |
| 34 | parent::__construct($config); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Set a URL for browser redirection. |
| 39 | * |
| 40 | * @param string $url URL to redirect to. |
| 41 | * @param string $msg Message to display on redirect. Optional, defaults to value set internally by controller, if any. |
| 42 | * @param string $type Message type. Optional, defaults to 'message' or the type set by a previous call to setMessage. |
| 43 | * |
| 44 | * @return static This object to support chaining. |
| 45 | */ |
| 46 | public function setRedirect($url, $msg = null, $type = null) |
| 47 | { |
| 48 | // check whether the specified URL starts with "index.php" |
| 49 | if (preg_match("/^index\.php/", $url)) |
| 50 | { |
| 51 | // extract selected menu item from request |
| 52 | $itemid = JFactory::getApplication()->input->getUint('Itemid'); |
| 53 | |
| 54 | if ($itemid) |
| 55 | { |
| 56 | if (preg_match("/\?/", $url)) |
| 57 | { |
| 58 | // append to query string |
| 59 | $url .= '&'; |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | // create query string |
| 64 | $url .= '?'; |
| 65 | } |
| 66 | |
| 67 | // preserve menu item |
| 68 | $url .= 'Itemid=' . $itemid; |
| 69 | } |
| 70 | |
| 71 | // finally rewrite the URL |
| 72 | $url = JRoute::rewrite($url, false); |
| 73 | } |
| 74 | |
| 75 | // invoke parent set the URL correctly |
| 76 | return parent::setRedirect($url, $msg, $type); |
| 77 | } |
| 78 | } |
| 79 |