|
@@ -82,6 +82,40 @@ class Test extends Model {
|
|
|
$mail->send();
|
|
$mail->send();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function sendDeclineEmail() {
|
|
|
|
|
+
|
|
|
|
|
+ $tester = $this->getTester();
|
|
|
|
|
+ $location = $this->getLocation();
|
|
|
|
|
+ $project = $this->getProject();
|
|
|
|
|
+
|
|
|
|
|
+ // Content
|
|
|
|
|
+ $name = htmlspecialchars($tester->getDisplayName());
|
|
|
|
|
+ $address = htmlspecialchars($location->name . ", " . $location->getDisplayAddress(["address_1", "address_2", "city", "county", "postal_code"]));
|
|
|
|
|
+ $project_name = htmlspecialchars($project->name);
|
|
|
|
|
+ $project_url = htmlspecialchars(PROTOCOL . "://" . DOMAIN . "/account/projects/" . $project->id);
|
|
|
|
|
+ $internal_id = "N/A";
|
|
|
|
|
+ if($location->internal_id) $internal_id = htmlspecialchars($location->internal_id);
|
|
|
|
|
+
|
|
|
|
|
+ // Build
|
|
|
|
|
+ $builder = new EmailBuilder;
|
|
|
|
|
+ $builder->addParagraph("<b>Hi,</b>");
|
|
|
|
|
+ $builder->addLeadParagraph("A tester has declined a test.");
|
|
|
|
|
+
|
|
|
|
|
+ $builder->addParagraph("<b>Project:</b><br />$project_name");
|
|
|
|
|
+ $builder->addParagraph("<b>Site:</b><br />$address<br />ID: $location->id | Internal ID: $internal_id");
|
|
|
|
|
+ $builder->addParagraph("<b>Who:</b><br />$name<br />ID: $tester->id");
|
|
|
|
|
+ $builder->addParagraph("<a href=\"$project_url\">Click here</a> to manage the project and reassign the test.");
|
|
|
|
|
+ $content = $builder->build();
|
|
|
|
|
+
|
|
|
|
|
+ // Send
|
|
|
|
|
+ $mail = new Email;
|
|
|
|
|
+ $mail->setHtmlContent($content);
|
|
|
|
|
+ $mail->setFrom(EMAIL_NO_REPLY, EMAIL_FROM_NAME);
|
|
|
|
|
+ $mail->addAddress(EMAIL_CONTACT, "Check Policy Contact");
|
|
|
|
|
+ $mail->setSubject("Test declined: $project->name / $location->name");
|
|
|
|
|
+ $mail->send();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function getChallengeStageText() {
|
|
public function getChallengeStageText() {
|
|
|
return Test::STAGES[$this->challenge_stage];
|
|
return Test::STAGES[$this->challenge_stage];
|
|
|
}
|
|
}
|