Beispiel #1
0
     }
     $emailTemplate->setName($_POST['name']);
     $emailTemplate->setText($_POST['text']);
     $emailTemplate->setJsquestion($_POST['jsquestion']);
     if ($_GET['edit'] == $createdid) {
         // Both checkboxes on the main created message should always be enabled.
         $emailTemplate->setDefaultAction(EmailTemplate::CREATED);
         $emailTemplate->setActive(1);
         $emailTemplate->setPreloadOnly(0);
     } else {
         $emailTemplate->setDefaultAction($_POST['defaultaction']);
         $emailTemplate->setActive(isset($_POST['active']));
         $emailTemplate->setPreloadOnly(isset($_POST['preloadonly']));
     }
     // Check if the entered name already exists (since these names are going to be used as the labels for buttons on the zoom page).
     $nameCheck = EmailTemplate::getByName($_POST['name'], gGetDb());
     if ($nameCheck != false && $nameCheck->getId() != $_GET['edit']) {
         BootstrapSkin::displayAlertBox("That Email template name is already being used. Please choose another.");
         BootstrapSkin::displayInternalFooter();
         die;
     }
     $database->transactionally(function () use($database, $emailTemplate) {
         $emailTemplate->save();
         Logger::editedEmail($database, $emailTemplate);
         global $baseurl;
         Notification::emailEdited($emailTemplate);
         SessionAlert::success("Email template has been saved successfully.");
         header("Location: {$baseurl}/acc.php?action=emailmgmt");
     });
     die;
 }
Beispiel #2
0
 /**
  * @depends testCreateAndGetEmailTemplateById
  */
 public function testGetLabel()
 {
     $emailTemplate = EmailTemplate::getByName('Test Email Template');
     $this->assertEquals(1, count($emailTemplate));
     $this->assertEquals('Email Template', $emailTemplate[0]::getModelLabelByTypeAndLanguage('Singular'));
     $this->assertEquals('Email Templates', $emailTemplate[0]::getModelLabelByTypeAndLanguage('Plural'));
 }
 /**
  * @depends testCreateAndGetEmailTemplateById
  */
 public function testSetInitializingHtmlContentForBuilderTemplates()
 {
     $defaultDataMaker = new EmailTemplatesDefaultDataMaker();
     $defaultDataMaker->make();
     $predefinedTemplate = EmailTemplate::getByName('3 Columns with Hero');
     $this->assertNotEmpty($predefinedTemplate);
     $emailTemplate = EmailTemplateTestHelper::populate('set Test', 'setTest', 'Contact', null, null, EmailTemplate::TYPE_CONTACT, 0, EmailTemplate::BUILT_TYPE_BUILDER_TEMPLATE, $predefinedTemplate[0]->serializedData);
     $this->assertNotEmpty($emailTemplate->htmlContent);
 }