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


PHP NotificationManager类代码示例

本文整理汇总了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;
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:38,代码来源:UploadPluginForm.inc.php

示例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');
 }
开发者ID:jmacgreg,项目名称:harvester,代码行数:34,代码来源:AdminLanguagesHandler.inc.php

示例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();
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:35,代码来源:AuthorDepositForm.inc.php

示例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));
     }
 }
开发者ID:RogerAKemp,项目名称:ojs,代码行数:32,代码来源:PubIdPlugin.inc.php

示例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;
 }
开发者ID:pkp,项目名称:ojs,代码行数:37,代码来源:CrossrefInfoSender.inc.php

示例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);
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:33,代码来源:PKPPubIdPlugin.inc.php

示例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));
 }
开发者ID:jmacgreg,项目名称:ojs,代码行数:62,代码来源:WorkflowHandler.inc.php

示例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();
     }
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:63,代码来源:PKPManageFileApiHandler.inc.php

示例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);
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:16,代码来源:PKPDistributionSettingsTabHandler.inc.php

示例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>')));
 }
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:16,代码来源:NotificationsGridCellProvider.inc.php

示例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;
     }
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:18,代码来源:NotificationMailingListForm.inc.php

示例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');
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:14,代码来源:PageFormat.php

示例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);
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:15,代码来源:Notification.php

示例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();
 }
开发者ID:bozana,项目名称:translator,代码行数:20,代码来源:MiscTranslationFileGridHandler.inc.php

示例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);
 }
开发者ID:hoff121324,项目名称:GlassWebsite,代码行数:7,代码来源:UserObject.php


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