Tweaked next_class
[tpope-extra.git] / perl / sctweb
index 06ff3a98056fd22e19e630d5de29b7a081ec6a3c..d9f9eff52a9ccff739a8a20fc629455ad909d61b 100755 (executable)
@@ -56,7 +56,7 @@ sub next_class {
     my $days = Delta_Days($1,$2,$3,$4,$5,$6);
     my $firstday = Date::Calc->new($1,$2,$3);
     my $lastday = Date::Calc->new($4,$5,$6);
-    my $today = Date::Calc->today;
+    my $today = Date::Calc->new(Date::Calc->localtime(time+3600*6)->date);
     my @days=();
     foreach(split(" ",$class{'days'})) {
        push @days, Decode_Day_of_Week($_);
@@ -67,7 +67,7 @@ sub next_class {
        next if(grep($_ == $today, @off));
        return $today;
     }
-    $today = Date::Calc->today;
+    $today = Date::Calc->new(Date::Calc->gmtime->date);
     for($today = ($today < $lastday ? $today : $lastday); $today > $firstday; $today--) {
        next unless(grep($_ == Day_of_Week($today->date), @days));
        next if(grep($_ == $today, @off));
@@ -289,7 +289,7 @@ sub do_mhc_schedule {
        if(defined($file) && (-d $file)) {
            $row->{'instructor'} =~ s/^([^,]*), ([^,]*)(.*)/$2 $1$3/;
            my $email = get_faculty_email $row->{'instructor'};
-           $row->{'instructor'} = '"' . $row->{'instructor'} . '" <'. ($email || "$1\@from.sctweb" . ">");
+           $row->{'instructor'} = '"' . $row->{'instructor'} . '" <'. ($email || "$1\@from.sctweb") . ">";
            $row->{'duration'} =~ /^(\d\d\d\d)(\d\d)(\d\d)-\d{8}$/;
            $row->{'begin'} =~ /^(\d\d):(\d\d)$/;
            my $next = next_class(%$row);
@@ -414,7 +414,15 @@ sub do_html_schedule {
            $row->{'duration'} =~ s/\d\d(\d\d)(\d\d)(\d\d)/$2-$3-$1/g;
            print '<tr>';
            print "<td>" . $row->{'id'} . "<br />" . $row->{'title'} . "</td>";
-           print "<td>" . $row->{'instructor'} . "</td>";
+           my $instructor = $row->{'instructor'};
+           $instructor =~ s/^([^,]*), ([^,]*)(.*)/$2 $1$3/;
+           my $email = get_faculty_email($instructor);
+           #if($email) {
+               #print '<td><a href="mailto:' . $email . '">'
+               #. $row->{'instructor'} . "</a></td>";
+           # } else {
+               print "<td>" . $row->{'instructor'} . "</td>";
+           #}
            print "<td>" . $row->{'days'} . "</td>";
            print "<td>" . $row->{'time'} . "</td>";
            print "<td>" . $row->{'duration'} . "</td>";