2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
17 function menu_item($label, $link)
19 $this->label = $label;
31 $this->title = $title;
32 $this->items = array();
35 function add_item($label, $link)
37 $item = new menu_item($label,$link);
38 array_push($this->items,$item);
50 function app_function($label,$link,$access='SA_OPEN')
52 $this->label = $label;
54 $this->access = $access;
65 function module($name,$icon = null)
69 $this->lappfunctions = array();
70 $this->rappfunctions = array();
73 function add_lapp_function($label,$link="",$access='SA_OPEN')
75 $appfunction = new app_function($label,$link,$access);
76 //array_push($this->lappfunctions,$appfunction);
77 $this->lappfunctions[] = $appfunction;
81 function add_rapp_function($label,$link="",$access='SA_OPEN')
83 $appfunction = new app_function($label,$link,$access);
84 //array_push($this->rappfunctions,$appfunction);
85 $this->rappfunctions[] = $appfunction;
100 function application($id, $name, $enabled=true)
104 $this->enabled = $enabled;
105 $this->modules = array();
108 function add_module($name, $icon = null)
110 $module = new module($name,$icon);
111 //array_push($this->modules,$module);
112 $this->modules[] = $module;
116 function add_lapp_function($level, $label,$link="",$access='SA_OPEN')
118 $this->modules[$level]->lappfunctions[] = new app_function($label, $link, $access);
121 function add_rapp_function($level, $label,$link="",$access='SA_OPEN')
123 $this->modules[$level]->rappfunctions[] = new app_function($label, $link, $access);
126 function add_extensions()
128 global $installed_extensions, $path_to_root;
130 foreach ($installed_extensions as $mod)
132 if (@$mod['active'] && isset($mod['entries']))
133 foreach($mod['entries'] as $entry) {
134 if ($entry['tab_id'] == $this->id)
135 $this->add_rapp_function(
136 isset($entry['section']) ? $entry['section'] : 2,
137 $entry['title'], $path_to_root.'/'.$mod['path'].'/'.$entry['url'],
138 isset($entry["access"]) ? $entry["access"] : 'SA_OPEN' );
143 // Helper returning link to report class added by extension module.
145 function report_class_url($class)
147 global $installed_extensions;
149 // TODO : konwencja lub ?
151 // if (file_exists($path_to_root.'/'.$mod['path'].'/'.$entry['url']
152 // .'/'.'reporting/reports_custom.php'))
153 return "reporting/reports_main.php?Class=".$class;