source: companies/celepar/calendar/inc/class.socalendar__.inc.php @ 763

Revision 763, 5.5 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

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        if (@$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'])
17        {
18                return;
19        }
20
21        $GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'] = True;
22
23        /*      include(PHPGW_SERVER_ROOT.'/calendar/setup/setup.inc.php');     */
24
25        if(extension_loaded('mcal') == False)
26        {
27                define('MCAL_RECUR_NONE',0);
28                define('MCAL_RECUR_DAILY',1);
29                define('MCAL_RECUR_WEEKLY',2);
30                define('MCAL_RECUR_MONTHLY_MDAY',3);
31                define('MCAL_RECUR_MONTHLY_WDAY',4);
32                define('MCAL_RECUR_YEARLY',5);
33               
34                define('MCAL_M_SUNDAY',1);
35                define('MCAL_M_MONDAY',2);
36                define('MCAL_M_TUESDAY',4);
37                define('MCAL_M_WEDNESDAY',8);
38                define('MCAL_M_THURSDAY',16);
39                define('MCAL_M_FRIDAY',32);
40                define('MCAL_M_SATURDAY',64);
41               
42                define('MCAL_M_WEEKDAYS',62);
43                define('MCAL_M_WEEKEND',65);
44                define('MCAL_M_ALLDAYS',127);
45        }
46
47        define('MSG_DELETED',0);
48        define('MSG_MODIFIED',1);
49        define('MSG_ADDED',2);
50        define('MSG_REJECTED',3);
51        define('MSG_TENTATIVE',4);
52        define('MSG_ACCEPTED',5);
53        define('MSG_ALARM',6);
54
55        define('REJECTED',0);
56        define('NO_RESPONSE',1);
57        define('TENTATIVE',2);
58        define('ACCEPTED',3);
59
60        class socalendar__
61        {
62                var $event;
63                var $stream;
64                var $user;
65                var $users_status;
66                var $debug = False;
67        //      var $debug = True;
68
69                function socalendar__()
70                {
71                }
72
73                function maketime($time)
74                {
75                        return mktime($time['hour'],$time['min'],$time['sec'],$time['month'],$time['mday'],$time['year']);
76                }
77
78                function get_cached_event()
79                {
80                        return $this->event;
81                }
82
83                function event_init()
84                {
85                        $this->event = Array();
86                        $this->add_attribute('owner',(int)$this->user);
87                }
88
89                function set_category($category='')
90                {
91                        $this->add_attribute('category',$category);
92                }
93
94                function set_title($title='')
95                {
96                        $this->add_attribute('title',$title);
97                }
98
99                function set_description($description='')
100                {
101                        $this->add_attribute('description',$description);
102                }
103
104                function set_ex_participants($ex_participants='')
105                {
106                        $this->add_attribute('ex_participants',$ex_participants);
107                }
108
109                function set_date($element,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
110                {
111                        $this->add_attribute($element,(int)$year,'year');
112                        $this->add_attribute($element,(int)$month,'month');
113                        $this->add_attribute($element,(int)$day,'mday');
114                        $this->add_attribute($element,(int)$hour,'hour');
115                        $this->add_attribute($element,(int)$min,'min');
116                        $this->add_attribute($element,(int)$sec,'sec');
117                        $this->add_attribute($element,0,'alarm');
118                }
119
120                function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
121                {
122                        $this->set_date('start',$year,$month,$day,$hour,$min,$sec);
123                }
124
125                function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
126                {
127                        $this->set_date('end',$year,$month,$day,$hour,$min,$sec);
128                }
129
130                function set_alarm($alarm)
131                {
132                        $this->add_attribute('alarm',(int)$alarm);
133                }
134
135                function set_class($class)
136                {
137                        $this->add_attribute('public',$class);
138                }
139
140                function set_common_recur($year=0,$month=0,$day=0,$interval=0)
141                {
142                        $this->add_attribute('recur_interval',(int)$interval);
143                        $this->set_date('recur_enddate',$year,$month,$day,0,0,0);
144                        $this->add_attribute('recur_data',0);
145                }
146
147                function set_recur_none()
148                {
149                        $this->set_common_recur(0,0,0,0);
150                        $this->add_attribute('recur_type',MCAL_RECUR_NONE);
151                }
152
153                function set_recur_daily($year,$month,$day,$interval)
154                {
155                        $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
156                        $this->add_attribute('recur_type',MCAL_RECUR_DAILY);
157                }
158
159                function set_recur_weekly($year,$month,$day,$interval,$weekdays)
160                {
161                        $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
162                        $this->add_attribute('recur_type',MCAL_RECUR_WEEKLY);
163                        $this->add_attribute('recur_data',(int)$weekdays);
164                }
165
166                function set_recur_monthly_mday($year,$month,$day,$interval)
167                {
168                        $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
169                        $this->add_attribute('recur_type',MCAL_RECUR_MONTHLY_MDAY);
170                }
171               
172                function set_recur_monthly_wday($year,$month,$day,$interval)
173                {
174                        $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
175                        $this->add_attribute('recur_type',MCAL_RECUR_MONTHLY_WDAY);
176                }
177               
178                function set_recur_yearly($year,$month,$day,$interval)
179                {
180                        $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
181                        $this->add_attribute('recur_type',MCAL_RECUR_YEARLY);
182                }
183
184                function fetch_current_stream_event()
185                {
186                        return $this->fetch_event($this->event['id']);
187                }
188               
189                function add_attribute($attribute,$value,$element='**(**')
190                {
191                        if(is_array($value))
192                        {
193                                reset($value);
194                        }
195                        if($element!='**(**')
196                        {
197                                $this->event[$attribute][$element] = $value;
198                        }
199                        else
200                        {
201                                $this->event[$attribute] = $value;
202                        }
203                }
204        }
Note: See TracBrowser for help on using the repository browser.