@@ -49,31 +49,31 @@ |
||
49 | 49 | * |
50 | 50 | * @return an instance of SugarController |
51 | 51 | */ |
52 | - static function getController($module){ |
|
52 | + static function getController($module) { |
|
53 | 53 | $class = ucfirst($module).'Controller'; |
54 | - $customClass = 'Custom' . $class; |
|
55 | - if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | - $customClass = 'Custom' . $class; |
|
54 | + $customClass = 'Custom'.$class; |
|
55 | + if (file_exists('custom/modules/'.$module.'/controller.php')) { |
|
56 | + $customClass = 'Custom'.$class; |
|
57 | 57 | require_once('custom/modules/'.$module.'/controller.php'); |
58 | - if(class_exists($customClass)){ |
|
58 | + if (class_exists($customClass)) { |
|
59 | 59 | $controller = new $customClass(); |
60 | - }else if(class_exists($class)){ |
|
60 | + } else if (class_exists($class)) { |
|
61 | 61 | $controller = new $class(); |
62 | 62 | } |
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
63 | + }elseif (file_exists('modules/'.$module.'/controller.php')) { |
|
64 | 64 | require_once('modules/'.$module.'/controller.php'); |
65 | - if(class_exists($customClass)){ |
|
65 | + if (class_exists($customClass)) { |
|
66 | 66 | $controller = new $customClass(); |
67 | - }else if(class_exists($class)){ |
|
67 | + } else if (class_exists($class)) { |
|
68 | 68 | $controller = new $class(); |
69 | 69 | } |
70 | - }else{ |
|
71 | - if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
70 | + } else { |
|
71 | + if (file_exists('custom/include/MVC/Controller/SugarController.php')) { |
|
72 | 72 | require_once('custom/include/MVC/Controller/SugarController.php'); |
73 | 73 | } |
74 | - if(class_exists('CustomSugarController')){ |
|
74 | + if (class_exists('CustomSugarController')) { |
|
75 | 75 | $controller = new CustomSugarController(); |
76 | - }else{ |
|
76 | + } else { |
|
77 | 77 | $controller = new SugarController(); |
78 | 78 | } |
79 | 79 | } |
@@ -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'; |
@@ -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,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::Dashlet($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 |
@@ -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; |
@@ -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 | ?> |