diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index f67ed0bd90..b00abba05c 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -1808,6 +1808,11 @@ return $icalendar->build_ical($ical); } + function get_alarms($event_id) + { + return $this->so->get_alarm($event_id); + } + function prepare_recipients(&$new_event,$old_event) { // Find modified and deleted users..... diff --git a/calendar/inc/class.socalendar.inc.php b/calendar/inc/class.socalendar.inc.php index 839e8cbc1b..23580db049 100755 --- a/calendar/inc/class.socalendar.inc.php +++ b/calendar/inc/class.socalendar.inc.php @@ -59,7 +59,6 @@ function list_events($startYear,$startMonth,$startDay,$endYear=0,$endMonth=0,$endDay=0) { - $this->makeobj(); $extra = ''; $extra .= (strpos($this->filter,'private')?'AND phpgw_cal.is_public=0 ':''); $extra .= ($this->cat_id?'AND phpgw_cal.category = '.$this->cat_id.' ':''); @@ -73,7 +72,6 @@ return Array(); } - $this->makeobj(); $starttime = mktime(0,0,0,$smonth,$sday,$syear) - $this->datetime->tz_offset; $endtime = mktime(23,59,59,$emonth,$eday,$eyear) - $this->datetime->tz_offset; // $starttime = mktime(0,0,0,$smonth,$sday,$syear); @@ -99,8 +97,6 @@ function list_events_keyword($keywords) { - $this->makeobj(); - $sql = 'AND (phpgw_cal_user.cal_login='.$this->owner.') '; $words = split(' ',$keywords); @@ -132,31 +128,26 @@ function get_event_ids($include_repeats=False, $sql='') { - $this->makeobj(); return $this->cal->get_event_ids($include_repeats,$sql); } function add_entry(&$event) { - $this->makeobj(); $this->cal->store_event($event); } function delete_entry($id) { - $this->makeobj(); $this->cal->delete_event($id); } function expunge() { - $this->makeobj(); $this->cal->expunge(); } function delete_calendar($owner) { - $this->makeobj(); $this->cal->delete_calendar($owner); } @@ -171,10 +162,20 @@ function set_status($id,$status) { - $this->makeobj(); $this->cal->set_status($id,$this->owner,$status); } + function get_alarm($id) + { + if($GLOBALS['phpgw_info']['server']['calendar_type'] == 'sql') + { + return $this->cal->get_alarm($id); + } + else + { + } + } + /* Begin mcal equiv functions */ function get_cached_event() { @@ -188,7 +189,6 @@ function event_init() { - $this->makeobj(); $this->cal->event_init(); } diff --git a/calendar/inc/class.socalendar_sql.inc.php b/calendar/inc/class.socalendar_sql.inc.php index 70784c8614..5c08c82d38 100755 --- a/calendar/inc/class.socalendar_sql.inc.php +++ b/calendar/inc/class.socalendar_sql.inc.php @@ -449,6 +449,24 @@ class socalendar_ extends socalendar__ return True; } + function get_alarm($id) + { + $this->stream->query('SELECT cal_time, cal_text FROM phpgw_cal_alarm WHERE cal_id='.$id,__LINE__,__FILE__); + if($this->stream->num_rows()) + { + while($this->stream->next_record()) + { + $alarm[$this->stream->f('cal_time')] = $this->stream->f('cal_text'); + } + @reset($alarm); + return $alarm; + } + else + { + return False; + } + } + function set_status($id,$owner,$status) { $status_code_short = Array( diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index 6d1cd0c281..615d8fca16 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -2071,6 +2071,7 @@ ); $p->set_block('view','view_event','view_event'); $p->set_block('view','list','list'); + $p->set_block('view','hr','hr'); $var = Array( 'bg_text'=> $this->theme['bg_text'], @@ -2249,6 +2250,27 @@ $this->output_template_array($p,'row','list',$var[$i]); } + if($alarms = $this->bo->get_alarms($event['id'])) + { + $p->set_var('hr_text','
'); + $p->parse('row','hr',True); + $p->set_var('hr_text','
'.lang('Alarms').'

'); + $p->parse('row','hr',True); + + @reset($alarms); + while(list($time,$text) = each($alarms)) + { + $var = Array( + 'field' => $GLOBALS['phpgw']->common->show_date($time), + 'data' => $text + ); + $this->output_template_array($p,'row','list',$var); + } + } + + $p->set_var('hr_text','
'); + $p->parse('row','hr',True); + return $p->fp('out','view_event'); } diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php index 413405be25..ba3eb5701d 100755 --- a/calendar/setup/setup.inc.php +++ b/calendar/setup/setup.inc.php @@ -13,7 +13,7 @@ $setup_info['calendar']['name'] = 'calendar'; $setup_info['calendar']['title'] = 'Calendar'; - $setup_info['calendar']['version'] = '0.9.13.003'; + $setup_info['calendar']['version'] = '0.9.13.004'; $setup_info['calendar']['app_order'] = 3; $setup_info['calendar']['enable'] = 1; @@ -21,7 +21,8 @@ $setup_info['calendar']['tables'][] = 'phpgw_cal_holidays'; $setup_info['calendar']['tables'][] = 'phpgw_cal_repeats'; $setup_info['calendar']['tables'][] = 'phpgw_cal_user'; - + $setup_info['calendar']['tables'][] = 'phpgw_cal_alarm'; + /* The hooks this app includes, needed for hooks registration */ $setup_info['calendar']['hooks'] = array( 'preferences', @@ -29,7 +30,8 @@ 'manual', 'deleteaccount', 'add_def_prefs', - 'email' + 'email', + 'home' ); /* Dependencies for this app to work */ diff --git a/calendar/setup/tables_current.inc.php b/calendar/setup/tables_current.inc.php index 44f43503ea..7261700fc3 100644 --- a/calendar/setup/tables_current.inc.php +++ b/calendar/setup/tables_current.inc.php @@ -73,6 +73,18 @@ 'fk' => array(), 'ix' => array(), 'uc' => array() + ), + 'phpgw_cal_alarm' => array( + 'fd' => array( + 'alarm_id' => array('type' => 'auto','nullable' => False), + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), + 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), + 'cal_text' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False) + ), + 'pk' => array('alarm_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() ) ); ?> diff --git a/calendar/setup/tables_update.inc.php b/calendar/setup/tables_update.inc.php index 0901651c03..d170b16bd1 100644 --- a/calendar/setup/tables_update.inc.php +++ b/calendar/setup/tables_update.inc.php @@ -13,16 +13,14 @@ function calendar_v0_9_2to0_9_3update_owner($table, $field) { - global $phpgw_setup; - - $phpgw_setup->oProc->query("select distinct($field) from $table"); - if ($phpgw_setup->oProc->num_rows()) + $GLOBALS['phpgw_setup']->oProc->query("select distinct($field) from $table"); + if ($GLOBALS['phpgw_setup']->oProc->num_rows()) { - while ($phpgw_setup->oProc->next_record()) + while ($GLOBALS['phpgw_setup']->oProc->next_record()) { - $owner[count($owner)] = $phpgw_setup->oProc->f($field); + $owner[count($owner)] = $GLOBALS['phpgw_setup']->oProc->f($field); } - if($phpgw_setup->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre4')) + if($GLOBALS['phpgw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4')) { $acctstbl = 'accounts'; } @@ -32,178 +30,154 @@ } for($i=0;$ioProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); - $phpgw_setup->oProc->next_record(); - $phpgw_setup->oProc->query("UPDATE $table SET $field=".$phpgw_setup->oProc->f("account_id")." WHERE $field='".$owner[$i]."'"); + $GLOBALS['phpgw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); + $GLOBALS['phpgw_setup']->oProc->next_record(); + $GLOBALS['phpgw_setup']->oProc->query("UPDATE $table SET $field=".$GLOBALS['phpgw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'"); } } - $phpgw_setup->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0)); + $GLOBALS['phpgw_setup']->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0)); } $test[] = '0.9.3pre1'; function calendar_upgrade0_9_3pre1() { - global $setup_info; calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by'); calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login'); - $setup_info['calendar']['currentver'] = '0.9.3pre2'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre2"; function calendar_upgrade0_9_3pre2() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3pre3'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre3"; function calendar_upgrade0_9_3pre3() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3pre4'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre4'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre4"; function calendar_upgrade0_9_3pre4() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3pre5'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre5'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre5"; function calendar_upgrade0_9_3pre5() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3pre6'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre6'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre6"; function calendar_upgrade0_9_3pre6() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3pre7'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre7'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre7"; function calendar_upgrade0_9_3pre7() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3pre8'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre8'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre8"; function calendar_upgrade0_9_3pre8() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3pre9'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre9'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre9"; function calendar_upgrade0_9_3pre9() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3pre10'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre10'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3pre10"; function calendar_upgrade0_9_3pre10() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.3'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.3"; function calendar_upgrade0_9_3() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.4pre1'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.4pre1"; function calendar_upgrade0_9_4pre1() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.4pre2'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.4pre2'; function calendar_upgrade0_9_4pre2() { - global $setup_info, $phpgw_setup; - - $phpgw_setup->oProc->RenameColumn('webcal_entry', 'cal_create_by', 'cal_owner'); - $phpgw_setup->oProc->AlterColumn('webcal_entry', 'cal_owner', array('type' => 'int', 'precision' => 4, 'nullable' => false)); - $setup_info['calendar']['currentver'] = '0.9.4pre3'; - return $setup_info['calendar']['currentver']; + $GLOBALS['phpgw_setup']->oProc->RenameColumn('webcal_entry', 'cal_create_by', 'cal_owner'); + $GLOBALS['phpgw_setup']->oProc->AlterColumn('webcal_entry', 'cal_owner', array('type' => 'int', 'precision' => 4, 'nullable' => false)); + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.4pre3"; function calendar_upgrade0_9_4pre3() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.4pre4'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre4'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.4pre4"; function calendar_upgrade0_9_4pre4() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.4pre5'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre5'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.4pre5"; function calendar_upgrade0_9_4pre5() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.4'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.4"; function calendar_upgrade0_9_4() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.5pre1'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.5pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.5pre1"; function calendar_upgrade0_9_5pre1() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.5pre2'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.5pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.5pre2"; function calendar_upgrade0_9_5pre2() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.5pre3'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.5pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.5"; function calendar_upgrade0_9_5() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.6'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.6'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.6"; function calendar_upgrade0_9_6() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.7pre1'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.7pre1'; function calendar_upgrade0_9_7pre1() { - global $setup_info, $phpgw_setup; + $db2 = $GLOBALS['phpgw_setup']->db; - $db2 = $phpgw_setup->db; - - if($phpgw_setup->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8')) + if($GLOBALS['phpgw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre8')) { $appstable = 'applications'; } @@ -212,43 +186,45 @@ $appstable = 'phpgw_applications'; } - $phpgw_setup->oProc->CreateTable('calendar_entry', array( - 'fd' => array( - 'cal_id' => array('type' => 'auto', 'nullable' => false), - 'cal_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), - 'cal_group' => array('type' => 'varchar', 'precision' => 255), - 'cal_datetime' => array('type' => 'int', 'precision' => 4), - 'cal_mdatetime' => array('type' => 'int', 'precision' => 4), - 'cal_duration' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), - 'cal_priority' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '2'), - 'cal_type' => array('type' => 'varchar', 'precision' => 10), - 'cal_access' => array('type' => 'varchar', 'precision' => 10), - 'cal_name' => array('type' => 'varchar', 'precision' => 80, 'nullable' => false), - 'cal_description' => array('type' => 'text') - ), - 'pk' => array("cal_id"), - 'ix' => array(), - 'fk' => array(), - 'uc' => array() - )); + $GLOBALS['phpgw_setup']->oProc->CreateTable('calendar_entry', + Array( + 'fd' => array( + 'cal_id' => array('type' => 'auto', 'nullable' => false), + 'cal_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), + 'cal_group' => array('type' => 'varchar', 'precision' => 255), + 'cal_datetime' => array('type' => 'int', 'precision' => 4), + 'cal_mdatetime' => array('type' => 'int', 'precision' => 4), + 'cal_duration' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), + 'cal_priority' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '2'), + 'cal_type' => array('type' => 'varchar', 'precision' => 10), + 'cal_access' => array('type' => 'varchar', 'precision' => 10), + 'cal_name' => array('type' => 'varchar', 'precision' => 80, 'nullable' => false), + 'cal_description' => array('type' => 'text') + ), + 'pk' => array("cal_id"), + 'ix' => array(), + 'fk' => array(), + 'uc' => array() + ) + ); - $phpgw_setup->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); - $phpgw_setup->oProc->next_record(); - if($phpgw_setup->oProc->f(0)) + $GLOBALS['phpgw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); + $GLOBALS['phpgw_setup']->oProc->next_record(); + if($GLOBALS['phpgw_setup']->oProc->f(0)) { - $phpgw_setup->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id',__LINE__,__FILE__); - while($phpgw_setup->oProc->next_record()) + $GLOBALS['phpgw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id',__LINE__,__FILE__); + while($GLOBALS['phpgw_setup']->oProc->next_record()) { - $cal_id = $phpgw_setup->oProc->f('cal_id'); - $cal_owner = $phpgw_setup->oProc->f('cal_owner'); - $cal_duration = $phpgw_setup->oProc->f('cal_duration'); - $cal_priority = $phpgw_setup->oProc->f('cal_priority'); - $cal_type = $phpgw_setup->oProc->f('cal_type'); - $cal_access = $phpgw_setup->oProc->f('cal_access'); - $cal_name = $phpgw_setup->oProc->f('cal_name'); - $cal_description = $phpgw_setup->oProc->f('cal_description'); - $datetime = mktime(intval(strrev(substr(strrev($phpgw_setup->oProc->f('cal_time')),4))),intval(strrev(substr(strrev($phpgw_setup->oProc->f('cal_time')),2,2))),intval(strrev(substr(strrev($phpgw_setup->oProc->f('cal_time')),0,2))),intval(substr($phpgw_setup->oProc->f('cal_date'),4,2)),intval(substr($phpgw_setup->oProc->f('cal_date'),6,2)),intval(substr($phpgw_setup->oProc->f('cal_date'),0,4))); - $moddatetime = mktime(intval(strrev(substr(strrev($phpgw_setup->oProc->f('cal_mod_time')),4))),intval(strrev(substr(strrev($phpgw_setup->oProc->f('cal_mod_time')),2,2))),intval(strrev(substr(strrev($phpgw_setup->oProc->f('cal_mod_time')),0,2))),intval(substr($phpgw_setup->oProc->f('cal_mod_date'),4,2)),intval(substr($phpgw_setup->oProc->f('cal_mod_date'),6,2)),intval(substr($phpgw_setup->oProc->f('cal_mod_date'),0,4))); + $cal_id = $GLOBALS['phpgw_setup']->oProc->f('cal_id'); + $cal_owner = $GLOBALS['phpgw_setup']->oProc->f('cal_owner'); + $cal_duration = $GLOBALS['phpgw_setup']->oProc->f('cal_duration'); + $cal_priority = $GLOBALS['phpgw_setup']->oProc->f('cal_priority'); + $cal_type = $GLOBALS['phpgw_setup']->oProc->f('cal_type'); + $cal_access = $GLOBALS['phpgw_setup']->oProc->f('cal_access'); + $cal_name = $GLOBALS['phpgw_setup']->oProc->f('cal_name'); + $cal_description = $GLOBALS['phpgw_setup']->oProc->f('cal_description'); + $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['phpgw_setup']->oProc->f('cal_time')),4))),intval(strrev(substr(strrev($GLOBALS['phpgw_setup']->oProc->f('cal_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['phpgw_setup']->oProc->f('cal_time')),0,2))),intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_date'),4,2)),intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_date'),6,2)),intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_date'),0,4))); + $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['phpgw_setup']->oProc->f('cal_mod_time')),4))),intval(strrev(substr(strrev($GLOBALS['phpgw_setup']->oProc->f('cal_mod_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['phpgw_setup']->oProc->f('cal_mod_time')),0,2))),intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_mod_date'),4,2)),intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_mod_date'),6,2)),intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_mod_date'),0,4))); $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__); $db2->next_record(); $cal_group = $db2->f('groups'); @@ -257,64 +233,68 @@ } } - $phpgw_setup->oProc->DropTable('webcal_entry_groups'); - $phpgw_setup->oProc->DropTable('webcal_entry'); + $GLOBALS['phpgw_setup']->oProc->DropTable('webcal_entry_groups'); + $GLOBALS['phpgw_setup']->oProc->DropTable('webcal_entry'); - $phpgw_setup->oProc->CreateTable('calendar_entry_user', array( - 'fd' => array( - 'cal_id' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), - 'cal_login' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), - 'cal_status' => array('type' => 'char', 'precision' => 1, 'default' => 'A') - ), - 'pk' => array('cal_id', 'cal_login'), - 'ix' => array(), - 'fk' => array(), - 'uc' => array() - )); + $GLOBALS['phpgw_setup']->oProc->CreateTable('calendar_entry_user', + Array( + 'fd' => array( + 'cal_id' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), + 'cal_login' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), + 'cal_status' => array('type' => 'char', 'precision' => 1, 'default' => 'A') + ), + 'pk' => array('cal_id', 'cal_login'), + 'ix' => array(), + 'fk' => array(), + 'uc' => array() + ) + ); - $phpgw_setup->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); - $phpgw_setup->oProc->next_record(); - if($phpgw_setup->oProc->f(0)) + $GLOBALS['phpgw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); + $GLOBALS['phpgw_setup']->oProc->next_record(); + if($GLOBALS['phpgw_setup']->oProc->f(0)) { - $phpgw_setup->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); - while($phpgw_setup->oProc->next_record()) + $GLOBALS['phpgw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); + while($GLOBALS['phpgw_setup']->oProc->next_record()) { - $cal_id = $phpgw_setup->oProc->f('cal_id'); - $cal_login = $phpgw_setup->oProc->f('cal_login'); - $cal_status = $phpgw_setup->oProc->f('cal_status'); + $cal_id = $GLOBALS['phpgw_setup']->oProc->f('cal_id'); + $cal_login = $GLOBALS['phpgw_setup']->oProc->f('cal_login'); + $cal_status = $GLOBALS['phpgw_setup']->oProc->f('cal_status'); $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__); } } - $phpgw_setup->oProc->DropTable('webcal_entry_user'); + $GLOBALS['phpgw_setup']->oProc->DropTable('webcal_entry_user'); - $phpgw_setup->oProc->CreateTable('calendar_entry_repeats', array( - 'fd' => array( - 'cal_id' => array('type' => 'int', 'precision' => 4, 'default' => '0', 'nullable' => false), - 'cal_type' => array('type' => 'varchar', 'precision' => 20, 'default' => 'daily', 'nullable' => false), - 'cal_use_end' => array('type' => 'int', 'precision' => 4, 'default' => '0'), - 'cal_end' => array('type' => 'int', 'precision' => 4), - 'cal_frequency' => array('type' => 'int', 'precision' => 4, 'default' => '1'), - 'cal_days' => array('type' => 'char', 'precision' => 7) - ), - 'pk' => array(), - 'ix' => array(), - 'fk' => array(), - 'uc' => array() - )); + $GLOBALS['phpgw_setup']->oProc->CreateTable('calendar_entry_repeats', + Array( + 'fd' => array( + 'cal_id' => array('type' => 'int', 'precision' => 4, 'default' => '0', 'nullable' => false), + 'cal_type' => array('type' => 'varchar', 'precision' => 20, 'default' => 'daily', 'nullable' => false), + 'cal_use_end' => array('type' => 'int', 'precision' => 4, 'default' => '0'), + 'cal_end' => array('type' => 'int', 'precision' => 4), + 'cal_frequency' => array('type' => 'int', 'precision' => 4, 'default' => '1'), + 'cal_days' => array('type' => 'char', 'precision' => 7) + ), + 'pk' => array(), + 'ix' => array(), + 'fk' => array(), + 'uc' => array() + ) + ); - $phpgw_setup->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); - $phpgw_setup->oProc->next_record(); - if($phpgw_setup->oProc->f(0)) + $GLOBALS['phpgw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); + $GLOBALS['phpgw_setup']->oProc->next_record(); + if($GLOBALS['phpgw_setup']->oProc->f(0)) { - $phpgw_setup->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id',__LINE__,__FILE__); - while($phpgw_setup->oProc->next_record()) + $GLOBALS['phpgw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id',__LINE__,__FILE__); + while($GLOBALS['phpgw_setup']->oProc->next_record()) { - $cal_id = $phpgw_setup->oProc->f('cal_id'); - $cal_type = $phpgw_setup->oProc->f('cal_type'); - if(isset($phpgw_setup->oProc->Record['cal_end'])) + $cal_id = $GLOBALS['phpgw_setup']->oProc->f('cal_id'); + $cal_type = $GLOBALS['phpgw_setup']->oProc->f('cal_type'); + if(isset($GLOBALS['phpgw_setup']->oProc->Record['cal_end'])) { - $enddate = mktime(0,0,0,intval(substr($phpgw_setup->oProc->f('cal_end'),4,2)),intval(substr($phpgw_setup->oProc->f('cal_end'),6,2)),intval(substr($phpgw_setup->oProc->f('cal_end'),0,4))); + $enddate = mktime(0,0,0,intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_end'),4,2)),intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_end'),6,2)),intval(substr($GLOBALS['phpgw_setup']->oProc->f('cal_end'),0,4))); $useend = 1; } else @@ -322,327 +302,284 @@ $enddate = 0; $useend = 0; } - $cal_frequency = $phpgw_setup->oProc->f('cal_frequency'); - $cal_days = $phpgw_setup->oProc->f('cal_days'); + $cal_frequency = $GLOBALS['phpgw_setup']->oProc->f('cal_frequency'); + $cal_days = $GLOBALS['phpgw_setup']->oProc->f('cal_days'); $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__); } } - $phpgw_setup->oProc->DropTable('webcal_entry_repeats'); - $phpgw_setup->oProc->query("UPDATE $appstable SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); + $GLOBALS['phpgw_setup']->oProc->DropTable('webcal_entry_repeats'); + $GLOBALS['phpgw_setup']->oProc->query("UPDATE $appstable SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); - $setup_info['calendar']['currentver'] = '0.9.7pre2'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.7pre2"; function calendar_upgrade0_9_7pre2() { - global $oldversion, $setup_info, $phpgw_setup, $oDelta; - - $db2 = $phpgw_setup->db; + $db2 = $GLOBALS['phpgw_setup']->db; - $phpgw_setup->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); - $phpgw_setup->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id',__LINE__,__FILE__); - if($phpgw_setup->oProc->num_rows()) + $GLOBALS['phpgw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); + $GLOBALS['phpgw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id',__LINE__,__FILE__); + if($GLOBALS['phpgw_setup']->oProc->num_rows()) { - while($phpgw_setup->oProc->next_record()) + while($GLOBALS['phpgw_setup']->oProc->next_record()) { - $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$phpgw_setup->db->f('cal_owner'),__LINE__,__FILE__); + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['phpgw_setup']->db->f('cal_owner'),__LINE__,__FILE__); $db2->next_record(); $tz = $db2->f('preference_value'); - $cal_id = $phpgw_setup->oProc->f('cal_id'); - $datetime = $phpgw_setup->oProc->f("cal_datetime") - ((60 * 60) * $tz); - $mdatetime = $phpgw_setup->oProc->f("cal_mdatetime") - ((60 * 60) * $tz); - $edatetime = $datetime + (60 * $phpgw_setup->oProc->f("cal_edatetime")); - $db2->query("UPDATE calendar_entry SET cal_datetime=".$datetime.", cal_edatetime=".$edatetime.", cal_mdatetime=".$mdatetime." WHERE cal_id=".$cal_id,__LINE__,__FILE__); + $cal_id = $GLOBALS['phpgw_setup']->oProc->f('cal_id'); + $datetime = $GLOBALS['phpgw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz); + $mdatetime = $GLOBALS['phpgw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz); + $edatetime = $datetime + (60 * $GLOBALS['phpgw_setup']->oProc->f('cal_edatetime')); + $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__); } } - $setup_info['calendar']['currentver'] = '0.9.7pre3'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.7pre3"; function calendar_upgrade0_9_7pre3() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.7'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.7"; function calendar_upgrade0_9_7() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.8pre1'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.8pre1"; function calendar_upgrade0_9_8pre1() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.8pre2'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.8pre2"; function calendar_upgrade0_9_8pre2() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.8pre3'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.8pre3"; function calendar_upgrade0_9_8pre3() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.8pre4'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre4'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.8pre4"; function calendar_upgrade0_9_8pre4() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.8pre5'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre5'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.8pre5'; function calendar_upgrade0_9_8pre5() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.9pre1'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.9pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.9pre1"; function calendar_upgrade0_9_9pre1() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.9'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.9'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.9"; function calendar_upgrade0_9_9() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre1'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.10pre1"; function calendar_upgrade0_9_10pre1() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre2'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.10pre2"; function calendar_upgrade0_9_10pre2() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre3'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.10pre3"; function calendar_upgrade0_9_10pre3() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre4'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre4'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.10pre4"; function calendar_upgrade0_9_10pre4() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre5'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre5'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.10pre5"; function calendar_upgrade0_9_10pre5() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre6'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre6'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.10pre6"; function calendar_upgrade0_9_10pre6() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre7'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre7'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.10pre7"; function calendar_upgrade0_9_10pre7() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre8'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre8'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = "0.9.10pre8"; function calendar_upgrade0_9_10pre8() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre9'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre9'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre9'; function calendar_upgrade0_9_10pre9() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre10'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre10'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre10'; function calendar_upgrade0_9_10pre10() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre11'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre11'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre11'; function calendar_upgrade0_9_10pre11() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre12'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre12'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre12'; function calendar_upgrade0_9_10pre12() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre13'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre13'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre13'; function calendar_upgrade0_9_10pre13() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre14'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre14'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre14'; function calendar_upgrade0_9_10pre14() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre15'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre15'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre15'; function calendar_upgrade0_9_10pre15() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre16'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre16'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre16'; function calendar_upgrade0_9_10pre16() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre17'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre17'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre17'; function calendar_upgrade0_9_10pre17() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre18'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre18'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre18'; function calendar_upgrade0_9_10pre18() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre19'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre19'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre19'; function calendar_upgrade0_9_10pre19() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre20'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre20'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre20'; function calendar_upgrade0_9_10pre20() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre21'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre21'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre21'; function calendar_upgrade0_9_10pre21() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre22'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre22'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre22'; function calendar_upgrade0_9_10pre22() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre23'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre23'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre23'; function calendar_upgrade0_9_10pre23() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre24'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre24'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre24'; function calendar_upgrade0_9_10pre24() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre25'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre25'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre25'; function calendar_upgrade0_9_10pre25() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre26'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre26'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre26'; function calendar_upgrade0_9_10pre26() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre27'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre27'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre27'; function calendar_upgrade0_9_10pre27() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10pre28'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre28'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10pre28'; function calendar_upgrade0_9_10pre28() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.10'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.10'; function calendar_upgrade0_9_10() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.11.001'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11'; function calendar_upgrade0_9_11() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.11.001'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.001'; function calendar_upgrade0_9_11_001() { - global $setup_info, $phpgw_setup; - - $db2 = $phpgw_setup->db; + $db2 = $GLOBALS['phpgw_setup']->db; if(extension_loaded('mcal') == False) { @@ -663,8 +600,8 @@ } // calendar_entry => phpgw_cal - $phpgw_setup->oProc->CreateTable( - 'phpgw_cal', array( + $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_cal', + Array( 'fd' => array( 'cal_id' => array('type' => 'auto', 'nullable' => False), 'owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), @@ -686,12 +623,12 @@ ) ); - $phpgw_setup->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); - while($phpgw_setup->oProc->next_record()) + $GLOBALS['phpgw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); + while($GLOBALS['phpgw_setup']->oProc->next_record()) { - $id = $phpgw_setup->oProc->f('cal_id'); - $owner = $phpgw_setup->oProc->f('cal_owner'); - $access = $phpgw_setup->oProc->f('cal_access'); + $id = $GLOBALS['phpgw_setup']->oProc->f('cal_id'); + $owner = $GLOBALS['phpgw_setup']->oProc->f('cal_owner'); + $access = $GLOBALS['phpgw_setup']->oProc->f('cal_access'); switch($access) { case 'private': @@ -704,40 +641,42 @@ $is_public = 2; break; } - $groups = $phpgw_setup->oProc->f('cal_group'); - $datetime = $phpgw_setup->oProc->f('cal_datetime'); - $mdatetime = $phpgw_setup->oProc->f('cal_mdatetime'); - $edatetime = $phpgw_setup->oProc->f('cal_edatetime'); - $priority = $phpgw_setup->oProc->f('cal_priority'); - $type = $phpgw_setup->oProc->f('cal_type'); - $title = $phpgw_setup->oProc->f('cal_name'); - $description = $phpgw_setup->oProc->f('cal_description'); + $groups = $GLOBALS['phpgw_setup']->oProc->f('cal_group'); + $datetime = $GLOBALS['phpgw_setup']->oProc->f('cal_datetime'); + $mdatetime = $GLOBALS['phpgw_setup']->oProc->f('cal_mdatetime'); + $edatetime = $GLOBALS['phpgw_setup']->oProc->f('cal_edatetime'); + $priority = $GLOBALS['phpgw_setup']->oProc->f('cal_priority'); + $type = $GLOBALS['phpgw_setup']->oProc->f('cal_type'); + $title = $GLOBALS['phpgw_setup']->oProc->f('cal_name'); + $description = $GLOBALS['phpgw_setup']->oProc->f('cal_description'); $db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) " . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__); } - $phpgw_setup->oProc->DropTable('calendar_entry'); + $GLOBALS['phpgw_setup']->oProc->DropTable('calendar_entry'); // calendar_entry_repeats => phpgw_cal_repeats - $phpgw_setup->oProc->CreateTable('phpgw_cal_repeats', array( - 'fd' => array( - 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), - 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), - 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), - 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), - 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), - 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') - ), - 'pk' => array(), - 'fk' => array(), - 'ix' => array(), - 'uc' => array() - )); - $phpgw_setup->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); - while($phpgw_setup->oProc->next_record()) + $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_cal_repeats', + Array( + 'fd' => array( + 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), + 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), + 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), + 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), + 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), + 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') + ), + 'pk' => array(), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + $GLOBALS['phpgw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); + while($GLOBALS['phpgw_setup']->oProc->next_record()) { - $id = $phpgw_setup->oProc->f('cal_id'); - $recur_type = $phpgw_setup->oProc->f('cal_type'); + $id = $GLOBALS['phpgw_setup']->oProc->f('cal_id'); + $recur_type = $GLOBALS['phpgw_setup']->oProc->f('cal_type'); switch($recur_type) { case 'daily': @@ -756,10 +695,10 @@ $recur_type_num = RECUR_YEARLY; break; } - $recur_end_use = $phpgw_setup->oProc->f('cal_use_end'); - $recur_end = $phpgw_setup->oProc->f('cal_end'); - $recur_interval = $phpgw_setup->oProc->f('cal_frequency'); - $days = strtoupper($phpgw_setup->oProc->f('cal_days')); + $recur_end_use = $GLOBALS['phpgw_setup']->oProc->f('cal_use_end'); + $recur_end = $GLOBALS['phpgw_setup']->oProc->f('cal_end'); + $recur_interval = $GLOBALS['phpgw_setup']->oProc->f('cal_frequency'); + $days = strtoupper($GLOBALS['phpgw_setup']->oProc->f('cal_days')); $recur_data = 0; $recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0); $recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0); @@ -771,30 +710,27 @@ $db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) " . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); } - $phpgw_setup->oProc->DropTable('calendar_entry_repeats'); + $GLOBALS['phpgw_setup']->oProc->DropTable('calendar_entry_repeats'); // calendar_entry_user => phpgw_cal_user - $phpgw_setup->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); + $GLOBALS['phpgw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); - $setup_info['calendar']['currentver'] = '0.9.11.002'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.002'; function calendar_upgrade0_9_11_002() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.11.003'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.003'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.003'; function calendar_upgrade0_9_11_003() { - global $setup_info, $phpgw_setup; - - $phpgw_setup->oProc->CreateTable( - 'phpgw_cal_holidays', array( + $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_cal_holidays', + Array( 'fd' => array( 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), @@ -807,116 +743,125 @@ ) ); - $setup_info['calendar']['currentver'] = '0.9.11.004'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.004'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.004'; function calendar_upgrade0_9_11_004() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.11.005'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.005'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.005'; function calendar_upgrade0_9_11_005() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.11.006'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.006'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.006'; function calendar_upgrade0_9_11_006() { - global $setup_info, $phpgw_setup; + $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_cal_holidays'); + $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_cal_holidays', + Array( + 'fd' => array( + 'hol_id' => array('type' => 'auto','nullable' => False), + 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), + 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), + 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') + ), + 'pk' => array('hol_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); - $phpgw_setup->oProc->DropTable('phpgw_cal_holidays'); - $phpgw_setup->oProc->CreateTable('phpgw_cal_holidays', array( - 'fd' => array( - 'hol_id' => array('type' => 'auto','nullable' => False), - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') - ), - 'pk' => array('hol_id'), - 'fk' => array(), - 'ix' => array(), - 'uc' => array() - )); - - $setup_info['calendar']['currentver'] = '0.9.11.007'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.007'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.007'; function calendar_upgrade0_9_11_007() { - global $setup_info, $phpgw_setup; + $GLOBALS['phpgw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); + $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - $phpgw_setup->oProc->query('DELETE FROM phpgw_cal_holidays'); - $phpgw_setup->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - $phpgw_setup->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - $phpgw_setup->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - $phpgw_setup->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - - $setup_info['calendar']['currentver'] = '0.9.11.008'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.008'; function calendar_upgrade0_9_11_008() { - global $setup_info, $phpgw_setup; - $setup_info['calendar']['currentver'] = '0.9.11.009'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.009'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.009'; function calendar_upgrade0_9_11_009() { - global $setup_info, $phpgw_setup; + $GLOBALS['phpgw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); + $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - $phpgw_setup->oProc->query('DELETE FROM phpgw_cal_holidays'); - $phpgw_setup->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - - $setup_info['calendar']['currentver'] = '0.9.11.010'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.010'; function calendar_upgrade0_9_11_010() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.11.011'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.011'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.11.011'; function calendar_upgrade0_9_11_011() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.13.001'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.13.001'; function calendar_upgrade0_9_13_001() { - global $setup_info; - $setup_info['calendar']['currentver'] = '0.9.13.002'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.002'; + return $GLOBALS['setup_info']['calendar']['currentver']; } $test[] = '0.9.13.002'; function calendar_upgrade0_9_13_002() { - global $setup_info, $phpgw_setup; + $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - $phpgw_setup->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); - - $setup_info['calendar']['currentver'] = '0.9.13.003'; - return $setup_info['calendar']['currentver']; + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003'; + return $GLOBALS['setup_info']['calendar']['currentver']; } + $test[] = '0.9.13.003'; + function calendar_upgrade0_9_13_003() + { + $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_cal_alarm', + Array( + 'fd' => array( + 'alarm_id' => array('type' => 'auto','nullable' => False), + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), + 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), + 'cal_text' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False) + ), + 'pk' => array('alarm_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004'; + return $GLOBALS['setup_info']['calendar']['currentver']; + } ?> diff --git a/calendar/templates/default/view.tpl b/calendar/templates/default/view.tpl index 2978666e5f..7f09f634d5 100755 --- a/calendar/templates/default/view.tpl +++ b/calendar/templates/default/view.tpl @@ -17,3 +17,10 @@ {data} + + + + {hr_text} + + +