This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
||
3 | /********************************************************************************* |
||
4 | * SugarCRM Community Edition is a customer relationship management program developed by |
||
5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
||
6 | |||
7 | * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
||
8 | * Copyright (C) 2011 - 2014 Salesagility Ltd. |
||
9 | * |
||
10 | * This program is free software; you can redistribute it and/or modify it under |
||
11 | * the terms of the GNU Affero General Public License version 3 as published by the |
||
12 | * Free Software Foundation with the addition of the following permission added |
||
13 | * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
||
14 | * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
||
15 | * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
||
16 | * |
||
17 | * This program is distributed in the hope that it will be useful, but WITHOUT |
||
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
19 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
||
20 | * details. |
||
21 | * |
||
22 | * You should have received a copy of the GNU Affero General Public License along with |
||
23 | * this program; if not, see http://www.gnu.org/licenses or write to the Free |
||
24 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
||
25 | * 02110-1301 USA. |
||
26 | * |
||
27 | * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
||
28 | * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
||
29 | * |
||
30 | * The interactive user interfaces in modified source and object code versions |
||
31 | * of this program must display Appropriate Legal Notices, as required under |
||
32 | * Section 5 of the GNU Affero General Public License version 3. |
||
33 | * |
||
34 | * In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
||
35 | * these Appropriate Legal Notices must retain the display of the "Powered by |
||
36 | * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
||
37 | * reasonably feasible for technical reasons, the Appropriate Legal Notices must |
||
38 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
||
39 | ********************************************************************************/ |
||
40 | |||
41 | |||
42 | |||
43 | |||
44 | class CalendarDisplay { |
||
45 | |||
46 | /** |
||
47 | * colors of items on calendar |
||
48 | */ |
||
49 | public $activity_colors = array( |
||
50 | 'Meetings' => array( |
||
51 | 'border' => '#1C5FBD', |
||
52 | 'body' => '#D2E5FC', |
||
53 | ), |
||
54 | 'Calls' => array( |
||
55 | 'border' => '#DE4040', |
||
56 | 'body' => '#FCDCDC', |
||
57 | ), |
||
58 | 'Tasks' => array( |
||
59 | 'border' => '#015900', |
||
60 | 'body' => '#B1F5AE', |
||
61 | ), |
||
62 | ); |
||
63 | |||
64 | /** |
||
65 | * constructor |
||
66 | * @param Calendar $cal |
||
67 | * @param string $dashlet_id for dashlet mode |
||
68 | */ |
||
69 | function __construct(Calendar $cal,$dashlet_id = ""){ |
||
70 | $this->cal = $cal; |
||
71 | $this->dashlet_id = $dashlet_id; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * main displaying function of Calendar |
||
76 | */ |
||
77 | public function display(){ |
||
78 | |||
79 | global $timedate; |
||
80 | |||
81 | $cal = &$this->cal; |
||
82 | $ss = new Sugar_Smarty(); |
||
83 | |||
84 | $ss->assign('APP',$GLOBALS['app_strings']); |
||
85 | $ss->assign('APPLIST',$GLOBALS['app_list_strings']); |
||
86 | $ss->assign('MOD',$GLOBALS['cal_strings']); |
||
87 | |||
88 | $ss->assign('view',$cal->view); |
||
89 | $ss->assign('style',$cal->style); |
||
90 | $ss->assign('t_step',$cal->time_step); |
||
91 | $ss->assign('current_user_id',$GLOBALS['current_user']->id); |
||
92 | $ss->assign('current_user_name',$GLOBALS['current_user']->name); |
||
93 | $ss->assign('time_format',$GLOBALS['timedate']->get_user_time_format()); |
||
94 | $ss->assign('enable_repeat',$this->cal->enable_repeat); |
||
95 | $ss->assign('items_draggable',SugarConfig::getInstance()->get('calendar.items_draggable',true)); |
||
96 | $ss->assign('items_resizable',SugarConfig::getInstance()->get('calendar.items_resizable',true)); |
||
97 | $ss->assign('cells_per_day',$cal->cells_per_day); |
||
98 | |||
99 | $ss->assign('dashlet',$cal->dashlet); |
||
100 | $ss->assign('grid_start_ts',intval($cal->grid_start_ts)); |
||
101 | |||
102 | $ss->assign('year', $cal->date_time->format('Y')); |
||
103 | $ss->assign('month', $cal->date_time->format('m')); |
||
104 | $ss->assign('day', $cal->date_time->format('d')); |
||
105 | |||
106 | $ss->assign('CALENDAR_FORMAT',$GLOBALS['timedate']->get_cal_date_format()); |
||
107 | $ss->assign('CALENDAR_FDOW',$GLOBALS['current_user']->get_first_day_of_week()); |
||
108 | |||
109 | |||
110 | if($cal->style == "basic"){ |
||
111 | switch($cal->view){ |
||
112 | case "day": |
||
113 | $height = 250; break; |
||
0 ignored issues
–
show
|
|||
114 | case "mobile": |
||
115 | $height = 250; break; |
||
0 ignored issues
–
show
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
116 | case "week": |
||
117 | $height = 250; break; |
||
0 ignored issues
–
show
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
118 | case "shared": |
||
119 | $height = 100; break; |
||
0 ignored issues
–
show
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
120 | default: |
||
121 | $height = 80; break; |
||
0 ignored issues
–
show
Terminating statement must be on a line by itself
As per the PSR-2 coding standard, the switch ($expr) {
case "A":
doSomething();
break; //wrong
case "B":
doSomething();
break; //right
case "C:":
doSomething();
return true; //right
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
122 | } |
||
123 | }else{ |
||
124 | $height = 20; |
||
125 | } |
||
126 | $ss->assign('basic_min_height',$height); |
||
127 | |||
128 | $ss->assign('isPrint', $this->cal->isPrint() ? 'true': 'false'); |
||
129 | |||
130 | |||
131 | if(count($cal->shared_ids)){ |
||
132 | $ss->assign('shared_ids',$cal->shared_ids); |
||
133 | $ss->assign('shared_users_count',count($cal->shared_ids)); |
||
134 | } |
||
135 | $ss->assign('activity_colors',$this->activity_colors); |
||
136 | |||
137 | $ss->assign('scroll_slot',$this->cal->scroll_slot); |
||
138 | |||
139 | $ss->assign('editview_width',SugarConfig::getInstance()->get('calendar.editview_width',800)); |
||
140 | $ss->assign('editview_height',SugarConfig::getInstance()->get('calendar.editview_height',600)); |
||
141 | |||
142 | $ss->assign('a_str',json_encode($cal->items)); |
||
143 | |||
144 | $ss->assign('sugar_body_only',(isset($_REQUEST['to_pdf']) && $_REQUEST['to_pdf'] || isset($_REQUEST['sugar_body_only']) && $_REQUEST['sugar_body_only'])); |
||
145 | require_once('include/json_config.php'); |
||
146 | global $json; |
||
147 | $json = getJSONobj(); |
||
148 | $json_config = new json_config(); |
||
149 | $ss->assign('GRjavascript',$json_config->get_static_json_server(false, true, 'Meetings')); |
||
150 | |||
151 | // form |
||
152 | $user_default_date_start = $timedate->asUser($timedate->getNow()); |
||
153 | $ss->assign('user_default_date_start',$user_default_date_start); |
||
154 | // end form |
||
155 | |||
156 | if($_REQUEST['module'] == "Calendar"){ |
||
157 | $this->load_settings_template($ss); |
||
158 | $settings = "custom/modules/Calendar/tpls/settings.tpl"; |
||
159 | if(!file_exists($settings)) |
||
160 | $settings = "modules/Calendar/tpls/settings.tpl"; |
||
161 | $ss->assign("settings",$settings); |
||
162 | } |
||
163 | |||
164 | $main = "custom/modules/Calendar/tpls/main.tpl"; |
||
165 | if(!file_exists($main)) |
||
166 | $main = "modules/Calendar/tpls/main.tpl"; |
||
167 | |||
168 | $form_tpl = "custom/modules/Calendar/tpls/form.tpl"; |
||
169 | if(!file_exists($form_tpl)) |
||
170 | $form_tpl = "modules/Calendar/tpls/form.tpl"; |
||
171 | $ss->assign("form",$form_tpl); |
||
172 | |||
173 | if($this->cal->enable_repeat){ |
||
174 | $repeat_tpl = "custom/modules/Calendar/tpls/repeat.tpl"; |
||
175 | if(!file_exists($repeat_tpl)) |
||
176 | $repeat_tpl = "modules/Calendar/tpls/repeat.tpl"; |
||
177 | $ss->assign("repeat",$repeat_tpl); |
||
178 | |||
179 | $repeat_intervals = array(); |
||
180 | for($i = 1; $i <= 30; $i++) |
||
181 | $repeat_intervals[$i] = $i; |
||
182 | $ss->assign("repeat_intervals",$repeat_intervals); |
||
183 | |||
184 | |||
185 | $fdow = $GLOBALS['current_user']->get_first_day_of_week(); |
||
186 | $dow = array(); |
||
187 | for($i = $fdow; $i < $fdow + 7; $i++){ |
||
188 | $day_index = $i % 7; |
||
189 | $dow[] = array("index" => $day_index , "label" => $GLOBALS['app_list_strings']['dom_cal_day_short'][$day_index + 1]); |
||
190 | } |
||
191 | $ss->assign("dow",$dow); |
||
192 | |||
193 | } |
||
194 | |||
195 | |||
196 | |||
197 | echo $ss->fetch($main); |
||
198 | |||
199 | // grid |
||
200 | $grid = new CalendarGrid($cal); |
||
201 | echo $grid->display(); |
||
202 | // end grid |
||
203 | } |
||
204 | |||
205 | /** |
||
206 | * load settings popup template |
||
207 | */ |
||
208 | protected function load_settings_template(&$ss){ |
||
209 | |||
210 | list($d_start_hour,$d_start_min) = explode(":",$this->cal->day_start_time); |
||
211 | list($d_end_hour,$d_end_min) = explode(":",$this->cal->day_end_time); |
||
212 | |||
213 | require_once("include/utils.php"); |
||
214 | global $app_strings,$app_list_strings,$beanList; |
||
215 | global $timedate; |
||
216 | |||
217 | $user_default_date_start = $timedate->asUser($timedate->getNow()); |
||
218 | if(!isset($time_separator)) |
||
0 ignored issues
–
show
The variable
$time_separator seems only to be defined at a later point. As such the call to isset() seems to always evaluate to false .
This check marks calls to This is likely the result of code being shifted around. Consider removing these calls. ![]() |
|||
219 | $time_separator = ":"; |
||
220 | $date_format = $timedate->get_cal_date_format(); |
||
221 | $time_format = $timedate->get_user_time_format(); |
||
222 | $TIME_FORMAT = $time_format; |
||
223 | $t23 = strpos($time_format, '23') !== false ? '%H' : '%I'; |
||
224 | if(!isset($match[2]) || $match[2] == '') { |
||
0 ignored issues
–
show
The variable
$match seems to never exist, and therefore isset should always return false . Did you maybe rename this variable?
This check looks for calls to This is most likely caused by the renaming of a variable or the removal of a function/method parameter. ![]() |
|||
225 | $CALENDAR_FORMAT = $date_format . ' ' . $t23 . $time_separator . "%M"; |
||
226 | }else{ |
||
227 | $pm = $match[2] == "pm" ? "%P" : "%p"; |
||
228 | $CALENDAR_FORMAT = $date_format . ' ' . $t23 . $time_separator . "%M" . $pm; |
||
229 | } |
||
230 | $hours_arr = array (); |
||
231 | $num_of_hours = 24; |
||
232 | $start_at = 0; |
||
233 | $TIME_MERIDIEM = ""; |
||
234 | $time_pref = $timedate->get_time_format(); |
||
235 | $start_m = ""; |
||
236 | if(strpos($time_pref, 'a') || strpos($time_pref, 'A')){ |
||
237 | $num_of_hours = 12; |
||
238 | $start_at = 1; |
||
239 | $start_m = 'am'; |
||
240 | if($d_start_hour == 0){ |
||
241 | $d_start_hour = 12; |
||
242 | $start_m = 'am'; |
||
243 | }else |
||
244 | if($d_start_hour == 12) |
||
245 | $start_m = 'pm'; |
||
246 | if($d_start_hour > 12){ |
||
247 | $d_start_hour = $d_start_hour - 12; |
||
248 | $start_m = 'pm'; |
||
249 | } |
||
250 | $end_m = 'am'; |
||
251 | if($d_end_hour == 0){ |
||
252 | $d_end_hour = 12; |
||
253 | $end_m = 'am'; |
||
254 | }else |
||
255 | if($d_end_hour == 12) |
||
256 | $end_m = 'pm'; |
||
257 | |||
258 | if($d_end_hour > 12){ |
||
259 | $d_end_hour = $d_end_hour - 12; |
||
260 | $end_m = 'pm'; |
||
261 | } |
||
262 | if(strpos($time_pref, 'A')){ |
||
263 | $start_m = strtoupper($start_m); |
||
264 | $end_m = strtoupper($end_m); |
||
265 | } |
||
266 | $options = strpos($time_pref, 'a') ? $app_list_strings['dom_meridiem_lowercase'] : $app_list_strings['dom_meridiem_uppercase']; |
||
267 | $TIME_START_MERIDIEM = get_select_options_with_id($options, $start_m); |
||
268 | $TIME_END_MERIDIEM = get_select_options_with_id($options, $end_m); |
||
269 | $TIME_START_MERIDIEM = "<select id='day_start_meridiem' name='day_start_meridiem' tabindex='2'>".$TIME_START_MERIDIEM."</select>"; |
||
270 | $TIME_END_MERIDIEM = "<select id='day_end_meridiem' name='day_end_meridiem' tabindex='2'>".$TIME_END_MERIDIEM."</select>"; |
||
271 | }else{ |
||
272 | $TIME_START_MERIDIEM = $TIME_END_MERIDIEM = ""; |
||
273 | } |
||
274 | for($i = $start_at; $i <= $num_of_hours; $i ++){ |
||
275 | $i = $i.""; |
||
276 | if (strlen($i) == 1) |
||
277 | $i = "0".$i; |
||
278 | $hours_arr[$i] = $i; |
||
279 | } |
||
280 | $TIME_START_HOUR_OPTIONS = get_select_options_with_id($hours_arr, $d_start_hour); |
||
281 | $TIME_START_MINUTES_OPTIONS = get_select_options_with_id(array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'), $d_start_min); |
||
282 | $TIME_END_HOUR_OPTIONS = get_select_options_with_id($hours_arr, $d_end_hour); |
||
283 | $TIME_END_MINUTES_OPTIONS = get_select_options_with_id(array('0'=>'00','15'=>'15','30'=>'30','45'=>'45'), $d_end_min); |
||
284 | |||
285 | $displayTimeslots = $GLOBALS['current_user']->getPreference('calendar_display_timeslots'); |
||
286 | if(is_null($displayTimeslots)) { |
||
287 | $displayTimeslots = SugarConfig::getInstance()->get('calendar.display_timeslots', true); |
||
288 | } |
||
289 | |||
290 | $ss->assign('week',$_REQUEST['week']); |
||
291 | $ss->assign('display_timeslots', $displayTimeslots); |
||
292 | $ss->assign('show_calls',$this->cal->show_calls); |
||
293 | $ss->assign('show_tasks',$this->cal->show_tasks); |
||
294 | $ss->assign('show_completed', $this->cal->show_completed); |
||
295 | $ss->assign('TIME_START_HOUR_OPTIONS',$TIME_START_HOUR_OPTIONS); |
||
296 | $ss->assign('TIME_START_MINUTES_OPTIONS',$TIME_START_MINUTES_OPTIONS); |
||
297 | $ss->assign('TIME_START_MERIDIEM',$TIME_START_MERIDIEM); |
||
298 | $ss->assign('TIME_END_HOUR_OPTIONS',$TIME_END_HOUR_OPTIONS); |
||
299 | $ss->assign('TIME_END_MINUTES_OPTIONS',$TIME_END_MINUTES_OPTIONS); |
||
300 | $ss->assign('TIME_END_MERIDIEM',$TIME_END_MERIDIEM); |
||
301 | } |
||
302 | |||
303 | /** |
||
304 | * Get date info string (legacy from old calendar) |
||
305 | * @return string |
||
306 | */ |
||
307 | public function get_date_info($view, $date_time){ |
||
308 | $str = ""; |
||
309 | |||
310 | global $current_user; |
||
311 | $dateFormat = $current_user->getUserDateTimePreferences(); |
||
312 | |||
313 | if($view == 'month'){ |
||
314 | for($i=0; $i<strlen($dateFormat['date']); $i++){ |
||
315 | switch($dateFormat['date']{$i}){ |
||
316 | case "Y": |
||
317 | $str .= " ".$date_time->year; |
||
318 | break; |
||
319 | case "m": |
||
320 | $str .= " ".$date_time->get_month_name(); |
||
321 | break; |
||
322 | } |
||
323 | } |
||
324 | }else |
||
325 | if($view == 'week' || $view == 'shared') { |
||
326 | $first_day = $date_time; |
||
327 | |||
328 | $first_day = CalendarUtils::get_first_day_of_week($date_time); |
||
329 | $last_day = $first_day->get("+6 days"); |
||
330 | |||
331 | for($i=0; $i<strlen($dateFormat['date']); $i++) { |
||
332 | switch($dateFormat['date']{$i}){ |
||
333 | case "Y": |
||
334 | $str .= " ".$first_day->year; |
||
0 ignored issues
–
show
The property
year does not exist on object<SugarDateTime> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
335 | break; |
||
336 | case "m": |
||
337 | $str .= " ".$first_day->get_month_name(); |
||
0 ignored issues
–
show
The method
get_month_name does not exist on object<SugarDateTime> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
338 | break; |
||
339 | case "d": |
||
340 | $str .= " ".$first_day->get_day(); |
||
0 ignored issues
–
show
|
|||
341 | break; |
||
342 | } |
||
343 | } |
||
344 | $str .= " - "; |
||
345 | for($i=0; $i<strlen($dateFormat['date']); $i++) { |
||
346 | switch($dateFormat['date']{$i}) { |
||
347 | case "Y": |
||
348 | $str .= " ".$last_day->year; |
||
0 ignored issues
–
show
The property
year does not exist on object<SugarDateTime> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
349 | break; |
||
350 | case "m": |
||
351 | $str .= " ".$last_day->get_month_name(); |
||
0 ignored issues
–
show
The method
get_month_name does not exist on object<SugarDateTime> ? Since you implemented __call , maybe consider adding a @method annotation.
If you implement This is often the case, when class ParentClass {
private $data = array();
public function __call($method, array $args) {
if (0 === strpos($method, 'get')) {
return $this->data[strtolower(substr($method, 3))];
}
throw new \LogicException(sprintf('Unsupported method: %s', $method));
}
}
/**
* If this class knows which fields exist, you can specify the methods here:
*
* @method string getName()
*/
class SomeClass extends ParentClass { }
![]() |
|||
352 | break; |
||
353 | case "d": |
||
354 | $str .= " ".$last_day->get_day(); |
||
0 ignored issues
–
show
|
|||
355 | break; |
||
356 | } |
||
357 | } |
||
358 | }else if($view == 'day'){ |
||
359 | $str .= $date_time->get_day_of_week()." "; |
||
360 | |||
361 | for($i=0; $i<strlen($dateFormat['date']); $i++){ |
||
362 | switch($dateFormat['date']{$i}){ |
||
363 | case "Y": |
||
364 | $str .= " ".$date_time->year; |
||
365 | break; |
||
366 | case "m": |
||
367 | $str .= " ".$date_time->get_month_name(); |
||
368 | break; |
||
369 | case "d": |
||
370 | $str .= " ".$date_time->get_day(); |
||
371 | break; |
||
372 | } |
||
373 | } |
||
374 | }else if($view == 'mobile'){ |
||
375 | $str .= $date_time->get_day_of_week()." "; |
||
376 | |||
377 | for($i=0; $i<strlen($dateFormat['date']); $i++){ |
||
378 | switch($dateFormat['date']{$i}){ |
||
379 | case "Y": |
||
380 | $str .= " ".$date_time->year; |
||
381 | break; |
||
382 | case "m": |
||
383 | $str .= " ".$date_time->get_month_name(); |
||
384 | break; |
||
385 | case "d": |
||
386 | $str .= " ".$date_time->get_day(); |
||
387 | break; |
||
388 | } |
||
389 | } |
||
390 | }else if($view == 'year') { |
||
391 | $str .= $date_time->year; |
||
392 | }else{ |
||
393 | sugar_die("echo_date_info: date not supported"); |
||
394 | } |
||
395 | return $str; |
||
396 | } |
||
397 | |||
398 | /** |
||
399 | * Get link to next date range |
||
400 | * @return string |
||
401 | */ |
||
402 | protected function get_next_calendar(){ |
||
403 | global $cal_strings,$image_path; |
||
404 | $str = ""; |
||
405 | if($_REQUEST['module'] == "Calendar"){ |
||
406 | $str .= "<a href='".ajaxLink("index.php?action=index&module=Calendar&view=".$this->cal->view."&".$this->cal->get_neighbor_date_str("next"))."'>"; |
||
407 | |||
408 | }else{ |
||
409 | $str .= "<a href='#' onclick='return SUGAR.mySugar.retrieveDashlet(\"".$this->dashlet_id."\", \"index.php?module=Home&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&".$this->cal->get_neighbor_date_str("next")."&id=".$this->dashlet_id."\")'>"; |
||
410 | } |
||
411 | $str .= $cal_strings["LBL_NEXT_".strtoupper($this->cal->view)]; |
||
412 | |||
413 | $str .= " ".SugarThemeRegistry::current()->getImage("calendar_next", 'align="absmiddle" border="0"' ,null,null,'.gif', '') . "</a>"; //setting alt tag blank on purpose for 508 compliance |
||
414 | return $str; |
||
415 | } |
||
416 | |||
417 | /** |
||
418 | * Get link to previous date range |
||
419 | * @return string |
||
420 | */ |
||
421 | protected function get_previous_calendar(){ |
||
422 | global $cal_strings,$image_path; |
||
423 | $str = ""; |
||
424 | if($_REQUEST['module'] == "Calendar"){ |
||
425 | $str .= "<a href='".ajaxLink("index.php?action=index&module=Calendar&view=".$this->cal->view."&".$this->cal->get_neighbor_date_str("previous")."")."'>"; |
||
426 | }else{ |
||
427 | $str .= "<a href='#' onclick='return SUGAR.mySugar.retrieveDashlet(\"".$this->dashlet_id."\", \"index.php?module=Home&action=DynamicAction&DynamicAction=displayDashlet&sugar_body_only=1&".$this->cal->get_neighbor_date_str("previous")."&id=".$this->dashlet_id."\")'>"; |
||
428 | } |
||
429 | $str .= SugarThemeRegistry::current()->getImage('calendar_previous','align="absmiddle" border="0"', null, null, '.gif', ''); //setting alt tag blank on purpose for 508 compliance |
||
430 | $str .= " ".$cal_strings["LBL_PREVIOUS_".strtoupper($this->cal->view)] . "</a>"; |
||
431 | return $str; |
||
432 | } |
||
433 | |||
434 | /** |
||
435 | * display header |
||
436 | * @param boolean $controls display ui contol itmes |
||
437 | */ |
||
438 | public function display_calendar_header($controls = true){ |
||
439 | global $cal_strings; |
||
440 | |||
441 | $ss = new Sugar_Smarty(); |
||
442 | $ss->assign("MOD",$cal_strings); |
||
443 | $ss->assign("view",$this->cal->view); |
||
444 | |||
445 | $ss->assign('print', $this->cal->isPrint()); |
||
446 | |||
447 | if($controls){ |
||
448 | $current_date = str_pad($this->cal->date_time->month,2,'0',STR_PAD_LEFT)."/".str_pad($this->cal->date_time->day,2,'0',STR_PAD_LEFT)."/".$this->cal->date_time->year; |
||
449 | |||
450 | $tabs = array('day', 'week', 'month', 'year', 'shared'); |
||
451 | $tabs_params = array(); |
||
452 | foreach($tabs as $tab){ |
||
453 | $tabs_params[$tab]['title'] = $cal_strings["LBL_".strtoupper($tab)]; |
||
454 | $tabs_params[$tab]['id'] = $tab . "-tab"; |
||
455 | $tabs_params[$tab]['link'] = "window.location.href='".ajaxLink("index.php?module=Calendar&action=index&view=". $tab . $this->cal->date_time->get_date_str())."'"; |
||
456 | } |
||
457 | $ss->assign('controls',$controls); |
||
458 | $ss->assign('tabs',$tabs); |
||
459 | $ss->assign('tabs_params',$tabs_params); |
||
460 | $ss->assign('current_date',$current_date); |
||
461 | $ss->assign('start_weekday',$GLOBALS['current_user']->get_first_day_of_week()); |
||
462 | $ss->assign('cal_img',SugarThemeRegistry::current()->getImageURL("jscalendar.gif",false)); |
||
463 | } |
||
464 | |||
465 | $ss->assign('previous',$this->get_previous_calendar()); |
||
466 | $ss->assign('next',$this->get_next_calendar()); |
||
467 | |||
468 | $ss->assign('date_info',$this->get_date_info($this->cal->view,$this->cal->date_time)); |
||
469 | |||
470 | $header = "custom/modules/Calendar/tpls/header.tpl"; |
||
471 | if(!file_exists($header)) |
||
472 | $header = "modules/Calendar/tpls/header.tpl"; |
||
473 | echo $ss->fetch($header); |
||
474 | } |
||
475 | |||
476 | /** |
||
477 | * display footer |
||
478 | */ |
||
479 | public function display_calendar_footer(){ |
||
480 | global $cal_strings; |
||
481 | |||
482 | $ss = new Sugar_Smarty(); |
||
483 | $ss->assign("MOD",$cal_strings); |
||
484 | $ss->assign("view",$this->cal->view); |
||
485 | |||
486 | $ss->assign('previous',$this->get_previous_calendar()); |
||
487 | $ss->assign('next',$this->get_next_calendar()); |
||
488 | |||
489 | $footer = "custom/modules/Calendar/tpls/footer.tpl"; |
||
490 | if(!file_exists($footer)) |
||
491 | $footer = "modules/Calendar/tpls/footer.tpl"; |
||
492 | echo $ss->fetch($footer); |
||
493 | } |
||
494 | |||
495 | /** |
||
496 | * display title |
||
497 | */ |
||
498 | public function display_title(){ |
||
499 | global $mod_strings; |
||
500 | //Hack to make this 6.5 compatible until this module is converted to MVC |
||
501 | |||
502 | if($this->cal->view == "mobile"){ |
||
503 | |||
504 | $buttons = array("Meeting","Call","Task"); |
||
505 | |||
506 | echo "<div class='custom_module_title moduleTitle'><h2>". $mod_strings['LBL_MODULE_TITLE'] ."</h2></div>"; |
||
507 | echo "<div style='float:right;' class='moduleTitle'>"; |
||
508 | |||
509 | echo '<div class="btn-group"> |
||
510 | <button type="button" class="btn button dropdown-toggle" data-toggle="dropdown">'.$mod_strings["LBL_ADD_ITEM"].'<span class="caret"></span></button> |
||
511 | <ul class="dropdown-menu pull-left" style="right: 0; left: auto;">'; |
||
512 | |||
513 | foreach($buttons as $module){ |
||
514 | echo '<li><a href="index.php?return_module=Calendar&return_action=index&module=' . $module .'s&action=EditView">'.$mod_strings["LBL_ADD_".strtoupper($module)].'</a></li>'; |
||
515 | } |
||
516 | |||
517 | echo '</ul></div></div>'; |
||
518 | |||
519 | }else{ |
||
520 | echo "<div class='moduleTitle'><h2>". $mod_strings['LBL_MODULE_TITLE'] ."</h2></div>"; |
||
521 | |||
522 | } |
||
523 | |||
524 | } |
||
525 | |||
526 | /** |
||
527 | * display html used in shared view |
||
528 | */ |
||
529 | public function display_shared_html(){ |
||
530 | global $app_strings,$cal_strings,$action; |
||
531 | |||
532 | $ss = new Sugar_Smarty(); |
||
533 | $ss->assign("APP",$app_strings); |
||
534 | $ss->assign("MOD",$cal_strings); |
||
535 | $ss->assign("UP",SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;"', null, null, '.gif', $app_strings['LBL_SORT'])); |
||
536 | $ss->assign("DOWN",SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;"', null, null, '.gif', $app_strings['LBL_SORT'])); |
||
537 | |||
538 | if(!empty($_REQUEST['edit_shared'])){ |
||
539 | $ss->assign("edit_shared",true); |
||
540 | } |
||
541 | |||
542 | |||
543 | $ss->assign("users_options",get_select_options_with_id(get_user_array(false), $this->cal->shared_ids)); |
||
544 | |||
545 | $tpl = "modules/Calendar/tpls/shared_users.tpl"; |
||
546 | echo $ss->fetch($tpl); |
||
547 | } |
||
548 | |||
549 | } |
||
550 | |||
551 | ?> |
||
552 |
As per the PSR-2 coding standard, the
break
(or other terminating) statement must be on a line of its own.To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.