class_DebugMailer.php
Go to the documentation of this file.00001 <?php
00025 class DebugMailer extends BaseMailer implements DeliverableMail {
00031 protected function __construct () {
00032
00033 parent::__construct(__CLASS__);
00034 }
00035
00044 public final static function createDebugMailer (CompileableTemplate $templateInstance, ManageableApplication $appInstance, $templateName) {
00045
00046 $mailerInstance = new DebugMailer();
00047
00048
00049 $mailerInstance->setTemplateInstance($templateInstance);
00050
00051
00052 $mailerInstance->setApplicationInstance($appInstance);
00053
00054
00055 $mailerInstance->setTemplateName('resend_link');
00056
00057
00058 return $mailerInstance;
00059 }
00060
00067 public function deliverEmail () {
00068
00069 $templateInstance = $this->getTemplateInstance();
00070
00071
00072 foreach ($this->getRecipientList() as $templateName => $recipientList) {
00073
00074 foreach ($recipientList['recipients'] as $recipientInstance) {
00075
00076 if (!$recipientInstance instanceof ManageableMember) {
00077
00078 throw new InvalidInterfaceException(array($this, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
00079 }
00080
00081
00082 $this->loadTemplate($templateName);
00083
00084
00085 $templateInstance->assignVariable('subject', $this->getSubjectLine());
00086
00087
00088 foreach ($recipientList['config_vars'] as $variable => $dummy) {
00089
00090 $templateInstance->assignConfigVariable($variable);
00091 }
00092
00093
00094 foreach ($recipientList['value_vars'] as $variable => $dummy) {
00095
00096 if (!isset($recipientList['values'][$variable])) {
00097
00098 throw new NullPointerException ($this, self::EXCEPTION_IS_NULL_POINTER);
00099 }
00100
00101
00102 $fieldValue = $recipientList['values'][$variable]->getField($variable);
00103
00104
00105 $templateInstance->assignVariable($variable, $fieldValue);
00106 }
00107
00108
00109 $templateInstance->renderXmlContent();
00110
00111
00112 $responseInstance = $this->getApplicationInstance()->getResponseInstance();
00113
00114
00115 $this->getTemplateInstance()->transferToResponse($responseInstance);
00116 }
00117 }
00118 }
00119
00126 public function sendAdminNotification () {
00127
00128 }
00129
00135 public function invokeMailDelivery () {
00136
00137 $templateInstance = $this->getTemplateInstance();
00138
00139
00140 $message = $templateInstance->getCompiledData();
00141 $templateInstance->assignVariable('message', $message);
00142
00143
00144 $templateInstance->loadCodeTemplate('mail_debug');
00145
00146
00147 $templateInstance->compileTemplate();
00148
00149
00150 $templateInstance->assignTemplateWithVariable('mail_debug', 'content');
00151
00152
00153 $templateInstance->loadCodeTemplate('header');
00154
00155
00156 $templateInstance->compileTemplate();
00157 $templateInstance->assignTemplateWithVariable('header', 'header');
00158
00159
00160 $templateInstance->loadCodeTemplate('footer');
00161
00162
00163 $templateInstance->compileTemplate();
00164 $templateInstance->assignTemplateWithVariable('footer', 'footer');
00165
00166
00167 $templateInstance->loadCodeTemplate($this->getApplicationInstance()->getMasterTemplate());
00168
00169
00170 $templateInstance->compileVariables();
00171 }
00172 }
00173
00174
00175 ?>