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


PHP MailTemplate::save方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new MailTemplate();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['MailTemplate'])) {
         $model->attributes = $_POST['MailTemplate'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:loristissino,项目名称:swu,代码行数:17,代码来源:MailtemplateController.php

示例2: actionCreate

 /**
  * Создает новую модель почтового шаблона.
  * Если создание прошло успешно - перенаправляет на просмотр.
  *
  * @return void
  */
 public function actionCreate()
 {
     $model = new MailTemplate();
     if (Yii::app()->getRequest()->getParam('eid')) {
         $model->event_id = (int) Yii::app()->getRequest()->getParam('eid');
     }
     if (($data = Yii::app()->getRequest()->getPost('MailTemplate')) !== null) {
         $model->setAttributes($data);
         if ($model->save()) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('MailModule.mail', 'Record was created!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create']));
         }
     }
     $this->render('create', ['model' => $model]);
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:21,代码来源:TemplateBackendController.php

示例3: actionCreate

 /**
  * Создает новую модель почтового шаблона.
  * Если создание прошло успешно - перенаправляет на просмотр.
  *
  * @return void
  */
 public function actionCreate()
 {
     $model = new MailTemplate();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (Yii::app()->getRequest()->getParam('eid')) {
         $model->event_id = (int) Yii::app()->getRequest()->getParam('eid');
     }
     if (($data = Yii::app()->getRequest()->getPost('MailTemplate')) !== null) {
         $model->setAttributes($data);
         if ($model->save()) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('MailModule.mail', 'Record was created!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', array('create')));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:sepaker,项目名称:yupe,代码行数:23,代码来源:TemplateBackendController.php

示例4: parseMailTemplateFormular

function parseMailTemplateFormular($ui, $session, &$template = null)
{
    $label = stripslashes($_POST["label"]);
    $body = stripslashes($_POST["body"]);
    if ($template == null) {
        $gliederung = $session->getStorage()->getGliederung($session->getVariable("gliederungid"));
        if (!$session->isAllowed("mailtemplates_create", $gliederung->getGliederungID())) {
            $ui->viewLogin();
            exit;
        }
        $template = new MailTemplate($session->getStorage());
        $template->setGliederung($gliederung);
    } else {
        $gliederung = $template->getGliederung();
        if (!$session->isAllowed("mailtemplates_modify", $gliederung->getGliederungID())) {
            $ui->viewLogin();
            exit;
        }
    }
    $template->setLabel($label);
    $template->setBody($body);
    // Headerfelder
    $headerfields = $session->getListVariable("headerfields");
    $headervalues = $session->getListVariable("headervalues");
    $headerfieldsindex = array_map('strtolower', $headerfields);
    foreach ($template->getHeaders() as $field => $header) {
        if (empty($field) || !in_array(strtolower($field), $headerfieldsindex)) {
            $template->delHeader($field);
        }
    }
    $headers = array_combine($headerfields, $headervalues);
    foreach ($headers as $field => $value) {
        if (!empty($field)) {
            $template->setHeader($field, $value);
        }
    }
    $template->save();
}
开发者ID:jungepiraten,项目名称:vpanel,代码行数:38,代码来源:mailtemplates.php


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