<?php

include_once './pages/PageInterface.inc.php';

include_once './includes/database/MySQLDatabase.inc.php';

/**
 * This page represents the content of the footer line.
 *
 * @author Thomas Schwery <thomas.schwery@epfl.ch>
 */
class FooterPage implements PageInterface {

    private $title;

    private $content;

    public function __construct() {
        $this->title = "";

        $loginLabel = Localization::userLoginLink;

        $this->content = "<a href='./?page=Login'>$loginLabel</a>";
        $this->content.= " - Website by Thomas Schwery - ";

        if (array_key_exists("language", $_SESSION)) {
            $language = $_SESSION['language'];
        }
        /*
         * TODO: Correct the English Localization ...
        if ($language == "French") {
            $this->content.= "<a href='./?page=Index&amp;language=English>Switch to English</a>";
        } else {
            $this->content.= "<a href='./?page=Index&amp;language=French>Passer en Français</a>";
        }
        */
    }

    public function getContent() {
         if (key_exists('loggedin', $_SESSION) && $_SESSION['loggedin'] == true) {
            $time = (microtime(true) - $_SESSION['startTime']);
            $this->content .= " - " . MySQLDatabase::getInstance()->getCount() . " requêtes";
            $this->content .= " - " . $time . " ms.";
        }
        return $this->content;
    }

    public function getTitle() {
        return $this->title;
    }

    public static function getStaticTitle() {
        return "";
    }
}
?>
