67 lines
1.8 KiB
PHP
67 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace com\fwdekker\deathnotifier\mailer;
|
|
|
|
|
|
/**
|
|
* An email to inform a user a tracker person's status has changed.
|
|
*/
|
|
class NotifyStatusChangedEmail extends Email
|
|
{
|
|
/**
|
|
* A string identifying the type of email.
|
|
*/
|
|
public const TYPE = "notify-status-changed";
|
|
|
|
/**
|
|
* @var string The name of the person whose status has changed.
|
|
*/
|
|
public string $name;
|
|
/**
|
|
* @var string The new status of the person.
|
|
*/
|
|
public string $new_status;
|
|
|
|
|
|
/**
|
|
* Constructs an email to inform a user someone has died.
|
|
*
|
|
* @param string $recipient the intended recipient of the email
|
|
* @param string $name the name of the person who died
|
|
* @param string $new_status the new status of the person
|
|
*/
|
|
public function __construct(string $recipient, string $name, string $new_status)
|
|
{
|
|
$this->type = self::TYPE;
|
|
$this->recipient = $recipient;
|
|
|
|
$this->name = $name;
|
|
$this->arg1 = $name;
|
|
|
|
$this->new_status = $new_status;
|
|
$this->arg2 = $new_status;
|
|
}
|
|
|
|
|
|
public function getSubject(): string
|
|
{
|
|
return "$this->name may be $this->new_status";
|
|
}
|
|
|
|
public function getBody(array $config): string
|
|
{
|
|
$base_path = $config["server"]["base_path"];
|
|
|
|
return
|
|
"Someone has edited Wikipedia to state that $this->name is $this->new_status. " .
|
|
"For more information, read their Wikipedia article at " .
|
|
"https://en.wikipedia.org/wiki/" . rawurlencode($this->name) .
|
|
"\n\n" .
|
|
"You are receiving this message because of the preferences in your Death Notifier account. " .
|
|
"To unsubscribe from these messages, go to the Death Notifier website, log in, and change your email " .
|
|
"preferences." .
|
|
"\n\n" .
|
|
$base_path;
|
|
}
|
|
}
|