<?php

function mailBeezMenu()
{

    if (class_exists('MainFactory') && method_exists('MainFactory', 'create')) {

        /**
         * @var LanguageTextManager $languageTextManager
         */
        $languageTextManager = MainFactory::create('LanguageTextManager', 'admin_menu');
        $label = $languageTextManager->get_text('BOX_MAILBEEZ');
        $label = ($label == 'BOX_MAILBEEZ') ? 'MailBeez Email-Marketing' : $label;
        $menu = '<menuitem link="mailbeez.php" link_param="" sort="1" title="' . $label . '"/>';

        $label1 = $languageTextManager->get_text('BOX_MAILBEEZ_SHOPVOTING');
        $label1 = ($label1 == 'BOX_MAILBEEZ_SHOPVOTING') ? 'Shopbewertungen' : $label1;
        $menu .= '<menuitem link="mailbeez.php" link_param="module=config_shopvoting" title="' . $label1 . '" sort="10"/>';
    } else {
        global $txt;
        $label = (defined($txt.BOX_MAILBEEZ)) ? $txt.BOX_MAILBEEZ : 'MailBeez Automatisiertes Email-Marketing';
        $menu = '<menuitem link="mailbeez.php" link_param="" sort="1" title="' . $label . '"/>';

        $label1 = (defined($txt.MAILBEEZ_MENU_SHOPVOTING)) ? $txt.MAILBEEZ_MENU_SHOPVOTING : 'Shopbewertungen';
        $menu .= '<menuitem link="mailbeez.php" link_param="module=config_shopvoting" title="' . $label1 . '" sort="10"/>';
    }

    // issue: only one paramter possible
//    $menu .= '<menuitem link="mailbeez.php" link_param="module=config_shopvoting&w4d_popup=0" sort="10" title="' . $label1 . '"/>';

    return $menu;
    // todo
    // add dynamically menu items
    if (false) {
        return '<menuitem link="mailbeez.php"  link_param="tab=configbeez" title="Konfiguration" sort="10"/>';
    }
}
