2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 $sm = sm_build_array();
39 $sm_smarty = new Sugar_Smarty();
42 if(isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '')
44 $current_language = $_SESSION['authenticated_user_language'];
48 $current_language = $sugar_config['default_language'];
51 $mod_strings = return_module_language($current_language, 'Home');
52 $sm_smarty->assign('CLOSE', isset($mod_strings['LBL_CLOSE_SITEMAP']) ? $mod_strings['LBL_CLOSE_SITEMAP'] : '');
54 // get the list_strings in order for module friendly name display.
55 $app_list_strings = return_app_list_strings_language($current_language);
57 foreach ($sm as $mod_dir_name => $links)
59 $module_friendly_name = $app_list_strings['moduleList'][$mod_dir_name];
61 $temphtml .= '<h4><a href="javascript:window.location=\'index.php?module='.$mod_dir_name.'&action=index\'">' . $module_friendly_name .'</a></h4><ul class=\'noBullet\'>';
63 foreach ($links as $name => $href)
65 $temphtml .= '<li class=\'noBullet\'><a href="javascript:window.location=\''. $href .'\'">' . $name . ' ' . '</a></li>';
69 $sm_smarty->assign(strtoupper($mod_dir_name), $temphtml);
72 // Specify the sitemap template to use; allow developers to override this with a custom one to add/remove modules
74 $tpl = 'modules/Home/sitemap.tpl';
75 if ( sugar_is_file('custom/modules/Home/sitemap.tpl') ) {
76 $tpl = 'custom/modules/Home/sitemap.tpl';
78 echo $sm_smarty->fetch($tpl);
80 function sm_build_array()
82 //if the sitemap array is already stored, then pass it back
83 if (isset($_SESSION['SM_ARRAY']) && !empty($_SESSION['SM_ARRAY'])){
84 return $_SESSION['SM_ARRAY'];
88 include("include/modules.php");
89 global $sugar_config,$mod_strings;
92 // Need to set up mod_strings when we iterate through module menus.
93 $orig_modstrings = array();
94 if(!empty($mod_strings))
96 $orig_modstrings = $mod_strings;
98 if(isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '')
100 $current_language = $_SESSION['authenticated_user_language'];
104 $current_language = $sugar_config['default_language'];
106 $exclude= array(); // in case you want to exclude any.
107 $mstr_array = array();
109 global $modListHeader;
110 if(!isset($modListHeader))
112 global $current_user;
113 if(isset($current_user))
115 $modListHeader = query_module_access_list($current_user);
119 foreach($modListHeader as $key=>$val)
121 if(!empty($exclusion_array) && in_array($val,$exclude ))
127 if (file_exists('modules/'.$val.'/Menu.php'))
129 $mod_strings = return_module_language($current_language, $val);
130 $module_menu = array();
131 include('modules/'.$val.'/Menu.php');
133 $tmp_menu_items = array();
134 foreach($module_menu as $menu)
136 if(isset($menu[0]) && !empty($menu[0]) && isset($menu[1]) && !empty($menu[1]) && trim($menu[0]) !='#')
138 $tmp_menu_items[$menu[1]] =$menu[0];
141 $mstr_array[$val] = $tmp_menu_items;
146 //reset the modstrings to current module
147 $mod_strings = $orig_modstrings ;
148 //store master array into session variable
149 $_SESSION['SM_ARRAY'] = $mstr_array;