本文整理汇总了PHP中NotificationManager::createTrivialNotification方法的典型用法代码示例。如果您正苦于以下问题:PHP NotificationManager::createTrivialNotification方法的具体用法?PHP NotificationManager::createTrivialNotification怎么用?PHP NotificationManager::createTrivialNotification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NotificationManager
的用法示例。
在下文中一共展示了NotificationManager::createTrivialNotification方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @copydoc Form::execute()
*/
function execute($request)
{
parent::execute($request);
// Retrieve the temporary file.
$user = $request->getUser();
$temporaryFileId = $this->getData('temporaryFileId');
$temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
$temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
$pluginHelper = new PluginHelper();
$errorMsg = null;
$pluginDir = $pluginHelper->extractPlugin($temporaryFile->getFilePath(), $temporaryFile->getOriginalFileName(), $errorMsg);
$notificationMgr = new NotificationManager();
if ($pluginDir) {
if ($this->_function == PLUGIN_ACTION_UPLOAD) {
$pluginVersion = $pluginHelper->installPlugin($pluginDir, $errorMsg);
if ($pluginVersion) {
$notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('manager.plugins.installSuccessful', array('versionNumber' => $pluginVersion->getVersionString(false)))));
}
} else {
if ($this->_function == PLUGIN_ACTION_UPGRADE) {
$pluginVersion = $pluginHelper->upgradePlugin($request->getUserVar('category'), $request->getUserVar('plugin'), $pluginDir, $errorMsg);
if ($pluginVersion) {
$notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('manager.plugins.upgradeSuccessful', array('versionString' => $pluginVersion->getVersionString(false)))));
}
}
}
} else {
$errorMsg = __('manager.plugins.invalidPluginArchive');
}
if ($errorMsg) {
$notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => $errorMsg));
return false;
}
return true;
}
示例2: manage
/**
* @copydoc Plugin::manage()
*/
function manage($args, $request)
{
$notificationManager = new NotificationManager();
$user = $request->getUser();
$journal = $request->getJournal();
$settingsFormName = $this->getSettingsFormName();
$settingsFormNameParts = explode('.', $settingsFormName);
$settingsFormClassName = array_pop($settingsFormNameParts);
$this->import($settingsFormName);
$form = new $settingsFormClassName($this, $journal->getId());
if ($request->getUserVar('save')) {
$form->readInputData();
if ($form->validate()) {
$form->execute();
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS);
return new JSONMessage(true);
} else {
return new JSONMessage(true, $form->fetch($request));
}
} elseif ($request->getUserVar('clearPubIds')) {
$journalDao = DAORegistry::getDAO('JournalDAO');
$journalDao->deleteAllPubIds($journal->getId(), $this->getPubIdType());
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS);
return new JSONMessage(true);
} else {
$form->initData();
return new JSONMessage(true, $form->fetch($request));
}
}
示例3: manage
/**
* @copydoc Plugin::manage()
*/
function manage($args, $request)
{
$user = $request->getUser();
$router = $request->getRouter();
$context = $router->getContext($request);
$form = $this->instantiateSettingsForm($context->getId());
$notificationManager = new NotificationManager();
switch ($request->getUserVar('verb')) {
case 'save':
$form->readInputData();
if ($form->validate()) {
$form->execute();
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS);
return new JSONMessage(true);
}
return new JSONMessage(true, $form->fetch($request));
case 'clearPubIds':
if (!$request->checkCSRF()) {
return new JSONMessage(false);
}
$contextDao = Application::getContextDAO();
$contextDao->deleteAllPubIds($context->getId(), $this->getPubIdType());
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS);
return new JSONMessage(true);
default:
$form->initData();
return new JSONMessage(true, $form->fetch($request));
}
return parent::manage($args, $request);
}
示例4: save
/**
* Display the grid's containing page.
* @param $args array
* @param $request PKPRequest
*/
function save($args, $request)
{
$filename = $this->_getFilename($request);
$notificationManager = new NotificationManager();
$user = $request->getUser();
$contents = $this->correctCr($request->getUserVar('fileContents'));
if (file_put_contents($filename, $contents)) {
$notificationManager->createTrivialNotification($user->getId());
} else {
// Could not write the file
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => __('plugins.generic.translator.couldNotWriteFile', array('filename' => $filename))));
}
$message = new JSONMessage(true);
return $message->getString();
}
示例5: saveLanguageSettings
/**
* Update language settings.
* @param $args array
* @param $request object
*/
function saveLanguageSettings($args, &$request)
{
$this->validate();
$this->setupTemplate(true);
$site =& $request->getSite();
$primaryLocale = $request->getUserVar('primaryLocale');
$supportedLocales = $request->getUserVar('supportedLocales');
if (Locale::isLocaleValid($primaryLocale)) {
$site->setPrimaryLocale($primaryLocale);
}
$newSupportedLocales = array();
if (isset($supportedLocales) && is_array($supportedLocales)) {
foreach ($supportedLocales as $locale) {
if (Locale::isLocaleValid($locale)) {
array_push($newSupportedLocales, $locale);
}
}
}
if (!in_array($primaryLocale, $newSupportedLocales)) {
array_push($newSupportedLocales, $primaryLocale);
}
$site->setSupportedLocales($newSupportedLocales);
$siteDao =& DAORegistry::getDAO('SiteDAO');
$siteDao->updateObject($site);
import('notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationManager->createTrivialNotification('notification.notification', 'common.changesSaved');
$request->redirect(null, 'index');
}
示例6: executeActions
/**
* @copydoc ScheduledTask::executeActions()
*/
function executeActions()
{
if (!$this->_plugin) {
return false;
}
$plugin = $this->_plugin;
$journals = $this->_getJournals();
foreach ($journals as $journal) {
$notify = false;
$pubIdPlugins = PluginRegistry::loadCategory('pubIds', true, $journal->getId());
$doiPubIdPlugin = $pubIdPlugins['doipubidplugin'];
if ($doiPubIdPlugin->getSetting($journal->getId(), 'enableSubmissionDoi')) {
// Get unregistered articles
$unregisteredArticles = $plugin->getUnregisteredArticles($journal);
// Update the status and construct an array of the articles to be deposited
$articlesToBeDeposited = $this->_getObjectsToBeDeposited($unregisteredArticles, $journal, $notify);
// If there are articles to be deposited and we want automatic deposits
if (count($articlesToBeDeposited) && $plugin->getSetting($journal->getId(), 'automaticRegistration')) {
$this->_registerObjects($articlesToBeDeposited, 'article=>crossref-xml', $journal, 'articles');
}
}
// Notify journal managers if there is a new failed DOI status
if ($notify) {
$roleDao = DAORegistry::getDAO('RoleDAO');
$journalManagers = $roleDao->getUsersByRoleId(ROLE_ID_MANAGER, $journal->getId());
import('classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
while ($journalManager = $journalManagers->next()) {
$notificationManager->createTrivialNotification($journalManager->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => __('plugins.importexport.crossref.notification.failed')));
}
}
}
return true;
}
示例7: execute
/**
* Perform SWORD deposit
*/
function execute()
{
import('classes.sword.OJSSwordDeposit');
$deposit = new OJSSwordDeposit($this->article);
$deposit->setMetadata();
$deposit->addEditorial();
$deposit->createPackage();
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$allowAuthorSpecify = $this->swordPlugin->getSetting($this->article->getJournalId(), 'allowAuthorSpecify');
$authorDepositUrl = $this->getData('authorDepositUrl');
if ($allowAuthorSpecify && $authorDepositUrl != '') {
$deposit->deposit($this->getData('authorDepositUrl'), $this->getData('authorDepositUsername'), $this->getData('authorDepositPassword'));
$notificationManager->createTrivialNotification(Locale::translate('notification.notification'), Locale::translate('plugins.generic.sword.depositComplete', array('itemTitle' => $this->article->getLocalizedTitle(), 'repositoryName' => $this->getData('authorDepositUrl'))), NOTIFICATION_TYPE_SUCCESS, null, false);
}
$depositableDepositPoints = $this->_getDepositableDepositPoints();
$depositPoints = $this->getData('depositPoint');
foreach ($depositableDepositPoints as $key => $depositPoint) {
if (!isset($depositPoints[$key]['enabled'])) {
continue;
}
if ($depositPoint['type'] == SWORD_DEPOSIT_TYPE_OPTIONAL_SELECTION) {
$url = $depositPoints[$key]['depositPoint'];
} else {
// SWORD_DEPOSIT_TYPE_OPTIONAL_FIXED
$url = $depositPoint['url'];
}
$deposit->deposit($url, $depositPoint['username'], $depositPoint['password']);
$notificationManager->createTrivialNotification(Locale::translate('notification.notification'), Locale::translate('plugins.generic.sword.depositComplete', array('itemTitle' => $this->article->getLocalizedTitle(), 'repositoryName' => $depositPoint['name'])), NOTIFICATION_TYPE_SUCCESS, null, false);
}
$deposit->cleanup();
}
示例8: expedite
/**
* Expedites a submission through the submission process, if the submitter is a manager or editor.
* @param $args array
* @param $request PKPRequest
*/
function expedite($args, $request)
{
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
$user = $request->getUser();
$form = new IssueEntryPublicationMetadataForm($submission->getId(), $user, null, array('expeditedSubmission' => true));
if ($submission && (int) $request->getUserVar('issueId') > 0) {
// Process our submitted form in order to create the published article entry.
$form->readInputData();
if ($form->validate()) {
$form->execute($request);
// Create trivial notification in place on the form, and log the event.
$notificationManager = new NotificationManager();
$user = $request->getUser();
import('lib.pkp.classes.log.SubmissionLog');
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_ISSUE_METADATA_UPDATE, 'submission.event.issueMetadataUpdated');
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.savedIssueMetadata')));
// Now, create a galley for this submission. Assume PDF, and set to 'available'.
$articleGalleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
$articleGalley = $articleGalleyDao->newDataObject();
$articleGalley->setGalleyType('pdfarticlegalleyplugin');
$articleGalley->setIsAvailable(true);
$articleGalley->setSubmissionId($submission->getId());
$articleGalley->setLocale($submission->getLocale());
$articleGalley->setLabel('PDF');
$articleGalley->setSeq($articleGalleyDao->getNextGalleySequence($submission->getId()));
$articleGalleyId = $articleGalleyDao->insertObject($articleGalley);
// Next, create a galley PROOF file out of the submission file uploaded.
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
$submissionFiles = $submissionFileDao->getLatestRevisions($submission->getId(), SUBMISSION_FILE_SUBMISSION);
// Assume a single file was uploaded, but check for something that's PDF anyway.
foreach ($submissionFiles as $submissionFile) {
// test both mime type and file extension in case the mime type isn't correct after uploading.
if ($submissionFile->getFileType() == 'application/pdf' || preg_match('/\\.pdf$/', $submissionFile->getOriginalFileName())) {
// Get the path of the current file because we change the file stage in a bit.
$currentFilePath = $submissionFile->getFilePath();
// this will be a new file based on the old one.
$submissionFile->setFileId(null);
$submissionFile->setRevision(1);
$submissionFile->setFileStage(SUBMISSION_FILE_PROOF);
$submissionFile->setAssocType(ASSOC_TYPE_GALLEY);
$submissionFile->setAssocId($articleGalleyId);
$submissionFileDao->insertObject($submissionFile, $currentFilePath);
break;
}
}
// no errors, clear all notifications for this submission which may have been created during the submission process and close the modal.
$context = $request->getContext();
$notificationDao = DAORegistry::getDAO('NotificationDAO');
$notificationFactory = $notificationDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION, $submission->getId(), null, null, $context->getId());
return new JSONMessage(true);
} else {
return new JSONMessage(true, $form->fetch($request));
}
}
return new JSONMessage(true, $form->fetch($request));
}
示例9: resetPermissions
/**
* Reset permissions data assigned to existing submissions.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON response.
*/
function resetPermissions($args, $request)
{
$context = $request->getContext();
$submissionDao = Application::getSubmissionDAO();
$submissionDao->deletePermissions($context->getId());
$notificationManager = new NotificationManager();
$user = $request->getUser();
$notificationManager->createTrivialNotification($user->getId());
return new JSONMessage(true);
}
示例10: plugin
/**
* Perform plugin-specific management functions.
* @param $args array
* @param $request object
*/
function plugin($args, &$request)
{
$category = array_shift($args);
$plugin = array_shift($args);
$verb = array_shift($args);
$this->validate();
$this->setupTemplate(true);
$plugins =& PluginRegistry::loadCategory($category);
$message = null;
if (!isset($plugins[$plugin]) || !$plugins[$plugin]->manage($verb, $args, $message)) {
import('notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationManager->createTrivialNotification(Locale::translate('notification.notification'), $message, NOTIFICATION_TYPE_SUCCESS, null, 0);
$request->redirect(null, null, null, 'plugins', array($category));
}
}
示例11: saveForm
/**
* Save the metadata tab.
* @param $args array
* @param $request PKPRequest
*/
function saveForm($args, $request)
{
$this->setupTemplate($request);
import('controllers.modals.submissionMetadata.form.SubmissionMetadataViewForm');
$submissionMetadataViewForm = new SubmissionMetadataViewForm($this->_submission->getId());
// Try to save the form data.
$submissionMetadataViewForm->readInputData($request);
if ($submissionMetadataViewForm->validate()) {
$submissionMetadataViewForm->execute($request);
// Create trivial notification.
$notificationManager = new NotificationManager();
$user = $request->getUser();
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.savedSubmissionMetadata')));
return new JSONMessage(true);
}
return new JSONMessage(false);
}
示例12: saveLanguageSettings
/**
* Save changes to language settings.
* @param $args array
* @param $request object
*/
function saveLanguageSettings($args, &$request)
{
$this->validate();
$this->setupTemplate(true);
import('manager.form.LanguageSettingsForm');
$settingsForm = new LanguageSettingsForm();
$settingsForm->readInputData();
if ($settingsForm->validate()) {
$settingsForm->execute();
import('notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationManager->createTrivialNotification('notification.notification', 'common.changesSaved');
$request->redirect(null, null, 'index');
} else {
$settingsForm->display();
}
}
示例13: reloadLocalizedDefaultSettings
/**
* Reload the default localized settings for the journal.
* @param $args array
* @param $request object
*/
function reloadLocalizedDefaultSettings($args, &$request)
{
// make sure the locale is valid
$locale = $request->getUserVar('localeToLoad');
if (!Locale::isLocaleValid($locale)) {
$request->redirect(null, null, 'languages');
}
$this->validate();
$this->setupTemplate(true);
$journal =& $request->getJournal();
$journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
$journalSettingsDao->reloadLocalizedDefaultSettings($journal->getId(), 'registry/journalSettings.xml', array('indexUrl' => $request->getIndexUrl(), 'journalPath' => $journal->getData('path'), 'primaryLocale' => $journal->getPrimaryLocale(), 'journalName' => $journal->getTitle($journal->getPrimaryLocale())), $locale);
// Display a notification
import('lib.pkp.classes.notification.NotificationManager');
$notificationManager = new NotificationManager();
$notificationManager->createTrivialNotification('notification.notification', 'common.changesSaved');
$request->redirect(null, null, 'languages');
}
示例14: updateReviewFiles
/**
* Save 'manage review files' form.
* @param $args array
* @param $request PKPRequest
* @return JSONMessage JSON object
*/
function updateReviewFiles($args, $request)
{
$submission = $this->getSubmission();
import('lib.pkp.controllers.grid.files.review.form.ManageReviewFilesForm');
$manageReviewFilesForm = new ManageReviewFilesForm($submission->getId(), $this->getRequestArg('stageId'), $this->getRequestArg('reviewRoundId'));
$manageReviewFilesForm->readInputData();
if ($manageReviewFilesForm->validate()) {
$dataProvider = $this->getDataProvider();
$manageReviewFilesForm->execute($args, $request, $this->getGridCategoryDataElements($request, $this->getStageId()));
$this->setupTemplate($request);
$user = $request->getUser();
NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.updatedReviewFiles')));
// Let the calling grid reload itself
return DAO::getDataChangedEvent();
} else {
return new JSONMessage(false);
}
}
示例15: saveForm
/**
* Save the submission metadata form.
* @param $args array
* @param $request Request
*/
function saveForm($args, $request)
{
$submissionId = $request->getUserVar('submissionId');
// Form handling
$submissionMetadataViewForm = $this->getFormInstance($submissionId);
// Try to save the form data.
$submissionMetadataViewForm->readInputData($request);
if ($submissionMetadataViewForm->validate()) {
$submissionMetadataViewForm->execute($request);
// Create trivial notification.
$notificationManager = new NotificationManager();
$user = $request->getUser();
$notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.savedSubmissionMetadata')));
return new JSONMessage();
} else {
return new JSONMessage(false);
}
}