source: trunk/calendar/inc/class.uiicalendar.inc.php @ 678

Revision 678, 3.5 KB checked in by niltonneto, 15 years ago (diff)

IMportação de compromisso pelo Expressomail.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
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;
19                var $template;
20
21                var $public_functions = array(
22                        'test'          => True,
23                        'import'                => True,
24                        'import_from_mail' => True
25                );
26
27
28
29                function uiicalendar()
30                {
31                        $this->bo = CreateObject('calendar.boicalendar');
32                        $this->template = $GLOBALS['phpgw']->template;
33                        $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Calendar - [iv]Cal Importer');
34                }
35
36                function print_test($val,$title,$x_pre='')
37                {
38//                      echo 'VAL = '._debug_array($val,False)."<br>\n";
39                        if(is_array($val))
40                        {
41                                @reset($val);
42                                while(list($key,$value) = each($val))
43                                {
44                                        if(is_array($key))
45                                        {
46                                                $this->print_test($key,$title,$x_pre);
47                                        }
48                                        elseif(is_array($value))
49                                        {
50                                                $this->print_test($value,$title,$x_pre);
51                                        }
52                                        else
53                                        {
54                                                if($x_pre && $key == 'name')
55                                                {
56                                                        $x_key = $x_pre.$value;
57                                                        list($key,$value) = each($val);
58                                                        $key=$x_key;
59                                                }
60                                                if($this->bo->parameter[$key]['type'] == 'function')
61                                                {
62                                                        $function = $this->bo->parameter[$key]['function'];
63                                                        $v_value = $this->bo->$function($value);
64                                                }
65                                                else
66                                                {
67                                                        $v_value = $value;
68                                                }
69                                                echo $title.' ('.$key.') = '.$v_value."<br>\n";
70                                        }
71                                }
72                        }
73                        elseif($val != '')
74                        {
75                                echo $title.' = '.$val."<br>\n";
76                        }
77                }
78
79                function import_from_mail($calendar) {
80                        return $this->bo->import(explode("\n",$calendar),true);
81                }
82
83
84                function import()
85                {
86                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
87                        unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
88                        $GLOBALS['phpgw_info']['flags']['nonappheader'] = True;
89                        $GLOBALS['phpgw_info']['flags']['nonappfooter'] = True;
90                        $GLOBALS['phpgw']->common->phpgw_header();
91
92                        if(!@is_dir($GLOBALS['phpgw_info']['server']['temp_dir']))
93                        {
94                                mkdir($GLOBALS['phpgw_info']['server']['temp_dir'],0700);
95                        }
96
97                        echo '<body bgcolor="' . $GLOBALS['phpgw_info']['theme']['bg_color'] . '">';
98
99                        if ($GLOBALS['HTTP_GET_VARS']['action'] == 'GetFile')
100                        {
101                                echo '<b><center>' . lang('You must select a [iv]Cal. (*.[iv]cs)') . '</b></center><br><br>';
102                        }
103
104                        $this->template->set_file(
105                                Array(
106                                        'vcalimport' => 'vcal_import.tpl'
107                                )
108                        );
109
110                        $var = Array(
111                                'vcal_header'   => '<p>',
112                                'ical_lang'             => lang('(i/v)Cal'),
113                                'action_url'    => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.boicalendar.import'),
114                                'lang_access'   => lang('Access'),
115                                'lang_groups'   => lang('Which groups'),
116                                'access_option'=> $access_option,
117                                'group_option'  => $group_option,
118                                'load_vcal'     => lang('Load [iv]Cal')
119                        );
120                        $this->template->set_var($var);
121                        $this->template->pparse('out','vcalimport');
122                }
123        }
124?>
Note: See TracBrowser for help on using the repository browser.