当前位置: 首页>>代码示例>>PHP>>正文


PHP EmailTemplate::getById方法代码示例

本文整理汇总了PHP中EmailTemplate::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::getById方法的具体用法?PHP EmailTemplate::getById怎么用?PHP EmailTemplate::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EmailTemplate的用法示例。


在下文中一共展示了EmailTemplate::getById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: makeBuilderPredefinedEmailTemplate

 protected function makeBuilderPredefinedEmailTemplate($name, $unserializedData, $subject = null, $modelClassName = null, $language = null, $type = null, $isDraft = 0, $textContent = null, $htmlContent = null)
 {
     $emailTemplate = new EmailTemplate();
     $emailTemplate->type = $type;
     //EmailTemplate::TYPE_WORKFLOW;
     $emailTemplate->builtType = EmailTemplate::BUILT_TYPE_BUILDER_TEMPLATE;
     $emailTemplate->isDraft = $isDraft;
     $emailTemplate->modelClassName = $modelClassName;
     $emailTemplate->name = $name;
     if (empty($subject)) {
         $subject = $name;
     }
     $emailTemplate->subject = $subject;
     if (!isset($language)) {
         $language = Yii::app()->languageHelper->getForCurrentUser();
     }
     $emailTemplate->language = $language;
     $emailTemplate->htmlContent = $htmlContent;
     $emailTemplate->textContent = $textContent;
     $emailTemplate->serializedData = CJSON::encode($unserializedData);
     $emailTemplate->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
     $saved = $emailTemplate->save(false);
     if (!$saved) {
         throw new FailedToSaveModelException();
     }
     $emailTemplate = EmailTemplate::getById($emailTemplate->id);
     ReadPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($emailTemplate, Group::getByName(Group::EVERYONE_GROUP_NAME));
     $saved = $emailTemplate->save(false);
     assert('$saved');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:30,代码来源:EmailTemplatesBaseDefaultDataMaker.php

示例2: sendemail

/**
 * Send a "close pend ticket" email to the end user. (created, taken, etc...)
 */
function sendemail($messageno, $target, $id)
{
    $template = EmailTemplate::getById($messageno, gGetDb());
    $headers = 'From: accounts-enwiki-l@lists.wikimedia.org';
    // Get the closing user's Email signature and append it to the Email.
    if (User::getCurrent()->getEmailSig() != "") {
        $emailsig = html_entity_decode(User::getCurrent()->getEmailSig(), ENT_QUOTES, "UTF-8");
        mail($target, "RE: [ACC #{$id}] English Wikipedia Account Request", $template->getText() . "\n\n" . $emailsig, $headers);
    } else {
        mail($target, "RE: [ACC #{$id}] English Wikipedia Account Request", $template->getText(), $headers);
    }
}
开发者ID:FastLizard4,项目名称:waca,代码行数:15,代码来源:functions.php

示例3: resolveEmailTemplateContent

 protected static function resolveEmailTemplateContent(WorkflowMessageInQueue $model)
 {
     $unserializedData = unserialize($model->serializedData);
     try {
         if (isset($unserializedData[0]) && isset($unserializedData[0]['emailTemplateId'])) {
             $emailTemplate = EmailTemplate::getById((int) $unserializedData[0]['emailTemplateId']);
             $modelContent = strval($emailTemplate);
         } else {
             throw new NotFoundException();
         }
     } catch (AccessDeniedSecurityException $e) {
         $modelContent = Zurmo::t('Core', 'Restricted');
     } catch (NotFoundException $e) {
         $modelContent = Zurmo::t('ZurmoModule', 'Record no longer exists');
     }
     return ' &mdash; <span class="less-pronounced-text">' . $modelContent . '</span>';
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:17,代码来源:WorkflowMessageInQueueUtil.php

示例4: process

 /**
  * @throws MissingRecipientsForEmailMessageException
  */
 public function process()
 {
     $emailTemplate = EmailTemplate::getById((int) $this->emailMessageForm->emailTemplateId);
     $emailMessage = new EmailMessage();
     $emailMessage->owner = $this->triggeredByUser;
     $emailMessage->subject = $this->resolveEmailTemplateSubjectForModelData($emailTemplate);
     $emailContent = new EmailMessageContent();
     $emailContent->textContent = $this->resolveEmailTemplateTextContentForModelData($emailTemplate);
     $emailContent->htmlContent = $this->resolveEmailTemplateHtmlContentForModelData($emailTemplate);
     $emailMessage->content = $emailContent;
     $emailMessage->sender = $this->resolveSender();
     $this->resolveRecipients($emailMessage);
     if ($emailMessage->recipients->count() == 0) {
         throw new MissingRecipientsForEmailMessageException();
     }
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_DRAFT);
     Yii::app()->emailHelper->send($emailMessage);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:22,代码来源:WorkflowEmailMessageProcessingHelper.php

示例5: testCreateAndGetEmailTemplateById

 public function testCreateAndGetEmailTemplateById()
 {
     $emailTemplate = new EmailTemplate();
     $emailTemplate->type = EmailTemplate::TYPE_CONTACT;
     $emailTemplate->subject = 'Test subject';
     $emailTemplate->modelClassName = 'Contact';
     $emailTemplate->name = 'Test Email Template';
     $emailTemplate->htmlContent = 'Test html Content';
     $emailTemplate->textContent = 'Test text Content';
     $this->assertTrue($emailTemplate->save());
     $id = $emailTemplate->id;
     unset($emailTemplate);
     $emailTemplate = EmailTemplate::getById($id);
     $this->assertEquals(EmailTemplate::TYPE_CONTACT, $emailTemplate->type);
     $this->assertEquals('Test subject', $emailTemplate->subject);
     $this->assertEquals('Test Email Template', $emailTemplate->name);
     $this->assertEquals('Test html Content', $emailTemplate->htmlContent);
     $this->assertEquals('Test text Content', $emailTemplate->textContent);
     $this->assertEquals(1, count(EmailTemplate::getAll()));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:20,代码来源:EmailTemplateTest.php

示例6: makeAll

 /**
  * @param DemoDataHelper $demoDataHelper
  */
 public function makeAll(&$demoDataHelper)
 {
     assert('$demoDataHelper instanceof DemoDataHelper');
     assert('$demoDataHelper->isSetRange("User")');
     $emailTemplates = array();
     $types = array_keys(EmailTemplate::getTypeDropDownArray());
     for ($this->index = 0; $this->index < 7; $this->index++) {
         $emailTemplate = new EmailTemplate();
         $emailTemplate->type = $types[$this->index % 2];
         $emailTemplate->owner = $demoDataHelper->getRandomByModelName('User');
         $this->populateModel($emailTemplate);
         $emailTemplate->addPermissions(Group::getByName(Group::EVERYONE_GROUP_NAME), Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
         $saved = $emailTemplate->save();
         assert('$saved');
         $emailTemplate = EmailTemplate::getById($emailTemplate->id);
         ReadPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($emailTemplate, Group::getByName(Group::EVERYONE_GROUP_NAME));
         $emailTemplate->save();
         $emailTemplates[] = $emailTemplate->id;
     }
     $demoDataHelper->setRangeByModelName('EmailTemplate', $emailTemplates[0], $emailTemplates[count($emailTemplates) - 1]);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:24,代码来源:EmailTemplatesDemoDataMaker.php

示例7: testSaveWithBaseTemplateIdUpdate

 /**
  * @depends testSaveWithValidDataWithValidation
  * @depends testGetHtmlContentActionForBuilder
  */
 public function testSaveWithBaseTemplateIdUpdate()
 {
     $emailTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'builder 02');
     $emailTemplate = EmailTemplate::getById($emailTemplateId);
     $oldUnserializedData = CJSON::decode($emailTemplate->serializedData);
     $oldBaseTemplateId = ArrayUtil::getArrayValue($oldUnserializedData, 'baseTemplateId');
     $baseTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'builder 01');
     $baseTemplate = EmailTemplate::getById($baseTemplateId);
     $expectedUnserializedData = CJSON::decode($baseTemplate->serializedData);
     unset($expectedUnserializedData['icon']);
     $expectedUnserializedData['baseTemplateId'] = $baseTemplate->id;
     $expectedHtmlContent = EmailTemplateSerializedDataToHtmlUtil::resolveHtmlByUnserializedData($expectedUnserializedData);
     $post = array('BuilderEmailTemplateWizardForm' => array('name' => 'builder 02', 'subject' => 'builder 02', 'type' => 2, 'builtType' => 3, 'isDraft' => 0, 'language' => '', 'hiddenId' => $emailTemplateId, 'modelClassName' => 'Contact', 'ownerId' => 1, 'ownerName' => 'Super User', 'explicitReadWriteModelPermissions' => array('nonEveryoneGroup' => 3, 'type' => 1), 'baseTemplateId' => $baseTemplateId, 'serializedData' => array('baseTemplateId' => $baseTemplateId, 'dom' => CJSON::encode($oldUnserializedData['dom'])), 'originalBaseTemplateId' => $oldBaseTemplateId, 'textContent' => 'some text changed'), 'validationScenario' => BuilderEmailTemplateWizardForm::PLAIN_AND_RICH_CONTENT_VALIDATION_SCENARIO, 'ajax' => 'edit-form');
     $this->setGetArray(array('builtType' => EmailTemplate::BUILT_TYPE_BUILDER_TEMPLATE));
     $this->setPostArray($post);
     $content = $this->runControllerWithExitExceptionAndGetContent('emailTemplates/default/save');
     $jsonDecodedContent = CJSON::decode($content);
     $this->assertEmpty($jsonDecodedContent);
     // now send the actual save request
     unset($post['ajax']);
     $this->setPostArray($post);
     $content = $this->runControllerWithExitExceptionAndGetContent('emailTemplates/default/save');
     $jsonDecodedContent = CJSON::decode($content);
     $this->assertNotEmpty($jsonDecodedContent);
     $this->assertCount(3, $jsonDecodedContent);
     $this->assertArrayHasKey('id', $jsonDecodedContent);
     $this->assertEquals($emailTemplateId, $jsonDecodedContent['id']);
     $this->assertArrayHasKey('redirectToList', $jsonDecodedContent);
     $this->assertFalse($jsonDecodedContent['redirectToList']);
     $this->assertArrayHasKey('moduleClassName', $jsonDecodedContent);
     $this->assertEquals('ContactsModule', $jsonDecodedContent['moduleClassName']);
     // ensure htmlContent was generated.
     $emailTemplate->forgetAll();
     unset($emailTemplate);
     $emailTemplate = EmailTemplate::getById($emailTemplateId);
     $unserializedData = CJSON::decode($emailTemplate->serializedData);
     $this->assertEquals($expectedUnserializedData, $unserializedData);
     $this->assertEquals('some text changed', $emailTemplate->textContent);
     $this->assertEquals($expectedHtmlContent, $emailTemplate->htmlContent);
 }
开发者ID:spiogit,项目名称:cna-seed-project,代码行数:44,代码来源:EmailTemplatesSuperUserWalkthroughTest.php

示例8: actionSendTestEmail

 public function actionSendTestEmail($id, $contactId = null, $emailAddress = null, $useHtmlContent = 1)
 {
     $emailTemplate = EmailTemplate::getById(intval($id));
     ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($emailTemplate);
     $htmlContent = $emailTemplate->htmlContent;
     if (!$useHtmlContent) {
         $htmlContent = EmailTemplateSerializedDataToHtmlUtil::resolveHtmlByEmailTemplateModel($emailTemplate, false);
     }
     $contact = null;
     if (isset($contactId)) {
         $contact = Contact::getById(intval($contactId));
     }
     static::resolveEmailMessage($emailTemplate, $contact, $htmlContent, $emailAddress);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:14,代码来源:DefaultController.php

示例9: resolveSerializedDataForTemplateByPostData

 protected static function resolveSerializedDataForTemplateByPostData()
 {
     $unserializedData = array();
     $postUnserializedData = ArrayUtil::getArrayValue(static::$data, 'serializedData');
     $templateUnserializedData = CJSON::decode(static::$emailTemplate->serializedData);
     if (empty($templateUnserializedData)) {
         $templateUnserializedData = array('baseTemplateId' => null);
     }
     // dom element would be empty till we get to canvas screen and hit save/finish at least once on create
     // we need to unset it so if user does not change pre-selected base template on step 2 and moves to canvas
     // during step 2, we don't end up purging baseTemplate's dom we loaded in step1's save.
     if (empty($postUnserializedData['dom'])) {
         unset($postUnserializedData['dom']);
     } else {
         // if it is set then it is most probably in
         $postUnserializedData['dom'] = CJSON::decode($postUnserializedData['dom']);
     }
     if (static::hasBaseTemplateIdChanged($postUnserializedData['baseTemplateId'], $templateUnserializedData['baseTemplateId'])) {
         // baseTemplateId has changed.
         $baseTemplateModel = EmailTemplate::getById(intval($postUnserializedData['baseTemplateId']));
         $unserializedData = CJSON::decode($baseTemplateModel->serializedData);
         unset($unserializedData['icon']);
         $unserializedData['baseTemplateId'] = $postUnserializedData['baseTemplateId'];
     } elseif ($templateUnserializedData != $postUnserializedData) {
         // baseTemplateId remains same, probably a post from canvas
         if (isset($postUnserializedData['dom']) && isset($templateUnserializedData['dom'])) {
             unset($templateUnserializedData['dom']);
         }
         $unserializedData = CMap::mergeArray($templateUnserializedData, $postUnserializedData);
     }
     if (!empty($unserializedData)) {
         static::$emailTemplate->serializedData = CJSON::encode($unserializedData);
     }
     // we don't need this as we "continue" in the invoker if block but still...
     unset(static::$data['serializedData']);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:36,代码来源:DataToEmailTemplateUtil.php

示例10: testSuperUserDetailsActionForWorkflow

 /**
  * @depends testSuperUserDetailsJsonActionForWorkflow
  */
 public function testSuperUserDetailsActionForWorkflow()
 {
     $emailTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'New Test Workflow Email Template 00');
     $emailTemplate = EmailTemplate::getById($emailTemplateId);
     $this->setGetArray(array('id' => $emailTemplateId));
     $content = $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/details');
     $this->assertTrue(strpos($content, '<span class="ellipsis-content">' . $emailTemplate->name . '</span>') !== false);
     $this->assertTrue(strpos($content, '<span>Options</span>') !== false);
     $this->assertTrue(strpos($content, 'emailTemplates/default/edit?id=' . $emailTemplateId) !== false);
     $this->assertTrue(strpos($content, 'emailTemplates/default/delete?id=' . $emailTemplateId) !== false);
     $this->assertTrue(strpos($content, '<th>Name</th><td colspan="1">' . $emailTemplate->name . '</td>') !== false);
     $this->assertTrue(strpos($content, '<th>Subject</th><td colspan="1">' . $emailTemplate->subject . '</td>') !== false);
     $this->assertTrue(strpos($content, '<div class="tabs-nav"><a class="active-tab" href="#tab1">') !== false);
     $this->assertTrue(strpos($content, '<a href="#tab2">') !== false);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:18,代码来源:EmailTemplatesSuperUserWalkthroughTest.php

示例11: resolveHtmlByEmailTemplateId

 /**
  * Resolve html for a builder template provided its id
  * @param $emailTemplateId
  * @param bool $renderForCanvas
  * @return bool|null|string
  */
 public static function resolveHtmlByEmailTemplateId($emailTemplateId, $renderForCanvas = false)
 {
     $emailTemplate = EmailTemplate::getById(intval($emailTemplateId));
     $resolvedHtml = static::resolveHtmlByEmailTemplateModel($emailTemplate, $renderForCanvas);
     return $resolvedHtml;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:12,代码来源:EmailTemplateSerializedDataToHtmlUtil.php

示例12: use

         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;
     }
     $emailTemplate = EmailTemplate::getById($_GET['edit'], gGetDb());
     $smarty->assign('id', $emailTemplate->getId());
     $smarty->assign('emailTemplate', $emailTemplate);
     $smarty->assign('createdid', $createdid);
     $smarty->assign('requeststates', $availableRequestStates);
     $smarty->assign('emailmgmtpage', 'Edit');
     // Use a variable so we don't need two Smarty templates for creating and editing.
     $smarty->display("email-management/edit.tpl");
     BootstrapSkin::displayInternalFooter();
     die;
 }
 $query = "SELECT * FROM emailtemplate WHERE active = 1";
 $statement = gGetDb()->prepare($query);
 $statement->execute();
 $rows = $statement->fetchAll(PDO::FETCH_CLASS, "EmailTemplate");
 $smarty->assign('activeemails', $rows);
开发者ID:FastLizard4,项目名称:waca,代码行数:31,代码来源:acc.php

示例13: testHtmlContentGetsSavedCorrectly

 /**
  * @depends testCreateAndGetEmailTemplateById
  */
 public function testHtmlContentGetsSavedCorrectly()
 {
     $randomData = ZurmoRandomDataUtil::getRandomDataByModuleAndModelClassNames('EmailTemplatesModule', 'EmailTemplate');
     $htmlContent = $randomData['htmlContent'][count($randomData['htmlContent']) - 1];
     $emailTemplate = new EmailTemplate();
     $emailTemplate->type = EmailTemplate::TYPE_CONTACT;
     $emailTemplate->builtType = EmailTemplate::BUILT_TYPE_PASTED_HTML;
     $emailTemplate->subject = 'Another Test subject';
     $emailTemplate->name = 'Another Test Email Template';
     $emailTemplate->textContent = 'Text Content';
     $emailTemplate->htmlContent = $htmlContent;
     $emailTemplate->modelClassName = 'Contact';
     $this->assertTrue($emailTemplate->save());
     $emailTemplateId = $emailTemplate->id;
     $emailTemplate->forgetAll();
     $emailTemplate = EmailTemplate::getById($emailTemplateId);
     $this->assertEquals($htmlContent, $emailTemplate->htmlContent);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:21,代码来源:EmailTemplateTest.php

示例14: getLogDescription

 /**
  * Summary of getLogDescription
  * @param Log $entry 
  * @return string
  */
 public static function getLogDescription(Log $entry)
 {
     $text = "Deferred to ";
     if (substr($entry->getAction(), 0, strlen($text)) == $text) {
         // Deferred to a different queue
         // This is exactly what we want to display.
         return $entry->getAction();
     }
     $text = "Closed custom-n";
     if ($entry->getAction() == $text) {
         // Custom-closed
         return "closed (custom reason - account not created)";
     }
     $text = "Closed custom-y";
     if ($entry->getAction() == $text) {
         // Custom-closed
         return "closed (custom reason - account created)";
     }
     $text = "Closed 0";
     if ($entry->getAction() == $text) {
         // Dropped the request - short-circuit the lookup
         return "dropped request";
     }
     $text = "Closed ";
     if (substr($entry->getAction(), 0, strlen($text)) == $text) {
         // Closed with a reason - do a lookup here.
         $id = substr($entry->getAction(), strlen($text));
         $template = EmailTemplate::getById((int) $id, $entry->getDatabase());
         if ($template != false) {
             return "closed (" . $template->getName() . ")";
         }
     }
     // Fall back to the basic stuff
     $lookup = array('Reserved' => 'reserved', 'Email Confirmed' => 'email-confirmed', 'Unreserved' => 'unreserved', 'Approved' => 'approved', 'Suspended' => 'suspended', 'Banned' => 'banned', 'Edited' => 'edited interface message', 'Declined' => 'declined', 'EditComment-c' => 'edited a comment', 'EditComment-r' => 'edited a comment', 'Unbanned' => 'unbanned', 'Promoted' => 'promoted to tool admin', 'BreakReserve' => 'forcibly broke the reservation', 'Prefchange' => 'changed user preferences', 'Renamed' => 'renamed', 'Demoted' => 'demoted from tool admin', 'ReceiveReserved' => 'received the reservation', 'SendReserved' => 'sent the reservation', 'EditedEmail' => 'edited email', 'DeletedTemplate' => 'deleted template', 'EditedTemplate' => 'edited template', 'CreatedEmail' => 'created email', 'CreatedTemplate' => 'created template', 'SentMail' => 'sent an email to the requestor');
     if (array_key_exists($entry->getAction(), $lookup)) {
         return $lookup[$entry->getAction()];
     }
     // OK, I don't know what this is. Fall back to something sane.
     return "performed an unknown action ({$entry->getAction()})";
 }
开发者ID:Austin503,项目名称:waca,代码行数:45,代码来源:Logger.php

示例15: resolveHtmlByEmailTemplateId

 /**
  * Resolve html for a builder template provided its id
  * @param $emailTemplateId
  * @param bool $renderForCanvas
  * @param OwnedSecurableItem $attachedMergeTagModel
  * @return bool|null|string
  */
 public static function resolveHtmlByEmailTemplateId($emailTemplateId, $renderForCanvas = false, OwnedSecurableItem $attachedMergeTagModel = null)
 {
     $emailTemplate = EmailTemplate::getById(intval($emailTemplateId));
     $resolvedHtml = static::resolveHtmlByEmailTemplateModel($emailTemplate, $renderForCanvas, $attachedMergeTagModel);
     return $resolvedHtml;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:13,代码来源:EmailTemplateSerializedDataToHtmlUtil.php


注:本文中的EmailTemplate::getById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。