本文整理汇总了PHP中EmailTemplate::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::getAll方法的具体用法?PHP EmailTemplate::getAll怎么用?PHP EmailTemplate::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailTemplate
的用法示例。
在下文中一共展示了EmailTemplate::getAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRegularUserCreateActionForWorkflow
/**
* @depends testRegularUserAllDefaultControllerActions
*/
public function testRegularUserCreateActionForWorkflow()
{
// TODO: @Shoaibi/@Jason: Medium: Even if a user doesn't have module permission he can sent that modelClassName in POST
// nobody needs access to meetings ans contact to have that in ddl.
$this->user->setRight('ContactsModule', ContactsModule::getAccessRight());
$this->user->setRight('MeetingsModule', MeetingsModule::getAccessRight());
$this->assertTrue($this->user->save());
// Create a new emailTemplate and test validator.
$this->setGetArray(array('type' => EmailTemplate::TYPE_WORKFLOW));
$this->setPostArray(array('EmailTemplate' => array('type' => EmailTemplate::TYPE_WORKFLOW, 'name' => 'New Test Workflow EmailTemplate', 'subject' => 'New Test Subject')));
$content = $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/create');
$this->assertTrue(strpos($content, 'Create Email Template') !== false);
$this->assertFalse(strpos($content, '<select name="EmailTemplate[type]" id="EmailTemplate_type">') !== false);
$this->assertTrue(strpos($content, '<select name="EmailTemplate[modelClassName]" id="EmailTemplate_modelClassName_value"') !== false);
$this->assertTrue(strpos($content, 'Please provide at least one of the contents field.') !== false);
$this->assertTrue(strpos($content, 'Module cannot be blank.') !== false);
// Create a new emailTemplate and test merge tags validator.
$this->setPostArray(array('EmailTemplate' => array('type' => EmailTemplate::TYPE_WORKFLOW, 'modelClassName' => 'Meeting', 'name' => 'New Test Workflow EmailTemplate', 'subject' => 'New Test Subject', 'textContent' => 'This is text content [[INVALID^TAG]]', 'htmlContent' => 'This is Html content [[INVALIDTAG]]')));
$content = $this->runControllerWithNoExceptionsAndGetContent('emailTemplates/default/create');
$this->assertTrue(strpos($content, 'Create Email Template') !== false);
$this->assertFalse(strpos($content, '<select name="EmailTemplate[type]" id="EmailTemplate_type">') !== false);
$this->assertTrue(strpos($content, '<select name="EmailTemplate[modelClassName]" id="EmailTemplate_modelClassName_value">') !== false);
$this->assertTrue(strpos($content, '<option value="Meeting" selected="selected">Meetings</option>') !== false);
$this->assertTrue(strpos($content, 'INVALID^TAG') !== false);
$this->assertTrue(strpos($content, 'INVALIDTAG') !== false);
$this->assertEquals(2, substr_count($content, 'INVALID^TAG'));
$this->assertEquals(2, substr_count($content, 'INVALIDTAG'));
// Create a new emailTemplate and save it.
$this->setPostArray(array('EmailTemplate' => array('type' => EmailTemplate::TYPE_WORKFLOW, 'name' => 'New Test Workflow EmailTemplate', 'modelClassName' => 'Contact', 'subject' => 'New Test Subject [[FIRST^NAME]]', 'textContent' => 'New Text Content [[FIRST^NAME]]')));
$redirectUrl = $this->runControllerWithRedirectExceptionAndGetUrl('emailTemplates/default/create');
$emailTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'New Test Workflow EmailTemplate');
$emailTemplate = EmailTemplate::getById($emailTemplateId);
$this->assertTrue($emailTemplate->id > 0);
$this->assertEquals('New Test Subject [[FIRST^NAME]]', $emailTemplate->subject);
$this->assertEquals('New Text Content [[FIRST^NAME]]', $emailTemplate->textContent);
$this->assertTrue($emailTemplate->owner == $this->user);
$compareRedirectUrl = Yii::app()->createUrl('emailTemplates/default/details', array('id' => $emailTemplate->id));
$this->assertEquals($compareRedirectUrl, $redirectUrl);
$emailTemplates = EmailTemplate::getAll();
$this->assertEquals(1, count($emailTemplates));
}
示例2: testDeleteEmailTemplate
public function testDeleteEmailTemplate()
{
$emailTemplates = EmailTemplate::getAll();
$this->assertEquals(3, count($emailTemplates));
$emailTemplates[0]->delete();
$emailTemplates = EmailTemplate::getAll();
$this->assertEquals(2, count($emailTemplates));
}
示例3: testSuperUserDeleteAction
/**
* @depends testSuperUserDetailsActionForMarketing
*/
public function testSuperUserDeleteAction()
{
$emailTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'New Test Email Template 00');
// Delete an emailTemplate.
$this->setGetArray(array('id' => $emailTemplateId));
$this->resetPostArray();
$redirectUrl = $this->runControllerWithRedirectExceptionAndGetUrl('emailTemplates/default/delete');
$compareRedirectUrl = Yii::app()->createUrl('emailTemplates/default/listForMarketing');
$this->assertEquals($compareRedirectUrl, $redirectUrl);
$emailTemplates = EmailTemplate::getAll();
$this->assertEquals(3, count($emailTemplates));
$emailTemplateId = self::getModelIdByModelNameAndName('EmailTemplate', 'New Test Workflow Email Template 00');
$this->setGetArray(array('id' => $emailTemplateId));
$this->resetPostArray();
$redirectUrl = $this->runControllerWithRedirectExceptionAndGetUrl('emailTemplates/default/delete');
$compareRedirectUrl = Yii::app()->createUrl('emailTemplates/default/listForWorkflow');
$this->assertEquals($compareRedirectUrl, $redirectUrl);
$emailTemplates = EmailTemplate::getAll();
$this->assertEquals(2, count($emailTemplates));
}
示例4: use_class
}
*/
use_class('EmailTemplate');
$languages = getLanguages();
if (isset($_POST['me_action'])) {
if ($_POST['me_action'] == 'LOADTABLELIST') {
$header = array();
$header['w040 a'] = 'No';
$header['w250 b'] = 'Template Name';
$header['w400 c'] = 'Template Info';
$header['w080 f'] = 'Active<br />Status';
// $header['w400 d'] = 'Technical Info';
$header['w200 e'] = 'Languages<br />(click to preview)';
$tablelist_data = array();
$tablelist_data[] = $header;
$data_ids = EmailTemplate::getAll();
if (count($data_ids) == 0) {
$tablelist = '<h3 class="red">No templates found in database</h3>';
} else {
$data_counter = 0;
foreach ($data_ids as $id) {
$data_counter++;
$obj = new EmailTemplate($id);
$row = array();
foreach ($header as $hk => $hv) {
list($class_width, $class_key) = explode(' ', $hk);
$class_align = '';
switch ($class_key) {
case 'a':
$class_align = 'tac';
$value = $data_counter;