<?php

include_once './includes/menu/MenuEntry.inc.php';

/**
 * This class allows for easy formatting of menu entries.
 *
 * @author Thomas Schwery <thomas.schwery@epfl.ch>
 */
class MenuEntryFormatter {

    public static function getEntry(MenuEntry $entry) {

        $name = $entry->getName();
        $hint = $entry->getHint();
        $url = $entry->getUrl();

        $hint = str_replace("'", "&#39;", $hint);


        return "<a href='./?page=$url' title='$hint'>$name</a>";
    }

    public static function getSummaryBox(MenuEntry $entry) {
        $name = $entry->getName();
        $hint = $entry->getHint();
        $url = $entry->getUrl();
        $menuId = $entry->getMenuId();
        $weight = $entry->getWeight();

        $content = "<div style='border: 1px dotted black;'>";
        $content.= Localization::menuEntryName . ": $name";
        $content.= "<br>\n";
        $content.= Localization::menuEntryHint . ": $hint";
        $content.= "<br>\n";
        $content.= Localization::menuEntryURL . ": $url";
        $content.= "<br>\n";
        $content.= Localization::menuEntryMenuId . ": $menuId";
        $content.= "<br>\n";
        $content.= Localization::menuEntryWeight . ": $weight";
        $content.= "</div>";

        return $content;
    }
}
?>
