1: <?php
2:
3: namespace ModHelper;
4:
5: 6: 7: 8:
9: abstract class Menu
10: {
11: protected $options;
12: protected $areas;
13: private $id;
14: private $title;
15:
16: public function execute()
17: {
18: global $sourcedir;
19:
20: foreach ($this->options as $item) {
21: $options[] = $item;
22: }
23: foreach ($this->areas as $item) {
24: $areas[] = $item;
25: }
26:
27: require_once($sourcedir . '/Subs-Menu.php');
28: return createMenu(array(
29: $this->id => array(
30: 'title' => $this->title,
31: 'areas' => $areas
32: )), $options);
33: }
34:
35: 36: 37: 38: 39: 40:
41: public function addArea($id, $area)
42: {
43: $this->areas->addValue([$id => $areas]);
44: }
45:
46: 47: 48: 49: 50: 51:
52: public function addOption($id, $val)
53: {
54: $this->options->addValue([$id => $val]);
55: }
56:
57: public function __construct($id, $title)
58: {
59: $this->id = $id;
60: $this->title = $title;
61: $this->options = new Collection();
62: $this->areas = new Collection();
63: }
64:
65: }
66: