1 | 2 | simandl | <?php |
2 | | | |
3 | | | namespace FreenetRouter\Controllers; |
4 | | | |
5 | | | use FreenetRouter\Models\UI\MenuEntry; |
6 | | | use Phem\Controllers\SimpleViewController; |
7 | | | use Phem\Core\Collection; |
8 | | | use Phem\Environment\EnvironmentManager; |
9 | | | |
10 | | | /** |
11 | | | * @author Jakub PetrĹžĂlka <petrzilka@czweb.net> |
12 | | | */ |
13 | | | abstract class Controller extends SimpleViewController |
14 | | | { |
15 | | | public function __construct() |
16 | | | { |
17 | | | parent::__construct(); |
18 | | | |
19 | | | $this->getModel()->put("osVersion", "Freenet Router 3.1"); |
20 | | | $this->getModel()->put("routerName", "TestAP"); |
21 | | | $this->getModel()->put("projectLink", |
22 | | | "https://bbb.nfx.cz/projects/freenet-router"); |
23 | | | |
24 | | | $loggedUser = EnvironmentManager::getSession()->getVar("loggedUser"); |
25 | | | if ($loggedUser !== null) |
26 | | | { |
27 | | | $this->getModel()->put("loggedUser", $loggedUser); |
28 | | | $this->getModel()->put("login", true); |
29 | | | } |
30 | | | |
31 | | | $this->getModel()->put("mainMenu", $this->populateMainMenu()); |
32 | | | $this->getModel()->put("lb", EnvironmentManager::getLinkBuilder()); |
33 | | | } |
34 | | | |
35 | | | private function populateMainMenu() |
36 | | | { |
37 | | | $menu = new Collection(); |
38 | | | $menu->add(new MenuEntry("Others","showPage","ostatnĂ")); |
39 | | | $menu->add(new MenuEntry("Logs","showPage","logy")); |
40 | | | $menu->add(new MenuEntry("Graphs","showPage","grafy")); |
41 | | | $menu->add(new MenuEntry("Quagga","showPage","quagga")); |
42 | | | $menu->add(new MenuEntry("Macguard","showPage","macguard")); |
43 | | | $menu->add(new MenuEntry("Firewall","showPage","firewall")); |
44 | | | $menu->add(new MenuEntry("Monitoring","showPage","monitoring")); |
45 | | | $menu->add(new MenuEntry("Networking","showPage","nastavenĂ sĂtÄ")); |
46 | | | return $menu; |
47 | | | } |
48 | | | } |