@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'category' => array( |
56 | 56 | 'type' => 'select', |
57 | 57 | 'label' => lang('Choose a category'), |
58 | - 'options' => array(), // specification of options is postponed into the get_user_interface function |
|
58 | + 'options' => array(), // specification of options is postponed into the get_user_interface function |
|
59 | 59 | 'multiple' => true, |
60 | 60 | ), |
61 | 61 | 'numWeeks' => array( |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | function get_user_interface() |
108 | 108 | { |
109 | 109 | // copied from bookmarks module. |
110 | - $cat = createobject('phpgwapi.categories','','calendar'); |
|
111 | - $cats = $cat->return_array('all',0,False,'','cat_name','',True); |
|
110 | + $cat = createobject('phpgwapi.categories', '', 'calendar'); |
|
111 | + $cats = $cat->return_array('all', 0, False, '', 'cat_name', '', True); |
|
112 | 112 | $cat_ids = array(); |
113 | 113 | while (list(,$category) = @each($cats)) |
114 | 114 | { |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | $this->arguments['category']['multiple'] = 5; |
120 | 120 | } |
121 | 121 | |
122 | - if (! isset($GLOBALS['egw']->accounts)) |
|
122 | + if (!isset($GLOBALS['egw']->accounts)) |
|
123 | 123 | { |
124 | 124 | $GLOBALS['egw']->accounts = new Api\Accounts(); |
125 | 125 | } |
126 | - $this->accounts =& $GLOBALS['egw']->accounts; |
|
127 | - $search_params=array( |
|
126 | + $this->accounts = & $GLOBALS['egw']->accounts; |
|
127 | + $search_params = array( |
|
128 | 128 | 'type' => 'both', |
129 | 129 | 'app' => 'calendar', |
130 | 130 | ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | // sort users and groups separately. |
135 | 135 | if (isset($GLOBALS['sitemgr_info']['anonymous_user'])) |
136 | 136 | { |
137 | - $anon_user = $this->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user'],'account_lid','u'); |
|
137 | + $anon_user = $this->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user'], 'account_lid', 'u'); |
|
138 | 138 | } |
139 | 139 | else |
140 | 140 | { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * Get possible sitemgr paths from the HTTP_REFERRER in order to unreveal the |
144 | 144 | * anonymous user for the correct site. |
145 | 145 | */ |
146 | - $sitemgr_path = preg_replace('/^[^\/]+:\/\/[^\/]+\/([^\?]*)(\?.*)*$/',"/\${1}",$_SERVER['HTTP_REFERER']); |
|
146 | + $sitemgr_path = preg_replace('/^[^\/]+:\/\/[^\/]+\/([^\?]*)(\?.*)*$/', "/\${1}", $_SERVER['HTTP_REFERER']); |
|
147 | 147 | // Remove the trailing file- / pathname if any |
148 | 148 | $sitemgr_path = preg_replace('/[^\/]*$/', '', $sitemgr_path); |
149 | 149 | // Add leading slash if it has been lost. |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | // Code adapted from sitemgr-site/index.php |
156 | 156 | $site_urls = array(); |
157 | 157 | $site_urls[] = $sitemgr_path; |
158 | - $site_urls[] = ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_ADDR'] . $sitemgr_path; |
|
159 | - $site_urls[] = $site_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $sitemgr_path; |
|
158 | + $site_urls[] = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_ADDR'].$sitemgr_path; |
|
159 | + $site_urls[] = $site_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].$sitemgr_path; |
|
160 | 160 | |
161 | - $anon_user = $this->accounts->name2id($GLOBALS['egw']->db->select('egw_sitemgr_sites','anonymous_user,anonymous_passwd,site_id', |
|
162 | - array('site_url' => $site_urls),__LINE__,__FILE__,false,'','sitemgr')->fetchColumn(),'account_lid','u'); |
|
161 | + $anon_user = $this->accounts->name2id($GLOBALS['egw']->db->select('egw_sitemgr_sites', 'anonymous_user,anonymous_passwd,site_id', |
|
162 | + array('site_url' => $site_urls), __LINE__, __FILE__, false, '', 'sitemgr')->fetchColumn(), 'account_lid', 'u'); |
|
163 | 163 | } |
164 | 164 | |
165 | - $anon_groups = $this->accounts->memberships($anon_user,true); |
|
165 | + $anon_groups = $this->accounts->memberships($anon_user, true); |
|
166 | 166 | foreach ($accounts as $entry) |
167 | 167 | { |
168 | 168 | $is_group = false; |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | $acl = new Acl($entry['account_id']); |
171 | 171 | $acl->read_repository(); |
172 | 172 | // get the rights for each account to check whether the anon user has read permissions. |
173 | - $rights = $acl->get_rights($anon_user,'calendar'); |
|
173 | + $rights = $acl->get_rights($anon_user, 'calendar'); |
|
174 | 174 | // also add the anon user if it's his own calendar. |
175 | - if (($rights & Acl::READ) || ($entry['account_id'] == $anon_user)) |
|
175 | + if (($rights&Acl::READ) || ($entry['account_id'] == $anon_user)) |
|
176 | 176 | { |
177 | 177 | $has_read_permissions = true; |
178 | 178 | } |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | // or ass permissions if this is the anon group's calendar. |
183 | 183 | foreach ($anon_groups as $parent_group) |
184 | 184 | { |
185 | - $rights = $acl->get_rights($parent_group,'calendar'); |
|
186 | - if (($rights & Acl::READ) || ($entry['account_id'] == $parent_group)) |
|
185 | + $rights = $acl->get_rights($parent_group, 'calendar'); |
|
186 | + if (($rights&Acl::READ) || ($entry['account_id'] == $parent_group)) |
|
187 | 187 | { |
188 | 188 | $has_read_permissions = true; |
189 | 189 | break; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | else |
201 | 201 | { |
202 | - $users[$entry['account_id']] = Api\Accounts::format_username($entry['account_lid'],$entry['account_firstname'],$entry['account_lastname']); |
|
202 | + $users[$entry['account_id']] = Api\Accounts::format_username($entry['account_lid'], $entry['account_firstname'], $entry['account_lastname']); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | return parent::get_user_interface(); |
220 | 220 | } |
221 | 221 | |
222 | - function get_content(&$arguments,$properties) |
|
222 | + function get_content(&$arguments, $properties) |
|
223 | 223 | { |
224 | 224 | $html = ""; |
225 | 225 | Api\Translation::add_app('calendar'); |
@@ -227,33 +227,32 @@ discard block |
||
227 | 227 | $this->ui->allowEdit = false; |
228 | 228 | $this->ui->use_time_grid = isset($arguments['grid']) ? $arguments['grid'] : false; |
229 | 229 | |
230 | - $weeks = $arguments['numWeeks'] ? (int) $arguments['numWeeks'] : 2; |
|
230 | + $weeks = $arguments['numWeeks'] ? (int)$arguments['numWeeks'] : 2; |
|
231 | 231 | |
232 | - if (($arguments['acceptDateParam']) && (get_var('date',array('POST','GET')))) |
|
232 | + if (($arguments['acceptDateParam']) && (get_var('date', array('POST', 'GET')))) |
|
233 | 233 | { |
234 | - $start = (int) (strtotime(get_var('date',array('POST','GET'))) + |
|
234 | + $start = (int)(strtotime(get_var('date', array('POST', 'GET'))) + |
|
235 | 235 | (60 * 60 * 24 * 7 * $dateOffset)); |
236 | 236 | } |
237 | 237 | else |
238 | 238 | { |
239 | - $start = (int) ($this->bo->now_su + |
|
239 | + $start = (int)($this->bo->now_su + |
|
240 | 240 | (60 * 60 * 24 * 7 * $dateOffset)); |
241 | 241 | } |
242 | 242 | $start = new Api\DateTime($start); |
243 | 243 | $start->setWeekstart(); |
244 | 244 | $first = $start->format('ts'); |
245 | - $last = strtotime("+$weeks weeks",$first) - 1; |
|
245 | + $last = strtotime("+$weeks weeks", $first) - 1; |
|
246 | 246 | |
247 | 247 | if ($arguments['showTitle']) |
248 | 248 | { |
249 | 249 | $html .= '<div id="divAppboxHeader">'.$GLOBALS['egw_info']['apps']['calendar']['title'].' - '.lang('Weekview').": "; |
250 | - $html .= lang('After %1',$this->bo->long_date($first)); |
|
250 | + $html .= lang('After %1', $this->bo->long_date($first)); |
|
251 | 251 | $html .= "</div>"; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // set the search parameters |
255 | - $search_params = Array |
|
256 | - ( |
|
255 | + $search_params = Array( |
|
257 | 256 | 'offset' => false, |
258 | 257 | 'order' => 'cal_start ASC', |
259 | 258 | 'start' => $first, |
@@ -288,19 +287,19 @@ discard block |
||
288 | 287 | $html .= '<!-- END Calendar info -->'."\n"; |
289 | 288 | unset($css_file); |
290 | 289 | // we add DAY_s/2 to $this->first (using 12h), to deal with daylight saving changes |
291 | - for ($week_start = $first; $week_start < $last; $week_start = strtotime("+1 week",$week_start)) |
|
290 | + for ($week_start = $first; $week_start < $last; $week_start = strtotime("+1 week", $week_start)) |
|
292 | 291 | { |
293 | 292 | $week = array(); |
294 | 293 | for ($i = 0; $i < 7; ++$i) |
295 | 294 | { |
296 | - $day_ymd = $this->bo->date2string($i ? strtotime("+$i days",$week_start) : $week_start); |
|
295 | + $day_ymd = $this->bo->date2string($i ? strtotime("+$i days", $week_start) : $week_start); |
|
297 | 296 | $week[$day_ymd] = array_shift($rows); |
298 | 297 | } |
299 | 298 | $week_view = array( |
300 | 299 | 'menuaction' => false, |
301 | 300 | 'date' => $this->bo->date2string($week_start), |
302 | 301 | ); |
303 | - $title = lang('Wk').' '.adodb_date('W',$week_start); |
|
302 | + $title = lang('Wk').' '.adodb_date('W', $week_start); |
|
304 | 303 | if (!isset($GLOBALS['egw']->template)) |
305 | 304 | { |
306 | 305 | $GLOBALS['egw']->template = new Framework\Template; |
@@ -115,7 +115,8 @@ |
||
115 | 115 | $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); |
116 | 116 | } |
117 | 117 | $this->arguments['category']['options'] = $cat_ids; |
118 | - if (count($cat_ids) > 5) { |
|
118 | + if (count($cat_ids) > 5) |
|
119 | + { |
|
119 | 120 | $this->arguments['category']['multiple'] = 5; |
120 | 121 | } |
121 | 122 |
@@ -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); |
@@ -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( |
@@ -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 | |
@@ -612,7 +628,10 @@ discard block |
||
612 | 628 | */ |
613 | 629 | public function update_client($event_id, Api\DateTime $recurrence_date = null) |
614 | 630 | { |
615 | - if(!$event_id) return false; |
|
631 | + if(!$event_id) |
|
632 | + { |
|
633 | + return false; |
|
634 | + } |
|
616 | 635 | |
617 | 636 | // Directly update stored data. |
618 | 637 | // Make sure we have the whole event |
@@ -678,7 +697,10 @@ discard block |
||
678 | 697 | */ |
679 | 698 | public function to_client(&$event) |
680 | 699 | { |
681 | - if(!$event || !is_array($event)) return false; |
|
700 | + if(!$event || !is_array($event)) |
|
701 | + { |
|
702 | + return false; |
|
703 | + } |
|
682 | 704 | |
683 | 705 | if (!$this->bo->check_perms(Acl::EDIT,$event)) |
684 | 706 | { |
@@ -699,8 +721,16 @@ discard block |
||
699 | 721 | |
700 | 722 | $event['recure'] = $this->bo->recure2string($event); |
701 | 723 | |
702 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
703 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
724 | + if (empty($event['description'])) |
|
725 | + { |
|
726 | + $event['description'] = ' '; |
|
727 | + } |
|
728 | + // no description screws the titles horz. alignment |
|
729 | + if (empty($event['location'])) |
|
730 | + { |
|
731 | + $event['location'] = ' '; |
|
732 | + } |
|
733 | + // no location screws the owner horz. alignment |
|
704 | 734 | |
705 | 735 | // respect category permissions |
706 | 736 | if(!empty($event['category'])) |
@@ -777,8 +807,14 @@ discard block |
||
777 | 807 | if(!$timespan) |
778 | 808 | { |
779 | 809 | // Try to make time span into appropriate ranges to match |
780 | - if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month'; |
|
781 | - if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week'; |
|
810 | + if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) |
|
811 | + { |
|
812 | + $template = 'month'; |
|
813 | + } |
|
814 | + if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) |
|
815 | + { |
|
816 | + $template = 'week'; |
|
817 | + } |
|
782 | 818 | //error_log("Detected template $template"); |
783 | 819 | switch ($template) |
784 | 820 | { |
@@ -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 | { |
@@ -612,10 +612,10 @@ discard block |
||
612 | 612 | */ |
613 | 613 | public function update_client($event_id, Api\DateTime $recurrence_date = null) |
614 | 614 | { |
615 | - if(!$event_id) return false; |
|
616 | - if(is_string($event_id) && strpos($event_id,':') !== FALSE) |
|
615 | + if (!$event_id) return false; |
|
616 | + if (is_string($event_id) && strpos($event_id, ':') !== FALSE) |
|
617 | 617 | { |
618 | - list($event_id, $date) = explode(':',$event_id); |
|
618 | + list($event_id, $date) = explode(':', $event_id); |
|
619 | 619 | $recurrence_date = new Api\DateTime($date); |
620 | 620 | } |
621 | 621 | |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | // Check filters to see if they still match, may have to remove |
629 | 629 | // the event because it should no longer be displayed |
630 | 630 | $filter_match = true; |
631 | - if($this->cal_prefs['saved_states']['status_filter'] != 'all' || |
|
631 | + if ($this->cal_prefs['saved_states']['status_filter'] != 'all' || |
|
632 | 632 | $this->cal_prefs['saved_states']['cat_id']) |
633 | 633 | { |
634 | 634 | $filter_check = array( |
@@ -641,20 +641,20 @@ discard block |
||
641 | 641 | $filter_match = count($this->bo->search($filter_check, $this->bo->so->cal_table.".cal_id = {$event['id']}")) > 0; |
642 | 642 | } |
643 | 643 | |
644 | - if(!$event || !$filter_match) |
|
644 | + if (!$event || !$filter_match) |
|
645 | 645 | { |
646 | 646 | // Sending null will trigger a removal |
647 | 647 | $response->generic('data', array('uid' => 'calendar::'.$event_id, 'data' => null)); |
648 | 648 | return false; |
649 | 649 | } |
650 | 650 | |
651 | - if(!$event['recur_type'] || $recurrence_date) |
|
651 | + if (!$event['recur_type'] || $recurrence_date) |
|
652 | 652 | { |
653 | 653 | $this->to_client($event); |
654 | 654 | $response->generic('data', array('uid' => 'calendar::'.$event['row_id'], 'data' => $event)); |
655 | 655 | } |
656 | 656 | // If it's recurring, try to send the next month or so |
657 | - else if($event['recur_type'] ) |
|
657 | + else if ($event['recur_type']) |
|
658 | 658 | { |
659 | 659 | $this_month = new Api\DateTime('next month'); |
660 | 660 | $rrule = calendar_rrule::event2rrule($event, true); |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $response->generic('data', array('uid' => 'calendar::'.$converted['row_id'], 'data' => $converted)); |
668 | 668 | $rrule->next(); |
669 | 669 | } |
670 | - while ($rrule->valid() && $occurrence <= $this_month ); |
|
670 | + while ($rrule->valid() && $occurrence <= $this_month); |
|
671 | 671 | } |
672 | 672 | return true; |
673 | 673 | } |
@@ -683,15 +683,15 @@ discard block |
||
683 | 683 | */ |
684 | 684 | public function to_client(&$event) |
685 | 685 | { |
686 | - if(!$event || !is_array($event)) return false; |
|
686 | + if (!$event || !is_array($event)) return false; |
|
687 | 687 | |
688 | - if (!$this->bo->check_perms(Acl::EDIT,$event)) |
|
688 | + if (!$this->bo->check_perms(Acl::EDIT, $event)) |
|
689 | 689 | { |
690 | 690 | $event['class'] .= 'rowNoEdit '; |
691 | 691 | } |
692 | 692 | |
693 | 693 | // Delete disabled for other applications |
694 | - if (!$this->bo->check_perms(Acl::DELETE,$event) || !is_numeric($event['id'])) |
|
694 | + if (!$this->bo->check_perms(Acl::DELETE, $event) || !is_numeric($event['id'])) |
|
695 | 695 | { |
696 | 696 | $event['class'] .= 'rowNoDelete '; |
697 | 697 | } |
@@ -704,32 +704,32 @@ discard block |
||
704 | 704 | |
705 | 705 | $event['recure'] = $this->bo->recure2string($event); |
706 | 706 | |
707 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
708 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
707 | + if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
708 | + if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
709 | 709 | |
710 | 710 | // respect category permissions |
711 | - if(!empty($event['category'])) |
|
711 | + if (!empty($event['category'])) |
|
712 | 712 | { |
713 | 713 | $event['category'] = $this->categories->check_list(Acl::READ, $event['category']); |
714 | 714 | } |
715 | 715 | $event['non_blocking'] = (bool)$event['non_blocking']; |
716 | 716 | |
717 | 717 | $matches = null; |
718 | - if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches)) |
|
718 | + if (!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i', $event['id'], $matches)) |
|
719 | 719 | { |
720 | 720 | $app = $matches[1]; |
721 | 721 | $app_id = $matches[2]; |
722 | 722 | $icons = array(); |
723 | - if(!($is_private = calendar_bo::integration_get_private($app,$app_id,$event))) |
|
723 | + if (!($is_private = calendar_bo::integration_get_private($app, $app_id, $event))) |
|
724 | 724 | { |
725 | - $icons = calendar_uiviews::integration_get_icons($app,$app_id,$event); |
|
725 | + $icons = calendar_uiviews::integration_get_icons($app, $app_id, $event); |
|
726 | 726 | } |
727 | 727 | $event['app'] = $app; |
728 | 728 | $event['app_id'] = $app_id; |
729 | 729 | } |
730 | 730 | else |
731 | 731 | { |
732 | - $is_private = !$this->bo->check_perms(Acl::READ,$event); |
|
732 | + $is_private = !$this->bo->check_perms(Acl::READ, $event); |
|
733 | 733 | } |
734 | 734 | if ($is_private) |
735 | 735 | { |
@@ -737,29 +737,29 @@ discard block |
||
737 | 737 | $event['class'] .= 'rowNoView '; |
738 | 738 | } |
739 | 739 | |
740 | - if(!$event['app']) |
|
740 | + if (!$event['app']) |
|
741 | 741 | { |
742 | 742 | $event['app'] = 'calendar'; |
743 | 743 | } |
744 | - if(!$event['app_id']) |
|
744 | + if (!$event['app_id']) |
|
745 | 745 | { |
746 | 746 | $event['app_id'] = $event['id']; |
747 | 747 | } |
748 | 748 | |
749 | 749 | if ($event['recur_type'] != MCAL_RECUR_NONE) |
750 | 750 | { |
751 | - $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts'); |
|
751 | + $event['app_id'] .= ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts'); |
|
752 | 752 | } |
753 | 753 | // set id for grid |
754 | - $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts') : ''); |
|
754 | + $event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'], 'ts') : ''); |
|
755 | 755 | |
756 | - $event['parts'] = implode(",\n",$this->bo->participants($event,false)); |
|
756 | + $event['parts'] = implode(",\n", $this->bo->participants($event, false)); |
|
757 | 757 | $event['date'] = $this->bo->date2string($event['start']); |
758 | 758 | |
759 | 759 | // Change dates |
760 | - foreach(calendar_egw_record::$types['date-time'] as $field) |
|
760 | + foreach (calendar_egw_record::$types['date-time'] as $field) |
|
761 | 761 | { |
762 | - if(is_int($event[$field])) |
|
762 | + if (is_int($event[$field])) |
|
763 | 763 | { |
764 | 764 | $event[$field] = Api\DateTime::to($event[$field], Api\DateTime::ET2); |
765 | 765 | } |
@@ -777,13 +777,13 @@ discard block |
||
777 | 777 | public function merge($timespan = array()) |
778 | 778 | { |
779 | 779 | // Merge print |
780 | - if($_GET['merge']) |
|
780 | + if ($_GET['merge']) |
|
781 | 781 | { |
782 | - if(!$timespan) |
|
782 | + if (!$timespan) |
|
783 | 783 | { |
784 | 784 | // Try to make time span into appropriate ranges to match |
785 | - if(stripos($_GET['merge'],'month') !== false || stripos($_GET['merge'],lang('month')) !== false) $template = 'month'; |
|
786 | - if(stripos($_GET['merge'],'week') !== false || stripos($_GET['merge'],lang('week')) !== false) $template = 'week'; |
|
785 | + if (stripos($_GET['merge'], 'month') !== false || stripos($_GET['merge'], lang('month')) !== false) $template = 'month'; |
|
786 | + if (stripos($_GET['merge'], 'week') !== false || stripos($_GET['merge'], lang('week')) !== false) $template = 'week'; |
|
787 | 787 | //error_log("Detected template $template"); |
788 | 788 | switch ($template) |
789 | 789 | { |
@@ -791,8 +791,8 @@ discard block |
||
791 | 791 | // Trim to _only_ the month, do not pad to week start / end |
792 | 792 | $time = new Api\DateTime($this->date); |
793 | 793 | $timespan = array(array( |
794 | - 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'),'ts'), |
|
795 | - 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'),'ts') |
|
794 | + 'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'), 'ts'), |
|
795 | + 'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'), 'ts') |
|
796 | 796 | )); |
797 | 797 | break; |
798 | 798 | case 'week': |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $start = new Api\DateTime($this->first); |
801 | 801 | $t = clone $start; |
802 | 802 | $t->modify('+1 week')->modify('-1 second'); |
803 | - if($t->format('ts') < Api\DateTime::to($this->last,'ts')) |
|
803 | + if ($t->format('ts') < Api\DateTime::to($this->last, 'ts')) |
|
804 | 804 | { |
805 | 805 | do |
806 | 806 | { |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | ); |
811 | 811 | $start->modify('+1 week'); |
812 | 812 | $t->modify('+1 week'); |
813 | - } while( $start->format('ts') < $this->last); |
|
813 | + } while ($start->format('ts') < $this->last); |
|
814 | 814 | break; |
815 | 815 | } |
816 | 816 | // Fall through |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | Framework::refresh_opener($error, 'calendar'); |
829 | 829 | } |
830 | 830 | unset($_GET['merge']); |
831 | - if($error) |
|
831 | + if ($error) |
|
832 | 832 | { |
833 | 833 | // This doesn't give message either, but at least it doesn't give a blank screen |
834 | 834 | Framework::redirect_link('/index.php', array( |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | static private $recur_egw2ical_2_0 = array( |
77 | 77 | self::DAILY => 'DAILY', |
78 | 78 | self::WEEKLY => 'WEEKLY', |
79 | - self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday} |
|
80 | - self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month} |
|
79 | + self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday} |
|
80 | + self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month} |
|
81 | 81 | self::YEARLY => 'YEARLY', |
82 | 82 | ); |
83 | 83 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | static private $recur_egw2ical_1_0 = array( |
88 | 88 | self::DAILY => 'D', |
89 | 89 | self::WEEKLY => 'W', |
90 | - self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday} |
|
91 | - self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1} |
|
90 | + self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday} |
|
91 | + self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1} |
|
92 | 92 | self::YEARLY => 'YM', |
93 | 93 | ); |
94 | 94 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | const THURSDAY = 16; |
145 | 145 | const FRIDAY = 32; |
146 | 146 | const SATURDAY = 64; |
147 | - const WORKDAYS = 62; // Mo, ..., Fr |
|
147 | + const WORKDAYS = 62; // Mo, ..., Fr |
|
148 | 148 | const ALLDAYS = 127; |
149 | 149 | /** |
150 | 150 | * Translate weekday bitmasks to labels |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @var array |
174 | 174 | */ |
175 | - public $exceptions=array(); |
|
175 | + public $exceptions = array(); |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Array of exceptions as DateTime/egw_time objects |
179 | 179 | * |
180 | 180 | * @var array |
181 | 181 | */ |
182 | - public $exceptions_objs=array(); |
|
182 | + public $exceptions_objs = array(); |
|
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Starttime of series |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | * @param int $weekdays =0 self::SUNDAY=1|self::MONDAY=2|...|self::SATURDAY=64 |
223 | 223 | * @param array $exceptions =null DateTime objects with exceptions |
224 | 224 | */ |
225 | - public function __construct(DateTime $time,$type,$interval=1,DateTime $enddate=null,$weekdays=0,array $exceptions=null) |
|
225 | + public function __construct(DateTime $time, $type, $interval = 1, DateTime $enddate = null, $weekdays = 0, array $exceptions = null) |
|
226 | 226 | { |
227 | - switch($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']) |
|
227 | + switch ($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']) |
|
228 | 228 | { |
229 | 229 | case 'Sunday': |
230 | 230 | $this->lastdayofweek = self::SATURDAY; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | $this->time = $time instanceof Api\DateTime ? $time : new Api\DateTime($time); |
240 | 240 | |
241 | - if (!in_array($type,array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY))) |
|
241 | + if (!in_array($type, array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY))) |
|
242 | 242 | { |
243 | 243 | throw new Api\Exception\WrongParameter(__METHOD__."($time,$type,$interval,$enddate,$weekdays,...) type $type is NOT valid!"); |
244 | 244 | } |
@@ -248,16 +248,16 @@ discard block |
||
248 | 248 | if ($type == self::MONTHLY_WDAY) |
249 | 249 | { |
250 | 250 | // check for last week of month |
251 | - if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time)-7) |
|
251 | + if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time) - 7) |
|
252 | 252 | { |
253 | 253 | $this->monthly_byday_num = -1; |
254 | 254 | } |
255 | 255 | else |
256 | 256 | { |
257 | - $this->monthly_byday_num = 1 + floor(($this->time->format('d')-1) / 7); |
|
257 | + $this->monthly_byday_num = 1 + floor(($this->time->format('d') - 1) / 7); |
|
258 | 258 | } |
259 | 259 | } |
260 | - elseif($type == self::MONTHLY_MDAY) |
|
260 | + elseif ($type == self::MONTHLY_MDAY) |
|
261 | 261 | { |
262 | 262 | $this->monthly_bymonthday = (int)$this->time->format('d'); |
263 | 263 | // check for last day of month |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | if ((int)$interval < 1) |
276 | 276 | { |
277 | - $interval = 1; // calendar stores no (extra) interval as null, so using default 1 here |
|
277 | + $interval = 1; // calendar stores no (extra) interval as null, so using default 1 here |
|
278 | 278 | } |
279 | 279 | $this->interval = (int)$interval; |
280 | 280 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | if ($exceptions) |
306 | 306 | { |
307 | - foreach($exceptions as $exception) |
|
307 | + foreach ($exceptions as $exception) |
|
308 | 308 | { |
309 | 309 | $exception->setTimezone($this->time->getTimezone()); |
310 | 310 | $this->exceptions[] = $exception->format('Ymd'); |
@@ -320,22 +320,22 @@ discard block |
||
320 | 320 | * @param int $interval =1 |
321 | 321 | * @return int |
322 | 322 | */ |
323 | - public static function recurrence_interval($type, $interval=1) |
|
323 | + public static function recurrence_interval($type, $interval = 1) |
|
324 | 324 | { |
325 | - switch($type) |
|
325 | + switch ($type) |
|
326 | 326 | { |
327 | 327 | case self::DAILY: |
328 | - $duration = 24*3600; |
|
328 | + $duration = 24 * 3600; |
|
329 | 329 | break; |
330 | 330 | case self::WEEKLY: |
331 | - $duration = 7*24*3600; |
|
331 | + $duration = 7 * 24 * 3600; |
|
332 | 332 | break; |
333 | 333 | case self::MONTHLY_MDAY: |
334 | 334 | case self::MONTHLY_WDAY: |
335 | - $duration = 31*24*3600; |
|
335 | + $duration = 31 * 24 * 3600; |
|
336 | 336 | break; |
337 | 337 | case self::YEARLY: |
338 | - $duration = 366*24*3600; |
|
338 | + $duration = 366 * 24 * 3600; |
|
339 | 339 | break; |
340 | 340 | } |
341 | 341 | if ($interval > 1) $duration *= $interval; |
@@ -351,9 +351,9 @@ discard block |
||
351 | 351 | */ |
352 | 352 | private static function daysInMonth(DateTime $time) |
353 | 353 | { |
354 | - list($year,$month) = explode('-',$time->format('Y-m')); |
|
354 | + list($year, $month) = explode('-', $time->format('Y-m')); |
|
355 | 355 | $last_day = new Api\DateTime(); |
356 | - $last_day->setDate($year,$month+1,0); |
|
356 | + $last_day->setDate($year, $month + 1, 0); |
|
357 | 357 | |
358 | 358 | return (int)$last_day->format('d'); |
359 | 359 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | public function next_no_exception() |
385 | 385 | { |
386 | - switch($this->type) |
|
386 | + switch ($this->type) |
|
387 | 387 | { |
388 | 388 | case self::NONE: // need to add at least one day, to end "series", as enddate == current date |
389 | 389 | case self::DAILY: |
@@ -398,28 +398,28 @@ discard block |
||
398 | 398 | // --> on the last day of the week we have to additionally advance interval-1 weeks |
399 | 399 | if ($this->interval > 1 && self::getWeekday($this->current) == $this->lastdayofweek) |
400 | 400 | { |
401 | - $this->current->modify(($this->interval-1).' week'); |
|
401 | + $this->current->modify(($this->interval - 1).' week'); |
|
402 | 402 | } |
403 | 403 | $this->current->modify('1 day'); |
404 | 404 | //echo __METHOD__.'() '.$this->current->format('l').', '.$this->current.": $this->weekdays & ".self::getWeekday($this->current)."<br />\n"; |
405 | 405 | } |
406 | - while(!($this->weekdays & self::getWeekday($this->current))); |
|
406 | + while (!($this->weekdays&self::getWeekday($this->current))); |
|
407 | 407 | break; |
408 | 408 | |
409 | 409 | case self::MONTHLY_WDAY: // iCal: BYDAY={1, ..., 5, -1}{MO..SO} |
410 | 410 | // advance to start of next month |
411 | - list($year,$month) = explode('-',$this->current->format('Y-m')); |
|
412 | - $month += $this->interval+($this->monthly_byday_num < 0 ? 1 : 0); |
|
413 | - $this->current->setDate($year,$month,$this->monthly_byday_num < 0 ? 0 : 1); |
|
411 | + list($year, $month) = explode('-', $this->current->format('Y-m')); |
|
412 | + $month += $this->interval + ($this->monthly_byday_num < 0 ? 1 : 0); |
|
413 | + $this->current->setDate($year, $month, $this->monthly_byday_num < 0 ? 0 : 1); |
|
414 | 414 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).": setDate($year,$month,1): ".$this->current->format('l').', '.$this->current."<br />\n"; |
415 | 415 | // now advance to n-th week |
416 | 416 | if ($this->monthly_byday_num > 1) |
417 | 417 | { |
418 | - $this->current->modify(($this->monthly_byday_num-1).' week'); |
|
418 | + $this->current->modify(($this->monthly_byday_num - 1).' week'); |
|
419 | 419 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify('.($this->monthly_byday_num-1).' week): '.$this->current->format('l').', '.$this->current."<br />\n"; |
420 | 420 | } |
421 | 421 | // advance to given weekday |
422 | - while(!($this->weekdays & self::getWeekday($this->current))) |
|
422 | + while (!($this->weekdays&self::getWeekday($this->current))) |
|
423 | 423 | { |
424 | 424 | $this->current->modify(($this->monthly_byday_num < 0 ? -1 : 1).' day'); |
425 | 425 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify(1 day): '.$this->current->format('l').', '.$this->current."<br />\n"; |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | break; |
428 | 428 | |
429 | 429 | case self::MONTHLY_MDAY: // iCal: monthly_bymonthday={1, ..., 31, -1} |
430 | - list($year,$month) = explode('-',$this->current->format('Y-m')); |
|
431 | - $day = $this->monthly_bymonthday+($this->monthly_bymonthday < 0 ? 1 : 0); |
|
432 | - $month += $this->interval+($this->monthly_bymonthday < 0 ? 1 : 0); |
|
433 | - $this->current->setDate($year,$month,$day); |
|
430 | + list($year, $month) = explode('-', $this->current->format('Y-m')); |
|
431 | + $day = $this->monthly_bymonthday + ($this->monthly_bymonthday < 0 ? 1 : 0); |
|
432 | + $month += $this->interval + ($this->monthly_bymonthday < 0 ? 1 : 0); |
|
433 | + $this->current->setDate($year, $month, $day); |
|
434 | 434 | //echo __METHOD__."() setDate($year,$month,$day): ".$this->current->format('l').', '.$this->current."<br />\n"; |
435 | 435 | break; |
436 | 436 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | { |
453 | 453 | $this->next_no_exception(); |
454 | 454 | } |
455 | - while($this->exceptions && in_array($this->current->format('Ymd'),$this->exceptions)); |
|
455 | + while ($this->exceptions && in_array($this->current->format('Ymd'), $this->exceptions)); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | /** |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | if (isset($this->current)) $backup = $this->current; |
485 | 485 | $this->rewind(); |
486 | 486 | |
487 | - while(--$count > 0) |
|
487 | + while (--$count > 0) |
|
488 | 488 | { |
489 | 489 | $this->next_no_exception(); |
490 | 490 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | // if enddate is now before next acurrence, but not on same day, we use previous recurrence |
510 | 510 | // this can happen if client gives an enddate which is NOT a recurrence date |
511 | 511 | // eg. for a on Monday recurring weekly event a Tuesday as enddate |
512 | - if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd')) |
|
512 | + if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd')) |
|
513 | 513 | { |
514 | 514 | $last = $previous; |
515 | 515 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | $this->current = clone $this->time; |
529 | 529 | while ($this->valid() && |
530 | 530 | $this->exceptions && |
531 | - in_array($this->current->format('Ymd'),$this->exceptions)) |
|
531 | + in_array($this->current->format('Ymd'), $this->exceptions)) |
|
532 | 532 | { |
533 | 533 | $this->next_no_exception(); |
534 | 534 | } |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | * |
540 | 540 | * @return boolean |
541 | 541 | */ |
542 | - public function valid () |
|
542 | + public function valid() |
|
543 | 543 | { |
544 | 544 | return $this->current->format('Ymd') <= $this->enddate_ymd; |
545 | 545 | } |
@@ -553,9 +553,9 @@ discard block |
||
553 | 553 | { |
554 | 554 | $str = ''; |
555 | 555 | // Repeated Events |
556 | - if($this->type != self::NONE) |
|
556 | + if ($this->type != self::NONE) |
|
557 | 557 | { |
558 | - list($str) = explode(' (',lang(self::$types[$this->type])); // remove (by day/date) from Monthly |
|
558 | + list($str) = explode(' (', lang(self::$types[$this->type])); // remove (by day/date) from Monthly |
|
559 | 559 | |
560 | 560 | $str_extra = array(); |
561 | 561 | switch ($this->type) |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | { |
572 | 572 | $repeat_days[] = $this->type == self::WEEKLY ? lang('all') : lang('day'); |
573 | 573 | } |
574 | - elseif($this->weekdays == self::WORKDAYS) |
|
574 | + elseif ($this->weekdays == self::WORKDAYS) |
|
575 | 575 | { |
576 | 576 | $repeat_days[] = $this->type == self::WEEKLY ? lang('workdays') : lang('workday'); |
577 | 577 | } |
@@ -579,24 +579,24 @@ discard block |
||
579 | 579 | { |
580 | 580 | foreach (self::$days as $mask => $label) |
581 | 581 | { |
582 | - if ($this->weekdays & $mask) |
|
582 | + if ($this->weekdays&$mask) |
|
583 | 583 | { |
584 | 584 | $repeat_days[] = lang($label); |
585 | 585 | } |
586 | 586 | } |
587 | 587 | } |
588 | - if($this->type == self::WEEKLY && count($repeat_days)) |
|
588 | + if ($this->type == self::WEEKLY && count($repeat_days)) |
|
589 | 589 | { |
590 | - $str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days); |
|
590 | + $str_extra[] = lang('days repeated').': '.implode(', ', $repeat_days); |
|
591 | 591 | } |
592 | - elseif($this->type == self::MONTHLY_WDAY) |
|
592 | + elseif ($this->type == self::MONTHLY_WDAY) |
|
593 | 593 | { |
594 | - $str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ',$repeat_days); |
|
594 | + $str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ', $repeat_days); |
|
595 | 595 | } |
596 | 596 | break; |
597 | 597 | |
598 | 598 | } |
599 | - if($this->interval > 1) |
|
599 | + if ($this->interval > 1) |
|
600 | 600 | { |
601 | 601 | $str_extra[] = lang('Interval').': '.$this->interval; |
602 | 602 | } |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | { |
613 | 613 | $str_extra[] = $this->time->getTimezone()->getName(); |
614 | 614 | } |
615 | - if(count($str_extra)) |
|
615 | + if (count($str_extra)) |
|
616 | 616 | { |
617 | - $str .= ' ('.implode(', ',$str_extra).')'; |
|
617 | + $str .= ' ('.implode(', ', $str_extra).')'; |
|
618 | 618 | } |
619 | 619 | } |
620 | 620 | return $str; |
@@ -626,24 +626,24 @@ discard block |
||
626 | 626 | * |
627 | 627 | * $return array vCalendar RRULE |
628 | 628 | */ |
629 | - public function generate_rrule($version='2.0') |
|
629 | + public function generate_rrule($version = '2.0') |
|
630 | 630 | { |
631 | 631 | $repeat_days = array(); |
632 | 632 | $rrule = array(); |
633 | 633 | |
634 | - if ($this->type == self::NONE) return false; // no recuring event |
|
634 | + if ($this->type == self::NONE) return false; // no recuring event |
|
635 | 635 | |
636 | 636 | if ($version == '1.0') |
637 | 637 | { |
638 | - $rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type] . $this->interval; |
|
638 | + $rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type].$this->interval; |
|
639 | 639 | switch ($this->type) |
640 | 640 | { |
641 | 641 | case self::WEEKLY: |
642 | 642 | foreach (self::$days as $mask => $label) |
643 | 643 | { |
644 | - if ($this->weekdays & $mask) |
|
644 | + if ($this->weekdays&$mask) |
|
645 | 645 | { |
646 | - $repeat_days[] = strtoupper(substr($label,0,2)); |
|
646 | + $repeat_days[] = strtoupper(substr($label, 0, 2)); |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | $rrule['BYDAY'] = implode(' ', $repeat_days); |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}+ {MO..SO} |
657 | 657 | $rrule['BYDAY'] = abs($this->monthly_byday_num); |
658 | 658 | $rrule['BYDAY'] .= ($this->monthly_byday_num < 0) ? '- ' : '+ '; |
659 | - $rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'),0,2)); |
|
659 | + $rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'), 0, 2)); |
|
660 | 660 | $rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY']; |
661 | 661 | break; |
662 | 662 | } |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | case self::WEEKLY: |
675 | 675 | foreach (self::$days as $mask => $label) |
676 | 676 | { |
677 | - if ($this->weekdays & $mask) |
|
677 | + if ($this->weekdays&$mask) |
|
678 | 678 | { |
679 | - $repeat_days[] = strtoupper(substr($label,0,2)); |
|
679 | + $repeat_days[] = strtoupper(substr($label, 0, 2)); |
|
680 | 680 | } |
681 | 681 | } |
682 | 682 | $rrule['BYDAY'] = implode(',', $repeat_days); |
@@ -687,8 +687,8 @@ discard block |
||
687 | 687 | break; |
688 | 688 | |
689 | 689 | case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO} |
690 | - $rrule['BYDAY'] = $this->monthly_byday_num . |
|
691 | - strtoupper(substr($this->time->format('l'),0,2)); |
|
690 | + $rrule['BYDAY'] = $this->monthly_byday_num. |
|
691 | + strtoupper(substr($this->time->format('l'), 0, 2)); |
|
692 | 692 | break; |
693 | 693 | } |
694 | 694 | if ($this->interval > 1) |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | * |
724 | 724 | * @return calendar_rrule false on error |
725 | 725 | */ |
726 | - public static function event2rrule(array $event,$usertime=true,$to_tz=null) |
|
726 | + public static function event2rrule(array $event, $usertime = true, $to_tz = null) |
|
727 | 727 | { |
728 | - if (!is_array($event) || !isset($event['tzid'])) return false; |
|
728 | + if (!is_array($event) || !isset($event['tzid'])) return false; |
|
729 | 729 | if (!$to_tz) $to_tz = $event['tzid']; |
730 | 730 | $timestamp_tz = $usertime ? Api\DateTime::$user_timezone : Api\DateTime::$server_timezone; |
731 | - $time = is_a($event['start'],'DateTime') ? $event['start'] : new Api\DateTime($event['start'],$timestamp_tz); |
|
731 | + $time = is_a($event['start'], 'DateTime') ? $event['start'] : new Api\DateTime($event['start'], $timestamp_tz); |
|
732 | 732 | |
733 | 733 | if (!isset(self::$tz_cache[$to_tz])) |
734 | 734 | { |
@@ -741,16 +741,16 @@ discard block |
||
741 | 741 | |
742 | 742 | if ($event['recur_enddate']) |
743 | 743 | { |
744 | - $enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'],$timestamp_tz); |
|
744 | + $enddate = is_a($event['recur_enddate'], 'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'], $timestamp_tz); |
|
745 | 745 | } |
746 | 746 | if (is_array($event['recur_exception'])) |
747 | 747 | { |
748 | - foreach($event['recur_exception'] as $exception) |
|
748 | + foreach ($event['recur_exception'] as $exception) |
|
749 | 749 | { |
750 | - $exceptions[] = is_a($exception,'DateTime') ? $exception : new Api\DateTime($exception,$timestamp_tz); |
|
750 | + $exceptions[] = is_a($exception, 'DateTime') ? $exception : new Api\DateTime($exception, $timestamp_tz); |
|
751 | 751 | } |
752 | 752 | } |
753 | - return new calendar_rrule($time,$event['recur_type'],$event['recur_interval'],$enddate,$event['recur_data'],$exceptions); |
|
753 | + return new calendar_rrule($time, $event['recur_type'], $event['recur_interval'], $enddate, $event['recur_data'], $exceptions); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | /** |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | * @param DateTime/string starttime of the event (in servertime) |
777 | 777 | * @param string $to_tz new timezone |
778 | 778 | */ |
779 | - public static function rrule2tz(array &$event,$starttime,$to_tz) |
|
779 | + public static function rrule2tz(array &$event, $starttime, $to_tz) |
|
780 | 780 | { |
781 | 781 | // We assume that the difference between timezones can result |
782 | 782 | // in a maximum of one day |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | self::$tz_cache[$to_tz] = calendar_timezones::DateTimeZone($to_tz); |
798 | 798 | } |
799 | 799 | |
800 | - $time = is_a($starttime,'DateTime') ? |
|
800 | + $time = is_a($starttime, 'DateTime') ? |
|
801 | 801 | $starttime : new Api\DateTime($starttime, Api\DateTime::$server_timezone); |
802 | 802 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
803 | 803 | $remote = clone $time; |
@@ -815,11 +815,11 @@ discard block |
||
815 | 815 | if ($delta == 1 || $delta == -6) |
816 | 816 | { |
817 | 817 | $mask = $mask << 1; |
818 | - if ($mask & 128) $mask = $mask - 127; // overflow |
|
818 | + if ($mask&128) $mask = $mask - 127; // overflow |
|
819 | 819 | } |
820 | 820 | else |
821 | 821 | { |
822 | - if ($mask & 1) $mask = $mask + 128; // underflow |
|
822 | + if ($mask&1) $mask = $mask + 128; // underflow |
|
823 | 823 | $mask = $mask >> 1; |
824 | 824 | } |
825 | 825 | $event['recur_data'] = $mask; |
@@ -830,15 +830,15 @@ discard block |
||
830 | 830 | |
831 | 831 | if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) // some tests |
832 | 832 | { |
833 | - ini_set('display_errors',1); |
|
834 | - error_reporting(E_ALL & ~E_NOTICE); |
|
833 | + ini_set('display_errors', 1); |
|
834 | + error_reporting(E_ALL&~E_NOTICE); |
|
835 | 835 | function lang($str) { return $str; } |
836 | 836 | $GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin'; |
837 | 837 | require_once('../../api/src/autoload.php'); |
838 | 838 | |
839 | 839 | if (!isset($_REQUEST['time'])) |
840 | 840 | { |
841 | - $now = new Api\DateTime('now',new DateTimeZone($_REQUEST['tz'] = 'UTC')); |
|
841 | + $now = new Api\DateTime('now', new DateTimeZone($_REQUEST['tz'] = 'UTC')); |
|
842 | 842 | $_REQUEST['time'] = $now->format(); |
843 | 843 | $_REQUEST['type'] = calendar_rrule::WEEKLY; |
844 | 844 | $_REQUEST['interval'] = 2; |
@@ -847,29 +847,29 @@ discard block |
||
847 | 847 | $_REQUEST['user-tz'] = 'Europe/Berlin'; |
848 | 848 | } |
849 | 849 | echo "<html>\n<head>\n\t<title>Test calendar_rrule class</title>\n</head>\n<body>\n<form method='GET'>\n"; |
850 | - echo "<p>Date+Time: ".Api\Html::input('time',$_REQUEST['time']). |
|
851 | - Api\Html::select('tz',$_REQUEST['tz'],Api\DateTime::getTimezones())."</p>\n"; |
|
852 | - echo "<p>Type: ".Api\Html::select('type',$_REQUEST['type'],calendar_rrule::$types)."\n". |
|
853 | - "Interval: ".Api\Html::input('interval',$_REQUEST['interval'])."</p>\n"; |
|
850 | + echo "<p>Date+Time: ".Api\Html::input('time', $_REQUEST['time']). |
|
851 | + Api\Html::select('tz', $_REQUEST['tz'], Api\DateTime::getTimezones())."</p>\n"; |
|
852 | + echo "<p>Type: ".Api\Html::select('type', $_REQUEST['type'], calendar_rrule::$types)."\n". |
|
853 | + "Interval: ".Api\Html::input('interval', $_REQUEST['interval'])."</p>\n"; |
|
854 | 854 | echo "<table><tr><td>\n"; |
855 | - echo "Weekdays:<br />".Api\Html::checkbox_multiselect('weekdays',$_REQUEST['weekdays'],calendar_rrule::$days,false,'','7',false,'height: 150px;')."\n"; |
|
855 | + echo "Weekdays:<br />".Api\Html::checkbox_multiselect('weekdays', $_REQUEST['weekdays'], calendar_rrule::$days, false, '', '7', false, 'height: 150px;')."\n"; |
|
856 | 856 | echo "</td><td>\n"; |
857 | - echo "<p>Exceptions:<br />".Api\Html::textarea('exceptions',$_REQUEST['exceptions'],'style="height: 150px;"')."\n"; |
|
857 | + echo "<p>Exceptions:<br />".Api\Html::textarea('exceptions', $_REQUEST['exceptions'], 'style="height: 150px;"')."\n"; |
|
858 | 858 | echo "</td></tr></table>\n"; |
859 | - echo "<p>Enddate: ".Api\Html::input('enddate',$_REQUEST['enddate'])."</p>\n"; |
|
860 | - echo "<p>Display recurances in ".Api\Html::select('user-tz',$_REQUEST['user-tz'],Api\DateTime::getTimezones())."</p>\n"; |
|
861 | - echo "<p>".Api\Html::submit_button('calc','Calculate')."</p>\n"; |
|
859 | + echo "<p>Enddate: ".Api\Html::input('enddate', $_REQUEST['enddate'])."</p>\n"; |
|
860 | + echo "<p>Display recurances in ".Api\Html::select('user-tz', $_REQUEST['user-tz'], Api\DateTime::getTimezones())."</p>\n"; |
|
861 | + echo "<p>".Api\Html::submit_button('calc', 'Calculate')."</p>\n"; |
|
862 | 862 | echo "</form>\n"; |
863 | 863 | |
864 | 864 | $tz = new DateTimeZone($_REQUEST['tz']); |
865 | - $time = new Api\DateTime($_REQUEST['time'],$tz); |
|
866 | - if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'],$tz); |
|
867 | - $weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
868 | - if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); } |
|
865 | + $time = new Api\DateTime($_REQUEST['time'], $tz); |
|
866 | + if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'], $tz); |
|
867 | + $weekdays = 0; foreach ((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
868 | + if ($_REQUEST['exceptions']) foreach (preg_split("/[,\r\n]+ ?/", $_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); } |
|
869 | 869 | |
870 | - $rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions); |
|
870 | + $rrule = new calendar_rrule($time, $_REQUEST['type'], $_REQUEST['interval'], $enddate, $weekdays, $exceptions); |
|
871 | 871 | echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n"; |
872 | - foreach($rrule as $rtime) |
|
872 | + foreach ($rrule as $rtime) |
|
873 | 873 | { |
874 | 874 | $rtime->setTimezone(Api\DateTime::$user_timezone); |
875 | 875 | echo ++$n.': '.$rtime->format('l').', '.$rtime."<br />\n"; |
@@ -338,7 +338,10 @@ discard block |
||
338 | 338 | $duration = 366*24*3600; |
339 | 339 | break; |
340 | 340 | } |
341 | - if ($interval > 1) $duration *= $interval; |
|
341 | + if ($interval > 1) |
|
342 | + { |
|
343 | + $duration *= $interval; |
|
344 | + } |
|
342 | 345 | |
343 | 346 | return $duration; |
344 | 347 | } |
@@ -481,7 +484,10 @@ discard block |
||
481 | 484 | { |
482 | 485 | return clone $this->time; |
483 | 486 | } |
484 | - if (isset($this->current)) $backup = $this->current; |
|
487 | + if (isset($this->current)) |
|
488 | + { |
|
489 | + $backup = $this->current; |
|
490 | + } |
|
485 | 491 | $this->rewind(); |
486 | 492 | |
487 | 493 | while(--$count > 0) |
@@ -489,7 +495,10 @@ discard block |
||
489 | 495 | $this->next_no_exception(); |
490 | 496 | } |
491 | 497 | $ret = clone $this->current; |
492 | - if ($backup) $this->current = $backup; |
|
498 | + if ($backup) |
|
499 | + { |
|
500 | + $this->current = $backup; |
|
501 | + } |
|
493 | 502 | return $ret; |
494 | 503 | } |
495 | 504 | |
@@ -631,7 +640,11 @@ discard block |
||
631 | 640 | $repeat_days = array(); |
632 | 641 | $rrule = array(); |
633 | 642 | |
634 | - if ($this->type == self::NONE) return false; // no recuring event |
|
643 | + if ($this->type == self::NONE) |
|
644 | + { |
|
645 | + return false; |
|
646 | + } |
|
647 | + // no recuring event |
|
635 | 648 | |
636 | 649 | if ($version == '1.0') |
637 | 650 | { |
@@ -725,8 +738,14 @@ discard block |
||
725 | 738 | */ |
726 | 739 | public static function event2rrule(array $event,$usertime=true,$to_tz=null) |
727 | 740 | { |
728 | - if (!is_array($event) || !isset($event['tzid'])) return false; |
|
729 | - if (!$to_tz) $to_tz = $event['tzid']; |
|
741 | + if (!is_array($event) || !isset($event['tzid'])) |
|
742 | + { |
|
743 | + return false; |
|
744 | + } |
|
745 | + if (!$to_tz) |
|
746 | + { |
|
747 | + $to_tz = $event['tzid']; |
|
748 | + } |
|
730 | 749 | $timestamp_tz = $usertime ? Api\DateTime::$user_timezone : Api\DateTime::$server_timezone; |
731 | 750 | $time = is_a($event['start'],'DateTime') ? $event['start'] : new Api\DateTime($event['start'],$timestamp_tz); |
732 | 751 | |
@@ -786,7 +805,10 @@ discard block |
||
786 | 805 | $event['recur_type'] == self::NONE || |
787 | 806 | empty($event['recur_data']) || $event['recur_data'] == ALLDAYS || |
788 | 807 | empty($event['tzid']) || empty($to_tz) || |
789 | - $event['tzid'] == $to_tz) return; |
|
808 | + $event['tzid'] == $to_tz) |
|
809 | + { |
|
810 | + return; |
|
811 | + } |
|
790 | 812 | |
791 | 813 | if (!isset(self::$tz_cache[$event['tzid']])) |
792 | 814 | { |
@@ -815,11 +837,19 @@ discard block |
||
815 | 837 | if ($delta == 1 || $delta == -6) |
816 | 838 | { |
817 | 839 | $mask = $mask << 1; |
818 | - if ($mask & 128) $mask = $mask - 127; // overflow |
|
840 | + if ($mask & 128) |
|
841 | + { |
|
842 | + $mask = $mask - 127; |
|
843 | + } |
|
844 | + // overflow |
|
819 | 845 | } |
820 | 846 | else |
821 | 847 | { |
822 | - if ($mask & 1) $mask = $mask + 128; // underflow |
|
848 | + if ($mask & 1) |
|
849 | + { |
|
850 | + $mask = $mask + 128; |
|
851 | + } |
|
852 | + // underflow |
|
823 | 853 | $mask = $mask >> 1; |
824 | 854 | } |
825 | 855 | $event['recur_data'] = $mask; |
@@ -828,11 +858,16 @@ discard block |
||
828 | 858 | } |
829 | 859 | } |
830 | 860 | |
831 | -if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) // some tests |
|
861 | +if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) |
|
862 | +{ |
|
863 | + // some tests |
|
832 | 864 | { |
833 | 865 | ini_set('display_errors',1); |
866 | +} |
|
834 | 867 | error_reporting(E_ALL & ~E_NOTICE); |
835 | - function lang($str) { return $str; } |
|
868 | + function lang($str) |
|
869 | + { |
|
870 | +return $str; } |
|
836 | 871 | $GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin'; |
837 | 872 | require_once('../../api/src/autoload.php'); |
838 | 873 | |
@@ -863,9 +898,18 @@ discard block |
||
863 | 898 | |
864 | 899 | $tz = new DateTimeZone($_REQUEST['tz']); |
865 | 900 | $time = new Api\DateTime($_REQUEST['time'],$tz); |
866 | - if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'],$tz); |
|
867 | - $weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
868 | - if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); } |
|
901 | + if ($_REQUEST['enddate']) |
|
902 | + { |
|
903 | + $enddate = new Api\DateTime($_REQUEST['enddate'],$tz); |
|
904 | + } |
|
905 | + $weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) |
|
906 | + { |
|
907 | +$weekdays |= $mask; } |
|
908 | + if ($_REQUEST['exceptions']) |
|
909 | + { |
|
910 | + foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); |
|
911 | + } |
|
912 | + } |
|
869 | 913 | |
870 | 914 | $rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions); |
871 | 915 | echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n"; |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * |
62 | 62 | * @var array |
63 | 63 | */ |
64 | - static public $types = Array( |
|
64 | + static public $types = array( |
|
65 | 65 | self::NONE => 'None', |
66 | 66 | self::DAILY => 'Daily', |
67 | 67 | self::WEEKLY => 'Weekly', |