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

Revision 60, 3.4 KB checked in by niltonneto, 17 years ago (diff)

* empty log message *

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