本文整理汇总了PHP中NotificationManager类的典型用法代码示例。如果您正苦于以下问题:PHP NotificationManager类的具体用法?PHP NotificationManager怎么用?PHP NotificationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NotificationManager类的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: 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');
}
示例3: 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();
}
示例4: 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));
}
}
示例5: 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;
}
示例6: 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);
}
示例7: 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));
}
示例8: deleteFile
/**
* Delete a file or revision
* @param $args array
* @param $request Request
* @return string a serialized JSON object
*/
function deleteFile($args, $request)
{
$submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
$stageId = $request->getUserVar('stageId');
if ($stageId) {
// validate the stage id.
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO');
$user = $request->getUser();
$stageAssignments = $stageAssignmentDao->getBySubmissionAndStageId($submission->getId(), $stageId, null, $user->getId());
}
assert($submissionFile && $submission);
// Should have been validated already
$noteDao = DAORegistry::getDAO('NoteDAO');
$noteDao->deleteByAssoc(ASSOC_TYPE_SUBMISSION_FILE, $submissionFile->getFileId());
// Delete all signoffs related with this file.
$signoffDao = DAORegistry::getDAO('SignoffDAO');
/* @var $signoffDao SignoffDAO */
$signoffFactory = $signoffDao->getAllByAssocType(ASSOC_TYPE_SUBMISSION_FILE, $submissionFile->getFileId());
$signoffs = $signoffFactory->toArray();
$notificationMgr = new NotificationManager();
foreach ($signoffs as $signoff) {
$signoffDao->deleteObject($signoff);
// Delete for all users.
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_AUDITOR_REQUEST, NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT), null, ASSOC_TYPE_SIGNOFF, $signoff->getId());
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_SIGNOFF_COPYEDIT, NOTIFICATION_TYPE_SIGNOFF_PROOF), array($signoff->getUserId()), ASSOC_TYPE_SUBMISSION, $submission->getId());
}
// Delete the submission file.
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
/* @var $submissionFileDao SubmissionFileDAO */
// check to see if we need to remove review_round_file associations
if (!$stageAssignments->wasEmpty()) {
$submissionFileDao->deleteReviewRoundAssignment($submission->getId(), $stageId, $submissionFile->getFileId(), $submissionFile->getRevision());
}
$success = (bool) $submissionFileDao->deleteRevisionById($submissionFile->getFileId(), $submissionFile->getRevision(), $submissionFile->getFileStage(), $submission->getId());
if ($success) {
if ($submissionFile->getFileStage() == SUBMISSION_FILE_REVIEW_REVISION) {
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_PENDING_INTERNAL_REVISIONS, NOTIFICATION_TYPE_PENDING_EXTERNAL_REVISIONS), array($submission->getUserId()), ASSOC_TYPE_SUBMISSION, $submission->getId());
$reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
$lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId);
$notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ALL_REVISIONS_IN), null, ASSOC_TYPE_REVIEW_ROUND, $lastReviewRound->getId());
}
$this->indexSubmissionFiles($submission, $submissionFile);
$fileManager = $this->getFileManager($submission->getContextId(), $submission->getId());
$fileManager->deleteFile($submissionFile->getFileId(), $submissionFile->getRevision());
$this->setupTemplate($request);
$user = $request->getUser();
if (!$request->getUserVar('suppressNotification')) {
NotificationManager::createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.removedFile')));
}
$this->logDeletionEvent($request, $submission, $submissionFile, $user);
return DAO::getDataChangedEvent();
} else {
$json = new JSONMessage(false);
return $json->getString();
}
}
示例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: getCellActions
/**
* Get cell actions associated with this row/column combination
* @param $row GridRow
* @param $column GridColumn
* @return array an array of LinkAction instances
*/
function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
{
assert($column->getId() == 'task');
$notification = $row->getData();
$contextDao = Application::getContextDAO();
$context = $contextDao->getById($notification->getContextId());
$notificationMgr = new NotificationManager();
$router = $request->getRouter();
return array(new LinkAction('details', new AjaxAction($router->url($request, null, null, 'markRead', null, array('redirect' => 1, 'selectedElements' => array($notification->getId())))), ($notification->getDateRead() ? '' : '<strong>') . __('common.tasks.titleAndTask', array('acronym' => $context->getLocalizedAcronym(), 'title' => $this->_getTitle($notification), 'task' => $notificationMgr->getNotificationMessage($request, $notification))) . ($notification->getDateRead() ? '' : '</strong>')));
}
示例11: execute
/**
* Save the form
* @param $request PKPRequest
*/
function execute($request)
{
$userEmail = $this->getData('email');
$context = $request->getContext();
$notificationMailListDao = DAORegistry::getDAO('NotificationMailListDAO');
if ($password = $notificationMailListDao->subscribeGuest($userEmail, $context->getId())) {
$notificationManager = new NotificationManager();
$notificationManager->sendMailingListEmail($request, $userEmail, $password, 'NOTIFICATION_MAILLIST_WELCOME');
return true;
} else {
$request->redirect(null, 'notification', 'mailListSubscribed', array('error'));
return false;
}
}
示例12: postDispatch
public function postDispatch()
{
$o_view = new View($this->getRequest(), $this->getRequest()->config->get('views_directory'));
$o_notification = new NotificationManager($this->getRequest());
if ($o_notification->numNotifications()) {
$o_view->setVar('notifications', $o_notification->getNotifications($this->getResponse()->isRedirect()));
$this->getResponse()->prependContent($o_view->render('pageFormat/notifications.php'), 'notifications');
}
//$nav = new AppNavigation($this->getRequest(), $this->getResponse());
$o_view->setVar('nav', $nav);
//$this->getResponse()->prependContent($o_view->render('pageFormat/menuBar.php'), 'menubar');
$this->getResponse()->prependContent($o_view->render('pageFormat/pageHeader.php'), 'head');
$this->getResponse()->appendContent($o_view->render('pageFormat/pageFooter.php'), 'footer');
}
示例13: handle
public function handle(Event $event)
{
$manager = new NotificationManager();
$notificationType = $event->name;
$manager->setNotificationType($notificationType);
$manager->setUser($event->args[0]);
if (isset($event->args[1])) {
$notificationObject = $event->args[1];
$manager->setNotificationObject($notificationObject);
}
if (isset($event->args[1])) {
$time = $event->args[2];
$manager->add($time);
}
}
示例14: 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();
}
示例15: setVerified
public function setVerified($bool)
{
NotificationManager::createNotification($this, "Your account was verified.", array());
$database = new DatabaseManager();
$database->query("UPDATE `users` SET `verified`='" . $database->sanitize($bool) . "' WHERE `email`='" . $database->sanitize($this->getEmail()) . "'");
apc_store('userObject_' . $this->blid, $this, 600);
}