[2] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare - Calendar * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * Based on Webcalendar by Craig Knudsen <cknudsen@radix.net> * |
---|
| 6 | * http://www.radix.net/~cknudsen * |
---|
| 7 | * Modified by Mark Peters <skeeter@phpgroupware.org> * |
---|
| 8 | * -------------------------------------------- * |
---|
| 9 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 10 | * under the terms of the GNU General Public License as published by the * |
---|
| 11 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 12 | * option) any later version. * |
---|
| 13 | \**************************************************************************/ |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | class uiicalendar |
---|
| 17 | { |
---|
| 18 | var $bo; |
---|
[5132] | 19 | // var $ui; |
---|
[2] | 20 | var $template; |
---|
| 21 | |
---|
| 22 | var $public_functions = array( |
---|
| 23 | 'test' => True, |
---|
[620] | 24 | 'import' => True, |
---|
| 25 | 'import_from_mail' => True |
---|
[2] | 26 | ); |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | function uiicalendar() |
---|
| 31 | { |
---|
| 32 | $this->bo = CreateObject('calendar.boicalendar'); |
---|
[5132] | 33 | // $this->ui = CreateObject('calendar.uicalendar'); |
---|
| 34 | |
---|
[2] | 35 | $this->template = $GLOBALS['phpgw']->template; |
---|
| 36 | $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Calendar - [iv]Cal Importer'); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | function print_test($val,$title,$x_pre='') |
---|
| 40 | { |
---|
| 41 | // echo 'VAL = '._debug_array($val,False)."<br>\n"; |
---|
| 42 | if(is_array($val)) |
---|
| 43 | { |
---|
| 44 | @reset($val); |
---|
| 45 | while(list($key,$value) = each($val)) |
---|
| 46 | { |
---|
| 47 | if(is_array($key)) |
---|
| 48 | { |
---|
| 49 | $this->print_test($key,$title,$x_pre); |
---|
| 50 | } |
---|
| 51 | elseif(is_array($value)) |
---|
| 52 | { |
---|
| 53 | $this->print_test($value,$title,$x_pre); |
---|
| 54 | } |
---|
| 55 | else |
---|
| 56 | { |
---|
| 57 | if($x_pre && $key == 'name') |
---|
| 58 | { |
---|
| 59 | $x_key = $x_pre.$value; |
---|
| 60 | list($key,$value) = each($val); |
---|
| 61 | $key=$x_key; |
---|
| 62 | } |
---|
| 63 | if($this->bo->parameter[$key]['type'] == 'function') |
---|
| 64 | { |
---|
| 65 | $function = $this->bo->parameter[$key]['function']; |
---|
| 66 | $v_value = $this->bo->$function($value); |
---|
| 67 | } |
---|
| 68 | else |
---|
| 69 | { |
---|
| 70 | $v_value = $value; |
---|
| 71 | } |
---|
| 72 | echo $title.' ('.$key.') = '.$v_value."<br>\n"; |
---|
| 73 | } |
---|
| 74 | } |
---|
| 75 | } |
---|
| 76 | elseif($val != '') |
---|
| 77 | { |
---|
| 78 | echo $title.' = '.$val."<br>\n"; |
---|
| 79 | } |
---|
| 80 | } |
---|
| 81 | |
---|
[5132] | 82 | function import_from_mail($calendar, $from_ajax, $importAccount = false) { |
---|
| 83 | return $this->bo->import(explode("\n",$calendar),$from_ajax,$importAccount); |
---|
[620] | 84 | } |
---|
[3736] | 85 | |
---|
[620] | 86 | |
---|
[2] | 87 | function import() |
---|
| 88 | { |
---|
| 89 | unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 90 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
| 91 | $GLOBALS['phpgw_info']['flags']['nonappheader'] = True; |
---|
| 92 | $GLOBALS['phpgw_info']['flags']['nonappfooter'] = True; |
---|
| 93 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 94 | |
---|
| 95 | if(!@is_dir($GLOBALS['phpgw_info']['server']['temp_dir'])) |
---|
| 96 | { |
---|
| 97 | mkdir($GLOBALS['phpgw_info']['server']['temp_dir'],0700); |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | echo '<body bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color'] . '">'; |
---|
| 101 | |
---|
| 102 | if ($GLOBALS['HTTP_GET_VARS']['action'] == 'GetFile') |
---|
| 103 | { |
---|
| 104 | echo '<b><center>' . lang('You must select a [iv]Cal. (*.[iv]cs)') . '</b></center><br><br>'; |
---|
| 105 | } |
---|
| 106 | |
---|
[5132] | 107 | $this->template->set_file( |
---|
| 108 | Array( |
---|
| 109 | 'vcalimport' => 'vcal_import.tpl' |
---|
| 110 | ) |
---|
| 111 | ); |
---|
[3736] | 112 | |
---|
[2] | 113 | $var = Array( |
---|
| 114 | 'vcal_header' => '<p>', |
---|
| 115 | 'ical_lang' => lang('(i/v)Cal'), |
---|
[5132] | 116 | 'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.boicalendar.import&calendarImport=1'), |
---|
[2] | 117 | 'lang_access' => lang('Access'), |
---|
| 118 | 'lang_groups' => lang('Which groups'), |
---|
| 119 | 'access_option'=> $access_option, |
---|
| 120 | 'group_option' => $group_option, |
---|
| 121 | 'load_vcal' => lang('Load [iv]Cal') |
---|
| 122 | ); |
---|
| 123 | $this->template->set_var($var); |
---|
[5132] | 124 | $this->template->pparse('out','vcalimport'); |
---|
[2] | 125 | } |
---|
| 126 | } |
---|
| 127 | ?> |
---|