1 | |
---|
2 | |
---|
3 | function search() |
---|
4 | { |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
10 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
11 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['infolog']['title'].' - '.lang('Search Results'); |
---|
12 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
13 | |
---|
14 | $error = ''; |
---|
15 | |
---|
16 | $matches = 0; |
---|
17 | |
---|
18 | // There is currently a problem searching in with repeated events. |
---|
19 | // It spits back out the date it was entered. I would like to to say that |
---|
20 | // it is a repeated event. |
---|
21 | |
---|
22 | // This has been solved by the little icon indicator for recurring events. |
---|
23 | |
---|
24 | $event = $this->bo->read_entry($info_id); |
---|
25 | |
---|
26 | $event_ids = $this->bo->search_keywords($_POST['keywords']); |
---|
27 | |
---|
28 | foreach($event_ids as $key => $id) |
---|
29 | { |
---|
30 | |
---|
31 | |
---|
32 | $event = $this->bo->read_entry($id); |
---|
33 | |
---|
34 | |
---|
35 | $datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
36 | |
---|
37 | $info[strval($event['id'])] = array( |
---|
38 | 'tr_color' => $GLOBALS['phpgw']->nextmatchs->alternate_row_color(), |
---|
39 | 'date' => $GLOBALS['phpgw']->common->show_date($datetime), |
---|
40 | 'link' => $this->link_to_entry($event,$event['start']['month'],$event['start']['mday'],$event['start']['year']) |
---|
41 | ); |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | if(!$this->bo->check_perms(PHPGW_ACL_READ,$event)) |
---|
46 | { |
---|
47 | continue; |
---|
48 | } |
---|
49 | |
---|
50 | } |
---|
51 | $matches = count($event_ids); |
---|
52 | |
---|
53 | if ($matches == 1) |
---|
54 | { |
---|
55 | $quantity = lang('1 match found').'.'; |
---|
56 | } |
---|
57 | elseif ($matches > 0) |
---|
58 | { |
---|
59 | $quantity = lang('%1 matches found',$matches).'.'; |
---|
60 | } |
---|
61 | else |
---|
62 | { |
---|
63 | echo '<b>'.lang('Error').':</b>'.lang('no matches found'); |
---|
64 | return; |
---|
65 | } |
---|
66 | |
---|
67 | $p = $GLOBALS['phpgw']->template; |
---|
68 | $p->set_file( |
---|
69 | Array( |
---|
70 | 'search_form' => 'search.tpl' |
---|
71 | ) |
---|
72 | ); |
---|
73 | $p->set_block('search_form','search','search'); |
---|
74 | $p->set_block('search_form','search_list_header','search_list_header'); |
---|
75 | $p->set_block('search_form','search_list','search_list'); |
---|
76 | $p->set_block('search_form','search_list_footer','search_list_footer'); |
---|
77 | |
---|
78 | $var = Array( |
---|
79 | 'th_bg' => $this->theme['th_bg'], |
---|
80 | 'search_text' => lang('Search Results'), |
---|
81 | 'quantity' => $quantity |
---|
82 | ); |
---|
83 | $p->set_var($var); |
---|
84 | |
---|
85 | if($matches > 0) |
---|
86 | { |
---|
87 | $p->parse('rows','search_list_header',True); |
---|
88 | } |
---|
89 | |
---|
90 | //if($info){ |
---|
91 | foreach($info as $id => $data) |
---|
92 | { |
---|
93 | $p->set_var($data); |
---|
94 | $p->parse('rows','search_list',True); |
---|
95 | } |
---|
96 | // } |
---|
97 | if($matches > 0) |
---|
98 | { |
---|
99 | $p->parse('rows','search_list_footer',True); |
---|
100 | } |
---|
101 | |
---|
102 | $p->pparse('out','search'); |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | function month() |
---|
111 | { |
---|
112 | echo $this->printer_friendly($this->get_month(),lang('Monthview')); |
---|
113 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
114 | } |
---|
115 | |
---|
116 | function get_month() |
---|
117 | { |
---|
118 | |
---|
119 | |
---|
120 | } |
---|
121 | |
---|
122 | |
---|
123 | |
---|
124 | function get_todos(&$todo_label) |
---|
125 | { |
---|
126 | $todos_from_hook = $GLOBALS['phpgw']->hooks->process(array( |
---|
127 | 'location' => 'infolog_include_todos', |
---|
128 | 'year' => $this->bo->year, |
---|
129 | 'month' => $this->bo->month, |
---|
130 | 'day' => $this->bo->day, |
---|
131 | 'owner' => $this->bo->owner // num. id of the user, not necessary current user |
---|
132 | )); |
---|
133 | |
---|
134 | if(is_array($todo_label)) |
---|
135 | { |
---|
136 | list($label,$showall)=$todo_label; |
---|
137 | } |
---|
138 | else |
---|
139 | { |
---|
140 | $label=$todo_label; |
---|
141 | $showall=true; |
---|
142 | } |
---|
143 | $maxshow = (int)$GLOBALS['phpgw_info']['user']['preferences']['infolog']['mainscreen_maxshow']; |
---|
144 | if($maxshow<=0) |
---|
145 | { |
---|
146 | $maxshow=10; |
---|
147 | } |
---|
148 | //print_debug("get_todos(): label=$label; showall=$showall; max=$maxshow"); |
---|
149 | |
---|
150 | $content = $todo_label = ''; |
---|
151 | if (is_array($todos_from_hook) && count($todos_from_hook)) |
---|
152 | { |
---|
153 | $todo_label = !empty($label)?$label:lang("open ToDo's:"); |
---|
154 | |
---|
155 | foreach($todos_from_hook as $todos) |
---|
156 | { |
---|
157 | $i = 0; |
---|
158 | if (is_array($todos) && count($todos)) |
---|
159 | { |
---|
160 | foreach($todos as $todo) |
---|
161 | { |
---|
162 | if(!$showall && ($i++>$maxshow)) |
---|
163 | { |
---|
164 | break; |
---|
165 | } |
---|
166 | $icons = ''; |
---|
167 | foreach($todo['icons'] as $name => $app) |
---|
168 | { |
---|
169 | $icons .= ($icons?' ':'').$GLOBALS['phpgw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"'); |
---|
170 | } |
---|
171 | $class = $class == 'row_on' ? 'row_off' : 'row_on'; |
---|
172 | |
---|
173 | //NDEE <tr starts here |
---|
174 | $content .= " <tr id=\"debug\" class=\"$class\">\n <td valign=\"top\" width=\"15%\"nowrap>". |
---|
175 | ($this->bo->printer_friendly?$icons:$GLOBALS['phpgw']->html->a_href($icons,$todo['view'])). |
---|
176 | "</td>\n <td>".($this->bo->printer_friendly?$todo['title']: |
---|
177 | $GLOBALS['phpgw']->html->a_href($todo['title'],$todo['view']))."</td>\n </tr>\n"; |
---|
178 | } |
---|
179 | } |
---|
180 | } |
---|
181 | } |
---|
182 | if (!empty($content)) |
---|
183 | { |
---|
184 | return "<table border=\"0\" width=\"100%\">\n$content</table>\n"; |
---|
185 | } |
---|
186 | return False; |
---|
187 | } |
---|
188 | |
---|
189 | |
---|
190 | |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | /****************************************/ |
---|
195 | |
---|
196 | |
---|
197 | |
---|
198 | |
---|
199 | |
---|
200 | |
---|
201 | function link_to_entry($event,$month,$day,$year) |
---|
202 | { |
---|
203 | |
---|
204 | |
---|
205 | |
---|
206 | $str = ''; |
---|
207 | $is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event); |
---|
208 | $viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event); |
---|
209 | |
---|
210 | $starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
211 | $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
212 | $rawdate = mktime(0,0,0,$month,$day,$year); |
---|
213 | $rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
214 | $nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
215 | if ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') && $starttime == $endtime) |
---|
216 | { |
---|
217 | $time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); |
---|
218 | } |
---|
219 | elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60) |
---|
220 | { |
---|
221 | $time = '[ '.lang('All Day').' ]'; |
---|
222 | } |
---|
223 | elseif ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') || $starttime != $endtime) |
---|
224 | { |
---|
225 | if($starttime < $rawdate_offset && $event['recur_type'] == MCAL_RECUR_NONE) |
---|
226 | { |
---|
227 | $start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat); |
---|
228 | } |
---|
229 | else |
---|
230 | { |
---|
231 | $start_time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); |
---|
232 | } |
---|
233 | |
---|
234 | if($endtime >= ($rawdate_offset + 86400)) |
---|
235 | { |
---|
236 | $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat); |
---|
237 | } |
---|
238 | else |
---|
239 | { |
---|
240 | $end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat); |
---|
241 | } |
---|
242 | $time = $start_time.'-'.$end_time; |
---|
243 | } |
---|
244 | else |
---|
245 | { |
---|
246 | $time = ''; |
---|
247 | } |
---|
248 | |
---|
249 | $texttitle = $texttime = $textdesc = $textlocation = $textstatus = ''; |
---|
250 | |
---|
251 | |
---|
252 | |
---|
253 | if(!$is_private) |
---|
254 | { |
---|
255 | //$text .= $this->bo->display_status($event['users_status']); |
---|
256 | |
---|
257 | // split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation |
---|
258 | |
---|
259 | $textstatus=$this->bo->display_status($event['users_status']); |
---|
260 | |
---|
261 | } |
---|
262 | |
---|
263 | /* |
---|
264 | $text = '<nobr> '.$time.' </nobr> '.$this->bo->get_short_field($event,$is_private,'title').$text. |
---|
265 | (!$is_private && $event['description'] ? ': <i>'.$this->bo->get_short_field($event,$is_private,'description').'</i>':''). |
---|
266 | $GLOBALS['phpgw']->browser->br; |
---|
267 | */ |
---|
268 | |
---|
269 | $texttime=$time; |
---|
270 | $texttitle=$this->bo->get_short_field($event,$is_private,'title'); |
---|
271 | |
---|
272 | $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'info_des'):''); |
---|
273 | echo "descrip".$textdesc."<br>".$event."."; |
---|
274 | // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set |
---|
275 | $textlocation=$this->bo->get_short_field($event,$is_private,'info_cat'); |
---|
276 | |
---|
277 | if ($viewable) |
---|
278 | { |
---|
279 | $date = sprintf('%04d%02d%02d',$year,$month,$day); |
---|
280 | $this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); |
---|
281 | $this->link_tpl->set_var('lang_view',lang('View this entry')); |
---|
282 | $this->link_tpl->set_var('desc', $textdesc); |
---|
283 | $this->link_tpl->set_var('location', $textlocation); |
---|
284 | $this->link_tpl->parse('picture','link_open',True); |
---|
285 | } |
---|
286 | if (!$is_private) |
---|
287 | { |
---|
288 | if($event['priority'] == 3) |
---|
289 | { |
---|
290 | $picture[] = Array( |
---|
291 | 'pict' => $GLOBALS['phpgw']->common->image('calendar','high'), |
---|
292 | 'width' => 16, |
---|
293 | 'height'=> 16, |
---|
294 | 'title' => lang('high priority') |
---|
295 | ); |
---|
296 | } |
---|
297 | if($event['recur_type'] == MCAL_RECUR_NONE) |
---|
298 | { |
---|
299 | $picture[] = Array( |
---|
300 | 'pict' => $GLOBALS['phpgw']->common->image('calendar','circle'), |
---|
301 | 'width' => 9, |
---|
302 | 'height'=> 9, |
---|
303 | 'title' => lang('single event') |
---|
304 | ); |
---|
305 | } |
---|
306 | else |
---|
307 | { |
---|
308 | $picture[] = Array( |
---|
309 | 'pict' => $GLOBALS['phpgw']->common->image('calendar','recur'), |
---|
310 | 'width' => 12, |
---|
311 | 'height'=> 12, |
---|
312 | 'title' => lang('recurring event') |
---|
313 | ); |
---|
314 | } |
---|
315 | } |
---|
316 | |
---|
317 | |
---|
318 | foreach($event as $dato) |
---|
319 | |
---|
320 | |
---|
321 | |
---|
322 | |
---|
323 | $participants = $this->planner_participants($event['participants']); |
---|
324 | |
---|
325 | if(count($event['participants']) > 1) |
---|
326 | { |
---|
327 | $picture[] = Array( |
---|
328 | 'pict' => $GLOBALS['phpgw']->common->image('calendar','multi_3'), |
---|
329 | 'width' => 14, |
---|
330 | 'height'=> 14, |
---|
331 | 'title' => $participants |
---|
332 | ); |
---|
333 | } |
---|
334 | else |
---|
335 | { |
---|
336 | $picture[] = Array( |
---|
337 | 'pict' => $GLOBALS['phpgw']->common->image('calendar','single'), |
---|
338 | 'width' => 14, |
---|
339 | 'height'=> 14, |
---|
340 | 'title' => $participants |
---|
341 | ); |
---|
342 | } |
---|
343 | if($event['public'] == 0) |
---|
344 | { |
---|
345 | $picture[] = Array( |
---|
346 | 'pict' => $GLOBALS['phpgw']->common->image('calendar','private'), |
---|
347 | 'width' => 13, |
---|
348 | 'height'=> 13, |
---|
349 | 'title' => lang('private') |
---|
350 | ); |
---|
351 | } |
---|
352 | if(@isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) |
---|
353 | { |
---|
354 | // if the alarm is to go off the day before the event |
---|
355 | // the icon does not show up because of 'alarm_today' |
---|
356 | // - TOM |
---|
357 | if($this->bo->alarm_today($event,$rawdate_offset,$starttime)) |
---|
358 | { |
---|
359 | $picture[] = Array( |
---|
360 | 'pict' => $GLOBALS['phpgw']->common->image('calendar','alarm'), |
---|
361 | 'width' => 13, |
---|
362 | 'height'=> 13, |
---|
363 | 'title' => lang('alarm') |
---|
364 | ); |
---|
365 | } |
---|
366 | } |
---|
367 | |
---|
368 | $description = $this->bo->get_short_field($event,$is_private,'description'); |
---|
369 | for($i=0;$i<count($picture);$i++) |
---|
370 | { |
---|
371 | $var = Array( |
---|
372 | 'pic_image' => $picture[$i]['pict'], |
---|
373 | 'width' => $picture[$i]['width'], |
---|
374 | 'height' => $picture[$i]['height'], |
---|
375 | 'title' => $picture[$i]['title'] |
---|
376 | ); |
---|
377 | $this->output_template_array($this->link_tpl,'picture','pict',$var); |
---|
378 | } |
---|
379 | if ($texttitle) |
---|
380 | { |
---|
381 | $var = Array( |
---|
382 | 'text' => $text, |
---|
383 | 'time'=> $texttime, |
---|
384 | 'title'=> $texttitle, |
---|
385 | 'users_status'=>$textstatus, |
---|
386 | 'desc'=> 'dessccccc'.$textdesc, |
---|
387 | 'location'=> "<br><b>Local:</b> ".$textlocation |
---|
388 | ); |
---|
389 | $this->output_template_array($this->link_tpl,'picture','link_text',$var); |
---|
390 | } |
---|
391 | |
---|
392 | if ($viewable) |
---|
393 | { |
---|
394 | $this->link_tpl->parse('picture','link_close',True); |
---|
395 | } |
---|
396 | $str = $this->link_tpl->fp('out','link_pict'); |
---|
397 | $this->link_tpl->set_var('picture',''); |
---|
398 | $this->link_tpl->set_var('out',''); |
---|
399 | unset($p); |
---|
400 | return $str; |
---|
401 | } |
---|
402 | |
---|
403 | |
---|
404 | |
---|
405 | function planner_participants($parts) |
---|
406 | { |
---|
407 | static $id2lid; |
---|
408 | |
---|
409 | $names = ''; |
---|
410 | while (list($id,$status) = each($parts)) |
---|
411 | { |
---|
412 | $status = substr($this->bo->get_long_status($status),0,1); |
---|
413 | |
---|
414 | if (!isset($id2lid[$id])) |
---|
415 | { |
---|
416 | $id2lid[$id] = $GLOBALS['phpgw']->common->grab_owner_name($id); |
---|
417 | } |
---|
418 | if (strlen($names)) |
---|
419 | { |
---|
420 | $names .= ",\n"; |
---|
421 | } |
---|
422 | $names .= $id2lid[$id]." ($status)"; |
---|
423 | } |
---|
424 | if($this->debug) |
---|
425 | { |
---|
426 | echo '<!-- Inside participants() : '.$names.' -->'."\n"; |
---|
427 | } |
---|
428 | return $names; |
---|
429 | } |
---|
430 | |
---|
431 | |
---|
432 | function view($vcal_id=0,$cal_date=0) |
---|
433 | { |
---|
434 | |
---|
435 | |
---|
436 | |
---|
437 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
438 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
439 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['infolog']['title'].' - '.lang('View'); |
---|
440 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
441 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
442 | |
---|
443 | $cal_id = get_var('info_id',array('GET','POST'),$vcal_id); |
---|
444 | |
---|
445 | $date = $cal_date ? $cal_date : 0; |
---|
446 | $date = $date ? $date : (int)$_GET['date']; |
---|
447 | |
---|
448 | // First, make sure they have permission to this entry |
---|
449 | if ($cal_id < 1) |
---|
450 | { |
---|
451 | echo '<center>'.lang('Invalid entry id.').'</center>'."\n"; |
---|
452 | $GLOBALS['phpgw']->common->phpgw_exit(True); |
---|
453 | } |
---|
454 | |
---|
455 | if(!$this->bo->check_perms(PHPGW_ACL_READ,$cal_id)) |
---|
456 | { |
---|
457 | echo '<center>'.lang('You do not have permission to read this record!').'</center>'."\n"; |
---|
458 | $GLOBALS['phpgw']->common->phpgw_exit(True); |
---|
459 | } |
---|
460 | |
---|
461 | $event = $this->bo->read_entry($cal_id); |
---|
462 | |
---|
463 | if(!isset($event['id'])) |
---|
464 | { |
---|
465 | echo '<center>'.lang('Sorry, this event does not exist').'.'.'</center>'."\n"; |
---|
466 | $GLOBALS['phpgw']->common->phpgw_exit(True); |
---|
467 | } |
---|
468 | |
---|
469 | $this->bo->repeating_events = Array(); |
---|
470 | $this->bo->cached_events = Array(); |
---|
471 | $this->bo->repeating_events[0] = $event; |
---|
472 | $datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $GLOBALS['phpgw']->datetime->tz_offset; |
---|
473 | $this->bo->check_repeating_events($datetime); |
---|
474 | $check_date = $GLOBALS['phpgw']->common->show_date($datetime,'Ymd'); |
---|
475 | if(is_array($this->bo->cached_events[$check_date][0]) && |
---|
476 | $this->bo->cached_events[$check_date][0]['id'] == $event['id']) |
---|
477 | { |
---|
478 | $starttime = $this->bo->maketime($event['start']); |
---|
479 | $endtime = $this->bo->maketime($event['end']); |
---|
480 | $event['start']['month'] = $this->bo->month; |
---|
481 | $event['start']['mday'] = $this->bo->day; |
---|
482 | $event['start']['year'] = $this->bo->year; |
---|
483 | $temp_end = $this->bo->maketime($event['start']) + ($endtime - $starttime); |
---|
484 | $event['end']['month'] = date('m',$temp_end); |
---|
485 | $event['end']['mday'] = date('d',$temp_end); |
---|
486 | $event['end']['year'] = date('Y',$temp_end); |
---|
487 | } |
---|
488 | |
---|
489 | if(!$this->view_event($event,True)) |
---|
490 | { |
---|
491 | echo '<center>'.lang('You do not have permission to read this record!').'</center>'; |
---|
492 | $GLOBALS['phpgw']->common->phpgw_exit(True); |
---|
493 | } |
---|
494 | |
---|
495 | $p = $GLOBALS['phpgw']->template; |
---|
496 | $p->set_file( |
---|
497 | Array( |
---|
498 | 'form_button' => 'form_button_script.tpl' |
---|
499 | ) |
---|
500 | ); |
---|
501 | |
---|
502 | $button_left = $button_center = $button_right = ''; |
---|
503 | |
---|
504 | if($this->bo->check_perms(PHPGW_ACL_EDIT,$event)) |
---|
505 | { |
---|
506 | if($event['recur_type'] != MCAL_RECUR_NONE) |
---|
507 | { |
---|
508 | $var = Array( |
---|
509 | 'action_url_button' => $this->page('edit','&cal_id='.$cal_id), |
---|
510 | 'action_text_button' => lang('Edit Single'), |
---|
511 | 'action_confirm_button' => '', |
---|
512 | 'action_extra_field' => $this->html->input_hidden(array( |
---|
513 | 'edit_type' => 'single', |
---|
514 | 'date' => sprintf('%04d%02d%02d',$this->bo->year,$this->bo->month,$this->bo->day) |
---|
515 | )) |
---|
516 | ); |
---|
517 | $p->set_var($var); |
---|
518 | $button_left .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
519 | |
---|
520 | $var = Array( |
---|
521 | 'action_url_button' => $this->page('edit','&cal_id='.$cal_id), |
---|
522 | 'action_text_button' => lang('Edit Series'), |
---|
523 | 'action_confirm_button' => '', |
---|
524 | 'action_extra_field' => $this->html->input_hidden('edit_type','series') |
---|
525 | ); |
---|
526 | $p->set_var($var); |
---|
527 | $button_left .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
528 | } |
---|
529 | else |
---|
530 | { |
---|
531 | $var = Array( |
---|
532 | 'action_url_button' => $this->page('edit','&cal_id='.$cal_id), |
---|
533 | 'action_text_button' => lang('Edit'), |
---|
534 | 'action_confirm_button' => '', |
---|
535 | 'action_extra_field' => '' |
---|
536 | ); |
---|
537 | $p->set_var($var); |
---|
538 | $button_left .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
539 | } |
---|
540 | |
---|
541 | $var = Array( |
---|
542 | 'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uialarm.manager'), |
---|
543 | 'action_text_button' => lang('Alarm Management'), |
---|
544 | 'action_confirm_button' => '', |
---|
545 | 'action_extra_field' => $this->html->input_hidden(array( |
---|
546 | 'cal_id' => $cal_id, |
---|
547 | 'return_to' => $this->bo->return_to |
---|
548 | )) |
---|
549 | ); |
---|
550 | $p->set_var($var); |
---|
551 | $button_center .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
552 | } |
---|
553 | |
---|
554 | if ($this->bo->check_perms(PHPGW_ACL_DELETE,$event)) |
---|
555 | { |
---|
556 | if($event['recur_type'] != MCAL_RECUR_NONE) |
---|
557 | { |
---|
558 | $var = Array( |
---|
559 | 'action_url_button' => $this->page('delete','&cal_id='.$cal_id), |
---|
560 | 'action_text_button' => lang('Delete Single'), |
---|
561 | 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this single occurence?\\nThis will delete this entry for all users.')."')\"", |
---|
562 | 'action_extra_field' => $this->html->input_hidden(array( |
---|
563 | 'delete_type' => 'single', |
---|
564 | 'date' => sprintf('%04d%02d%02d',$this->bo->year,$this->bo->month,$this->bo->day) |
---|
565 | )) |
---|
566 | ); |
---|
567 | $p->set_var($var); |
---|
568 | $button_right .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
569 | |
---|
570 | $var = Array( |
---|
571 | 'action_url_button' => $this->page('delete','&cal_id='.$cal_id), |
---|
572 | 'action_text_button' => lang('Delete Series'), |
---|
573 | 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"", |
---|
574 | 'action_extra_field' => $this->html->input_hidden('delete_type','series') |
---|
575 | ); |
---|
576 | $p->set_var($var); |
---|
577 | $button_right .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
578 | |
---|
579 | if($event['recur_exception']) |
---|
580 | { |
---|
581 | $var = Array( |
---|
582 | 'action_url_button' => $this->page('reinstate_list','&cal_id='.$cal_id), |
---|
583 | 'action_text_button' => lang('Reinstate'), |
---|
584 | 'action_confirm_button' => '', |
---|
585 | 'action_extra_field' => '' |
---|
586 | ); |
---|
587 | $p->set_var($var); |
---|
588 | $button_center .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
589 | } |
---|
590 | } |
---|
591 | else |
---|
592 | { |
---|
593 | $var = Array( |
---|
594 | 'action_url_button' => $this->page('delete','&cal_id='.$cal_id), |
---|
595 | 'action_text_button' => lang('Delete'), |
---|
596 | 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"", |
---|
597 | 'action_extra_field' => '' |
---|
598 | ); |
---|
599 | $p->set_var($var); |
---|
600 | $button_right .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
601 | } |
---|
602 | } |
---|
603 | else |
---|
604 | { |
---|
605 | // allow me (who I am logged in as) to set up an alarm |
---|
606 | // if I am a participant, but not the owner |
---|
607 | reset($event['participants']); |
---|
608 | while (list($user,$short_status) = each($event['participants'])) |
---|
609 | { |
---|
610 | if ($GLOBALS['phpgw_info']['user']['account_id'] == $user) |
---|
611 | { |
---|
612 | $var = Array( |
---|
613 | 'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uialarm.manager'), |
---|
614 | 'action_text_button' => lang('Alarm Management'), |
---|
615 | 'action_confirm_button' => '', |
---|
616 | 'action_extra_field' => $this->html->input_hidden(array( |
---|
617 | 'cal_id' => $cal_id, |
---|
618 | 'return_to' => $this->bo->return_to |
---|
619 | )) |
---|
620 | ); |
---|
621 | $p->set_var($var); |
---|
622 | echo $p->fp('out','form_button'); |
---|
623 | } |
---|
624 | } |
---|
625 | } |
---|
626 | |
---|
627 | $var = Array( |
---|
628 | 'action_url_button' => $this->page('export'), |
---|
629 | 'action_text_button' => lang('Export'), |
---|
630 | 'action_confirm_button' => '', |
---|
631 | 'action_extra_field' => $this->html->input_hidden('cal_id',$cal_id) |
---|
632 | ); |
---|
633 | $p->set_var($var); |
---|
634 | $button_center .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
635 | |
---|
636 | if ($this->bo->return_to) |
---|
637 | { |
---|
638 | $var = Array( |
---|
639 | 'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to), |
---|
640 | 'action_text_button' => lang('Done'), |
---|
641 | 'action_confirm_button' => '', |
---|
642 | 'action_extra_field' => '' |
---|
643 | ); |
---|
644 | $p->set_var($var); |
---|
645 | $button_left .= '<td>'.$p->fp('button','form_button').'</td>'; |
---|
646 | } |
---|
647 | $p->set_var(array( |
---|
648 | 'button_left' => $button_left, |
---|
649 | 'button_center' => $button_center, |
---|
650 | 'button_right' => $button_right |
---|
651 | )); |
---|
652 | $p->pfp('phpgw_body','view_event'); |
---|
653 | |
---|
654 | $GLOBALS['phpgw']->hooks->process(array( |
---|
655 | 'location' => 'calendar_view', |
---|
656 | 'cal_id' => $cal_id |
---|
657 | )); |
---|
658 | |
---|
659 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
660 | } |
---|