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/SBogers59/ferrumbv.nl/wwwroot/lib/ui/submenu.class.php
<?php
/**
 * Created by PhpStorm.
 * User: mike
 * Date: 08/10/14
 * Time: 11:55
 */

class UI_Submenu
{
    // English name of the page
    private $_pageName;

    // Language array
    private $_lang;

    public function __construct($pageName)
    {
        $this->_pageName = $pageName;

        // Translate
        $Translator = new Translator(URL_LANG);
        $this->_lang = $Translator->get();
    }

    public function create($data)
    {
        $output = '';

        // Loop trough data
        foreach($data['entity'] as $entity)
        {
            if (! isset($entity['title'])) continue;

            // Build URL
            $urlTitle = Fn::encodeUrl($entity['title']);
            $url = SITE_ROOT . Fn::encodeUrl($this->_lang[$this->_pageName]);

            // Root ?
            $root = isset( $entity['@attributes']['root']);
            if( ! $root)
            {
                $url .= '/' . $urlTitle;
            }

            // Build output
            $output .= '<li';
            if( (defined('URL_SUB') && $urlTitle == URL_SUB) ||
                ( ! defined('URL_SUB') && $root))
                $output .= ' class="active"';
            $output .= '><a href="' . $url . '" data-id="' . $this->_pageName . '" data-rel="ajax" class="dynamic">' . $entity['title'] . '</a></li>';
        }

        $output .= '<li class="job_offers">
                        <a href="/vacatures" data-id="job_offers" data-rel="ajax" class="dynamic">
                            Vacatures';
                $output .= '<span class="count">1</span>';
            $output .= '</a>
                    </li>';

        return $output;
    }
}