Subversion Repositories VORC

Rev

Rev 8 | Rev 35 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8 Rev 29
Line 9... Line 9...
9
use Date::Calc qw(Add_Delta_DHMS);
9
use Date::Calc qw(Add_Delta_DHMS);
10
use Time::HiRes;
10
use Time::HiRes;
Line 11... Line 11...
11
 
11
 
12
use CGI qw(:standard);
12
use CGI qw(:standard);
13
use DBI;
13
use DBI;
-
 
14
use tableViewer;
Line 14... Line 15...
14
use scanFunctions;
15
use WebDB;
15
 
16
 
Line 30... Line 31...
30
        $stamp[1],
31
        $stamp[1],
31
        $stamp[0]);
32
        $stamp[0]);
Line 32... Line 33...
32
 
33
 
Line 33... Line 34...
33
my $tz = DateTime::TimeZone->new(name => 'America/Los_Angeles');
34
my $tz = DateTime::TimeZone->new(name => 'America/Los_Angeles');
34
 
35
 
35
my $dbh = getDBConnection();
36
my $dbh = WebDB::connect;
36
my $sth = $dbh->prepare("select * from (select id, date, dayofweek, track, time, role, teams from v_shift where RCid = ? union select id, date, dayofweek, track , time, 'Track Lead' as role, '' as teams from v_lead_shift where assignee_id = ?) temp order by date, time");
37
my $sth = $dbh->prepare("select * from (select id, date, dayofweek, track as 'location', time, role, teams from v_shift_officiating where RCid = ? union select id, date, dayofweek, track as 'location', time, role, teams from v_shift_announcer where RCid = ? union select id, date, dayofweek, location, time, role, '' as teams from v_shift where RCid = ?) temp order by date, time");
37
$sth->execute($RCid, $RCid);
38
$sth->execute($RCid, $RCid, $RCid);
38
while (my $s = $sth->fetchrow_hashref) {
39
while (my $s = $sth->fetchrow_hashref) {
39
	$s->{role} =~ s/\-\d$//;
40
	$s->{role} =~ s/\-\d$//;
Line 57... Line 58...
57
                    $tm[5] + 1900, $tm[4] + 1, $tm[3], $tm[2],
58
                    $tm[5] + 1900, $tm[4] + 1, $tm[3], $tm[2],
58
                    $tm[1], $tm[0], scalar(Time::HiRes::gettimeofday()), $count);
59
                    $tm[1], $tm[0], scalar(Time::HiRes::gettimeofday()), $count);
Line 59... Line 60...
59
	
60
	
60
	$event->add_properties(
61
	$event->add_properties(
61
            uid => $uid,
62
            uid => $uid,
62
            summary => "ORC: $S->{role} on $S->{track} - $S->{teams}",
63
            summary => "ORC: $S->{role} on $S->{location} - $S->{teams}",
63
            description => "" ,
64
            description => "" ,
64
            categories => "RollerCon Officiating;RollerCon Schedule",
65
            categories => "RollerCon Officiating;RollerCon Schedule;RollerCon Volunteer",
65
            location => "Track $S->{track}",
66
            location => "$S->{location}",
66
            dtstamp => $dstamp,
67
            dtstamp => $dstamp,
67
            dtstart => Date::ICal->new(
68
            dtstart => Date::ICal->new(
68
                            year => $startyear,
69
                            year => $startyear,
69
                            month => $startmonth,
70
                            month => $startmonth,
Line 87... Line 88...
87
}
88
}
Line 88... Line 89...
88
 
89
 
89
$calendar->add_properties(
90
$calendar->add_properties(
90
#        calscale => 'GREGORIAN',
91
#        calscale => 'GREGORIAN',
91
#        method => 'PUBLISH',
92
#        method => 'PUBLISH',
92
        'X-WR-CALNAME' => 'RollerCon Officiating Schedule'
93
        'X-WR-CALNAME' => 'RollerCon Volunteer Schedule'
Line 93... Line 94...
93
        );
94
        );
94
 
95
 
95
print header('Content-type: text/calendar; charset=utf-8');
96
print header('Content-type: text/calendar; charset=utf-8');
96
#print header('Content-Disposition: attachment; filename=export_ics.pl.ics');
97
#print header('Content-Disposition: attachment; filename=export_ics.pl.ics');