@@ -43,7 +43,7 @@ |
||
43 | 43 | * To change the template for this generated file go to |
44 | 44 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
45 | 45 | */ |
46 | - //format '<action_name>' => '<view_name>' |
|
46 | + //format '<action_name>' => '<view_name>' |
|
47 | 47 | $action_view_map['multieditview']= 'multiedit'; |
48 | 48 | $action_view_map['detailview']= 'detail'; |
49 | 49 | $action_view_map['editview']= 'edit'; |
@@ -44,21 +44,21 @@ |
||
44 | 44 | * Window - Preferences - PHPeclipse - PHP - Code Templates |
45 | 45 | */ |
46 | 46 | //format '<action_name>' => '<view_name>' |
47 | -$action_view_map['multieditview']= 'multiedit'; |
|
48 | -$action_view_map['detailview']= 'detail'; |
|
49 | -$action_view_map['editview']= 'edit'; |
|
50 | -$action_view_map['listview']= 'list'; |
|
51 | -$action_view_map['popup']= 'popup'; |
|
52 | -$action_view_map['vcard']= 'vcard'; |
|
53 | -$action_view_map['importvcard']= 'importvcard'; |
|
54 | -$action_view_map['importvcardsave']= 'importvcardsave'; |
|
55 | -$action_view_map['modulelistmenu']= 'modulelistmenu'; |
|
56 | -$action_view_map['favorites']= 'favorites'; |
|
57 | -$action_view_map['ajaxui']= 'ajaxui'; |
|
58 | -$action_view_map['noaccess']= 'noaccess'; |
|
47 | +$action_view_map['multieditview'] = 'multiedit'; |
|
48 | +$action_view_map['detailview'] = 'detail'; |
|
49 | +$action_view_map['editview'] = 'edit'; |
|
50 | +$action_view_map['listview'] = 'list'; |
|
51 | +$action_view_map['popup'] = 'popup'; |
|
52 | +$action_view_map['vcard'] = 'vcard'; |
|
53 | +$action_view_map['importvcard'] = 'importvcard'; |
|
54 | +$action_view_map['importvcardsave'] = 'importvcardsave'; |
|
55 | +$action_view_map['modulelistmenu'] = 'modulelistmenu'; |
|
56 | +$action_view_map['favorites'] = 'favorites'; |
|
57 | +$action_view_map['ajaxui'] = 'ajaxui'; |
|
58 | +$action_view_map['noaccess'] = 'noaccess'; |
|
59 | 59 | |
60 | 60 | // SugarPDF |
61 | -$action_view_map['sugarpdf']= 'sugarpdf'; |
|
61 | +$action_view_map['sugarpdf'] = 'sugarpdf'; |
|
62 | 62 | $action_view_map['dc'] = 'dc'; |
63 | 63 | $action_view_map['dcajax'] = 'dcajax'; |
64 | 64 | $action_view_map['quick'] = 'quick'; |
@@ -46,29 +46,29 @@ |
||
46 | 46 | * Contributor(s): ______________________________________.. |
47 | 47 | ********************************************************************************/ |
48 | 48 | $file_access_control_map = array( |
49 | - 'modules' => array( |
|
50 | - 'administration' => array( |
|
51 | - 'actions' => array( |
|
52 | - 'backups', |
|
53 | - 'updater', |
|
54 | - ), |
|
55 | - 'links' => array( |
|
56 | - 'update', |
|
57 | - 'backup_management', |
|
58 | - 'upgrade_wizard', |
|
59 | - 'moduleBuilder', |
|
60 | - ), |
|
61 | - ), |
|
62 | - 'upgradewizard' => array( |
|
63 | - 'actions' => array( |
|
64 | - 'index', |
|
65 | - ), |
|
66 | - ), |
|
67 | - 'modulebuilder' => array( |
|
68 | - 'actions' => array( |
|
69 | - 'index' => array('params' => array('type' => array('mb'))), |
|
70 | - ), |
|
71 | - ), |
|
72 | - ) |
|
49 | + 'modules' => array( |
|
50 | + 'administration' => array( |
|
51 | + 'actions' => array( |
|
52 | + 'backups', |
|
53 | + 'updater', |
|
54 | + ), |
|
55 | + 'links' => array( |
|
56 | + 'update', |
|
57 | + 'backup_management', |
|
58 | + 'upgrade_wizard', |
|
59 | + 'moduleBuilder', |
|
60 | + ), |
|
61 | + ), |
|
62 | + 'upgradewizard' => array( |
|
63 | + 'actions' => array( |
|
64 | + 'index', |
|
65 | + ), |
|
66 | + ), |
|
67 | + 'modulebuilder' => array( |
|
68 | + 'actions' => array( |
|
69 | + 'index' => array('params' => array('type' => array('mb'))), |
|
70 | + ), |
|
71 | + ), |
|
72 | + ) |
|
73 | 73 | ); |
74 | 74 | ?> |
75 | 75 | \ No newline at end of file |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | $yui_path = array( |
44 | 44 | "2.9.0" => "include/javascript/yui", |
45 | - "2_9_0" => "include/javascript/yui", |
|
46 | - "3.3.0" => "include/javascript/yui3", |
|
47 | - "3_3_0" => "include/javascript/yui3" |
|
45 | + "2_9_0" => "include/javascript/yui", |
|
46 | + "3.3.0" => "include/javascript/yui3", |
|
47 | + "3_3_0" => "include/javascript/yui3" |
|
48 | 48 | ); |
49 | 49 | $types = array( |
50 | 50 | "js" => "application/javascript", |
51 | - "css" => "text/css", |
|
51 | + "css" => "text/css", |
|
52 | 52 | ); |
53 | 53 | $out = ""; |
54 | 54 | |
@@ -57,36 +57,36 @@ discard block |
||
57 | 57 | |
58 | 58 | foreach ($_REQUEST as $param => $val) |
59 | 59 | { |
60 | - //No backtracking in the path |
|
61 | - if (strpos($param, "..") !== false) |
|
60 | + //No backtracking in the path |
|
61 | + if (strpos($param, "..") !== false) |
|
62 | 62 | continue; |
63 | 63 | |
64 | - $version = explode("/", $param); |
|
65 | - $version = $version[0]; |
|
64 | + $version = explode("/", $param); |
|
65 | + $version = $version[0]; |
|
66 | 66 | if (empty($yui_path[$version])) continue; |
67 | 67 | |
68 | 68 | $path = $yui_path[$version] . substr($param, strlen($version)); |
69 | 69 | |
70 | - $extension = substr($path, strrpos($path, "_") + 1); |
|
70 | + $extension = substr($path, strrpos($path, "_") + 1); |
|
71 | 71 | |
72 | - //Only allowed file extensions |
|
73 | - if (empty($types[$extension])) |
|
74 | - continue; |
|
72 | + //Only allowed file extensions |
|
73 | + if (empty($types[$extension])) |
|
74 | + continue; |
|
75 | 75 | |
76 | - if (empty($contentType)) |
|
76 | + if (empty($contentType)) |
|
77 | 77 | { |
78 | 78 | $contentType = $types[$extension]; |
79 | 79 | } |
80 | - //Put together the final filepath |
|
81 | - $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
82 | - $contents = ''; |
|
83 | - if (is_file($path)) { |
|
84 | - $out .= "/*" . $path . "*/\n"; |
|
85 | - $contents = file_get_contents($path); |
|
86 | - $out .= $contents . "\n"; |
|
87 | - } |
|
88 | - $path = empty($contents) ? $path : $contents; |
|
89 | - $allpath .= md5($path); |
|
80 | + //Put together the final filepath |
|
81 | + $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
82 | + $contents = ''; |
|
83 | + if (is_file($path)) { |
|
84 | + $out .= "/*" . $path . "*/\n"; |
|
85 | + $contents = file_get_contents($path); |
|
86 | + $out .= $contents . "\n"; |
|
87 | + } |
|
88 | + $path = empty($contents) ? $path : $contents; |
|
89 | + $allpath .= md5($path); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $etag = '"'.md5($allpath).'"'; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $version = $version[0]; |
66 | 66 | if (empty($yui_path[$version])) continue; |
67 | 67 | |
68 | - $path = $yui_path[$version] . substr($param, strlen($version)); |
|
68 | + $path = $yui_path[$version].substr($param, strlen($version)); |
|
69 | 69 | |
70 | 70 | $extension = substr($path, strrpos($path, "_") + 1); |
71 | 71 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $contentType = $types[$extension]; |
79 | 79 | } |
80 | 80 | //Put together the final filepath |
81 | - $path = substr($path, 0, strrpos($path, "_")) . "." . $extension; |
|
81 | + $path = substr($path, 0, strrpos($path, "_")).".".$extension; |
|
82 | 82 | $contents = ''; |
83 | 83 | if (is_file($path)) { |
84 | - $out .= "/*" . $path . "*/\n"; |
|
85 | - $contents = file_get_contents($path); |
|
86 | - $out .= $contents . "\n"; |
|
84 | + $out .= "/*".$path."*/\n"; |
|
85 | + $contents = file_get_contents($path); |
|
86 | + $out .= $contents."\n"; |
|
87 | 87 | } |
88 | 88 | $path = empty($contents) ? $path : $contents; |
89 | 89 | $allpath .= md5($path); |
@@ -95,6 +95,6 @@ discard block |
||
95 | 95 | header("Cache-Control: private"); |
96 | 96 | header("Pragma: dummy=bogus"); |
97 | 97 | header("Etag: $etag"); |
98 | -header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000)); |
|
98 | +header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000)); |
|
99 | 99 | header("Content-Type: $contentType"); |
100 | 100 | echo ($out); |
101 | 101 | \ No newline at end of file |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
39 | 41 | ********************************************************************************/ |
40 | 42 | |
41 | -if (empty($_REQUEST)) die(); |
|
43 | +if (empty($_REQUEST)) { |
|
44 | + die(); |
|
45 | +} |
|
42 | 46 | |
43 | 47 | $yui_path = array( |
44 | 48 | "2.9.0" => "include/javascript/yui", |
@@ -58,20 +62,24 @@ discard block |
||
58 | 62 | foreach ($_REQUEST as $param => $val) |
59 | 63 | { |
60 | 64 | //No backtracking in the path |
61 | - if (strpos($param, "..") !== false) |
|
62 | - continue; |
|
65 | + if (strpos($param, "..") !== false) { |
|
66 | + continue; |
|
67 | + } |
|
63 | 68 | |
64 | 69 | $version = explode("/", $param); |
65 | 70 | $version = $version[0]; |
66 | - if (empty($yui_path[$version])) continue; |
|
71 | + if (empty($yui_path[$version])) { |
|
72 | + continue; |
|
73 | + } |
|
67 | 74 | |
68 | 75 | $path = $yui_path[$version] . substr($param, strlen($version)); |
69 | 76 | |
70 | 77 | $extension = substr($path, strrpos($path, "_") + 1); |
71 | 78 | |
72 | 79 | //Only allowed file extensions |
73 | - if (empty($types[$extension])) |
|
74 | - continue; |
|
80 | + if (empty($types[$extension])) { |
|
81 | + continue; |
|
82 | + } |
|
75 | 83 | |
76 | 84 | if (empty($contentType)) |
77 | 85 | { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function setRefreshIcon() |
141 | 141 | { |
142 | - $additionalTitle = ''; |
|
142 | + $additionalTitle = ''; |
|
143 | 143 | if($this->isRefreshable) |
144 | 144 | |
145 | 145 | $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\'' |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | public function displayScript() |
166 | 166 | { |
167 | 167 | |
168 | - require_once('include/SugarCharts/SugarChartFactory.php'); |
|
169 | - $sugarChart = SugarChartFactory::getInstance(); |
|
170 | - return $sugarChart->getDashletScript($this->id); |
|
168 | + require_once('include/SugarCharts/SugarChartFactory.php'); |
|
169 | + $sugarChart = SugarChartFactory::getInstance(); |
|
170 | + return $sugarChart->getDashletScript($this->id); |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown); |
273 | 273 | |
274 | 274 | if($this->isAutoRefreshable()) { |
275 | - $this->getConfigureSmartyInstance()->assign('isRefreshable', true); |
|
276 | - $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); |
|
277 | - $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); |
|
278 | - $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh); |
|
279 | - } |
|
275 | + $this->getConfigureSmartyInstance()->assign('isRefreshable', true); |
|
276 | + $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); |
|
277 | + $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); |
|
278 | + $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh); |
|
279 | + } |
|
280 | 280 | |
281 | 281 | return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl); |
282 | 282 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $dashletOffset = 0; |
340 | 340 | $module = $_REQUEST['module']; |
341 | 341 | if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) { |
342 | - $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset']; |
|
342 | + $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset']; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -121,10 +123,12 @@ discard block |
||
121 | 123 | // load language files |
122 | 124 | $this->loadLanguage($classname, 'modules/Charts/Dashlets/'); |
123 | 125 | |
124 | - if ( empty($options['title']) ) |
|
125 | - $this->title = $this->dashletStrings['LBL_TITLE']; |
|
126 | - if ( isset($options['autoRefresh']) ) |
|
127 | - $this->autoRefresh = $options['autoRefresh']; |
|
126 | + if ( empty($options['title']) ) { |
|
127 | + $this->title = $this->dashletStrings['LBL_TITLE']; |
|
128 | + } |
|
129 | + if ( isset($options['autoRefresh']) ) { |
|
130 | + $this->autoRefresh = $options['autoRefresh']; |
|
131 | + } |
|
128 | 132 | |
129 | 133 | $this->layoutManager = new LayoutManager(); |
130 | 134 | $this->layoutManager->setAttribute('context', 'Report'); |
@@ -140,8 +144,8 @@ discard block |
||
140 | 144 | public function setRefreshIcon() |
141 | 145 | { |
142 | 146 | $additionalTitle = ''; |
143 | - if($this->isRefreshable) |
|
144 | - |
|
147 | + if($this->isRefreshable) { |
|
148 | + |
|
145 | 149 | $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\'' |
146 | 150 | . $this->id |
147 | 151 | . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->' |
@@ -154,6 +158,7 @@ discard block |
||
154 | 158 | translate('LBL_DASHLET_REFRESH', 'Home') |
155 | 159 | ) |
156 | 160 | . '</a>'; |
161 | + } |
|
157 | 162 | return $additionalTitle; |
158 | 163 | } |
159 | 164 | |
@@ -200,25 +205,32 @@ discard block |
||
200 | 205 | |
201 | 206 | $options = array(); |
202 | 207 | |
203 | - foreach($req as $name => $value) |
|
204 | - if(!is_array($value)) $req[$name] = trim($value); |
|
208 | + foreach($req as $name => $value) { |
|
209 | + if(!is_array($value)) $req[$name] = trim($value); |
|
210 | + } |
|
205 | 211 | |
206 | 212 | foreach($this->_searchFields as $name => $params) { |
207 | 213 | $widgetDef = $params; |
208 | - if ( isset($this->getSeedBean()->field_defs[$name]) ) |
|
209 | - $widgetDef = $this->getSeedBean()->field_defs[$name]; |
|
210 | - if ( $widgetDef['type'] == 'date') // special case date types |
|
214 | + if ( isset($this->getSeedBean()->field_defs[$name]) ) { |
|
215 | + $widgetDef = $this->getSeedBean()->field_defs[$name]; |
|
216 | + } |
|
217 | + if ( $widgetDef['type'] == 'date') { |
|
218 | + // special case date types |
|
211 | 219 | $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat); |
212 | - elseif ( $widgetDef['type'] == 'time') // special case time types |
|
220 | + } elseif ( $widgetDef['type'] == 'time') { |
|
221 | + // special case time types |
|
213 | 222 | $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat); |
214 | - elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types |
|
223 | + } elseif ( $widgetDef['type'] == 'datepicker') { |
|
224 | + // special case datepicker types |
|
215 | 225 | $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat); |
216 | - elseif (!empty($req[$widgetDef['name']])) |
|
217 | - $options[$widgetDef['name']] = $req[$widgetDef['name']]; |
|
226 | + } elseif (!empty($req[$widgetDef['name']])) { |
|
227 | + $options[$widgetDef['name']] = $req[$widgetDef['name']]; |
|
228 | + } |
|
218 | 229 | } |
219 | 230 | |
220 | - if (!empty($req['dashletTitle'])) |
|
221 | - $options['title'] = $req['dashletTitle']; |
|
231 | + if (!empty($req['dashletTitle'])) { |
|
232 | + $options['title'] = $req['dashletTitle']; |
|
233 | + } |
|
222 | 234 | |
223 | 235 | $options['autoRefresh'] = empty($req['autoRefresh']) ? '0' : $req['autoRefresh']; |
224 | 236 | |
@@ -241,19 +253,24 @@ discard block |
||
241 | 253 | $currentSearchFields[$name] = array(); |
242 | 254 | |
243 | 255 | $widgetDef = $params; |
244 | - if ( isset($this->getSeedBean()->field_defs[$name]) ) |
|
245 | - $widgetDef = $this->getSeedBean()->field_defs[$name]; |
|
256 | + if ( isset($this->getSeedBean()->field_defs[$name]) ) { |
|
257 | + $widgetDef = $this->getSeedBean()->field_defs[$name]; |
|
258 | + } |
|
246 | 259 | |
247 | - if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown |
|
260 | + if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') { |
|
261 | + $widgetDef['remove_blank'] = true; |
|
262 | + } |
|
263 | + // remove the blank option for the dropdown |
|
248 | 264 | |
249 | - if ( empty($widgetDef['input_name0']) ) |
|
250 | - $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name; |
|
265 | + if ( empty($widgetDef['input_name0']) ) { |
|
266 | + $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name; |
|
267 | + } |
|
251 | 268 | $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir); |
252 | - if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] ) |
|
253 | - $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts'); |
|
269 | + if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] ) { |
|
270 | + $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts'); |
|
271 | + } |
|
254 | 272 | $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name)); |
255 | - } |
|
256 | - else { // ability to create spacers in input fields |
|
273 | + } else { // ability to create spacers in input fields |
|
257 | 274 | $currentSearchFields['blank' + $count]['label'] = ''; |
258 | 275 | $currentSearchFields['blank' + $count]['input'] = ''; |
259 | 276 | $count++; |
@@ -289,8 +306,9 @@ discard block |
||
289 | 306 | */ |
290 | 307 | protected function getSeedBean() |
291 | 308 | { |
292 | - if ( !($this->_seedBean instanceof SugarBean) ) |
|
293 | - $this->_seedBean = SugarModule::get($this->_seedName)->loadBean(); |
|
309 | + if ( !($this->_seedBean instanceof SugarBean) ) { |
|
310 | + $this->_seedBean = SugarModule::get($this->_seedName)->loadBean(); |
|
311 | + } |
|
294 | 312 | |
295 | 313 | return $this->_seedBean; |
296 | 314 | } |
@@ -412,9 +430,14 @@ discard block |
||
412 | 430 | } |
413 | 431 | |
414 | 432 | //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank. |
415 | - if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank. |
|
433 | + if(isset($sortby1[0]) && $sortby1[0]==array()) { |
|
434 | + unset($sortby1[0]); |
|
435 | + } |
|
436 | + //the beginning of month after search is blank. |
|
416 | 437 | |
417 | - if($ifsort2==false) $sortby2=array(0); |
|
438 | + if($ifsort2==false) { |
|
439 | + $sortby2=array(0); |
|
440 | + } |
|
418 | 441 | |
419 | 442 | if($keycolname2!=null) { |
420 | 443 | $sortby2 = array(); |
@@ -438,7 +461,9 @@ discard block |
||
438 | 461 | |
439 | 462 | foreach($sortby1 as $sort1) { |
440 | 463 | foreach($sortby2 as $sort2) { |
441 | - if($ifsort2) $a=0; |
|
464 | + if($ifsort2) { |
|
465 | + $a=0; |
|
466 | + } |
|
442 | 467 | foreach($data_set as $key => $value){ |
443 | 468 | if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) { |
444 | 469 | if($translate1) { |
@@ -461,15 +486,13 @@ discard block |
||
461 | 486 | if($translate1) { |
462 | 487 | $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1]; |
463 | 488 | $val[$keycolname1.'_dom_option'] = $sort1; |
464 | - } |
|
465 | - else { |
|
489 | + } else { |
|
466 | 490 | $val[$keycolname1] = $sort1; |
467 | 491 | } |
468 | 492 | if($translate2) { |
469 | 493 | $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2]; |
470 | 494 | $val[$keycolname2.'_dom_option'] = $sort2; |
471 | - } |
|
472 | - elseif($keycolname2!=null) { |
|
495 | + } elseif($keycolname2!=null) { |
|
473 | 496 | $val[$keycolname2] = $sort2; |
474 | 497 | } |
475 | 498 | array_push($data, $val); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @see Dashlet::$isRefreshable |
61 | 61 | */ |
62 | - public $isRefreshable = true; |
|
62 | + public $isRefreshable = true; |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * location of smarty template file for configuring |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | { |
106 | 106 | parent::__construct($id); |
107 | 107 | |
108 | - if ( isset($options) ) { |
|
109 | - foreach ( $options as $key => $value ) { |
|
108 | + if (isset($options)) { |
|
109 | + foreach ($options as $key => $value) { |
|
110 | 110 | $this->$key = $value; |
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | 114 | // load searchfields |
115 | 115 | $classname = get_class($this); |
116 | - if ( is_file("modules/Charts/Dashlets/$classname/$classname.data.php") ) { |
|
116 | + if (is_file("modules/Charts/Dashlets/$classname/$classname.data.php")) { |
|
117 | 117 | require("modules/Charts/Dashlets/$classname/$classname.data.php"); |
118 | 118 | $this->_searchFields = $dashletData[$classname]['searchFields']; |
119 | 119 | } |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | // load language files |
122 | 122 | $this->loadLanguage($classname, 'modules/Charts/Dashlets/'); |
123 | 123 | |
124 | - if ( empty($options['title']) ) |
|
124 | + if (empty($options['title'])) |
|
125 | 125 | $this->title = $this->dashletStrings['LBL_TITLE']; |
126 | - if ( isset($options['autoRefresh']) ) |
|
126 | + if (isset($options['autoRefresh'])) |
|
127 | 127 | $this->autoRefresh = $options['autoRefresh']; |
128 | 128 | |
129 | 129 | $this->layoutManager = new LayoutManager(); |
130 | 130 | $this->layoutManager->setAttribute('context', 'Report'); |
131 | 131 | // fake a reporter object here just to pass along the db type used in many widgets. |
132 | 132 | // this should be taken out when sugarwidgets change |
133 | - $temp = (object) array('db' => &$GLOBALS['db'], 'report_def_str' => ''); |
|
133 | + $temp = (object)array('db' => &$GLOBALS['db'], 'report_def_str' => ''); |
|
134 | 134 | $this->layoutManager->setAttributePtr('reporter', $temp); |
135 | 135 | } |
136 | 136 | |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | public function setRefreshIcon() |
141 | 141 | { |
142 | 142 | $additionalTitle = ''; |
143 | - if($this->isRefreshable) |
|
143 | + if ($this->isRefreshable) |
|
144 | 144 | |
145 | 145 | $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\'' |
146 | 146 | . $this->id |
147 | 147 | . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->' |
148 | 148 | . SugarThemeRegistry::current()->getImage( |
149 | 149 | 'dashlet-header-refresh', |
150 | - 'border="0" align="absmiddle" title="'. translate('LBL_DASHLET_REFRESH', 'Home') . '"', |
|
150 | + 'border="0" align="absmiddle" title="'.translate('LBL_DASHLET_REFRESH', 'Home').'"', |
|
151 | 151 | null, |
152 | 152 | null, |
153 | 153 | '.gif', |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function getConfigureSmartyInstance() |
179 | 179 | { |
180 | - if ( !($this->_configureSS instanceof Sugar_Smarty) ) { |
|
180 | + if (!($this->_configureSS instanceof Sugar_Smarty)) { |
|
181 | 181 | |
182 | 182 | $this->_configureSS = new Sugar_Smarty(); |
183 | 183 | } |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | |
201 | 201 | $options = array(); |
202 | 202 | |
203 | - foreach($req as $name => $value) |
|
204 | - if(!is_array($value)) $req[$name] = trim($value); |
|
203 | + foreach ($req as $name => $value) |
|
204 | + if (!is_array($value)) $req[$name] = trim($value); |
|
205 | 205 | |
206 | - foreach($this->_searchFields as $name => $params) { |
|
206 | + foreach ($this->_searchFields as $name => $params) { |
|
207 | 207 | $widgetDef = $params; |
208 | - if ( isset($this->getSeedBean()->field_defs[$name]) ) |
|
208 | + if (isset($this->getSeedBean()->field_defs[$name])) |
|
209 | 209 | $widgetDef = $this->getSeedBean()->field_defs[$name]; |
210 | - if ( $widgetDef['type'] == 'date') // special case date types |
|
210 | + if ($widgetDef['type'] == 'date') // special case date types |
|
211 | 211 | $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat); |
212 | - elseif ( $widgetDef['type'] == 'time') // special case time types |
|
212 | + elseif ($widgetDef['type'] == 'time') // special case time types |
|
213 | 213 | $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat); |
214 | - elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types |
|
214 | + elseif ($widgetDef['type'] == 'datepicker') // special case datepicker types |
|
215 | 215 | $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat); |
216 | 216 | elseif (!empty($req[$widgetDef['name']])) |
217 | 217 | $options[$widgetDef['name']] = $req[$widgetDef['name']]; |
@@ -234,36 +234,36 @@ discard block |
||
234 | 234 | { |
235 | 235 | $currentSearchFields = array(); |
236 | 236 | |
237 | - if ( is_array($this->_searchFields) ) { |
|
238 | - foreach($this->_searchFields as $name=>$params) { |
|
239 | - if(!empty($name)) { |
|
237 | + if (is_array($this->_searchFields)) { |
|
238 | + foreach ($this->_searchFields as $name=>$params) { |
|
239 | + if (!empty($name)) { |
|
240 | 240 | $name = strtolower($name); |
241 | 241 | $currentSearchFields[$name] = array(); |
242 | 242 | |
243 | 243 | $widgetDef = $params; |
244 | - if ( isset($this->getSeedBean()->field_defs[$name]) ) |
|
244 | + if (isset($this->getSeedBean()->field_defs[$name])) |
|
245 | 245 | $widgetDef = $this->getSeedBean()->field_defs[$name]; |
246 | 246 | |
247 | - if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown |
|
247 | + if ($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown |
|
248 | 248 | |
249 | - if ( empty($widgetDef['input_name0']) ) |
|
249 | + if (empty($widgetDef['input_name0'])) |
|
250 | 250 | $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name; |
251 | 251 | $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir); |
252 | - if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] ) |
|
252 | + if ($currentSearchFields[$name]['label'] == $widgetDef['vname']) |
|
253 | 253 | $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts'); |
254 | 254 | $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name)); |
255 | 255 | } |
256 | 256 | else { // ability to create spacers in input fields |
257 | - $currentSearchFields['blank' + $count]['label'] = ''; |
|
258 | - $currentSearchFields['blank' + $count]['input'] = ''; |
|
257 | + $currentSearchFields['blank' +$count]['label'] = ''; |
|
258 | + $currentSearchFields['blank' +$count]['input'] = ''; |
|
259 | 259 | $count++; |
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |
263 | 263 | $this->currentSearchFields = $currentSearchFields; |
264 | - $this->getConfigureSmartyInstance()->assign('title',translate('LBL_TITLE','Charts')); |
|
265 | - $this->getConfigureSmartyInstance()->assign('save',$GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']); |
|
266 | - $this->getConfigureSmartyInstance()->assign('clear',$GLOBALS['app_strings']['LBL_CLEAR_BUTTON_LABEL']); |
|
264 | + $this->getConfigureSmartyInstance()->assign('title', translate('LBL_TITLE', 'Charts')); |
|
265 | + $this->getConfigureSmartyInstance()->assign('save', $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']); |
|
266 | + $this->getConfigureSmartyInstance()->assign('clear', $GLOBALS['app_strings']['LBL_CLEAR_BUTTON_LABEL']); |
|
267 | 267 | $this->getConfigureSmartyInstance()->assign('id', $this->id); |
268 | 268 | $this->getConfigureSmartyInstance()->assign('searchFields', $this->currentSearchFields); |
269 | 269 | $this->getConfigureSmartyInstance()->assign('dashletTitle', $this->title); |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | $this->getConfigureSmartyInstance()->assign('module', $_REQUEST['module']); |
272 | 272 | $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown); |
273 | 273 | |
274 | - if($this->isAutoRefreshable()) { |
|
274 | + if ($this->isAutoRefreshable()) { |
|
275 | 275 | $this->getConfigureSmartyInstance()->assign('isRefreshable', true); |
276 | 276 | $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']); |
277 | 277 | $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions()); |
278 | 278 | $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh); |
279 | 279 | } |
280 | 280 | |
281 | - return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl); |
|
281 | + return parent::displayOptions().$this->getConfigureSmartyInstance()->fetch($this->_configureTpl); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | protected function getSeedBean() |
291 | 291 | { |
292 | - if ( !($this->_seedBean instanceof SugarBean) ) |
|
292 | + if (!($this->_seedBean instanceof SugarBean)) |
|
293 | 293 | $this->_seedBean = SugarModule::get($this->_seedName)->loadBean(); |
294 | 294 | |
295 | 295 | return $this->_seedBean; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function display() |
324 | 324 | { |
325 | - return parent::display() . $this->processAutoRefresh(); |
|
325 | + return parent::display().$this->processAutoRefresh(); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -335,28 +335,28 @@ discard block |
||
335 | 335 | { |
336 | 336 | global $sugar_config; |
337 | 337 | |
338 | - if ( empty($dashletOffset) ) { |
|
338 | + if (empty($dashletOffset)) { |
|
339 | 339 | $dashletOffset = 0; |
340 | 340 | $module = $_REQUEST['module']; |
341 | - if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) { |
|
341 | + if (isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) { |
|
342 | 342 | $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset']; |
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
346 | - if ( !$this->isRefreshable ) { |
|
346 | + if (!$this->isRefreshable) { |
|
347 | 347 | return ''; |
348 | 348 | } |
349 | - if ( !empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1 ) { |
|
349 | + if (!empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1) { |
|
350 | 350 | return ''; |
351 | 351 | } |
352 | 352 | $autoRefreshSS = new Sugar_Smarty(); |
353 | 353 | $autoRefreshSS->assign('dashletOffset', $dashletOffset); |
354 | 354 | $autoRefreshSS->assign('dashletId', $this->id); |
355 | - $autoRefreshSS->assign('strippedDashletId', str_replace("-","",$this->id)); //javascript doesn't like "-" in function names |
|
355 | + $autoRefreshSS->assign('strippedDashletId', str_replace("-", "", $this->id)); //javascript doesn't like "-" in function names |
|
356 | 356 | $autoRefreshSS->assign('dashletRefreshInterval', $this->getAutoRefresh()); |
357 | 357 | $autoRefreshSS->assign('url', "predefined_chart"); |
358 | 358 | $tpl = 'include/Dashlets/DashletGenericAutoRefresh.tpl'; |
359 | - if ( $_REQUEST['action'] == "DynamicAction" ) { |
|
359 | + if ($_REQUEST['action'] == "DynamicAction") { |
|
360 | 360 | $tpl = 'include/Dashlets/DashletGenericAutoRefreshDynamic.tpl'; |
361 | 361 | } |
362 | 362 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | |
373 | 373 | $row = $db->fetchByAssoc($result); |
374 | 374 | |
375 | - while ($row != null){ |
|
375 | + while ($row != null) { |
|
376 | 376 | $dataSet[] = $row; |
377 | 377 | $row = $db->fetchByAssoc($result); |
378 | 378 | } |
@@ -392,19 +392,19 @@ discard block |
||
392 | 392 | bool $ifsort2 Whether to sort by the second column or just translate the second column. |
393 | 393 | * @return The sorted and translated data. |
394 | 394 | */ |
395 | - function sortData($data_set, $keycolname1=null, $translate1=false, $keycolname2=null, $translate2=false, $ifsort2=false) { |
|
395 | + function sortData($data_set, $keycolname1 = null, $translate1 = false, $keycolname2 = null, $translate2 = false, $ifsort2 = false) { |
|
396 | 396 | //You can set whether the columns need to be translated or sorted. It the column needn't to be translated, the sorting must be done in SQL, this function will not do the sorting. |
397 | 397 | global $app_list_strings; |
398 | 398 | $sortby1[] = array(); |
399 | 399 | foreach ($data_set as $row) { |
400 | - $sortby1[] = $row[$keycolname1]; |
|
400 | + $sortby1[] = $row[$keycolname1]; |
|
401 | 401 | } |
402 | 402 | $sortby1 = array_unique($sortby1); |
403 | 403 | //The data is from the database, the sorting should be done in the sql. So I will not do the sort here. |
404 | - if($translate1) { |
|
404 | + if ($translate1) { |
|
405 | 405 | $temp_sortby1 = array(); |
406 | - foreach(array_keys($app_list_strings[$keycolname1.'_dom']) as $sortby1_value) { |
|
407 | - if(in_array($sortby1_value, $sortby1)) { |
|
406 | + foreach (array_keys($app_list_strings[$keycolname1.'_dom']) as $sortby1_value) { |
|
407 | + if (in_array($sortby1_value, $sortby1)) { |
|
408 | 408 | $temp_sortby1[] = $sortby1_value; |
409 | 409 | } |
410 | 410 | } |
@@ -412,21 +412,21 @@ discard block |
||
412 | 412 | } |
413 | 413 | |
414 | 414 | //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank. |
415 | - if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank. |
|
415 | + if (isset($sortby1[0]) && $sortby1[0] == array()) unset($sortby1[0]); //the beginning of month after search is blank. |
|
416 | 416 | |
417 | - if($ifsort2==false) $sortby2=array(0); |
|
417 | + if ($ifsort2 == false) $sortby2 = array(0); |
|
418 | 418 | |
419 | - if($keycolname2!=null) { |
|
419 | + if ($keycolname2 != null) { |
|
420 | 420 | $sortby2 = array(); |
421 | 421 | foreach ($data_set as $row) { |
422 | - $sortby2[] = $row[$keycolname2]; |
|
422 | + $sortby2[] = $row[$keycolname2]; |
|
423 | 423 | } |
424 | 424 | //The data is from the database, the sorting should be done in the sql. So I will not do the sort here. |
425 | 425 | $sortby2 = array_unique($sortby2); |
426 | - if($translate2) { |
|
426 | + if ($translate2) { |
|
427 | 427 | $temp_sortby2 = array(); |
428 | - foreach(array_keys($app_list_strings[$keycolname2.'_dom']) as $sortby2_value) { |
|
429 | - if(in_array($sortby2_value, $sortby2)) { |
|
428 | + foreach (array_keys($app_list_strings[$keycolname2.'_dom']) as $sortby2_value) { |
|
429 | + if (in_array($sortby2_value, $sortby2)) { |
|
430 | 430 | $temp_sortby2[] = $sortby2_value; |
431 | 431 | } |
432 | 432 | } |
@@ -434,42 +434,42 @@ discard block |
||
434 | 434 | } |
435 | 435 | } |
436 | 436 | |
437 | - $data=array(); |
|
437 | + $data = array(); |
|
438 | 438 | |
439 | - foreach($sortby1 as $sort1) { |
|
440 | - foreach($sortby2 as $sort2) { |
|
441 | - if($ifsort2) $a=0; |
|
442 | - foreach($data_set as $key => $value){ |
|
443 | - if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) { |
|
444 | - if($translate1) { |
|
439 | + foreach ($sortby1 as $sort1) { |
|
440 | + foreach ($sortby2 as $sort2) { |
|
441 | + if ($ifsort2) $a = 0; |
|
442 | + foreach ($data_set as $key => $value) { |
|
443 | + if ($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2] == $sort2)) { |
|
444 | + if ($translate1) { |
|
445 | 445 | $value[$keycolname1.'_dom_option'] = $value[$keycolname1]; |
446 | 446 | $value[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$value[$keycolname1]]; |
447 | 447 | } |
448 | - if($translate2) { |
|
448 | + if ($translate2) { |
|
449 | 449 | $value[$keycolname2.'_dom_option'] = $value[$keycolname2]; |
450 | 450 | $value[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$value[$keycolname2]]; |
451 | 451 | } |
452 | 452 | array_push($data, $value); |
453 | 453 | unset($data_set[$key]); |
454 | - $a=1; |
|
454 | + $a = 1; |
|
455 | 455 | } |
456 | 456 | } |
457 | - if($ifsort2 && $a==0) {//Add 0 for sorting by the second column, if the first row doesn't have a certain col, it will fill the column with 0. |
|
458 | - $val=array(); |
|
457 | + if ($ifsort2 && $a == 0) {//Add 0 for sorting by the second column, if the first row doesn't have a certain col, it will fill the column with 0. |
|
458 | + $val = array(); |
|
459 | 459 | $val['total'] = 0; |
460 | 460 | $val['count'] = 0; |
461 | - if($translate1) { |
|
461 | + if ($translate1) { |
|
462 | 462 | $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1]; |
463 | 463 | $val[$keycolname1.'_dom_option'] = $sort1; |
464 | 464 | } |
465 | 465 | else { |
466 | 466 | $val[$keycolname1] = $sort1; |
467 | 467 | } |
468 | - if($translate2) { |
|
468 | + if ($translate2) { |
|
469 | 469 | $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2]; |
470 | 470 | $val[$keycolname2.'_dom_option'] = $sort2; |
471 | 471 | } |
472 | - elseif($keycolname2!=null) { |
|
472 | + elseif ($keycolname2 != null) { |
|
473 | 473 | $val[$keycolname2] = $sort2; |
474 | 474 | } |
475 | 475 | array_push($data, $val); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -64,28 +64,28 @@ discard block |
||
64 | 64 | $cacheDir = create_cache_directory('dashlets/'); |
65 | 65 | $allDashlets = array_merge($dashletFiles, $dashletFilesCustom); |
66 | 66 | $dashletFiles = array(); |
67 | - foreach($allDashlets as $num => $file) { |
|
68 | - if(substr_count($file, '.meta') == 0) { // ignore meta data files |
|
67 | + foreach ($allDashlets as $num => $file) { |
|
68 | + if (substr_count($file, '.meta') == 0) { // ignore meta data files |
|
69 | 69 | $class = substr($file, strrpos($file, '/') + 1, -4); |
70 | 70 | $dashletFiles[$class] = array(); |
71 | 71 | $dashletFiles[$class]['file'] = $file; |
72 | 72 | $dashletFiles[$class]['class'] = $class; |
73 | - if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file? |
|
73 | + if (is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file? |
|
74 | 74 | $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file); |
75 | 75 | require($dashletFiles[$class]['meta']); |
76 | - if ( isset($dashletMeta[$class]['module']) ) |
|
76 | + if (isset($dashletMeta[$class]['module'])) |
|
77 | 77 | $dashletFiles[$class]['module'] = $dashletMeta[$class]['module']; |
78 | 78 | } |
79 | 79 | |
80 | 80 | $filesInDirectory = array(); |
81 | 81 | getFiles($filesInDirectory, substr($file, 0, strrpos($file, '/')), '/^.*\/Dashlets\/[^\.]*\.icon\.(jpg|jpeg|gif|png)$/i'); |
82 | - if(!empty($filesInDirectory)) { |
|
82 | + if (!empty($filesInDirectory)) { |
|
83 | 83 | $dashletFiles[$class]['icon'] = $filesInDirectory[0]; // take the first icon we see |
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
88 | - write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir . 'dashlets.php'); |
|
88 | + write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir.'dashlets.php'); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | ?> |
92 | 92 | \ No newline at end of file |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file? |
74 | 76 | $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file); |
75 | 77 | require($dashletFiles[$class]['meta']); |
76 | - if ( isset($dashletMeta[$class]['module']) ) |
|
77 | - $dashletFiles[$class]['module'] = $dashletMeta[$class]['module']; |
|
78 | + if ( isset($dashletMeta[$class]['module']) ) { |
|
79 | + $dashletFiles[$class]['module'] = $dashletMeta[$class]['module']; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | $filesInDirectory = array(); |
@@ -43,79 +43,79 @@ |
||
43 | 43 | * Created: Sep 12, 2011 |
44 | 44 | */ |
45 | 45 | class DashletRssFeedTitle { |
46 | - public $defaultEncoding = "UTF-8"; |
|
47 | - public $readBytes = 8192; |
|
48 | - public $url; |
|
49 | - public $cut = 70; |
|
50 | - public $contents = ""; |
|
51 | - public $title = ""; |
|
52 | - public $endWith = "..."; |
|
53 | - public $xmlEncoding = false; |
|
54 | - public $fileOpen = false; |
|
46 | + public $defaultEncoding = "UTF-8"; |
|
47 | + public $readBytes = 8192; |
|
48 | + public $url; |
|
49 | + public $cut = 70; |
|
50 | + public $contents = ""; |
|
51 | + public $title = ""; |
|
52 | + public $endWith = "..."; |
|
53 | + public $xmlEncoding = false; |
|
54 | + public $fileOpen = false; |
|
55 | 55 | |
56 | - public function __construct($url) { |
|
57 | - $this->url = $url; |
|
58 | - } |
|
56 | + public function __construct($url) { |
|
57 | + $this->url = $url; |
|
58 | + } |
|
59 | 59 | |
60 | - public function generateTitle() { |
|
61 | - if ($this->readFeed()) { |
|
62 | - $this->getTitle(); |
|
63 | - if (!empty($this->title)) { |
|
64 | - $this->convertEncoding(); |
|
65 | - $this->cutLength(); |
|
66 | - } |
|
67 | - } |
|
68 | - return $this->title; |
|
69 | - } |
|
60 | + public function generateTitle() { |
|
61 | + if ($this->readFeed()) { |
|
62 | + $this->getTitle(); |
|
63 | + if (!empty($this->title)) { |
|
64 | + $this->convertEncoding(); |
|
65 | + $this->cutLength(); |
|
66 | + } |
|
67 | + } |
|
68 | + return $this->title; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @todo use curl with waiting timeout instead of fopen |
|
73 | - */ |
|
74 | - public function readFeed() { |
|
75 | - if ($this->url) { |
|
71 | + /** |
|
72 | + * @todo use curl with waiting timeout instead of fopen |
|
73 | + */ |
|
74 | + public function readFeed() { |
|
75 | + if ($this->url) { |
|
76 | 76 | if (!in_array(strtolower(parse_url($this->url, PHP_URL_SCHEME)), array("http", "https"), true)) { |
77 | 77 | return false; |
78 | 78 | } |
79 | - $fileOpen = @fopen($this->url, 'r'); |
|
80 | - if ($fileOpen) { |
|
81 | - $this->fileOpen = true; |
|
82 | - $this->contents = fread($fileOpen, $this->readBytes); |
|
83 | - fclose($fileOpen); |
|
84 | - return true; |
|
85 | - } |
|
86 | - } |
|
87 | - return false; |
|
88 | - } |
|
79 | + $fileOpen = @fopen($this->url, 'r'); |
|
80 | + if ($fileOpen) { |
|
81 | + $this->fileOpen = true; |
|
82 | + $this->contents = fread($fileOpen, $this->readBytes); |
|
83 | + fclose($fileOpen); |
|
84 | + return true; |
|
85 | + } |
|
86 | + } |
|
87 | + return false; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * |
|
92 | - */ |
|
93 | - public function getTitle() { |
|
94 | - $matches = array (); |
|
95 | - preg_match("/<title>.*?<\/title>/i", $this->contents, $matches); |
|
96 | - if (isset($matches[0])) { |
|
97 | - $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]); |
|
98 | - } |
|
99 | - } |
|
90 | + /** |
|
91 | + * |
|
92 | + */ |
|
93 | + public function getTitle() { |
|
94 | + $matches = array (); |
|
95 | + preg_match("/<title>.*?<\/title>/i", $this->contents, $matches); |
|
96 | + if (isset($matches[0])) { |
|
97 | + $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]); |
|
98 | + } |
|
99 | + } |
|
100 | 100 | |
101 | - public function cutLength() { |
|
102 | - if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) { |
|
103 | - $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith; |
|
104 | - } |
|
105 | - } |
|
101 | + public function cutLength() { |
|
102 | + if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) { |
|
103 | + $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith; |
|
104 | + } |
|
105 | + } |
|
106 | 106 | |
107 | - private function _identifyXmlEncoding() { |
|
108 | - $matches = array (); |
|
109 | - preg_match('/encoding\=*\".*?\"/', $this->contents, $matches); |
|
110 | - if (isset($matches[0])) { |
|
111 | - $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"'); |
|
112 | - } |
|
113 | - } |
|
107 | + private function _identifyXmlEncoding() { |
|
108 | + $matches = array (); |
|
109 | + preg_match('/encoding\=*\".*?\"/', $this->contents, $matches); |
|
110 | + if (isset($matches[0])) { |
|
111 | + $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"'); |
|
112 | + } |
|
113 | + } |
|
114 | 114 | |
115 | - public function convertEncoding() { |
|
116 | - $this->_identifyXmlEncoding(); |
|
117 | - if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) { |
|
118 | - $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title); |
|
119 | - } |
|
120 | - } |
|
115 | + public function convertEncoding() { |
|
116 | + $this->_identifyXmlEncoding(); |
|
117 | + if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) { |
|
118 | + $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title); |
|
119 | + } |
|
120 | + } |
|
121 | 121 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | */ |
93 | 93 | public function getTitle() { |
94 | - $matches = array (); |
|
94 | + $matches = array(); |
|
95 | 95 | preg_match("/<title>.*?<\/title>/i", $this->contents, $matches); |
96 | 96 | if (isset($matches[0])) { |
97 | 97 | $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]); |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | |
101 | 101 | public function cutLength() { |
102 | 102 | if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) { |
103 | - $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith; |
|
103 | + $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding).$this->endWith; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | 107 | private function _identifyXmlEncoding() { |
108 | - $matches = array (); |
|
108 | + $matches = array(); |
|
109 | 109 | preg_match('/encoding\=*\".*?\"/', $this->contents, $matches); |
110 | 110 | if (isset($matches[0])) { |
111 | 111 | $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"'); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | require_once('include/MySugar/MySugar.php'); |
43 | 43 | |
44 | 44 | // build dashlet cache file if not found |
45 | -if(!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) { |
|
45 | +if (!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) { |
|
46 | 46 | require_once('include/Dashlets/DashletCacheBuilder.php'); |
47 | 47 | |
48 | 48 | $dc = new DashletCacheBuilder(); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $hasUserPreferences = (!isset($pages) || empty($pages) || !isset($dashlets) || empty($dashlets)) ? false : true; |
62 | 62 | |
63 | -if(!$hasUserPreferences){ |
|
63 | +if (!$hasUserPreferences) { |
|
64 | 64 | $dashlets = array(); |
65 | 65 | |
66 | 66 | //list of preferences to move over and to where |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $old_columns = $current_user->getPreference('columns', 'home'); |
86 | 86 | $old_dashlets = $current_user->getPreference('dashlets', 'home'); |
87 | 87 | |
88 | - if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)){ |
|
88 | + if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)) { |
|
89 | 89 | $columns = $old_columns; |
90 | 90 | $dashlets = $old_dashlets; |
91 | 91 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $current_user->setPreference('columns', $old_columns, 0, 'home'); |
96 | 96 | $current_user->setPreference('dashlets', $old_dashlets, 0, 'home'); |
97 | 97 | } |
98 | - else{ |
|
98 | + else { |
|
99 | 99 | // This is here to get Sugar dashlets added above the rest |
100 | 100 | $dashlets[create_guid()] = array('className' => 'iFrameDashlet', |
101 | 101 | 'module' => 'Home', |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'height' => 315, |
107 | 107 | )); |
108 | 108 | |
109 | - $dashlets[create_guid()] = array ('className' => 'SugarFeedDashlet', |
|
109 | + $dashlets[create_guid()] = array('className' => 'SugarFeedDashlet', |
|
110 | 110 | 'module' => 'SugarFeed', |
111 | 111 | 'forceColumn' => 1, |
112 | 112 | 'fileLocation' => $dashletsFiles['SugarFeedDashlet']['file'], |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | 'height' => 315, |
122 | 122 | )); |
123 | 123 | |
124 | - foreach($defaultDashlets as $dashletName=>$module){ |
|
124 | + foreach ($defaultDashlets as $dashletName=>$module) { |
|
125 | 125 | // clint - fixes bug #20398 |
126 | 126 | // only display dashlets that are from visibile modules and that the user has permission to list |
127 | 127 | $myDashlet = new MySugar($module); |
128 | 128 | $displayDashlet = $myDashlet->checkDashletDisplay(); |
129 | - if (isset($dashletsFiles[$dashletName]) && $displayDashlet){ |
|
129 | + if (isset($dashletsFiles[$dashletName]) && $displayDashlet) { |
|
130 | 130 | $options = array(); |
131 | - $prefsforthisdashlet = array_keys($prefstomove,$dashletName); |
|
132 | - foreach ( $prefsforthisdashlet as $pref ) { |
|
131 | + $prefsforthisdashlet = array_keys($prefstomove, $dashletName); |
|
132 | + foreach ($prefsforthisdashlet as $pref) { |
|
133 | 133 | $options[$pref] = $current_user->getPreference($pref); |
134 | 134 | } |
135 | 135 | $dashlets[create_guid()] = array('className' => $dashletName, |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | $columns[1]['width'] = '40%'; |
150 | 150 | $columns[1]['dashlets'] = array(); |
151 | 151 | |
152 | - foreach($dashlets as $guid=>$dashlet) { |
|
153 | - if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid); |
|
152 | + foreach ($dashlets as $guid=>$dashlet) { |
|
153 | + if ($dashlet['forceColumn'] == 0) array_push($columns[0]['dashlets'], $guid); |
|
154 | 154 | else array_push($columns[1]['dashlets'], $guid); |
155 | 155 | $count++; |
156 | 156 | } |
@@ -165,29 +165,29 @@ discard block |
||
165 | 165 | // handles upgrading from versions that had the 'Dashboard' module; move those items over to the Home page |
166 | 166 | $pagesDashboard = $current_user->getPreference('pages', 'Dashboard'); |
167 | 167 | $dashletsDashboard = $current_user->getPreference('dashlets', 'Dashboard'); |
168 | -if ( !empty($pagesDashboard) ) { |
|
168 | +if (!empty($pagesDashboard)) { |
|
169 | 169 | // move dashlets from the dashboard to be at the end of the home screen dashlets |
170 | - foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn ) { |
|
171 | - foreach ($dashboardColumn['dashlets'] as $dashletItem ) { |
|
170 | + foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn) { |
|
171 | + foreach ($dashboardColumn['dashlets'] as $dashletItem) { |
|
172 | 172 | $pages[0]['columns'][$dashboardColumnKey]['dashlets'][] = $dashletItem; |
173 | 173 | } |
174 | 174 | } |
175 | - $pages = array_merge($pages,$pagesDashboard); |
|
175 | + $pages = array_merge($pages, $pagesDashboard); |
|
176 | 176 | $current_user->setPreference('pages', $pages, 0, 'Home'); |
177 | 177 | } |
178 | -if ( !empty($dashletsDashboard) ) { |
|
179 | - $dashlets = array_merge($dashlets,$dashletsDashboard); |
|
178 | +if (!empty($dashletsDashboard)) { |
|
179 | + $dashlets = array_merge($dashlets, $dashletsDashboard); |
|
180 | 180 | $current_user->setPreference('dashlets', $dashlets, 0, 'Home'); |
181 | 181 | } |
182 | -if ( !empty($pagesDashboard) || !empty($dashletsDashboard) ) |
|
182 | +if (!empty($pagesDashboard) || !empty($dashletsDashboard)) |
|
183 | 183 | $current_user->resetPreferences('Dashboard'); |
184 | 184 | |
185 | -if (empty($pages)){ |
|
185 | +if (empty($pages)) { |
|
186 | 186 | $pages = array(); |
187 | 187 | $pageIndex = 0; |
188 | 188 | $pages[0]['columns'] = $columns; |
189 | 189 | $pages[0]['numColumns'] = '2'; |
190 | - $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME'; // "My Sugar" |
|
190 | + $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME'; // "My Sugar" |
|
191 | 191 | $pageIndex++; |
192 | 192 | $current_user->setPreference('pages', $pages, 0, 'Home'); |
193 | 193 | $activePage = 0; |
@@ -206,32 +206,32 @@ discard block |
||
206 | 206 | $dashletIds = array(); // collect ids to pass to javascript |
207 | 207 | $display = array(); |
208 | 208 | |
209 | -foreach($pages[$activePage]['columns'] as $colNum => $column) { |
|
210 | - if ($colNum == $numCols){ |
|
209 | +foreach ($pages[$activePage]['columns'] as $colNum => $column) { |
|
210 | + if ($colNum == $numCols) { |
|
211 | 211 | break; |
212 | 212 | } |
213 | 213 | $display[$colNum]['width'] = $column['width']; |
214 | 214 | $display[$colNum]['dashlets'] = array(); |
215 | - foreach($column['dashlets'] as $num => $id) { |
|
215 | + foreach ($column['dashlets'] as $num => $id) { |
|
216 | 216 | // clint - fixes bug #20398 |
217 | 217 | // only display dashlets that are from visibile modules and that the user has permission to list |
218 | - if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) { |
|
218 | + if (!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) { |
|
219 | 219 | $module = 'Home'; |
220 | - if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) ) |
|
220 | + if (!empty($dashletsFiles[$dashlets[$id]['className']]['module'])) |
|
221 | 221 | $module = $dashletsFiles[$dashlets[$id]['className']]['module']; |
222 | 222 | // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case |
223 | 223 | // of the Report Chart dashlets. |
224 | - elseif ( !empty($dashlets[$id]['module']) ) |
|
224 | + elseif (!empty($dashlets[$id]['module'])) |
|
225 | 225 | $module = $dashlets[$id]['module']; |
226 | 226 | |
227 | 227 | $myDashlet = new MySugar($module); |
228 | 228 | |
229 | - if($myDashlet->checkDashletDisplay()) { |
|
229 | + if ($myDashlet->checkDashletDisplay()) { |
|
230 | 230 | require_once($dashlets[$id]['fileLocation']); |
231 | 231 | $dashlet = new $dashlets[$id]['className']($id, (isset($dashlets[$id]['options']) ? $dashlets[$id]['options'] : array())); |
232 | 232 | // Need to add support to dynamically display/hide dashlets |
233 | 233 | // If it has a method 'shouldDisplay' we will call it to see if we should display it or not |
234 | - if (method_exists($dashlet,'shouldDisplay')) { |
|
234 | + if (method_exists($dashlet, 'shouldDisplay')) { |
|
235 | 235 | if (!$dashlet->shouldDisplay()) { |
236 | 236 | // This dashlet doesn't want us to show it, skip it. |
237 | 237 | continue; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $dashlets = $current_user->getPreference('dashlets', 'Home'); // Using hardcoded 'Home' because DynamicAction.php $_REQUEST['module'] value is always Home |
244 | 244 | $lvsParams = array(); |
245 | - if(!empty($dashlets[$id]['sort_options'])){ |
|
245 | + if (!empty($dashlets[$id]['sort_options'])) { |
|
246 | 246 | $lvsParams = $dashlets[$id]['sort_options']; |
247 | 247 | } |
248 | 248 | |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | $display[$colNum]['dashlets'][$id]['display'] = $dashlet->display(); |
252 | 252 | $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader(); |
253 | 253 | $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter(); |
254 | - if($dashlet->hasScript) { |
|
254 | + if ($dashlet->hasScript) { |
|
255 | 255 | $display[$colNum]['dashlets'][$id]['script'] = $dashlet->displayScript(); |
256 | 256 | } |
257 | - } catch (Exception $ex) { |
|
257 | + }catch (Exception $ex) { |
|
258 | 258 | $display[$colNum]['dashlets'][$id]['display'] = $ex->getMessage(); |
259 | 259 | $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader(); |
260 | 260 | $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter(); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $_SESSION['current_tab'] = $activePage; |
268 | 268 | |
269 | 269 | |
270 | -if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true); |
|
270 | +if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true); |
|
271 | 271 | |
272 | 272 | |
273 | 273 | $sugar_smarty->assign('sugarVersion', $sugar_version); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | $sugar_smarty->assign('maxCount', empty($sugar_config['max_dashlets_homepage']) ? 15 : $sugar_config['max_dashlets_homepage']); |
279 | 279 | $sugar_smarty->assign('dashletCount', $count); |
280 | -$sugar_smarty->assign('dashletIds', '["' . implode('","', $dashletIds) . '"]'); |
|
280 | +$sugar_smarty->assign('dashletIds', '["'.implode('","', $dashletIds).'"]'); |
|
281 | 281 | $sugar_smarty->assign('columns', $display); |
282 | 282 | |
283 | 283 | global $theme; |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
3 | + die('Not A Valid Entry Point'); |
|
4 | +} |
|
3 | 5 | /********************************************************************************* |
4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -94,8 +96,7 @@ discard block |
||
94 | 96 | $old_dashlets = array(); |
95 | 97 | $current_user->setPreference('columns', $old_columns, 0, 'home'); |
96 | 98 | $current_user->setPreference('dashlets', $old_dashlets, 0, 'home'); |
97 | - } |
|
98 | - else{ |
|
99 | + } else{ |
|
99 | 100 | // This is here to get Sugar dashlets added above the rest |
100 | 101 | $dashlets[create_guid()] = array('className' => 'iFrameDashlet', |
101 | 102 | 'module' => 'Home', |
@@ -150,8 +151,11 @@ discard block |
||
150 | 151 | $columns[1]['dashlets'] = array(); |
151 | 152 | |
152 | 153 | foreach($dashlets as $guid=>$dashlet) { |
153 | - if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid); |
|
154 | - else array_push($columns[1]['dashlets'], $guid); |
|
154 | + if( $dashlet['forceColumn'] == 0 ) { |
|
155 | + array_push($columns[0]['dashlets'], $guid); |
|
156 | + } else { |
|
157 | + array_push($columns[1]['dashlets'], $guid); |
|
158 | + } |
|
155 | 159 | $count++; |
156 | 160 | } |
157 | 161 | } |
@@ -179,8 +183,9 @@ discard block |
||
179 | 183 | $dashlets = array_merge($dashlets,$dashletsDashboard); |
180 | 184 | $current_user->setPreference('dashlets', $dashlets, 0, 'Home'); |
181 | 185 | } |
182 | -if ( !empty($pagesDashboard) || !empty($dashletsDashboard) ) |
|
186 | +if ( !empty($pagesDashboard) || !empty($dashletsDashboard) ) { |
|
183 | 187 | $current_user->resetPreferences('Dashboard'); |
188 | +} |
|
184 | 189 | |
185 | 190 | if (empty($pages)){ |
186 | 191 | $pages = array(); |
@@ -217,12 +222,14 @@ discard block |
||
217 | 222 | // only display dashlets that are from visibile modules and that the user has permission to list |
218 | 223 | if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) { |
219 | 224 | $module = 'Home'; |
220 | - if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) ) |
|
221 | - $module = $dashletsFiles[$dashlets[$id]['className']]['module']; |
|
225 | + if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) ) { |
|
226 | + $module = $dashletsFiles[$dashlets[$id]['className']]['module']; |
|
227 | + } |
|
222 | 228 | // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case |
223 | 229 | // of the Report Chart dashlets. |
224 | - elseif ( !empty($dashlets[$id]['module']) ) |
|
225 | - $module = $dashlets[$id]['module']; |
|
230 | + elseif ( !empty($dashlets[$id]['module']) ) { |
|
231 | + $module = $dashlets[$id]['module']; |
|
232 | + } |
|
226 | 233 | |
227 | 234 | $myDashlet = new MySugar($module); |
228 | 235 | |
@@ -267,7 +274,9 @@ discard block |
||
267 | 274 | $_SESSION['current_tab'] = $activePage; |
268 | 275 | |
269 | 276 | |
270 | -if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true); |
|
277 | +if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) { |
|
278 | + $sugar_smarty->assign('lock_homepage', true); |
|
279 | +} |
|
271 | 280 | |
272 | 281 | |
273 | 282 | $sugar_smarty->assign('sugarVersion', $sugar_version); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | function smarty_function_sugar_number_format($params, &$smarty) { |
38 | 38 | global $locale; |
39 | 39 | |
40 | - if(!isset($params['var']) || $params['var'] === '') { |
|
40 | + if(!isset($params['var']) || $params['var'] === '') { |
|
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 |
@@ -37,11 +37,11 @@ |
||
37 | 37 | function smarty_function_sugar_number_format($params, &$smarty) { |
38 | 38 | global $locale; |
39 | 39 | |
40 | - if(!isset($params['var']) || $params['var'] === '') { |
|
40 | + if (!isset($params['var']) || $params['var'] === '') { |
|
41 | 41 | return ''; |
42 | 42 | } |
43 | 43 | |
44 | - if ( !isset($params['precision']) ) { |
|
44 | + if (!isset($params['precision'])) { |
|
45 | 45 | $params['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits'); |
46 | 46 | } |
47 | 47 |
@@ -21,9 +21,9 @@ |
||
21 | 21 | * @param boolean |
22 | 22 | * @return string |
23 | 23 | */ |
24 | -function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false) |
|
24 | +function smarty_modifier_wordwrap($string, $length = 80, $break = "\n", $cut = false) |
|
25 | 25 | { |
26 | - return wordwrap($string,$length,$break,$cut); |
|
26 | + return wordwrap($string, $length, $break, $cut); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | ?> |