[3594] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare - infolog * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * Based on Webinfolog 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']['soinfolog__']) |
---|
| 17 | { |
---|
| 18 | return; |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | $GLOBALS['phpgw_info']['flags']['included_classes']['soinfolog__'] = True; |
---|
| 22 | |
---|
| 23 | /* include(PHPGW_SERVER_ROOT.'/infolog/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 soinfolog__ |
---|
| 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 soinfolog__() |
---|
| 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_description1($description1='') |
---|
| 105 | { |
---|
| 106 | $this->add_attribute('description1',$description1); |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | function set_participants1($participants1='') |
---|
| 110 | { |
---|
| 111 | $this->add_attribute('participants1',$participants1); |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | function set_ex_participants($ex_participants='') |
---|
| 115 | { |
---|
| 116 | $this->add_attribute('ex_participants',$ex_participants); |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | function set_date($element,$year,$month,$day=0,$hour=0,$min=0,$sec=0) |
---|
| 120 | { |
---|
| 121 | $this->add_attribute($element,(int)$year,'year'); |
---|
| 122 | $this->add_attribute($element,(int)$month,'month'); |
---|
| 123 | $this->add_attribute($element,(int)$day,'mday'); |
---|
| 124 | $this->add_attribute($element,(int)$hour,'hour'); |
---|
| 125 | $this->add_attribute($element,(int)$min,'min'); |
---|
| 126 | $this->add_attribute($element,(int)$sec,'sec'); |
---|
| 127 | $this->add_attribute($element,0,'alarm'); |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0) |
---|
| 131 | { |
---|
| 132 | $this->set_date('start',$year,$month,$day,$hour,$min,$sec); |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0) |
---|
| 136 | { |
---|
| 137 | $this->set_date('end',$year,$month,$day,$hour,$min,$sec); |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | function set_alarm($alarm) |
---|
| 141 | { |
---|
| 142 | $this->add_attribute('alarm',(int)$alarm); |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | function set_class($class) |
---|
| 146 | { |
---|
| 147 | $this->add_attribute('public',$class); |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | function set_common_recur($year=0,$month=0,$day=0,$interval=0) |
---|
| 151 | { |
---|
| 152 | $this->add_attribute('recur_interval',(int)$interval); |
---|
| 153 | $this->set_date('recur_enddate',$year,$month,$day,0,0,0); |
---|
| 154 | $this->add_attribute('recur_data',0); |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | function set_recur_none() |
---|
| 158 | { |
---|
| 159 | $this->set_common_recur(0,0,0,0); |
---|
| 160 | $this->add_attribute('recur_type',MCAL_RECUR_NONE); |
---|
| 161 | } |
---|
| 162 | |
---|
| 163 | function set_recur_daily($year,$month,$day,$interval) |
---|
| 164 | { |
---|
| 165 | $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval); |
---|
| 166 | $this->add_attribute('recur_type',MCAL_RECUR_DAILY); |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | function set_recur_weekly($year,$month,$day,$interval,$weekdays) |
---|
| 170 | { |
---|
| 171 | $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval); |
---|
| 172 | $this->add_attribute('recur_type',MCAL_RECUR_WEEKLY); |
---|
| 173 | $this->add_attribute('recur_data',(int)$weekdays); |
---|
| 174 | } |
---|
| 175 | |
---|
| 176 | function set_recur_monthly_mday($year,$month,$day,$interval) |
---|
| 177 | { |
---|
| 178 | $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval); |
---|
| 179 | $this->add_attribute('recur_type',MCAL_RECUR_MONTHLY_MDAY); |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | function set_recur_monthly_wday($year,$month,$day,$interval) |
---|
| 183 | { |
---|
| 184 | $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval); |
---|
| 185 | $this->add_attribute('recur_type',MCAL_RECUR_MONTHLY_WDAY); |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | function set_recur_yearly($year,$month,$day,$interval) |
---|
| 189 | { |
---|
| 190 | $this->set_common_recur((int)$year,(int)$month,(int)$day,$interval); |
---|
| 191 | $this->add_attribute('recur_type',MCAL_RECUR_YEARLY); |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | function fetch_current_stream_event() |
---|
| 195 | { |
---|
| 196 | return $this->fetch_event($this->event['id']); |
---|
| 197 | } |
---|
| 198 | |
---|
| 199 | function add_attribute($attribute,$value,$element='**(**') |
---|
| 200 | { |
---|
| 201 | if(is_array($value)) |
---|
| 202 | { |
---|
| 203 | reset($value); |
---|
| 204 | } |
---|
| 205 | if($element!='**(**') |
---|
| 206 | { |
---|
| 207 | $this->event[$attribute][$element] = $value; |
---|
| 208 | } |
---|
| 209 | else |
---|
| 210 | { |
---|
| 211 | $this->event[$attribute] = $value; |
---|
| 212 | } |
---|
| 213 | } |
---|
| 214 | } |
---|