@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'category' => array( |
92 | 92 | 'type' => 'select', |
93 | 93 | 'label' => lang('Choose a category'), |
94 | - 'options' => array(), // specification of options is postponed into the get_user_interface function |
|
94 | + 'options' => array(), // specification of options is postponed into the get_user_interface function |
|
95 | 95 | 'multiple' => true, |
96 | 96 | ), |
97 | 97 | 'numWeeks' => array( |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | { |
158 | 158 | //_debug_array($GLOBALS['Common_BO']->sites->current_site); |
159 | 159 | // copied from bookmarks module. |
160 | - $cat = createobject('phpgwapi.categories','','calendar'); |
|
161 | - $cats = $cat->return_array('all',0,False,'','cat_name','',True); |
|
160 | + $cat = createobject('phpgwapi.categories', '', 'calendar'); |
|
161 | + $cats = $cat->return_array('all', 0, False, '', 'cat_name', '', True); |
|
162 | 162 | $cat_ids = array(); |
163 | 163 | while (list(,$category) = @each($cats)) |
164 | 164 | { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $GLOBALS['egw']->accounts = new Api\Accounts(); |
175 | 175 | } |
176 | - $this->accounts =& $GLOBALS['egw']->accounts; |
|
176 | + $this->accounts = & $GLOBALS['egw']->accounts; |
|
177 | 177 | $search_params = array( |
178 | 178 | 'type' => 'both', |
179 | 179 | 'app' => 'calendar', |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | $users = array(); |
183 | 183 | $groups = array(); |
184 | 184 | // sort users and groups separately. |
185 | - $anon_user = $this->accounts->name2id($GLOBALS['Common_BO']->sites->current_site['anonymous_user'],'account_lid','u'); |
|
186 | - $anon_groups = $this->accounts->memberships($anon_user,true); |
|
185 | + $anon_user = $this->accounts->name2id($GLOBALS['Common_BO']->sites->current_site['anonymous_user'], 'account_lid', 'u'); |
|
186 | + $anon_groups = $this->accounts->memberships($anon_user, true); |
|
187 | 187 | foreach ($accounts as $entry) |
188 | 188 | { |
189 | 189 | $is_group = false; |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | $acl = new Acl($entry['account_id']); |
192 | 192 | $acl->read_repository(); |
193 | 193 | // get the rights for each account to check whether the anon user has read permissions. |
194 | - $rights = $acl->get_rights($anon_user,'calendar'); |
|
194 | + $rights = $acl->get_rights($anon_user, 'calendar'); |
|
195 | 195 | // also add the anon user if it's his own calendar. |
196 | - if (($rights & Acl::READ) || ($entry['account_id'] == $anon_user)) |
|
196 | + if (($rights&Acl::READ) || ($entry['account_id'] == $anon_user)) |
|
197 | 197 | { |
198 | 198 | $has_read_permissions = true; |
199 | 199 | } |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | // or ass permissions if this is the anon group's calendar. |
204 | 204 | foreach ($anon_groups as $parent_group) |
205 | 205 | { |
206 | - $rights = $acl->get_rights($parent_group,'calendar'); |
|
207 | - if (($rights & Acl::READ) || ($entry['account_id'] == $parent_group)) |
|
206 | + $rights = $acl->get_rights($parent_group, 'calendar'); |
|
207 | + if (($rights&Acl::READ) || ($entry['account_id'] == $parent_group)) |
|
208 | 208 | { |
209 | 209 | $has_read_permissions = true; |
210 | 210 | break; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | else |
222 | 222 | { |
223 | - $users[$entry['account_id']] = Api\Accounts::format_username($entry['account_lid'],$entry['account_firstname'],$entry['account_lastname']); |
|
223 | + $users[$entry['account_id']] = Api\Accounts::format_username($entry['account_lid'], $entry['account_firstname'], $entry['account_lastname']); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | return parent::get_user_interface(); |
241 | 241 | } |
242 | 242 | |
243 | - function get_content(&$arguments,$properties) |
|
243 | + function get_content(&$arguments, $properties) |
|
244 | 244 | { |
245 | 245 | $html = ""; |
246 | 246 | Api\Translation::add_app('calendar'); |
@@ -249,17 +249,17 @@ discard block |
||
249 | 249 | $this->ui->allowEdit = false; |
250 | 250 | $this->ui->use_time_grid = isset($arguments['grid']) ? $arguments['grid'] : false; |
251 | 251 | |
252 | - $weeks = $arguments['numWeeks'] ? (int) $arguments['numWeeks'] : 4; |
|
253 | - $dateOffset = $arguments['offset'] ? (int) $arguments['offset'] : 0; |
|
252 | + $weeks = $arguments['numWeeks'] ? (int)$arguments['numWeeks'] : 4; |
|
253 | + $dateOffset = $arguments['offset'] ? (int)$arguments['offset'] : 0; |
|
254 | 254 | |
255 | - if (($arguments['acceptDateParam']) && (get_var('date',array('POST','GET')))) |
|
255 | + if (($arguments['acceptDateParam']) && (get_var('date', array('POST', 'GET')))) |
|
256 | 256 | { |
257 | - $first = (int) (strtotime(get_var('date',array('POST','GET'))) + |
|
257 | + $first = (int)(strtotime(get_var('date', array('POST', 'GET'))) + |
|
258 | 258 | (60 * 60 * 24 * 7 * $dateOffset)); |
259 | 259 | } |
260 | 260 | else |
261 | 261 | { |
262 | - $first = (int) ($this->bo->now_su + |
|
262 | + $first = (int)($this->bo->now_su + |
|
263 | 263 | (60 * 60 * 24 * 7 * $dateOffset)); |
264 | 264 | } |
265 | 265 | if ($arguments['useWeekStart']) |
@@ -269,20 +269,19 @@ discard block |
||
269 | 269 | $first = $start->format('ts'); |
270 | 270 | } |
271 | 271 | |
272 | - $last = (int) ($first + |
|
272 | + $last = (int)($first + |
|
273 | 273 | (60 * 60 * 24 * 7 * $weeks)); |
274 | 274 | |
275 | 275 | if ($arguments['showTitle']) |
276 | 276 | { |
277 | 277 | $html .= '<div id="divAppboxHeader">'.$GLOBALS['egw_info']['apps']['calendar']['title'].' - '; |
278 | - $html .= lang('After %1',$this->bo->long_date($first)); |
|
278 | + $html .= lang('After %1', $this->bo->long_date($first)); |
|
279 | 279 | $html .= "</div>"; |
280 | 280 | } |
281 | 281 | |
282 | 282 | // set the search parameters |
283 | - $search_params = Array |
|
284 | - ( |
|
285 | - 'offset' => $arguments['entryOffset'] ? (int) $arguments['entryOffset'] : false, |
|
283 | + $search_params = Array( |
|
284 | + 'offset' => $arguments['entryOffset'] ? (int)$arguments['entryOffset'] : false, |
|
286 | 285 | 'order' => 'cal_start ASC', |
287 | 286 | 'start' => $first, |
288 | 287 | 'end' => $last, |
@@ -302,23 +301,23 @@ discard block |
||
302 | 301 | } |
303 | 302 | if ($arguments['numEntries']) |
304 | 303 | { |
305 | - $search_params['num_rows'] = (int) $arguments['numEntries']; |
|
306 | - $search_params['offset'] = $arguments['entryOffset'] ? (int) $arguments['entryOffset'] :0; |
|
304 | + $search_params['num_rows'] = (int)$arguments['numEntries']; |
|
305 | + $search_params['offset'] = $arguments['entryOffset'] ? (int)$arguments['entryOffset'] : 0; |
|
307 | 306 | } |
308 | 307 | $rows = array(); |
309 | 308 | |
310 | - foreach((array) $this->bo->search($search_params) as $event) |
|
309 | + foreach ((array)$this->bo->search($search_params) as $event) |
|
311 | 310 | { |
312 | 311 | $event['date'] = $this->bo->date2string($event['start']); |
313 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
314 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
312 | + if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
313 | + if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
315 | 314 | $rows[] = $event; |
316 | 315 | } |
317 | 316 | if (($arguments['showWeeks']) && ((int)$arguments['offset'] == 0)) |
318 | 317 | { |
319 | 318 | $html .= "<div>".lang('Next')." ".lang('%1 weeks', $weeks).":</div>\n"; |
320 | 319 | } |
321 | - if (($search_params['offset'] && $this->bo->total == 0) || count($rows)==0) |
|
320 | + if (($search_params['offset'] && $this->bo->total == 0) || count($rows) == 0) |
|
322 | 321 | { |
323 | 322 | $html .= "<div>".lang("no events found")."</div>"; |
324 | 323 | } |
@@ -331,11 +330,11 @@ discard block |
||
331 | 330 | $html .= ' <div class="cal_list_weektop"></div>'."\n"; |
332 | 331 | foreach ($rows as $event) |
333 | 332 | { |
334 | - if (($last_week != 0) && (adodb_date('W-Y',$event['start']) != $last_week)) |
|
333 | + if (($last_week != 0) && (adodb_date('W-Y', $event['start']) != $last_week)) |
|
335 | 334 | { |
336 | 335 | $html .= ' <div class="cal_list_weeksplit"></div>'."\n"; |
337 | 336 | } |
338 | - $last_week = adodb_date('W-Y',$event['start']); |
|
337 | + $last_week = adodb_date('W-Y', $event['start']); |
|
339 | 338 | $html .= " <!-- Event -->\n"; |
340 | 339 | if ($event_count % 2 == 0) { |
341 | 340 | $html .= ' <div class="cal_list_event cal_event_even">'."\n"; |
@@ -347,17 +346,17 @@ discard block |
||
347 | 346 | $html .= ' <div class="cal_list_title">'.$event['title']."</div>\n"; |
348 | 347 | $html .= ' <div class="cal_list_date">'; |
349 | 348 | $html .= '<span class="cal_list_start">'; |
350 | - $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['start'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
|
349 | + $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D', $event['start'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
|
351 | 350 | $html .= $this->bo->format_date($event['start'])."</span>"; |
352 | 351 | $html .= '<span class="cal_list_end"> - '; |
353 | - $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
|
352 | + $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D', $event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
|
354 | 353 | $html .= $this->bo->format_date($event['end'])."</span></div>\n"; |
355 | 354 | $descr = trim($event['description']); |
356 | - if (! empty($descr)) { |
|
357 | - $html .= " <div class=\"cal_list_descr\">\n".preg_replace('/\\n/',"<br>\n",$event['description'])."</div>\n"; |
|
355 | + if (!empty($descr)) { |
|
356 | + $html .= " <div class=\"cal_list_descr\">\n".preg_replace('/\\n/', "<br>\n", $event['description'])."</div>\n"; |
|
358 | 357 | } |
359 | 358 | $html .= " </div><!-- cal_list_event -->\n"; |
360 | - $event_count ++; |
|
359 | + $event_count++; |
|
361 | 360 | } |
362 | 361 | $html .= ' <div class="cal_list_weekbottom"></div>'."\n"; |
363 | 362 | $html .= "<!-- End module -->\n"; |
@@ -165,7 +165,8 @@ discard block |
||
165 | 165 | $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); |
166 | 166 | } |
167 | 167 | $this->arguments['category']['options'] = $cat_ids; |
168 | - if (count($cat_ids) > 5) { |
|
168 | + if (count($cat_ids) > 5) |
|
169 | + { |
|
169 | 170 | $this->arguments['category']['multiple'] = 5; |
170 | 171 | } |
171 | 172 | |
@@ -310,8 +311,16 @@ discard block |
||
310 | 311 | foreach((array) $this->bo->search($search_params) as $event) |
311 | 312 | { |
312 | 313 | $event['date'] = $this->bo->date2string($event['start']); |
313 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
314 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
314 | + if (empty($event['description'])) |
|
315 | + { |
|
316 | + $event['description'] = ' '; |
|
317 | + } |
|
318 | + // no description screws the titles horz. alignment |
|
319 | + if (empty($event['location'])) |
|
320 | + { |
|
321 | + $event['location'] = ' '; |
|
322 | + } |
|
323 | + // no location screws the owner horz. alignment |
|
315 | 324 | $rows[] = $event; |
316 | 325 | } |
317 | 326 | if (($arguments['showWeeks']) && ((int)$arguments['offset'] == 0)) |
@@ -337,7 +346,8 @@ discard block |
||
337 | 346 | } |
338 | 347 | $last_week = adodb_date('W-Y',$event['start']); |
339 | 348 | $html .= " <!-- Event -->\n"; |
340 | - if ($event_count % 2 == 0) { |
|
349 | + if ($event_count % 2 == 0) |
|
350 | + { |
|
341 | 351 | $html .= ' <div class="cal_list_event cal_event_even">'."\n"; |
342 | 352 | } |
343 | 353 | else |
@@ -353,7 +363,8 @@ discard block |
||
353 | 363 | $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
354 | 364 | $html .= $this->bo->format_date($event['end'])."</span></div>\n"; |
355 | 365 | $descr = trim($event['description']); |
356 | - if (! empty($descr)) { |
|
366 | + if (! empty($descr)) |
|
367 | + { |
|
357 | 368 | $html .= " <div class=\"cal_list_descr\">\n".preg_replace('/\\n/',"<br>\n",$event['description'])."</div>\n"; |
358 | 369 | } |
359 | 370 | $html .= " </div><!-- cal_list_event -->\n"; |
@@ -280,7 +280,7 @@ |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | // set the search parameters |
283 | - $search_params = Array |
|
283 | + $search_params = array |
|
284 | 284 | ( |
285 | 285 | 'offset' => $arguments['entryOffset'] ? (int) $arguments['entryOffset'] : false, |
286 | 286 | 'order' => 'cal_start ASC', |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $setup_info['calendar']['enable'] = 1; |
16 | 16 | $setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index&ajax=true'; |
17 | 17 | |
18 | -$setup_info['calendar']['license'] = 'GPL'; |
|
18 | +$setup_info['calendar']['license'] = 'GPL'; |
|
19 | 19 | $setup_info['calendar']['description'] = |
20 | 20 | 'Powerful group calendar with meeting request system and ACL security.'; |
21 | 21 | $setup_info['calendar']['note'] = |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | $setup_info['resources']['depends'][] = array( |
40 | 40 | 'appname' => 'api', |
41 | - 'versions' => Array('16.1') |
|
41 | + 'versions' => array('16.1') |
|
42 | 42 | ); |
43 | 43 | |
44 | 44 |
@@ -12,41 +12,41 @@ discard block |
||
12 | 12 | $phpgw_baseline = array( |
13 | 13 | 'egw_cal' => array( |
14 | 14 | 'fd' => array( |
15 | - 'cal_id' => array('type' => 'auto','nullable' => False,'comment' => 'calendar id'), |
|
16 | - 'cal_uid' => array('type' => 'ascii','precision' => '128','nullable' => False,'comment' => 'unique id of event(-series)'), |
|
17 | - 'cal_owner' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'), |
|
18 | - 'cal_category' => array('type' => 'ascii','meta' => 'category','precision' => '64','comment' => 'category id(s)'), |
|
19 | - 'cal_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'ts of last modification'), |
|
20 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2','comment' => 'priority: 1=Low, 2=Normal, 3=High'), |
|
21 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'), |
|
22 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'title of event'), |
|
23 | - 'cal_description' => array('type' => 'varchar','precision' => '16384','comment' => 'description'), |
|
24 | - 'cal_location' => array('type' => 'varchar','precision' => '255','comment' => 'location'), |
|
25 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'), |
|
26 | - 'cal_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'user who last modified event'), |
|
27 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'), |
|
28 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
29 | - 'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'), |
|
30 | - 'cal_creator' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'creating user'), |
|
31 | - 'cal_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'creation time of event'), |
|
32 | - 'cal_recurrence' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'), |
|
33 | - 'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'), |
|
34 | - 'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted'), |
|
35 | - 'caldav_name' => array('type' => 'ascii','precision' => '128','comment' => 'name part of CalDAV URL, if specified by client'), |
|
36 | - 'range_start' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'startdate (of range)'), |
|
37 | - 'range_end' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'enddate (of range, UNTIL of RRULE)') |
|
15 | + 'cal_id' => array('type' => 'auto', 'nullable' => False, 'comment' => 'calendar id'), |
|
16 | + 'cal_uid' => array('type' => 'ascii', 'precision' => '128', 'nullable' => False, 'comment' => 'unique id of event(-series)'), |
|
17 | + 'cal_owner' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'comment' => 'event owner / calendar'), |
|
18 | + 'cal_category' => array('type' => 'ascii', 'meta' => 'category', 'precision' => '64', 'comment' => 'category id(s)'), |
|
19 | + 'cal_modified' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'comment' => 'ts of last modification'), |
|
20 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2', 'comment' => 'priority: 1=Low, 2=Normal, 3=High'), |
|
21 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1', 'comment' => '1=public, 0=private event'), |
|
22 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'title of event'), |
|
23 | + 'cal_description' => array('type' => 'varchar', 'precision' => '16384', 'comment' => 'description'), |
|
24 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'location'), |
|
25 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'cal_id of series for exception'), |
|
26 | + 'cal_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'comment' => 'user who last modified event'), |
|
27 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0', 'comment' => '1 for non-blocking events'), |
|
28 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
29 | + 'cal_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag for optimistic locking'), |
|
30 | + 'cal_creator' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'comment' => 'creating user'), |
|
31 | + 'cal_created' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'comment' => 'creation time of event'), |
|
32 | + 'cal_recurrence' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'cal_start of original recurrence for exception'), |
|
33 | + 'tz_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'key into egw_cal_timezones'), |
|
34 | + 'cal_deleted' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts when event was deleted'), |
|
35 | + 'caldav_name' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'name part of CalDAV URL, if specified by client'), |
|
36 | + 'range_start' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'comment' => 'startdate (of range)'), |
|
37 | + 'range_end' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'comment' => 'enddate (of range, UNTIL of RRULE)') |
|
38 | 38 | ), |
39 | 39 | 'pk' => array('cal_id'), |
40 | 40 | 'fk' => array(), |
41 | - 'ix' => array('cal_uid','cal_owner','cal_modified','cal_reference','cal_deleted','caldav_name'), |
|
41 | + 'ix' => array('cal_uid', 'cal_owner', 'cal_modified', 'cal_reference', 'cal_deleted', 'caldav_name'), |
|
42 | 42 | 'uc' => array() |
43 | 43 | ), |
44 | 44 | 'egw_cal_repeats' => array( |
45 | 45 | 'fd' => array( |
46 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
47 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
48 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
49 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1') |
|
46 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
47 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
48 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
49 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1') |
|
50 | 50 | ), |
51 | 51 | 'pk' => array('cal_id'), |
52 | 52 | 'fk' => array(), |
@@ -55,53 +55,53 @@ discard block |
||
55 | 55 | ), |
56 | 56 | 'egw_cal_user' => array( |
57 | 57 | 'fd' => array( |
58 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
59 | - 'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0'), |
|
60 | - 'cal_user_type' => array('type' => 'ascii','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
61 | - 'cal_user_id' => array('type' => 'ascii','meta' => array("cal_user_type='u'" => 'account'),'precision' => '32','nullable' => False,'comment' => 'id or md5(email-address) for type=e'), |
|
62 | - 'cal_status' => array('type' => 'ascii','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
63 | - 'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'), |
|
64 | - 'cal_role' => array('type' => 'ascii','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
65 | - 'cal_user_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'automatic timestamp of last update'), |
|
66 | - 'cal_user_auto' => array('type' => 'auto','nullable' => False), |
|
67 | - 'cal_user_attendee' => array('type' => 'varchar','precision' => '255','comment' => 'email or json object with attr. cn, url, ...') |
|
58 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
59 | + 'cal_recur_date' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
60 | + 'cal_user_type' => array('type' => 'ascii', 'precision' => '1', 'nullable' => False, 'default' => 'u', 'comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
61 | + 'cal_user_id' => array('type' => 'ascii', 'meta' => array("cal_user_type='u'" => 'account'), 'precision' => '32', 'nullable' => False, 'comment' => 'id or md5(email-address) for type=e'), |
|
62 | + 'cal_status' => array('type' => 'ascii', 'precision' => '1', 'default' => 'A', 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
63 | + 'cal_quantity' => array('type' => 'int', 'precision' => '4', 'default' => '1', 'comment' => 'only for certain types (eg. resources)'), |
|
64 | + 'cal_role' => array('type' => 'ascii', 'precision' => '64', 'default' => 'REQ-PARTICIPANT', 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
65 | + 'cal_user_modified' => array('type' => 'timestamp', 'default' => 'current_timestamp', 'comment' => 'automatic timestamp of last update'), |
|
66 | + 'cal_user_auto' => array('type' => 'auto', 'nullable' => False), |
|
67 | + 'cal_user_attendee' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'email or json object with attr. cn, url, ...') |
|
68 | 68 | ), |
69 | 69 | 'pk' => array('cal_user_auto'), |
70 | 70 | 'fk' => array(), |
71 | - 'ix' => array('cal_user_modified',array('cal_user_type','cal_user_id')), |
|
72 | - 'uc' => array(array('cal_id','cal_recur_date','cal_user_type','cal_user_id')) |
|
71 | + 'ix' => array('cal_user_modified', array('cal_user_type', 'cal_user_id')), |
|
72 | + 'uc' => array(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id')) |
|
73 | 73 | ), |
74 | 74 | 'egw_cal_extra' => array( |
75 | 75 | 'fd' => array( |
76 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
77 | - 'cal_extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '40','nullable' => False), |
|
78 | - 'cal_extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False,'default' => '') |
|
76 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
77 | + 'cal_extra_name' => array('type' => 'varchar', 'meta' => 'cfname', 'precision' => '40', 'nullable' => False), |
|
78 | + 'cal_extra_value' => array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '16384', 'nullable' => False, 'default' => '') |
|
79 | 79 | ), |
80 | - 'pk' => array('cal_id','cal_extra_name'), |
|
80 | + 'pk' => array('cal_id', 'cal_extra_name'), |
|
81 | 81 | 'fk' => array(), |
82 | 82 | 'ix' => array(), |
83 | 83 | 'uc' => array() |
84 | 84 | ), |
85 | 85 | 'egw_cal_dates' => array( |
86 | 86 | 'fd' => array( |
87 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
88 | - 'cal_start' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'starttime in server time'), |
|
89 | - 'cal_end' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'endtime in server time'), |
|
90 | - 'recur_exception' => array('type' => 'bool','nullable' => False,'default' => '','comment' => 'date is an exception') |
|
87 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
88 | + 'cal_start' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'comment' => 'starttime in server time'), |
|
89 | + 'cal_end' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'comment' => 'endtime in server time'), |
|
90 | + 'recur_exception' => array('type' => 'bool', 'nullable' => False, 'default' => '', 'comment' => 'date is an exception') |
|
91 | 91 | ), |
92 | - 'pk' => array('cal_id','cal_start'), |
|
92 | + 'pk' => array('cal_id', 'cal_start'), |
|
93 | 93 | 'fk' => array(), |
94 | - 'ix' => array(array('recur_exception','cal_id')), |
|
94 | + 'ix' => array(array('recur_exception', 'cal_id')), |
|
95 | 95 | 'uc' => array() |
96 | 96 | ), |
97 | 97 | 'egw_cal_timezones' => array( |
98 | 98 | 'fd' => array( |
99 | - 'tz_id' => array('type' => 'auto','nullable' => False), |
|
100 | - 'tz_tzid' => array('type' => 'ascii','precision' => '128','nullable' => False), |
|
101 | - 'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'), |
|
102 | - 'tz_latitude' => array('type' => 'int','precision' => '4'), |
|
103 | - 'tz_longitude' => array('type' => 'int','precision' => '4'), |
|
104 | - 'tz_component' => array('type' => 'ascii','precision' => '8192','comment' => 'iCal VTIMEZONE component') |
|
99 | + 'tz_id' => array('type' => 'auto', 'nullable' => False), |
|
100 | + 'tz_tzid' => array('type' => 'ascii', 'precision' => '128', 'nullable' => False), |
|
101 | + 'tz_alias' => array('type' => 'int', 'precision' => '4', 'comment' => 'tz_id for data'), |
|
102 | + 'tz_latitude' => array('type' => 'int', 'precision' => '4'), |
|
103 | + 'tz_longitude' => array('type' => 'int', 'precision' => '4'), |
|
104 | + 'tz_component' => array('type' => 'ascii', 'precision' => '8192', 'comment' => 'iCal VTIMEZONE component') |
|
105 | 105 | ), |
106 | 106 | 'pk' => array('tz_id'), |
107 | 107 | 'fk' => array(), |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'Arab Standard Time' => 'Asia/Riyadh', |
25 | 25 | 'Arabian Standard Time' => 'Asia/Dubai', |
26 | 26 | 'Arabic Standard Time' => 'Asia/Baghdad', |
27 | - 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', |
|
27 | + 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', |
|
28 | 28 | 'Atlantic Standard Time' => 'America/Halifax', |
29 | 29 | 'Azerbaijan Standard Time' => 'Asia/Baku', |
30 | 30 | 'Azores Standard Time' => 'Atlantic/Azores', |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'Greenland Standard Time' => 'America/Godthab', |
60 | 60 | 'Greenwich Standard Time' => 'Atlantic/Reykjavik', |
61 | 61 | 'Hawaiian Standard Time' => 'Pacific/Honolulu', |
62 | - 'India Standard Time' => 'Asia/Kolkata', // Asia/Calcutta is an alias to Asia/Kolkata |
|
62 | + 'India Standard Time' => 'Asia/Kolkata', // Asia/Calcutta is an alias to Asia/Kolkata |
|
63 | 63 | 'Iran Standard Time' => 'Asia/Tehran', |
64 | 64 | 'Israel Standard Time' => 'Asia/Jerusalem', |
65 | 65 | 'Jordan Standard Time' => 'Asia/Amman', |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein', |
199 | 199 | |
200 | 200 | // various aliases collected over time |
201 | - 'America/Creston' => 'America/Dawson_Creek', // not in sqlight DB of Thunderbird version 1.2011n, Dawson Creek is also UTC-7 without DS |
|
201 | + 'America/Creston' => 'America/Dawson_Creek', // not in sqlight DB of Thunderbird version 1.2011n, Dawson Creek is also UTC-7 without DS |
|
202 | 202 | 'Armenian Standard Time' => 'Asia/Yerevan', |
203 | 203 | 'Asia/Katmandu' => 'Asia/Kathmandu', |
204 | 204 | 'Asia/Calcutta' => 'Asia/Kolkata', |
@@ -10,17 +10,17 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // enable auto-loading of holidays from localhost by default |
13 | -foreach(array( |
|
13 | +foreach (array( |
|
14 | 14 | 'auto_load_holidays' => 'True', |
15 | 15 | 'holidays_url_path' => 'localhost', |
16 | 16 | ) as $name => $value) |
17 | 17 | { |
18 | - $oProc->insert($GLOBALS['egw_setup']->config_table,array( |
|
18 | + $oProc->insert($GLOBALS['egw_setup']->config_table, array( |
|
19 | 19 | 'config_value' => $value, |
20 | - ),array( |
|
20 | + ), array( |
|
21 | 21 | 'config_app' => 'phpgwapi', |
22 | 22 | 'config_name' => $name, |
23 | - ),__FILE__,__LINE__); |
|
23 | + ), __FILE__, __LINE__); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | // import timezone data |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; |
42 | 42 | } |
43 | 43 | // fix for SOGo connector, which does not decode the = in our f/b url |
44 | -if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D') |
|
44 | +if (strpos($_SERVER['QUERY_STRING'], '=3D') !== false && substr($_GET['user'], 0, 2) == '3D') |
|
45 | 45 | { |
46 | - $_GET['user'] = substr($_GET['user'],2); |
|
47 | - if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2); |
|
48 | - if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2); |
|
46 | + $_GET['user'] = substr($_GET['user'], 2); |
|
47 | + if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'], 2); |
|
48 | + if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'], 2); |
|
49 | 49 | } |
50 | 50 | if (!is_numeric($user = $_GET['user'])) |
51 | 51 | { |
52 | 52 | // check if user contains the current domain --> remove it |
53 | - list(,$domain) = explode('@',$user); |
|
53 | + list(,$domain) = explode('@', $user); |
|
54 | 54 | if ($domain === $GLOBALS['egw_info']['user']['domain']) |
55 | - list($user) = explode('@',$user); |
|
56 | - $user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u'); |
|
55 | + list($user) = explode('@', $user); |
|
56 | + $user = $GLOBALS['egw']->accounts->name2id($user, 'account_lid', 'u'); |
|
57 | 57 | } |
58 | 58 | if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user))) |
59 | 59 | { |
60 | - fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!"." $username($user)",$_GET['user'])); |
|
60 | + fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!"." $username($user)", $_GET['user'])); |
|
61 | 61 | } |
62 | 62 | if (!$loged_in) |
63 | 63 | { |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | if (strpos($authuser, '@') === false) |
79 | 79 | { |
80 | 80 | $domain = $GLOBALS['egw_info']['server']['default_domain']; |
81 | - $authuser .= '@' . $domain; |
|
81 | + $authuser .= '@'.$domain; |
|
82 | 82 | } |
83 | 83 | else |
84 | 84 | { |
85 | - list(, $domain) = explode('@',$authuser, 2); |
|
85 | + list(, $domain) = explode('@', $authuser, 2); |
|
86 | 86 | } |
87 | 87 | if (array_key_exists($domain, $GLOBALS['egw_domain'])) |
88 | 88 | { |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | $GLOBALS['egw_info']['user']['domain'] = $domain; |
93 | 93 | $GLOBALS['egw_info']['flags']['currentapp'] = 'login'; |
94 | 94 | $GLOBALS['egw_info']['flags']['noapi'] = false; |
95 | - require_once(EGW_API_INC . '/functions.inc.php'); |
|
96 | - $loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text'); |
|
95 | + require_once(EGW_API_INC.'/functions.inc.php'); |
|
96 | + $loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text'); |
|
97 | 97 | session_unset(); |
98 | 98 | session_destroy(); |
99 | 99 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | else |
111 | 111 | { |
112 | - Api\Header\Content::type('freebusy.ifb','text/calendar'); |
|
112 | + Api\Header\Content::type('freebusy.ifb', 'text/calendar'); |
|
113 | 113 | } |
114 | 114 | $ical = new calendar_ical(); |
115 | 115 | echo $ical->freebusy($user, $_GET['end']); |
@@ -44,15 +44,23 @@ |
||
44 | 44 | if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D') |
45 | 45 | { |
46 | 46 | $_GET['user'] = substr($_GET['user'],2); |
47 | - if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2); |
|
48 | - if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2); |
|
49 | -} |
|
47 | + if (isset($_GET['password'])) |
|
48 | + { |
|
49 | + $_GET['password'] = substr($_GET['password'],2); |
|
50 | + } |
|
51 | + if (isset($_GET['cred'])) |
|
52 | + { |
|
53 | + $_GET['cred'] = substr($_GET['cred'],2); |
|
54 | + } |
|
55 | + } |
|
50 | 56 | if (!is_numeric($user = $_GET['user'])) |
51 | 57 | { |
52 | 58 | // check if user contains the current domain --> remove it |
53 | 59 | list(,$domain) = explode('@',$user); |
54 | 60 | if ($domain === $GLOBALS['egw_info']['user']['domain']) |
55 | - list($user) = explode('@',$user); |
|
61 | + { |
|
62 | + list($user) = explode('@',$user); |
|
63 | + } |
|
56 | 64 | $user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u'); |
57 | 65 | } |
58 | 66 | if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user))) |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | |
25 | 25 | public static $types = array( |
26 | 26 | 'select-cat' => array('category'), |
27 | - 'select-account'=> array('owner','creator', 'modifier'), |
|
28 | - 'date-time' => array('modified', 'created','start','end','recur_date'), |
|
27 | + 'select-account'=> array('owner', 'creator', 'modifier'), |
|
28 | + 'date-time' => array('modified', 'created', 'start', 'end', 'recur_date'), |
|
29 | 29 | 'date' => array('recur_enddate'), |
30 | 30 | 'select-bool' => array('public', 'non_blocking'), |
31 | 31 | 'select' => array('priority'), |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $_identifier |
39 | 39 | */ |
40 | - public function __construct( $_identifier='' ){ |
|
40 | + public function __construct($_identifier = '') { |
|
41 | 41 | $this->identifier = $_identifier; |
42 | - if(!is_object($this->bo)) { |
|
42 | + if (!is_object($this->bo)) { |
|
43 | 43 | $this->bo = new calendar_bo(); |
44 | 44 | } |
45 | - if($this->identifier) { |
|
45 | + if ($this->identifier) { |
|
46 | 46 | $this->record = $this->bo->read($this->identifier); |
47 | 47 | } |
48 | 48 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @todo add some checks |
97 | 97 | * @return void |
98 | 98 | */ |
99 | - public function set_record(array $_record){ |
|
99 | + public function set_record(array $_record) { |
|
100 | 100 | $this->record = $_record; |
101 | 101 | } |
102 | 102 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return string identifier |
126 | 126 | */ |
127 | - public function save ( $_dst_identifier ) { |
|
127 | + public function save($_dst_identifier) { |
|
128 | 128 | // Not yet implemeted |
129 | 129 | $this->identifier = $_dst_identifier; |
130 | 130 | } |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * @param string $_dst_identifier |
136 | 136 | * @return string dst_identifier |
137 | 137 | */ |
138 | - public function copy ( $_dst_identifier ) { |
|
139 | - unset($_dst_identifier); // not used |
|
138 | + public function copy($_dst_identifier) { |
|
139 | + unset($_dst_identifier); // not used |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | * @param string $_dst_identifier |
147 | 147 | * @return string dst_identifier |
148 | 148 | */ |
149 | - public function move ( $_dst_identifier ) { |
|
150 | - unset($_dst_identifier); // not used |
|
149 | + public function move($_dst_identifier) { |
|
150 | + unset($_dst_identifier); // not used |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
154 | 154 | * delets current record from backend |
155 | 155 | * |
156 | 156 | */ |
157 | - public function delete () { |
|
157 | + public function delete() { |
|
158 | 158 | |
159 | 159 | } |
160 | 160 |
@@ -37,12 +37,15 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $_identifier |
39 | 39 | */ |
40 | - public function __construct( $_identifier='' ){ |
|
40 | + public function __construct( $_identifier='' ) |
|
41 | + { |
|
41 | 42 | $this->identifier = $_identifier; |
42 | - if(!is_object($this->bo)) { |
|
43 | + if(!is_object($this->bo)) |
|
44 | + { |
|
43 | 45 | $this->bo = new calendar_bo(); |
44 | 46 | } |
45 | - if($this->identifier) { |
|
47 | + if($this->identifier) |
|
48 | + { |
|
46 | 49 | $this->record = $this->bo->read($this->identifier); |
47 | 50 | } |
48 | 51 | } |
@@ -52,7 +55,8 @@ discard block |
||
52 | 55 | * |
53 | 56 | * @param string $_attribute_name |
54 | 57 | */ |
55 | - public function __get($_attribute_name) { |
|
58 | + public function __get($_attribute_name) |
|
59 | + { |
|
56 | 60 | return $this->record[$_attribute_name]; |
57 | 61 | } |
58 | 62 | |
@@ -62,7 +66,8 @@ discard block |
||
62 | 66 | * @param string $_attribute_name |
63 | 67 | * @param data $data |
64 | 68 | */ |
65 | - public function __set($_attribute_name, $data) { |
|
69 | + public function __set($_attribute_name, $data) |
|
70 | + { |
|
66 | 71 | $this->record[$_attribute_name] = $data; |
67 | 72 | } |
68 | 73 | |
@@ -74,7 +79,8 @@ discard block |
||
74 | 79 | * |
75 | 80 | * @return array complete record as associative array |
76 | 81 | */ |
77 | - public function get_record_array() { |
|
82 | + public function get_record_array() |
|
83 | + { |
|
78 | 84 | return $this->record; |
79 | 85 | } |
80 | 86 | |
@@ -83,8 +89,10 @@ discard block |
||
83 | 89 | * |
84 | 90 | *@return string tiltle |
85 | 91 | */ |
86 | - public function get_title() { |
|
87 | - if (empty($this->record)) { |
|
92 | + public function get_title() |
|
93 | + { |
|
94 | + if (empty($this->record)) |
|
95 | + { |
|
88 | 96 | $this->get_record(); |
89 | 97 | } |
90 | 98 | return $this->record['title']; |
@@ -96,7 +104,8 @@ discard block |
||
96 | 104 | * @todo add some checks |
97 | 105 | * @return void |
98 | 106 | */ |
99 | - public function set_record(array $_record){ |
|
107 | + public function set_record(array $_record) |
|
108 | + { |
|
100 | 109 | $this->record = $_record; |
101 | 110 | } |
102 | 111 | |
@@ -105,7 +114,8 @@ discard block |
||
105 | 114 | * |
106 | 115 | * @return string identifier of current record |
107 | 116 | */ |
108 | - public function get_identifier() { |
|
117 | + public function get_identifier() |
|
118 | + { |
|
109 | 119 | return $this->identifier; |
110 | 120 | } |
111 | 121 | |
@@ -115,7 +125,8 @@ discard block |
||
115 | 125 | * |
116 | 126 | * @return string Full URL of an icon, or appname/icon_name |
117 | 127 | */ |
118 | - public function get_icon() { |
|
128 | + public function get_icon() |
|
129 | + { |
|
119 | 130 | return 'calendar/navbar'; |
120 | 131 | } |
121 | 132 | |
@@ -124,7 +135,8 @@ discard block |
||
124 | 135 | * |
125 | 136 | * @return string identifier |
126 | 137 | */ |
127 | - public function save ( $_dst_identifier ) { |
|
138 | + public function save ( $_dst_identifier ) |
|
139 | + { |
|
128 | 140 | // Not yet implemeted |
129 | 141 | $this->identifier = $_dst_identifier; |
130 | 142 | } |
@@ -135,7 +147,8 @@ discard block |
||
135 | 147 | * @param string $_dst_identifier |
136 | 148 | * @return string dst_identifier |
137 | 149 | */ |
138 | - public function copy ( $_dst_identifier ) { |
|
150 | + public function copy ( $_dst_identifier ) |
|
151 | + { |
|
139 | 152 | unset($_dst_identifier); // not used |
140 | 153 | } |
141 | 154 | |
@@ -146,7 +159,8 @@ discard block |
||
146 | 159 | * @param string $_dst_identifier |
147 | 160 | * @return string dst_identifier |
148 | 161 | */ |
149 | - public function move ( $_dst_identifier ) { |
|
162 | + public function move ( $_dst_identifier ) |
|
163 | + { |
|
150 | 164 | unset($_dst_identifier); // not used |
151 | 165 | } |
152 | 166 | |
@@ -154,7 +168,8 @@ discard block |
||
154 | 168 | * delets current record from backend |
155 | 169 | * |
156 | 170 | */ |
157 | - public function delete () { |
|
171 | + public function delete () |
|
172 | + { |
|
158 | 173 | |
159 | 174 | } |
160 | 175 | |
@@ -162,7 +177,8 @@ discard block |
||
162 | 177 | * destructor |
163 | 178 | * |
164 | 179 | */ |
165 | - public function __destruct() { |
|
180 | + public function __destruct() |
|
181 | + { |
|
166 | 182 | } |
167 | 183 | |
168 | 184 | } |
169 | 185 | \ No newline at end of file |
@@ -387,11 +387,11 @@ |
||
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
390 | - * gets the icons displayed for a given event |
|
391 | - * |
|
392 | - * @param array $event |
|
393 | - * @return array of 'img' / 'title' pairs |
|
394 | - */ |
|
390 | + * gets the icons displayed for a given event |
|
391 | + * |
|
392 | + * @param array $event |
|
393 | + * @return array of 'img' / 'title' pairs |
|
394 | + */ |
|
395 | 395 | function event_icons($event) |
396 | 396 | { |
397 | 397 | $is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ,$event); |
@@ -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,34 +495,34 @@ 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 | - 'Configuration'=>Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
522 | - 'Custom Fields'=>Egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'), |
|
523 | - 'Global Categories' =>Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'), |
|
521 | + 'Configuration'=>Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
522 | + 'Custom Fields'=>Egw::link('/index.php', 'menuaction=admin.customfields.index&appname=calendar'), |
|
523 | + 'Global Categories' =>Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar'), |
|
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 | } |
528 | 528 | |
@@ -531,15 +531,15 @@ discard block |
||
531 | 531 | */ |
532 | 532 | function sidebox_etemplate($content = array()) |
533 | 533 | { |
534 | - if($content['merge']) |
|
534 | + if ($content['merge']) |
|
535 | 535 | { |
536 | 536 | // View from sidebox is JSON encoded |
537 | - $this->manage_states(array_merge($content,json_decode($content['view'],true))); |
|
538 | - if($content['first']) |
|
537 | + $this->manage_states(array_merge($content, json_decode($content['view'], true))); |
|
538 | + if ($content['first']) |
|
539 | 539 | { |
540 | - $this->first = Api\DateTime::to($content['first'],'ts'); |
|
540 | + $this->first = Api\DateTime::to($content['first'], 'ts'); |
|
541 | 541 | } |
542 | - if($content['last']) |
|
542 | + if ($content['last']) |
|
543 | 543 | { |
544 | 544 | $this->last = new Api\DateTime($content['last']); |
545 | 545 | $this->last->setTime(23, 59, 59); |
@@ -557,25 +557,25 @@ discard block |
||
557 | 557 | $cont['view'] = $this->view ? $this->view : 'week'; |
558 | 558 | $cont['date'] = $this->date ? $this->date : Api\DateTime(); |
559 | 559 | |
560 | - $cont['year'] = (int)Api\DateTime::to($cont['date'],'Y'); |
|
560 | + $cont['year'] = (int)Api\DateTime::to($cont['date'], 'Y'); |
|
561 | 561 | $cont['holidays'] = $this->bo->read_holidays($cont['year']); |
562 | 562 | |
563 | 563 | $readonlys = array(); |
564 | 564 | $sel_options['status_filter'] = array( |
565 | - array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), |
|
566 | - array('value' => 'accepted', 'label' => lang('Accepted'), 'title' => lang('Show only accepted events')), |
|
567 | - array('value' => 'unknown', 'label' => lang('Invitations'), 'title' => lang('Show only invitations, not yet accepted or rejected')), |
|
568 | - array('value' => 'tentative', 'label' => lang('Tentative'), 'title' => lang('Show only tentative accepted events')), |
|
569 | - array('value' => 'delegated', 'label' => lang('Delegated'), 'title' => lang('Show only delegated events')), |
|
570 | - array('value' => 'rejected', 'label' => lang('Rejected'),'title' => lang('Show only rejected events')), |
|
571 | - array('value' => 'owner', 'label' => lang('Owner too'),'title' => lang('Show also events just owned by selected user')), |
|
572 | - array('value' => 'all', 'label' => lang('All incl. rejected'),'title' => lang('Show all status incl. rejected events')), |
|
573 | - array('value' => 'hideprivate', 'label' => lang('Hide private infos'),'title' => lang('Show all events, as if they were private')), |
|
574 | - array('value' => 'showonlypublic', 'label' => lang('Hide private events'),'title' => lang('Show only events flagged as public, (not checked as private)')), |
|
575 | - array('value' => 'no-enum-groups', 'label' => lang('only group-events'),'title' => lang('Do not include events of group members')), |
|
576 | - array('value' => 'not-unknown', 'label' => lang('No meeting requests'),'title' => lang('Show all status, but unknown')), |
|
565 | + array('value' => 'default', 'label' => lang('Not rejected'), 'title' => lang('Show all status, but rejected')), |
|
566 | + array('value' => 'accepted', 'label' => lang('Accepted'), 'title' => lang('Show only accepted events')), |
|
567 | + array('value' => 'unknown', 'label' => lang('Invitations'), 'title' => lang('Show only invitations, not yet accepted or rejected')), |
|
568 | + array('value' => 'tentative', 'label' => lang('Tentative'), 'title' => lang('Show only tentative accepted events')), |
|
569 | + array('value' => 'delegated', 'label' => lang('Delegated'), 'title' => lang('Show only delegated events')), |
|
570 | + array('value' => 'rejected', 'label' => lang('Rejected'), 'title' => lang('Show only rejected events')), |
|
571 | + array('value' => 'owner', 'label' => lang('Owner too'), 'title' => lang('Show also events just owned by selected user')), |
|
572 | + array('value' => 'all', 'label' => lang('All incl. rejected'), 'title' => lang('Show all status incl. rejected events')), |
|
573 | + array('value' => 'hideprivate', 'label' => lang('Hide private infos'), 'title' => lang('Show all events, as if they were private')), |
|
574 | + array('value' => 'showonlypublic', 'label' => lang('Hide private events'), 'title' => lang('Show only events flagged as public, (not checked as private)')), |
|
575 | + array('value' => 'no-enum-groups', 'label' => lang('only group-events'), 'title' => lang('Do not include events of group members')), |
|
576 | + array('value' => 'not-unknown', 'label' => lang('No meeting requests'), 'title' => lang('Show all status, but unknown')), |
|
577 | 577 | ); |
578 | - if($GLOBALS['egw_info']['server']['calendar_delete_history']) |
|
578 | + if ($GLOBALS['egw_info']['server']['calendar_delete_history']) |
|
579 | 579 | { |
580 | 580 | $sel_options['status_filter'][] = array('value' => 'deleted', 'label' => lang('Deleted'), 'title' => lang('Show events that have been deleted')); |
581 | 581 | } |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | // Merge print |
584 | 584 | if ($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']) |
585 | 585 | { |
586 | - $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null,'calendar'); |
|
586 | + $sel_options['merge'] = calendar_merge::get_documents($GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir'], '', null, 'calendar'); |
|
587 | 587 | } |
588 | 588 | else |
589 | 589 | { |
@@ -609,27 +609,27 @@ discard block |
||
609 | 609 | */ |
610 | 610 | public function update_client($event_id, Api\DateTime $recurrence_date = null) |
611 | 611 | { |
612 | - if(!$event_id) return; |
|
612 | + if (!$event_id) return; |
|
613 | 613 | |
614 | 614 | // Directly update stored data. |
615 | 615 | // Make sure we have the whole event |
616 | 616 | $event = $this->bo->read($event_id, $recurrence_date); |
617 | 617 | $response = Api\Json\Response::get(); |
618 | 618 | |
619 | - if(!$event) |
|
619 | + if (!$event) |
|
620 | 620 | { |
621 | 621 | // Sending null will trigger a removal |
622 | 622 | $response->generic('data', array('uid' => 'calendar::'.$event_id, 'data' => null)); |
623 | 623 | return false; |
624 | 624 | } |
625 | 625 | |
626 | - if(!$event['recur_type'] || $recurrence_date) |
|
626 | + if (!$event['recur_type'] || $recurrence_date) |
|
627 | 627 | { |
628 | 628 | $this->to_client($event); |
629 | 629 | $response->generic('data', array('uid' => 'calendar::'.$event['row_id'], 'data' => $event)); |
630 | 630 | } |
631 | 631 | // If it's recurring, try to send the next month or so |
632 | - else if($event['recur_type'] ) |
|
632 | + else if ($event['recur_type']) |
|
633 | 633 | { |
634 | 634 | $this_month = new Api\DateTime('next month'); |
635 | 635 | $rrule = calendar_rrule::event2rrule($event, true); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | $response->generic('data', array('uid' => 'calendar::'.$converted['row_id'], 'data' => $converted)); |
643 | 643 | $rrule->next(); |
644 | 644 | } |
645 | - while ($rrule->valid() && $occurrence <= $this_month ); |
|
645 | + while ($rrule->valid() && $occurrence <= $this_month); |
|
646 | 646 | } |
647 | 647 | } |
648 | 648 | |
@@ -657,15 +657,15 @@ discard block |
||
657 | 657 | */ |
658 | 658 | public function to_client(&$event) |
659 | 659 | { |
660 | - if(!$event || !is_array($event)) return false; |
|
660 | + if (!$event || !is_array($event)) return false; |
|
661 | 661 | |
662 | - if (!$this->bo->check_perms(Acl::EDIT,$event)) |
|
662 | + if (!$this->bo->check_perms(Acl::EDIT, $event)) |
|
663 | 663 | { |
664 | 664 | $event['class'] .= 'rowNoEdit '; |
665 | 665 | } |
666 | 666 | |
667 | 667 | // Delete disabled for other applications |
668 | - if (!$this->bo->check_perms(Acl::DELETE,$event) || !is_numeric($event['id'])) |
|
668 | + if (!$this->bo->check_perms(Acl::DELETE, $event) || !is_numeric($event['id'])) |
|
669 | 669 | { |
670 | 670 | $event['class'] .= 'rowNoDelete '; |
671 | 671 | } |
@@ -678,32 +678,32 @@ discard block |
||
678 | 678 | |
679 | 679 | $event['recure'] = $this->bo->recure2string($event); |
680 | 680 | |
681 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
682 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
681 | + if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
682 | + if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
683 | 683 | |
684 | 684 | // respect category permissions |
685 | - if(!empty($event['category'])) |
|
685 | + if (!empty($event['category'])) |
|
686 | 686 | { |
687 | 687 | $event['category'] = $this->categories->check_list(Acl::READ, $event['category']); |
688 | 688 | } |
689 | 689 | $event['non_blocking'] = (bool)$event['non_blocking']; |
690 | 690 | |
691 | 691 | $matches = null; |
692 | - if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches)) |
|
692 | + if (!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i', $event['id'], $matches)) |
|
693 | 693 | { |
694 | 694 | $app = $matches[1]; |
695 | 695 | $app_id = $matches[2]; |
696 | 696 | $icons = array(); |
697 | - if(!($is_private = calendar_bo::integration_get_private($app,$app_id,$event))) |
|
697 | + if (!($is_private = calendar_bo::integration_get_private($app, $app_id, $event))) |
|
698 | 698 | { |
699 | - $icons = calendar_uiviews::integration_get_icons($app,$app_id,$event); |
|
699 | + $icons = calendar_uiviews::integration_get_icons($app, $app_id, $event); |
|
700 | 700 | } |
701 | 701 | $event['app'] = $app; |
702 | 702 | $event['app_id'] = $app_id; |
703 | 703 | } |
704 | 704 | else |
705 | 705 | { |
706 | - $is_private = !$this->bo->check_perms(Acl::READ,$event); |
|
706 | + $is_private = !$this->bo->check_perms(Acl::READ, $event); |
|
707 | 707 | } |
708 | 708 | if ($is_private) |
709 | 709 | { |
@@ -711,29 +711,29 @@ discard block |
||
711 | 711 | $event['class'] .= 'rowNoView '; |
712 | 712 | } |
713 | 713 | |
714 | - if(!$event['app']) |
|
714 | + if (!$event['app']) |
|
715 | 715 | { |
716 | 716 | $event['app'] = 'calendar'; |
717 | 717 | } |
718 | - if(!$event['app_id']) |
|
718 | + if (!$event['app_id']) |
|
719 | 719 | { |
720 | 720 | $event['app_id'] = $event['id']; |
721 | 721 | } |
722 | 722 | |
723 | 723 | if ($event['recur_type'] != MCAL_RECUR_NONE) |
724 | 724 | { |
725 | - $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts'); |
|
725 | + $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts'); |
|
726 | 726 | } |
727 | 727 | // set id for grid |
728 | - $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts') : ''); |
|
728 | + $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts') : ''); |
|
729 | 729 | |
730 | - $event['parts'] = implode(",\n",$this->bo->participants($event,false)); |
|
730 | + $event['parts'] = implode(",\n", $this->bo->participants($event, false)); |
|
731 | 731 | $event['date'] = $this->bo->date2string($event['start']); |
732 | 732 | |
733 | 733 | // Change dates |
734 | - foreach(calendar_egw_record::$types['date-time'] as $field) |
|
734 | + foreach (calendar_egw_record::$types['date-time'] as $field) |
|
735 | 735 | { |
736 | - if(is_int($event[$field])) |
|
736 | + if (is_int($event[$field])) |
|
737 | 737 | { |
738 | 738 | $event[$field] = Api\DateTime::to($event[$field], Api\DateTime::ET2); |
739 | 739 | } |
@@ -751,13 +751,13 @@ discard block |
||
751 | 751 | public function merge($timespan = array()) |
752 | 752 | { |
753 | 753 | // Merge print |
754 | - if($_GET['merge']) |
|
754 | + if ($_GET['merge']) |
|
755 | 755 | { |
756 | - if(!$timespan) |
|
756 | + if (!$timespan) |
|
757 | 757 | { |
758 | 758 | // Try to make time span into appropriate ranges to match |
759 | - if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month'; |
|
760 | - if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week'; |
|
759 | + if (stripos($_GET['merge'], 'month') !== false || stripos($_GET['merge'], lang('month')) !== false) $template = 'month'; |
|
760 | + if (stripos($_GET['merge'], 'week') !== false || stripos($_GET['merge'], lang('week')) !== false) $template = 'week'; |
|
761 | 761 | //error_log("Detected template $template"); |
762 | 762 | switch ($template) |
763 | 763 | { |
@@ -765,8 +765,8 @@ discard block |
||
765 | 765 | // Trim to _only_ the month, do not pad to week start / end |
766 | 766 | $time = new Api\DateTime($this->date); |
767 | 767 | $timespan = array(array( |
768 | - 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'),'ts'), |
|
769 | - 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'),'ts') |
|
768 | + 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'), 'ts'), |
|
769 | + 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'), 'ts') |
|
770 | 770 | )); |
771 | 771 | break; |
772 | 772 | case 'week': |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $start = new Api\DateTime($this->first); |
775 | 775 | $t = clone $start; |
776 | 776 | $t->modify('+1 week')->modify('-1 second'); |
777 | - if($t->format('ts') < Api\DateTime::to($this->last,'ts')) |
|
777 | + if ($t->format('ts') < Api\DateTime::to($this->last, 'ts')) |
|
778 | 778 | { |
779 | 779 | do |
780 | 780 | { |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | ); |
785 | 785 | $start->modify('+1 week'); |
786 | 786 | $t->modify('+1 week'); |
787 | - } while( $start->format('ts') < $this->last); |
|
787 | + } while ($start->format('ts') < $this->last); |
|
788 | 788 | break; |
789 | 789 | } |
790 | 790 | // Fall through |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | Framework::refresh_opener($error, 'calendar'); |
803 | 803 | } |
804 | 804 | unset($_GET['merge']); |
805 | - if($error) |
|
805 | + if ($error) |
|
806 | 806 | { |
807 | 807 | // This doesn't give message either, but at least it doesn't give a blank screen |
808 | 808 | 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, |
@@ -553,7 +566,10 @@ discard block |
||
553 | 566 | $sidebox = new Etemplate('calendar.sidebox'); |
554 | 567 | |
555 | 568 | $cont = $this->cal_prefs['saved_states']; |
556 | - if (!is_array($cont)) $cont = array(); |
|
569 | + if (!is_array($cont)) |
|
570 | + { |
|
571 | + $cont = array(); |
|
572 | + } |
|
557 | 573 | $cont['view'] = $this->view ? $this->view : 'week'; |
558 | 574 | $cont['date'] = $this->date ? $this->date : Api\DateTime(); |
559 | 575 | |
@@ -609,7 +625,10 @@ discard block |
||
609 | 625 | */ |
610 | 626 | public function update_client($event_id, Api\DateTime $recurrence_date = null) |
611 | 627 | { |
612 | - if(!$event_id) return; |
|
628 | + if(!$event_id) |
|
629 | + { |
|
630 | + return; |
|
631 | + } |
|
613 | 632 | |
614 | 633 | // Directly update stored data. |
615 | 634 | // Make sure we have the whole event |
@@ -657,7 +676,10 @@ discard block |
||
657 | 676 | */ |
658 | 677 | public function to_client(&$event) |
659 | 678 | { |
660 | - if(!$event || !is_array($event)) return false; |
|
679 | + if(!$event || !is_array($event)) |
|
680 | + { |
|
681 | + return false; |
|
682 | + } |
|
661 | 683 | |
662 | 684 | if (!$this->bo->check_perms(Acl::EDIT,$event)) |
663 | 685 | { |
@@ -678,8 +700,16 @@ discard block |
||
678 | 700 | |
679 | 701 | $event['recure'] = $this->bo->recure2string($event); |
680 | 702 | |
681 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
682 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
703 | + if (empty($event['description'])) |
|
704 | + { |
|
705 | + $event['description'] = ' '; |
|
706 | + } |
|
707 | + // no description screws the titles horz. alignment |
|
708 | + if (empty($event['location'])) |
|
709 | + { |
|
710 | + $event['location'] = ' '; |
|
711 | + } |
|
712 | + // no location screws the owner horz. alignment |
|
683 | 713 | |
684 | 714 | // respect category permissions |
685 | 715 | if(!empty($event['category'])) |
@@ -756,8 +786,14 @@ discard block |
||
756 | 786 | if(!$timespan) |
757 | 787 | { |
758 | 788 | // Try to make time span into appropriate ranges to match |
759 | - if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month'; |
|
760 | - if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week'; |
|
789 | + if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) |
|
790 | + { |
|
791 | + $template = 'month'; |
|
792 | + } |
|
793 | + if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) |
|
794 | + { |
|
795 | + $template = 'week'; |
|
796 | + } |
|
761 | 797 | //error_log("Detected template $template"); |
762 | 798 | switch ($template) |
763 | 799 | { |
@@ -108,7 +108,7 @@ |
||
108 | 108 | |
109 | 109 | if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile()) |
110 | 110 | { |
111 | - $file = Array( |
|
111 | + $file = array( |
|
112 | 112 | 'Site configuration' => Egw::link('/index.php',array( |
113 | 113 | 'menuaction' => 'infolog.infolog_ui.admin' )), |
114 | 114 | 'Global Categories' => Egw::link('/index.php',array( |
@@ -30,33 +30,33 @@ discard block |
||
30 | 30 | * @param string $cname |
31 | 31 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
32 | 32 | */ |
33 | - public function beforeSendToClient($cname, array $expand=null) |
|
33 | + public function beforeSendToClient($cname, array $expand = null) |
|
34 | 34 | { |
35 | 35 | |
36 | - Framework::includeJS('.','et2_widget_owner','calendar'); |
|
37 | - Framework::includeCSS('calendar','calendar'); |
|
36 | + Framework::includeJS('.', 'et2_widget_owner', 'calendar'); |
|
37 | + Framework::includeCSS('calendar', 'calendar'); |
|
38 | 38 | |
39 | 39 | $bo = new calendar_bo(); |
40 | 40 | |
41 | 41 | $form_name = self::form_name($cname, $this->id, $expand); |
42 | 42 | |
43 | - $value =& self::get_array(self::$request->content, $form_name); |
|
44 | - if(!is_array($value)) $value = array(); |
|
43 | + $value = & self::get_array(self::$request->content, $form_name); |
|
44 | + if (!is_array($value)) $value = array(); |
|
45 | 45 | if (!is_array(self::$request->sel_options[$form_name])) |
46 | 46 | { |
47 | 47 | self::$request->sel_options[$form_name] = array(); |
48 | 48 | } |
49 | - $sel_options =& self::$request->sel_options[$form_name]; |
|
49 | + $sel_options = & self::$request->sel_options[$form_name]; |
|
50 | 50 | |
51 | 51 | // Get user accounts, formatted nicely for grouping and matching |
52 | 52 | // the ajax call calendar_uiforms->ajax_owner() - users first |
53 | 53 | $accounts = array(); |
54 | 54 | $list = array('accounts', 'owngroups'); |
55 | - foreach($list as $type) |
|
55 | + foreach ($list as $type) |
|
56 | 56 | { |
57 | 57 | $account_options = array('account_type' => $type); |
58 | - $accounts_type = Api\Accounts::link_query('',$account_options); |
|
59 | - if($type == 'accounts') |
|
58 | + $accounts_type = Api\Accounts::link_query('', $account_options); |
|
59 | + if ($type == 'accounts') |
|
60 | 60 | { |
61 | 61 | $accounts_type = array_intersect_key($accounts_type, $GLOBALS['egw']->acl->get_grants('calendar')); |
62 | 62 | } |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | // Add external owners that a select account widget will not find |
78 | - foreach($value as &$owner) |
|
78 | + foreach ($value as &$owner) |
|
79 | 79 | { |
80 | 80 | $label = self::get_owner_label($owner); |
81 | - if(!is_numeric($owner)) |
|
81 | + if (!is_numeric($owner)) |
|
82 | 82 | { |
83 | - $resource = $bo->resources[substr($owner, 0,1)]; |
|
83 | + $resource = $bo->resources[substr($owner, 0, 1)]; |
|
84 | 84 | } |
85 | 85 | else if (!in_array($owner, array_keys($accounts))) |
86 | 86 | { |
@@ -102,19 +102,19 @@ discard block |
||
102 | 102 | * @param array $content |
103 | 103 | * @param array &$validated=array() validated content |
104 | 104 | */ |
105 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
105 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
106 | 106 | { |
107 | 107 | $form_name = self::form_name($cname, $this->id, $expand); |
108 | 108 | |
109 | 109 | if (!$this->is_readonly($cname, $form_name)) |
110 | 110 | { |
111 | - $value = $value_in =& self::get_array($content, $form_name); |
|
112 | - if(!is_array($value)) |
|
111 | + $value = $value_in = & self::get_array($content, $form_name); |
|
112 | + if (!is_array($value)) |
|
113 | 113 | { |
114 | 114 | $value = Array($value); |
115 | 115 | } |
116 | 116 | |
117 | - $valid =& self::get_array($validated, $form_name, true); |
|
117 | + $valid = & self::get_array($validated, $form_name, true); |
|
118 | 118 | if (true) $valid = $value; |
119 | 119 | } |
120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | public static function ajax_owner($id = null) |
127 | 127 | { |
128 | 128 | // Handle a request for a single ID |
129 | - if($id) |
|
129 | + if ($id) |
|
130 | 130 | { |
131 | 131 | $label = self::get_owner_label($id); |
132 | 132 | Api\Json\Response::get()->data($label); |
@@ -137,35 +137,35 @@ discard block |
||
137 | 137 | $query = $_REQUEST['query']; |
138 | 138 | // Arbitrarily limited to 50 / resource |
139 | 139 | $options = array('start' => 0, 'num_rows' => 50) + |
140 | - array_diff_key($_REQUEST, array_flip(array('menuaction','query'))); |
|
140 | + array_diff_key($_REQUEST, array_flip(array('menuaction', 'query'))); |
|
141 | 141 | $results = array(); |
142 | 142 | |
143 | - $resources = array_merge(array('' => $bo->resources['']),$bo->resources); |
|
144 | - foreach($resources as $type => $data) |
|
143 | + $resources = array_merge(array('' => $bo->resources['']), $bo->resources); |
|
144 | + foreach ($resources as $type => $data) |
|
145 | 145 | { |
146 | 146 | $mapped = array(); |
147 | 147 | $_results = array(); |
148 | 148 | |
149 | 149 | // Handle Api\Accounts seperately |
150 | - if($type == '') |
|
150 | + if ($type == '') |
|
151 | 151 | { |
152 | 152 | $list = array('accounts', 'owngroups'); |
153 | - foreach($list as $a_type) |
|
153 | + foreach ($list as $a_type) |
|
154 | 154 | { |
155 | 155 | $account_options = $options + array('account_type' => $a_type); |
156 | - $_results += Api\Accounts::link_query($query,$account_options); |
|
156 | + $_results += Api\Accounts::link_query($query, $account_options); |
|
157 | 157 | } |
158 | 158 | $_results = array_intersect_key($_results, $GLOBALS['egw']->acl->get_grants('calendar')); |
159 | 159 | } |
160 | 160 | else if ($data['app'] && Link::get_registry($data['app'], 'query')) |
161 | 161 | { |
162 | - $_results = Link::query($data['app'], $query,$options); |
|
162 | + $_results = Link::query($data['app'], $query, $options); |
|
163 | 163 | } |
164 | - if(!$_results) continue; |
|
164 | + if (!$_results) continue; |
|
165 | 165 | |
166 | - foreach(array_unique($_results) as $id => $title) |
|
166 | + foreach (array_unique($_results) as $id => $title) |
|
167 | 167 | { |
168 | - if($id && $title) |
|
168 | + if ($id && $title) |
|
169 | 169 | { |
170 | 170 | // Magicsuggest uses id, not value. |
171 | 171 | $value = array( |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | 'label' => $title, |
175 | 175 | 'app' => lang($data['app']) |
176 | 176 | ); |
177 | - if(is_array($value['label'])) |
|
177 | + if (is_array($value['label'])) |
|
178 | 178 | { |
179 | 179 | $value = array_merge($value, $value['label']); |
180 | 180 | } |
181 | 181 | $mapped[] = $value; |
182 | 182 | } |
183 | 183 | } |
184 | - if(count($mapped)) |
|
184 | + if (count($mapped)) |
|
185 | 185 | { |
186 | 186 | $results = array_merge($results, $mapped); |
187 | 187 | } |
@@ -202,24 +202,24 @@ discard block |
||
202 | 202 | public static function get_owner_label($id) |
203 | 203 | { |
204 | 204 | static $bo; |
205 | - if(!$bo) $bo = new calendar_bo(); |
|
205 | + if (!$bo) $bo = new calendar_bo(); |
|
206 | 206 | |
207 | 207 | $id = ''.$id; |
208 | - if(!is_numeric($id)) |
|
208 | + if (!is_numeric($id)) |
|
209 | 209 | { |
210 | - $resource = $bo->resources[substr($id, 0,1)]; |
|
211 | - $label = Link::title($resource['app'], substr($id,1)); |
|
210 | + $resource = $bo->resources[substr($id, 0, 1)]; |
|
211 | + $label = Link::title($resource['app'], substr($id, 1)); |
|
212 | 212 | |
213 | 213 | // Could not get via link, try via resources info |
214 | - if($label === false) |
|
214 | + if ($label === false) |
|
215 | 215 | { |
216 | - $info = ExecMethod($resource['info'], substr($id,1)); |
|
216 | + $info = ExecMethod($resource['info'], substr($id, 1)); |
|
217 | 217 | $label = $info[0]['name']; |
218 | 218 | } |
219 | 219 | } |
220 | 220 | else |
221 | 221 | { |
222 | - $label = Link::title('api-accounts',$id); |
|
222 | + $label = Link::title('api-accounts', $id); |
|
223 | 223 | } |
224 | 224 | return $label; |
225 | 225 | } |
@@ -41,7 +41,10 @@ discard block |
||
41 | 41 | $form_name = self::form_name($cname, $this->id, $expand); |
42 | 42 | |
43 | 43 | $value =& self::get_array(self::$request->content, $form_name); |
44 | - if(!is_array($value)) $value = array(); |
|
44 | + if(!is_array($value)) |
|
45 | + { |
|
46 | + $value = array(); |
|
47 | + } |
|
45 | 48 | if (!is_array(self::$request->sel_options[$form_name])) |
46 | 49 | { |
47 | 50 | self::$request->sel_options[$form_name] = array(); |
@@ -63,7 +66,8 @@ discard block |
||
63 | 66 | $accounts += $accounts_type; |
64 | 67 | } |
65 | 68 | $sel_options += array_map( |
66 | - function($account_id, $account_name) { |
|
69 | + function($account_id, $account_name) |
|
70 | + { |
|
67 | 71 | return array( |
68 | 72 | 'value' => ''.$account_id, |
69 | 73 | 'label' => $account_name, |
@@ -115,7 +119,10 @@ discard block |
||
115 | 119 | } |
116 | 120 | |
117 | 121 | $valid =& self::get_array($validated, $form_name, true); |
118 | - if (true) $valid = $value; |
|
122 | + if (true) |
|
123 | + { |
|
124 | + $valid = $value; |
|
125 | + } |
|
119 | 126 | } |
120 | 127 | } |
121 | 128 | /** |
@@ -161,7 +168,10 @@ discard block |
||
161 | 168 | { |
162 | 169 | $_results = Link::query($data['app'], $query,$options); |
163 | 170 | } |
164 | - if(!$_results) continue; |
|
171 | + if(!$_results) |
|
172 | + { |
|
173 | + continue; |
|
174 | + } |
|
165 | 175 | |
166 | 176 | foreach(array_unique($_results) as $id => $title) |
167 | 177 | { |
@@ -202,7 +212,10 @@ discard block |
||
202 | 212 | public static function get_owner_label($id) |
203 | 213 | { |
204 | 214 | static $bo; |
205 | - if(!$bo) $bo = new calendar_bo(); |
|
215 | + if(!$bo) |
|
216 | + { |
|
217 | + $bo = new calendar_bo(); |
|
218 | + } |
|
206 | 219 | |
207 | 220 | $id = ''.$id; |
208 | 221 | if(!is_numeric($id)) |
@@ -111,7 +111,7 @@ |
||
111 | 111 | $value = $value_in =& self::get_array($content, $form_name); |
112 | 112 | if(!is_array($value)) |
113 | 113 | { |
114 | - $value = Array($value); |
|
114 | + $value = array($value); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $valid =& self::get_array($validated, $form_name, true); |