Added chart packages installation.
[fa-stable.git] / applications / application.php
index a4c6a6a879226334f66f4c2354bcdefa6c59e632..291a78a256ec9a418d252eb085f9e330df791c06 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 /**********************************************************************
     Copyright (C) FrontAccounting, LLC.
-       Released under the terms of the GNU Affero General Public License,
-       AGPL, as published by the Free Software Foundation, either version 
-       of the License, or (at your option) any later version.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-    See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
        class menu_item 
        {
@@ -47,7 +47,7 @@
                var $link;
                var $access;
                
-               function app_function($label,$link,$access=1
+               function app_function($label,$link,$access='SA_OPEN'
                {
                        $this->label = $label;
                        $this->link = $link;
@@ -70,7 +70,7 @@
                        $this->rappfunctions = array();
                }
                
-               function add_lapp_function($label,$link="",$access=1
+               function add_lapp_function($label,$link="",$access='SA_OPEN'
                {
                        $appfunction = new app_function($label,$link,$access);
                        //array_push($this->lappfunctions,$appfunction);
@@ -78,7 +78,7 @@
                        return $appfunction;
                }
 
-               function add_rapp_function($label,$link="",$access=1
+               function add_rapp_function($label,$link="",$access='SA_OPEN'
                {
                        $appfunction = new app_function($label,$link,$access);
                        //array_push($this->rappfunctions,$appfunction);
@@ -93,6 +93,7 @@
        {
                var $id;
                var $name;
+               var $help_context;
                var $modules;
                var $enabled;
                
                {
                        $this->id = $id;
                        $this->name = $name;
-                       $this->enables = $enabled;
+                       $this->enabled = $enabled;
                        $this->modules = array();
                }
                
                        return $module;
                }
                
-               function add_lapp_function($level, $label,$link="",$access=1
+               function add_lapp_function($level, $label,$link="",$access='SA_OPEN'
                {
                        $this->modules[$level]->lappfunctions[] = new app_function($label, $link, $access);
-               }       
-                       
-               function add_rapp_function($level, $label,$link="",$access=1
+               }
+               
+               function add_rapp_function($level, $label,$link="",$access='SA_OPEN'
                {
                        $this->modules[$level]->rappfunctions[] = new app_function($label, $link, $access);
-               }       
+               }
+               
+               function add_extensions()
+               {
+                       global $installed_extensions, $path_to_root;
+
+                       foreach ($installed_extensions as $mod)
+                       {
+                               if (@$mod['active'] && isset($mod['entries']))
+                                       foreach($mod['entries'] as $entry) {
+                                               if ($entry['tab_id'] == $this->id)
+                                                       $this->add_rapp_function(
+                                                               isset($entry['section']) ? $entry['section'] : 2,
+                                                               $entry['title'], $path_to_root.'/'.$mod['path'].'/'.$entry['url'],
+                                                               isset($entry["access"]) ? $entry["access"] : 'SA_OPEN' );
+                                       }
+                       }
+               }
+               //
+               // Helper returning link to report class added by extension module.
+               //
+               function report_class_url($class)
+               {
+                       global $installed_extensions;
+
+                       // TODO : konwencja lub ?
+                       $classno = 7;
+//                     if (file_exists($path_to_root.'/'.$mod['path'].'/'.$entry['url']
+//                                     .'/'.'reporting/reports_custom.php'))
+                               return "reporting/reports_main.php?Class=".$class;
+//                     else
+//                             return '';
+               }
        }