* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseMailer extends BaseFrameworkSystem {
/**
* @param $templateName Name of the template we shall load
* @return void
*/
- public function loadTemplate ($templateName) {
+ protected final function loadTemplate ($templateName) {
// Set template name
$this->setTemplateName($templateName);
* @param $userInstance An instance of a user class
* @return void
*/
- public function addRecipientByUserInstance (ManageableUser $userInstance) {
+ public function addRecipientByUserInstance (ManageableMember $userInstance) {
// Get template name
$templateName = $this->getTemplateName();
// Is the list initialized?
if (!isset($this->recipientList[$templateName]['recipients'])) {
// Then initialize it here
- $this->recipientList[$templateName]['recipients'] = new FrameworkArrayObject("FakedRecipientList");
+ $this->recipientList[$templateName]['recipients'] = array();
} // END - if
// Add it as a recipient
- $this->recipientList[$templateName]['recipients']->append($userInstance);
+ $this->recipientList[$templateName]['recipients'][] = $userInstance;
+ }
+
+ /**
+ * Adds a template variable (just the name) to the recipient list in given section of current template
+ *
+ * @param $section Section can be "config" or "value" currently
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ private final function addTemplateVariable ($section, $variableName) {
+ // Get template name
+ $templateName = $this->getTemplateName();
+
+ // Generate full section name
+ $sectionName = $section . '_vars';
+
+ // Is the list initialized?
+ if (!isset($this->recipientList[$templateName][$sectionName])) {
+ // Then initialize it here
+ $this->recipientList[$templateName][$sectionName] = array();
+ } // END - if
+
+ // Add the variable to the list
+ $this->recipientList[$templateName][$sectionName][$variableName] = 'OK';
+ }
+
+ /**
+ * Adds a config template variable to the recipient list of current template
+ *
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ public final function addConfigTemplateVariable ($variableName) {
+ $this->addTemplateVariable("config", $variableName);
+ }
+
+ /**
+ * Adds a "value" template variable to the recipient list of current template
+ *
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ public final function addValueTemplateVariable ($variableName) {
+ $this->addTemplateVariable("value", $variableName);
+ }
+
+ /**
+ * Adds a value instance for a given variable name. It should be set!
+ *
+ * @param $variableName Template variable we want to assign a value instance
+ * @param $valueInstance An object instance which can provide "field values"
+ * @return void
+ */
+ public final function addValueInstance ($variableName, FrameworkInterface $valueInstance) {
+ $this->recipientList[$this->getTemplateName()]['values'][$variableName] = $valueInstance;
}
/**
* @param $templateName Name of email template
* @return void
*/
- protected final function setTemplateName ($templateName) {
+ public final function setTemplateName ($templateName) {
$this->templateName = (string) $templateName;
}
// Set the subject line
$this->setSubjectLine("{?subject?}");
}
+
+ /**
+ * Getter for recipient list array
+ *
+ * @return $recipientList Array with reciepients
+ */
+ public final function getRecipientList () {
+ return $this->recipientList;
+ }
}
// [EOF]