本文整理汇总了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;
}
示例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;
}