@@ -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 |
@@ -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 |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | - * Do some magic with the participants and recurrance. |
|
136 | - * If this is one of a recurring event, append the recur_date to the participant field so we can |
|
137 | - * filter by it later. |
|
138 | - */ |
|
135 | + * Do some magic with the participants and recurrance. |
|
136 | + * If this is one of a recurring event, append the recur_date to the participant field so we can |
|
137 | + * filter by it later. |
|
138 | + */ |
|
139 | 139 | if(is_array($data['participants'])) |
140 | 140 | { |
141 | 141 | $participants = $data['participants']; |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
198 | - * Do some magic with the participants and recurrance. |
|
199 | - * If this is one of a recurring event, append the recur_date to the participant field so we can |
|
200 | - * filter by it later. |
|
201 | - */ |
|
198 | + * Do some magic with the participants and recurrance. |
|
199 | + * If this is one of a recurring event, append the recur_date to the participant field so we can |
|
200 | + * filter by it later. |
|
201 | + */ |
|
202 | 202 | protected function alter_participants($participants) |
203 | 203 | { |
204 | 204 | $data = array(); |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function __construct() |
116 | 116 | { |
117 | - parent::__construct('calendar'); // adds custom fields |
|
117 | + parent::__construct('calendar'); // adds custom fields |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Tracks the changes in one entry $data, by comparing it with the last version in $old |
122 | 122 | * Overrides parent to reformat participants into a format parent can handle |
123 | 123 | */ |
124 | - public function track(array $data,array $old=null,$user=null,$deleted=null,array $changed_fields=null) |
|
124 | + public function track(array $data, array $old = null, $user = null, $deleted = null, array $changed_fields = null) |
|
125 | 125 | { |
126 | 126 | // Don't try to track dates on recurring events. |
127 | 127 | // It won't change for the base event, and any change to the time creates an exception |
128 | - if($data['recur_type']) |
|
128 | + if ($data['recur_type']) |
|
129 | 129 | { |
130 | 130 | unset($data['start']); unset($data['end']); |
131 | 131 | unset($old['start']); unset($old['end']); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * If this is one of a recurring event, append the recur_date to the participant field so we can |
137 | 137 | * filter by it later. |
138 | 138 | */ |
139 | - if(is_array($data['participants'])) |
|
139 | + if (is_array($data['participants'])) |
|
140 | 140 | { |
141 | 141 | $participants = $data['participants']; |
142 | 142 | $data['participants'] = array(); |
@@ -144,25 +144,25 @@ discard block |
||
144 | 144 | } |
145 | 145 | // if clients eg. CalDAV do NOT set participants, they are left untouched |
146 | 146 | // therefore we should not track them, as all updates then show up as all participants removed |
147 | - elseif(!isset($data['participants'])) |
|
147 | + elseif (!isset($data['participants'])) |
|
148 | 148 | { |
149 | 149 | unset($old['participants']); |
150 | 150 | } |
151 | - if(is_array($old['participants'])) |
|
151 | + if (is_array($old['participants'])) |
|
152 | 152 | { |
153 | 153 | $participants = $old['participants']; |
154 | 154 | $old['participants'] = array(); |
155 | 155 | $old = array_merge($old, $this->alter_participants($participants)); |
156 | 156 | } |
157 | - parent::track($data,$old,$user,$deleted, $changed_fields); |
|
157 | + parent::track($data, $old, $user, $deleted, $changed_fields); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Overrides parent because calendar_boupdates handles the notifications |
162 | 162 | */ |
163 | - public function do_notifications($data,$old,$deleted=null) |
|
163 | + public function do_notifications($data, $old, $deleted = null) |
|
164 | 164 | { |
165 | - unset($data, $old, $deleted); // unused, but required by function signature |
|
165 | + unset($data, $old, $deleted); // unused, but required by function signature |
|
166 | 166 | return true; |
167 | 167 | } |
168 | 168 | |
@@ -177,21 +177,21 @@ discard block |
||
177 | 177 | * @param array $old = null |
178 | 178 | * @return array of keys with different values in $data and $old |
179 | 179 | */ |
180 | - public function changed_fields(array $data,array $old=null) |
|
180 | + public function changed_fields(array $data, array $old = null) |
|
181 | 181 | { |
182 | - if(is_array($data['participants'])) |
|
182 | + if (is_array($data['participants'])) |
|
183 | 183 | { |
184 | 184 | $participants = $data['participants']; |
185 | 185 | $data['participants'] = array(); |
186 | 186 | $data = array_merge($data, $this->alter_participants($participants)); |
187 | 187 | } |
188 | - if(is_array($old['participants'])) |
|
188 | + if (is_array($old['participants'])) |
|
189 | 189 | { |
190 | 190 | $participants = $old['participants']; |
191 | 191 | $old['participants'] = array(); |
192 | 192 | $old = array_merge($old, $this->alter_participants($participants)); |
193 | 193 | } |
194 | - return parent::changed_fields($data,$old); |
|
194 | + return parent::changed_fields($data, $old); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | protected function alter_participants($participants) |
203 | 203 | { |
204 | 204 | $data = array(); |
205 | - foreach($participants as $uid => $status) |
|
205 | + foreach ($participants as $uid => $status) |
|
206 | 206 | { |
207 | 207 | $quantity = $role = $user_type = $user_id = null; |
208 | 208 | calendar_so::split_status($status, $quantity, $role); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | use EGroupware\Api\Asyncservice; |
16 | 16 | |
17 | 17 | if (!isset($_REQUEST['domain'])) $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
18 | -$path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
|
18 | +$path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
|
19 | 19 | |
20 | 20 | // remove the comment from one of the following lines to enable loging |
21 | 21 | // define('ASYNC_LOG','C:\\async.log'); // Windows |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | if (defined('ASYNC_LOG')) |
26 | 26 | { |
27 | 27 | $msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].": asyncservice started\n"; |
28 | - $f = fopen(ASYNC_LOG,'a+'); |
|
29 | - fwrite($f,$msg); |
|
28 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
29 | + fwrite($f, $msg); |
|
30 | 30 | fclose($f); |
31 | 31 | } |
32 | 32 | $GLOBALS['egw_info']['flags'] = array( |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | } |
44 | 44 | if (defined('ASYNC_LOG')) |
45 | 45 | { |
46 | - $f = fopen(ASYNC_LOG,'a+'); |
|
47 | - fwrite($f,$msg); |
|
46 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
47 | + fwrite($f, $msg); |
|
48 | 48 | fclose($f); |
49 | 49 | } |
50 | 50 | die($msg); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | } |
64 | 64 | if (defined('ASYNC_LOG')) |
65 | 65 | { |
66 | - $f = fopen(ASYNC_LOG,'a+'); |
|
67 | - fwrite($f,$msg); |
|
66 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
67 | + fwrite($f, $msg); |
|
68 | 68 | fclose($f); |
69 | 69 | } |
70 | 70 | die($msg); |
@@ -75,8 +75,7 @@ discard block |
||
75 | 75 | $async = new Asyncservice(); |
76 | 76 | $num = $async->check_run(isset($_REQUEST['run_by']) ? $_REQUEST['run_by'] : 'crontab'); |
77 | 77 | |
78 | -$msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].': '.($num === false ? 'An error occured: can not obtain semaphore!' : |
|
79 | - ($num ? "$num job(s) executed" : 'Nothing to execute'))."\n\n"; |
|
78 | +$msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].': '.($num === false ? 'An error occured: can not obtain semaphore!' : ($num ? "$num job(s) executed" : 'Nothing to execute'))."\n\n"; |
|
80 | 79 | |
81 | 80 | if (isset($_SERVER['HTTP_HOST'])) |
82 | 81 | { |
@@ -87,7 +86,7 @@ discard block |
||
87 | 86 | |
88 | 87 | if (defined('ASYNC_LOG')) |
89 | 88 | { |
90 | - $f = fopen(ASYNC_LOG,'a+'); |
|
91 | - fwrite($f,$msg); |
|
89 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
90 | + fwrite($f, $msg); |
|
92 | 91 | fclose($f); |
93 | 92 | } |
@@ -14,7 +14,10 @@ |
||
14 | 14 | |
15 | 15 | use EGroupware\Api\Asyncservice; |
16 | 16 | |
17 | -if (!isset($_REQUEST['domain'])) $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
|
17 | +if (!isset($_REQUEST['domain'])) |
|
18 | +{ |
|
19 | + $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
|
20 | +} |
|
18 | 21 | $path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
19 | 22 | |
20 | 23 | // remove the comment from one of the following lines to enable loging |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | include '../header.inc.php'; |
30 | 30 | |
31 | -$content = json_encode(Api\Image::map(preg_match('/^[a-z0-9_-]+$/i',$_GET['template']) ? $_GET['template'] : null, $_GET['svg']), |
|
32 | - JSON_FORCE_OBJECT | // export empty php-arrays as empty objects, not empty arrays |
|
33 | - JSON_UNESCAPED_SLASHES | // do not escape slashes, smaller and better readable |
|
31 | +$content = json_encode(Api\Image::map(preg_match('/^[a-z0-9_-]+$/i', $_GET['template']) ? $_GET['template'] : null, $_GET['svg']), |
|
32 | + JSON_FORCE_OBJECT|// export empty php-arrays as empty objects, not empty arrays |
|
33 | + JSON_UNESCAPED_SLASHES|// do not escape slashes, smaller and better readable |
|
34 | 34 | (!empty($_GET['debug']) ? JSON_PRETTY_PRINT : 0)); |
35 | 35 | |
36 | 36 | // use an etag over the image mapp |
37 | 37 | $etag = '"'.md5($content).'"'; |
38 | 38 | |
39 | 39 | // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header |
40 | -Api\Session::cache_control(86400); // cache for one day |
|
41 | -Header('Content-Type: '.(empty($_GET['debug'])?'text/javascript':'application/json').'; charset=utf-8'); |
|
40 | +Api\Session::cache_control(86400); // cache for one day |
|
41 | +Header('Content-Type: '.(empty($_GET['debug']) ? 'text/javascript' : 'application/json').'; charset=utf-8'); |
|
42 | 42 | Header('ETag: '.$etag); |
43 | 43 | |
44 | 44 | // if servers send a If-None-Match header, response with 304 Not Modified, if etag matches |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if (empty($_GET['debug'])) $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
52 | 52 | |
53 | 53 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
54 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
54 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
55 | 55 | { |
56 | 56 | $content = gzencode($content); |
57 | 57 | header('Content-Encoding: gzip'); |
@@ -48,7 +48,10 @@ |
||
48 | 48 | exit; |
49 | 49 | } |
50 | 50 | |
51 | -if (empty($_GET['debug'])) $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
|
51 | +if (empty($_GET['debug'])) |
|
52 | +{ |
|
53 | + $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
|
54 | +} |
|
52 | 55 | |
53 | 56 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
54 | 57 | if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | private function parse_file($file) |
81 | 81 | { |
82 | 82 | // file is from url and can contain query-params, eg. /phpgwapi/inc/jscalendar-setup.php?dateformat=d.m.Y&lang=de |
83 | - if (strpos($file,'?') !== false) list($file) = explode('?',$file); |
|
83 | + if (strpos($file, '?') !== false) list($file) = explode('?', $file); |
|
84 | 84 | |
85 | 85 | // Mark the file as parsed |
86 | 86 | $this->parsed_files[$file] = true; |
@@ -284,17 +284,17 @@ discard block |
||
284 | 284 | * @returns the correct path on the server if the file is found or false, if the |
285 | 285 | * file is not found or no further processing is needed. |
286 | 286 | */ |
287 | - private function translate_params($package, $file=null, $app='api') |
|
287 | + private function translate_params($package, $file = null, $app = 'api') |
|
288 | 288 | { |
289 | 289 | if ($package[0] == '/' && is_readable(EGW_SERVER_ROOT.parse_url($path = $package, PHP_URL_PATH)) || |
290 | 290 | // fix old /phpgwapi/js/ path by replacing it with /api/js/ |
291 | 291 | substr($package, 0, 13) == '/phpgwapi/js/' && is_readable(EGW_SERVER_ROOT.parse_url($path = str_replace('/phpgwapi/js/', '/api/js/', $package), PHP_URL_PATH)) || |
292 | 292 | $package[0] == '/' && is_readable(EGW_SERVER_ROOT.($path = $package)) || |
293 | - $package == '.' && is_readable(EGW_SERVER_ROOT.($path="/$app/js/$file.js")) || |
|
294 | - is_readable(EGW_SERVER_ROOT.($path="/$app/js/$package/$file.js")) || |
|
293 | + $package == '.' && is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$file.js")) || |
|
294 | + is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$package/$file.js")) || |
|
295 | 295 | // fix not found by using app='api' |
296 | - $app != 'api' && is_readable(EGW_SERVER_ROOT.($path="/api/js/$package/$file.js")) || |
|
297 | - $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path="/phpgwapi/js/$package/$file.js"))) |
|
296 | + $app != 'api' && is_readable(EGW_SERVER_ROOT.($path = "/api/js/$package/$file.js")) || |
|
297 | + $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path = "/phpgwapi/js/$package/$file.js"))) |
|
298 | 298 | { |
299 | 299 | // normalise /./ to / |
300 | 300 | $path = str_replace('/./', '/', $path); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // adding the ctime to all js files... |
306 | 306 | if (is_array($file)) |
307 | 307 | { |
308 | - foreach($file as $name => $val) |
|
308 | + foreach ($file as $name => $val) |
|
309 | 309 | { |
310 | 310 | $args .= (empty($args) ? '?' : '&').$name.'='.urlencode($val); |
311 | 311 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @param array $files |
376 | 376 | * @param boolean $clear_files =false if true clear list of files, before including given ones |
377 | 377 | */ |
378 | - public function include_files(array $files, $clear_files=false) |
|
378 | + public function include_files(array $files, $clear_files = false) |
|
379 | 379 | { |
380 | 380 | if ($clear_files) $this->included_files = array(); |
381 | 381 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * @param boolean $clear_files =false if true clear list of files after returning them |
392 | 392 | * @return array |
393 | 393 | */ |
394 | - public function get_included_files($clear_files=false) |
|
394 | + public function get_included_files($clear_files = false) |
|
395 | 395 | { |
396 | 396 | $ret = array_keys($this->included_files); |
397 | 397 | if ($clear_files) $this->included_files = array(); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $paths = !empty($_GET['path']) ? (array)$_GET['path'] : (array)'/stylite/js/filemanager/filemanager.js'; |
426 | 426 | |
427 | - foreach($paths as $path) |
|
427 | + foreach ($paths as $path) |
|
428 | 428 | { |
429 | 429 | echo "\t<h1>".htmlspecialchars($path)."</h1>\n"; |
430 | 430 | $mgr->include_js_file($path); |
@@ -80,7 +80,10 @@ discard block |
||
80 | 80 | private function parse_file($file) |
81 | 81 | { |
82 | 82 | // file is from url and can contain query-params, eg. /phpgwapi/inc/jscalendar-setup.php?dateformat=d.m.Y&lang=de |
83 | - if (strpos($file,'?') !== false) list($file) = explode('?',$file); |
|
83 | + if (strpos($file,'?') !== false) |
|
84 | + { |
|
85 | + list($file) = explode('?',$file); |
|
86 | + } |
|
84 | 87 | |
85 | 88 | // Mark the file as parsed |
86 | 89 | $this->parsed_files[$file] = true; |
@@ -326,12 +329,15 @@ discard block |
||
326 | 329 | } |
327 | 330 | } |
328 | 331 | |
329 | - if (self::$DEBUG_MODE) // DEBUG_MODE is currently ALWAYS true. Comment this code out if you don't want error messages. |
|
332 | + if (self::$DEBUG_MODE) |
|
333 | + { |
|
334 | + // DEBUG_MODE is currently ALWAYS true. Comment this code out if you don't want error messages. |
|
330 | 335 | { |
331 | 336 | //error_log(__METHOD__."($package,$file,$app) $path NOT found".($this->debug_processing_file ? " while processing file '{$this->debug_processing_file}'." : "!").' '.function_backtrace()); |
332 | 337 | } |
333 | 338 | |
334 | 339 | return false; |
340 | + } |
|
335 | 341 | } |
336 | 342 | |
337 | 343 | /** |
@@ -377,7 +383,10 @@ discard block |
||
377 | 383 | */ |
378 | 384 | public function include_files(array $files, $clear_files=false) |
379 | 385 | { |
380 | - if ($clear_files) $this->included_files = array(); |
|
386 | + if ($clear_files) |
|
387 | + { |
|
388 | + $this->included_files = array(); |
|
389 | + } |
|
381 | 390 | |
382 | 391 | foreach ($files as $file) |
383 | 392 | { |
@@ -394,7 +403,10 @@ discard block |
||
394 | 403 | public function get_included_files($clear_files=false) |
395 | 404 | { |
396 | 405 | $ret = array_keys($this->included_files); |
397 | - if ($clear_files) $this->included_files = array(); |
|
406 | + if ($clear_files) |
|
407 | + { |
|
408 | + $this->included_files = array(); |
|
409 | + } |
|
398 | 410 | return $ret; |
399 | 411 | } |
400 | 412 |