<?php

include_once './modules/ModuleInterface.inc.php';

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

/**
 * This class represents the menu in itself.
 *
 * @author Thomas Schwery <thomas.schwery@epfl.ch>
 */
class MenuModule implements ModuleInterface {

    private $menuId;

    private $content;

    public function __construct($menuId) {
        $this->menuId = $menuId;
    }

    public function getContent() {
        $entries = MenuEntryLister::getAllFromMenu($this->menuId);

        $this->content.= "<div class='menu'>";
        foreach ($entries as $entry) {
            $this->content .= MenuEntryFormatter::getEntry($entry) . "\n";
        }
        $this->content.= "</div>\n";

        return $this->content;
    }

    public function getTitle() {
        return Localization::navigationMenu;
    }
}
?>
