@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @var $debug mixed integer level or string function-name |
| 35 | 35 | */ |
| 36 | - var $debug=false; |
|
| 36 | + var $debug = false; |
|
| 37 | 37 | /** |
| 38 | 38 | * instance of the bocal or bocalupdate class |
| 39 | 39 | * |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | /** |
| 128 | 128 | * @var array $states_to_save all states that will be saved to the user prefs |
| 129 | 129 | */ |
| 130 | - var $states_to_save = array('owner','status_filter','filter','cat_id','view','sortby','planner_view','weekend'); |
|
| 130 | + var $states_to_save = array('owner', 'status_filter', 'filter', 'cat_id', 'view', 'sortby', 'planner_view', 'weekend'); |
|
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * Constructor |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param boolean $use_boupdate use bocalupdate as parenent instead of bocal |
| 136 | 136 | * @param array $set_states to manualy set / change one of the states, default NULL = use $_REQUEST |
| 137 | 137 | */ |
| 138 | - function __construct($use_boupdate=false,$set_states=NULL) |
|
| 138 | + function __construct($use_boupdate = false, $set_states = NULL) |
|
| 139 | 139 | { |
| 140 | 140 | if ($use_boupdate) |
| 141 | 141 | { |
@@ -146,27 +146,27 @@ discard block |
||
| 146 | 146 | $this->bo = new calendar_bo(); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $this->categories = new Api\Categories($this->user,'calendar'); |
|
| 149 | + $this->categories = new Api\Categories($this->user, 'calendar'); |
|
| 150 | 150 | |
| 151 | - $this->common_prefs = &$GLOBALS['egw_info']['user']['preferences']['common']; |
|
| 151 | + $this->common_prefs = &$GLOBALS['egw_info']['user']['preferences']['common']; |
|
| 152 | 152 | $this->cal_prefs = &$GLOBALS['egw_info']['user']['preferences']['calendar']; |
| 153 | 153 | $this->bo->check_set_default_prefs(); |
| 154 | 154 | |
| 155 | - $this->wd_start = 60*$this->cal_prefs['workdaystarts']; |
|
| 156 | - $this->wd_end = 60*$this->cal_prefs['workdayends']; |
|
| 157 | - $this->interval_m = $this->cal_prefs['interval']; |
|
| 155 | + $this->wd_start = 60 * $this->cal_prefs['workdaystarts']; |
|
| 156 | + $this->wd_end = 60 * $this->cal_prefs['workdayends']; |
|
| 157 | + $this->interval_m = $this->cal_prefs['interval']; |
|
| 158 | 158 | |
| 159 | 159 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
| 160 | 160 | |
| 161 | 161 | $this->manage_states($set_states); |
| 162 | 162 | |
| 163 | - $GLOBALS['uical'] = &$this; // make us available for ExecMethod, else it creates a new instance |
|
| 163 | + $GLOBALS['uical'] = &$this; // make us available for ExecMethod, else it creates a new instance |
|
| 164 | 164 | |
| 165 | 165 | // calendar does not work with hidden sidebox atm. |
| 166 | 166 | unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); |
| 167 | 167 | |
| 168 | 168 | // make sure the hook for export_limit is registered |
| 169 | - if (!Api\Hooks::exists('export_limit','calendar')) Api\Hooks::read(true); |
|
| 169 | + if (!Api\Hooks::exists('export_limit', 'calendar')) Api\Hooks::read(true); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -179,21 +179,21 @@ discard block |
||
| 179 | 179 | function check_owners_access($users = null, &$no_access = array()) |
| 180 | 180 | { |
| 181 | 181 | $no_access = $no_access_group = array(); |
| 182 | - $owner_array = $users ? $users : explode(',',$this->owner); |
|
| 183 | - foreach($owner_array as $idx => $owner) |
|
| 182 | + $owner_array = $users ? $users : explode(',', $this->owner); |
|
| 183 | + foreach ($owner_array as $idx => $owner) |
|
| 184 | 184 | { |
| 185 | 185 | $owner = trim($owner); |
| 186 | 186 | if (is_numeric($owner) && $GLOBALS['egw']->accounts->get_type($owner) == 'g') |
| 187 | 187 | { |
| 188 | - foreach($GLOBALS['egw']->accounts->members($owner, true) as $member) |
|
| 188 | + foreach ($GLOBALS['egw']->accounts->members($owner, true) as $member) |
|
| 189 | 189 | { |
| 190 | - if (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY,0,$member)) |
|
| 190 | + if (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY, 0, $member)) |
|
| 191 | 191 | { |
| 192 | 192 | $no_access_group[$member] = $this->bo->participant_name($member); |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | - elseif (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY,0,$owner)) |
|
| 196 | + elseif (!$this->bo->check_perms(Acl::READ|calendar_bo::ACL_READ_FOR_PARTICIPANTS|calendar_bo::ACL_FREEBUSY, 0, $owner)) |
|
| 197 | 197 | { |
| 198 | 198 | $no_access[$owner] = $this->bo->participant_name($owner); |
| 199 | 199 | unset($owner_array[$idx]); |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | if (count($no_access)) |
| 203 | 203 | { |
| 204 | - $message = lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access)); |
|
| 205 | - Framework::message($message,'error'); |
|
| 206 | - $this->owner = implode(',',$owner_array); |
|
| 204 | + $message = lang('Access denied to the calendar of %1 !!!', implode(', ', $no_access)); |
|
| 205 | + Framework::message($message, 'error'); |
|
| 206 | + $this->owner = implode(',', $owner_array); |
|
| 207 | 207 | return $message; |
| 208 | 208 | } |
| 209 | 209 | if (count($no_access_group)) |
| 210 | 210 | { |
| 211 | - $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.',implode(', ',$no_access_group)); |
|
| 211 | + $this->bo->warnings['groupmembers'] = lang('Groupmember(s) %1 not included, because you have no access.', implode(', ', $no_access_group)); |
|
| 212 | 212 | } |
| 213 | 213 | return false; |
| 214 | 214 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * - view: the actual view, where dialogs should return to or which they refresh |
| 228 | 228 | * @param array $set_states array to manualy set / change one of the states, default NULL = use $_REQUEST |
| 229 | 229 | */ |
| 230 | - function manage_states($set_states=NULL) |
|
| 230 | + function manage_states($set_states = NULL) |
|
| 231 | 231 | { |
| 232 | 232 | // retrieve saved states from prefs |
| 233 | 233 | $states = is_array($this->bo->cal_prefs['saved_states']) ? |
@@ -247,12 +247,12 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | else |
| 249 | 249 | { |
| 250 | - parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?" |
|
| 250 | + parse_str(substr($json_data['request']['parameters'][0], 10), $set_states); // cut off "/index.php?" |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | else |
| 254 | 254 | { |
| 255 | - $set_states = substr($_GET['menuaction'],0,9) == 'calendar.' ? $_REQUEST : array(); |
|
| 255 | + $set_states = substr($_GET['menuaction'], 0, 9) == 'calendar.' ? $_REQUEST : array(); |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | if (!$states['date'] && $states['year'] && $states['month'] && $states['day']) |
@@ -260,16 +260,16 @@ discard block |
||
| 260 | 260 | $states['date'] = $this->bo->date2string($states); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - foreach(array( |
|
| 263 | + foreach (array( |
|
| 264 | 264 | 'date' => $this->bo->date2string($this->bo->now_su), |
| 265 | 265 | 'cat_id' => 0, |
| 266 | 266 | 'status_filter' => 'default', |
| 267 | 267 | 'owner' => $this->user, |
| 268 | 268 | 'save_owner' => 0, |
| 269 | 269 | 'sortby' => 'category', |
| 270 | - 'planner_view'=> 'month', // full month |
|
| 271 | - 'view' => ($this->bo->cal_prefs['defaultcalendar']?$this->bo->cal_prefs['defaultcalendar']:'day'), // use pref, if exists else use the dayview |
|
| 272 | - 'listview_days'=> '', // no range |
|
| 270 | + 'planner_view'=> 'month', // full month |
|
| 271 | + 'view' => ($this->bo->cal_prefs['defaultcalendar'] ? $this->bo->cal_prefs['defaultcalendar'] : 'day'), // use pref, if exists else use the dayview |
|
| 272 | + 'listview_days'=> '', // no range |
|
| 273 | 273 | 'test' => 'false', |
| 274 | 274 | ) as $state => $default) |
| 275 | 275 | { |
@@ -278,42 +278,42 @@ discard block |
||
| 278 | 278 | if ($state == 'owner') |
| 279 | 279 | { |
| 280 | 280 | // only change the owners of the same resource-type as given in set_state[owner] |
| 281 | - $set_owners = is_array($set_states['owner']) ? $set_states['owner'] : explode(',',$set_states['owner']); |
|
| 281 | + $set_owners = is_array($set_states['owner']) ? $set_states['owner'] : explode(',', $set_states['owner']); |
|
| 282 | 282 | if ((string)$set_owners[0] === '0') // set exactly the specified owners (without the 0) |
| 283 | 283 | { |
| 284 | 284 | if ($set_states['owner'] === '0,r0') // small fix for resources |
| 285 | 285 | { |
| 286 | - $set_states['owner'] = $default; // --> set default, instead of none |
|
| 286 | + $set_states['owner'] = $default; // --> set default, instead of none |
|
| 287 | 287 | } |
| 288 | 288 | else |
| 289 | 289 | { |
| 290 | - $set_states['owner'] = substr($set_states['owner'],2); |
|
| 290 | + $set_states['owner'] = substr($set_states['owner'], 2); |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | else // change only the owners of the given type |
| 294 | 294 | { |
| 295 | 295 | $res_type = is_numeric($set_owners[0]) ? false : $set_owners[0][0]; |
| 296 | 296 | $owners = $states['owner'] ? $states['owner'] : $default; |
| 297 | - if(!is_array($owners)) |
|
| 297 | + if (!is_array($owners)) |
|
| 298 | 298 | { |
| 299 | - $owners = explode(',',$owners); |
|
| 299 | + $owners = explode(',', $owners); |
|
| 300 | 300 | } |
| 301 | - foreach($owners as $key => $owner) |
|
| 301 | + foreach ($owners as $key => $owner) |
|
| 302 | 302 | { |
| 303 | 303 | if (!$res_type && is_numeric($owner) || $res_type && $owner[0] == $res_type) |
| 304 | 304 | { |
| 305 | 305 | unset($owners[$key]); |
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | - if (!$res_type || !in_array($res_type.'0',$set_owners)) |
|
| 308 | + if (!$res_type || !in_array($res_type.'0', $set_owners)) |
|
| 309 | 309 | { |
| 310 | - $owners = array_merge($owners,$set_owners); |
|
| 310 | + $owners = array_merge($owners, $set_owners); |
|
| 311 | 311 | } |
| 312 | - $set_states['owner'] = implode(',',$owners); |
|
| 312 | + $set_states['owner'] = implode(',', $owners); |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | // for the uiforms class (eg. edit), dont store the (new) owner, as it might change the view |
| 316 | - if (substr($_GET['menuaction'],0,25) == 'calendar.calendar_uiforms') |
|
| 316 | + if (substr($_GET['menuaction'], 0, 25) == 'calendar.calendar_uiforms') |
|
| 317 | 317 | { |
| 318 | 318 | $this->owner = $set_states[$state]; |
| 319 | 319 | continue; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | if ($state == 'date') |
| 328 | 328 | { |
| 329 | 329 | $date_arr = $this->bo->date2array($states['date']); |
| 330 | - foreach(array('year','month','day') as $name) |
|
| 330 | + foreach (array('year', 'month', 'day') as $name) |
|
| 331 | 331 | { |
| 332 | 332 | $this->$name = $states[$name] = $date_arr[$name]; |
| 333 | 333 | } |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | $this->$state = $states[$state]; |
| 336 | 336 | } |
| 337 | 337 | // remove a given calendar from the view |
| 338 | - if (isset($_GET['close']) && ($k = array_search($_GET['close'], $owners=explode(',',$this->owner))) !== false) |
|
| 338 | + if (isset($_GET['close']) && ($k = array_search($_GET['close'], $owners = explode(',', $this->owner))) !== false) |
|
| 339 | 339 | { |
| 340 | 340 | unset($owners[$k]); |
| 341 | - $this->owner = $states['owner'] = implode(',',$owners); |
|
| 341 | + $this->owner = $states['owner'] = implode(',', $owners); |
|
| 342 | 342 | } |
| 343 | - if(is_array($this->owner)) |
|
| 343 | + if (is_array($this->owner)) |
|
| 344 | 344 | { |
| 345 | - $this->owner = implode(',',$this->owner); |
|
| 345 | + $this->owner = implode(',', $this->owner); |
|
| 346 | 346 | } |
| 347 | - if (substr($this->view,0,8) == 'planner_') |
|
| 347 | + if (substr($this->view, 0, 8) == 'planner_') |
|
| 348 | 348 | { |
| 349 | 349 | $states['sortby'] = $this->sortby = $this->view == 'planner_cat' ? 'category' : 'user'; |
| 350 | 350 | $states['view'] = $this->view = 'planner'; |
@@ -352,10 +352,10 @@ discard block |
||
| 352 | 352 | // set the actual view as return_to |
| 353 | 353 | if (isset($_GET['menuaction'])) |
| 354 | 354 | { |
| 355 | - list(,$class,$func) = explode('.',$_GET['menuaction']); |
|
| 355 | + list(,$class, $func) = explode('.', $_GET['menuaction']); |
|
| 356 | 356 | if ($func == 'index') |
| 357 | 357 | { |
| 358 | - $func = $this->view; $this->view = 'index'; // switch to the default view |
|
| 358 | + $func = $this->view; $this->view = 'index'; // switch to the default view |
|
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | else // eg. calendar/index.php |
@@ -369,18 +369,18 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | $this->view_menuaction = $this->view == 'listview' ? 'calendar.calendar_uilist.listview' : 'calendar.calendar_uiviews.index'; |
| 371 | 371 | |
| 372 | - if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1), states now %3',True,$set_states,$states); |
|
| 372 | + if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1), states now %3', True, $set_states, $states); |
|
| 373 | 373 | // save the states in the session only when we are in calendar |
| 374 | - if ($GLOBALS['egw_info']['flags']['currentapp']=='calendar') |
|
| 374 | + if ($GLOBALS['egw_info']['flags']['currentapp'] == 'calendar') |
|
| 375 | 375 | { |
| 376 | 376 | // save defined states into the user-prefs |
| 377 | - if(!empty($states) && is_array($states)) |
|
| 377 | + if (!empty($states) && is_array($states)) |
|
| 378 | 378 | { |
| 379 | - $saved_states = array_intersect_key($states,array_flip($this->states_to_save)); |
|
| 379 | + $saved_states = array_intersect_key($states, array_flip($this->states_to_save)); |
|
| 380 | 380 | if ($saved_states != $this->cal_prefs['saved_states']) |
| 381 | 381 | { |
| 382 | - $GLOBALS['egw']->preferences->add('calendar','saved_states',$saved_states); |
|
| 383 | - $GLOBALS['egw']->preferences->save_repository(false,'user',true); |
|
| 382 | + $GLOBALS['egw']->preferences->add('calendar', 'saved_states', $saved_states); |
|
| 383 | + $GLOBALS['egw']->preferences->save_repository(false, 'user', true); |
|
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | } |
@@ -394,35 +394,35 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | function event_icons($event) |
| 396 | 396 | { |
| 397 | - $is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ,$event); |
|
| 397 | + $is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ, $event); |
|
| 398 | 398 | |
| 399 | 399 | $icons = array(); |
| 400 | 400 | if (!$is_private) |
| 401 | 401 | { |
| 402 | - if($event['priority'] == 3) |
|
| 402 | + if ($event['priority'] == 3) |
|
| 403 | 403 | { |
| 404 | - $icons[] = Api\Html::image('calendar','high',lang('high priority')); |
|
| 404 | + $icons[] = Api\Html::image('calendar', 'high', lang('high priority')); |
|
| 405 | 405 | } |
| 406 | - if($event['recur_type'] != MCAL_RECUR_NONE) |
|
| 406 | + if ($event['recur_type'] != MCAL_RECUR_NONE) |
|
| 407 | 407 | { |
| 408 | - $icons[] = Api\Html::image('calendar','recur',lang('recurring event')); |
|
| 408 | + $icons[] = Api\Html::image('calendar', 'recur', lang('recurring event')); |
|
| 409 | 409 | } |
| 410 | 410 | // icons for single user, multiple users or group(s) and resources |
| 411 | - foreach(array_keys($event['participants']) as $uid) |
|
| 411 | + foreach (array_keys($event['participants']) as $uid) |
|
| 412 | 412 | { |
| 413 | - if(is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon'])) |
|
| 413 | + if (is_numeric($uid) || !isset($this->bo->resources[$uid[0]]['icon'])) |
|
| 414 | 414 | { |
| 415 | 415 | if (isset($icons['single']) || $GLOBALS['egw']->accounts->get_type($uid) == 'g') |
| 416 | 416 | { |
| 417 | 417 | unset($icons['single']); |
| 418 | - $icons['multiple'] = Api\Html::image('calendar','users'); |
|
| 418 | + $icons['multiple'] = Api\Html::image('calendar', 'users'); |
|
| 419 | 419 | } |
| 420 | 420 | elseif (!isset($icons['multiple'])) |
| 421 | 421 | { |
| 422 | - $icons['single'] = Api\Html::image('calendar','single'); |
|
| 422 | + $icons['single'] = Api\Html::image('calendar', 'single'); |
|
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | - elseif(!isset($icons[$uid[0]]) && isset($this->bo->resources[$uid[0]]) && isset($this->bo->resources[$uid[0]]['icon'])) |
|
| 425 | + elseif (!isset($icons[$uid[0]]) && isset($this->bo->resources[$uid[0]]) && isset($this->bo->resources[$uid[0]]['icon'])) |
|
| 426 | 426 | { |
| 427 | 427 | $icons[$uid[0]] = Api\Html::image($this->bo->resources[$uid[0]]['app'], |
| 428 | 428 | ($this->bo->resources[$uid[0]]['icon'] ? $this->bo->resources[$uid[0]]['icon'] : 'navbar'), |
@@ -431,21 +431,21 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | - if($event['non_blocking']) |
|
| 434 | + if ($event['non_blocking']) |
|
| 435 | 435 | { |
| 436 | - $icons[] = Api\Html::image('calendar','nonblocking',lang('non blocking')); |
|
| 436 | + $icons[] = Api\Html::image('calendar', 'nonblocking', lang('non blocking')); |
|
| 437 | 437 | } |
| 438 | - if($event['public'] == 0) |
|
| 438 | + if ($event['public'] == 0) |
|
| 439 | 439 | { |
| 440 | - $icons[] = Api\Html::image('calendar','private',lang('private')); |
|
| 440 | + $icons[] = Api\Html::image('calendar', 'private', lang('private')); |
|
| 441 | 441 | } |
| 442 | - if(isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) |
|
| 442 | + if (isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) |
|
| 443 | 443 | { |
| 444 | - $icons[] = Api\Html::image('calendar','alarm',lang('alarm')); |
|
| 444 | + $icons[] = Api\Html::image('calendar', 'alarm', lang('alarm')); |
|
| 445 | 445 | } |
| 446 | - if($event['participants'][$this->user][0] == 'U') |
|
| 446 | + if ($event['participants'][$this->user][0] == 'U') |
|
| 447 | 447 | { |
| 448 | - $icons[] = Api\Html::image('calendar','needs-action',lang('Needs action')); |
|
| 448 | + $icons[] = Api\Html::image('calendar', 'needs-action', lang('Needs action')); |
|
| 449 | 449 | } |
| 450 | 450 | return $icons; |
| 451 | 451 | } |
@@ -460,17 +460,17 @@ discard block |
||
| 460 | 460 | * @param array $vars |
| 461 | 461 | * @return string the link incl. content |
| 462 | 462 | */ |
| 463 | - function add_link($content,$date=null,$hour=null,$minute=0,array $vars=null) |
|
| 463 | + function add_link($content, $date = null, $hour = null, $minute = 0, array $vars = null) |
|
| 464 | 464 | { |
| 465 | 465 | $vars['menuaction'] = 'calendar.calendar_uiforms.edit'; |
| 466 | - $vars['date'] = $date ? $date : $this->date; |
|
| 466 | + $vars['date'] = $date ? $date : $this->date; |
|
| 467 | 467 | |
| 468 | 468 | if (!is_null($hour)) |
| 469 | 469 | { |
| 470 | 470 | $vars['hour'] = $hour; |
| 471 | 471 | $vars['minute'] = $minute; |
| 472 | 472 | } |
| 473 | - return Api\Html::a_href($content,'',$vars,' data-date="' .$vars['date'].'|'.$vars['hour'].'|'.$vars['minute'] |
|
| 473 | + return Api\Html::a_href($content, '', $vars, ' data-date="'.$vars['date'].'|'.$vars['hour'].'|'.$vars['minute'] |
|
| 474 | 474 | . '" title="'.Api\Html::htmlspecialchars(lang('Add')).'"'); |
| 475 | 475 | } |
| 476 | 476 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | // Magic etemplate2 favorites menu (from framework) |
| 483 | 483 | display_sidebox('calendar', lang('Favorites'), Framework\Favorites::list_favorites('calendar')); |
| 484 | 484 | |
| 485 | - $file = array('menuOpened' => true); // menu open by default |
|
| 485 | + $file = array('menuOpened' => true); // menu open by default |
|
| 486 | 486 | |
| 487 | 487 | // Target for etemplate |
| 488 | 488 | $file[] = array( |
@@ -495,38 +495,38 @@ discard block |
||
| 495 | 495 | // Merge print placeholders (selectbox in etemplate) |
| 496 | 496 | if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) |
| 497 | 497 | { |
| 498 | - $file['Placeholders'] = Egw::link('/index.php','menuaction=calendar.calendar_merge.show_replacements'); |
|
| 498 | + $file['Placeholders'] = Egw::link('/index.php', 'menuaction=calendar.calendar_merge.show_replacements'); |
|
| 499 | 499 | } |
| 500 | 500 | $appname = 'calendar'; |
| 501 | 501 | $menu_title = lang('Calendar Menu'); |
| 502 | - display_sidebox($appname,$menu_title,$file); |
|
| 502 | + display_sidebox($appname, $menu_title, $file); |
|
| 503 | 503 | |
| 504 | 504 | $this->sidebox_etemplate(); |
| 505 | 505 | |
| 506 | 506 | // resources menu hooks |
| 507 | 507 | foreach ($this->bo->resources as $resource) |
| 508 | 508 | { |
| 509 | - if(!is_array($resource['cal_sidebox'])) continue; |
|
| 509 | + if (!is_array($resource['cal_sidebox'])) continue; |
|
| 510 | 510 | $menu_title = $resource['cal_sidebox']['menu_title'] ? $resource['cal_sidebox']['menu_title'] : lang($resource['app']); |
| 511 | - $file = ExecMethod($resource['cal_sidebox']['file'],array( |
|
| 511 | + $file = ExecMethod($resource['cal_sidebox']['file'], array( |
|
| 512 | 512 | 'menuaction' => $this->view_menuaction, |
| 513 | 513 | 'owner' => $this->owner, |
| 514 | 514 | )); |
| 515 | - display_sidebox($appname,$menu_title,$file); |
|
| 515 | + display_sidebox($appname, $menu_title, $file); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | if ($GLOBALS['egw_info']['user']['apps']['admin']) |
| 519 | 519 | { |
| 520 | 520 | $file = Array( |
| 521 | - 'Site configuration'=>Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
| 522 | - 'Custom Fields'=>Egw::link('/index.php','menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), |
|
| 523 | - 'Global Categories' =>Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), |
|
| 521 | + 'Site configuration'=>Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
| 522 | + 'Custom Fields'=>Egw::link('/index.php', 'menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), |
|
| 523 | + 'Global Categories' =>Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), |
|
| 524 | 524 | ); |
| 525 | - $GLOBALS['egw']->framework->sidebox($appname,lang('Admin'),$file,'admin'); |
|
| 525 | + $GLOBALS['egw']->framework->sidebox($appname, lang('Admin'), $file, 'admin'); |
|
| 526 | 526 | } |
| 527 | 527 | display_sidebox('calendar', lang('Utilities'), array('Category report' => "javascript:egw_openWindowCentered2('". |
| 528 | - Egw::link('/index.php',array('menuaction'=>'calendar.calendar_category_report.index','ajax'=>true),false). |
|
| 529 | - "','_blank',870,500,'yes')" )); |
|
| 528 | + Egw::link('/index.php', array('menuaction'=>'calendar.calendar_category_report.index', 'ajax'=>true), false). |
|
| 529 | + "','_blank',870,500,'yes')")); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | /** |
@@ -534,15 +534,15 @@ discard block |
||
| 534 | 534 | */ |
| 535 | 535 | function sidebox_etemplate($content = array()) |
| 536 | 536 | { |
| 537 | - if($content['merge']) |
|
| 537 | + if ($content['merge']) |
|
| 538 | 538 | { |
| 539 | 539 | // View from sidebox is JSON encoded |
| 540 | - $this->manage_states(array_merge($content,json_decode($content['view'],true))); |
|
| 541 | - if($content['first']) |
|
| 540 | + $this->manage_states(array_merge($content, json_decode($content['view'], true))); |
|
| 541 | + if ($content['first']) |
|
| 542 | 542 | { |
| 543 | - $this->first = Api\DateTime::to($content['first'],'ts'); |
|
| 543 | + $this->first = Api\DateTime::to($content['first'], 'ts'); |
|
| 544 | 544 | } |
| 545 | - if($content['last']) |
|
| 545 | + if ($content['last']) |
|
| 546 | 546 | { |
| 547 | 547 | $this->last = new Api\DateTime($content['last']); |
| 548 | 548 | $this->last->setTime(23, 59, 59); |
@@ -559,27 +559,27 @@ discard block |
||
| 559 | 559 | if (!is_array($cont)) $cont = array(); |
| 560 | 560 | $cont['view'] = $this->view ? $this->view : 'week'; |
| 561 | 561 | $cont['date'] = $this->date ? $this->date : new Api\DateTime(); |
| 562 | - $cont['owner'] = $this->owner ? (is_array($this->owner) ? $this->owner : explode(',',$this->owner) ) : $cont['owner']; |
|
| 562 | + $cont['owner'] = $this->owner ? (is_array($this->owner) ? $this->owner : explode(',', $this->owner)) : $cont['owner']; |
|
| 563 | 563 | |
| 564 | - $cont['year'] = (int)Api\DateTime::to($cont['date'],'Y'); |
|
| 564 | + $cont['year'] = (int)Api\DateTime::to($cont['date'], 'Y'); |
|
| 565 | 565 | $cont['holidays'] = $this->bo->read_holidays($cont['year']); |
| 566 | 566 | |
| 567 | 567 | $readonlys = array(); |
| 568 | 568 | $sel_options['status_filter'] = array( |
| 569 | - array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), |
|
| 570 | - array('value' => 'accepted', 'label' => lang('Accepted'), 'title' => lang('Show only accepted events')), |
|
| 571 | - array('value' => 'unknown', 'label' => lang('Invitations'), 'title' => lang('Show only invitations, not yet accepted or rejected')), |
|
| 572 | - array('value' => 'tentative', 'label' => lang('Tentative'), 'title' => lang('Show only tentative accepted events')), |
|
| 573 | - array('value' => 'delegated', 'label' => lang('Delegated'), 'title' => lang('Show only delegated events')), |
|
| 574 | - array('value' => 'rejected', 'label' => lang('Rejected'),'title' => lang('Show only rejected events')), |
|
| 575 | - array('value' => 'owner', 'label' => lang('Owner too'),'title' => lang('Show also events just owned by selected user')), |
|
| 576 | - array('value' => 'all', 'label' => lang('All incl. rejected'),'title' => lang('Show all status incl. rejected events')), |
|
| 577 | - array('value' => 'hideprivate', 'label' => lang('Hide private infos'),'title' => lang('Show all events, as if they were private')), |
|
| 578 | - array('value' => 'showonlypublic', 'label' => lang('Hide private events'),'title' => lang('Show only events flagged as public, (not checked as private)')), |
|
| 579 | - array('value' => 'no-enum-groups', 'label' => lang('only group-events'),'title' => lang('Do not include events of group members')), |
|
| 580 | - array('value' => 'not-unknown', 'label' => lang('No meeting requests'),'title' => lang('Show all status, but unknown')), |
|
| 569 | + array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), |
|
| 570 | + array('value' => 'accepted', 'label' => lang('Accepted'), 'title' => lang('Show only accepted events')), |
|
| 571 | + array('value' => 'unknown', 'label' => lang('Invitations'), 'title' => lang('Show only invitations, not yet accepted or rejected')), |
|
| 572 | + array('value' => 'tentative', 'label' => lang('Tentative'), 'title' => lang('Show only tentative accepted events')), |
|
| 573 | + array('value' => 'delegated', 'label' => lang('Delegated'), 'title' => lang('Show only delegated events')), |
|
| 574 | + array('value' => 'rejected', 'label' => lang('Rejected'), 'title' => lang('Show only rejected events')), |
|
| 575 | + array('value' => 'owner', 'label' => lang('Owner too'), 'title' => lang('Show also events just owned by selected user')), |
|
| 576 | + array('value' => 'all', 'label' => lang('All incl. rejected'), 'title' => lang('Show all status incl. rejected events')), |
|
| 577 | + array('value' => 'hideprivate', 'label' => lang('Hide private infos'), 'title' => lang('Show all events, as if they were private')), |
|
| 578 | + array('value' => 'showonlypublic', 'label' => lang('Hide private events'), 'title' => lang('Show only events flagged as public, (not checked as private)')), |
|
| 579 | + array('value' => 'no-enum-groups', 'label' => lang('only group-events'), 'title' => lang('Do not include events of group members')), |
|
| 580 | + array('value' => 'not-unknown', 'label' => lang('No meeting requests'), 'title' => lang('Show all status, but unknown')), |
|
| 581 | 581 | ); |
| 582 | - if($GLOBALS['egw_info']['server']['calendar_delete_history']) |
|
| 582 | + if ($GLOBALS['egw_info']['server']['calendar_delete_history']) |
|
| 583 | 583 | { |
| 584 | 584 | $sel_options['status_filter'][] = array('value' => 'deleted', 'label' => lang('Deleted'), 'title' => lang('Show events that have been deleted')); |
| 585 | 585 | } |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | // Merge print |
| 588 | 588 | if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) |
| 589 | 589 | { |
| 590 | - $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null,'calendar'); |
|
| 590 | + $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null, 'calendar'); |
|
| 591 | 591 | } |
| 592 | 592 | else |
| 593 | 593 | { |
@@ -616,10 +616,10 @@ discard block |
||
| 616 | 616 | */ |
| 617 | 617 | public function update_client($event_id, Api\DateTime $recurrence_date = null) |
| 618 | 618 | { |
| 619 | - if(!$event_id) return false; |
|
| 620 | - if(is_string($event_id) && strpos($event_id,':') !== FALSE) |
|
| 619 | + if (!$event_id) return false; |
|
| 620 | + if (is_string($event_id) && strpos($event_id, ':') !== FALSE) |
|
| 621 | 621 | { |
| 622 | - list($event_id, $date) = explode(':',$event_id); |
|
| 622 | + list($event_id, $date) = explode(':', $event_id); |
|
| 623 | 623 | $recurrence_date = new Api\DateTime($date); |
| 624 | 624 | } |
| 625 | 625 | |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | // Check filters to see if they still match, may have to remove |
| 633 | 633 | // the event because it should no longer be displayed |
| 634 | 634 | $filter_match = true; |
| 635 | - if($event && ($this->cal_prefs['saved_states']['status_filter'] != 'all' || |
|
| 635 | + if ($event && ($this->cal_prefs['saved_states']['status_filter'] != 'all' || |
|
| 636 | 636 | $this->cal_prefs['saved_states']['cat_id'])) |
| 637 | 637 | { |
| 638 | 638 | $filter_check = array( |
@@ -645,20 +645,20 @@ discard block |
||
| 645 | 645 | $filter_match = count($this->bo->search($filter_check, $this->bo->so->cal_table.".cal_id = {$event['id']}")) > 0; |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | - if(!$event || !$filter_match) |
|
| 648 | + if (!$event || !$filter_match) |
|
| 649 | 649 | { |
| 650 | 650 | // Sending null will trigger a removal |
| 651 | 651 | $response->generic('data', array('uid' => 'calendar::'.$event_id, 'data' => null)); |
| 652 | 652 | return false; |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | - if(!$event['recur_type'] || $recurrence_date) |
|
| 655 | + if (!$event['recur_type'] || $recurrence_date) |
|
| 656 | 656 | { |
| 657 | 657 | $this->to_client($event); |
| 658 | 658 | $response->generic('data', array('uid' => 'calendar::'.$event['row_id'], 'data' => $event)); |
| 659 | 659 | } |
| 660 | 660 | // If it's recurring, try to send the next month or so |
| 661 | - else if($event['recur_type'] ) |
|
| 661 | + else if ($event['recur_type']) |
|
| 662 | 662 | { |
| 663 | 663 | $this_month = new Api\DateTime('next month'); |
| 664 | 664 | $rrule = calendar_rrule::event2rrule($event, true); |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | $response->generic('data', array('uid' => 'calendar::'.$converted['row_id'], 'data' => $converted)); |
| 672 | 672 | $rrule->next(); |
| 673 | 673 | } |
| 674 | - while ($rrule->valid() && $occurrence <= $this_month ); |
|
| 674 | + while ($rrule->valid() && $occurrence <= $this_month); |
|
| 675 | 675 | } |
| 676 | 676 | return true; |
| 677 | 677 | } |
@@ -687,15 +687,15 @@ discard block |
||
| 687 | 687 | */ |
| 688 | 688 | public function to_client(&$event) |
| 689 | 689 | { |
| 690 | - if(!$event || !is_array($event)) return false; |
|
| 690 | + if (!$event || !is_array($event)) return false; |
|
| 691 | 691 | |
| 692 | - if (!$this->bo->check_perms(Acl::EDIT,$event)) |
|
| 692 | + if (!$this->bo->check_perms(Acl::EDIT, $event)) |
|
| 693 | 693 | { |
| 694 | 694 | $event['class'] .= 'rowNoEdit '; |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | // Delete disabled for other applications |
| 698 | - if (!$this->bo->check_perms(Acl::DELETE,$event) || !is_numeric($event['id'])) |
|
| 698 | + if (!$this->bo->check_perms(Acl::DELETE, $event) || !is_numeric($event['id'])) |
|
| 699 | 699 | { |
| 700 | 700 | $event['class'] .= 'rowNoDelete '; |
| 701 | 701 | } |
@@ -708,32 +708,32 @@ discard block |
||
| 708 | 708 | |
| 709 | 709 | $event['recure'] = $this->bo->recure2string($event); |
| 710 | 710 | |
| 711 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
| 712 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
| 711 | + if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
| 712 | + if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
| 713 | 713 | |
| 714 | 714 | // respect category permissions |
| 715 | - if(!empty($event['category'])) |
|
| 715 | + if (!empty($event['category'])) |
|
| 716 | 716 | { |
| 717 | 717 | $event['category'] = $this->categories->check_list(Acl::READ, $event['category']); |
| 718 | 718 | } |
| 719 | 719 | $event['non_blocking'] = (bool)$event['non_blocking']; |
| 720 | 720 | |
| 721 | 721 | $matches = null; |
| 722 | - if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches)) |
|
| 722 | + if (!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i', $event['id'], $matches)) |
|
| 723 | 723 | { |
| 724 | 724 | $app = $matches[1]; |
| 725 | 725 | $app_id = $matches[2]; |
| 726 | 726 | $icons = array(); |
| 727 | - if(!($is_private = calendar_bo::integration_get_private($app,$app_id,$event))) |
|
| 727 | + if (!($is_private = calendar_bo::integration_get_private($app, $app_id, $event))) |
|
| 728 | 728 | { |
| 729 | - $icons = calendar_uiviews::integration_get_icons($app,$app_id,$event); |
|
| 729 | + $icons = calendar_uiviews::integration_get_icons($app, $app_id, $event); |
|
| 730 | 730 | } |
| 731 | 731 | $event['app'] = $app; |
| 732 | 732 | $event['app_id'] = $app_id; |
| 733 | 733 | } |
| 734 | 734 | else |
| 735 | 735 | { |
| 736 | - $is_private = !$this->bo->check_perms(Acl::READ,$event); |
|
| 736 | + $is_private = !$this->bo->check_perms(Acl::READ, $event); |
|
| 737 | 737 | } |
| 738 | 738 | if ($is_private) |
| 739 | 739 | { |
@@ -741,27 +741,27 @@ discard block |
||
| 741 | 741 | $event['class'] .= 'rowNoView '; |
| 742 | 742 | } |
| 743 | 743 | |
| 744 | - if(!$event['app']) |
|
| 744 | + if (!$event['app']) |
|
| 745 | 745 | { |
| 746 | 746 | $event['app'] = 'calendar'; |
| 747 | 747 | } |
| 748 | - if(!$event['app_id']) |
|
| 748 | + if (!$event['app_id']) |
|
| 749 | 749 | { |
| 750 | 750 | $event['app_id'] = $event['id']; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | if ($event['recur_type'] != MCAL_RECUR_NONE) |
| 754 | 754 | { |
| 755 | - $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts'); |
|
| 755 | + $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts'); |
|
| 756 | 756 | } |
| 757 | 757 | // set id for grid |
| 758 | - $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts') : ''); |
|
| 758 | + $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts') : ''); |
|
| 759 | 759 | |
| 760 | 760 | // Set up participant section of tooltip |
| 761 | - $participants = $this->bo->participants($event,false); |
|
| 762 | - $event['parts'] = implode("\n",$participants); |
|
| 761 | + $participants = $this->bo->participants($event, false); |
|
| 762 | + $event['parts'] = implode("\n", $participants); |
|
| 763 | 763 | $event['participant_types'] = array(); |
| 764 | - foreach($participants as $uid => $text) |
|
| 764 | + foreach ($participants as $uid => $text) |
|
| 765 | 765 | { |
| 766 | 766 | $user_type = $user_id = null; |
| 767 | 767 | calendar_so::split_user($uid, $user_type, $user_id); |
@@ -771,9 +771,9 @@ discard block |
||
| 771 | 771 | $event['date'] = $this->bo->date2string($event['start']); |
| 772 | 772 | |
| 773 | 773 | // Change dates |
| 774 | - foreach(calendar_egw_record::$types['date-time'] as $field) |
|
| 774 | + foreach (calendar_egw_record::$types['date-time'] as $field) |
|
| 775 | 775 | { |
| 776 | - if(is_int($event[$field])) |
|
| 776 | + if (is_int($event[$field])) |
|
| 777 | 777 | { |
| 778 | 778 | $event[$field] = Api\DateTime::to($event[$field], Api\DateTime::ET2); |
| 779 | 779 | } |
@@ -791,13 +791,13 @@ discard block |
||
| 791 | 791 | public function merge($timespan = array()) |
| 792 | 792 | { |
| 793 | 793 | // Merge print |
| 794 | - if($_GET['merge']) |
|
| 794 | + if ($_GET['merge']) |
|
| 795 | 795 | { |
| 796 | - if(!$timespan) |
|
| 796 | + if (!$timespan) |
|
| 797 | 797 | { |
| 798 | 798 | // Try to make time span into appropriate ranges to match |
| 799 | - if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month'; |
|
| 800 | - if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week'; |
|
| 799 | + if (stripos($_GET['merge'], 'month') !== false || stripos($_GET['merge'], lang('month')) !== false) $template = 'month'; |
|
| 800 | + if (stripos($_GET['merge'], 'week') !== false || stripos($_GET['merge'], lang('week')) !== false) $template = 'week'; |
|
| 801 | 801 | //error_log("Detected template $template"); |
| 802 | 802 | switch ($template) |
| 803 | 803 | { |
@@ -805,8 +805,8 @@ discard block |
||
| 805 | 805 | // Trim to _only_ the month, do not pad to week start / end |
| 806 | 806 | $time = new Api\DateTime($this->date); |
| 807 | 807 | $timespan = array(array( |
| 808 | - 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'),'ts'), |
|
| 809 | - 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'),'ts') |
|
| 808 | + 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'), 'ts'), |
|
| 809 | + 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'), 'ts') |
|
| 810 | 810 | )); |
| 811 | 811 | break; |
| 812 | 812 | case 'week': |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | $start = new Api\DateTime($this->first); |
| 815 | 815 | $t = clone $start; |
| 816 | 816 | $t->modify('+1 week')->modify('-1 second'); |
| 817 | - if($t->format('ts') < Api\DateTime::to($this->last,'ts')) |
|
| 817 | + if ($t->format('ts') < Api\DateTime::to($this->last, 'ts')) |
|
| 818 | 818 | { |
| 819 | 819 | do |
| 820 | 820 | { |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | ); |
| 825 | 825 | $start->modify('+1 week'); |
| 826 | 826 | $t->modify('+1 week'); |
| 827 | - } while( $start->format('ts') < $this->last); |
|
| 827 | + } while ($start->format('ts') < $this->last); |
|
| 828 | 828 | break; |
| 829 | 829 | } |
| 830 | 830 | // Fall through |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | Framework::refresh_opener($error, 'calendar'); |
| 843 | 843 | } |
| 844 | 844 | unset($_GET['merge']); |
| 845 | - if($error) |
|
| 845 | + if ($error) |
|
| 846 | 846 | { |
| 847 | 847 | // This doesn't give message either, but at least it doesn't give a blank screen |
| 848 | 848 | Framework::redirect_link('/index.php', array( |
@@ -166,7 +166,10 @@ discard block |
||
| 166 | 166 | unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); |
| 167 | 167 | |
| 168 | 168 | // make sure the hook for export_limit is registered |
| 169 | - if (!Api\Hooks::exists('export_limit','calendar')) Api\Hooks::read(true); |
|
| 169 | + if (!Api\Hooks::exists('export_limit','calendar')) |
|
| 170 | + { |
|
| 171 | + Api\Hooks::read(true); |
|
| 172 | + } |
|
| 170 | 173 | } |
| 171 | 174 | |
| 172 | 175 | /** |
@@ -279,11 +282,15 @@ discard block |
||
| 279 | 282 | { |
| 280 | 283 | // only change the owners of the same resource-type as given in set_state[owner] |
| 281 | 284 | $set_owners = is_array($set_states['owner']) ? $set_states['owner'] : explode(',',$set_states['owner']); |
| 282 | - if ((string)$set_owners[0] === '0') // set exactly the specified owners (without the 0) |
|
| 285 | + if ((string)$set_owners[0] === '0') |
|
| 286 | + { |
|
| 287 | + // set exactly the specified owners (without the 0) |
|
| 283 | 288 | { |
| 284 | 289 | if ($set_states['owner'] === '0,r0') // small fix for resources |
| 285 | 290 | { |
| 286 | - $set_states['owner'] = $default; // --> set default, instead of none |
|
| 291 | + $set_states['owner'] = $default; |
|
| 292 | + } |
|
| 293 | + // --> set default, instead of none |
|
| 287 | 294 | } |
| 288 | 295 | else |
| 289 | 296 | { |
@@ -369,7 +376,10 @@ discard block |
||
| 369 | 376 | } |
| 370 | 377 | $this->view_menuaction = $this->view == 'listview' ? 'calendar.calendar_uilist.listview' : 'calendar.calendar_uiviews.index'; |
| 371 | 378 | |
| 372 | - if ($this->debug > 0 || $this->debug == 'manage_states') $this->bo->debug_message('uical::manage_states(%1), states now %3',True,$set_states,$states); |
|
| 379 | + if ($this->debug > 0 || $this->debug == 'manage_states') |
|
| 380 | + { |
|
| 381 | + $this->bo->debug_message('uical::manage_states(%1), states now %3',True,$set_states,$states); |
|
| 382 | + } |
|
| 373 | 383 | // save the states in the session only when we are in calendar |
| 374 | 384 | if ($GLOBALS['egw_info']['flags']['currentapp']=='calendar') |
| 375 | 385 | { |
@@ -505,8 +515,11 @@ discard block |
||
| 505 | 515 | |
| 506 | 516 | // resources menu hooks |
| 507 | 517 | foreach ($this->bo->resources as $resource) |
| 508 | - { |
|
| 509 | - if(!is_array($resource['cal_sidebox'])) continue; |
|
| 518 | + { |
|
| 519 | + if(!is_array($resource['cal_sidebox'])) |
|
| 520 | + { |
|
| 521 | + continue; |
|
| 522 | + } |
|
| 510 | 523 | $menu_title = $resource['cal_sidebox']['menu_title'] ? $resource['cal_sidebox']['menu_title'] : lang($resource['app']); |
| 511 | 524 | $file = ExecMethod($resource['cal_sidebox']['file'],array( |
| 512 | 525 | 'menuaction' => $this->view_menuaction, |
@@ -556,7 +569,10 @@ discard block |
||
| 556 | 569 | $sidebox = new Etemplate('calendar.sidebox'); |
| 557 | 570 | |
| 558 | 571 | $cont = $this->cal_prefs['saved_states']; |
| 559 | - if (!is_array($cont)) $cont = array(); |
|
| 572 | + if (!is_array($cont)) |
|
| 573 | + { |
|
| 574 | + $cont = array(); |
|
| 575 | + } |
|
| 560 | 576 | $cont['view'] = $this->view ? $this->view : 'week'; |
| 561 | 577 | $cont['date'] = $this->date ? $this->date : new Api\DateTime(); |
| 562 | 578 | $cont['owner'] = $this->owner ? (is_array($this->owner) ? $this->owner : explode(',',$this->owner) ) : $cont['owner']; |
@@ -616,7 +632,10 @@ discard block |
||
| 616 | 632 | */ |
| 617 | 633 | public function update_client($event_id, Api\DateTime $recurrence_date = null) |
| 618 | 634 | { |
| 619 | - if(!$event_id) return false; |
|
| 635 | + if(!$event_id) |
|
| 636 | + { |
|
| 637 | + return false; |
|
| 638 | + } |
|
| 620 | 639 | if(is_string($event_id) && strpos($event_id,':') !== FALSE) |
| 621 | 640 | { |
| 622 | 641 | list($event_id, $date) = explode(':',$event_id); |
@@ -687,7 +706,10 @@ discard block |
||
| 687 | 706 | */ |
| 688 | 707 | public function to_client(&$event) |
| 689 | 708 | { |
| 690 | - if(!$event || !is_array($event)) return false; |
|
| 709 | + if(!$event || !is_array($event)) |
|
| 710 | + { |
|
| 711 | + return false; |
|
| 712 | + } |
|
| 691 | 713 | |
| 692 | 714 | if (!$this->bo->check_perms(Acl::EDIT,$event)) |
| 693 | 715 | { |
@@ -708,8 +730,16 @@ discard block |
||
| 708 | 730 | |
| 709 | 731 | $event['recure'] = $this->bo->recure2string($event); |
| 710 | 732 | |
| 711 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
| 712 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
| 733 | + if (empty($event['description'])) |
|
| 734 | + { |
|
| 735 | + $event['description'] = ' '; |
|
| 736 | + } |
|
| 737 | + // no description screws the titles horz. alignment |
|
| 738 | + if (empty($event['location'])) |
|
| 739 | + { |
|
| 740 | + $event['location'] = ' '; |
|
| 741 | + } |
|
| 742 | + // no location screws the owner horz. alignment |
|
| 713 | 743 | |
| 714 | 744 | // respect category permissions |
| 715 | 745 | if(!empty($event['category'])) |
@@ -796,8 +826,14 @@ discard block |
||
| 796 | 826 | if(!$timespan) |
| 797 | 827 | { |
| 798 | 828 | // Try to make time span into appropriate ranges to match |
| 799 | - if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month'; |
|
| 800 | - if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week'; |
|
| 829 | + if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) |
|
| 830 | + { |
|
| 831 | + $template = 'month'; |
|
| 832 | + } |
|
| 833 | + if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) |
|
| 834 | + { |
|
| 835 | + $template = 'week'; |
|
| 836 | + } |
|
| 801 | 837 | //error_log("Detected template $template"); |
| 802 | 838 | switch ($template) |
| 803 | 839 | { |