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


PHP EmailTemplate::getBody方法代码示例

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


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

示例1: edit

 /**
  * Show / process email template form
  *
  * @param void
  * @return null
  */
 function edit()
 {
     if ($this->active_template->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $locale = $this->request->get('locale', null);
     $template_data = $this->request->post('template');
     if (!is_array($template_data)) {
         $template_data = array('subject' => $this->active_template->getSubject($locale), 'body' => $this->active_template->getBody($locale));
     }
     // if
     $template_variables = $this->active_template->getVariables() ? explode("\n", $this->active_template->getVariables()) : null;
     $this->smarty->assign(array('template_data' => $template_data, 'template_variables' => $template_variables, 'locale' => $locale));
     if ($this->request->isSubmitted()) {
         if ($locale) {
             $this->active_template->writeLocaleProperties(array_var($template_data, 'subject'), array_var($template_data, 'body'), $locale);
         } else {
             $this->active_template->setAttributes($template_data);
         }
         // if
         $save = $this->active_template->save();
         if ($save && !is_error($save)) {
             flash_success('Email template has been updated');
             $this->redirectToUrl($this->active_template->getUrl());
         } else {
             $this->smarty->assign('errors', $save);
         }
         // if
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:38,代码来源:EmailTemplatesAdminController.class.php

示例2: delete

 function delete($oDocument, $sReason, $iDestFolderId = null)
 {
     // use the deleteSymbolicLink function is this is a symlink
     if ($oDocument->isSymbolicLink()) {
         return KTDocumentUtil::deleteSymbolicLink($oDocument);
     }
     $oDocument =& KTUtil::getObject('Document', $oDocument);
     if (is_null($iDestFolderId)) {
         $iDestFolderId = $oDocument->getFolderID();
     }
     $oStorageManager =& KTStorageManagerUtil::getSingleton();
     global $default;
     if (count(trim($sReason)) == 0) {
         return PEAR::raiseError(_kt('Deletion requires a reason'));
     }
     if (PEAR::isError($oDocument) || $oDocument == false) {
         return PEAR::raiseError(_kt('Invalid document object.'));
     }
     if ($oDocument->getIsCheckedOut() == true) {
         return PEAR::raiseError(sprintf(_kt('The document is checked out and cannot be deleted: %s'), $oDocument->getName()));
     }
     if (!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.delete')) {
         return PEAR::raiseError(_kt('Document cannot be deleted as it is restricted by the workflow.'));
     }
     // IF we're deleted ...
     if ($oDocument->getStatusID() == DELETED) {
         return true;
     }
     $oOrigFolder = Folder::get($oDocument->getFolderId());
     DBUtil::startTransaction();
     // flip the status id
     $oDocument->setStatusID(DELETED);
     // $iDestFolderId is DEPRECATED.
     $oDocument->setFolderID(null);
     $oDocument->setRestoreFolderId($oOrigFolder->getId());
     $oDocument->setRestoreFolderPath(Folder::generateFolderIDs($oOrigFolder->getId()));
     $res = $oDocument->update();
     if (PEAR::isError($res) || $res == false) {
         DBUtil::rollback();
         return PEAR::raiseError(_kt('There was a problem deleting the document from the database.'));
     }
     // now move the document to the delete folder
     $res = $oStorageManager->delete($oDocument);
     if (PEAR::isError($res) || $res == false) {
         //could not delete the document from the file system
         $default->log->error('Deletion: Filesystem error deleting document ' . $oDocument->getFileName() . ' from folder ' . Folder::getFolderPath($oDocument->getFolderID()) . ' id=' . $oDocument->getFolderID());
         // we use a _real_ transaction here ...
         DBUtil::rollback();
         /*
         //reverse the document deletion
         $oDocument->setStatusID(LIVE);
         $oDocument->update();
         */
         return PEAR::raiseError(_kt('There was a problem deleting the document from storage.'));
     }
     // get the user object
     $oUser = User::get($_SESSION['userID']);
     //delete all shortcuts linking to this document
     $aSymlinks = $oDocument->getSymbolicLinks();
     foreach ($aSymlinks as $aSymlink) {
         $oShortcutDocument = Document::get($aSymlink['id']);
         $oOwnerUser = User::get($oShortcutDocument->getOwnerID());
         KTDocumentUtil::deleteSymbolicLink($aSymlink['id']);
         //send an email to the owner of the shortcut
         if ($oOwnerUser->getEmail() != null && $oOwnerUser->getEmailNotification() == true) {
             $emailTemplate = new EmailTemplate("kt3/notifications/notification.SymbolicLinkDeleted", array('user_name' => $oUser->getName(), 'url' => KTUtil::ktLink(KTBrowseUtil::getUrlForDocument($oShortcutDocument)), 'title' => $oShortcutDocument->getName()));
             $email = new EmailAlert($oOwnerUser->getEmail(), _kt("KnowledgeTree Notification"), $emailTemplate->getBody());
             $email->send();
         }
     }
     $oDocumentTransaction = new DocumentTransaction($oDocument, _kt('Document deleted: ') . $sReason, 'ktcore.transactions.delete');
     $oDocumentTransaction->create();
     $oDocument->setFolderID(1);
     DBUtil::commit();
     // we weren't doing notifications on this one
     $oSubscriptionEvent = new SubscriptionEvent();
     $oSubscriptionEvent->RemoveDocument($oDocument, $oOrigFolder);
     // document is now deleted:  triggers are best-effort.
     $oKTTriggerRegistry = KTTriggerRegistry::getSingleton();
     $aTriggers = $oKTTriggerRegistry->getTriggers('delete', 'postValidate');
     foreach ($aTriggers as $aTrigger) {
         $sTrigger = $aTrigger[0];
         $oTrigger = new $sTrigger();
         $aInfo = array('document' => $oDocument);
         $oTrigger->setInfo($aInfo);
         $ret = $oTrigger->postValidate();
         if (PEAR::isError($ret)) {
             $oDocument->delete();
             // FIXME nbm: review that on-fail => delete is correct ?!
             return $ret;
         }
     }
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:93,代码来源:documentutil.inc.php


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