Some additional access keys.
[fa-stable.git] / applications / application.php
1 <?php
2
3         class menu_item 
4         {
5                 var $label;
6                 var $link;
7                 
8                 function menu_item($label, $link) 
9                 {
10                         $this->label = $label;
11                         $this->link = $link;
12                 }
13         }
14
15         class menu 
16         {
17                 var $title;
18                 var $items;
19                 
20                 function menu($title) 
21                 {
22                         $this->title = $title;
23                         $this->items = array();
24                 }
25                 
26                 function add_item($label, $link) 
27                 {
28                         $item = new menu_item($label,$link);
29                         array_push($this->items,$item);
30                         return $item;
31                 }
32                 
33         }
34
35         class app_function 
36         {
37                 var $label;
38                 var $link;
39                 var $access;
40                 
41                 function app_function($label,$link,$access=1) 
42                 {
43                         $this->label = $label;
44                         $this->link = $link;
45                         $this->access = $access;
46                 }
47         }
48
49         class module 
50         {
51                 var $name;
52                 var $icon;
53                 var $lappfunctions;
54                 var $rappfunctions;
55                 
56                 function module($name,$icon = null) 
57                 {
58                         $this->name = $name;
59                         $this->icon = $icon;
60                         $this->lappfunctions = array();
61                         $this->rappfunctions = array();
62                 }
63                 
64                 function add_lapp_function($label,$link="",$access=1) 
65                 {
66                         $appfunction = new app_function($label,$link,$access);
67                         //array_push($this->lappfunctions,$appfunction);
68                         $this->lappfunctions[] = $appfunction;
69                         return $appfunction;
70                 }
71
72                 function add_rapp_function($label,$link="",$access=1) 
73                 {
74                         $appfunction = new app_function($label,$link,$access);
75                         //array_push($this->rappfunctions,$appfunction);
76                         $this->rappfunctions[] = $appfunction;
77                         return $appfunction;
78                 }
79                 
80                 
81         }
82
83         class application 
84         {
85                 var $id;
86                 var $name;
87                 var $modules;
88                 var $enabled;
89                 
90                 function application($id, $name, $enabled=true) 
91                 {
92                         $this->id = $id;
93                         $this->name = $name;
94                         $this->enables = $enabled;
95                         $this->modules = array();
96                 }
97                 
98                 function add_module($name, $icon = null) 
99                 {
100                         $module = new module($name,$icon);
101                         //array_push($this->modules,$module);
102                         $this->modules[] = $module;
103                         return $module;
104                 }
105                 
106                 function add_lapp_function($level, $label,$link="",$access=1) 
107                 {
108                         $this->modules[$level]->lappfunctions[] = new app_function($label, $link, $access);
109                 }       
110                         
111                 function add_rapp_function($level, $label,$link="",$access=1) 
112                 {
113                         $this->modules[$level]->rappfunctions[] = new app_function($label, $link, $access);
114                 }       
115         }
116
117
118 ?>