Esempio n. 1
0
function mailplayer($play, $opp, $col, $mt, $ot, $m, $g)
{
    global $pars;
    if (strlen($play->Email) == 0) {
        return new aboutplayer($play, $opp, $m, $g, "has given no email address");
    }
    if (!$play->OKemail) {
        return new aboutplayer($play, $opp, $m, $g, "has not agreed to auto-email");
    }
    $oppname = $opp->display_name(false);
    $dest = $play->Email;
    $fh = popen("mail -s 'Online league match reminder' {$dest}", "w");
    $mess = <<<EOT
Dear {$play->display_name(false)}

PLEASE NOTE that this is an automatically-generated message. Please DO NOT
reply to the apparent sender - thank you!

Please can we remind you that your are due to play in the online league match
playing for {$mt->display_name()} against {$ot->display_name()}.

Your opponent is {$oppname} {$opp->display_rank()}.

You are playing as {$col}.

EOT;
    fwrite($fh, $mess);
    $onl = $opp->display_online();
    if ($onl == '-') {
        $mess = <<<EOT
Sorry, but we have no record of an online name for {$oppname}.


EOT;
    } else {
        $mess = <<<EOT
The online name for {$oppname} is {$onl}.


EOT;
    }
    fwrite($fh, $mess);
    $hcp = hcp_message($g, $pars);
    if ($hcp) {
        fwrite($fh, "\nPlease note this game is played with {$hcp}\n");
    }
    if (strlen($opp->Email) != 0) {
        $mess = <<<EOT

{$oppname} has an email address of {$opp->Email}.

EOT;
    } else {
        $mess = <<<EOT

Sorry we have no email address for {$oppname}.

EOT;
    }
    fwrite($fh, $mess);
    $phone = $opp->display_phone(true);
    if (strlen($phone) != 0) {
        $mess = <<<EOT

You can reach {$oppname} on the phone at {$phone}.

EOT;
        fwrite($fh, $mess);
    }
    $nts = $opp->Notes;
    if (strlen($nts) != 0) {
        $mess = <<<EOT

{$oppname} has provided the following notes: {$nts}

EOT;
        fwrite($fh, $mess);
    }
    $capt = $mt->Captain;
    if (!$capt->is_same($play)) {
        $mess = <<<EOT

If you have any questions, please contact your team captain, {$capt->display_name(false)},
whose email address is {$capt->Email}.

EOT;
        fwrite($fh, $mess);
    }
    pclose($fh);
    return false;
}
Esempio n. 2
0
    $hcaps = array();
    $boards = array();
    $board = 1;
    foreach ($mtch->Games as $g) {
        $bpre = $bpost = $wpre = $wpost = "";
        switch ($g->Result) {
            case 'W':
                $wpre = "<b>";
                $wpost = "</b>";
                break;
            case 'B':
                $bpre = "<b>";
                $bpost = "</b>";
                break;
        }
        $hmsg = hcp_message($g, $pars);
        if ($hmsg) {
            array_push($hcaps, $hmsg);
            array_push($boards, $board);
        }
        print <<<EOT
<tr>
<td>{$g->date_played()}</td>
<td>{$wpre}{$g->Wplayer->display_name()}{$wpost}</td>
<td>{$g->Wplayer->display_rank()}</td>
<td>{$g->Wplayer->display_online()}</td>
<td>{$g->Wteam->display_name()}</td>
<td>{$bpre}{$g->Bplayer->display_name()}{$bpost}</td>
<td>{$g->Bplayer->display_rank()}</td>
<td>{$g->Bplayer->display_online()}</td>
<td>{$g->Bteam->display_name()}</td>
Esempio n. 3
0
<th colspan="4" align="center">Black</th></tr>
<tr>
<th>Player</th>
<th>Rank</th>
<th>Online</th>
<th>Team</th>
<th>Player</th>
<th>Rank</th>
<th>Online</th>
<th>Team</th>
<th>Hcp</th>
</tr>

EOT;
    foreach ($osgames as $g) {
        $hcp = hcp_message($g, $pars);
        if (!$hcp) {
            $hcp = "None";
        }
        print <<<EOT
<tr>
<td>{$g->Wplayer->display_name()}</td>
<td>{$g->Wplayer->display_rank()}</td>
<td>{$g->Wplayer->display_online()}</td>
<td>{$g->Wteam->display_name()}</td>
<td>{$g->Bplayer->display_name()}</td>
<td>{$g->Bplayer->display_rank()}</td>
<td>{$g->Bplayer->display_online()}</td>
<td>{$g->Bteam->display_name()}</td>
<td>{$hcp}</td>
<td>{$g->display_result(true)}</td>
Esempio n. 4
0
function mail_allocated($mtch, $pars, $byadmin = false)
{
    // We shouldn't get here without it being allocated but return if we are
    if (!$mtch->is_allocated()) {
        return;
    }
    // Get hold of the first and second teams and their captains
    $ht = $mtch->Hteam;
    $at = $mtch->Ateam;
    $hc = $ht->Captain;
    $ac = $at->Captain;
    $games = $mtch->Games;
    $mailgames = array();
    //  Games it is OK to mail players about
    if ($byadmin) {
        $suam = "amended";
        $stm = "Amended";
    } else {
        $suam = "set up";
        $stm = "Completed";
    }
    $fh = popen("mail -s 'Go League match {$suam}' online-league@britgo.org {$hc->Email} {$ac->Email}", "w");
    $mess = <<<EOT
{$stm} allocation of players to match in division {$mtch->Division} for {$mtch->Date->display_month()} between
{$ht->display_name()} ({$ht->display_description()}) and {$at->display_name()} ({$at->display_description()}).

Allocation is:
EOT;
    fwrite($fh, "{$mess}\n");
    $board = 1;
    foreach ($games as $g) {
        $wp = $g->Wplayer;
        $bp = $g->Bplayer;
        $wt = $g->Wteam;
        $bt = $g->Bteam;
        if ($wt->is_same($ht)) {
            $hp = $wp;
            $ap = $bp;
            $hcol = "White";
            $acol = "Black";
        } else {
            $hp = $bp;
            $ap = $wp;
            $acol = "White";
            $hcol = "Black";
        }
        $mess = <<<EOT
Board {$board}:
\tWhite: {$wp->display_name(false)} {$wp->display_rank()} of {$wt->display_name()}
\tBlack: {$bp->display_name(false)} {$bp->display_rank()} of {$bt->display_name()}
EOT;
        fwrite($fh, "{$mess}\n");
        if ($g->Result != 'N') {
            fwrite($fh, "This game has already been played.\n");
        } else {
            $hcp = hcp_message($g, $pars);
            if ($hcp) {
                fwrite($fh, "Game is played with {$hcp}\n");
            }
            $hreason = mail_player($board, $hp, $ht, $hc, $hcol, $ap, $at, $hcp);
            $areason = mail_player($board, $ap, $at, $ac, $acol, $hp, $ht, $hcp);
            if (strlen($hreason) != 0) {
                $mess = <<<EOT
\t{$ht->display_captain()} please contact as {$hreason}

EOT;
                fwrite($fh, $mess);
            }
            if (strlen($areason) != 0) {
                $mess = <<<EOT
\t{$at->display_captain()} please contact as {$areason}

EOT;
                fwrite($fh, $mess);
            }
        }
        $board++;
    }
    $mess = <<<EOT

Team Captains are:

For {$ht->display_name()}: {$ht->display_captain()}, {$hc->display_email_nolink()}
For {$at->display_name()}: {$at->display_captain()}, {$ac->display_email_nolink()}

EOT;
    fwrite($fh, "{$mess}");
    if (strlen($hc->Phone) != 0) {
        fwrite($fh, "You can reach {$ht->display_captain()} on {$hc->display_phone(true)}.\n");
    }
    if (strlen($ac->Phone) != 0) {
        fwrite($fh, "You can reach {$at->display_captain()} on {$ac->display_phone(true)}.\n");
    }
    pclose($fh);
}