HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/tops.komma.pro/wwwroot/lib/general/submenu_tracker.class.php
<?php
/**
 * page_tracker.class.php
 * Created by Komma Mediadesign.
 * Author: mike
 * Date: 13/02/14
 */

class Submenu_Tracker
{
    /*
     * What file should open in the submenu
     */
    private $_file = '';

    public function __construct()
    {
        // Make sure session exists
        if( ! isset($_SESSION['submenu_last'])) $_SESSION['submenu_last'] = '';
    }

    /*
     * Check if the submenu was open at the last page
     */
    public function getClass()
    {
        $classOutput = '';
        if( ! empty($_SESSION['submenu_last']))
        {
            // Start with open submenu
            $classOutput = ' class="open_submenu"';

            // Load old file in submenu
            $this->_file = $_SESSION['submenu_last'];
        }
        return $classOutput;
    }

    /*
     * Check if the submenu should be opened at the new page
     */
    public function checkNew()
    {
        // Pages width submenu
        $pages = array('filters','uses','certificates');

        // Get key of current page
        $Translator = new Translator(URL_LANG);
        $key = $Translator->getPageKey(URL_PAGE);

        // Check if submenu is needed
        if(in_array($key,$pages))
        {
            // Load new file in the submenu
            $this->_file = $_SESSION['submenu_last'] = $key;
            return true;
        }
        else
        {
            $_SESSION['submenu_last'] = '';
        }
        return false;
    }

    /*
     * What file should load in the submenu
     */
    public function getFile()
    {
        return $this->_file;
    }
}