Subversion Repositories VORC

Rev

Rev 121 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/usr/bin/perl

use strict;
use cPanelUserConfig;
use RollerCon;
use tableViewer;
use DateTime;
use HTML::Tiny;
my $h = HTML::Tiny->new( mode => 'html' );

my $dt = DateTime->today;
my $day = $dt->day_name;
my $date = $dt->date;
my $year = $dt->year;

my $dbh = getDBConnection ();
my $DEPT = getDepartments ();

my $class_name;
my $cnhan = $dbh->prepare ("select id, name from class where year(date) = year(now())");
$cnhan->execute ();
while (my ($id, $name) = $cnhan->fetchrow_array ()) { $class_name->{$id} = $name; }

my $sth1 = $dbh->prepare("select distinct RCid from v_class_signup where year(date) = year(now()) order by RCid");
my $sth2 = $dbh->prepare("select distinct id from v_class_signup where year(date) = year(now()) and RCid = ? order by id");

$sth1->execute();
while (my ($RCid) = $sth1->fetchrow_array()) {
        my $email = getUserEmail($RCid);
        my $dname = getUserDerbyName($RCid);
        my @classes = ();
        
        $sth2->execute($RCid);
        while (my ($C) = $sth2->fetchrow_array()) {
                push @classes, $C;
        }
        
        my $message = $h->p ("Greetings $dname,",
                             "Thanks for taking classes at RollerCon $year. Please take a minute to give us some feedback on the class(es) you took. To find out more about how we use this info, check out ".$h->a ({ href => "https://rollercon.com/about/mvp-star-ratings/" }, "RollerCon MVP Star Ratings"),
                             "Thanks again and see you next year!",
                             "Here are the links to review the classes that we have you registered for:"
                            );
                            
  $message .= $h->ul ([ map { $h->li ($h->a ({ href => "https://volunteers.rollercon.com/schedule/survey.pl?classid=$_" }, $class_name->{$_})) } @classes ]);

  
  $message .= $h->p (
    $h->i ("(Note: We may be missing some 'walk up' attendees of some classes.  If you don't see a link to a class you took, that's ok.)"),
    $h->br,
    "--RollerCon HQ".$h->br.'rollercon@gmail.com'.$h->br."rollercon.com"
  );


#       $message .= "\n$hours TOTAL HOURS\n\nAgain, thank you for volunteering at RollerCon.\n\n-RollerCon Leadership Team";
        
        my $subject = $dname."'s RollerCon MVP Class Surveys";
        
        print "Emailing $dname ($email)...\n";
        use RCMailer;
        EmailUser($email, $subject, $message);
        sleep (15);
}

print "\ndone.\n\n";