@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function __construct() |
26 | 26 | { |
27 | - if (false) parent::__construct(); // can not be called, but gives IDE warning |
|
27 | + if (false) parent::__construct(); // can not be called, but gives IDE warning |
|
28 | 28 | |
29 | 29 | $this->datasource('calendar'); |
30 | 30 | |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | |
49 | 49 | if (!is_array($data_id)) |
50 | 50 | { |
51 | - if (!(int) $data_id || !($data = $cal->read((int) $data_id))) |
|
51 | + if (!(int)$data_id || !($data = $cal->read((int)$data_id))) |
|
52 | 52 | { |
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | } |
56 | 56 | else |
57 | 57 | { |
58 | - $data =& $data_id; |
|
58 | + $data = & $data_id; |
|
59 | 59 | } |
60 | 60 | $ds = array( |
61 | 61 | 'pe_title' => $cal->link_title($data), |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'pe_details' => $data['description'] ? nl2br($data['description']) : '', |
66 | 66 | ); |
67 | 67 | // return first global category, as PM only supports one |
68 | - foreach($data['category'] ? explode(',', $data['category']) : array() as $cat_id) |
|
68 | + foreach ($data['category'] ? explode(',', $data['category']) : array() as $cat_id) |
|
69 | 69 | { |
70 | 70 | if (Api\Categories::is_global($cat_id)) |
71 | 71 | { |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | } |
75 | 75 | } |
76 | 76 | // calculation of the time |
77 | - $ds['pe_planned_time'] = (int) (($ds['pe_planned_end'] - $ds['pe_planned_start'])/60); // time is in minutes |
|
77 | + $ds['pe_planned_time'] = (int)(($ds['pe_planned_end'] - $ds['pe_planned_start']) / 60); // time is in minutes |
|
78 | 78 | |
79 | 79 | // if the event spans multiple days, we have to substract the nights (24h - daily working time specified in PM) |
80 | - if (($ds['pe_planned_time']/ 60 > 24) && date('Y-m-d',$ds['pe_planned_end']) != date('Y-m-d',$ds['pe_planned_start'])) |
|
80 | + if (($ds['pe_planned_time'] / 60 > 24) && date('Y-m-d', $ds['pe_planned_end']) != date('Y-m-d', $ds['pe_planned_start'])) |
|
81 | 81 | { |
82 | 82 | $start = $end = null; |
83 | - foreach(array('start','end') as $name) |
|
83 | + foreach (array('start', 'end') as $name) |
|
84 | 84 | { |
85 | 85 | $arr = $cal->date2array($ds['pe_planned_'.$name]); |
86 | 86 | $arr['hour'] = 12; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | if (!is_array($this->pm_config)) |
94 | 94 | { |
95 | - $c =& CreateObject('phpgwapi.config','projectmanager'); |
|
95 | + $c = & CreateObject('phpgwapi.config', 'projectmanager'); |
|
96 | 96 | $c->read_repository(); |
97 | 97 | $this->pm_config = $c->config_data; |
98 | 98 | unset($c); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | $ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']); |
102 | 102 | } |
103 | - foreach($data['participants'] as $uid => $status) |
|
103 | + foreach ($data['participants'] as $uid => $status) |
|
104 | 104 | { |
105 | 105 | if ($status != 'R' && is_numeric($uid)) // only users for now |
106 | 106 | { |
@@ -24,7 +24,11 @@ discard block |
||
24 | 24 | */ |
25 | 25 | function __construct() |
26 | 26 | { |
27 | - if (false) parent::__construct(); // can not be called, but gives IDE warning |
|
27 | + if (false) |
|
28 | + { |
|
29 | + parent::__construct(); |
|
30 | + } |
|
31 | + // can not be called, but gives IDE warning |
|
28 | 32 | |
29 | 33 | $this->datasource('calendar'); |
30 | 34 | |
@@ -96,16 +100,22 @@ discard block |
||
96 | 100 | $c->read_repository(); |
97 | 101 | $this->pm_config = $c->config_data; |
98 | 102 | unset($c); |
99 | - if (!$this->pm_config['hours_per_workday']) $this->pm_config['hours_per_workday'] = 8; |
|
103 | + if (!$this->pm_config['hours_per_workday']) |
|
104 | + { |
|
105 | + $this->pm_config['hours_per_workday'] = 8; |
|
106 | + } |
|
100 | 107 | } |
101 | 108 | $ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']); |
102 | 109 | } |
103 | 110 | foreach($data['participants'] as $uid => $status) |
104 | 111 | { |
105 | - if ($status != 'R' && is_numeric($uid)) // only users for now |
|
112 | + if ($status != 'R' && is_numeric($uid)) |
|
113 | + { |
|
114 | + // only users for now |
|
106 | 115 | { |
107 | 116 | $ds['pe_resources'][] = $uid; |
108 | 117 | } |
118 | + } |
|
109 | 119 | } |
110 | 120 | // if we have multiple participants we have to multiply the time by the number of participants to get the total time |
111 | 121 | $ds['pe_planned_time'] *= count($ds['pe_resources']); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // List each custom field |
34 | 34 | unset($this->mapping_fields['customfields']); |
35 | 35 | $custom = Api\Storage\Customfields::get('calendar'); |
36 | - foreach($custom as $name => $data) { |
|
36 | + foreach ($custom as $name => $data) { |
|
37 | 37 | $this->mapping_fields['#'.$name] = $data['label']; |
38 | 38 | } |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) |
54 | 54 | { |
55 | 55 | $result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv); |
56 | - $content['msg'] .= "\n*" ; |
|
56 | + $content['msg'] .= "\n*"; |
|
57 | 57 | |
58 | 58 | return $result; |
59 | 59 | } |
@@ -47,7 +47,8 @@ |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | $custom = Api\Storage\Customfields::get('resources', true); |
50 | - foreach($custom as $name => $data) { |
|
50 | + foreach($custom as $name => $data) |
|
51 | + { |
|
51 | 52 | $this->mapping_fields['#'.$name] = $data['label']; |
52 | 53 | } |
53 | 54 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @param egw_record $_definition |
25 | 25 | */ |
26 | - public function export( $_stream, importexport_definition $_definition) { |
|
26 | + public function export($_stream, importexport_definition $_definition) { |
|
27 | 27 | $options = $_definition->plugin_options; |
28 | 28 | $this->bo = new calendar_bo(); |
29 | 29 | $boical = new calendar_ical(); |
@@ -34,34 +34,34 @@ discard block |
||
34 | 34 | $limit_exception = Api\Storage\Merge::is_export_limit_excepted(); |
35 | 35 | if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
36 | 36 | |
37 | - if($options['selection'] == 'criteria') |
|
37 | + if ($options['selection'] == 'criteria') |
|
38 | 38 | { |
39 | 39 | $query = array( |
40 | 40 | 'start' => $options['criteria']['start'], |
41 | - 'end' => strtotime('+1 day',$options['criteria']['end'])-1, |
|
41 | + 'end' => strtotime('+1 day', $options['criteria']['end']) - 1, |
|
42 | 42 | 'categories' => $options['categories'], |
43 | 43 | 'daywise' => false, |
44 | 44 | 'users' => $options['criteria']['owner'], |
45 | 45 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
46 | 46 | ); |
47 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
47 | + if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
48 | 48 | $query['offset'] = 0; |
49 | - $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
49 | + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
50 | 50 | } |
51 | - $events =& $this->bo->search($query); |
|
51 | + $events = & $this->bo->search($query); |
|
52 | 52 | } |
53 | 53 | // Scheduled export will use 'all', which we don't allow through UI |
54 | 54 | elseif ($options['selection'] == 'search_results' || $options['selection'] == 'all') |
55 | 55 | { |
56 | 56 | $states = Api\Cache::getSession('calendar', 'session_data'); |
57 | - if($states['view'] == 'listview') |
|
57 | + if ($states['view'] == 'listview') |
|
58 | 58 | { |
59 | 59 | $query = Api\Cache::getSession('calendar', 'calendar_list'); |
60 | - $query['num_rows'] = -1; // all |
|
60 | + $query['num_rows'] = -1; // all |
|
61 | 61 | $query['start'] = 0; |
62 | 62 | $query['cfs'] = $cfs; |
63 | 63 | |
64 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
64 | + if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
65 | 65 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
66 | 66 | } |
67 | 67 | $ui = new calendar_uilist(); |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | $query = Api\Cache::getSession('calendar', 'session_data'); |
74 | 74 | $query['users'] = explode(',', $query['owner']); |
75 | 75 | $query['num_rows'] = -1; |
76 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
76 | + if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
77 | 77 | { |
78 | - $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
78 | + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
79 | 79 | } |
80 | 80 | |
81 | - switch($states['view']) |
|
81 | + switch ($states['view']) |
|
82 | 82 | { |
83 | 83 | case 'month': |
84 | 84 | $query += calendar_export_csv::get_query_month($states); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | default: |
93 | 93 | // Let UI set the date ranges |
94 | 94 | $ui = new calendar_uiviews($query); |
95 | - if(method_exists($ui, $states['view'])) |
|
95 | + if (method_exists($ui, $states['view'])) |
|
96 | 96 | { |
97 | 97 | ob_start(); |
98 | 98 | $ui->$states['view'](); |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | // compile list of unique cal_id's, as iCal should contain whole series, not recurrences |
115 | 115 | // calendar_ical->exportVCal needs to read events again, to get them in server-time |
116 | 116 | $ids = array(); |
117 | - foreach($events as $event) |
|
117 | + foreach ($events as $event) |
|
118 | 118 | { |
119 | 119 | $id = is_array($event) ? $event['id'] : $event; |
120 | 120 | if (($id = (int)$id)) $ids[$id] = $id; |
121 | 121 | } |
122 | 122 | |
123 | - $ical =& $boical->exportVCal($ids,'2.0','PUBLISH',false); |
|
123 | + $ical = & $boical->exportVCal($ids, '2.0', 'PUBLISH', false); |
|
124 | 124 | fwrite($_stream, $ical); |
125 | 125 | } |
126 | 126 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Exports records as defined in $_definition |
31 | 31 | * |
32 | - * @param egw_record $_definition |
|
32 | + * @param importexport_definition $_definition |
|
33 | 33 | */ |
34 | 34 | public function export( $_stream, importexport_definition $_definition) { |
35 | 35 | $options = $_definition->plugin_options; |
@@ -16,14 +16,16 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * iCal export plugin of calendar |
18 | 18 | */ |
19 | -class calendar_export_ical extends calendar_export_csv { |
|
19 | +class calendar_export_ical extends calendar_export_csv |
|
20 | +{ |
|
20 | 21 | |
21 | 22 | /** |
22 | 23 | * Exports records as defined in $_definition |
23 | 24 | * |
24 | 25 | * @param egw_record $_definition |
25 | 26 | */ |
26 | - public function export( $_stream, importexport_definition $_definition) { |
|
27 | + public function export( $_stream, importexport_definition $_definition) |
|
28 | + { |
|
27 | 29 | $options = $_definition->plugin_options; |
28 | 30 | $this->bo = new calendar_bo(); |
29 | 31 | $boical = new calendar_ical(); |
@@ -32,7 +34,10 @@ discard block |
||
32 | 34 | $cfs = array(); |
33 | 35 | |
34 | 36 | $limit_exception = Api\Storage\Merge::is_export_limit_excepted(); |
35 | - if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
|
37 | + if (!$limit_exception) |
|
38 | + { |
|
39 | + $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
|
40 | + } |
|
36 | 41 | |
37 | 42 | if($options['selection'] == 'criteria') |
38 | 43 | { |
@@ -44,7 +49,8 @@ discard block |
||
44 | 49 | 'users' => $options['criteria']['owner'], |
45 | 50 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
46 | 51 | ); |
47 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
52 | + if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
53 | + { |
|
48 | 54 | $query['offset'] = 0; |
49 | 55 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
50 | 56 | } |
@@ -61,7 +67,8 @@ discard block |
||
61 | 67 | $query['start'] = 0; |
62 | 68 | $query['cfs'] = $cfs; |
63 | 69 | |
64 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
70 | + if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
71 | + { |
|
65 | 72 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
66 | 73 | } |
67 | 74 | $ui = new calendar_uilist(); |
@@ -117,7 +124,10 @@ discard block |
||
117 | 124 | foreach($events as $event) |
118 | 125 | { |
119 | 126 | $id = is_array($event) ? $event['id'] : $event; |
120 | - if (($id = (int)$id)) $ids[$id] = $id; |
|
127 | + if (($id = (int)$id)) |
|
128 | + { |
|
129 | + $ids[$id] = $id; |
|
130 | + } |
|
121 | 131 | } |
122 | 132 | |
123 | 133 | $ical =& $boical->exportVCal($ids,'2.0','PUBLISH',false); |
@@ -129,7 +139,8 @@ discard block |
||
129 | 139 | * |
130 | 140 | * @return string name |
131 | 141 | */ |
132 | - public static function get_name() { |
|
142 | + public static function get_name() |
|
143 | + { |
|
133 | 144 | return lang('Calendar iCal export'); |
134 | 145 | } |
135 | 146 | |
@@ -138,7 +149,8 @@ discard block |
||
138 | 149 | * |
139 | 150 | * @return string descriprion |
140 | 151 | */ |
141 | - public static function get_description() { |
|
152 | + public static function get_description() |
|
153 | + { |
|
142 | 154 | return lang("Exports events from your Calendar in iCal format."); |
143 | 155 | } |
144 | 156 | |
@@ -147,11 +159,13 @@ discard block |
||
147 | 159 | * |
148 | 160 | * @return string suffix |
149 | 161 | */ |
150 | - public static function get_filesuffix() { |
|
162 | + public static function get_filesuffix() |
|
163 | + { |
|
151 | 164 | return 'ics'; |
152 | 165 | } |
153 | 166 | |
154 | - public static function get_mimetype() { |
|
167 | + public static function get_mimetype() |
|
168 | + { |
|
155 | 169 | return 'text/calendar'; |
156 | 170 | } |
157 | 171 | |
@@ -159,14 +173,16 @@ discard block |
||
159 | 173 | * return html for options. |
160 | 174 | * |
161 | 175 | */ |
162 | - public function get_options_etpl() { |
|
176 | + public function get_options_etpl() |
|
177 | + { |
|
163 | 178 | } |
164 | 179 | |
165 | 180 | /** |
166 | 181 | * returns selectors of this plugin |
167 | 182 | * |
168 | 183 | */ |
169 | - public function get_selectors_etpl($definition = null) { |
|
184 | + public function get_selectors_etpl($definition = null) |
|
185 | + { |
|
170 | 186 | $data = parent::get_selectors_etpl($definition); |
171 | 187 | return $data; |
172 | 188 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | static function search_link($location) |
30 | 30 | { |
31 | - unset($location); // not used, but in function signature for hooks |
|
31 | + unset($location); // not used, but in function signature for hooks |
|
32 | 32 | return array( |
33 | 33 | 'query' => 'calendar.calendar_bo.link_query', |
34 | 34 | 'title' => 'calendar.calendar_bo.link_title', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'add_id' => 'link_id', |
51 | 51 | 'add_popup' => '850x590', |
52 | 52 | 'file_access' => 'calendar.calendar_bo.file_access', |
53 | - 'file_access_user' => true, // file_access supports 4th parameter $user |
|
53 | + 'file_access_user' => true, // file_access supports 4th parameter $user |
|
54 | 54 | 'mime' => array( |
55 | 55 | 'text/calendar' => array( |
56 | 56 | 'menuaction' => 'calendar.calendar_uiforms.edit', |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | static function getAppExportLimit($location) |
76 | 76 | { |
77 | - unset($location); // not used, but in function signature for hooks |
|
77 | + unset($location); // not used, but in function signature for hooks |
|
78 | 78 | return $GLOBALS['egw_info']['server']['calendar_export_limit']; |
79 | 79 | } |
80 | 80 | |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | static function admin() |
85 | 85 | { |
86 | 86 | $file = Array( |
87 | - 'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
88 | - 'Custom fields' => Egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'), |
|
89 | - 'Global Categories' => Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'), |
|
90 | - 'Category ACL' => Egw::link('/index.php','menuaction=calendar.calendar_uiforms.cat_acl'), |
|
91 | - 'Update timezones' => Egw::link('/index.php','menuaction=calendar.calendar_timezones.update'), |
|
87 | + 'Site Configuration' => Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
88 | + 'Custom fields' => Egw::link('/index.php', 'menuaction=admin.customfields.index&appname=calendar'), |
|
89 | + 'Global Categories' => Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar'), |
|
90 | + 'Category ACL' => Egw::link('/index.php', 'menuaction=calendar.calendar_uiforms.cat_acl'), |
|
91 | + 'Update timezones' => Egw::link('/index.php', 'menuaction=calendar.calendar_timezones.update'), |
|
92 | 92 | ); |
93 | - display_section('calendar','calendar',$file); |
|
93 | + display_section('calendar', 'calendar', $file); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | for ($i = 2; $i <= 4; ++$i) |
162 | 162 | { |
163 | - $muliple_weeks[$i] = lang('%1 weeks',$i); |
|
163 | + $muliple_weeks[$i] = lang('%1 weeks', $i); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | for ($i = 2; $i <= 9; $i++) |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | if (!$hook_data['setup']) // does not work at setup time |
199 | 199 | { |
200 | 200 | $options = array('0' => lang('none')); |
201 | - foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group) |
|
201 | + foreach ($GLOBALS['egw']->accounts->search(array('type' => 'owngroups', 'app' => 'calendar')) as $group) |
|
202 | 202 | { |
203 | 203 | $options[$group['account_id']] = Api\Accounts::username($group['account_id']); |
204 | 204 | } |
205 | - $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); |
|
205 | + $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'], $GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); |
|
206 | 206 | $freebusy_url = '<a href="'.$freebusy_url.'" target="_blank">'.$freebusy_url.'</a>'; |
207 | 207 | $freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is'); |
208 | - $freebusy_help .= ' ' . $freebusy_url; |
|
208 | + $freebusy_help .= ' '.$freebusy_url; |
|
209 | 209 | |
210 | 210 | // Timezone for file exports |
211 | 211 | $export_tzs = array('0' => 'Use Event TZ'); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | 'admin' => False |
371 | 371 | ), |
372 | 372 | 'default-alarm' => array( |
373 | - 'type' => 'date-duration',//'select', |
|
373 | + 'type' => 'date-duration', //'select', |
|
374 | 374 | 'label' => lang('Default alarm for regular events').' ('.lang('empty = no alarm').')', |
375 | 375 | 'name' => 'default-alarm', |
376 | 376 | 'help' => 'Alarm added automatic to new events before event start-time', |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | 'default' => '', |
380 | 380 | ), |
381 | 381 | 'default-alarm-wholeday' => array( |
382 | - 'type' => 'date-duration',//'select', |
|
382 | + 'type' => 'date-duration', //'select', |
|
383 | 383 | 'label' => lang('Default alarm for whole-day events').' ('.lang('empty = no alarm').')', |
384 | 384 | 'name' => 'default-alarm-wholeday', |
385 | 385 | 'help' => lang('Alarm added automatic to new events before event start-time').' ('.lang('Midnight').')', |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | { |
393 | 393 | $prefs = $GLOBALS['egw_info']['user']['preferences']['calendar']; |
394 | 394 | $data = array( |
395 | - 'prefs' => &$prefs, // use reference to get preference value back |
|
395 | + 'prefs' => &$prefs, // use reference to get preference value back |
|
396 | 396 | 'preprocess' => true, |
397 | 397 | 'type' => 'user', |
398 | 398 | ); |
@@ -565,9 +565,9 @@ discard block |
||
565 | 565 | 'size' => 60, |
566 | 566 | 'label' => 'Default document to insert entries', |
567 | 567 | 'name' => 'default_document', |
568 | - 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('calendar')).' '. |
|
569 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. |
|
570 | - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), |
|
568 | + 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('calendar')).' '. |
|
569 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title').' '. |
|
570 | + lang('The following document-types are supported:').implode(',', Api\Storage\Merge::get_file_extensions()), |
|
571 | 571 | 'run_lang' => false, |
572 | 572 | 'xmlrpc' => True, |
573 | 573 | 'admin' => False, |
@@ -577,9 +577,9 @@ discard block |
||
577 | 577 | 'size' => 60, |
578 | 578 | 'label' => 'Directory with documents to insert entries', |
579 | 579 | 'name' => 'document_dir', |
580 | - 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('calendar')).' '. |
|
581 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. |
|
582 | - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), |
|
580 | + 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.', lang('calendar')).' '. |
|
581 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title').' '. |
|
582 | + lang('The following document-types are supported:').implode(',', Api\Storage\Merge::get_file_extensions()), |
|
583 | 583 | 'run_lang' => false, |
584 | 584 | 'xmlrpc' => True, |
585 | 585 | 'admin' => False, |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | } |
605 | 605 | catch (Exception $e) |
606 | 606 | { |
607 | - unset($e); // not used |
|
607 | + unset($e); // not used |
|
608 | 608 | // permission error |
609 | 609 | continue; |
610 | 610 | } |
@@ -692,14 +692,14 @@ discard block |
||
692 | 692 | if ($data['type'] != 'user') return; |
693 | 693 | |
694 | 694 | $account_lid = $GLOBALS['egw_info']['user']['account_lid']; |
695 | - foreach(array( |
|
695 | + foreach (array( |
|
696 | 696 | 'default-alarm' => 'default-alarm-vevent-datetime:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', |
697 | 697 | 'default-alarm-wholeday' => 'default-alarm-vevent-date:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', |
698 | 698 | ) as $name => $dav) |
699 | 699 | { |
700 | - $pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
|
701 | - if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
702 | - $val =& $data['prefs'][$name]; |
|
700 | + $pref = & $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
|
701 | + if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
702 | + $val = & $data['prefs'][$name]; |
|
703 | 703 | |
704 | 704 | //error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val"); |
705 | 705 | |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | 'D' => 1440, |
721 | 721 | ); |
722 | 722 | $factor = $factors[strtoupper($matches[2])]; |
723 | - $val = $factor*(int)$matches[1]; |
|
723 | + $val = $factor * (int)$matches[1]; |
|
724 | 724 | } |
725 | 725 | else |
726 | 726 | { |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | } |
752 | 752 | else |
753 | 753 | { |
754 | - $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val)/60, 0).'H', $pref); |
|
754 | + $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val) / 60, 0).'H', $pref); |
|
755 | 755 | } |
756 | 756 | $GLOBALS['egw']->preferences->add('groupdav', $dav, $pref, 'user'); |
757 | 757 | //error_log(__METHOD__."() storing $name=$val --> $dav='$pref'"); |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | */ |
813 | 813 | public static function categories($data) |
814 | 814 | { |
815 | - unset($data); // not used, but in function signature for hooks |
|
815 | + unset($data); // not used, but in function signature for hooks |
|
816 | 816 | return true; |
817 | 817 | } |
818 | 818 | |
@@ -823,9 +823,9 @@ discard block |
||
823 | 823 | */ |
824 | 824 | public static function mail_import($args) |
825 | 825 | { |
826 | - unset($args); // not used, but required by function signature |
|
826 | + unset($args); // not used, but required by function signature |
|
827 | 827 | |
828 | - return array ( |
|
828 | + return array( |
|
829 | 829 | 'menuaction' => 'calendar.calendar_uiforms.mail_import', |
830 | 830 | 'popup' => Link::get_registry('calendar', 'edit_popup') |
831 | 831 | ); |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | $async = new Api\Asyncservice(); |
842 | 842 | $async->cancel_timer($id); |
843 | 843 | |
844 | - if((float)$config > 0) |
|
844 | + if ((float)$config > 0) |
|
845 | 845 | { |
846 | 846 | $result = $async->set_timer( |
847 | 847 | array('month' => '*', 'day' => 1), |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | 'calendar.calendar_boupdate.purge', |
850 | 850 | (float)$config |
851 | 851 | ); |
852 | - if(!$result) |
|
852 | + if (!$result) |
|
853 | 853 | { |
854 | 854 | $GLOBALS['config_error'] = 'Unable to schedule purge'; |
855 | 855 | } |
@@ -100,9 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | static function settings($hook_data) |
102 | 102 | { |
103 | - if (!$hook_data['setup']) // does not work on setup time |
|
103 | + if (!$hook_data['setup']) |
|
104 | + { |
|
105 | + // does not work on setup time |
|
104 | 106 | { |
105 | 107 | $bo = new calendar_bo(); |
108 | + } |
|
106 | 109 | $bo->check_set_default_prefs(); |
107 | 110 | } |
108 | 111 | $yesno = array( |
@@ -195,9 +198,12 @@ discard block |
||
195 | 198 | 1 => lang('Yes'), |
196 | 199 | 2 => lang('With credentials included'), |
197 | 200 | ); |
198 | - if (!$hook_data['setup']) // does not work at setup time |
|
201 | + if (!$hook_data['setup']) |
|
202 | + { |
|
203 | + // does not work at setup time |
|
199 | 204 | { |
200 | 205 | $options = array('0' => lang('none')); |
206 | + } |
|
201 | 207 | foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group) |
202 | 208 | { |
203 | 209 | $options[$group['account_id']] = Api\Accounts::username($group['account_id']); |
@@ -388,9 +394,12 @@ discard block |
||
388 | 394 | 'default' => '', |
389 | 395 | ), |
390 | 396 | ); |
391 | - if (isset($bo)) // add custom time-spans set by CalDAV clients, not in our prefs |
|
397 | + if (isset($bo)) |
|
398 | + { |
|
399 | + // add custom time-spans set by CalDAV clients, not in our prefs |
|
392 | 400 | { |
393 | 401 | $prefs = $GLOBALS['egw_info']['user']['preferences']['calendar']; |
402 | + } |
|
394 | 403 | $data = array( |
395 | 404 | 'prefs' => &$prefs, // use reference to get preference value back |
396 | 405 | 'preprocess' => true, |
@@ -689,7 +698,10 @@ discard block |
||
689 | 698 | { |
690 | 699 | //error_log(__METHOD__."(".array2string($data).")"); |
691 | 700 | // caldav perfs are always user specific and cant by switched off |
692 | - if ($data['type'] != 'user') return; |
|
701 | + if ($data['type'] != 'user') |
|
702 | + { |
|
703 | + return; |
|
704 | + } |
|
693 | 705 | |
694 | 706 | $account_lid = $GLOBALS['egw_info']['user']['account_lid']; |
695 | 707 | foreach(array( |
@@ -698,16 +710,23 @@ discard block |
||
698 | 710 | ) as $name => $dav) |
699 | 711 | { |
700 | 712 | $pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
701 | - if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
713 | + if (true) |
|
714 | + { |
|
715 | + $pref = str_replace("\r", '', $pref); |
|
716 | + } |
|
717 | + // remove CR messing up multiline preg_match |
|
702 | 718 | $val =& $data['prefs'][$name]; |
703 | 719 | |
704 | 720 | //error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val"); |
705 | 721 | |
706 | - if ($data['preprocess']) // showing preferences |
|
722 | + if ($data['preprocess']) |
|
723 | + { |
|
724 | + // showing preferences |
|
707 | 725 | { |
708 | 726 | if (!isset($val)) // no calendar pref --> read value from caldav |
709 | 727 | { |
710 | 728 | $matches = null; |
729 | + } |
|
711 | 730 | if (preg_match('/^ACTION:NONE$/mi', $pref)) |
712 | 731 | { |
713 | 732 | $val = ''; |
@@ -464,7 +464,7 @@ |
||
464 | 464 | { |
465 | 465 | unset($args); // unused, but required by function signature |
466 | 466 | $appname = 'preferences'; |
467 | - $file = Array( |
|
467 | + $file = array( |
|
468 | 468 | 'Site configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname.'&ajax=true'), |
469 | 469 | ); |
470 | 470 | display_section($appname, $file); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Egroupware |
|
4 | - * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
|
5 | - * @link http://www.egroupware.org |
|
6 | - * @author Nathan Gray |
|
7 | - * @version $Id$ |
|
8 | - */ |
|
3 | + * Egroupware |
|
4 | + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
|
5 | + * @link http://www.egroupware.org |
|
6 | + * @author Nathan Gray |
|
7 | + * @version $Id$ |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | use EGroupware\Api; |
11 | 11 | use EGroupware\Api\Etemplate; |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | /** |
25 | - * Set up what we know on the server side. |
|
26 | - * |
|
27 | - * Sending a first chunk of rows |
|
28 | - * |
|
29 | - * @param string $cname |
|
30 | - * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
|
31 | - */ |
|
25 | + * Set up what we know on the server side. |
|
26 | + * |
|
27 | + * Sending a first chunk of rows |
|
28 | + * |
|
29 | + * @param string $cname |
|
30 | + * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
|
31 | + */ |
|
32 | 32 | public function beforeSendToClient($cname, array $expand=null) |
33 | 33 | { |
34 | 34 | $form_name = self::form_name($cname, $this->id, $expand); |
@@ -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 | } |
@@ -33,7 +33,10 @@ discard block |
||
33 | 33 | { |
34 | 34 | $form_name = self::form_name($cname, $this->id, $expand); |
35 | 35 | $value =& self::get_array(self::$request->content, $form_name, true); |
36 | - if(!is_array($value)) $value = array(); |
|
36 | + if(!is_array($value)) |
|
37 | + { |
|
38 | + $value = array(); |
|
39 | + } |
|
37 | 40 | |
38 | 41 | foreach($value as &$events) |
39 | 42 | { |
@@ -43,7 +46,10 @@ discard block |
||
43 | 46 | } |
44 | 47 | foreach($events as &$event) |
45 | 48 | { |
46 | - if(!is_array($event)) continue; |
|
49 | + if(!is_array($event)) |
|
50 | + { |
|
51 | + continue; |
|
52 | + } |
|
47 | 53 | foreach(array('start','end') as $date) |
48 | 54 | { |
49 | 55 | $event[$date] = Api\DateTime::to($event[$date],'Y-m-d\TH:i:s\Z'); |
@@ -323,17 +323,17 @@ |
||
323 | 323 | $days = $states['days']; |
324 | 324 | $ui = new calendar_uiviews($states); |
325 | 325 | if (!$days) |
326 | - { |
|
327 | - $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview']; |
|
328 | - if ($days != 5) $days = 7; |
|
329 | - } |
|
326 | + { |
|
327 | + $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview']; |
|
328 | + if ($days != 5) $days = 7; |
|
329 | + } |
|
330 | 330 | if ($states['view'] == 'week' && $days == 4) // next 4 days view |
331 | - { |
|
332 | - $query['start'] = $this->bo->date2ts($states['date']); |
|
333 | - $query['end'] = strtotime("+$days days",$query['start']) - 1; |
|
334 | - } |
|
335 | - else |
|
336 | - { |
|
331 | + { |
|
332 | + $query['start'] = $this->bo->date2ts($states['date']); |
|
333 | + $query['end'] = strtotime("+$days days",$query['start']) - 1; |
|
334 | + } |
|
335 | + else |
|
336 | + { |
|
337 | 337 | $query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']); |
338 | 338 | if ($days == 5) // no weekend-days |
339 | 339 | { |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param egw_record $_definition |
31 | 31 | */ |
32 | - public function export( $_stream, importexport_definition $_definition) { |
|
32 | + public function export($_stream, importexport_definition $_definition) { |
|
33 | 33 | $options = $_definition->plugin_options; |
34 | 34 | |
35 | 35 | $limit_exception = Api\Storage\Merge::is_export_limit_excepted(); |
36 | 36 | if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
37 | 37 | // Custom fields need to be specifically requested |
38 | 38 | $cfs = array(); |
39 | - foreach($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
40 | - if($key[0] == '#') $cfs[] = substr($key,1); |
|
39 | + foreach ($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
40 | + if ($key[0] == '#') $cfs[] = substr($key, 1); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $query = array( |
@@ -45,34 +45,34 @@ discard block |
||
45 | 45 | 'num_rows' => -1, |
46 | 46 | 'csv_export' => true |
47 | 47 | ); |
48 | - switch($options['selection']) |
|
48 | + switch ($options['selection']) |
|
49 | 49 | { |
50 | 50 | case 'criteria': |
51 | 51 | $query = array( |
52 | 52 | 'start' => $options['criteria']['start'], |
53 | - 'end' => strtotime('+1 day',$options['criteria']['end'])-1, |
|
53 | + 'end' => strtotime('+1 day', $options['criteria']['end']) - 1, |
|
54 | 54 | 'categories' => $options['categories'] ? $options['categories'] : $options['criteria']['categories'], |
55 | 55 | //'enum_recuring' => false, // we want the recurring events enumerated for csv export |
56 | 56 | 'daywise' => false, |
57 | 57 | 'users' => $options['criteria']['owner'], |
58 | 58 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
59 | 59 | ); |
60 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
60 | + if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
61 | 61 | $query['offset'] = 0; |
62 | 62 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
63 | 63 | } |
64 | - $events =& $this->bo->search($query); |
|
64 | + $events = & $this->bo->search($query); |
|
65 | 65 | break; |
66 | 66 | case 'search_results': |
67 | 67 | $states = Api\Cache::getSession('calendar', 'session_data'); |
68 | - if($states['view'] == 'listview') { |
|
68 | + if ($states['view'] == 'listview') { |
|
69 | 69 | $query = Api\Cache::getSession('calendar', 'calendar_list'); |
70 | - $query['num_rows'] = -1; // all |
|
71 | - $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
70 | + $query['num_rows'] = -1; // all |
|
71 | + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
72 | 72 | $query['start'] = 0; |
73 | 73 | $query['cfs'] = $cfs; |
74 | 74 | |
75 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
75 | + if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
76 | 76 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
77 | 77 | } |
78 | 78 | $ui = new calendar_uilist(); |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | $query = Api\Cache::getSession('calendar', 'session_data'); |
82 | 82 | $query['users'] = explode(',', $query['owner']); |
83 | 83 | $query['num_rows'] = -1; |
84 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
85 | - $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
84 | + if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
85 | + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $events = array(); |
89 | - switch($states['view']) { |
|
89 | + switch ($states['view']) { |
|
90 | 90 | case 'month': |
91 | 91 | $query += $this->get_query_month($states); |
92 | 92 | break; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | default: |
101 | 101 | // Let UI set the date ranges |
102 | 102 | $ui = new calendar_uiviews($query); |
103 | - if(method_exists($ui, $states['view'])) |
|
103 | + if (method_exists($ui, $states['view'])) |
|
104 | 104 | { |
105 | 105 | ob_start(); |
106 | 106 | $ui->$states['view'](); |
@@ -124,35 +124,35 @@ discard block |
||
124 | 124 | $filter = $_definition->filter; |
125 | 125 | |
126 | 126 | // Handle ranges |
127 | - foreach($filter as $field => $value) |
|
127 | + foreach ($filter as $field => $value) |
|
128 | 128 | { |
129 | - if($field == 'filter' && $value) |
|
129 | + if ($field == 'filter' && $value) |
|
130 | 130 | { |
131 | 131 | $query['filter'] = $value; |
132 | 132 | continue; |
133 | 133 | } |
134 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) |
|
134 | + if (!is_array($value) || (!$value['from'] && !$value['to'])) |
|
135 | 135 | { |
136 | 136 | $query['query']["cal_$field"] = $value; |
137 | 137 | continue; |
138 | 138 | } |
139 | 139 | |
140 | 140 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
141 | - if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
142 | - if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
141 | + if ($value['from']) $query['sql_filter'][] = "cal_$field >= ".(int)$value['from']; |
|
142 | + if ($value['to']) $query['sql_filter'][] = "cal_$field <= ".(int)$value['to']; |
|
143 | 143 | |
144 | 144 | } |
145 | - if($query['sql_filter'] && is_array($query['sql_filter'])) |
|
145 | + if ($query['sql_filter'] && is_array($query['sql_filter'])) |
|
146 | 146 | { |
147 | 147 | // Set as an extra parameter |
148 | - $sql_filter = implode(' AND ',$query['sql_filter']); |
|
148 | + $sql_filter = implode(' AND ', $query['sql_filter']); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | case 'all': |
152 | 152 | $events = $this->bo->search($query + array( |
153 | 153 | 'offset' => 0, |
154 | 154 | 'order' => 'cal_start', |
155 | - ),$sql_filter); |
|
155 | + ), $sql_filter); |
|
156 | 156 | break; |
157 | 157 | } |
158 | 158 | |
@@ -169,24 +169,24 @@ discard block |
||
169 | 169 | // Get rid of yearly recurring events that don't belong |
170 | 170 | //if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue; |
171 | 171 | // Add in participants |
172 | - if($options['mapping']['participants']) { |
|
173 | - $event['participants'] = implode(", ",$this->bo->participants($event,true)); |
|
172 | + if ($options['mapping']['participants']) { |
|
173 | + $event['participants'] = implode(", ", $this->bo->participants($event, true)); |
|
174 | 174 | } |
175 | 175 | if (is_array($event)) |
176 | 176 | { |
177 | 177 | $record->set_record($event); |
178 | - if($options['mapping']['recurrence']) { |
|
178 | + if ($options['mapping']['recurrence']) { |
|
179 | 179 | $record->recurrence = $recurrence[$record->recur_type]; |
180 | - if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval; |
|
180 | + if ($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '.$record->recur_interval; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Standard stuff |
184 | - if($options['convert']) { |
|
184 | + if ($options['convert']) { |
|
185 | 185 | importexport_export_csv::convert($record, $convert_fields, 'calendar', $this->selects); |
186 | 186 | } else { |
187 | 187 | // Implode arrays, so they don't say 'Array' |
188 | - foreach($record->get_record_array() as $key => $value) { |
|
189 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
188 | + foreach ($record->get_record_array() as $key => $value) { |
|
189 | + if (is_array($value)) $record->$key = implode(',', $value); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | $export_object->export_record($record); |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | public function get_selectors_etpl($definition = null) { |
242 | 242 | $states = $this->bo->cal_prefs['saved_states']; |
243 | 243 | $list = Api\Cache::getSession('calendar', 'calendar_list'); |
244 | - if(!$list['startdate']) |
|
244 | + if (!$list['startdate']) |
|
245 | 245 | { |
246 | - switch($states['view']) { |
|
246 | + switch ($states['view']) { |
|
247 | 247 | case 'month': |
248 | 248 | $query = $this->get_query_month($states); |
249 | 249 | break; |
@@ -255,12 +255,12 @@ discard block |
||
255 | 255 | $query = $this->get_query_day($states); |
256 | 256 | break; |
257 | 257 | } |
258 | - $start= new Api\DateTime($query['start']); |
|
258 | + $start = new Api\DateTime($query['start']); |
|
259 | 259 | $end = new Api\DateTime($query['end']); |
260 | 260 | } |
261 | 261 | else |
262 | 262 | { |
263 | - $start= new Api\DateTime($list['startdate']); |
|
263 | + $start = new Api\DateTime($list['startdate']); |
|
264 | 264 | $end = new Api\DateTime($list['enddate']); |
265 | 265 | } |
266 | 266 | if ($states['view'] == 'listview') |
@@ -269,24 +269,24 @@ discard block |
||
269 | 269 | |
270 | 270 | // Use UI to get dates |
271 | 271 | $ui = new calendar_uilist(); |
272 | - $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
273 | - $ui->get_rows($list,$rows,$readonlys); |
|
272 | + $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
273 | + $ui->get_rows($list, $rows, $readonlys); |
|
274 | 274 | $start = $ui->first ? $ui->first : new Api\DateTime($ui->date); |
275 | 275 | $end = $ui->last; |
276 | 276 | |
277 | 277 | // Special handling |
278 | - if($list['filter'] == 'all') $start = $end = null; |
|
279 | - if($list['filter'] == 'before') |
|
278 | + if ($list['filter'] == 'all') $start = $end = null; |
|
279 | + if ($list['filter'] == 'before') |
|
280 | 280 | { |
281 | 281 | $end = $start; |
282 | 282 | $start = null; |
283 | 283 | } |
284 | 284 | $ui = null; |
285 | 285 | } |
286 | - elseif(!$end) |
|
286 | + elseif (!$end) |
|
287 | 287 | { |
288 | - $end = '+1 ' . $states['view']; |
|
289 | - $end = strtotime($end, $start->format('ts'))-1; |
|
288 | + $end = '+1 '.$states['view']; |
|
289 | + $end = strtotime($end, $start->format('ts')) - 1; |
|
290 | 290 | } |
291 | 291 | $prefs = unserialize($GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]); |
292 | 292 | $data = array( |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | public static function get_query_month($states) |
312 | 312 | { |
313 | 313 | $timespan = array( |
314 | - 'start' => mktime(0,0,0,$states['month'],1,$states['year']), |
|
315 | - 'end' => mktime(0,0,0,$states['month']+1,1,$states['year'])-1 |
|
314 | + 'start' => mktime(0, 0, 0, $states['month'], 1, $states['year']), |
|
315 | + 'end' => mktime(0, 0, 0, $states['month'] + 1, 1, $states['year']) - 1 |
|
316 | 316 | ); |
317 | 317 | return $timespan; |
318 | 318 | } |
@@ -330,24 +330,24 @@ discard block |
||
330 | 330 | if ($states['view'] == 'week' && $days == 4) // next 4 days view |
331 | 331 | { |
332 | 332 | $query['start'] = $this->bo->date2ts($states['date']); |
333 | - $query['end'] = strtotime("+$days days",$query['start']) - 1; |
|
333 | + $query['end'] = strtotime("+$days days", $query['start']) - 1; |
|
334 | 334 | } |
335 | 335 | else |
336 | 336 | { |
337 | - $query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']); |
|
337 | + $query['start'] = $ui->datetime->get_weekday_start($states['year'], $states['month'], $states['day']); |
|
338 | 338 | if ($days == 5) // no weekend-days |
339 | 339 | { |
340 | - switch($ui->cal_prefs['weekdaystarts']) |
|
340 | + switch ($ui->cal_prefs['weekdaystarts']) |
|
341 | 341 | { |
342 | 342 | case 'Saturday': |
343 | - $query['start'] = strtotime("+2 days",$query['start']); |
|
343 | + $query['start'] = strtotime("+2 days", $query['start']); |
|
344 | 344 | break; |
345 | 345 | case 'Sunday': |
346 | - $query['start'] = strtotime("+1 day",$query['start']); |
|
346 | + $query['start'] = strtotime("+1 day", $query['start']); |
|
347 | 347 | break; |
348 | 348 | } |
349 | 349 | } |
350 | - $query['end'] = strtotime($states['view'] == 'week' ? "+$days days" : "+{$ui->cal_prefs['multiple_weeks']} weeks",$query['start']) - 1; |
|
350 | + $query['end'] = strtotime($states['view'] == 'week' ? "+$days days" : "+{$ui->cal_prefs['multiple_weeks']} weeks", $query['start']) - 1; |
|
351 | 351 | } |
352 | 352 | return $query; |
353 | 353 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $query = array(); |
358 | 358 | $bo = new calendar_bo(); |
359 | 359 | $query['start'] = $bo->date2ts((string)$states['date']); |
360 | - $query['end'] = $query['start']+DAY_s-1; |
|
360 | + $query['end'] = $query['start'] + DAY_s - 1; |
|
361 | 361 | return $query; |
362 | 362 | } |
363 | 363 | |
@@ -409,17 +409,17 @@ discard block |
||
409 | 409 | ); |
410 | 410 | $filters = array_reverse($filters, true); |
411 | 411 | |
412 | - foreach($filters as $field_name => &$settings) |
|
412 | + foreach ($filters as $field_name => &$settings) |
|
413 | 413 | { |
414 | 414 | // Can't filter on a custom field |
415 | - if(strpos($field_name, '#') === 0) |
|
415 | + if (strpos($field_name, '#') === 0) |
|
416 | 416 | { |
417 | 417 | unset($filters[$field_name]); |
418 | 418 | continue; |
419 | 419 | } |
420 | 420 | |
421 | 421 | // Pass on select options |
422 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
422 | + if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Exports records as defined in $_definition |
31 | 31 | * |
32 | - * @param egw_record $_definition |
|
32 | + * @param importexport_definition $_definition |
|
33 | 33 | */ |
34 | 34 | public function export( $_stream, importexport_definition $_definition) { |
35 | 35 | $options = $_definition->plugin_options; |
@@ -16,9 +16,11 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * export CSV plugin of calendar |
18 | 18 | */ |
19 | -class calendar_export_csv implements importexport_iface_export_plugin { |
|
19 | +class calendar_export_csv implements importexport_iface_export_plugin |
|
20 | +{ |
|
20 | 21 | |
21 | - public function __construct() { |
|
22 | + public function __construct() |
|
23 | + { |
|
22 | 24 | Api\Translation::add_app('calendar'); |
23 | 25 | $this->bo = new calendar_bo(); |
24 | 26 | $this->get_selects(); |
@@ -29,15 +31,23 @@ discard block |
||
29 | 31 | * |
30 | 32 | * @param egw_record $_definition |
31 | 33 | */ |
32 | - public function export( $_stream, importexport_definition $_definition) { |
|
34 | + public function export( $_stream, importexport_definition $_definition) |
|
35 | + { |
|
33 | 36 | $options = $_definition->plugin_options; |
34 | 37 | |
35 | 38 | $limit_exception = Api\Storage\Merge::is_export_limit_excepted(); |
36 | - if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
|
39 | + if (!$limit_exception) |
|
40 | + { |
|
41 | + $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
|
42 | + } |
|
37 | 43 | // Custom fields need to be specifically requested |
38 | 44 | $cfs = array(); |
39 | - foreach($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
40 | - if($key[0] == '#') $cfs[] = substr($key,1); |
|
45 | + foreach($options['mapping'] + (array)$_definition->filter as $key => $label) |
|
46 | + { |
|
47 | + if($key[0] == '#') |
|
48 | + { |
|
49 | + $cfs[] = substr($key,1); |
|
50 | + } |
|
41 | 51 | } |
42 | 52 | |
43 | 53 | $query = array( |
@@ -57,7 +67,8 @@ discard block |
||
57 | 67 | 'users' => $options['criteria']['owner'], |
58 | 68 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
59 | 69 | ); |
60 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
70 | + if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
71 | + { |
|
61 | 72 | $query['offset'] = 0; |
62 | 73 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
63 | 74 | } |
@@ -65,28 +76,34 @@ discard block |
||
65 | 76 | break; |
66 | 77 | case 'search_results': |
67 | 78 | $states = Api\Cache::getSession('calendar', 'session_data'); |
68 | - if($states['view'] == 'listview') { |
|
79 | + if($states['view'] == 'listview') |
|
80 | + { |
|
69 | 81 | $query = Api\Cache::getSession('calendar', 'calendar_list'); |
70 | 82 | $query['num_rows'] = -1; // all |
71 | 83 | $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
72 | 84 | $query['start'] = 0; |
73 | 85 | $query['cfs'] = $cfs; |
74 | 86 | |
75 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
87 | + if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
88 | + { |
|
76 | 89 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
77 | 90 | } |
78 | 91 | $ui = new calendar_uilist(); |
79 | 92 | $ui->get_rows($query, $events, $unused); |
80 | - } else { |
|
93 | + } |
|
94 | + else |
|
95 | + { |
|
81 | 96 | $query = Api\Cache::getSession('calendar', 'session_data'); |
82 | 97 | $query['users'] = explode(',', $query['owner']); |
83 | 98 | $query['num_rows'] = -1; |
84 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
99 | + if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
100 | + { |
|
85 | 101 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
86 | 102 | } |
87 | 103 | |
88 | 104 | $events = array(); |
89 | - switch($states['view']) { |
|
105 | + switch($states['view']) |
|
106 | + { |
|
90 | 107 | case 'month': |
91 | 108 | $query += $this->get_query_month($states); |
92 | 109 | break; |
@@ -138,8 +155,14 @@ discard block |
||
138 | 155 | } |
139 | 156 | |
140 | 157 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
141 | - if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
142 | - if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
158 | + if($value['from']) |
|
159 | + { |
|
160 | + $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
161 | + } |
|
162 | + if($value['to']) |
|
163 | + { |
|
164 | + $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
165 | + } |
|
143 | 166 | |
144 | 167 | } |
145 | 168 | if($query['sql_filter'] && is_array($query['sql_filter'])) |
@@ -157,36 +180,52 @@ discard block |
||
157 | 180 | } |
158 | 181 | |
159 | 182 | $export_object = new importexport_export_csv($_stream, (array)$options); |
160 | - if (!$limit_exception) $export_object->export_limit = $export_limit; |
|
183 | + if (!$limit_exception) |
|
184 | + { |
|
185 | + $export_object->export_limit = $export_limit; |
|
186 | + } |
|
161 | 187 | $export_object->set_mapping($options['mapping']); |
162 | 188 | $convert_fields = calendar_egw_record::$types; |
163 | 189 | |
164 | 190 | $recurrence = $this->bo->recur_types; |
165 | 191 | |
166 | 192 | $record = new calendar_egw_record(); |
167 | - foreach ($events as $event) { |
|
193 | + foreach ($events as $event) |
|
194 | + { |
|
168 | 195 | // the condition below (2 lines) may only work on enum_recuring=false and using the iterator to test an recurring event on the given timerange |
169 | 196 | // Get rid of yearly recurring events that don't belong |
170 | 197 | //if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue; |
171 | 198 | // Add in participants |
172 | - if($options['mapping']['participants']) { |
|
199 | + if($options['mapping']['participants']) |
|
200 | + { |
|
173 | 201 | $event['participants'] = implode(", ",$this->bo->participants($event,true)); |
174 | 202 | } |
175 | 203 | if (is_array($event)) |
176 | 204 | { |
177 | 205 | $record->set_record($event); |
178 | - if($options['mapping']['recurrence']) { |
|
206 | + if($options['mapping']['recurrence']) |
|
207 | + { |
|
179 | 208 | $record->recurrence = $recurrence[$record->recur_type]; |
180 | - if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval; |
|
209 | + if($record->recur_type != MCAL_RECUR_NONE) |
|
210 | + { |
|
211 | + $record->recurrence .= ' / '. $record->recur_interval; |
|
212 | + } |
|
181 | 213 | } |
182 | 214 | |
183 | 215 | // Standard stuff |
184 | - if($options['convert']) { |
|
216 | + if($options['convert']) |
|
217 | + { |
|
185 | 218 | importexport_export_csv::convert($record, $convert_fields, 'calendar', $this->selects); |
186 | - } else { |
|
219 | + } |
|
220 | + else |
|
221 | + { |
|
187 | 222 | // Implode arrays, so they don't say 'Array' |
188 | - foreach($record->get_record_array() as $key => $value) { |
|
189 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
223 | + foreach($record->get_record_array() as $key => $value) |
|
224 | + { |
|
225 | + if(is_array($value)) |
|
226 | + { |
|
227 | + $record->$key = implode(',', $value); |
|
228 | + } |
|
190 | 229 | } |
191 | 230 | } |
192 | 231 | $export_object->export_record($record); |
@@ -201,7 +240,8 @@ discard block |
||
201 | 240 | * |
202 | 241 | * @return string name |
203 | 242 | */ |
204 | - public static function get_name() { |
|
243 | + public static function get_name() |
|
244 | + { |
|
205 | 245 | return lang('Calendar CSV export'); |
206 | 246 | } |
207 | 247 | |
@@ -210,7 +250,8 @@ discard block |
||
210 | 250 | * |
211 | 251 | * @return string descriprion |
212 | 252 | */ |
213 | - public static function get_description() { |
|
253 | + public static function get_description() |
|
254 | + { |
|
214 | 255 | return lang("Exports events from your Calendar into a CSV File."); |
215 | 256 | } |
216 | 257 | |
@@ -219,11 +260,13 @@ discard block |
||
219 | 260 | * |
220 | 261 | * @return string suffix |
221 | 262 | */ |
222 | - public static function get_filesuffix() { |
|
263 | + public static function get_filesuffix() |
|
264 | + { |
|
223 | 265 | return 'csv'; |
224 | 266 | } |
225 | 267 | |
226 | - public static function get_mimetype() { |
|
268 | + public static function get_mimetype() |
|
269 | + { |
|
227 | 270 | return 'text/csv'; |
228 | 271 | } |
229 | 272 | |
@@ -231,19 +274,22 @@ discard block |
||
231 | 274 | * return html for options. |
232 | 275 | * |
233 | 276 | */ |
234 | - public function get_options_etpl($definition = null) { |
|
277 | + public function get_options_etpl($definition = null) |
|
278 | + { |
|
235 | 279 | } |
236 | 280 | |
237 | 281 | /** |
238 | 282 | * returns selectors of this plugin |
239 | 283 | * |
240 | 284 | */ |
241 | - public function get_selectors_etpl($definition = null) { |
|
285 | + public function get_selectors_etpl($definition = null) |
|
286 | + { |
|
242 | 287 | $states = $this->bo->cal_prefs['saved_states']; |
243 | 288 | $list = Api\Cache::getSession('calendar', 'calendar_list'); |
244 | 289 | if(!$list['startdate']) |
245 | 290 | { |
246 | - switch($states['view']) { |
|
291 | + switch($states['view']) |
|
292 | + { |
|
247 | 293 | case 'month': |
248 | 294 | $query = $this->get_query_month($states); |
249 | 295 | break; |
@@ -275,7 +321,10 @@ discard block |
||
275 | 321 | $end = $ui->last; |
276 | 322 | |
277 | 323 | // Special handling |
278 | - if($list['filter'] == 'all') $start = $end = null; |
|
324 | + if($list['filter'] == 'all') |
|
325 | + { |
|
326 | + $start = $end = null; |
|
327 | + } |
|
279 | 328 | if($list['filter'] == 'before') |
280 | 329 | { |
281 | 330 | $end = $start; |
@@ -323,24 +372,33 @@ discard block |
||
323 | 372 | $days = $states['days']; |
324 | 373 | $ui = new calendar_uiviews($states); |
325 | 374 | if (!$days) |
326 | - { |
|
375 | + { |
|
327 | 376 | $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview']; |
328 | - if ($days != 5) $days = 7; |
|
377 | + if ($days != 5) |
|
378 | + { |
|
379 | + $days = 7; |
|
380 | + } |
|
329 | 381 | } |
330 | - if ($states['view'] == 'week' && $days == 4) // next 4 days view |
|
382 | + if ($states['view'] == 'week' && $days == 4) |
|
383 | + { |
|
384 | + // next 4 days view |
|
331 | 385 | { |
332 | 386 | $query['start'] = $this->bo->date2ts($states['date']); |
387 | + } |
|
333 | 388 | $query['end'] = strtotime("+$days days",$query['start']) - 1; |
334 | 389 | } |
335 | 390 | else |
336 | 391 | { |
337 | 392 | $query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']); |
338 | - if ($days == 5) // no weekend-days |
|
393 | + if ($days == 5) |
|
394 | + { |
|
395 | + // no weekend-days |
|
339 | 396 | { |
340 | 397 | switch($ui->cal_prefs['weekdaystarts']) |
341 | 398 | { |
342 | 399 | case 'Saturday': |
343 | 400 | $query['start'] = strtotime("+2 days",$query['start']); |
401 | + } |
|
344 | 402 | break; |
345 | 403 | case 'Sunday': |
346 | 404 | $query['start'] = strtotime("+1 day",$query['start']); |
@@ -419,7 +477,10 @@ discard block |
||
419 | 477 | } |
420 | 478 | |
421 | 479 | // Pass on select options |
422 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
480 | + if($this->selects[$field_name]) |
|
481 | + { |
|
482 | + $settings['values'] = $this->selects[$field_name]; |
|
483 | + } |
|
423 | 484 | } |
424 | 485 | |
425 | 486 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | protected function get_selects() |
368 | 368 | { |
369 | - $this->selects['priority'] = Array( |
|
369 | + $this->selects['priority'] = array( |
|
370 | 370 | 0 => lang('None'), |
371 | 371 | 1 => lang('Low'), |
372 | 372 | 2 => lang('Normal'), |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | /** |
395 | 395 | * Adjust automatically generated field filters |
396 | 396 | */ |
397 | - public function get_filter_fields(Array &$filters) |
|
397 | + public function get_filter_fields(array &$filters) |
|
398 | 398 | { |
399 | 399 | |
400 | 400 | // Calendar SO doesn't support filtering by column, so we have to remove pretty much everything |
@@ -71,25 +71,25 @@ discard block |
||
71 | 71 | $this->locales[] = $this->locale; |
72 | 72 | } |
73 | 73 | |
74 | - if($this->debug) |
|
74 | + if ($this->debug) |
|
75 | 75 | { |
76 | 76 | echo '<-- Locale = '.$this->locales[0].' -->'."\n"; |
77 | 77 | } |
78 | 78 | |
79 | - $this->total = $this->so->holiday_total($this->locales[0],$this->query,$this->year); |
|
79 | + $this->total = $this->so->holiday_total($this->locales[0], $this->query, $this->year); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /* Begin Calendar functions */ |
83 | - function read_entry($id=0) |
|
83 | + function read_entry($id = 0) |
|
84 | 84 | { |
85 | - if($this->debug) |
|
85 | + if ($this->debug) |
|
86 | 86 | { |
87 | 87 | echo "BO : Reading Holiday ID : ".$id."<br>\n"; |
88 | 88 | } |
89 | 89 | |
90 | - if(!$id) |
|
90 | + if (!$id) |
|
91 | 91 | { |
92 | - if(!$this->id) |
|
92 | + if (!$this->id) |
|
93 | 93 | { |
94 | 94 | return Array(); |
95 | 95 | } |
@@ -102,18 +102,18 @@ discard block |
||
102 | 102 | return $this->so->read_holiday($id); |
103 | 103 | } |
104 | 104 | |
105 | - function delete_holiday($id=0) |
|
105 | + function delete_holiday($id = 0) |
|
106 | 106 | { |
107 | - if(!$id) |
|
107 | + if (!$id) |
|
108 | 108 | { |
109 | - if($this->id) |
|
109 | + if ($this->id) |
|
110 | 110 | { |
111 | 111 | $id = $this->id; |
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - $this->ui =& CreateObject('calendar.uiholiday'); |
|
116 | - if($id) |
|
115 | + $this->ui = & CreateObject('calendar.uiholiday'); |
|
116 | + if ($id) |
|
117 | 117 | { |
118 | 118 | $this->so->delete_holiday($id); |
119 | 119 | $this->ui->edit_locale(); |
@@ -124,45 +124,45 @@ discard block |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - function delete_locale($locale='') |
|
127 | + function delete_locale($locale = '') |
|
128 | 128 | { |
129 | - if(!$locale) |
|
129 | + if (!$locale) |
|
130 | 130 | { |
131 | - if($this->locales[0]) |
|
131 | + if ($this->locales[0]) |
|
132 | 132 | { |
133 | 133 | $locale = $this->locales[0]; |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | - if($locale) |
|
137 | + if ($locale) |
|
138 | 138 | { |
139 | 139 | $this->so->delete_locale($locale); |
140 | 140 | } |
141 | - $this->ui =& CreateObject('calendar.uiholiday'); |
|
141 | + $this->ui = & CreateObject('calendar.uiholiday'); |
|
142 | 142 | $this->ui->admin(); |
143 | 143 | } |
144 | 144 | |
145 | 145 | function accept_holiday() |
146 | 146 | { |
147 | - $send_back_to = str_replace('submitlocale','holiday_admin',$_SERVER['HTTP_REFERER']); |
|
148 | - if(!@$this->locales[0]) |
|
147 | + $send_back_to = str_replace('submitlocale', 'holiday_admin', $_SERVER['HTTP_REFERER']); |
|
148 | + if (!@$this->locales[0]) |
|
149 | 149 | { |
150 | 150 | Header('Location: '.$send_back_to); |
151 | 151 | } |
152 | 152 | |
153 | - $send_back_to = str_replace('&locale='.$this->locales[0],'',$send_back_to); |
|
153 | + $send_back_to = str_replace('&locale='.$this->locales[0], '', $send_back_to); |
|
154 | 154 | $file = './holidays.'.$this->locales[0]; |
155 | - if(!file_exists($file) && count($_POST['name'])) |
|
155 | + if (!file_exists($file) && count($_POST['name'])) |
|
156 | 156 | { |
157 | - $fp = fopen($file,'w'); |
|
158 | - fwrite($fp,"charset\t".Api\Translation::charset()."\n"); |
|
157 | + $fp = fopen($file, 'w'); |
|
158 | + fwrite($fp, "charset\t".Api\Translation::charset()."\n"); |
|
159 | 159 | |
160 | 160 | $holidays = array(); |
161 | - foreach($_POST['name'] as $i => $name) |
|
161 | + foreach ($_POST['name'] as $i => $name) |
|
162 | 162 | { |
163 | 163 | $holiday = array( |
164 | 164 | 'locale' => $_POST['locale'], |
165 | - 'name' => str_replace('\\','',$name), |
|
165 | + 'name' => str_replace('\\', '', $name), |
|
166 | 166 | 'day' => $_POST['day'][$i], |
167 | 167 | 'month' => $_POST['month'][$i], |
168 | 168 | 'occurence' => $_POST['occurence'][$i], |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | ); |
172 | 172 | } |
173 | 173 | // sort holidays by year / occurence: |
174 | - usort($holidays,'_holiday_cmp'); |
|
174 | + usort($holidays, '_holiday_cmp'); |
|
175 | 175 | |
176 | 176 | $last_year = -1; |
177 | - foreach($holidays as $holiday) |
|
177 | + foreach ($holidays as $holiday) |
|
178 | 178 | { |
179 | 179 | $year = $holiday['occurence'] <= 0 ? 0 : $holiday['occurence']; |
180 | 180 | if ($year != $last_year) |
@@ -182,46 +182,46 @@ discard block |
||
182 | 182 | echo "\n".($year ? $year : 'regular (year=0)').":\n"; |
183 | 183 | $last_year = $year; |
184 | 184 | } |
185 | - fwrite($fp,"$holiday[locale]\t$holiday[name]\t$holiday[day]\t$holiday[month]\t$holiday[occurence]\t$holiday[dow]\t$holiday[observance_rule]\n"); |
|
185 | + fwrite($fp, "$holiday[locale]\t$holiday[name]\t$holiday[day]\t$holiday[month]\t$holiday[occurence]\t$holiday[dow]\t$holiday[observance_rule]\n"); |
|
186 | 186 | } |
187 | 187 | fclose($fp); |
188 | 188 | } |
189 | 189 | Header('Location: '.$send_back_to); |
190 | 190 | } |
191 | 191 | |
192 | - function get_holiday_list($locale='', $sort='', $order='', $query='', $total='', $year=0) |
|
192 | + function get_holiday_list($locale = '', $sort = '', $order = '', $query = '', $total = '', $year = 0) |
|
193 | 193 | { |
194 | - $locale = ($locale?$locale:$this->locales[0]); |
|
195 | - $sort = ($sort?$sort:$this->sort); |
|
196 | - $order = ($order?$order:$this->order); |
|
197 | - $query = ($query?$query:$this->query); |
|
198 | - $year = ($$year?$$year:$this->year); |
|
199 | - return $this->so->read_holidays($locale,$query,$order,$year); |
|
194 | + $locale = ($locale ? $locale : $this->locales[0]); |
|
195 | + $sort = ($sort ? $sort : $this->sort); |
|
196 | + $order = ($order ? $order : $this->order); |
|
197 | + $query = ($query ? $query : $this->query); |
|
198 | + $year = ($$year ? $$year : $this->year); |
|
199 | + return $this->so->read_holidays($locale, $query, $order, $year); |
|
200 | 200 | } |
201 | 201 | |
202 | - function get_locale_list($sort='', $order='', $query='') |
|
202 | + function get_locale_list($sort = '', $order = '', $query = '') |
|
203 | 203 | { |
204 | - $sort = ($sort?$sort:$this->sort); |
|
205 | - $order = ($order?$order:$this->order); |
|
206 | - $query = ($query?$query:$this->query); |
|
207 | - return $this->so->get_locale_list($sort,$order,$query); |
|
204 | + $sort = ($sort ? $sort : $this->sort); |
|
205 | + $order = ($order ? $order : $this->order); |
|
206 | + $query = ($query ? $query : $this->query); |
|
207 | + return $this->so->get_locale_list($sort, $order, $query); |
|
208 | 208 | } |
209 | 209 | |
210 | - function prepare_read_holidays($year=0,$owner=0) |
|
210 | + function prepare_read_holidays($year = 0, $owner = 0) |
|
211 | 211 | { |
212 | - $this->year = (isset($year) && $year > 0?$year: Api\DateTime::to(time() - $GLOBALS['egw']->datetime->tz_offset,'Y')); |
|
213 | - $this->owner = ($owner?$owner:$GLOBALS['egw_info']['user']['account_id']); |
|
212 | + $this->year = (isset($year) && $year > 0 ? $year : Api\DateTime::to(time() - $GLOBALS['egw']->datetime->tz_offset, 'Y')); |
|
213 | + $this->owner = ($owner ? $owner : $GLOBALS['egw_info']['user']['account_id']); |
|
214 | 214 | |
215 | - if($this->debug) |
|
215 | + if ($this->debug) |
|
216 | 216 | { |
217 | 217 | echo 'Setting Year to : '.$this->year.'<br>'."\n"; |
218 | 218 | } |
219 | 219 | |
220 | - if(@$GLOBALS['egw_info']['user']['preferences']['common']['country']) |
|
220 | + if (@$GLOBALS['egw_info']['user']['preferences']['common']['country']) |
|
221 | 221 | { |
222 | 222 | $this->locales[] = $GLOBALS['egw_info']['user']['preferences']['common']['country']; |
223 | 223 | } |
224 | - elseif(@$GLOBALS['egw_info']['user']['preferences']['calendar']['locale']) |
|
224 | + elseif (@$GLOBALS['egw_info']['user']['preferences']['calendar']['locale']) |
|
225 | 225 | { |
226 | 226 | $this->locales[] = $GLOBALS['egw_info']['user']['preferences']['calendar']['locale']; |
227 | 227 | } |
@@ -230,45 +230,45 @@ discard block |
||
230 | 230 | $this->locales[] = 'US'; |
231 | 231 | } |
232 | 232 | |
233 | - if($this->owner != $GLOBALS['egw_info']['user']['account_id']) |
|
233 | + if ($this->owner != $GLOBALS['egw_info']['user']['account_id']) |
|
234 | 234 | { |
235 | 235 | $owner_pref = new Api\Preferences($owner); |
236 | 236 | $owner_prefs = $owner_pref->read_repository(); |
237 | - if(@$owner_prefs['common']['country']) |
|
237 | + if (@$owner_prefs['common']['country']) |
|
238 | 238 | { |
239 | 239 | $this->locales[] = $owner_prefs['common']['country']; |
240 | 240 | } |
241 | - elseif(@$owner_prefs['calendar']['locale']) |
|
241 | + elseif (@$owner_prefs['calendar']['locale']) |
|
242 | 242 | { |
243 | 243 | $this->locales[] = $owner_prefs['calendar']['locale']; |
244 | 244 | } |
245 | 245 | unset($owner_pref); |
246 | 246 | } |
247 | 247 | |
248 | - if($GLOBALS['egw_info']['server']['auto_load_holidays'] == True && $this->locales) |
|
248 | + if ($GLOBALS['egw_info']['server']['auto_load_holidays'] == True && $this->locales) |
|
249 | 249 | { |
250 | - foreach($this->locales as $local) |
|
250 | + foreach ($this->locales as $local) |
|
251 | 251 | { |
252 | 252 | $this->auto_load_holidays($local, $year); |
253 | 253 | } |
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | - function auto_load_holidays($locale, $year=0) |
|
257 | + function auto_load_holidays($locale, $year = 0) |
|
258 | 258 | { |
259 | 259 | //error_log(__METHOD__."('$locale', $year)"); |
260 | - if (!Api\Cache::getInstance(__CLASS__, $locale.'-'.$year) && // check if autoload has been tried for this locale and year |
|
260 | + if (!Api\Cache::getInstance(__CLASS__, $locale.'-'.$year) && // check if autoload has been tried for this locale and year |
|
261 | 261 | (!($total_year = $this->so->holiday_total($locale, '', $year)) || |
262 | 262 | // automatic try load new holidays, if there are no irregular ones for queried year |
263 | 263 | $total_year == $this->so->holiday_total($locale, '', 1901))) |
264 | 264 | { |
265 | 265 | //error_log(__METHOD__."('$locale', $year) attemption autoload ..."); |
266 | - Api\Cache::setInstance(__CLASS__, $locale.'-'.$year, true, 864000); // do NOT try again for 10 days |
|
266 | + Api\Cache::setInstance(__CLASS__, $locale.'-'.$year, true, 864000); // do NOT try again for 10 days |
|
267 | 267 | @set_time_limit(0); |
268 | 268 | |
269 | 269 | /* get the file that contains the calendar events for your locale */ |
270 | 270 | /* "http://www.egroupware.org/cal/holidays.US.csv"; */ |
271 | - if(isset($GLOBALS['egw_info']['server']['holidays_url_path']) && $GLOBALS['egw_info']['server']['holidays_url_path'] != 'localhost') |
|
271 | + if (isset($GLOBALS['egw_info']['server']['holidays_url_path']) && $GLOBALS['egw_info']['server']['holidays_url_path'] != 'localhost') |
|
272 | 272 | { |
273 | 273 | $load_from = $GLOBALS['egw_info']['server']['holidays_url_path']; |
274 | 274 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | { |
277 | 277 | if ($GLOBALS['egw_info']['server']['webserver_url'][0] == '/') |
278 | 278 | { |
279 | - $server_host = ($_SERVER['HTTPS']?'https://':'http://').$_SERVER['HTTP_HOST'].$GLOBALS['egw_info']['server']['webserver_url']; |
|
279 | + $server_host = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$GLOBALS['egw_info']['server']['webserver_url']; |
|
280 | 280 | } |
281 | 281 | else |
282 | 282 | { |
@@ -285,13 +285,13 @@ discard block |
||
285 | 285 | $load_from = $server_host.'/calendar/egroupware.org'; |
286 | 286 | } |
287 | 287 | // echo 'Loading from: '.$load_from.'/holidays.'.strtoupper($locale).'.csv'."<br>\n"; |
288 | - if($GLOBALS['egw_info']['server']['holidays_url_path'] == 'localhost') |
|
288 | + if ($GLOBALS['egw_info']['server']['holidays_url_path'] == 'localhost') |
|
289 | 289 | { |
290 | 290 | $lines = file(EGW_SERVER_ROOT.'/calendar/egroupware.org/holidays.'.strtoupper($locale).'.csv'); |
291 | 291 | } |
292 | 292 | else |
293 | 293 | { |
294 | - $lines = file($url=$load_from.'/holidays.'.strtoupper($locale).'.csv', 0, Framework::proxy_context()); |
|
294 | + $lines = file($url = $load_from.'/holidays.'.strtoupper($locale).'.csv', 0, Framework::proxy_context()); |
|
295 | 295 | //error_log(__METHOD__."('$locale', $year) file('$url')=".array2string($lines)); |
296 | 296 | } |
297 | 297 | if (!$lines) |
@@ -299,21 +299,21 @@ discard block |
||
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | // reading the holidayfile from egroupware.org via network::gethttpsocketfile contains all the headers! |
302 | - foreach($lines as $line) |
|
302 | + foreach ($lines as $line) |
|
303 | 303 | { |
304 | - $fields = preg_split("/[\t\n ]+/",$line); |
|
304 | + $fields = preg_split("/[\t\n ]+/", $line); |
|
305 | 305 | |
306 | 306 | if ($fields[0] == 'charset' && $fields[1]) |
307 | 307 | { |
308 | - $lines = Api\Translation::convert($lines,$fields[1]); |
|
308 | + $lines = Api\Translation::convert($lines, $fields[1]); |
|
309 | 309 | break; |
310 | 310 | } |
311 | 311 | } |
312 | 312 | foreach ($lines as $line) |
313 | 313 | { |
314 | 314 | // echo 'Line #'.$i.' : '.$lines[$i]."<br>\n"; |
315 | - $holiday = explode("\t",$line); |
|
316 | - if(count($holiday) == 7) |
|
315 | + $holiday = explode("\t", $line); |
|
316 | + if (count($holiday) == 7) |
|
317 | 317 | { |
318 | 318 | $holiday['locale'] = $holiday[0]; |
319 | 319 | $holiday['name'] = $GLOBALS['egw']->db->db_addslashes($holiday[1]); |
@@ -336,23 +336,23 @@ discard block |
||
336 | 336 | |
337 | 337 | function add() |
338 | 338 | { |
339 | - if(@$_POST['submit']) |
|
339 | + if (@$_POST['submit']) |
|
340 | 340 | { |
341 | 341 | $holiday = $_POST['holiday']; |
342 | 342 | |
343 | - if(empty($holiday['mday'])) |
|
343 | + if (empty($holiday['mday'])) |
|
344 | 344 | { |
345 | 345 | $holiday['mday'] = 0; |
346 | 346 | } |
347 | - if(!isset($this->bo->locales[0]) || $this->bo->locales[0]=='') |
|
347 | + if (!isset($this->bo->locales[0]) || $this->bo->locales[0] == '') |
|
348 | 348 | { |
349 | 349 | $this->bo->locales[0] = $holiday['locale']; |
350 | 350 | } |
351 | - elseif(!isset($holiday['locale']) || $holiday['locale']=='') |
|
351 | + elseif (!isset($holiday['locale']) || $holiday['locale'] == '') |
|
352 | 352 | { |
353 | 353 | $holiday['locale'] = $this->bo->locales[0]; |
354 | 354 | } |
355 | - if(!isset($holiday['hol_id'])) |
|
355 | + if (!isset($holiday['hol_id'])) |
|
356 | 356 | { |
357 | 357 | $holiday['hol_id'] = $this->bo->id; |
358 | 358 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | { |
364 | 364 | $errors[] = lang('You need to set either a day or a occurence !!!'); |
365 | 365 | } |
366 | - if($holiday['year'] && $holiday['occurence']) |
|
366 | + if ($holiday['year'] && $holiday['occurence']) |
|
367 | 367 | { |
368 | 368 | $errors[] = lang('You can only set a year or a occurence !!!'); |
369 | 369 | } |
@@ -375,13 +375,13 @@ discard block |
||
375 | 375 | |
376 | 376 | // Still need to put some validation in here..... |
377 | 377 | |
378 | - $this->ui =& CreateObject('calendar.uiholiday'); |
|
378 | + $this->ui = & CreateObject('calendar.uiholiday'); |
|
379 | 379 | |
380 | 380 | if (is_array($errors)) |
381 | 381 | { |
382 | 382 | $holiday['month'] = $holiday['month_num']; |
383 | 383 | $holiday['day'] = $holiday['mday']; |
384 | - $this->ui->edit_holiday($errors,$holiday); |
|
384 | + $this->ui->edit_holiday($errors, $holiday); |
|
385 | 385 | } |
386 | 386 | else |
387 | 387 | { |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | function sort_holidays_by_date($holidays) |
395 | 395 | { |
396 | 396 | $c_holidays = count($holidays); |
397 | - for($outer_loop=0;$outer_loop<($c_holidays - 1);$outer_loop++) |
|
397 | + for ($outer_loop = 0; $outer_loop < ($c_holidays - 1); $outer_loop++) |
|
398 | 398 | { |
399 | - for($inner_loop=$outer_loop;$inner_loop<$c_holidays;$inner_loop++) |
|
399 | + for ($inner_loop = $outer_loop; $inner_loop < $c_holidays; $inner_loop++) |
|
400 | 400 | { |
401 | - if($holidays[$outer_loop]['date'] > $holidays[$inner_loop]['date']) |
|
401 | + if ($holidays[$outer_loop]['date'] > $holidays[$inner_loop]['date']) |
|
402 | 402 | { |
403 | 403 | $temp = $holidays[$inner_loop]; |
404 | 404 | $holidays[$inner_loop] = $holidays[$outer_loop]; |
@@ -412,38 +412,38 @@ discard block |
||
412 | 412 | function set_holidays_to_date($holidays) |
413 | 413 | { |
414 | 414 | $new_holidays = Array(); |
415 | - for($i=0;$i<count($holidays);$i++) |
|
415 | + for ($i = 0; $i < count($holidays); $i++) |
|
416 | 416 | { |
417 | 417 | // echo "Setting Holidays Date : ".date('Ymd',$holidays[$i]['date'])."<br>\n"; |
418 | - $new_holidays[date('Ymd',$holidays[$i]['date'])][] = $holidays[$i]; |
|
418 | + $new_holidays[date('Ymd', $holidays[$i]['date'])][] = $holidays[$i]; |
|
419 | 419 | } |
420 | 420 | return $new_holidays; |
421 | 421 | } |
422 | 422 | |
423 | 423 | function read_holiday() |
424 | 424 | { |
425 | - if(isset($this->cached_holidays)) |
|
425 | + if (isset($this->cached_holidays)) |
|
426 | 426 | { |
427 | 427 | return $this->cached_holidays; |
428 | 428 | } |
429 | - $holidays = $this->so->read_holidays($this->locales,'','',$this->year); |
|
429 | + $holidays = $this->so->read_holidays($this->locales, '', '', $this->year); |
|
430 | 430 | |
431 | - if(count($holidays) == 0) |
|
431 | + if (count($holidays) == 0) |
|
432 | 432 | { |
433 | 433 | return $holidays; |
434 | 434 | } |
435 | 435 | |
436 | 436 | $temp_locale = $GLOBALS['egw_info']['user']['preferences']['common']['country']; |
437 | - foreach($holidays as $i => $holiday) |
|
437 | + foreach ($holidays as $i => $holiday) |
|
438 | 438 | { |
439 | - if($i == 0 || $holidays[$i]['locale'] != $holidays[$i - 1]['locale']) |
|
439 | + if ($i == 0 || $holidays[$i]['locale'] != $holidays[$i - 1]['locale']) |
|
440 | 440 | { |
441 | - if(is_object($holidaycalc)) |
|
441 | + if (is_object($holidaycalc)) |
|
442 | 442 | { |
443 | 443 | unset($holidaycalc); |
444 | 444 | } |
445 | 445 | $GLOBALS['egw_info']['user']['preferences']['common']['country'] = $holidays[$i]['locale']; |
446 | - $holidaycalc =& CreateObject('calendar.holidaycalc'); |
|
446 | + $holidaycalc = & CreateObject('calendar.holidaycalc'); |
|
447 | 447 | } |
448 | 448 | $holidays[$i]['date'] = $holidaycalc->calculate_date($holiday, $holidays, $this->year); |
449 | 449 | } |
@@ -457,9 +457,9 @@ discard block |
||
457 | 457 | |
458 | 458 | function check_admin() |
459 | 459 | { |
460 | - if(!@$GLOBALS['egw_info']['user']['apps']['admin']) |
|
460 | + if (!@$GLOBALS['egw_info']['user']['apps']['admin']) |
|
461 | 461 | { |
462 | - Header('Location: ' . $GLOBALS['egw']->link('/index.php')); |
|
462 | + Header('Location: '.$GLOBALS['egw']->link('/index.php')); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
@@ -470,8 +470,8 @@ discard block |
||
470 | 470 | return false; |
471 | 471 | } |
472 | 472 | $monthnames = array( |
473 | - '','January','February','March','April','May','June', |
|
474 | - 'July','August','September','October','November','December' |
|
473 | + '', 'January', 'February', 'March', 'April', 'May', 'June', |
|
474 | + 'July', 'August', 'September', 'October', 'November', 'December' |
|
475 | 475 | ); |
476 | 476 | $month = $holiday['month'] ? lang($monthnames[$holiday['month']]) : ''; |
477 | 477 | |
@@ -479,15 +479,15 @@ discard block |
||
479 | 479 | { |
480 | 480 | $occ = $holiday['occurence'] == 99 ? lang('last') : $holiday['occurence'].'.'; |
481 | 481 | |
482 | - $dow_str = Array(lang('Sun'),lang('Mon'),lang('Tue'),lang('Wed'),lang('Thu'),lang('Fri'),lang('Sat')); |
|
482 | + $dow_str = Array(lang('Sun'), lang('Mon'), lang('Tue'), lang('Wed'), lang('Thu'), lang('Fri'), lang('Sat')); |
|
483 | 483 | $dow = $dow_str[$holiday['dow']]; |
484 | 484 | |
485 | - $str = lang('%1 %2 in %3',$occ,$dow,$month); |
|
485 | + $str = lang('%1 %2 in %3', $occ, $dow, $month); |
|
486 | 486 | } |
487 | 487 | else |
488 | 488 | { |
489 | - $arr = array($month,$holiday['day']); |
|
490 | - if ($holiday['occurence']>1900) array_unshift ($arr, $holiday['occurence']); |
|
489 | + $arr = array($month, $holiday['day']); |
|
490 | + if ($holiday['occurence'] > 1900) array_unshift($arr, $holiday['occurence']); |
|
491 | 491 | $str = implode('-', $arr); |
492 | 492 | } |
493 | 493 | if ($holiday['observance_rule']) |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | } |
499 | 499 | } |
500 | 500 | |
501 | -function _holiday_cmp($a,$b) |
|
501 | +function _holiday_cmp($a, $b) |
|
502 | 502 | { |
503 | 503 | if (($year_diff = ($a['occurence'] <= 0 ? 0 : $a['occurence']) - ($b['occurence'] <= 0 ? 0 : $b['occurence']))) |
504 | 504 | { |
@@ -487,7 +487,10 @@ |
||
487 | 487 | else |
488 | 488 | { |
489 | 489 | $arr = array($month,$holiday['day']); |
490 | - if ($holiday['occurence']>1900) array_unshift ($arr, $holiday['occurence']); |
|
490 | + if ($holiday['occurence']>1900) |
|
491 | + { |
|
492 | + array_unshift ($arr, $holiday['occurence']); |
|
493 | + } |
|
491 | 494 | $str = implode('-', $arr); |
492 | 495 | } |
493 | 496 | if ($holiday['observance_rule']) |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class boholiday |
26 | 26 | { |
27 | - var $public_functions = Array( |
|
27 | + var $public_functions = array( |
|
28 | 28 | 'add' => True, |
29 | 29 | 'delete_holiday' => True, |
30 | 30 | 'delete_locale' => True, |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | var $query; |
51 | 51 | var $sort; |
52 | 52 | |
53 | - var $locales = Array(); |
|
53 | + var $locales = array(); |
|
54 | 54 | var $holidays; |
55 | 55 | var $cached_holidays; |
56 | 56 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | if(!$this->id) |
93 | 93 | { |
94 | - return Array(); |
|
94 | + return array(); |
|
95 | 95 | } |
96 | 96 | else |
97 | 97 | { |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | |
412 | 412 | function set_holidays_to_date($holidays) |
413 | 413 | { |
414 | - $new_holidays = Array(); |
|
414 | + $new_holidays = array(); |
|
415 | 415 | for($i=0;$i<count($holidays);$i++) |
416 | 416 | { |
417 | 417 | // echo "Setting Holidays Date : ".date('Ymd',$holidays[$i]['date'])."<br>\n"; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | { |
480 | 480 | $occ = $holiday['occurence'] == 99 ? lang('last') : $holiday['occurence'].'.'; |
481 | 481 | |
482 | - $dow_str = Array(lang('Sun'),lang('Mon'),lang('Tue'),lang('Wed'),lang('Thu'),lang('Fri'),lang('Sat')); |
|
482 | + $dow_str = array(lang('Sun'),lang('Mon'),lang('Tue'),lang('Wed'),lang('Thu'),lang('Fri'),lang('Sat')); |
|
483 | 483 | $dow = $dow_str[$holiday['dow']]; |
484 | 484 | |
485 | 485 | $str = lang('%1 %2 in %3',$occ,$dow,$month); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | private $bo; |
65 | 65 | |
66 | 66 | /** |
67 | - * For figuring out if an entry has changed |
|
68 | - */ |
|
67 | + * For figuring out if an entry has changed |
|
68 | + */ |
|
69 | 69 | protected $tracking; |
70 | 70 | |
71 | 71 | /** |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | protected $errors = array(); |
95 | 95 | |
96 | 96 | /** |
97 | - * List of actions, and how many times that action was taken |
|
98 | - */ |
|
99 | - protected $results = array(); |
|
97 | + * List of actions, and how many times that action was taken |
|
98 | + */ |
|
99 | + protected $results = array(); |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * imports entries according to given definition object. |
@@ -202,38 +202,38 @@ discard block |
||
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | - * Returns warnings that were encountered during importing |
|
206 | - * Maximum of one warning message per record, but you can append if you need to |
|
207 | - * |
|
208 | - * @return Array ( |
|
209 | - * record_# => warning message |
|
210 | - * ) |
|
211 | - */ |
|
212 | - public function get_warnings() { |
|
205 | + * Returns warnings that were encountered during importing |
|
206 | + * Maximum of one warning message per record, but you can append if you need to |
|
207 | + * |
|
208 | + * @return Array ( |
|
209 | + * record_# => warning message |
|
210 | + * ) |
|
211 | + */ |
|
212 | + public function get_warnings() { |
|
213 | 213 | return $this->warnings; |
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
217 | - * Returns errors that were encountered during importing |
|
218 | - * Maximum of one error message per record, but you can append if you need to |
|
219 | - * |
|
220 | - * @return Array ( |
|
221 | - * record_# => error message |
|
222 | - * ) |
|
223 | - */ |
|
224 | - public function get_errors() { |
|
217 | + * Returns errors that were encountered during importing |
|
218 | + * Maximum of one error message per record, but you can append if you need to |
|
219 | + * |
|
220 | + * @return Array ( |
|
221 | + * record_# => error message |
|
222 | + * ) |
|
223 | + */ |
|
224 | + public function get_errors() { |
|
225 | 225 | return $this->errors; |
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | - * Returns a list of actions taken, and the number of records for that action. |
|
230 | - * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
231 | - * |
|
232 | - * @return Array ( |
|
233 | - * action => record count |
|
234 | - * ) |
|
235 | - */ |
|
236 | - public function get_results() { |
|
237 | - return $this->results; |
|
238 | - } |
|
229 | + * Returns a list of actions taken, and the number of records for that action. |
|
230 | + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
231 | + * |
|
232 | + * @return Array ( |
|
233 | + * action => record count |
|
234 | + * ) |
|
235 | + */ |
|
236 | + public function get_results() { |
|
237 | + return $this->results; |
|
238 | + } |
|
239 | 239 | } |
240 | 240 | \ No newline at end of file |
@@ -15,19 +15,19 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * import ical for calendar |
17 | 17 | */ |
18 | -class calendar_import_ical implements importexport_iface_import_plugin { |
|
18 | +class calendar_import_ical implements importexport_iface_import_plugin { |
|
19 | 19 | |
20 | 20 | private static $plugin_options = array( |
21 | - 'fieldsep', // char |
|
22 | - 'charset', // string |
|
23 | - 'owner', // int |
|
24 | - 'update_cats', // string {override|add} overides record |
|
21 | + 'fieldsep', // char |
|
22 | + 'charset', // string |
|
23 | + 'owner', // int |
|
24 | + 'update_cats', // string {override|add} overides record |
|
25 | 25 | // with cat(s) from csv OR add the cat from |
26 | 26 | // csv file to exeisting cat(s) of record |
27 | 27 | 'num_header_lines', // int number of header lines |
28 | 28 | 'field_conversion', // array( $csv_col_num => conversion) |
29 | - 'field_mapping', // array( $csv_col_num => adb_filed) |
|
30 | - 'conditions', /* => array containing condition arrays: |
|
29 | + 'field_mapping', // array( $csv_col_num => adb_filed) |
|
30 | + 'conditions', /* => array containing condition arrays: |
|
31 | 31 | 'type' => exists, // exists |
32 | 32 | 'string' => '#kundennummer', |
33 | 33 | 'true' => array( |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string $_charset |
105 | 105 | * @param definition $_definition |
106 | 106 | */ |
107 | - public function import( $_stream, importexport_definition $_definition ) { |
|
107 | + public function import($_stream, importexport_definition $_definition) { |
|
108 | 108 | |
109 | 109 | $this->definition = $_definition; |
110 | 110 | |
@@ -112,20 +112,20 @@ discard block |
||
112 | 112 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
113 | 113 | |
114 | 114 | // dry run? |
115 | - $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; |
|
115 | + $this->dry_run = isset($_definition->plugin_options['dry_run']) ? $_definition->plugin_options['dry_run'] : false; |
|
116 | 116 | |
117 | 117 | // fetch the addressbook bo |
118 | - $this->bo= new calendar_boupdate(); |
|
118 | + $this->bo = new calendar_boupdate(); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | // Failures |
122 | 122 | $this->errors = array(); |
123 | 123 | |
124 | - @set_time_limit(0); // try switching execution time limit off |
|
124 | + @set_time_limit(0); // try switching execution time limit off |
|
125 | 125 | |
126 | 126 | $calendar_ical = new calendar_ical; |
127 | 127 | $calendar_ical->setSupportedFields('file', ''); |
128 | - if($this->dry_run) |
|
128 | + if ($this->dry_run) |
|
129 | 129 | { |
130 | 130 | // No real dry run for iCal |
131 | 131 | echo lang("No preview for iCal"); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | $_definition->plugin_options['no_notification'] = true; |
138 | 138 | } |
139 | - if (!$calendar_ical->importVCal($_stream, -1,null,false,0,'',null,null,null,$_definition->plugin_options['no_notification'])) |
|
139 | + if (!$calendar_ical->importVCal($_stream, -1, null, false, 0, '', null, null, null, $_definition->plugin_options['no_notification'])) |
|
140 | 140 | { |
141 | 141 | $this->errors[] = lang('Error: importing the iCal'); |
142 | 142 | } |
@@ -104,8 +104,7 @@ |
||
104 | 104 | /** |
105 | 105 | * imports entries according to given definition object. |
106 | 106 | * @param resource $_stream |
107 | - * @param string $_charset |
|
108 | - * @param definition $_definition |
|
107 | + * @param importexport_definition $_definition |
|
109 | 108 | */ |
110 | 109 | public function import( $_stream, importexport_definition $_definition ) { |
111 | 110 | $import_csv = new importexport_import_csv( $_stream, array( |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * import ical for calendar |
17 | 17 | */ |
18 | -class calendar_import_ical implements importexport_iface_import_plugin { |
|
18 | +class calendar_import_ical implements importexport_iface_import_plugin |
|
19 | +{ |
|
19 | 20 | |
20 | 21 | private static $plugin_options = array( |
21 | 22 | 'fieldsep', // char |
@@ -104,7 +105,8 @@ discard block |
||
104 | 105 | * @param string $_charset |
105 | 106 | * @param definition $_definition |
106 | 107 | */ |
107 | - public function import( $_stream, importexport_definition $_definition ) { |
|
108 | + public function import( $_stream, importexport_definition $_definition ) |
|
109 | + { |
|
108 | 110 | |
109 | 111 | $this->definition = $_definition; |
110 | 112 | |
@@ -154,7 +156,8 @@ discard block |
||
154 | 156 | * |
155 | 157 | * @return string name |
156 | 158 | */ |
157 | - public static function get_name() { |
|
159 | + public static function get_name() |
|
160 | + { |
|
158 | 161 | return lang('Calendar iCal import'); |
159 | 162 | } |
160 | 163 | |
@@ -163,7 +166,8 @@ discard block |
||
163 | 166 | * |
164 | 167 | * @return string descriprion |
165 | 168 | */ |
166 | - public static function get_description() { |
|
169 | + public static function get_description() |
|
170 | + { |
|
167 | 171 | return lang("Imports events into your Calendar from an iCal File."); |
168 | 172 | } |
169 | 173 | |
@@ -172,7 +176,8 @@ discard block |
||
172 | 176 | * |
173 | 177 | * @return string suffix (comma seperated) |
174 | 178 | */ |
175 | - public static function get_filesuffix() { |
|
179 | + public static function get_filesuffix() |
|
180 | + { |
|
176 | 181 | return 'ics'; |
177 | 182 | } |
178 | 183 | |
@@ -188,7 +193,8 @@ discard block |
||
188 | 193 | * preserv => array, |
189 | 194 | * ) |
190 | 195 | */ |
191 | - public function get_options_etpl() { |
|
196 | + public function get_options_etpl() |
|
197 | + { |
|
192 | 198 | // lets do it! |
193 | 199 | } |
194 | 200 | |
@@ -197,7 +203,8 @@ discard block |
||
197 | 203 | * |
198 | 204 | * @return string etemplate name |
199 | 205 | */ |
200 | - public function get_selectors_etpl() { |
|
206 | + public function get_selectors_etpl() |
|
207 | + { |
|
201 | 208 | // lets do it! |
202 | 209 | } |
203 | 210 | |
@@ -209,7 +216,8 @@ discard block |
||
209 | 216 | * record_# => warning message |
210 | 217 | * ) |
211 | 218 | */ |
212 | - public function get_warnings() { |
|
219 | + public function get_warnings() |
|
220 | + { |
|
213 | 221 | return $this->warnings; |
214 | 222 | } |
215 | 223 | |
@@ -221,7 +229,8 @@ discard block |
||
221 | 229 | * record_# => error message |
222 | 230 | * ) |
223 | 231 | */ |
224 | - public function get_errors() { |
|
232 | + public function get_errors() |
|
233 | + { |
|
225 | 234 | return $this->errors; |
226 | 235 | } |
227 | 236 | |
@@ -233,7 +242,8 @@ discard block |
||
233 | 242 | * action => record count |
234 | 243 | * ) |
235 | 244 | */ |
236 | - public function get_results() { |
|
245 | + public function get_results() |
|
246 | + { |
|
237 | 247 | return $this->results; |
238 | 248 | } |
239 | 249 | } |
240 | 250 | \ No newline at end of file |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | $reload = !is_null($need_reload); |
33 | 33 | |
34 | 34 | // Let parent handle the basic stuff |
35 | - parent::__construct($context,$need_reload); |
|
35 | + parent::__construct($context, $need_reload); |
|
36 | 36 | |
37 | - if($this->favorite['state']['view'] == 'listview') |
|
37 | + if ($this->favorite['state']['view'] == 'listview') |
|
38 | 38 | { |
39 | 39 | $this->context['template'] = 'calendar.list.rows'; |
40 | 40 | $this->context['sel_options'] = array(); |
41 | 41 | $this->nm_settings += array( |
42 | 42 | 'csv_export' => True, |
43 | - 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
|
44 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
45 | - 'no_cat' => True, // I disable the cat-selectbox |
|
43 | + 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
|
44 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
45 | + 'no_cat' => True, // I disable the cat-selectbox |
|
46 | 46 | 'filter' => 'after', |
47 | - 'row_id' => 'row_id', // set in get rows "$event[id]:$event[recur_date]" |
|
47 | + 'row_id' => 'row_id', // set in get rows "$event[id]:$event[recur_date]" |
|
48 | 48 | 'row_modified' => 'modified', |
49 | 49 | 'get_rows' => 'calendar_favorite_portlet::get_rows', |
50 | 50 | // Use a different template so it can be accessed from client side |
@@ -58,17 +58,17 @@ discard block |
||
58 | 58 | $need_reload = $reload && $need_reload; |
59 | 59 | } |
60 | 60 | |
61 | - public function exec($id = null, Etemplate &$etemplate = null) |
|
61 | + public function exec($id = null, Etemplate&$etemplate = null) |
|
62 | 62 | { |
63 | 63 | |
64 | 64 | // Always load app's javascript, so most actions have a chance of working |
65 | - Framework::includeJS('.','app',$this->context['appname']); |
|
65 | + Framework::includeJS('.', 'app', $this->context['appname']); |
|
66 | 66 | |
67 | 67 | // Always load app's css |
68 | 68 | Framework::includeCSS('calendar', 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) || |
69 | - Framework::includeCSS('calendar','app'); |
|
69 | + Framework::includeCSS('calendar', 'app'); |
|
70 | 70 | |
71 | - if($this->favorite['state']['view'] == 'listview' || is_array($this->favorite) && !$this->favorite['state']['view']) |
|
71 | + if ($this->favorite['state']['view'] == 'listview' || is_array($this->favorite) && !$this->favorite['state']['view']) |
|
72 | 72 | { |
73 | 73 | $ui = new calendar_uilist(); |
74 | 74 | } |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | $ui = new calendar_uiviews(); |
78 | 78 | if ($this->favorite) |
79 | 79 | { |
80 | - if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
81 | - if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
80 | + if ($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
81 | + if ($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
82 | 82 | // Owner can be 0 for current user |
83 | - if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
84 | - if($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
|
83 | + if (array_key_exists('owner', $this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
84 | + if ($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
|
85 | 85 | { |
86 | - $ui->search_params['users'] = explode(',',$ui->search_params['users']); |
|
86 | + $ui->search_params['users'] = explode(',', $ui->search_params['users']); |
|
87 | 87 | } |
88 | - if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
89 | - if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
88 | + if ($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
89 | + if ($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
90 | 90 | $ui->search_params['weekend'] = $this->favorite['state']['weekend']; |
91 | 91 | } |
92 | 92 | $etemplate->read('home.legacy'); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $content = array('legacy' => ''); |
98 | 98 | |
99 | - switch($this->favorite['state']['view']) |
|
99 | + switch ($this->favorite['state']['view']) |
|
100 | 100 | { |
101 | 101 | case 'listview': |
102 | 102 | $this->context['sel_options']['filter'] = &$ui->date_filters; |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | $content = array(); |
111 | 111 | $etemplate->read('calendar.planner'); |
112 | 112 | $etemplate->set_dom_id($id); |
113 | - $this->actions =& $etemplate->getElementAttribute('planner', 'actions'); |
|
113 | + $this->actions = & $etemplate->getElementAttribute('planner', 'actions'); |
|
114 | 114 | // Don't notify the calendar app of date changes |
115 | - $etemplate->setElementAttribute('planner','onchange',false); |
|
115 | + $etemplate->setElementAttribute('planner', 'onchange', false); |
|
116 | 116 | $ui->planner_view = $this->favorite['state']['planner_view']; |
117 | 117 | $ui->planner(array(), $etemplate); |
118 | 118 | return; |
@@ -120,20 +120,19 @@ discard block |
||
120 | 120 | case 'weekN': |
121 | 121 | $etemplate->read('calendar.view'); |
122 | 122 | $etemplate->set_dom_id($id); |
123 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
123 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
124 | 124 | |
125 | 125 | $ui->month($this->favorite['state']['view'] == 'month' ? |
126 | - 0 : |
|
127 | - (int)$ui->cal_prefs['multiple_weeks'], |
|
126 | + 0 : (int)$ui->cal_prefs['multiple_weeks'], |
|
128 | 127 | $etemplate |
129 | 128 | ); |
130 | 129 | return; |
131 | 130 | case 'week': |
132 | 131 | $etemplate->read('calendar.view'); |
133 | 132 | $etemplate->set_dom_id($id); |
134 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
133 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
135 | 134 | // Don't notify the calendar app of date changes |
136 | - $etemplate->setElementAttribute('view[0]','onchange',false); |
|
135 | + $etemplate->setElementAttribute('view[0]', 'onchange', false); |
|
137 | 136 | $ui->week(array(), $etemplate); |
138 | 137 | return; |
139 | 138 | case 'day': |
@@ -143,7 +142,7 @@ discard block |
||
143 | 142 | $days = $this->favorite['state']['days'] ? $this->favorite['state']['days'] : ( |
144 | 143 | $this->favorite['state']['view'] == 'day' ? 1 : 4 |
145 | 144 | ); |
146 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
145 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
147 | 146 | $ui->week($days, $etemplate); |
148 | 147 | return; |
149 | 148 | } |
@@ -156,7 +155,7 @@ discard block |
||
156 | 155 | $old_app = $GLOBALS['egw_info']['flags']['currentapp']; |
157 | 156 | $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; |
158 | 157 | |
159 | - $etemplate->exec(get_called_class() .'::process',$content); |
|
158 | + $etemplate->exec(get_called_class().'::process', $content); |
|
160 | 159 | $GLOBALS['egw_info']['flags']['currentapp'] = $old_app; |
161 | 160 | } |
162 | 161 | |
@@ -199,27 +198,27 @@ discard block |
||
199 | 198 | else |
200 | 199 | { |
201 | 200 | $success = $failed = $action_msg = $msg = null; |
202 | - if ($ui->action($values['nm']['action'],$values['nm']['selected'],$values['nm']['select_all'], |
|
203 | - $success,$failed,$action_msg,'calendar_list',$msg, $values['nm']['checkboxes']['no_notifications'])) |
|
201 | + if ($ui->action($values['nm']['action'], $values['nm']['selected'], $values['nm']['select_all'], |
|
202 | + $success, $failed, $action_msg, 'calendar_list', $msg, $values['nm']['checkboxes']['no_notifications'])) |
|
204 | 203 | { |
205 | - $msg .= lang('%1 event(s) %2',$success,$action_msg); |
|
206 | - Api\Json\Response::get()->apply('egw.message',array($msg,'success')); |
|
207 | - foreach($values['nm']['selected'] as &$id) |
|
204 | + $msg .= lang('%1 event(s) %2', $success, $action_msg); |
|
205 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'success')); |
|
206 | + foreach ($values['nm']['selected'] as &$id) |
|
208 | 207 | { |
209 | 208 | $id = 'calendar::'.$id; |
210 | 209 | } |
211 | 210 | // Directly request an update - this will get addressbook tab too |
212 | - Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($values['nm']['selected'])); |
|
211 | + Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($values['nm']['selected'])); |
|
213 | 212 | } |
214 | - elseif(is_null($msg)) |
|
213 | + elseif (is_null($msg)) |
|
215 | 214 | { |
216 | - $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
217 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
215 | + $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
216 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
218 | 217 | } |
219 | - elseif($msg) |
|
218 | + elseif ($msg) |
|
220 | 219 | { |
221 | - $msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed); |
|
222 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
220 | + $msg .= "\n".lang('%1 entries %2, %3 failed.', $success, $action_msg, $failed); |
|
221 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
223 | 222 | } |
224 | 223 | unset($values['nm']['action']); |
225 | 224 | unset($values['nm']['select_all']); |
@@ -235,9 +234,9 @@ discard block |
||
235 | 234 | public function get_properties() |
236 | 235 | { |
237 | 236 | $properties = parent::get_properties(); |
238 | - foreach($properties as &$property) |
|
237 | + foreach ($properties as &$property) |
|
239 | 238 | { |
240 | - if($property['name'] == 'favorite') |
|
239 | + if ($property['name'] == 'favorite') |
|
241 | 240 | { |
242 | 241 | unset($property['select_options']['blank']); |
243 | 242 | break; |
@@ -247,7 +246,7 @@ discard block |
||
247 | 246 | } |
248 | 247 | |
249 | 248 | public function get_actions() { |
250 | - if($this->favorite['state']['view'] == 'listview' || !$this->actions) |
|
249 | + if ($this->favorite['state']['view'] == 'listview' || !$this->actions) |
|
251 | 250 | { |
252 | 251 | return array(); |
253 | 252 | } |
@@ -77,16 +77,31 @@ discard block |
||
77 | 77 | $ui = new calendar_uiviews(); |
78 | 78 | if ($this->favorite) |
79 | 79 | { |
80 | - if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
81 | - if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
80 | + if($this->favorite['state']['start']) |
|
81 | + { |
|
82 | + $ui->search_params['start'] = $this->favorite['state']['start']; |
|
83 | + } |
|
84 | + if($this->favorite['state']['cat_id']) |
|
85 | + { |
|
86 | + $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
87 | + } |
|
82 | 88 | // Owner can be 0 for current user |
83 | - if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
89 | + if(array_key_exists('owner',$this->favorite['state'])) |
|
90 | + { |
|
91 | + $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
92 | + } |
|
84 | 93 | if($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
85 | 94 | { |
86 | 95 | $ui->search_params['users'] = explode(',',$ui->search_params['users']); |
87 | 96 | } |
88 | - if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
89 | - if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
97 | + if($this->favorite['state']['filter']) |
|
98 | + { |
|
99 | + $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
100 | + } |
|
101 | + if($this->favorite['state']['sortby']) |
|
102 | + { |
|
103 | + $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
104 | + } |
|
90 | 105 | $ui->search_params['weekend'] = $this->favorite['state']['weekend']; |
91 | 106 | } |
92 | 107 | $etemplate->read('home.legacy'); |
@@ -246,7 +261,8 @@ discard block |
||
246 | 261 | return $properties; |
247 | 262 | } |
248 | 263 | |
249 | - public function get_actions() { |
|
264 | + public function get_actions() |
|
265 | + { |
|
250 | 266 | if($this->favorite['state']['view'] == 'listview' || !$this->actions) |
251 | 267 | { |
252 | 268 | return array(); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @param boolean $need_reload Flag to indicate that the portlet needs to be reloaded (exec will be called) |
51 | 51 | */ |
52 | - public function __construct(Array &$context = array(), &$need_reload = false) |
|
52 | + public function __construct(array &$context = array(), &$need_reload = false) |
|
53 | 53 | { |
54 | 54 | if (false) parent::__construct(); |
55 | 55 |