Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("$prefix/utils/Elements.php");
- class UserSidebar {
- private $_userSidebar;
- function UserSidebar($prefix) {
- if (isset($_SESSION['user_id'])) {
- $box = new Box();
- $userMenu = new Menu();
- $welcomeVoice = new MenuVoice();
- if (isset($_SESSION['user_name'])) {
- $welcomeVoice->add(new Dummy("Benvenuto " . $_SESSION['user_name']));
- }
- else {
- $welcomeVoice->add(new Dummy("Benvenuto " . $_SESSION['user_mail']));
- }
- $anagraficaVoice = new MenuVoice();
- $anagraficaVoice->add(new Link("$prefix/users/anagrafica.php", "Anagrafica"));
- $interventiVoice = new MenuVoice();
- $interventiVoice->add(new Link("$prefix/users/interventi_new.php", "Nuovo intervento"));
- $interventiStoricoVoice = new MenuVoice();
- $interventiStoricoVoice->add(new Link("$prefix/users/interventi_storico.php", "Storico interventi"));
- $logoutVoice = new MenuVoice();
- $logoutVoice->add(new Link("$prefix/logout.php", "Logout"));
- $userMenu->addVoice($welcomeVoice);
- $userMenu->addVoice($anagraficaVoice);
- $userMenu->addVoice($interventiVoice);
- $userMenu->addVoice($interventiStoricoVoice);
- $userMenu->addVoice($logoutVoice);
- $box->add($userMenu);
- $this->_userSidebar = $box;
- }
- else {
- $box = new Box();
- $box->addStyle("text-align", "center");
- $loginTitle = new Title("Login", "3");
- $loginTitle->addStyle("text-align", "left");
- $menu = new Menu();
- $menu->addClass("list");
- $userDiv = new Div();
- $userDiv->add(new Dummy('<input name="username" id="username" type="text" />'));
- $passDiv = new Div();
- $passDiv->add(new Dummy('<input name="password" id="password" type="password" />'));
- $fakePasswordDiv = new Div();
- $fakePasswordDiv->add(new Dummy('<input id="fakepassword" type="text" />'));
- $submitDiv = new Div();
- $submitDiv->add(new Dummy('<input type="submit" value="Entra" id="login_submit" />'));
- $menuVoice = new MenuVoice();
- $menuVoice->add($userDiv);
- $menuVoice->add($passDiv);
- $menuVoice->add($fakePasswordDiv);
- $menuVoice->add($submitDiv);
- $menu->add($menuVoice);
- $box->add($loginTitle);
- $box->add($menu);
- $this->_userSidebar = $box;
- }
- }
- public function html() {
- return $this->_userSidebar->html();
- }
- public function show() {
- echo $this->html();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement