]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Administration/index.php
Release 6.5.0
[Github/sugarcrm.git] / modules / Administration / index.php
1 <?php
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-2012 SugarCRM Inc.
6  * 
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.
13  * 
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
17  * details.
18  * 
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
22  * 02110-1301 USA.
23  * 
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.
26  * 
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.
30  * 
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  ********************************************************************************/
37
38 /*********************************************************************************
39
40  * Description: TODO:  To be written.
41  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42  * All Rights Reserved.
43  * Contributor(s): ______________________________________..
44  ********************************************************************************/
45
46 global $currentModule;
47 global $current_language;
48 global $current_user;
49 global $sugar_flavor;
50
51
52 if (!is_admin($current_user) && !is_admin_for_any_module($current_user))
53 {
54    sugar_die("Unauthorized access to administration.");
55 }
56
57 echo getClassicModuleTitle(translate('LBL_MODULE_NAME','Administration'),
58                       array(translate('LBL_MODULE_NAME','Administration')), false);
59
60 //get the module links..
61 require('modules/Administration/metadata/adminpaneldefs.php');
62 global $admin_group_header;  ///variable defined in the file above.
63
64
65 $tab = array();
66 $header_image = array();
67 $url = array();
68 $onclick = array();
69 $label_tab = array();
70 $id_tab = array();
71 $description = array();
72 $group = array();
73 $sugar_smarty = new Sugar_Smarty();
74 $values_3_tab = array();
75 $admin_group_header_tab = array();
76 $j=0;
77
78 foreach ($admin_group_header as $key=>$values) {
79     $module_index = array_keys($values[3]);
80     $addedHeaderGroups = array();
81     foreach ($module_index as $mod_key=>$mod_val) {
82         if(
83         (!isset($addedHeaderGroups[$values[0]]))) {
84             $admin_group_header_tab[]=$values;
85             $group_header_value=get_form_header(translate($values[0],'Administration'),$values[1],$values[2]);
86                 $group[$j][0] = '<table cellpadding="0" cellspacing="0" width="100%" class="h3Row"><tr ><td width="20%" valign="bottom"><h3>' . translate($values[0]) . '</h3></td></tr>';
87                 $addedHeaderGroups[$values[0]] = 1;
88                 if (isset($values[4]))
89                $group[$j][1] = '<tr><td style="padding-top: 3px; padding-bottom: 5px;">' . translate($values[4]) . '</td></tr></table>';
90             else
91                $group[$j][2] = '</tr></table>';
92             $colnum=0;
93             $i=0;
94             $fix = array_keys($values[3]);
95             if(count($values[3])>1){
96
97                 //////////////////
98                 $tmp_array = $values[3];
99                 $return_array = array();
100                 foreach ($tmp_array as $mod => $value){
101                     $keys = array_keys($value);
102                     foreach ($keys as $key){
103                         $return_array[$key] = $value[$key];
104                     }
105                 }
106                 $values_3_tab[]= $return_array;
107                 $mod = $return_array;
108             }
109            else {
110                 $mod = $values[3][$fix[0]];
111                 $values_3_tab[]= $mod;
112            }
113
114             foreach ($mod as $link_idx =>$admin_option) {
115                 if(!empty($GLOBALS['admin_access_control_links']) && in_array($link_idx, $GLOBALS['admin_access_control_links'])){
116                     continue;
117                 }
118                 $colnum+=1;
119                 $header_image[$j][$i]= SugarThemeRegistry::current()->getImage($admin_option[0],'border="0" align="absmiddle"',null,null,'.gif',translate($admin_option[1],'Administration'));
120                 $url[$j][$i] = $admin_option[3];
121                 if(!empty($admin_option[5])) {
122                         $onclick[$j][$i] = $admin_option[5];
123                 }
124                 $label = translate($admin_option[1],'Administration');
125                 if(!empty($admin_option['additional_label']))$label.= ' '. $admin_option['additional_label'];
126                 if(!empty($admin_option[4])){
127                         $label = ' <font color="red">'. $label . '</font>';
128                 }
129
130                 $label_tab[$j][$i]= $label;
131                 $id_tab[$j][$i] = $link_idx;
132                 
133                 $description[$j][$i]= translate($admin_option[2],'Administration');
134
135                 if (($colnum % 2) == 0) {
136                     $tab[$j][$i]= ($colnum % 2);
137                 }
138                 else {
139                     $tab[$j][$i]= 10;
140                 }
141                 $i+=1;
142             }
143
144                 //if the loop above ends with an odd entry add a blank column.
145                 if (($colnum % 2) != 0) {
146                     $tab[$j][$i]= 10;
147                 }
148         $j+=1;
149     }
150   }
151 }
152
153 $sugar_smarty->assign('MY_FRAME',"<iframe class='teamNoticeBox' title='http://www.sugarcrm.com/crm/product/gopro/admin' src='http://www.sugarcrm.com/crm/product/gopro/admin' width='100%' height='315px'></iframe>");
154 $sugar_smarty->assign("VALUES_3_TAB", $values_3_tab);
155 $sugar_smarty->assign("ADMIN_GROUP_HEADER", $admin_group_header_tab);
156 $sugar_smarty->assign("GROUP_HEADER", $group);
157 $sugar_smarty->assign("ITEM_HEADER_IMAGE", $header_image);
158 $sugar_smarty->assign("ITEM_URL", $url);
159 $sugar_smarty->assign("ITEM_ONCLICK", $onclick);
160 $sugar_smarty->assign("ITEM_HEADER_LABEL",$label_tab);
161 $sugar_smarty->assign("ITEM_DESCRIPTION", $description);
162 $sugar_smarty->assign("COLNUM", $tab);
163 $sugar_smarty->assign('ID_TAB', $id_tab);
164
165 echo $sugar_smarty->fetch('modules/Administration/index.tpl');
166 ?>