1<?php
2
3/**
4 * Swift Mailer Verbose-sending Plugin Default View File.
5 * Please read the LICENSE file
6 * @author Chris Corbyn <chris@w3style.co.uk>
7 * @package Swift_Plugin
8 * @subpackage VerboseSending
9 * @license GNU Lesser General Public License
10 */
11
12require_once dirname(__FILE__) . "/../../ClassLoader.php";
13Swift_ClassLoader::load("Swift_Plugin_VerboseSending_AbstractView");
14
15/**
16 * The Default View for the Verbose Sending Plugin
17 * @package Swift_Plugin
18 * @subpackage VerboseSending
19 * @author Chris Corbyn <chris@w3style.co.uk>
20 */
21class Swift_Plugin_VerboseSending_DefaultView extends Swift_Plugin_VerboseSending_AbstractView
22{
23  /**
24   * Number of recipients painted
25   * @var int
26   */
27  protected $count = 0;
28
29  /**
30   * Paint the result of a send operation
31   * @param string The email address that was tried
32   * @param boolean True if the message was successfully sent
33   */
34  public function paintResult($address, $result)
35  {
36    $this->count++;
37    $color = $result ? "#51c45f" : "#d67d71";
38    $result_text = $result ? "PASS" : "FAIL";
39    ?>
40    <div style="color: #ffffff; margin: 2px; padding: 3px;
41      font-weight: bold; background: <?php echo $color; ?>;">
42      <span style="float: right; text-decoration: underline;">
43        <?php echo $result_text; ?></span>
44      Recipient (<?php echo $this->count; ?>):
45      <?php echo $address; ?>
46    </div>
47    <?php
48    flush();
49  }
50}
51