]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Administration/index.php
Release 6.2.3
[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-2011 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 $label_tab = array();
69 $id_tab = array();
70 $description = array();
71 $group = array();
72 $sugar_smarty = new Sugar_Smarty();
73 $values_3_tab = array();
74 $admin_group_header_tab = array();
75 $j=0;
76
77 foreach ($admin_group_header as $key=>$values) {
78     $module_index = array_keys($values[3]);
79     $addedHeaderGroups = array();
80     foreach ($module_index as $mod_key=>$mod_val) {
81         if(
82         (!isset($addedHeaderGroups[$values[0]]))) {
83             $admin_group_header_tab[]=$values;
84             $group_header_value=get_form_header(translate($values[0],'Administration'),$values[1],$values[2]);
85                 $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>';
86                 $addedHeaderGroups[$values[0]] = 1;
87                 if (isset($values[4]))
88                $group[$j][1] = '<tr><td style="padding-top: 3px; padding-bottom: 5px;">' . translate($values[4]) . '</td></tr></table>';
89             else
90                $group[$j][2] = '</tr></table>';
91             $colnum=0;
92             $i=0;
93             $fix = array_keys($values[3]);
94             if(count($values[3])>1){
95
96                 //////////////////
97                 $tmp_array = $values[3];
98                 $return_array = array();
99                 foreach ($tmp_array as $mod => $value){
100                     $keys = array_keys($value);
101                     foreach ($keys as $key){
102                         $return_array[$key] = $value[$key];
103                     }
104                 }
105                 $values_3_tab[]= $return_array;
106                 $mod = $return_array;
107             }
108            else {
109                 $mod = $values[3][$fix[0]];
110                 $values_3_tab[]= $mod;
111            }
112
113             foreach ($mod as $link_idx =>$admin_option) {
114                 if(!empty($GLOBALS['admin_access_control_links']) && in_array($link_idx, $GLOBALS['admin_access_control_links'])){
115                     continue;
116                 }
117                 $colnum+=1;
118                 $header_image[$j][$i]= SugarThemeRegistry::current()->getImage($admin_option[0],'alt="' .  translate($admin_option[1],'Administration') .'" border="0" align="absmiddle"');
119                 $url[$j][$i] = $admin_option[3];
120                 $label = translate($admin_option[1],'Administration');
121                 if(!empty($admin_option['additional_label']))$label.= ' '. $admin_option['additional_label'];
122                 if(!empty($admin_option[4])){
123                         $label = ' <font color="red">'. $label . '</font>';
124                 }
125
126                 $label_tab[$j][$i]= $label;
127                 $id_tab[$j][$i] = $link_idx;
128                 
129                 $description[$j][$i]= translate($admin_option[2],'Administration');
130
131                 if (($colnum % 2) == 0) {
132                     $tab[$j][$i]= ($colnum % 2);
133                 }
134                 else {
135                     $tab[$j][$i]= 10;
136                 }
137                 $i+=1;
138             }
139
140                 //if the loop above ends with an odd entry add a blank column.
141                 if (($colnum % 2) != 0) {
142                     $tab[$j][$i]= 10;
143                 }
144         $j+=1;
145     }
146   }
147 }
148
149 $sugar_smarty->assign('MY_FRAME',"<iframe class='teamNoticeBox' src='http://www.sugarcrm.com/crm/product/gopro/admin' width='100%' height='315px'></iframe>");
150 $sugar_smarty->assign("VALUES_3_TAB", $values_3_tab);
151 $sugar_smarty->assign("ADMIN_GROUP_HEADER", $admin_group_header_tab);
152 $sugar_smarty->assign("GROUP_HEADER", $group);
153 $sugar_smarty->assign("ITEM_HEADER_IMAGE", $header_image);
154 $sugar_smarty->assign("ITEM_URL", $url);
155 $sugar_smarty->assign("ITEM_HEADER_LABEL",$label_tab);
156 $sugar_smarty->assign("ITEM_DESCRIPTION", $description);
157 $sugar_smarty->assign("COLNUM", $tab);
158 $sugar_smarty->assign('ID_TAB', $id_tab);
159
160 echo $sugar_smarty->fetch('modules/Administration/index.tpl');
161 ?>