@@ -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; |
@@ -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'] = |
@@ -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']); |
@@ -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 | |
@@ -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"; |
@@ -29,24 +29,24 @@ |
||
| 29 | 29 | * @param string $cname |
| 30 | 30 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
| 31 | 31 | */ |
| 32 | - public function beforeSendToClient($cname, array $expand=null) |
|
| 32 | + public function beforeSendToClient($cname, array $expand = null) |
|
| 33 | 33 | { |
| 34 | 34 | $form_name = self::form_name($cname, $this->id, $expand); |
| 35 | - $value =& self::get_array(self::$request->content, $form_name, true); |
|
| 36 | - if(!is_array($value)) $value = array(); |
|
| 35 | + $value = & self::get_array(self::$request->content, $form_name, true); |
|
| 36 | + if (!is_array($value)) $value = array(); |
|
| 37 | 37 | |
| 38 | - foreach($value as &$events) |
|
| 38 | + foreach ($value as &$events) |
|
| 39 | 39 | { |
| 40 | - if(!is_array($events)) |
|
| 40 | + if (!is_array($events)) |
|
| 41 | 41 | { |
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | - foreach($events as &$event) |
|
| 44 | + foreach ($events as &$event) |
|
| 45 | 45 | { |
| 46 | - if(!is_array($event)) continue; |
|
| 47 | - foreach(array('start','end') as $date) |
|
| 46 | + if (!is_array($event)) continue; |
|
| 47 | + foreach (array('start', 'end') as $date) |
|
| 48 | 48 | { |
| 49 | - $event[$date] = Api\DateTime::to($event[$date],'Y-m-d\TH:i:s\Z'); |
|
| 49 | + $event[$date] = Api\DateTime::to($event[$date], 'Y-m-d\TH:i:s\Z'); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |