@@ -44,43 +44,43 @@ |
||
44 | 44 | */ |
45 | 45 | class ControllerFactory |
46 | 46 | { |
47 | - /** |
|
48 | - * Obtain an instance of the correct controller. |
|
49 | - * |
|
50 | - * @return an instance of SugarController |
|
51 | - */ |
|
52 | - static function getController($module){ |
|
53 | - $class = ucfirst($module).'Controller'; |
|
54 | - $customClass = 'Custom' . $class; |
|
55 | - if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | - $customClass = 'Custom' . $class; |
|
57 | - require_once('custom/modules/'.$module.'/controller.php'); |
|
58 | - if(class_exists($customClass)){ |
|
59 | - $controller = new $customClass(); |
|
60 | - }else if(class_exists($class)){ |
|
61 | - $controller = new $class(); |
|
62 | - } |
|
63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | - require_once('modules/'.$module.'/controller.php'); |
|
65 | - if(class_exists($customClass)){ |
|
66 | - $controller = new $customClass(); |
|
67 | - }else if(class_exists($class)){ |
|
68 | - $controller = new $class(); |
|
69 | - } |
|
70 | - }else{ |
|
71 | - if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
72 | - require_once('custom/include/MVC/Controller/SugarController.php'); |
|
73 | - } |
|
74 | - if(class_exists('CustomSugarController')){ |
|
75 | - $controller = new CustomSugarController(); |
|
76 | - }else{ |
|
77 | - $controller = new SugarController(); |
|
78 | - } |
|
79 | - } |
|
80 | - //setup the controller |
|
81 | - $controller->setup($module); |
|
82 | - return $controller; |
|
83 | - } |
|
47 | + /** |
|
48 | + * Obtain an instance of the correct controller. |
|
49 | + * |
|
50 | + * @return an instance of SugarController |
|
51 | + */ |
|
52 | + static function getController($module){ |
|
53 | + $class = ucfirst($module).'Controller'; |
|
54 | + $customClass = 'Custom' . $class; |
|
55 | + if(file_exists('custom/modules/'.$module.'/controller.php')){ |
|
56 | + $customClass = 'Custom' . $class; |
|
57 | + require_once('custom/modules/'.$module.'/controller.php'); |
|
58 | + if(class_exists($customClass)){ |
|
59 | + $controller = new $customClass(); |
|
60 | + }else if(class_exists($class)){ |
|
61 | + $controller = new $class(); |
|
62 | + } |
|
63 | + }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
64 | + require_once('modules/'.$module.'/controller.php'); |
|
65 | + if(class_exists($customClass)){ |
|
66 | + $controller = new $customClass(); |
|
67 | + }else if(class_exists($class)){ |
|
68 | + $controller = new $class(); |
|
69 | + } |
|
70 | + }else{ |
|
71 | + if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
|
72 | + require_once('custom/include/MVC/Controller/SugarController.php'); |
|
73 | + } |
|
74 | + if(class_exists('CustomSugarController')){ |
|
75 | + $controller = new CustomSugarController(); |
|
76 | + }else{ |
|
77 | + $controller = new SugarController(); |
|
78 | + } |
|
79 | + } |
|
80 | + //setup the controller |
|
81 | + $controller->setup($module); |
|
82 | + return $controller; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | ?> |
87 | 87 | \ No newline at end of file |
@@ -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 | } |
@@ -57,23 +57,23 @@ |
||
57 | 57 | require_once('custom/modules/'.$module.'/controller.php'); |
58 | 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 | 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{ |
|
70 | + } else{ |
|
71 | 71 | if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
72 | 72 | require_once('custom/include/MVC/Controller/SugarController.php'); |
73 | 73 | } |
74 | 74 | if(class_exists('CustomSugarController')){ |
75 | 75 | $controller = new CustomSugarController(); |
76 | - }else{ |
|
76 | + } else{ |
|
77 | 77 | $controller = new SugarController(); |
78 | 78 | } |
79 | 79 | } |
@@ -44,247 +44,247 @@ discard block |
||
44 | 44 | * @api |
45 | 45 | */ |
46 | 46 | class SugarController{ |
47 | - /** |
|
48 | - * remap actions in here |
|
49 | - * e.g. make all detail views go to edit views |
|
50 | - * $action_remap = array('detailview'=>'editview'); |
|
51 | - */ |
|
52 | - protected $action_remap = array('index'=>'listview'); |
|
53 | - /** |
|
54 | - * The name of the current module. |
|
55 | - */ |
|
56 | - public $module = 'Home'; |
|
57 | - /** |
|
58 | - * The name of the target module. |
|
59 | - */ |
|
60 | - public $target_module = null; |
|
61 | - /** |
|
62 | - * The name of the current action. |
|
63 | - */ |
|
64 | - public $action = 'index'; |
|
65 | - /** |
|
66 | - * The id of the current record. |
|
67 | - */ |
|
68 | - public $record = ''; |
|
69 | - /** |
|
70 | - * The name of the return module. |
|
71 | - */ |
|
72 | - public $return_module = null; |
|
73 | - /** |
|
74 | - * The name of the return action. |
|
75 | - */ |
|
76 | - public $return_action = null; |
|
77 | - /** |
|
78 | - * The id of the return record. |
|
79 | - */ |
|
80 | - public $return_id = null; |
|
81 | - /** |
|
82 | - * If the action was remapped it will be set to do_action and then we will just |
|
83 | - * use do_action for the actual action to perform. |
|
84 | - */ |
|
85 | - protected $do_action = 'index'; |
|
86 | - /** |
|
87 | - * If a bean is present that set it. |
|
88 | - */ |
|
89 | - public $bean = null; |
|
90 | - /** |
|
91 | - * url to redirect to |
|
92 | - */ |
|
93 | - public $redirect_url = ''; |
|
94 | - /** |
|
95 | - * any subcontroller can modify this to change the view |
|
96 | - */ |
|
97 | - public $view = 'classic'; |
|
98 | - /** |
|
99 | - * this array will hold the mappings between a key and an object for use within the view. |
|
100 | - */ |
|
101 | - public $view_object_map = array(); |
|
47 | + /** |
|
48 | + * remap actions in here |
|
49 | + * e.g. make all detail views go to edit views |
|
50 | + * $action_remap = array('detailview'=>'editview'); |
|
51 | + */ |
|
52 | + protected $action_remap = array('index'=>'listview'); |
|
53 | + /** |
|
54 | + * The name of the current module. |
|
55 | + */ |
|
56 | + public $module = 'Home'; |
|
57 | + /** |
|
58 | + * The name of the target module. |
|
59 | + */ |
|
60 | + public $target_module = null; |
|
61 | + /** |
|
62 | + * The name of the current action. |
|
63 | + */ |
|
64 | + public $action = 'index'; |
|
65 | + /** |
|
66 | + * The id of the current record. |
|
67 | + */ |
|
68 | + public $record = ''; |
|
69 | + /** |
|
70 | + * The name of the return module. |
|
71 | + */ |
|
72 | + public $return_module = null; |
|
73 | + /** |
|
74 | + * The name of the return action. |
|
75 | + */ |
|
76 | + public $return_action = null; |
|
77 | + /** |
|
78 | + * The id of the return record. |
|
79 | + */ |
|
80 | + public $return_id = null; |
|
81 | + /** |
|
82 | + * If the action was remapped it will be set to do_action and then we will just |
|
83 | + * use do_action for the actual action to perform. |
|
84 | + */ |
|
85 | + protected $do_action = 'index'; |
|
86 | + /** |
|
87 | + * If a bean is present that set it. |
|
88 | + */ |
|
89 | + public $bean = null; |
|
90 | + /** |
|
91 | + * url to redirect to |
|
92 | + */ |
|
93 | + public $redirect_url = ''; |
|
94 | + /** |
|
95 | + * any subcontroller can modify this to change the view |
|
96 | + */ |
|
97 | + public $view = 'classic'; |
|
98 | + /** |
|
99 | + * this array will hold the mappings between a key and an object for use within the view. |
|
100 | + */ |
|
101 | + public $view_object_map = array(); |
|
102 | 102 | |
103 | - /** |
|
104 | - * This array holds the methods that handleAction() will invoke, in sequence. |
|
105 | - */ |
|
106 | - protected $tasks = array( |
|
107 | - 'pre_action', |
|
108 | - 'do_action', |
|
109 | - 'post_action' |
|
110 | - ); |
|
111 | - /** |
|
112 | - * List of options to run through within the process() method. |
|
113 | - * This list is meant to easily allow additions for new functionality as well as |
|
114 | - * the ability to add a controller's own handling. |
|
115 | - */ |
|
116 | - public $process_tasks = array( |
|
117 | - 'blockFileAccess', |
|
118 | - 'handleEntryPoint', |
|
119 | - 'callLegacyCode', |
|
120 | - 'remapAction', |
|
121 | - 'handle_action', |
|
122 | - 'handleActionMaps', |
|
123 | - ); |
|
124 | - /** |
|
125 | - * Whether or not the action has been handled by $process_tasks |
|
126 | - * |
|
127 | - * @var bool |
|
128 | - */ |
|
129 | - protected $_processed = false; |
|
130 | - /** |
|
131 | - * Map an action directly to a file |
|
132 | - */ |
|
133 | - /** |
|
134 | - * Map an action directly to a file. This will be loaded from action_file_map.php |
|
135 | - */ |
|
136 | - protected $action_file_map = array(); |
|
137 | - /** |
|
138 | - * Map an action directly to a view |
|
139 | - */ |
|
140 | - /** |
|
141 | - * Map an action directly to a view. This will be loaded from action_view_map.php |
|
142 | - */ |
|
143 | - protected $action_view_map = array(); |
|
103 | + /** |
|
104 | + * This array holds the methods that handleAction() will invoke, in sequence. |
|
105 | + */ |
|
106 | + protected $tasks = array( |
|
107 | + 'pre_action', |
|
108 | + 'do_action', |
|
109 | + 'post_action' |
|
110 | + ); |
|
111 | + /** |
|
112 | + * List of options to run through within the process() method. |
|
113 | + * This list is meant to easily allow additions for new functionality as well as |
|
114 | + * the ability to add a controller's own handling. |
|
115 | + */ |
|
116 | + public $process_tasks = array( |
|
117 | + 'blockFileAccess', |
|
118 | + 'handleEntryPoint', |
|
119 | + 'callLegacyCode', |
|
120 | + 'remapAction', |
|
121 | + 'handle_action', |
|
122 | + 'handleActionMaps', |
|
123 | + ); |
|
124 | + /** |
|
125 | + * Whether or not the action has been handled by $process_tasks |
|
126 | + * |
|
127 | + * @var bool |
|
128 | + */ |
|
129 | + protected $_processed = false; |
|
130 | + /** |
|
131 | + * Map an action directly to a file |
|
132 | + */ |
|
133 | + /** |
|
134 | + * Map an action directly to a file. This will be loaded from action_file_map.php |
|
135 | + */ |
|
136 | + protected $action_file_map = array(); |
|
137 | + /** |
|
138 | + * Map an action directly to a view |
|
139 | + */ |
|
140 | + /** |
|
141 | + * Map an action directly to a view. This will be loaded from action_view_map.php |
|
142 | + */ |
|
143 | + protected $action_view_map = array(); |
|
144 | 144 | |
145 | - /** |
|
146 | - * This can be set from the application to tell us whether we have authorization to |
|
147 | - * process the action. If this is set we will default to the noaccess view. |
|
148 | - */ |
|
149 | - public $hasAccess = true; |
|
145 | + /** |
|
146 | + * This can be set from the application to tell us whether we have authorization to |
|
147 | + * process the action. If this is set we will default to the noaccess view. |
|
148 | + */ |
|
149 | + public $hasAccess = true; |
|
150 | 150 | |
151 | - /** |
|
152 | - * Map case sensitive filenames to action. This is used for linux/unix systems |
|
153 | - * where filenames are case sensitive |
|
154 | - */ |
|
155 | - public static $action_case_file = array( |
|
156 | - 'editview'=>'EditView', |
|
157 | - 'detailview'=>'DetailView', |
|
158 | - 'listview'=>'ListView' |
|
159 | - ); |
|
160 | - |
|
161 | - /** |
|
162 | - * Constructor. This ie meant tot load up the module, action, record as well |
|
163 | - * as the mapping arrays. |
|
164 | - */ |
|
165 | - function SugarController(){ |
|
166 | - } |
|
151 | + /** |
|
152 | + * Map case sensitive filenames to action. This is used for linux/unix systems |
|
153 | + * where filenames are case sensitive |
|
154 | + */ |
|
155 | + public static $action_case_file = array( |
|
156 | + 'editview'=>'EditView', |
|
157 | + 'detailview'=>'DetailView', |
|
158 | + 'listview'=>'ListView' |
|
159 | + ); |
|
167 | 160 | |
168 | - /** |
|
169 | - * Called from SugarApplication and is meant to perform the setup operations |
|
170 | - * on the controller. |
|
171 | - * |
|
172 | - */ |
|
173 | - public function setup($module = ''){ |
|
174 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | - $module = $_REQUEST['module']; |
|
176 | - //set the module |
|
177 | - if(!empty($module)) |
|
178 | - $this->setModule($module); |
|
179 | - |
|
180 | - if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
181 | - $this->target_module = $_REQUEST['target_module']; |
|
182 | - } |
|
183 | - //set properties on the controller from the $_REQUEST |
|
184 | - $this->loadPropertiesFromRequest(); |
|
185 | - //load the mapping files |
|
186 | - $this->loadMappings(); |
|
187 | - } |
|
188 | - /** |
|
189 | - * Set the module on the Controller |
|
190 | - * |
|
191 | - * @param object $module |
|
192 | - */ |
|
193 | - public function setModule($module){ |
|
194 | - $this->module = $module; |
|
195 | - } |
|
161 | + /** |
|
162 | + * Constructor. This ie meant tot load up the module, action, record as well |
|
163 | + * as the mapping arrays. |
|
164 | + */ |
|
165 | + function SugarController(){ |
|
166 | + } |
|
196 | 167 | |
197 | - /** |
|
198 | - * Set properties on the Controller from the $_REQUEST |
|
199 | - * |
|
200 | - */ |
|
201 | - private function loadPropertiesFromRequest(){ |
|
202 | - if(!empty($_REQUEST['action'])) |
|
203 | - $this->action = $_REQUEST['action']; |
|
204 | - if(!empty($_REQUEST['record'])) |
|
205 | - $this->record = $_REQUEST['record']; |
|
206 | - if(!empty($_REQUEST['view'])) |
|
207 | - $this->view = $_REQUEST['view']; |
|
208 | - if(!empty($_REQUEST['return_module'])) |
|
209 | - $this->return_module = $_REQUEST['return_module']; |
|
210 | - if(!empty($_REQUEST['return_action'])) |
|
211 | - $this->return_action = $_REQUEST['return_action']; |
|
212 | - if(!empty($_REQUEST['return_id'])) |
|
213 | - $this->return_id = $_REQUEST['return_id']; |
|
214 | - } |
|
168 | + /** |
|
169 | + * Called from SugarApplication and is meant to perform the setup operations |
|
170 | + * on the controller. |
|
171 | + * |
|
172 | + */ |
|
173 | + public function setup($module = ''){ |
|
174 | + if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | + $module = $_REQUEST['module']; |
|
176 | + //set the module |
|
177 | + if(!empty($module)) |
|
178 | + $this->setModule($module); |
|
179 | + |
|
180 | + if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
181 | + $this->target_module = $_REQUEST['target_module']; |
|
182 | + } |
|
183 | + //set properties on the controller from the $_REQUEST |
|
184 | + $this->loadPropertiesFromRequest(); |
|
185 | + //load the mapping files |
|
186 | + $this->loadMappings(); |
|
187 | + } |
|
188 | + /** |
|
189 | + * Set the module on the Controller |
|
190 | + * |
|
191 | + * @param object $module |
|
192 | + */ |
|
193 | + public function setModule($module){ |
|
194 | + $this->module = $module; |
|
195 | + } |
|
215 | 196 | |
216 | - /** |
|
217 | - * Load map files for use within the Controller |
|
218 | - * |
|
219 | - */ |
|
220 | - private function loadMappings(){ |
|
221 | - $this->loadMapping('action_view_map'); |
|
222 | - $this->loadMapping('action_file_map'); |
|
223 | - $this->loadMapping('action_remap', true); |
|
224 | - } |
|
197 | + /** |
|
198 | + * Set properties on the Controller from the $_REQUEST |
|
199 | + * |
|
200 | + */ |
|
201 | + private function loadPropertiesFromRequest(){ |
|
202 | + if(!empty($_REQUEST['action'])) |
|
203 | + $this->action = $_REQUEST['action']; |
|
204 | + if(!empty($_REQUEST['record'])) |
|
205 | + $this->record = $_REQUEST['record']; |
|
206 | + if(!empty($_REQUEST['view'])) |
|
207 | + $this->view = $_REQUEST['view']; |
|
208 | + if(!empty($_REQUEST['return_module'])) |
|
209 | + $this->return_module = $_REQUEST['return_module']; |
|
210 | + if(!empty($_REQUEST['return_action'])) |
|
211 | + $this->return_action = $_REQUEST['return_action']; |
|
212 | + if(!empty($_REQUEST['return_id'])) |
|
213 | + $this->return_id = $_REQUEST['return_id']; |
|
214 | + } |
|
225 | 215 | |
226 | - /** |
|
227 | - * Given a record id load the bean. This bean is accessible from any sub controllers. |
|
228 | - */ |
|
229 | - public function loadBean() |
|
230 | - { |
|
231 | - if(!empty($GLOBALS['beanList'][$this->module])){ |
|
232 | - $class = $GLOBALS['beanList'][$this->module]; |
|
233 | - if(!empty($GLOBALS['beanFiles'][$class])){ |
|
234 | - require_once($GLOBALS['beanFiles'][$class]); |
|
235 | - $this->bean = new $class(); |
|
236 | - if(!empty($this->record)){ |
|
237 | - $this->bean->retrieve($this->record); |
|
238 | - if($this->bean) |
|
239 | - $GLOBALS['FOCUS'] = $this->bean; |
|
240 | - } |
|
241 | - } |
|
242 | - } |
|
243 | - } |
|
216 | + /** |
|
217 | + * Load map files for use within the Controller |
|
218 | + * |
|
219 | + */ |
|
220 | + private function loadMappings(){ |
|
221 | + $this->loadMapping('action_view_map'); |
|
222 | + $this->loadMapping('action_file_map'); |
|
223 | + $this->loadMapping('action_remap', true); |
|
224 | + } |
|
244 | 225 | |
245 | - /** |
|
246 | - * Generic load method to load mapping arrays. |
|
247 | - */ |
|
248 | - private function loadMapping($var, $merge = false){ |
|
249 | - $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
250 | - if(!$$var){ |
|
251 | - if($merge && !empty($this->$var)){ |
|
252 | - $$var = $this->$var; |
|
253 | - }else{ |
|
254 | - $$var = array(); |
|
255 | - } |
|
256 | - if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
257 | - require('include/MVC/Controller/'. $var . '.php'); |
|
258 | - } |
|
259 | - if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
260 | - require('modules/'.$this->module.'/'. $var . '.php'); |
|
261 | - } |
|
262 | - if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
263 | - require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
264 | - } |
|
265 | - if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
266 | - require('custom/include/MVC/Controller/'. $var . '.php'); |
|
267 | - } |
|
226 | + /** |
|
227 | + * Given a record id load the bean. This bean is accessible from any sub controllers. |
|
228 | + */ |
|
229 | + public function loadBean() |
|
230 | + { |
|
231 | + if(!empty($GLOBALS['beanList'][$this->module])){ |
|
232 | + $class = $GLOBALS['beanList'][$this->module]; |
|
233 | + if(!empty($GLOBALS['beanFiles'][$class])){ |
|
234 | + require_once($GLOBALS['beanFiles'][$class]); |
|
235 | + $this->bean = new $class(); |
|
236 | + if(!empty($this->record)){ |
|
237 | + $this->bean->retrieve($this->record); |
|
238 | + if($this->bean) |
|
239 | + $GLOBALS['FOCUS'] = $this->bean; |
|
240 | + } |
|
241 | + } |
|
242 | + } |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * Generic load method to load mapping arrays. |
|
247 | + */ |
|
248 | + private function loadMapping($var, $merge = false){ |
|
249 | + $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
250 | + if(!$$var){ |
|
251 | + if($merge && !empty($this->$var)){ |
|
252 | + $$var = $this->$var; |
|
253 | + }else{ |
|
254 | + $$var = array(); |
|
255 | + } |
|
256 | + if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
257 | + require('include/MVC/Controller/'. $var . '.php'); |
|
258 | + } |
|
259 | + if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
260 | + require('modules/'.$this->module.'/'. $var . '.php'); |
|
261 | + } |
|
262 | + if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
263 | + require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
264 | + } |
|
265 | + if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
266 | + require('custom/include/MVC/Controller/'. $var . '.php'); |
|
267 | + } |
|
268 | 268 | |
269 | 269 | // entry_point_registry -> EntryPointRegistry |
270 | 270 | |
271 | - $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
271 | + $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
272 | 272 | if(file_exists("custom/application/Ext/$varname/$var.ext.php")){ |
273 | - require("custom/application/Ext/$varname/$var.ext.php"); |
|
274 | - } |
|
275 | - if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
276 | - require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
|
277 | - } |
|
278 | - |
|
279 | - sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
280 | - } |
|
281 | - $this->$var = $$var; |
|
282 | - } |
|
273 | + require("custom/application/Ext/$varname/$var.ext.php"); |
|
274 | + } |
|
275 | + if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
276 | + require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
|
277 | + } |
|
283 | 278 | |
284 | - /** |
|
285 | - * This method is called from SugarApplication->execute and it will bootstrap the entire controller process |
|
286 | - */ |
|
287 | - final public function execute() |
|
279 | + sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
280 | + } |
|
281 | + $this->$var = $$var; |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * This method is called from SugarApplication->execute and it will bootstrap the entire controller process |
|
286 | + */ |
|
287 | + final public function execute() |
|
288 | 288 | { |
289 | 289 | |
290 | 290 | try |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | } |
297 | 297 | elseif(!empty($this->redirect_url)) |
298 | 298 | { |
299 | - $this->redirect(); |
|
299 | + $this->redirect(); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | catch (Exception $e) |
@@ -306,12 +306,12 @@ discard block |
||
306 | 306 | |
307 | 307 | |
308 | 308 | |
309 | - } |
|
309 | + } |
|
310 | 310 | |
311 | 311 | /** |
312 | - * Handle exception |
|
313 | - * @param Exception $e |
|
314 | - */ |
|
312 | + * Handle exception |
|
313 | + * @param Exception $e |
|
314 | + */ |
|
315 | 315 | protected function handleException(Exception $e) |
316 | 316 | { |
317 | 317 | $GLOBALS['log']->fatal('Exception in Controller: ' . $e->getMessage()); |
@@ -328,52 +328,52 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - /** |
|
332 | - * Display the appropriate view. |
|
333 | - */ |
|
334 | - private function processView(){ |
|
335 | - if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
336 | - { |
|
337 | - $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
|
338 | - } |
|
339 | - $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
|
340 | - $GLOBALS['current_view'] = $view; |
|
341 | - if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
342 | - ACLController::displayNoAccess(true); |
|
343 | - sugar_cleanup(true); |
|
344 | - } |
|
345 | - if(isset($this->errors)){ |
|
346 | - $view->errors = $this->errors; |
|
347 | - } |
|
348 | - $view->process(); |
|
349 | - } |
|
331 | + /** |
|
332 | + * Display the appropriate view. |
|
333 | + */ |
|
334 | + private function processView(){ |
|
335 | + if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
336 | + { |
|
337 | + $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
|
338 | + } |
|
339 | + $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
|
340 | + $GLOBALS['current_view'] = $view; |
|
341 | + if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
342 | + ACLController::displayNoAccess(true); |
|
343 | + sugar_cleanup(true); |
|
344 | + } |
|
345 | + if(isset($this->errors)){ |
|
346 | + $view->errors = $this->errors; |
|
347 | + } |
|
348 | + $view->process(); |
|
349 | + } |
|
350 | 350 | |
351 | - /** |
|
352 | - * Meant to be overridden by a subclass and allows for specific functionality to be |
|
353 | - * injected prior to the process() method being called. |
|
354 | - */ |
|
355 | - public function preProcess() |
|
356 | - {} |
|
357 | - |
|
358 | - /** |
|
359 | - * if we have a function to support the action use it otherwise use the default action |
|
360 | - * |
|
361 | - * 1) check for file |
|
362 | - * 2) check for action |
|
363 | - */ |
|
364 | - public function process(){ |
|
365 | - $GLOBALS['action'] = $this->action; |
|
366 | - $GLOBALS['module'] = $this->module; |
|
351 | + /** |
|
352 | + * Meant to be overridden by a subclass and allows for specific functionality to be |
|
353 | + * injected prior to the process() method being called. |
|
354 | + */ |
|
355 | + public function preProcess() |
|
356 | + {} |
|
367 | 357 | |
368 | - //check to ensure we have access to the module. |
|
369 | - if($this->hasAccess){ |
|
370 | - $this->do_action = $this->action; |
|
358 | + /** |
|
359 | + * if we have a function to support the action use it otherwise use the default action |
|
360 | + * |
|
361 | + * 1) check for file |
|
362 | + * 2) check for action |
|
363 | + */ |
|
364 | + public function process(){ |
|
365 | + $GLOBALS['action'] = $this->action; |
|
366 | + $GLOBALS['module'] = $this->module; |
|
371 | 367 | |
372 | - $file = self::getActionFilename($this->do_action); |
|
368 | + //check to ensure we have access to the module. |
|
369 | + if($this->hasAccess){ |
|
370 | + $this->do_action = $this->action; |
|
373 | 371 | |
374 | - $this->loadBean(); |
|
372 | + $file = self::getActionFilename($this->do_action); |
|
375 | 373 | |
376 | - $processed = false; |
|
374 | + $this->loadBean(); |
|
375 | + |
|
376 | + $processed = false; |
|
377 | 377 | if (!$this->_processed) { |
378 | 378 | foreach ($this->process_tasks as $process) { |
379 | 379 | $this->$process(); |
@@ -383,173 +383,173 @@ discard block |
||
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | - $this->redirect(); |
|
387 | - }else{ |
|
388 | - $this->no_access(); |
|
389 | - } |
|
390 | - } |
|
386 | + $this->redirect(); |
|
387 | + }else{ |
|
388 | + $this->no_access(); |
|
389 | + } |
|
390 | + } |
|
391 | 391 | |
392 | - /** |
|
393 | - * This method is called from the process method. I could also be called within an action_* method. |
|
394 | - * It allows a developer to override any one of these methods contained within, |
|
395 | - * or if the developer so chooses they can override the entire action_* method. |
|
396 | - * |
|
397 | - * @return true if any one of the pre_, do_, or post_ methods have been defined, |
|
398 | - * false otherwise. This is important b/c if none of these methods exists, then we will run the |
|
399 | - * action_default() method. |
|
400 | - */ |
|
401 | - protected function handle_action(){ |
|
402 | - $processed = false; |
|
403 | - foreach($this->tasks as $task){ |
|
404 | - $processed = ($this->$task() || $processed); |
|
405 | - } |
|
406 | - $this->_processed = $processed; |
|
407 | - } |
|
392 | + /** |
|
393 | + * This method is called from the process method. I could also be called within an action_* method. |
|
394 | + * It allows a developer to override any one of these methods contained within, |
|
395 | + * or if the developer so chooses they can override the entire action_* method. |
|
396 | + * |
|
397 | + * @return true if any one of the pre_, do_, or post_ methods have been defined, |
|
398 | + * false otherwise. This is important b/c if none of these methods exists, then we will run the |
|
399 | + * action_default() method. |
|
400 | + */ |
|
401 | + protected function handle_action(){ |
|
402 | + $processed = false; |
|
403 | + foreach($this->tasks as $task){ |
|
404 | + $processed = ($this->$task() || $processed); |
|
405 | + } |
|
406 | + $this->_processed = $processed; |
|
407 | + } |
|
408 | 408 | |
409 | - /** |
|
410 | - * Perform an action prior to the specified action. |
|
411 | - * This can be overridde in a sub-class |
|
412 | - */ |
|
413 | - private function pre_action(){ |
|
414 | - $function = 'pre_' . $this->action; |
|
415 | - if($this->hasFunction($function)){ |
|
416 | - $GLOBALS['log']->debug('Performing pre_action'); |
|
417 | - $this->$function(); |
|
418 | - return true; |
|
419 | - } |
|
420 | - return false; |
|
421 | - } |
|
409 | + /** |
|
410 | + * Perform an action prior to the specified action. |
|
411 | + * This can be overridde in a sub-class |
|
412 | + */ |
|
413 | + private function pre_action(){ |
|
414 | + $function = 'pre_' . $this->action; |
|
415 | + if($this->hasFunction($function)){ |
|
416 | + $GLOBALS['log']->debug('Performing pre_action'); |
|
417 | + $this->$function(); |
|
418 | + return true; |
|
419 | + } |
|
420 | + return false; |
|
421 | + } |
|
422 | 422 | |
423 | - /** |
|
424 | - * Perform the specified action. |
|
425 | - * This can be overridde in a sub-class |
|
426 | - */ |
|
427 | - private function do_action(){ |
|
428 | - $function = 'action_'. strtolower($this->do_action); |
|
429 | - if($this->hasFunction($function)){ |
|
430 | - $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
|
431 | - $this->$function(); |
|
432 | - return true; |
|
433 | - } |
|
434 | - return false; |
|
435 | - } |
|
423 | + /** |
|
424 | + * Perform the specified action. |
|
425 | + * This can be overridde in a sub-class |
|
426 | + */ |
|
427 | + private function do_action(){ |
|
428 | + $function = 'action_'. strtolower($this->do_action); |
|
429 | + if($this->hasFunction($function)){ |
|
430 | + $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
|
431 | + $this->$function(); |
|
432 | + return true; |
|
433 | + } |
|
434 | + return false; |
|
435 | + } |
|
436 | 436 | |
437 | - /** |
|
438 | - * Perform an action after to the specified action has occurred. |
|
439 | - * This can be overridde in a sub-class |
|
440 | - */ |
|
441 | - private function post_action(){ |
|
442 | - $function = 'post_' . $this->action; |
|
443 | - if($this->hasFunction($function)){ |
|
444 | - $GLOBALS['log']->debug('Performing post_action'); |
|
445 | - $this->$function(); |
|
446 | - return true; |
|
447 | - } |
|
448 | - return false; |
|
449 | - } |
|
437 | + /** |
|
438 | + * Perform an action after to the specified action has occurred. |
|
439 | + * This can be overridde in a sub-class |
|
440 | + */ |
|
441 | + private function post_action(){ |
|
442 | + $function = 'post_' . $this->action; |
|
443 | + if($this->hasFunction($function)){ |
|
444 | + $GLOBALS['log']->debug('Performing post_action'); |
|
445 | + $this->$function(); |
|
446 | + return true; |
|
447 | + } |
|
448 | + return false; |
|
449 | + } |
|
450 | 450 | |
451 | - /** |
|
452 | - * If there is no action found then display an error to the user. |
|
453 | - */ |
|
454 | - protected function no_action(){ |
|
455 | - sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
|
456 | - } |
|
451 | + /** |
|
452 | + * If there is no action found then display an error to the user. |
|
453 | + */ |
|
454 | + protected function no_action(){ |
|
455 | + sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
|
456 | + } |
|
457 | 457 | |
458 | - /** |
|
459 | - * The default action handler for instances where we do not have access to process. |
|
460 | - */ |
|
461 | - protected function no_access(){ |
|
462 | - $this->view = 'noaccess'; |
|
463 | - } |
|
458 | + /** |
|
459 | + * The default action handler for instances where we do not have access to process. |
|
460 | + */ |
|
461 | + protected function no_access(){ |
|
462 | + $this->view = 'noaccess'; |
|
463 | + } |
|
464 | 464 | |
465 | - /////////////////////////////////////////////// |
|
466 | - /////// HELPER FUNCTIONS |
|
467 | - /////////////////////////////////////////////// |
|
465 | + /////////////////////////////////////////////// |
|
466 | + /////// HELPER FUNCTIONS |
|
467 | + /////////////////////////////////////////////// |
|
468 | 468 | |
469 | - /** |
|
470 | - * Determine if a given function exists on the objects |
|
471 | - * @param function - the function to check |
|
472 | - * @return true if the method exists on the object, false otherwise |
|
473 | - */ |
|
474 | - protected function hasFunction($function){ |
|
475 | - return method_exists($this, $function); |
|
476 | - } |
|
469 | + /** |
|
470 | + * Determine if a given function exists on the objects |
|
471 | + * @param function - the function to check |
|
472 | + * @return true if the method exists on the object, false otherwise |
|
473 | + */ |
|
474 | + protected function hasFunction($function){ |
|
475 | + return method_exists($this, $function); |
|
476 | + } |
|
477 | 477 | |
478 | 478 | |
479 | - /** |
|
480 | - * Set the url to which we will want to redirect |
|
481 | - * |
|
482 | - * @param string url - the url to which we will want to redirect |
|
483 | - */ |
|
484 | - protected function set_redirect($url){ |
|
485 | - $this->redirect_url = $url; |
|
486 | - } |
|
479 | + /** |
|
480 | + * Set the url to which we will want to redirect |
|
481 | + * |
|
482 | + * @param string url - the url to which we will want to redirect |
|
483 | + */ |
|
484 | + protected function set_redirect($url){ |
|
485 | + $this->redirect_url = $url; |
|
486 | + } |
|
487 | 487 | |
488 | - /** |
|
489 | - * Perform redirection based on the redirect_url |
|
490 | - * |
|
491 | - */ |
|
492 | - protected function redirect(){ |
|
488 | + /** |
|
489 | + * Perform redirection based on the redirect_url |
|
490 | + * |
|
491 | + */ |
|
492 | + protected function redirect(){ |
|
493 | 493 | |
494 | - if(!empty($this->redirect_url)) |
|
495 | - SugarApplication::redirect($this->redirect_url); |
|
496 | - } |
|
494 | + if(!empty($this->redirect_url)) |
|
495 | + SugarApplication::redirect($this->redirect_url); |
|
496 | + } |
|
497 | 497 | |
498 | - //////////////////////////////////////////////////////// |
|
499 | - ////// DEFAULT ACTIONS |
|
500 | - /////////////////////////////////////////////////////// |
|
498 | + //////////////////////////////////////////////////////// |
|
499 | + ////// DEFAULT ACTIONS |
|
500 | + /////////////////////////////////////////////////////// |
|
501 | 501 | |
502 | - /* |
|
502 | + /* |
|
503 | 503 | * Save a bean |
504 | 504 | */ |
505 | 505 | |
506 | - /** |
|
507 | - * Do some processing before saving the bean to the database. |
|
508 | - */ |
|
509 | - public function pre_save(){ |
|
510 | - if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
511 | - $this->bean->notify_on_save = true; |
|
512 | - } |
|
513 | - $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
|
506 | + /** |
|
507 | + * Do some processing before saving the bean to the database. |
|
508 | + */ |
|
509 | + public function pre_save(){ |
|
510 | + if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
511 | + $this->bean->notify_on_save = true; |
|
512 | + } |
|
513 | + $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
|
514 | 514 | require_once('include/SugarFields/SugarFieldHandler.php'); |
515 | 515 | $sfh = new SugarFieldHandler(); |
516 | - foreach($this->bean->field_defs as $field => $properties) { |
|
517 | - $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
|
518 | - $sf = $sfh->getSugarField(ucfirst($type), true); |
|
519 | - if(isset($_POST[$field])) { |
|
520 | - if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | - if(empty($_POST[$field][0])) { |
|
522 | - unset($_POST[$field][0]); |
|
523 | - } |
|
524 | - $_POST[$field] = encodeMultienumValue($_POST[$field]); |
|
525 | - } |
|
526 | - $this->bean->$field = $_POST[$field]; |
|
527 | - } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
528 | - $this->bean->$field = ''; |
|
529 | - } |
|
516 | + foreach($this->bean->field_defs as $field => $properties) { |
|
517 | + $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
|
518 | + $sf = $sfh->getSugarField(ucfirst($type), true); |
|
519 | + if(isset($_POST[$field])) { |
|
520 | + if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | + if(empty($_POST[$field][0])) { |
|
522 | + unset($_POST[$field][0]); |
|
523 | + } |
|
524 | + $_POST[$field] = encodeMultienumValue($_POST[$field]); |
|
525 | + } |
|
526 | + $this->bean->$field = $_POST[$field]; |
|
527 | + } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
528 | + $this->bean->$field = ''; |
|
529 | + } |
|
530 | 530 | if($sf != null){ |
531 | 531 | $sf->save($this->bean, $_POST, $field, $properties); |
532 | 532 | } |
533 | - } |
|
534 | - |
|
535 | - foreach($this->bean->relationship_fields as $field=>$link){ |
|
536 | - if(!empty($_POST[$field])){ |
|
537 | - $this->bean->$field = $_POST[$field]; |
|
538 | - } |
|
539 | - } |
|
540 | - if(!$this->bean->ACLAccess('save')){ |
|
541 | - ACLController::displayNoAccess(true); |
|
542 | - sugar_cleanup(true); |
|
543 | - } |
|
544 | - $this->bean->unformat_all_fields(); |
|
545 | - } |
|
533 | + } |
|
546 | 534 | |
547 | - /** |
|
548 | - * Perform the actual save |
|
549 | - */ |
|
550 | - public function action_save(){ |
|
551 | - $this->bean->save(!empty($this->bean->notify_on_save)); |
|
552 | - } |
|
535 | + foreach($this->bean->relationship_fields as $field=>$link){ |
|
536 | + if(!empty($_POST[$field])){ |
|
537 | + $this->bean->$field = $_POST[$field]; |
|
538 | + } |
|
539 | + } |
|
540 | + if(!$this->bean->ACLAccess('save')){ |
|
541 | + ACLController::displayNoAccess(true); |
|
542 | + sugar_cleanup(true); |
|
543 | + } |
|
544 | + $this->bean->unformat_all_fields(); |
|
545 | + } |
|
546 | + |
|
547 | + /** |
|
548 | + * Perform the actual save |
|
549 | + */ |
|
550 | + public function action_save(){ |
|
551 | + $this->bean->save(!empty($this->bean->notify_on_save)); |
|
552 | + } |
|
553 | 553 | |
554 | 554 | |
555 | 555 | public function action_spot() |
@@ -558,43 +558,43 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | |
561 | - /** |
|
562 | - * Specify what happens after the save has occurred. |
|
563 | - */ |
|
564 | - protected function post_save(){ |
|
565 | - $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
|
566 | - $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
|
567 | - $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
|
561 | + /** |
|
562 | + * Specify what happens after the save has occurred. |
|
563 | + */ |
|
564 | + protected function post_save(){ |
|
565 | + $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
|
566 | + $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
|
567 | + $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
|
568 | 568 | |
569 | - $url = "index.php?module=".$module."&action=".$action."&record=".$id; |
|
570 | - $this->set_redirect($url); |
|
571 | - } |
|
569 | + $url = "index.php?module=".$module."&action=".$action."&record=".$id; |
|
570 | + $this->set_redirect($url); |
|
571 | + } |
|
572 | 572 | |
573 | - /* |
|
573 | + /* |
|
574 | 574 | * Delete a bean |
575 | 575 | */ |
576 | 576 | |
577 | - /** |
|
578 | - * Perform the actual deletion. |
|
579 | - */ |
|
580 | - protected function action_delete(){ |
|
581 | - //do any pre delete processing |
|
582 | - //if there is some custom logic for deletion. |
|
583 | - if(!empty($_REQUEST['record'])){ |
|
584 | - if(!$this->bean->ACLAccess('Delete')){ |
|
585 | - ACLController::displayNoAccess(true); |
|
586 | - sugar_cleanup(true); |
|
587 | - } |
|
588 | - $this->bean->mark_deleted($_REQUEST['record']); |
|
589 | - }else{ |
|
590 | - sugar_die("A record number must be specified to delete"); |
|
591 | - } |
|
592 | - } |
|
577 | + /** |
|
578 | + * Perform the actual deletion. |
|
579 | + */ |
|
580 | + protected function action_delete(){ |
|
581 | + //do any pre delete processing |
|
582 | + //if there is some custom logic for deletion. |
|
583 | + if(!empty($_REQUEST['record'])){ |
|
584 | + if(!$this->bean->ACLAccess('Delete')){ |
|
585 | + ACLController::displayNoAccess(true); |
|
586 | + sugar_cleanup(true); |
|
587 | + } |
|
588 | + $this->bean->mark_deleted($_REQUEST['record']); |
|
589 | + }else{ |
|
590 | + sugar_die("A record number must be specified to delete"); |
|
591 | + } |
|
592 | + } |
|
593 | 593 | |
594 | - /** |
|
595 | - * Specify what happens after the deletion has occurred. |
|
596 | - */ |
|
597 | - protected function post_delete(){ |
|
594 | + /** |
|
595 | + * Specify what happens after the deletion has occurred. |
|
596 | + */ |
|
597 | + protected function post_delete(){ |
|
598 | 598 | if (empty($_REQUEST['return_url'])) { |
599 | 599 | $return_module = isset($_REQUEST['return_module']) ? |
600 | 600 | $_REQUEST['return_module'] : |
@@ -610,23 +610,23 @@ discard block |
||
610 | 610 | $url = $_REQUEST['return_url']; |
611 | 611 | } |
612 | 612 | |
613 | - //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
|
614 | - if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
615 | - $url .= "&offset=".$_REQUEST['offset']; |
|
616 | - } |
|
613 | + //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
|
614 | + if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
615 | + $url .= "&offset=".$_REQUEST['offset']; |
|
616 | + } |
|
617 | 617 | |
618 | - $this->set_redirect($url); |
|
619 | - } |
|
620 | - /** |
|
621 | - * Perform the actual massupdate. |
|
622 | - */ |
|
623 | - protected function action_massupdate(){ |
|
624 | - if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
625 | - if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
618 | + $this->set_redirect($url); |
|
619 | + } |
|
620 | + /** |
|
621 | + * Perform the actual massupdate. |
|
622 | + */ |
|
623 | + protected function action_massupdate(){ |
|
624 | + if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
625 | + if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
626 | 626 | || (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){ |
627 | - ACLController::displayNoAccess(true); |
|
628 | - sugar_cleanup(true); |
|
629 | - } |
|
627 | + ACLController::displayNoAccess(true); |
|
628 | + sugar_cleanup(true); |
|
629 | + } |
|
630 | 630 | |
631 | 631 | set_time_limit(0);//I'm wondering if we will set it never goes timeout here. |
632 | 632 | // until we have more efficient way of handling MU, we have to disable the limit |
@@ -652,35 +652,35 @@ discard block |
||
652 | 652 | unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
653 | 653 | $storeQuery->saveFromRequest($_REQUEST['module']); |
654 | 654 | $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
655 | - }else{ |
|
656 | - sugar_die("You must massupdate at least one record"); |
|
657 | - } |
|
658 | - } |
|
659 | - /** |
|
660 | - * Specify what happens after the massupdate has occurred. |
|
661 | - */ |
|
662 | - protected function post_massupdate(){ |
|
663 | - $return_module = isset($_REQUEST['return_module']) ? |
|
664 | - $_REQUEST['return_module'] : |
|
665 | - $GLOBALS['sugar_config']['default_module']; |
|
666 | - $return_action = isset($_REQUEST['return_action']) ? |
|
667 | - $_REQUEST['return_action'] : |
|
668 | - $GLOBALS['sugar_config']['default_action']; |
|
669 | - $url = "index.php?module=".$return_module."&action=".$return_action; |
|
670 | - if($return_module == 'Emails'){//specificly for My Achieves |
|
671 | - if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
672 | - $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
673 | - } |
|
674 | - } |
|
675 | - $this->set_redirect($url); |
|
676 | - } |
|
677 | - /** |
|
678 | - * Perform the listview action |
|
679 | - */ |
|
680 | - protected function action_listview(){ |
|
681 | - $this->view_object_map['bean'] = $this->bean; |
|
682 | - $this->view = 'list'; |
|
683 | - } |
|
655 | + }else{ |
|
656 | + sugar_die("You must massupdate at least one record"); |
|
657 | + } |
|
658 | + } |
|
659 | + /** |
|
660 | + * Specify what happens after the massupdate has occurred. |
|
661 | + */ |
|
662 | + protected function post_massupdate(){ |
|
663 | + $return_module = isset($_REQUEST['return_module']) ? |
|
664 | + $_REQUEST['return_module'] : |
|
665 | + $GLOBALS['sugar_config']['default_module']; |
|
666 | + $return_action = isset($_REQUEST['return_action']) ? |
|
667 | + $_REQUEST['return_action'] : |
|
668 | + $GLOBALS['sugar_config']['default_action']; |
|
669 | + $url = "index.php?module=".$return_module."&action=".$return_action; |
|
670 | + if($return_module == 'Emails'){//specificly for My Achieves |
|
671 | + if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
672 | + $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
673 | + } |
|
674 | + } |
|
675 | + $this->set_redirect($url); |
|
676 | + } |
|
677 | + /** |
|
678 | + * Perform the listview action |
|
679 | + */ |
|
680 | + protected function action_listview(){ |
|
681 | + $this->view_object_map['bean'] = $this->bean; |
|
682 | + $this->view = 'list'; |
|
683 | + } |
|
684 | 684 | |
685 | 685 | /* |
686 | 686 | |
@@ -689,63 +689,63 @@ discard block |
||
689 | 689 | } |
690 | 690 | */ |
691 | 691 | |
692 | - /** |
|
693 | - * Action to handle when using a file as was done in previous versions of Sugar. |
|
694 | - */ |
|
695 | - protected function action_default(){ |
|
696 | - $this->view = 'classic'; |
|
697 | - } |
|
692 | + /** |
|
693 | + * Action to handle when using a file as was done in previous versions of Sugar. |
|
694 | + */ |
|
695 | + protected function action_default(){ |
|
696 | + $this->view = 'classic'; |
|
697 | + } |
|
698 | 698 | |
699 | - /** |
|
700 | - * this method id used within a Dashlet when performing an ajax call |
|
701 | - */ |
|
702 | - protected function action_callmethoddashlet(){ |
|
703 | - if(!empty($_REQUEST['id'])) { |
|
704 | - $id = $_REQUEST['id']; |
|
705 | - $requestedMethod = $_REQUEST['method']; |
|
706 | - $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
|
707 | - if(!empty($dashletDefs[$id])) { |
|
708 | - require_once($dashletDefs[$id]['fileLocation']); |
|
709 | - |
|
710 | - $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
711 | - |
|
712 | - if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
713 | - echo $dashlet->$requestedMethod(); |
|
714 | - } |
|
715 | - else { |
|
716 | - echo 'no method'; |
|
717 | - } |
|
718 | - } |
|
719 | - } |
|
720 | - } |
|
699 | + /** |
|
700 | + * this method id used within a Dashlet when performing an ajax call |
|
701 | + */ |
|
702 | + protected function action_callmethoddashlet(){ |
|
703 | + if(!empty($_REQUEST['id'])) { |
|
704 | + $id = $_REQUEST['id']; |
|
705 | + $requestedMethod = $_REQUEST['method']; |
|
706 | + $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
|
707 | + if(!empty($dashletDefs[$id])) { |
|
708 | + require_once($dashletDefs[$id]['fileLocation']); |
|
709 | + |
|
710 | + $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
711 | + |
|
712 | + if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
713 | + echo $dashlet->$requestedMethod(); |
|
714 | + } |
|
715 | + else { |
|
716 | + echo 'no method'; |
|
717 | + } |
|
718 | + } |
|
719 | + } |
|
720 | + } |
|
721 | 721 | |
722 | - /** |
|
723 | - * this method is used within a Dashlet when the options configuration is posted |
|
724 | - */ |
|
725 | - protected function action_configuredashlet(){ |
|
726 | - global $current_user, $mod_strings; |
|
727 | - |
|
728 | - if(!empty($_REQUEST['id'])) { |
|
729 | - $id = $_REQUEST['id']; |
|
730 | - $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
|
731 | - require_once($dashletDefs[$id]['fileLocation']); |
|
732 | - |
|
733 | - $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
734 | - if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
735 | - $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
|
736 | - $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
|
737 | - } |
|
738 | - else { // display options |
|
739 | - $json = getJSONobj(); |
|
740 | - return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
741 | - 'body' => $dashlet->displayOptions()))); |
|
742 | - |
|
743 | - } |
|
744 | - } |
|
745 | - else { |
|
746 | - return '0'; |
|
747 | - } |
|
748 | - } |
|
722 | + /** |
|
723 | + * this method is used within a Dashlet when the options configuration is posted |
|
724 | + */ |
|
725 | + protected function action_configuredashlet(){ |
|
726 | + global $current_user, $mod_strings; |
|
727 | + |
|
728 | + if(!empty($_REQUEST['id'])) { |
|
729 | + $id = $_REQUEST['id']; |
|
730 | + $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
|
731 | + require_once($dashletDefs[$id]['fileLocation']); |
|
732 | + |
|
733 | + $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
|
734 | + if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
735 | + $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
|
736 | + $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
|
737 | + } |
|
738 | + else { // display options |
|
739 | + $json = getJSONobj(); |
|
740 | + return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
741 | + 'body' => $dashlet->displayOptions()))); |
|
742 | + |
|
743 | + } |
|
744 | + } |
|
745 | + else { |
|
746 | + return '0'; |
|
747 | + } |
|
748 | + } |
|
749 | 749 | |
750 | 750 | /** |
751 | 751 | * Global method to delete an attachment |
@@ -775,84 +775,84 @@ discard block |
||
775 | 775 | sugar_cleanup(true); |
776 | 776 | } |
777 | 777 | |
778 | - /** |
|
779 | - * getActionFilename |
|
780 | - */ |
|
781 | - public static function getActionFilename($action) { |
|
782 | - if(isset(self::$action_case_file[$action])) { |
|
783 | - return self::$action_case_file[$action]; |
|
784 | - } |
|
785 | - return $action; |
|
786 | - } |
|
778 | + /** |
|
779 | + * getActionFilename |
|
780 | + */ |
|
781 | + public static function getActionFilename($action) { |
|
782 | + if(isset(self::$action_case_file[$action])) { |
|
783 | + return self::$action_case_file[$action]; |
|
784 | + } |
|
785 | + return $action; |
|
786 | + } |
|
787 | 787 | |
788 | - /********************************************************************/ |
|
789 | - // PROCESS TASKS |
|
790 | - /********************************************************************/ |
|
788 | + /********************************************************************/ |
|
789 | + // PROCESS TASKS |
|
790 | + /********************************************************************/ |
|
791 | 791 | |
792 | - /** |
|
793 | - * Given the module and action, determine whether the super/admin has prevented access |
|
794 | - * to this url. In addition if any links specified for this module, load the links into |
|
795 | - * GLOBALS |
|
796 | - * |
|
797 | - * @return true if we want to stop processing, false if processing should continue |
|
798 | - */ |
|
799 | - private function blockFileAccess(){ |
|
800 | - //check if the we have enabled file_access_control and if so then check the mappings on the request; |
|
801 | - if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
802 | - $this->loadMapping('file_access_control_map'); |
|
803 | - //since we have this turned on, check the mapping file |
|
804 | - $module = strtolower($this->module); |
|
805 | - $action = strtolower($this->do_action); |
|
806 | - if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
807 | - $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
|
808 | - } |
|
809 | - |
|
810 | - if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
811 | - //check params |
|
812 | - if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
813 | - $block = true; |
|
814 | - $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
|
815 | - foreach($params as $param => $paramVals){ |
|
816 | - if(!empty($_REQUEST[$param])){ |
|
817 | - if(!in_array($_REQUEST[$param], $paramVals)){ |
|
818 | - $block = false; |
|
819 | - break; |
|
820 | - } |
|
821 | - } |
|
822 | - } |
|
823 | - if($block){ |
|
824 | - $this->_processed = true; |
|
825 | - $this->no_access(); |
|
826 | - } |
|
827 | - }else{ |
|
828 | - $this->_processed = true; |
|
829 | - $this->no_access(); |
|
830 | - } |
|
831 | - } |
|
832 | - }else |
|
833 | - $this->_processed = false; |
|
834 | - } |
|
792 | + /** |
|
793 | + * Given the module and action, determine whether the super/admin has prevented access |
|
794 | + * to this url. In addition if any links specified for this module, load the links into |
|
795 | + * GLOBALS |
|
796 | + * |
|
797 | + * @return true if we want to stop processing, false if processing should continue |
|
798 | + */ |
|
799 | + private function blockFileAccess(){ |
|
800 | + //check if the we have enabled file_access_control and if so then check the mappings on the request; |
|
801 | + if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
802 | + $this->loadMapping('file_access_control_map'); |
|
803 | + //since we have this turned on, check the mapping file |
|
804 | + $module = strtolower($this->module); |
|
805 | + $action = strtolower($this->do_action); |
|
806 | + if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
807 | + $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
|
808 | + } |
|
835 | 809 | |
836 | - /** |
|
837 | - * This code is part of the entry points reworking. We have consolidated all |
|
838 | - * entry points to go through index.php. Now in order to bring up an entry point |
|
839 | - * it will follow the format: |
|
840 | - * 'index.php?entryPoint=download' |
|
841 | - * the download entry point is mapped in the following file: entry_point_registry.php |
|
842 | - * |
|
843 | - */ |
|
844 | - private function handleEntryPoint(){ |
|
845 | - if(!empty($_REQUEST['entryPoint'])){ |
|
846 | - $this->loadMapping('entry_point_registry'); |
|
847 | - $entryPoint = $_REQUEST['entryPoint']; |
|
848 | - |
|
849 | - if(!empty($this->entry_point_registry[$entryPoint])){ |
|
850 | - require_once($this->entry_point_registry[$entryPoint]['file']); |
|
851 | - $this->_processed = true; |
|
852 | - $this->view = ''; |
|
853 | - } |
|
854 | - } |
|
855 | - } |
|
810 | + if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
811 | + //check params |
|
812 | + if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
813 | + $block = true; |
|
814 | + $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
|
815 | + foreach($params as $param => $paramVals){ |
|
816 | + if(!empty($_REQUEST[$param])){ |
|
817 | + if(!in_array($_REQUEST[$param], $paramVals)){ |
|
818 | + $block = false; |
|
819 | + break; |
|
820 | + } |
|
821 | + } |
|
822 | + } |
|
823 | + if($block){ |
|
824 | + $this->_processed = true; |
|
825 | + $this->no_access(); |
|
826 | + } |
|
827 | + }else{ |
|
828 | + $this->_processed = true; |
|
829 | + $this->no_access(); |
|
830 | + } |
|
831 | + } |
|
832 | + }else |
|
833 | + $this->_processed = false; |
|
834 | + } |
|
835 | + |
|
836 | + /** |
|
837 | + * This code is part of the entry points reworking. We have consolidated all |
|
838 | + * entry points to go through index.php. Now in order to bring up an entry point |
|
839 | + * it will follow the format: |
|
840 | + * 'index.php?entryPoint=download' |
|
841 | + * the download entry point is mapped in the following file: entry_point_registry.php |
|
842 | + * |
|
843 | + */ |
|
844 | + private function handleEntryPoint(){ |
|
845 | + if(!empty($_REQUEST['entryPoint'])){ |
|
846 | + $this->loadMapping('entry_point_registry'); |
|
847 | + $entryPoint = $_REQUEST['entryPoint']; |
|
848 | + |
|
849 | + if(!empty($this->entry_point_registry[$entryPoint])){ |
|
850 | + require_once($this->entry_point_registry[$entryPoint]['file']); |
|
851 | + $this->_processed = true; |
|
852 | + $this->view = ''; |
|
853 | + } |
|
854 | + } |
|
855 | + } |
|
856 | 856 | |
857 | 857 | /** |
858 | 858 | * Checks to see if the requested entry point requires auth |
@@ -870,67 +870,67 @@ discard block |
||
870 | 870 | return true; |
871 | 871 | } |
872 | 872 | |
873 | - /** |
|
874 | - * Meant to handle old views e.g. DetailView.php. |
|
875 | - * |
|
876 | - */ |
|
877 | - protected function callLegacyCode() |
|
878 | - { |
|
879 | - $file = self::getActionFilename($this->do_action); |
|
880 | - if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
881 | - $action = $this->action_view_map[strtolower($this->do_action)]; |
|
882 | - } |
|
883 | - else { |
|
884 | - $action = $this->do_action; |
|
885 | - } |
|
886 | - // index actions actually maps to the view.list.php view |
|
887 | - if ( $action == 'index' ) { |
|
888 | - $action = 'list'; |
|
889 | - } |
|
890 | - |
|
891 | - if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
873 | + /** |
|
874 | + * Meant to handle old views e.g. DetailView.php. |
|
875 | + * |
|
876 | + */ |
|
877 | + protected function callLegacyCode() |
|
878 | + { |
|
879 | + $file = self::getActionFilename($this->do_action); |
|
880 | + if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
881 | + $action = $this->action_view_map[strtolower($this->do_action)]; |
|
882 | + } |
|
883 | + else { |
|
884 | + $action = $this->do_action; |
|
885 | + } |
|
886 | + // index actions actually maps to the view.list.php view |
|
887 | + if ( $action == 'index' ) { |
|
888 | + $action = 'list'; |
|
889 | + } |
|
890 | + |
|
891 | + if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
892 | 892 | && !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php')) |
893 | 893 | || (file_exists('custom/modules/' . $this->module . '/'. $file . '.php') |
894 | 894 | && !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php')) |
895 | 895 | ) { |
896 | - // A 'classic' module, using the old pre-MVC display files |
|
897 | - // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
|
898 | - unset($GLOBALS['FOCUS']); |
|
899 | - $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
900 | - $this->action_default(); |
|
901 | - $this->_processed = true; |
|
902 | - } |
|
903 | - } |
|
896 | + // A 'classic' module, using the old pre-MVC display files |
|
897 | + // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
|
898 | + unset($GLOBALS['FOCUS']); |
|
899 | + $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
900 | + $this->action_default(); |
|
901 | + $this->_processed = true; |
|
902 | + } |
|
903 | + } |
|
904 | 904 | |
905 | - /** |
|
906 | - * If the action has been remapped to a different action as defined in |
|
907 | - * action_file_map.php or action_view_map.php load those maps here. |
|
908 | - * |
|
909 | - */ |
|
910 | - private function handleActionMaps(){ |
|
911 | - if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
912 | - $this->view = ''; |
|
913 | - $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
914 | - require_once($this->action_file_map[strtolower($this->do_action)]); |
|
915 | - $this->_processed = true; |
|
916 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | - $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
918 | - $this->view = $this->action_view_map[strtolower($this->do_action)]; |
|
919 | - $this->_processed = true; |
|
920 | - }else |
|
921 | - $this->no_action(); |
|
922 | - } |
|
905 | + /** |
|
906 | + * If the action has been remapped to a different action as defined in |
|
907 | + * action_file_map.php or action_view_map.php load those maps here. |
|
908 | + * |
|
909 | + */ |
|
910 | + private function handleActionMaps(){ |
|
911 | + if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
912 | + $this->view = ''; |
|
913 | + $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
914 | + require_once($this->action_file_map[strtolower($this->do_action)]); |
|
915 | + $this->_processed = true; |
|
916 | + }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | + $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
918 | + $this->view = $this->action_view_map[strtolower($this->do_action)]; |
|
919 | + $this->_processed = true; |
|
920 | + }else |
|
921 | + $this->no_action(); |
|
922 | + } |
|
923 | 923 | |
924 | - /** |
|
925 | - * Actually remap the action if required. |
|
926 | - * |
|
927 | - */ |
|
928 | - protected function remapAction(){ |
|
929 | - if(!empty($this->action_remap[$this->do_action])){ |
|
930 | - $this->action = $this->action_remap[$this->do_action]; |
|
931 | - $this->do_action = $this->action; |
|
932 | - } |
|
933 | - } |
|
924 | + /** |
|
925 | + * Actually remap the action if required. |
|
926 | + * |
|
927 | + */ |
|
928 | + protected function remapAction(){ |
|
929 | + if(!empty($this->action_remap[$this->do_action])){ |
|
930 | + $this->action = $this->action_remap[$this->do_action]; |
|
931 | + $this->do_action = $this->action; |
|
932 | + } |
|
933 | + } |
|
934 | 934 | |
935 | 935 | } |
936 | 936 | ?> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * Main SugarCRM controller |
44 | 44 | * @api |
45 | 45 | */ |
46 | -class SugarController{ |
|
46 | +class SugarController { |
|
47 | 47 | /** |
48 | 48 | * remap actions in here |
49 | 49 | * e.g. make all detail views go to edit views |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * Constructor. This ie meant tot load up the module, action, record as well |
163 | 163 | * as the mapping arrays. |
164 | 164 | */ |
165 | - function SugarController(){ |
|
165 | + function SugarController() { |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | * on the controller. |
171 | 171 | * |
172 | 172 | */ |
173 | - public function setup($module = ''){ |
|
174 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
173 | + public function setup($module = '') { |
|
174 | + if (empty($module) && !empty($_REQUEST['module'])) |
|
175 | 175 | $module = $_REQUEST['module']; |
176 | 176 | //set the module |
177 | - if(!empty($module)) |
|
177 | + if (!empty($module)) |
|
178 | 178 | $this->setModule($module); |
179 | 179 | |
180 | - if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
180 | + if (!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
|
181 | 181 | $this->target_module = $_REQUEST['target_module']; |
182 | 182 | } |
183 | 183 | //set properties on the controller from the $_REQUEST |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @param object $module |
192 | 192 | */ |
193 | - public function setModule($module){ |
|
193 | + public function setModule($module) { |
|
194 | 194 | $this->module = $module; |
195 | 195 | } |
196 | 196 | |
@@ -198,18 +198,18 @@ discard block |
||
198 | 198 | * Set properties on the Controller from the $_REQUEST |
199 | 199 | * |
200 | 200 | */ |
201 | - private function loadPropertiesFromRequest(){ |
|
202 | - if(!empty($_REQUEST['action'])) |
|
201 | + private function loadPropertiesFromRequest() { |
|
202 | + if (!empty($_REQUEST['action'])) |
|
203 | 203 | $this->action = $_REQUEST['action']; |
204 | - if(!empty($_REQUEST['record'])) |
|
204 | + if (!empty($_REQUEST['record'])) |
|
205 | 205 | $this->record = $_REQUEST['record']; |
206 | - if(!empty($_REQUEST['view'])) |
|
206 | + if (!empty($_REQUEST['view'])) |
|
207 | 207 | $this->view = $_REQUEST['view']; |
208 | - if(!empty($_REQUEST['return_module'])) |
|
208 | + if (!empty($_REQUEST['return_module'])) |
|
209 | 209 | $this->return_module = $_REQUEST['return_module']; |
210 | - if(!empty($_REQUEST['return_action'])) |
|
210 | + if (!empty($_REQUEST['return_action'])) |
|
211 | 211 | $this->return_action = $_REQUEST['return_action']; |
212 | - if(!empty($_REQUEST['return_id'])) |
|
212 | + if (!empty($_REQUEST['return_id'])) |
|
213 | 213 | $this->return_id = $_REQUEST['return_id']; |
214 | 214 | } |
215 | 215 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * Load map files for use within the Controller |
218 | 218 | * |
219 | 219 | */ |
220 | - private function loadMappings(){ |
|
220 | + private function loadMappings() { |
|
221 | 221 | $this->loadMapping('action_view_map'); |
222 | 222 | $this->loadMapping('action_file_map'); |
223 | 223 | $this->loadMapping('action_remap', true); |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function loadBean() |
230 | 230 | { |
231 | - if(!empty($GLOBALS['beanList'][$this->module])){ |
|
231 | + if (!empty($GLOBALS['beanList'][$this->module])) { |
|
232 | 232 | $class = $GLOBALS['beanList'][$this->module]; |
233 | - if(!empty($GLOBALS['beanFiles'][$class])){ |
|
233 | + if (!empty($GLOBALS['beanFiles'][$class])) { |
|
234 | 234 | require_once($GLOBALS['beanFiles'][$class]); |
235 | 235 | $this->bean = new $class(); |
236 | - if(!empty($this->record)){ |
|
236 | + if (!empty($this->record)) { |
|
237 | 237 | $this->bean->retrieve($this->record); |
238 | - if($this->bean) |
|
238 | + if ($this->bean) |
|
239 | 239 | $GLOBALS['FOCUS'] = $this->bean; |
240 | 240 | } |
241 | 241 | } |
@@ -245,38 +245,38 @@ discard block |
||
245 | 245 | /** |
246 | 246 | * Generic load method to load mapping arrays. |
247 | 247 | */ |
248 | - private function loadMapping($var, $merge = false){ |
|
249 | - $$var = sugar_cache_retrieve("CONTROLLER_". $var . "_".$this->module); |
|
250 | - if(!$$var){ |
|
251 | - if($merge && !empty($this->$var)){ |
|
248 | + private function loadMapping($var, $merge = false) { |
|
249 | + $$var = sugar_cache_retrieve("CONTROLLER_".$var."_".$this->module); |
|
250 | + if (!$$var) { |
|
251 | + if ($merge && !empty($this->$var)) { |
|
252 | 252 | $$var = $this->$var; |
253 | - }else{ |
|
253 | + } else { |
|
254 | 254 | $$var = array(); |
255 | 255 | } |
256 | - if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
|
257 | - require('include/MVC/Controller/'. $var . '.php'); |
|
256 | + if (file_exists('include/MVC/Controller/'.$var.'.php')) { |
|
257 | + require('include/MVC/Controller/'.$var.'.php'); |
|
258 | 258 | } |
259 | - if(file_exists('modules/'.$this->module.'/'. $var . '.php')){ |
|
260 | - require('modules/'.$this->module.'/'. $var . '.php'); |
|
259 | + if (file_exists('modules/'.$this->module.'/'.$var.'.php')) { |
|
260 | + require('modules/'.$this->module.'/'.$var.'.php'); |
|
261 | 261 | } |
262 | - if(file_exists('custom/modules/'.$this->module.'/'. $var . '.php')){ |
|
263 | - require('custom/modules/'.$this->module.'/'. $var . '.php'); |
|
262 | + if (file_exists('custom/modules/'.$this->module.'/'.$var.'.php')) { |
|
263 | + require('custom/modules/'.$this->module.'/'.$var.'.php'); |
|
264 | 264 | } |
265 | - if(file_exists('custom/include/MVC/Controller/'. $var . '.php')){ |
|
266 | - require('custom/include/MVC/Controller/'. $var . '.php'); |
|
265 | + if (file_exists('custom/include/MVC/Controller/'.$var.'.php')) { |
|
266 | + require('custom/include/MVC/Controller/'.$var.'.php'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | // entry_point_registry -> EntryPointRegistry |
270 | 270 | |
271 | - $varname = str_replace(" ","",ucwords(str_replace("_"," ", $var))); |
|
272 | - if(file_exists("custom/application/Ext/$varname/$var.ext.php")){ |
|
271 | + $varname = str_replace(" ", "", ucwords(str_replace("_", " ", $var))); |
|
272 | + if (file_exists("custom/application/Ext/$varname/$var.ext.php")) { |
|
273 | 273 | require("custom/application/Ext/$varname/$var.ext.php"); |
274 | 274 | } |
275 | - if(file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")){ |
|
275 | + if (file_exists("custom/modules/{$this->module}/Ext/$varname/$var.ext.php")) { |
|
276 | 276 | require("custom/modules/{$this->module}/Ext/$varname/$var.ext.php"); |
277 | 277 | } |
278 | 278 | |
279 | - sugar_cache_put("CONTROLLER_". $var . "_".$this->module, $$var); |
|
279 | + sugar_cache_put("CONTROLLER_".$var."_".$this->module, $$var); |
|
280 | 280 | } |
281 | 281 | $this->$var = $$var; |
282 | 282 | } |
@@ -290,11 +290,11 @@ discard block |
||
290 | 290 | try |
291 | 291 | { |
292 | 292 | $this->process(); |
293 | - if(!empty($this->view)) |
|
293 | + if (!empty($this->view)) |
|
294 | 294 | { |
295 | 295 | $this->processView(); |
296 | 296 | } |
297 | - elseif(!empty($this->redirect_url)) |
|
297 | + elseif (!empty($this->redirect_url)) |
|
298 | 298 | { |
299 | 299 | $this->redirect(); |
300 | 300 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | */ |
315 | 315 | protected function handleException(Exception $e) |
316 | 316 | { |
317 | - $GLOBALS['log']->fatal('Exception in Controller: ' . $e->getMessage()); |
|
317 | + $GLOBALS['log']->fatal('Exception in Controller: '.$e->getMessage()); |
|
318 | 318 | $logicHook = new LogicHook(); |
319 | 319 | |
320 | 320 | if (isset($this->bean)) |
@@ -331,18 +331,18 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * Display the appropriate view. |
333 | 333 | */ |
334 | - private function processView(){ |
|
335 | - if(!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
334 | + private function processView() { |
|
335 | + if (!isset($this->view_object_map['remap_action']) && isset($this->action_view_map[strtolower($this->action)])) |
|
336 | 336 | { |
337 | 337 | $this->view_object_map['remap_action'] = $this->action_view_map[strtolower($this->action)]; |
338 | 338 | } |
339 | 339 | $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module); |
340 | 340 | $GLOBALS['current_view'] = $view; |
341 | - if(!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list'){ |
|
341 | + if (!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list') { |
|
342 | 342 | ACLController::displayNoAccess(true); |
343 | 343 | sugar_cleanup(true); |
344 | 344 | } |
345 | - if(isset($this->errors)){ |
|
345 | + if (isset($this->errors)) { |
|
346 | 346 | $view->errors = $this->errors; |
347 | 347 | } |
348 | 348 | $view->process(); |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | * 1) check for file |
362 | 362 | * 2) check for action |
363 | 363 | */ |
364 | - public function process(){ |
|
364 | + public function process() { |
|
365 | 365 | $GLOBALS['action'] = $this->action; |
366 | 366 | $GLOBALS['module'] = $this->module; |
367 | 367 | |
368 | 368 | //check to ensure we have access to the module. |
369 | - if($this->hasAccess){ |
|
369 | + if ($this->hasAccess) { |
|
370 | 370 | $this->do_action = $this->action; |
371 | 371 | |
372 | 372 | $file = self::getActionFilename($this->do_action); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | } |
385 | 385 | |
386 | 386 | $this->redirect(); |
387 | - }else{ |
|
387 | + } else { |
|
388 | 388 | $this->no_access(); |
389 | 389 | } |
390 | 390 | } |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | * false otherwise. This is important b/c if none of these methods exists, then we will run the |
399 | 399 | * action_default() method. |
400 | 400 | */ |
401 | - protected function handle_action(){ |
|
401 | + protected function handle_action() { |
|
402 | 402 | $processed = false; |
403 | - foreach($this->tasks as $task){ |
|
403 | + foreach ($this->tasks as $task) { |
|
404 | 404 | $processed = ($this->$task() || $processed); |
405 | 405 | } |
406 | 406 | $this->_processed = $processed; |
@@ -410,9 +410,9 @@ discard block |
||
410 | 410 | * Perform an action prior to the specified action. |
411 | 411 | * This can be overridde in a sub-class |
412 | 412 | */ |
413 | - private function pre_action(){ |
|
414 | - $function = 'pre_' . $this->action; |
|
415 | - if($this->hasFunction($function)){ |
|
413 | + private function pre_action() { |
|
414 | + $function = 'pre_'.$this->action; |
|
415 | + if ($this->hasFunction($function)) { |
|
416 | 416 | $GLOBALS['log']->debug('Performing pre_action'); |
417 | 417 | $this->$function(); |
418 | 418 | return true; |
@@ -424,9 +424,9 @@ discard block |
||
424 | 424 | * Perform the specified action. |
425 | 425 | * This can be overridde in a sub-class |
426 | 426 | */ |
427 | - private function do_action(){ |
|
428 | - $function = 'action_'. strtolower($this->do_action); |
|
429 | - if($this->hasFunction($function)){ |
|
427 | + private function do_action() { |
|
428 | + $function = 'action_'.strtolower($this->do_action); |
|
429 | + if ($this->hasFunction($function)) { |
|
430 | 430 | $GLOBALS['log']->debug('Performing action: '.$function.' MODULE: '.$this->module); |
431 | 431 | $this->$function(); |
432 | 432 | return true; |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | * Perform an action after to the specified action has occurred. |
439 | 439 | * This can be overridde in a sub-class |
440 | 440 | */ |
441 | - private function post_action(){ |
|
442 | - $function = 'post_' . $this->action; |
|
443 | - if($this->hasFunction($function)){ |
|
441 | + private function post_action() { |
|
442 | + $function = 'post_'.$this->action; |
|
443 | + if ($this->hasFunction($function)) { |
|
444 | 444 | $GLOBALS['log']->debug('Performing post_action'); |
445 | 445 | $this->$function(); |
446 | 446 | return true; |
@@ -451,14 +451,14 @@ discard block |
||
451 | 451 | /** |
452 | 452 | * If there is no action found then display an error to the user. |
453 | 453 | */ |
454 | - protected function no_action(){ |
|
454 | + protected function no_action() { |
|
455 | 455 | sugar_die($GLOBALS['app_strings']['LBL_NO_ACTION']); |
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
459 | 459 | * The default action handler for instances where we do not have access to process. |
460 | 460 | */ |
461 | - protected function no_access(){ |
|
461 | + protected function no_access() { |
|
462 | 462 | $this->view = 'noaccess'; |
463 | 463 | } |
464 | 464 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @param function - the function to check |
472 | 472 | * @return true if the method exists on the object, false otherwise |
473 | 473 | */ |
474 | - protected function hasFunction($function){ |
|
474 | + protected function hasFunction($function) { |
|
475 | 475 | return method_exists($this, $function); |
476 | 476 | } |
477 | 477 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @param string url - the url to which we will want to redirect |
483 | 483 | */ |
484 | - protected function set_redirect($url){ |
|
484 | + protected function set_redirect($url) { |
|
485 | 485 | $this->redirect_url = $url; |
486 | 486 | } |
487 | 487 | |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | * Perform redirection based on the redirect_url |
490 | 490 | * |
491 | 491 | */ |
492 | - protected function redirect(){ |
|
492 | + protected function redirect() { |
|
493 | 493 | |
494 | - if(!empty($this->redirect_url)) |
|
494 | + if (!empty($this->redirect_url)) |
|
495 | 495 | SugarApplication::redirect($this->redirect_url); |
496 | 496 | } |
497 | 497 | |
@@ -506,38 +506,38 @@ discard block |
||
506 | 506 | /** |
507 | 507 | * Do some processing before saving the bean to the database. |
508 | 508 | */ |
509 | - public function pre_save(){ |
|
510 | - if(!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])){ |
|
509 | + public function pre_save() { |
|
510 | + if (!empty($_POST['assigned_user_id']) && $_POST['assigned_user_id'] != $this->bean->assigned_user_id && $_POST['assigned_user_id'] != $GLOBALS['current_user']->id && empty($GLOBALS['sugar_config']['exclude_notifications'][$this->bean->module_dir])) { |
|
511 | 511 | $this->bean->notify_on_save = true; |
512 | 512 | } |
513 | 513 | $GLOBALS['log']->debug("SugarController:: performing pre_save."); |
514 | 514 | require_once('include/SugarFields/SugarFieldHandler.php'); |
515 | 515 | $sfh = new SugarFieldHandler(); |
516 | - foreach($this->bean->field_defs as $field => $properties) { |
|
516 | + foreach ($this->bean->field_defs as $field => $properties) { |
|
517 | 517 | $type = !empty($properties['custom_type']) ? $properties['custom_type'] : $properties['type']; |
518 | 518 | $sf = $sfh->getSugarField(ucfirst($type), true); |
519 | - if(isset($_POST[$field])) { |
|
520 | - if(is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | - if(empty($_POST[$field][0])) { |
|
519 | + if (isset($_POST[$field])) { |
|
520 | + if (is_array($_POST[$field]) && !empty($properties['isMultiSelect'])) { |
|
521 | + if (empty($_POST[$field][0])) { |
|
522 | 522 | unset($_POST[$field][0]); |
523 | 523 | } |
524 | 524 | $_POST[$field] = encodeMultienumValue($_POST[$field]); |
525 | 525 | } |
526 | 526 | $this->bean->$field = $_POST[$field]; |
527 | - } else if(!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field . '_multiselect'])) { |
|
527 | + } else if (!empty($properties['isMultiSelect']) && !isset($_POST[$field]) && isset($_POST[$field.'_multiselect'])) { |
|
528 | 528 | $this->bean->$field = ''; |
529 | 529 | } |
530 | - if($sf != null){ |
|
530 | + if ($sf != null) { |
|
531 | 531 | $sf->save($this->bean, $_POST, $field, $properties); |
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
535 | - foreach($this->bean->relationship_fields as $field=>$link){ |
|
536 | - if(!empty($_POST[$field])){ |
|
535 | + foreach ($this->bean->relationship_fields as $field=>$link) { |
|
536 | + if (!empty($_POST[$field])) { |
|
537 | 537 | $this->bean->$field = $_POST[$field]; |
538 | 538 | } |
539 | 539 | } |
540 | - if(!$this->bean->ACLAccess('save')){ |
|
540 | + if (!$this->bean->ACLAccess('save')) { |
|
541 | 541 | ACLController::displayNoAccess(true); |
542 | 542 | sugar_cleanup(true); |
543 | 543 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * Perform the actual save |
549 | 549 | */ |
550 | - public function action_save(){ |
|
550 | + public function action_save() { |
|
551 | 551 | $this->bean->save(!empty($this->bean->notify_on_save)); |
552 | 552 | } |
553 | 553 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | /** |
562 | 562 | * Specify what happens after the save has occurred. |
563 | 563 | */ |
564 | - protected function post_save(){ |
|
564 | + protected function post_save() { |
|
565 | 565 | $module = (!empty($this->return_module) ? $this->return_module : $this->module); |
566 | 566 | $action = (!empty($this->return_action) ? $this->return_action : 'DetailView'); |
567 | 567 | $id = (!empty($this->return_id) ? $this->return_id : $this->bean->id); |
@@ -577,16 +577,16 @@ discard block |
||
577 | 577 | /** |
578 | 578 | * Perform the actual deletion. |
579 | 579 | */ |
580 | - protected function action_delete(){ |
|
580 | + protected function action_delete() { |
|
581 | 581 | //do any pre delete processing |
582 | 582 | //if there is some custom logic for deletion. |
583 | - if(!empty($_REQUEST['record'])){ |
|
584 | - if(!$this->bean->ACLAccess('Delete')){ |
|
583 | + if (!empty($_REQUEST['record'])) { |
|
584 | + if (!$this->bean->ACLAccess('Delete')) { |
|
585 | 585 | ACLController::displayNoAccess(true); |
586 | 586 | sugar_cleanup(true); |
587 | 587 | } |
588 | 588 | $this->bean->mark_deleted($_REQUEST['record']); |
589 | - }else{ |
|
589 | + } else { |
|
590 | 590 | sugar_die("A record number must be specified to delete"); |
591 | 591 | } |
592 | 592 | } |
@@ -594,24 +594,21 @@ discard block |
||
594 | 594 | /** |
595 | 595 | * Specify what happens after the deletion has occurred. |
596 | 596 | */ |
597 | - protected function post_delete(){ |
|
597 | + protected function post_delete() { |
|
598 | 598 | if (empty($_REQUEST['return_url'])) { |
599 | 599 | $return_module = isset($_REQUEST['return_module']) ? |
600 | - $_REQUEST['return_module'] : |
|
601 | - $GLOBALS['sugar_config']['default_module']; |
|
600 | + $_REQUEST['return_module'] : $GLOBALS['sugar_config']['default_module']; |
|
602 | 601 | $return_action = isset($_REQUEST['return_action']) ? |
603 | - $_REQUEST['return_action'] : |
|
604 | - $GLOBALS['sugar_config']['default_action']; |
|
602 | + $_REQUEST['return_action'] : $GLOBALS['sugar_config']['default_action']; |
|
605 | 603 | $return_id = isset($_REQUEST['return_id']) ? |
606 | - $_REQUEST['return_id'] : |
|
607 | - ''; |
|
604 | + $_REQUEST['return_id'] : ''; |
|
608 | 605 | $url = "index.php?module=".$return_module."&action=".$return_action."&record=".$return_id; |
609 | 606 | } else { |
610 | 607 | $url = $_REQUEST['return_url']; |
611 | 608 | } |
612 | 609 | |
613 | 610 | //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. |
614 | - if(isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
611 | + if (isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { |
|
615 | 612 | $url .= "&offset=".$_REQUEST['offset']; |
616 | 613 | } |
617 | 614 | |
@@ -620,15 +617,15 @@ discard block |
||
620 | 617 | /** |
621 | 618 | * Perform the actual massupdate. |
622 | 619 | */ |
623 | - protected function action_massupdate(){ |
|
624 | - if(!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))){ |
|
625 | - if(!empty($_REQUEST['Delete']) && $_REQUEST['Delete']=='true' && !$this->bean->ACLAccess('delete') |
|
626 | - || (empty($_REQUEST['Delete']) || $_REQUEST['Delete']!='true') && !$this->bean->ACLAccess('save')){ |
|
620 | + protected function action_massupdate() { |
|
621 | + if (!empty($_REQUEST['massupdate']) && $_REQUEST['massupdate'] == 'true' && (!empty($_REQUEST['uid']) || !empty($_REQUEST['entire']))) { |
|
622 | + if (!empty($_REQUEST['Delete']) && $_REQUEST['Delete'] == 'true' && !$this->bean->ACLAccess('delete') |
|
623 | + || (empty($_REQUEST['Delete']) || $_REQUEST['Delete'] != 'true') && !$this->bean->ACLAccess('save')) { |
|
627 | 624 | ACLController::displayNoAccess(true); |
628 | 625 | sugar_cleanup(true); |
629 | 626 | } |
630 | 627 | |
631 | - set_time_limit(0);//I'm wondering if we will set it never goes timeout here. |
|
628 | + set_time_limit(0); //I'm wondering if we will set it never goes timeout here. |
|
632 | 629 | // until we have more efficient way of handling MU, we have to disable the limit |
633 | 630 | $GLOBALS['db']->setQueryLimit(0); |
634 | 631 | require_once("include/MassUpdate.php"); |
@@ -636,40 +633,38 @@ discard block |
||
636 | 633 | $seed = loadBean($_REQUEST['module']); |
637 | 634 | $mass = new MassUpdate(); |
638 | 635 | $mass->setSugarBean($seed); |
639 | - if(isset($_REQUEST['entire']) && empty($_POST['mass'])) { |
|
636 | + if (isset($_REQUEST['entire']) && empty($_POST['mass'])) { |
|
640 | 637 | $mass->generateSearchWhere($_REQUEST['module'], $_REQUEST['current_query_by_page']); |
641 | 638 | } |
642 | 639 | $mass->handleMassUpdate(); |
643 | - $storeQuery = new StoreQuery();//restore the current search. to solve bug 24722 for multi tabs massupdate. |
|
640 | + $storeQuery = new StoreQuery(); //restore the current search. to solve bug 24722 for multi tabs massupdate. |
|
644 | 641 | $temp_req = array('current_query_by_page' => $_REQUEST['current_query_by_page'], 'return_module' => $_REQUEST['return_module'], 'return_action' => $_REQUEST['return_action']); |
645 | - if($_REQUEST['return_module'] == 'Emails') { |
|
646 | - if(!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) { |
|
642 | + if ($_REQUEST['return_module'] == 'Emails') { |
|
643 | + if (!empty($_REQUEST['type']) && !empty($_REQUEST['ie_assigned_user_id'])) { |
|
647 | 644 | $this->req_for_email = array('type' => $_REQUEST['type'], 'ie_assigned_user_id' => $_REQUEST['ie_assigned_user_id']); // Specifically for My Achieves |
648 | 645 | } |
649 | 646 | } |
650 | 647 | $_REQUEST = array(); |
651 | 648 | $_REQUEST = unserialize(base64_decode($temp_req['current_query_by_page'])); |
652 | - unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
|
649 | + unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']); //after massupdate, the page should redirect to no offset page |
|
653 | 650 | $storeQuery->saveFromRequest($_REQUEST['module']); |
654 | - $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
|
655 | - }else{ |
|
651 | + $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']); //for post_massupdate, to go back to original page. |
|
652 | + } else { |
|
656 | 653 | sugar_die("You must massupdate at least one record"); |
657 | 654 | } |
658 | 655 | } |
659 | 656 | /** |
660 | 657 | * Specify what happens after the massupdate has occurred. |
661 | 658 | */ |
662 | - protected function post_massupdate(){ |
|
659 | + protected function post_massupdate() { |
|
663 | 660 | $return_module = isset($_REQUEST['return_module']) ? |
664 | - $_REQUEST['return_module'] : |
|
665 | - $GLOBALS['sugar_config']['default_module']; |
|
661 | + $_REQUEST['return_module'] : $GLOBALS['sugar_config']['default_module']; |
|
666 | 662 | $return_action = isset($_REQUEST['return_action']) ? |
667 | - $_REQUEST['return_action'] : |
|
668 | - $GLOBALS['sugar_config']['default_action']; |
|
663 | + $_REQUEST['return_action'] : $GLOBALS['sugar_config']['default_action']; |
|
669 | 664 | $url = "index.php?module=".$return_module."&action=".$return_action; |
670 | - if($return_module == 'Emails'){//specificly for My Achieves |
|
671 | - if(!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
672 | - $url = $url . "&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
665 | + if ($return_module == 'Emails') {//specificly for My Achieves |
|
666 | + if (!empty($this->req_for_email['type']) && !empty($this->req_for_email['ie_assigned_user_id'])) { |
|
667 | + $url = $url."&type=".$this->req_for_email['type']."&assigned_user_id=".$this->req_for_email['ie_assigned_user_id']; |
|
673 | 668 | } |
674 | 669 | } |
675 | 670 | $this->set_redirect($url); |
@@ -677,7 +672,7 @@ discard block |
||
677 | 672 | /** |
678 | 673 | * Perform the listview action |
679 | 674 | */ |
680 | - protected function action_listview(){ |
|
675 | + protected function action_listview() { |
|
681 | 676 | $this->view_object_map['bean'] = $this->bean; |
682 | 677 | $this->view = 'list'; |
683 | 678 | } |
@@ -692,24 +687,24 @@ discard block |
||
692 | 687 | /** |
693 | 688 | * Action to handle when using a file as was done in previous versions of Sugar. |
694 | 689 | */ |
695 | - protected function action_default(){ |
|
690 | + protected function action_default() { |
|
696 | 691 | $this->view = 'classic'; |
697 | 692 | } |
698 | 693 | |
699 | 694 | /** |
700 | 695 | * this method id used within a Dashlet when performing an ajax call |
701 | 696 | */ |
702 | - protected function action_callmethoddashlet(){ |
|
703 | - if(!empty($_REQUEST['id'])) { |
|
697 | + protected function action_callmethoddashlet() { |
|
698 | + if (!empty($_REQUEST['id'])) { |
|
704 | 699 | $id = $_REQUEST['id']; |
705 | 700 | $requestedMethod = $_REQUEST['method']; |
706 | 701 | $dashletDefs = $GLOBALS['current_user']->getPreference('dashlets', 'Home'); // load user's dashlets config |
707 | - if(!empty($dashletDefs[$id])) { |
|
702 | + if (!empty($dashletDefs[$id])) { |
|
708 | 703 | require_once($dashletDefs[$id]['fileLocation']); |
709 | 704 | |
710 | 705 | $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
711 | 706 | |
712 | - if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
707 | + if (method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
|
713 | 708 | echo $dashlet->$requestedMethod(); |
714 | 709 | } |
715 | 710 | else { |
@@ -722,22 +717,22 @@ discard block |
||
722 | 717 | /** |
723 | 718 | * this method is used within a Dashlet when the options configuration is posted |
724 | 719 | */ |
725 | - protected function action_configuredashlet(){ |
|
720 | + protected function action_configuredashlet() { |
|
726 | 721 | global $current_user, $mod_strings; |
727 | 722 | |
728 | - if(!empty($_REQUEST['id'])) { |
|
723 | + if (!empty($_REQUEST['id'])) { |
|
729 | 724 | $id = $_REQUEST['id']; |
730 | 725 | $dashletDefs = $current_user->getPreference('dashlets', $_REQUEST['module']); // load user's dashlets config |
731 | 726 | require_once($dashletDefs[$id]['fileLocation']); |
732 | 727 | |
733 | 728 | $dashlet = new $dashletDefs[$id]['className']($id, (isset($dashletDefs[$id]['options']) ? $dashletDefs[$id]['options'] : array())); |
734 | - if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
729 | + if (!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
|
735 | 730 | $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
736 | 731 | $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
737 | 732 | } |
738 | 733 | else { // display options |
739 | 734 | $json = getJSONobj(); |
740 | - return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
|
735 | + return 'result = '.$json->encode((array('header' => $dashlet->title.' : '.$mod_strings['LBL_OPTIONS'], |
|
741 | 736 | 'body' => $dashlet->displayOptions()))); |
742 | 737 | |
743 | 738 | } |
@@ -761,7 +756,7 @@ discard block |
||
761 | 756 | ob_clean(); |
762 | 757 | $retval = false; |
763 | 758 | |
764 | - if(method_exists($this->bean, 'deleteAttachment')) { |
|
759 | + if (method_exists($this->bean, 'deleteAttachment')) { |
|
765 | 760 | $duplicate = "false"; |
766 | 761 | if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == "true") { |
767 | 762 | $duplicate = "true"; |
@@ -779,7 +774,7 @@ discard block |
||
779 | 774 | * getActionFilename |
780 | 775 | */ |
781 | 776 | public static function getActionFilename($action) { |
782 | - if(isset(self::$action_case_file[$action])) { |
|
777 | + if (isset(self::$action_case_file[$action])) { |
|
783 | 778 | return self::$action_case_file[$action]; |
784 | 779 | } |
785 | 780 | return $action; |
@@ -796,40 +791,40 @@ discard block |
||
796 | 791 | * |
797 | 792 | * @return true if we want to stop processing, false if processing should continue |
798 | 793 | */ |
799 | - private function blockFileAccess(){ |
|
794 | + private function blockFileAccess() { |
|
800 | 795 | //check if the we have enabled file_access_control and if so then check the mappings on the request; |
801 | - if(!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']){ |
|
796 | + if (!empty($GLOBALS['sugar_config']['admin_access_control']) && $GLOBALS['sugar_config']['admin_access_control']) { |
|
802 | 797 | $this->loadMapping('file_access_control_map'); |
803 | 798 | //since we have this turned on, check the mapping file |
804 | 799 | $module = strtolower($this->module); |
805 | 800 | $action = strtolower($this->do_action); |
806 | - if(!empty($this->file_access_control_map['modules'][$module]['links'])){ |
|
801 | + if (!empty($this->file_access_control_map['modules'][$module]['links'])) { |
|
807 | 802 | $GLOBALS['admin_access_control_links'] = $this->file_access_control_map['modules'][$module]['links']; |
808 | 803 | } |
809 | 804 | |
810 | - if(!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))){ |
|
805 | + if (!empty($this->file_access_control_map['modules'][$module]['actions']) && (in_array($action, $this->file_access_control_map['modules'][$module]['actions']) || !empty($this->file_access_control_map['modules'][$module]['actions'][$action]))) { |
|
811 | 806 | //check params |
812 | - if(!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])){ |
|
807 | + if (!empty($this->file_access_control_map['modules'][$module]['actions'][$action]['params'])) { |
|
813 | 808 | $block = true; |
814 | 809 | $params = $this->file_access_control_map['modules'][$module]['actions'][$action]['params']; |
815 | - foreach($params as $param => $paramVals){ |
|
816 | - if(!empty($_REQUEST[$param])){ |
|
817 | - if(!in_array($_REQUEST[$param], $paramVals)){ |
|
810 | + foreach ($params as $param => $paramVals) { |
|
811 | + if (!empty($_REQUEST[$param])) { |
|
812 | + if (!in_array($_REQUEST[$param], $paramVals)) { |
|
818 | 813 | $block = false; |
819 | 814 | break; |
820 | 815 | } |
821 | 816 | } |
822 | 817 | } |
823 | - if($block){ |
|
818 | + if ($block) { |
|
824 | 819 | $this->_processed = true; |
825 | 820 | $this->no_access(); |
826 | 821 | } |
827 | - }else{ |
|
822 | + } else { |
|
828 | 823 | $this->_processed = true; |
829 | 824 | $this->no_access(); |
830 | 825 | } |
831 | 826 | } |
832 | - }else |
|
827 | + } else |
|
833 | 828 | $this->_processed = false; |
834 | 829 | } |
835 | 830 | |
@@ -841,12 +836,12 @@ discard block |
||
841 | 836 | * the download entry point is mapped in the following file: entry_point_registry.php |
842 | 837 | * |
843 | 838 | */ |
844 | - private function handleEntryPoint(){ |
|
845 | - if(!empty($_REQUEST['entryPoint'])){ |
|
839 | + private function handleEntryPoint() { |
|
840 | + if (!empty($_REQUEST['entryPoint'])) { |
|
846 | 841 | $this->loadMapping('entry_point_registry'); |
847 | 842 | $entryPoint = $_REQUEST['entryPoint']; |
848 | 843 | |
849 | - if(!empty($this->entry_point_registry[$entryPoint])){ |
|
844 | + if (!empty($this->entry_point_registry[$entryPoint])) { |
|
850 | 845 | require_once($this->entry_point_registry[$entryPoint]['file']); |
851 | 846 | $this->_processed = true; |
852 | 847 | $this->view = ''; |
@@ -864,8 +859,8 @@ discard block |
||
864 | 859 | { |
865 | 860 | $this->loadMapping('entry_point_registry'); |
866 | 861 | |
867 | - if ( isset($this->entry_point_registry[$entryPoint]['auth']) |
|
868 | - && !$this->entry_point_registry[$entryPoint]['auth'] ) |
|
862 | + if (isset($this->entry_point_registry[$entryPoint]['auth']) |
|
863 | + && !$this->entry_point_registry[$entryPoint]['auth']) |
|
869 | 864 | return false; |
870 | 865 | return true; |
871 | 866 | } |
@@ -877,26 +872,26 @@ discard block |
||
877 | 872 | protected function callLegacyCode() |
878 | 873 | { |
879 | 874 | $file = self::getActionFilename($this->do_action); |
880 | - if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
|
875 | + if (isset($this->action_view_map[strtolower($this->do_action)])) { |
|
881 | 876 | $action = $this->action_view_map[strtolower($this->do_action)]; |
882 | 877 | } |
883 | 878 | else { |
884 | 879 | $action = $this->do_action; |
885 | 880 | } |
886 | 881 | // index actions actually maps to the view.list.php view |
887 | - if ( $action == 'index' ) { |
|
882 | + if ($action == 'index') { |
|
888 | 883 | $action = 'list'; |
889 | 884 | } |
890 | 885 | |
891 | - if ((file_exists('modules/' . $this->module . '/'. $file . '.php') |
|
892 | - && !file_exists('modules/' . $this->module . '/views/view.'. $action . '.php')) |
|
893 | - || (file_exists('custom/modules/' . $this->module . '/'. $file . '.php') |
|
894 | - && !file_exists('custom/modules/' . $this->module . '/views/view.'. $action . '.php')) |
|
886 | + if ((file_exists('modules/'.$this->module.'/'.$file.'.php') |
|
887 | + && !file_exists('modules/'.$this->module.'/views/view.'.$action.'.php')) |
|
888 | + || (file_exists('custom/modules/'.$this->module.'/'.$file.'.php') |
|
889 | + && !file_exists('custom/modules/'.$this->module.'/views/view.'.$action.'.php')) |
|
895 | 890 | ) { |
896 | 891 | // A 'classic' module, using the old pre-MVC display files |
897 | 892 | // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own |
898 | 893 | unset($GLOBALS['FOCUS']); |
899 | - $GLOBALS['log']->debug('Module:' . $this->module . ' using file: '. $file); |
|
894 | + $GLOBALS['log']->debug('Module:'.$this->module.' using file: '.$file); |
|
900 | 895 | $this->action_default(); |
901 | 896 | $this->_processed = true; |
902 | 897 | } |
@@ -907,17 +902,17 @@ discard block |
||
907 | 902 | * action_file_map.php or action_view_map.php load those maps here. |
908 | 903 | * |
909 | 904 | */ |
910 | - private function handleActionMaps(){ |
|
911 | - if(!empty($this->action_file_map[strtolower($this->do_action)])){ |
|
905 | + private function handleActionMaps() { |
|
906 | + if (!empty($this->action_file_map[strtolower($this->do_action)])) { |
|
912 | 907 | $this->view = ''; |
913 | - $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
|
908 | + $GLOBALS['log']->debug('Using Action File Map:'.$this->action_file_map[strtolower($this->do_action)]); |
|
914 | 909 | require_once($this->action_file_map[strtolower($this->do_action)]); |
915 | 910 | $this->_processed = true; |
916 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | - $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
|
911 | + }elseif (!empty($this->action_view_map[strtolower($this->do_action)])) { |
|
912 | + $GLOBALS['log']->debug('Using Action View Map:'.$this->action_view_map[strtolower($this->do_action)]); |
|
918 | 913 | $this->view = $this->action_view_map[strtolower($this->do_action)]; |
919 | 914 | $this->_processed = true; |
920 | - }else |
|
915 | + } else |
|
921 | 916 | $this->no_action(); |
922 | 917 | } |
923 | 918 | |
@@ -925,8 +920,8 @@ discard block |
||
925 | 920 | * Actually remap the action if required. |
926 | 921 | * |
927 | 922 | */ |
928 | - protected function remapAction(){ |
|
929 | - if(!empty($this->action_remap[$this->do_action])){ |
|
923 | + protected function remapAction() { |
|
924 | + if (!empty($this->action_remap[$this->do_action])) { |
|
930 | 925 | $this->action = $this->action_remap[$this->do_action]; |
931 | 926 | $this->do_action = $this->action; |
932 | 927 | } |
@@ -171,11 +171,13 @@ discard block |
||
171 | 171 | * |
172 | 172 | */ |
173 | 173 | public function setup($module = ''){ |
174 | - if(empty($module) && !empty($_REQUEST['module'])) |
|
175 | - $module = $_REQUEST['module']; |
|
174 | + if(empty($module) && !empty($_REQUEST['module'])) { |
|
175 | + $module = $_REQUEST['module']; |
|
176 | + } |
|
176 | 177 | //set the module |
177 | - if(!empty($module)) |
|
178 | - $this->setModule($module); |
|
178 | + if(!empty($module)) { |
|
179 | + $this->setModule($module); |
|
180 | + } |
|
179 | 181 | |
180 | 182 | if(!empty($_REQUEST['target_module']) && $_REQUEST['target_module'] != 'undefined') { |
181 | 183 | $this->target_module = $_REQUEST['target_module']; |
@@ -199,18 +201,24 @@ discard block |
||
199 | 201 | * |
200 | 202 | */ |
201 | 203 | private function loadPropertiesFromRequest(){ |
202 | - if(!empty($_REQUEST['action'])) |
|
203 | - $this->action = $_REQUEST['action']; |
|
204 | - if(!empty($_REQUEST['record'])) |
|
205 | - $this->record = $_REQUEST['record']; |
|
206 | - if(!empty($_REQUEST['view'])) |
|
207 | - $this->view = $_REQUEST['view']; |
|
208 | - if(!empty($_REQUEST['return_module'])) |
|
209 | - $this->return_module = $_REQUEST['return_module']; |
|
210 | - if(!empty($_REQUEST['return_action'])) |
|
211 | - $this->return_action = $_REQUEST['return_action']; |
|
212 | - if(!empty($_REQUEST['return_id'])) |
|
213 | - $this->return_id = $_REQUEST['return_id']; |
|
204 | + if(!empty($_REQUEST['action'])) { |
|
205 | + $this->action = $_REQUEST['action']; |
|
206 | + } |
|
207 | + if(!empty($_REQUEST['record'])) { |
|
208 | + $this->record = $_REQUEST['record']; |
|
209 | + } |
|
210 | + if(!empty($_REQUEST['view'])) { |
|
211 | + $this->view = $_REQUEST['view']; |
|
212 | + } |
|
213 | + if(!empty($_REQUEST['return_module'])) { |
|
214 | + $this->return_module = $_REQUEST['return_module']; |
|
215 | + } |
|
216 | + if(!empty($_REQUEST['return_action'])) { |
|
217 | + $this->return_action = $_REQUEST['return_action']; |
|
218 | + } |
|
219 | + if(!empty($_REQUEST['return_id'])) { |
|
220 | + $this->return_id = $_REQUEST['return_id']; |
|
221 | + } |
|
214 | 222 | } |
215 | 223 | |
216 | 224 | /** |
@@ -235,8 +243,9 @@ discard block |
||
235 | 243 | $this->bean = new $class(); |
236 | 244 | if(!empty($this->record)){ |
237 | 245 | $this->bean->retrieve($this->record); |
238 | - if($this->bean) |
|
239 | - $GLOBALS['FOCUS'] = $this->bean; |
|
246 | + if($this->bean) { |
|
247 | + $GLOBALS['FOCUS'] = $this->bean; |
|
248 | + } |
|
240 | 249 | } |
241 | 250 | } |
242 | 251 | } |
@@ -250,7 +259,7 @@ discard block |
||
250 | 259 | if(!$$var){ |
251 | 260 | if($merge && !empty($this->$var)){ |
252 | 261 | $$var = $this->$var; |
253 | - }else{ |
|
262 | + } else{ |
|
254 | 263 | $$var = array(); |
255 | 264 | } |
256 | 265 | if(file_exists('include/MVC/Controller/'. $var . '.php')){ |
@@ -293,13 +302,11 @@ discard block |
||
293 | 302 | if(!empty($this->view)) |
294 | 303 | { |
295 | 304 | $this->processView(); |
296 | - } |
|
297 | - elseif(!empty($this->redirect_url)) |
|
305 | + } elseif(!empty($this->redirect_url)) |
|
298 | 306 | { |
299 | 307 | $this->redirect(); |
300 | 308 | } |
301 | - } |
|
302 | - catch (Exception $e) |
|
309 | + } catch (Exception $e) |
|
303 | 310 | { |
304 | 311 | $this->handleException($e); |
305 | 312 | } |
@@ -321,8 +328,7 @@ discard block |
||
321 | 328 | { |
322 | 329 | $logicHook->setBean($this->bean); |
323 | 330 | $logicHook->call_custom_logic($this->bean->module_dir, "handle_exception", $e); |
324 | - } |
|
325 | - else |
|
331 | + } else |
|
326 | 332 | { |
327 | 333 | $logicHook->call_custom_logic('', "handle_exception", $e); |
328 | 334 | } |
@@ -384,7 +390,7 @@ discard block |
||
384 | 390 | } |
385 | 391 | |
386 | 392 | $this->redirect(); |
387 | - }else{ |
|
393 | + } else{ |
|
388 | 394 | $this->no_access(); |
389 | 395 | } |
390 | 396 | } |
@@ -491,8 +497,9 @@ discard block |
||
491 | 497 | */ |
492 | 498 | protected function redirect(){ |
493 | 499 | |
494 | - if(!empty($this->redirect_url)) |
|
495 | - SugarApplication::redirect($this->redirect_url); |
|
500 | + if(!empty($this->redirect_url)) { |
|
501 | + SugarApplication::redirect($this->redirect_url); |
|
502 | + } |
|
496 | 503 | } |
497 | 504 | |
498 | 505 | //////////////////////////////////////////////////////// |
@@ -586,7 +593,7 @@ discard block |
||
586 | 593 | sugar_cleanup(true); |
587 | 594 | } |
588 | 595 | $this->bean->mark_deleted($_REQUEST['record']); |
589 | - }else{ |
|
596 | + } else{ |
|
590 | 597 | sugar_die("A record number must be specified to delete"); |
591 | 598 | } |
592 | 599 | } |
@@ -652,7 +659,7 @@ discard block |
||
652 | 659 | unset($_REQUEST[$seed->module_dir.'2_'.strtoupper($seed->object_name).'_offset']);//after massupdate, the page should redirect to no offset page |
653 | 660 | $storeQuery->saveFromRequest($_REQUEST['module']); |
654 | 661 | $_REQUEST = array('return_module' => $temp_req['return_module'], 'return_action' => $temp_req['return_action']);//for post_massupdate, to go back to original page. |
655 | - }else{ |
|
662 | + } else{ |
|
656 | 663 | sugar_die("You must massupdate at least one record"); |
657 | 664 | } |
658 | 665 | } |
@@ -711,8 +718,7 @@ discard block |
||
711 | 718 | |
712 | 719 | if(method_exists($dashlet, $requestedMethod) || method_exists($dashlet, '__call')) { |
713 | 720 | echo $dashlet->$requestedMethod(); |
714 | - } |
|
715 | - else { |
|
721 | + } else { |
|
716 | 722 | echo 'no method'; |
717 | 723 | } |
718 | 724 | } |
@@ -734,15 +740,13 @@ discard block |
||
734 | 740 | if(!empty($_REQUEST['configure']) && $_REQUEST['configure']) { // save settings |
735 | 741 | $dashletDefs[$id]['options'] = $dashlet->saveOptions($_REQUEST); |
736 | 742 | $current_user->setPreference('dashlets', $dashletDefs, 0, $_REQUEST['module']); |
737 | - } |
|
738 | - else { // display options |
|
743 | + } else { // display options |
|
739 | 744 | $json = getJSONobj(); |
740 | 745 | return 'result = ' . $json->encode((array('header' => $dashlet->title . ' : ' . $mod_strings['LBL_OPTIONS'], |
741 | 746 | 'body' => $dashlet->displayOptions()))); |
742 | 747 | |
743 | 748 | } |
744 | - } |
|
745 | - else { |
|
749 | + } else { |
|
746 | 750 | return '0'; |
747 | 751 | } |
748 | 752 | } |
@@ -824,13 +828,14 @@ discard block |
||
824 | 828 | $this->_processed = true; |
825 | 829 | $this->no_access(); |
826 | 830 | } |
827 | - }else{ |
|
831 | + } else{ |
|
828 | 832 | $this->_processed = true; |
829 | 833 | $this->no_access(); |
830 | 834 | } |
831 | 835 | } |
832 | - }else |
|
833 | - $this->_processed = false; |
|
836 | + } else { |
|
837 | + $this->_processed = false; |
|
838 | + } |
|
834 | 839 | } |
835 | 840 | |
836 | 841 | /** |
@@ -865,8 +870,9 @@ discard block |
||
865 | 870 | $this->loadMapping('entry_point_registry'); |
866 | 871 | |
867 | 872 | if ( isset($this->entry_point_registry[$entryPoint]['auth']) |
868 | - && !$this->entry_point_registry[$entryPoint]['auth'] ) |
|
869 | - return false; |
|
873 | + && !$this->entry_point_registry[$entryPoint]['auth'] ) { |
|
874 | + return false; |
|
875 | + } |
|
870 | 876 | return true; |
871 | 877 | } |
872 | 878 | |
@@ -879,8 +885,7 @@ discard block |
||
879 | 885 | $file = self::getActionFilename($this->do_action); |
880 | 886 | if ( isset($this->action_view_map[strtolower($this->do_action)]) ) { |
881 | 887 | $action = $this->action_view_map[strtolower($this->do_action)]; |
882 | - } |
|
883 | - else { |
|
888 | + } else { |
|
884 | 889 | $action = $this->do_action; |
885 | 890 | } |
886 | 891 | // index actions actually maps to the view.list.php view |
@@ -913,12 +918,13 @@ discard block |
||
913 | 918 | $GLOBALS['log']->debug('Using Action File Map:' . $this->action_file_map[strtolower($this->do_action)]); |
914 | 919 | require_once($this->action_file_map[strtolower($this->do_action)]); |
915 | 920 | $this->_processed = true; |
916 | - }elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
921 | + } elseif(!empty($this->action_view_map[strtolower($this->do_action)])){ |
|
917 | 922 | $GLOBALS['log']->debug('Using Action View Map:' . $this->action_view_map[strtolower($this->do_action)]); |
918 | 923 | $this->view = $this->action_view_map[strtolower($this->do_action)]; |
919 | 924 | $this->_processed = true; |
920 | - }else |
|
921 | - $this->no_action(); |
|
925 | + } else { |
|
926 | + $this->no_action(); |
|
927 | + } |
|
922 | 928 | } |
923 | 929 | |
924 | 930 | /** |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | ********************************************************************************/ |
40 | 40 | |
41 | 41 | $entry_point_registry = array( |
42 | - 'emailImage' => array('file' => 'modules/EmailMan/EmailImage.php', 'auth' => false), |
|
43 | - 'download' => array('file' => 'download.php', 'auth' => true), |
|
44 | - 'export' => array('file' => 'export.php', 'auth' => true), |
|
45 | - 'export_dataset' => array('file' => 'export_dataset.php', 'auth' => true), |
|
46 | - 'Changenewpassword' => array('file' => 'modules/Users/Changenewpassword.php', 'auth' => false), |
|
47 | - 'GeneratePassword' => array('file' => 'modules/Users/GeneratePassword.php', 'auth' => false), |
|
48 | - 'vCard' => array('file' => 'vCard.php', 'auth' => true), |
|
49 | - 'pdf' => array('file' => 'pdf.php', 'auth' => true), |
|
50 | - 'minify' => array('file' => 'jssource/minify.php', 'auth' => true), |
|
42 | + 'emailImage' => array('file' => 'modules/EmailMan/EmailImage.php', 'auth' => false), |
|
43 | + 'download' => array('file' => 'download.php', 'auth' => true), |
|
44 | + 'export' => array('file' => 'export.php', 'auth' => true), |
|
45 | + 'export_dataset' => array('file' => 'export_dataset.php', 'auth' => true), |
|
46 | + 'Changenewpassword' => array('file' => 'modules/Users/Changenewpassword.php', 'auth' => false), |
|
47 | + 'GeneratePassword' => array('file' => 'modules/Users/GeneratePassword.php', 'auth' => false), |
|
48 | + 'vCard' => array('file' => 'vCard.php', 'auth' => true), |
|
49 | + 'pdf' => array('file' => 'pdf.php', 'auth' => true), |
|
50 | + 'minify' => array('file' => 'jssource/minify.php', 'auth' => true), |
|
51 | 51 | 'json_server' => array('file' => 'json_server.php', 'auth' => true), |
52 | 52 | 'get_url' => array('file' => 'get_url.php', 'auth' => true), |
53 | - 'HandleAjaxCall' => array('file' => 'HandleAjaxCall.php', 'auth' => true), |
|
54 | - 'TreeData' => array('file' => 'TreeData.php', 'auth' => true), |
|
53 | + 'HandleAjaxCall' => array('file' => 'HandleAjaxCall.php', 'auth' => true), |
|
54 | + 'TreeData' => array('file' => 'TreeData.php', 'auth' => true), |
|
55 | 55 | 'image' => array('file' => 'modules/Campaigns/image.php', 'auth' => false), |
56 | 56 | 'campaign_trackerv2' => array('file' => 'modules/Campaigns/Tracker.php', 'auth' => false), |
57 | 57 | 'WebToLeadCapture' => array('file' => 'modules/Campaigns/WebToLeadCapture.php', 'auth' => false), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'acceptDecline' => array('file' => 'modules/Contacts/AcceptDecline.php', 'auth' => false), |
60 | 60 | 'leadCapture' => array('file' => 'modules/Leads/Capture.php', 'auth' => false), |
61 | 61 | 'process_queue' => array('file' => 'process_queue.php', 'auth' => true), |
62 | - 'zipatcher' => array('file' => 'zipatcher.php', 'auth' => true), |
|
62 | + 'zipatcher' => array('file' => 'zipatcher.php', 'auth' => true), |
|
63 | 63 | 'mm_get_doc' => array('file' => 'modules/MailMerge/get_doc.php', 'auth' => true), |
64 | 64 | 'getImage' => array('file' => 'include/SugarTheme/getImage.php', 'auth' => false), |
65 | 65 | 'GenerateQuickComposeFrame' => array('file' => 'modules/Emails/GenerateQuickComposeFrame.php', 'auth' => true), |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | 'UploadFileCheck' => array('file' => 'modules/Configurator/UploadFileCheck.php', 'auth' => true), |
69 | 69 | 'SAML'=> array('file' => 'modules/Users/authentication/SAMLAuthenticate/index.php', 'auth' => false), |
70 | 70 | 'jslang'=> array('file' => 'include/language/getJSLanguage.php', 'auth' => true), |
71 | - 'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
72 | - 'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
73 | - 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true), |
|
74 | - 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true), |
|
75 | - 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true), |
|
76 | - 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true), |
|
77 | - 'social' => array('file' => 'include/social/get_data.php' , 'auth' => true), |
|
78 | - 'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true), |
|
79 | - 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true), |
|
80 | - 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true), |
|
81 | - 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true), |
|
82 | - 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true) |
|
71 | + 'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
72 | + 'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
|
73 | + 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true), |
|
74 | + 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true), |
|
75 | + 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true), |
|
76 | + 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true), |
|
77 | + 'social' => array('file' => 'include/social/get_data.php' , 'auth' => true), |
|
78 | + 'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true), |
|
79 | + 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true), |
|
80 | + 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true), |
|
81 | + 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true), |
|
82 | + 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | ?> |
@@ -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. |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | 'jslang'=> array('file' => 'include/language/getJSLanguage.php', 'auth' => true), |
71 | 71 | 'deleteAttachment' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
72 | 72 | 'responseEntryPoint' => array('file' => 'modules/FP_events/responseEntryPoint.php', 'auth' => false), |
73 | - 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php' , 'auth' => true), |
|
74 | - 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php' , 'auth' => true), |
|
75 | - 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php' , 'auth' => true), |
|
76 | - 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php' , 'auth' => true), |
|
77 | - 'social' => array('file' => 'include/social/get_data.php' , 'auth' => true), |
|
78 | - 'social_reader' => array('file' => 'include/social/get_feed_data.php' , 'auth' => true), |
|
79 | - 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php' , 'auth' => true), |
|
80 | - 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php' , 'auth' => true), |
|
81 | - 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php' , 'auth' => true), |
|
82 | - 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php' , 'auth' => true) |
|
73 | + 'formLetter' => array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true), |
|
74 | + 'generatePdf' => array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true), |
|
75 | + 'Reschedule' => array('file' => 'modules/Calls_Reschedule/Reschedule_popup.php', 'auth' => true), |
|
76 | + 'Reschedule2' => array('file' => 'modules/Calls/Reschedule.php', 'auth' => true), |
|
77 | + 'social' => array('file' => 'include/social/get_data.php', 'auth' => true), |
|
78 | + 'social_reader' => array('file' => 'include/social/get_feed_data.php', 'auth' => true), |
|
79 | + 'add_dash_page' => array('file' => 'modules/Home/AddDashboardPages.php', 'auth' => true), |
|
80 | + 'retrieve_dash_page' => array('file' => 'include/MySugar/retrieve_dash_page.php', 'auth' => true), |
|
81 | + 'remove_dash_page' => array('file' => 'modules/Home/RemoveDashboardPages.php', 'auth' => true), |
|
82 | + 'rename_dash_page' => array('file' => 'modules/Home/RenameDashboardPages.php', 'auth' => true) |
|
83 | 83 | ); |
84 | 84 | |
85 | 85 | ?> |
@@ -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. |
@@ -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,28 +42,28 @@ discard block |
||
42 | 42 | require_once("include/utils/db_utils.php"); |
43 | 43 | |
44 | 44 | class jsAlerts{ |
45 | - var $script; |
|
45 | + var $script; |
|
46 | 46 | |
47 | - function jsAlerts(){ |
|
48 | - global $app_strings; |
|
49 | - $this->script .= <<<EOQ |
|
47 | + function jsAlerts(){ |
|
48 | + global $app_strings; |
|
49 | + $this->script .= <<<EOQ |
|
50 | 50 | if (!alertsTimeoutId) { |
51 | 51 | checkAlerts(); |
52 | 52 | } |
53 | 53 | |
54 | 54 | EOQ; |
55 | - $this->addActivities(); |
|
56 | - Reminder::addNotifications($this); |
|
57 | - if(!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])){ |
|
58 | - $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60 ); |
|
59 | - $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60 , 'index.php'); |
|
60 | - } |
|
61 | - } |
|
62 | - function addAlert($type, $name, $subtitle, $description, $countdown, $redirect='') |
|
55 | + $this->addActivities(); |
|
56 | + Reminder::addNotifications($this); |
|
57 | + if(!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])){ |
|
58 | + $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60 ); |
|
59 | + $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60 , 'index.php'); |
|
60 | + } |
|
61 | + } |
|
62 | + function addAlert($type, $name, $subtitle, $description, $countdown, $redirect='') |
|
63 | 63 | { |
64 | - $script = 'addAlert(' . json_encode($type) .',' . json_encode($name). ',' . json_encode($subtitle). ','. json_encode(str_replace(array("\r", "\n"), array('','<br>'),$description)) . ',' . $countdown . ','.json_encode($redirect).');' . "\n"; |
|
64 | + $script = 'addAlert(' . json_encode($type) .',' . json_encode($name). ',' . json_encode($subtitle). ','. json_encode(str_replace(array("\r", "\n"), array('','<br>'),$description)) . ',' . $countdown . ','.json_encode($redirect).');' . "\n"; |
|
65 | 65 | $this->script .= $script; |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | 68 | function getScript() |
69 | 69 | { |
@@ -87,29 +87,29 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | function addActivities(){ |
90 | - global $app_list_strings, $timedate, $current_user, $app_strings; |
|
91 | - global $sugar_config; |
|
90 | + global $app_list_strings, $timedate, $current_user, $app_strings; |
|
91 | + global $sugar_config; |
|
92 | 92 | |
93 | - if (empty($current_user->id)) { |
|
93 | + if (empty($current_user->id)) { |
|
94 | 94 | return; |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | 97 | //Create separate variable to hold timedate value |
98 | 98 | $alertDateTimeNow = $timedate->nowDb(); |
99 | 99 | |
100 | - // cn: get a boundary limiter |
|
101 | - $dateTimeMax = $timedate->getNow()->modify("+{$app_list_strings['reminder_max_time']} seconds")->asDb(); |
|
102 | - $dateTimeNow = $timedate->nowDb(); |
|
100 | + // cn: get a boundary limiter |
|
101 | + $dateTimeMax = $timedate->getNow()->modify("+{$app_list_strings['reminder_max_time']} seconds")->asDb(); |
|
102 | + $dateTimeNow = $timedate->nowDb(); |
|
103 | 103 | |
104 | - global $db; |
|
105 | - $dateTimeNow = $db->convert($db->quoted($dateTimeNow), 'datetime'); |
|
106 | - $dateTimeMax = $db->convert($db->quoted($dateTimeMax), 'datetime'); |
|
107 | - $desc = $db->convert("description", "text2char"); |
|
108 | - if($desc != "description") { |
|
109 | - $desc .= " description"; |
|
110 | - } |
|
104 | + global $db; |
|
105 | + $dateTimeNow = $db->convert($db->quoted($dateTimeNow), 'datetime'); |
|
106 | + $dateTimeMax = $db->convert($db->quoted($dateTimeMax), 'datetime'); |
|
107 | + $desc = $db->convert("description", "text2char"); |
|
108 | + if($desc != "description") { |
|
109 | + $desc .= " description"; |
|
110 | + } |
|
111 | 111 | |
112 | - // Prep Meetings Query |
|
112 | + // Prep Meetings Query |
|
113 | 113 | $selectMeetings = "SELECT meetings.id, name,reminder_time, $desc,location, status, parent_type, parent_id, date_start, assigned_user_id |
114 | 114 | FROM meetings LEFT JOIN meetings_users ON meetings.id = meetings_users.meeting_id |
115 | 115 | WHERE meetings_users.user_id ='".$current_user->id."' |
@@ -119,61 +119,61 @@ discard block |
||
119 | 119 | AND meetings.status = 'Planned' |
120 | 120 | AND date_start >= $dateTimeNow |
121 | 121 | AND date_start <= $dateTimeMax"; |
122 | - $result = $db->query($selectMeetings); |
|
123 | - |
|
124 | - /////////////////////////////////////////////////////////////////////// |
|
125 | - //// MEETING INTEGRATION |
|
126 | - $meetingIntegration = null; |
|
127 | - if(isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) { |
|
128 | - if(!class_exists($sugar_config['meeting_integration'])) { |
|
129 | - require_once("modules/{$sugar_config['meeting_integration']}/{$sugar_config['meeting_integration']}.php"); |
|
130 | - } |
|
131 | - $meetingIntegration = new $sugar_config['meeting_integration'](); |
|
132 | - } |
|
133 | - //// END MEETING INTEGRATION |
|
134 | - /////////////////////////////////////////////////////////////////////// |
|
135 | - |
|
136 | - while($row = $db->fetchByAssoc($result)) { |
|
137 | - // need to concatenate since GMT times can bridge two local days |
|
138 | - $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
|
139 | - $timeRemind = $row['reminder_time']; |
|
140 | - $timeStart -= $timeRemind; |
|
141 | - |
|
142 | - $url = 'index.php?action=DetailView&module=Meetings&record=' . $row['id']; |
|
143 | - $instructions = $app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG']; |
|
144 | - |
|
145 | - /////////////////////////////////////////////////////////////////// |
|
146 | - //// MEETING INTEGRATION |
|
147 | - if(!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) { |
|
148 | - $url = $meetingIntegration->miUrlGetJsAlert($row); |
|
149 | - $instructions = $meetingIntegration->miGetJsAlertInstructions(); |
|
150 | - } |
|
151 | - //// END MEETING INTEGRATION |
|
152 | - /////////////////////////////////////////////////////////////////// |
|
153 | - |
|
154 | - $meetingName = from_html($row['name']); |
|
155 | - $desc1 = from_html($row['description']); |
|
156 | - $location = from_html($row['location']); |
|
122 | + $result = $db->query($selectMeetings); |
|
123 | + |
|
124 | + /////////////////////////////////////////////////////////////////////// |
|
125 | + //// MEETING INTEGRATION |
|
126 | + $meetingIntegration = null; |
|
127 | + if(isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) { |
|
128 | + if(!class_exists($sugar_config['meeting_integration'])) { |
|
129 | + require_once("modules/{$sugar_config['meeting_integration']}/{$sugar_config['meeting_integration']}.php"); |
|
130 | + } |
|
131 | + $meetingIntegration = new $sugar_config['meeting_integration'](); |
|
132 | + } |
|
133 | + //// END MEETING INTEGRATION |
|
134 | + /////////////////////////////////////////////////////////////////////// |
|
135 | + |
|
136 | + while($row = $db->fetchByAssoc($result)) { |
|
137 | + // need to concatenate since GMT times can bridge two local days |
|
138 | + $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
|
139 | + $timeRemind = $row['reminder_time']; |
|
140 | + $timeStart -= $timeRemind; |
|
141 | + |
|
142 | + $url = 'index.php?action=DetailView&module=Meetings&record=' . $row['id']; |
|
143 | + $instructions = $app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG']; |
|
144 | + |
|
145 | + /////////////////////////////////////////////////////////////////// |
|
146 | + //// MEETING INTEGRATION |
|
147 | + if(!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) { |
|
148 | + $url = $meetingIntegration->miUrlGetJsAlert($row); |
|
149 | + $instructions = $meetingIntegration->miGetJsAlertInstructions(); |
|
150 | + } |
|
151 | + //// END MEETING INTEGRATION |
|
152 | + /////////////////////////////////////////////////////////////////// |
|
153 | + |
|
154 | + $meetingName = from_html($row['name']); |
|
155 | + $desc1 = from_html($row['description']); |
|
156 | + $location = from_html($row['location']); |
|
157 | 157 | |
158 | 158 | $relatedToMeeting = $this->getRelatedName($row['parent_type'], $row['parent_id']); |
159 | 159 | |
160 | - $description = empty($desc1) ? '' : $app_strings['MSG_JS_ALERT_MTG_REMINDER_AGENDA'].$desc1."\n"; |
|
160 | + $description = empty($desc1) ? '' : $app_strings['MSG_JS_ALERT_MTG_REMINDER_AGENDA'].$desc1."\n"; |
|
161 | 161 | $description = $description ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . $row['status'] ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToMeeting; |
162 | 162 | |
163 | 163 | |
164 | - // standard functionality |
|
165 | - $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING'], $meetingName, |
|
166 | - $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')), |
|
167 | - $app_strings['MSG_JS_ALERT_MTG_REMINDER_LOC'].$location. |
|
168 | - $description. |
|
169 | - $instructions, |
|
170 | - $timeStart - strtotime($alertDateTimeNow), |
|
171 | - $url |
|
172 | - ); |
|
173 | - } |
|
164 | + // standard functionality |
|
165 | + $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING'], $meetingName, |
|
166 | + $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')), |
|
167 | + $app_strings['MSG_JS_ALERT_MTG_REMINDER_LOC'].$location. |
|
168 | + $description. |
|
169 | + $instructions, |
|
170 | + $timeStart - strtotime($alertDateTimeNow), |
|
171 | + $url |
|
172 | + ); |
|
173 | + } |
|
174 | 174 | |
175 | - // Prep Calls Query |
|
176 | - $selectCalls = " |
|
175 | + // Prep Calls Query |
|
176 | + $selectCalls = " |
|
177 | 177 | SELECT calls.id, name, reminder_time, $desc, date_start, status, parent_type, parent_id |
178 | 178 | FROM calls LEFT JOIN calls_users ON calls.id = calls_users.call_id |
179 | 179 | WHERE calls_users.user_id ='".$current_user->id."' |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | AND date_start >= $dateTimeNow |
185 | 185 | AND date_start <= $dateTimeMax"; |
186 | 186 | |
187 | - $result = $db->query($selectCalls); |
|
187 | + $result = $db->query($selectCalls); |
|
188 | 188 | |
189 | - while($row = $db->fetchByAssoc($result)){ |
|
190 | - // need to concatenate since GMT times can bridge two local days |
|
191 | - $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
|
192 | - $timeRemind = $row['reminder_time']; |
|
193 | - $timeStart -= $timeRemind; |
|
194 | - $row['description'] = (isset($row['description'])) ? $row['description'] : ''; |
|
189 | + while($row = $db->fetchByAssoc($result)){ |
|
190 | + // need to concatenate since GMT times can bridge two local days |
|
191 | + $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
|
192 | + $timeRemind = $row['reminder_time']; |
|
193 | + $timeStart -= $timeRemind; |
|
194 | + $row['description'] = (isset($row['description'])) ? $row['description'] : ''; |
|
195 | 195 | |
196 | 196 | $relatedToCall = $this->getRelatedName($row['parent_type'], $row['parent_id']); |
197 | 197 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | |
200 | 200 | |
201 | 201 | $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $row['name'], $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')) , $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$callDescription , $timeStart - strtotime($alertDateTimeNow), 'index.php?action=DetailView&module=Calls&record=' . $row['id']); |
202 | - } |
|
203 | - } |
|
202 | + } |
|
203 | + } |
|
204 | 204 | |
205 | 205 | |
206 | 206 | } |
@@ -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. |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | |
42 | 42 | require_once("include/utils/db_utils.php"); |
43 | 43 | |
44 | -class jsAlerts{ |
|
44 | +class jsAlerts { |
|
45 | 45 | var $script; |
46 | 46 | |
47 | - function jsAlerts(){ |
|
47 | + function jsAlerts() { |
|
48 | 48 | global $app_strings; |
49 | 49 | $this->script .= <<<EOQ |
50 | 50 | if (!alertsTimeoutId) { |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | EOQ; |
55 | 55 | $this->addActivities(); |
56 | 56 | Reminder::addNotifications($this); |
57 | - if(!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])){ |
|
58 | - $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60 ); |
|
59 | - $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'],'', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60 , 'index.php'); |
|
57 | + if (!empty($GLOBALS['sugar_config']['enable_timeout_alerts'])) { |
|
58 | + $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'], '', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_1'], (session_cache_expire() - 2) * 60); |
|
59 | + $this->addAlert($app_strings['ERROR_JS_ALERT_SYSTEM_CLASS'], $app_strings['ERROR_JS_ALERT_TIMEOUT_TITLE'], '', $app_strings['ERROR_JS_ALERT_TIMEOUT_MSG_2'], (session_cache_expire()) * 60, 'index.php'); |
|
60 | 60 | } |
61 | 61 | } |
62 | - function addAlert($type, $name, $subtitle, $description, $countdown, $redirect='') |
|
62 | + function addAlert($type, $name, $subtitle, $description, $countdown, $redirect = '') |
|
63 | 63 | { |
64 | - $script = 'addAlert(' . json_encode($type) .',' . json_encode($name). ',' . json_encode($subtitle). ','. json_encode(str_replace(array("\r", "\n"), array('','<br>'),$description)) . ',' . $countdown . ','.json_encode($redirect).');' . "\n"; |
|
64 | + $script = 'addAlert('.json_encode($type).','.json_encode($name).','.json_encode($subtitle).','.json_encode(str_replace(array("\r", "\n"), array('', '<br>'), $description)).','.$countdown.','.json_encode($redirect).');'."\n"; |
|
65 | 65 | $this->script .= $script; |
66 | 66 | } |
67 | 67 | |
68 | 68 | function getScript() |
69 | 69 | { |
70 | - return "<script>secondsSinceLoad = 0; alertList = [];" . $this->script . "</script>"; |
|
70 | + return "<script>secondsSinceLoad = 0; alertList = [];".$this->script."</script>"; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /* |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return ''; |
87 | 87 | } |
88 | 88 | |
89 | - function addActivities(){ |
|
89 | + function addActivities() { |
|
90 | 90 | global $app_list_strings, $timedate, $current_user, $app_strings; |
91 | 91 | global $sugar_config; |
92 | 92 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $dateTimeNow = $db->convert($db->quoted($dateTimeNow), 'datetime'); |
106 | 106 | $dateTimeMax = $db->convert($db->quoted($dateTimeMax), 'datetime'); |
107 | 107 | $desc = $db->convert("description", "text2char"); |
108 | - if($desc != "description") { |
|
108 | + if ($desc != "description") { |
|
109 | 109 | $desc .= " description"; |
110 | 110 | } |
111 | 111 | |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | /////////////////////////////////////////////////////////////////////// |
125 | 125 | //// MEETING INTEGRATION |
126 | 126 | $meetingIntegration = null; |
127 | - if(isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) { |
|
128 | - if(!class_exists($sugar_config['meeting_integration'])) { |
|
127 | + if (isset($sugar_config['meeting_integration']) && !empty($sugar_config['meeting_integration'])) { |
|
128 | + if (!class_exists($sugar_config['meeting_integration'])) { |
|
129 | 129 | require_once("modules/{$sugar_config['meeting_integration']}/{$sugar_config['meeting_integration']}.php"); |
130 | 130 | } |
131 | 131 | $meetingIntegration = new $sugar_config['meeting_integration'](); |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | //// END MEETING INTEGRATION |
134 | 134 | /////////////////////////////////////////////////////////////////////// |
135 | 135 | |
136 | - while($row = $db->fetchByAssoc($result)) { |
|
136 | + while ($row = $db->fetchByAssoc($result)) { |
|
137 | 137 | // need to concatenate since GMT times can bridge two local days |
138 | 138 | $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
139 | 139 | $timeRemind = $row['reminder_time']; |
140 | 140 | $timeStart -= $timeRemind; |
141 | 141 | |
142 | - $url = 'index.php?action=DetailView&module=Meetings&record=' . $row['id']; |
|
142 | + $url = 'index.php?action=DetailView&module=Meetings&record='.$row['id']; |
|
143 | 143 | $instructions = $app_strings['MSG_JS_ALERT_MTG_REMINDER_MEETING_MSG']; |
144 | 144 | |
145 | 145 | /////////////////////////////////////////////////////////////////// |
146 | 146 | //// MEETING INTEGRATION |
147 | - if(!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) { |
|
147 | + if (!empty($meetingIntegration) && $meetingIntegration->isIntegratedMeeting($row['id'])) { |
|
148 | 148 | $url = $meetingIntegration->miUrlGetJsAlert($row); |
149 | 149 | $instructions = $meetingIntegration->miGetJsAlertInstructions(); |
150 | 150 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $relatedToMeeting = $this->getRelatedName($row['parent_type'], $row['parent_id']); |
159 | 159 | |
160 | 160 | $description = empty($desc1) ? '' : $app_strings['MSG_JS_ALERT_MTG_REMINDER_AGENDA'].$desc1."\n"; |
161 | - $description = $description ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . $row['status'] ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToMeeting; |
|
161 | + $description = $description."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'].$row['status']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO'].$relatedToMeeting; |
|
162 | 162 | |
163 | 163 | |
164 | 164 | // standard functionality |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | $result = $db->query($selectCalls); |
188 | 188 | |
189 | - while($row = $db->fetchByAssoc($result)){ |
|
189 | + while ($row = $db->fetchByAssoc($result)) { |
|
190 | 190 | // need to concatenate since GMT times can bridge two local days |
191 | 191 | $timeStart = strtotime($db->fromConvert($row['date_start'], 'datetime')); |
192 | 192 | $timeRemind = $row['reminder_time']; |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | |
196 | 196 | $relatedToCall = $this->getRelatedName($row['parent_type'], $row['parent_id']); |
197 | 197 | |
198 | - $callDescription = $row['description'] ."\n" .$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'] . $row['status'] ."\n". $app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO']. $relatedToCall; |
|
198 | + $callDescription = $row['description']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_STATUS'].$row['status']."\n".$app_strings['MSG_JS_ALERT_MTG_REMINDER_RELATED_TO'].$relatedToCall; |
|
199 | 199 | |
200 | 200 | |
201 | - $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $row['name'], $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')) , $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$callDescription , $timeStart - strtotime($alertDateTimeNow), 'index.php?action=DetailView&module=Calls&record=' . $row['id']); |
|
201 | + $this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $row['name'], $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($row['date_start'], 'datetime')), $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$callDescription, $timeStart - strtotime($alertDateTimeNow), 'index.php?action=DetailView&module=Calls&record='.$row['id']); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 |
@@ -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,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,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. |
@@ -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(); |