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


PHP EmailTemplate::loadFromID方法代码示例

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


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

示例1: view

 public function view()
 {
     if (!($email_template_id = $this->_context[0])) {
         redirect(extension_members::baseURL());
     }
     if (!($existing = EmailTemplate::loadFromID($email_template_id))) {
         throw new SymphonyErrorPage(__('The email template you requested to edit does not exist.'), __('Email Template not found'), 'error');
     }
     if (isset($this->_context[1])) {
         switch ($this->_context[1]) {
             case 'saved':
                 $this->pageAlert(__('Email Template updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Email Template</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), extension_members::baseURL() . 'email_templates_new/', extension_members::baseURL() . 'email_templates/')), Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('Email Template created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Email Template</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), extension_members::baseURL() . 'email_templates_new/', extension_members::baseURL() . 'email_templates/')), Alert::SUCCESS);
                 break;
         }
     }
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 9125341);
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if ($formHasErrors) {
         $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), AdministrationPage::PAGE_ALERT_ERROR);
     }
     $this->setPageType('form');
     $this->setTitle('Symphony &ndash; Member Roles &ndash; ' . $existing->subject);
     $this->appendSubheading($existing->subject);
     $fields = array();
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     } else {
         $fields['subject'] = $existing->subject;
         $fields['body'] = $existing->body;
         $fields['type'] = $existing->type;
         $fields['roles'] = NULL;
         foreach ($existing->roles() as $role_id => $r) {
             $fields['roles'] .= $r->name() . ", ";
         }
         $fields['roles'] = trim($fields['roles'], ', ');
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'primary');
     $label = Widget::Label('Subject');
     $label->appendChild(Widget::Input('fields[subject]', General::sanitize($fields['subject'])));
     if (isset($this->_errors['subject'])) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['subject']));
     } else {
         $fieldset->appendChild($label);
     }
     $label = Widget::Label('Body');
     $label->appendChild(Widget::Textarea('fields[body]', 15, 75, General::sanitize($fields['body'])));
     if (isset($this->_errors['body'])) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['body']));
     } else {
         $fieldset->appendChild($label);
     }
     $fieldset->appendChild(new XMLElement('p', 'Dynamic fields and parameters can be included in the subject or body of the email using the <code>{$param}</code> syntax. Please see the <a href="http://github.com/symphony/members/blob/master/README.markdown">readme</a> for a complete list of available parameters.', array('class' => 'help')));
     $this->Form->appendChild($fieldset);
     $sidebar = new XMLElement('fieldset');
     $sidebar->setAttribute('class', 'secondary');
     $label = Widget::Label('Type');
     $options = array(array(NULL, false, NULL), array('reset-password', $fields['type'] == 'reset-password', 'Reset Password'), array('new-password', $fields['type'] == 'new-password', 'New Password'), array('activate-account', $fields['type'] == 'activate-account', 'Activate Account'), array('welcome', $fields['type'] == 'welcome', 'Welcome Email'));
     $label->appendChild(Widget::Select('fields[type]', $options));
     if (isset($this->_errors['type'])) {
         $sidebar->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['type']));
     } else {
         $sidebar->appendChild($label);
     }
     $label = Widget::Label('Roles');
     $label->appendChild(Widget::Input('fields[roles]', $fields['roles']));
     if (isset($this->_errors['roles'])) {
         $sidebar->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['roles']));
     } else {
         $sidebar->appendChild($label);
     }
     $roles = DatabaseUtilities::resultColumn(ASDCLoader::instance()->query("SELECT `name` FROM `tbl_members_roles` ORDER BY `name` ASC"), 'name');
     if (is_array($roles) && !empty($roles)) {
         $taglist = new XMLElement('ul');
         $taglist->setAttribute('class', 'tags');
         foreach ($roles as $tag) {
             $taglist->appendChild(new XMLElement('li', $tag));
         }
         $sidebar->appendChild($taglist);
     }
     $this->Form->appendChild($sidebar);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', array('accesskey' => 's')));
     $button = new XMLElement('button', __('Delete'));
     $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'confirm delete', 'title' => __('Delete this email template')));
     $div->appendChild($button);
     $this->Form->appendChild($div);
 }
开发者ID:ErisDS,项目名称:Bugaroo,代码行数:92,代码来源:content.email_templates_edit.php

示例2: current

 public function current()
 {
     $this->_current = EmailTemplate::loadFromID($this->_iterator->current()->id);
     return $this->_current;
 }
开发者ID:ErisDS,项目名称:Bugaroo,代码行数:5,代码来源:extension.driver.php


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