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


PHP NotificationManager::sendNotificationEmail方法代码示例

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


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

示例1: releaseStudy

 /**
  * Release draft study.
  * @param $study DataverseStudy
  * @return boolean Study released
  */
 function releaseStudy($study)
 {
     import('classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     // Dataverse released?
     $dvReleased = $this->dataverseIsReleased($journal->getId());
     if (!$dvReleased) {
         // Try to release Dataverse via API
         $dvReleased = $this->releaseDataverse($journal->getId());
     }
     // If release via API has failed or is not supported, notify JMs
     if (!$dvReleased) {
         $request =& Application::getRequest();
         $roleDao =& DAORegistry::getDAO('RoleDAO');
         $journalManagers =& $roleDao->getUsersByRoleId(ROLE_ID_JOURNAL_MANAGER, $journal->getId());
         while ($journalManagers && !$journalManagers->eof()) {
             $journalManager =& $journalManagers->next();
             $notification = $notificationManager->createNotification($request, $journalManager->getId(), NOTIFICATION_TYPE_DATAVERSE_UNRELEASED, $journal->getId(), ASSOC_TYPE_JOURNAL, $journal->getId(), NOTIFICATION_LEVEL_NORMAL);
             $notificationManager->sendNotificationEmail($request, $notification);
             unset($journalManager);
         }
         // end notifying JMs
         // In API v1.1, publishing datasets in unpublished datverses is not supported.
         if (version_compare($this->getSetting($journal->getId(), 'apiVersion'), '1.1', '>=')) {
             $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR);
             return $dvReleased;
         }
     }
     // Attempt to release/publish the study/dataset.
     $client = $this->_initSwordClient();
     $response = $client->completeIncompleteDeposit($study->getEditUri(), $this->getSetting($journal->getId(), 'username'), $this->getSetting($journal->getId(), 'password'), '');
     // on behalf of
     $studyReleased = $response->sac_status == DATAVERSE_PLUGIN_HTTP_STATUS_OK;
     if ($studyReleased) {
         // Retrieve deposit receipt & store updated data citation
         $depositReceipt = $client->retrieveDepositReceipt($study->getEditUri(), $this->getSetting($journal->getId(), 'username'), $this->getSetting($journal->getId(), 'password'), '');
         if ($depositReceipt->sac_status == DATAVERSE_PLUGIN_HTTP_STATUS_OK) {
             $study->setDataCitation($depositReceipt->sac_dcterms['bibliographicCitation'][0]);
             $dataverseStudyDao =& DAORegistry::getDAO('DataverseStudyDAO');
             $dataverseStudyDao->updateStudy($study);
         }
         // Include citation & link to study in notification
         $params = array('dataCitation' => $this->_formatDataCitation($study->getDataCitation(), $study->getPersistentUri()));
         $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_DATAVERSE_STUDY_RELEASED, $params);
     } else {
         $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR);
     }
     return $studyReleased;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:56,代码来源:DataversePlugin.inc.php

示例2: releaseStudy

 /**
  * Release draft study.
  * @param DataverseStudy $study
  * @return boolean Study released
  */
 function releaseStudy(&$study)
 {
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $client = $this->_initSwordClient();
     $response = $client->completeIncompleteDeposit($study->getEditUri(), $this->getSetting($journal->getId(), 'username'), $this->getSetting($journal->getId(), 'password'), '');
     // on behalf of
     $studyReleased = $response->sac_status == DATAVERSE_PLUGIN_HTTP_STATUS_OK;
     // Notify on success or failure. Provide citation & link to study.
     import('classes.notification.NotificationManager');
     $notificationManager = new NotificationManager();
     if ($studyReleased) {
         $params = array('dataCitation' => $this->_formatDataCitation($study->getDataCitation(), $study->getPersistentUri()));
         $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_DATAVERSE_STUDY_RELEASED, $params);
     } else {
         $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR);
     }
     // Whether the study was released or not, notify JMs by email if Dataverse
     // has not yet been released. Released studies are not accessible until
     // the Dataverse has been released.
     if (!$this->dataverseIsReleased()) {
         $request =& Application::getRequest();
         $roleDao =& DAORegistry::getDAO('RoleDAO');
         $journalManagers =& $roleDao->getUsersByRoleId(ROLE_ID_JOURNAL_MANAGER, $journal->getId());
         while ($journalManagers && !$journalManagers->eof()) {
             $journalManager =& $journalManagers->next();
             $notification = $notificationManager->createNotification($request, $journalManager->getId(), NOTIFICATION_TYPE_DATAVERSE_UNRELEASED, $journal->getId(), ASSOC_TYPE_JOURNAL, $journal->getId(), NOTIFICATION_LEVEL_NORMAL);
             $notificationManager->sendNotificationEmail($request, $notification);
             unset($journalManager);
         }
         // end notifying JMs
     }
     // end if (study not released)
     return $studyReleased;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:40,代码来源:DataversePlugin.inc.php


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