• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP JSONMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中JSONMessage的典型用法代码示例。如果您正苦于以下问题:PHP JSONMessage类的具体用法?PHP JSONMessage怎么用?PHP JSONMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: series

 /**
  * Display series admin page.
  * @param $args array
  * @param $request PKPRequest
  */
 function series($args, $request)
 {
     $this->setupTemplate($request);
     $templateMgr = TemplateManager::getManager($request);
     $jsonMessage = new JSONMessage(true, $templateMgr->fetch('management/series.tpl'));
     return $jsonMessage->getString();
 }
开发者ID:NateWr,项目名称:omp,代码行数:12,代码来源:SettingsHandler.inc.php


示例2: updateUserMessageState

 /**
  * Update the information whether user messages should be
  * displayed or not.
  * @param $args array
  * @param $request PKPRequest
  * @return string a JSON message
  */
 function updateUserMessageState($args, &$request)
 {
     // Exit with a fatal error if request parameters are missing.
     if (!isset($args['setting-name']) && isset($args['setting-value'])) {
         fatalError('Required request parameter "setting-name" or "setting-value" missing!');
     }
     // Retrieve the user from the session.
     $user =& $request->getUser();
     assert(is_a($user, 'User'));
     // Validate the setting.
     // FIXME: We don't have to retrieve the setting type (which is always bool
     // for user messages) but only whether the setting name is valid and the
     // value is boolean.
     $settingName = $args['setting-name'];
     $settingValue = $args['setting-value'];
     $settingType = $this->_settingType($settingName);
     switch ($settingType) {
         case 'bool':
             if (!($settingValue === 'false' || $settingValue === 'true')) {
                 // Exit with a fatal error when the setting value is invalid.
                 fatalError('Invalid setting value! Must be "true" or "false".');
             }
             $settingValue = $settingValue === 'true' ? true : false;
             break;
         default:
             // Exit with a fatal error when an unknown setting is found.
             fatalError('Unknown setting!');
     }
     // Persist the validated setting.
     $userSettingsDao =& DAORegistry::getDAO('UserSettingsDAO');
     $userSettingsDao->updateSetting($user->getId(), $settingName, $settingValue, $settingType);
     // Return a success message.
     $json = new JSONMessage(true);
     return $json->getString();
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:42,代码来源:UserApiHandler.inc.php


示例3: selectFiles

 /**
  * Show the form to allow the user to select review files
  * (bring in/take out files from submission stage to review stage)
  *
  * FIXME: Move to it's own handler so that it can be re-used among grids.
  *
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function selectFiles($args, $request)
 {
     $submission = $this->getSubmission();
     import('lib.pkp.controllers.grid.files.final.form.ManageFinalDraftFilesForm');
     $manageFinalDraftFilesForm = new ManageFinalDraftFilesForm($submission->getId());
     $manageFinalDraftFilesForm->initData($args, $request);
     $json = new JSONMessage(true, $manageFinalDraftFilesForm->fetch($request));
     return $json->getString();
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:19,代码来源:FinalDraftFilesGridHandler.inc.php


示例4: selectFiles

 /**
  * Show the form to allow the user to select review files
  * (bring in/take out files from submission stage to review stage)
  *
  * FIXME: Move to its own handler so that it can be re-used among grids.
  *
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function selectFiles($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->initData($args, $request);
     $json = new JSONMessage(true, $manageReviewFilesForm->fetch($request));
     return $json->getString();
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:19,代码来源:EditorReviewFilesGridHandler.inc.php


示例5: toggleHelp

 /**
  * Persist the status for a user's preference to see inline help.
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function toggleHelp($args, $request)
 {
     $user = $request->getUser();
     $user->setInlineHelp($user->getInlineHelp() ? 0 : 1);
     $userDao = DAORegistry::getDAO('UserDAO');
     $userDao->updateObject($user);
     import('lib.pkp.classes.core.JSONMessage');
     $json = new JSONMessage(true);
     return $json->getString();
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:16,代码来源:PKPUserHandler.inc.php


示例6: publicationMetadata

 /**
  * Show the publication metadata form.
  * @param $request Request
  * @param $args array
  * @return string JSON message
  */
 function publicationMetadata($args, $request)
 {
     import('controllers.tab.issueEntry.form.IssueEntryPublicationMetadataForm');
     $submission = $this->getSubmission();
     $stageId = $this->getStageId();
     $user = $request->getUser();
     $issueEntryPublicationMetadataForm = new IssueEntryPublicationMetadataForm($submission->getId(), $user->getId(), $stageId, array('displayedInContainer' => true));
     $issueEntryPublicationMetadataForm->initData($args, $request);
     $json = new JSONMessage(true, $issueEntryPublicationMetadataForm->fetch($request));
     return $json->getString();
 }
开发者ID:utlib,项目名称:ojs,代码行数:17,代码来源:IssueEntryTabHandler.inc.php


示例7: getSubmissions

 /**
  * Get a list of submission options for new catalog entries.
  * @param $args array
  * @param $request PKPRequest
  */
 function getSubmissions($args, $request)
 {
     $press = $request->getPress();
     $monographDao = DAORegistry::getDAO('MonographDAO');
     $submissionsIterator = $monographDao->getUnpublishedMonographsByPressId($press->getId());
     $submissions = array();
     while ($monograph = $submissionsIterator->next()) {
         $submissions[$monograph->getId()] = $monograph->getLocalizedTitle();
     }
     $jsonMessage = new JSONMessage(true, $submissions);
     return $jsonMessage->getString();
 }
开发者ID:NateWr,项目名称:omp,代码行数:17,代码来源:SelectMonographHandler.inc.php


示例8: testGetString

 /**
  * @covers JSONMessage
  */
 public function testGetString()
 {
     // Create a test object.
     $testObject = new stdClass();
     $testObject->someInt = 5;
     $testObject->someFloat = 5.5;
     $json = new JSONMessage($status = true, $content = 'test content', $elementId = '0', $additionalAttributes = array('testObj' => $testObject));
     $json->setEvent('someEvent', array('eventDataKey' => array('item1', 'item2')));
     // Render the JSON message.
     $expectedString = '{"status":true,"content":"test content",' . '"elementId":"0","testObj":{"someInt":5,"someFloat":5.5},' . '"event":{"name":"someEvent","data":{"eventDataKey":["item1","item2"]}}}';
     self::assertEquals($expectedString, $json->getString());
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:15,代码来源:JSONTest.php


示例9: fetchFormatInfo

 /**
  * Returns a JSON response containing information regarding the galley formats enabled
  * for this submission.
  * @param $args array
  * @param $request Request
  * @return JSONMessage JSON object
  */
 function fetchFormatInfo($args, $request)
 {
     $submission = $this->getSubmission();
     $galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
     $galleys = $galleyDao->getBySubmissionId($submission->getId());
     $formats = array();
     while ($galley = $galleys->next()) {
         $formats[$galley->getId()] = $galley->getLocalizedName();
     }
     $json = new JSONMessage(true, true);
     $json->setAdditionalAttributes(array('formats' => $formats));
     return $json;
 }
开发者ID:mariojp,项目名称:ojs,代码行数:20,代码来源:IssueEntryHandler.inc.php


示例10: getLocalizedOptions

 /**
  * @see LinkActionRequest::getLocalizedOptions()
  */
 function getLocalizedOptions()
 {
     $parentLocalizedOptions = parent::getLocalizedOptions();
     // override the modalHandler option.
     $parentLocalizedOptions['modalHandler'] = '$.pkp.controllers.modal.JsEventConfirmationModalHandler';
     $parentLocalizedOptions['jsEvent'] = $this->getEvent();
     if (is_array($this->getExtraArguments())) {
         $json = new JSONMessage();
         $json->setContent($this->getExtraArguments());
         $parentLocalizedOptions['extraArguments'] = $json->getString();
     }
     return $parentLocalizedOptions;
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:16,代码来源:JsEventConfirmationModal.inc.php


示例11: saveReportGenerator

 /**
  * Save form to generate custom reports.
  * @param $args array
  * @param $request Request
  * @return JSONMessage JSON object
  */
 function saveReportGenerator($args, $request)
 {
     $this->setupTemplate($request);
     $reportGeneratorForm = $this->_getReportGeneratorForm($request);
     $reportGeneratorForm->readInputData();
     $json = new JSONMessage(true);
     if ($reportGeneratorForm->validate()) {
         $reportUrl = $reportGeneratorForm->execute($request);
         $json->setAdditionalAttributes(array('reportUrl' => $reportUrl));
     } else {
         $json->setStatus(false);
     }
     return $json;
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:20,代码来源:ReportGeneratorHandler.inc.php


示例12: uploadCoverImage

 /**
  * Upload a new cover image file.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function uploadCoverImage($args, $request)
 {
     $user = $request->getUser();
     import('lib.pkp.classes.file.TemporaryFileManager');
     $temporaryFileManager = new TemporaryFileManager();
     $temporaryFile = $temporaryFileManager->handleUpload('uploadedFile', $user->getId());
     if ($temporaryFile) {
         $json = new JSONMessage(true);
         $json->setAdditionalAttributes(array('temporaryFileId' => $temporaryFile->getId()));
         return $json;
     } else {
         return new JSONMessage(false, __('common.uploadFailed'));
     }
 }
开发者ID:josekarvalho,项目名称:omp,代码行数:20,代码来源:CatalogEntryTabHandler.inc.php


示例13: fetchTemplateBody

 /**
  * Fetches an email template's message body and returns it via AJAX.
  * @param $args array
  * @param $request PKPRequest
  */
 function fetchTemplateBody($args, $request)
 {
     $templateId = $request->getUserVar('template');
     import('lib.pkp.classes.mail.SubmissionMailTemplate');
     $template = new SubmissionMailTemplate($this->getSubmission(), $templateId);
     if ($template) {
         $user = $request->getUser();
         $dispatcher = $request->getDispatcher();
         $context = $request->getContext();
         $template->assignParams(array('editorialContactSignature' => $user->getContactSignature(), 'signatureFullName' => $user->getFullname()));
         $json = new JSONMessage(true, $template->getBody() . "\n" . $context->getSetting('emailSignature'));
         return $json->getString();
     }
 }
开发者ID:jalperin,项目名称:ojs,代码行数:19,代码来源:StageParticipantGridHandler.inc.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: fetchFormatInfo

 /**
  * Returns a JSON response containing information regarding the galley formats enabled
  * for this submission.
  * @param $args array
  * @param $request Request
  */
 function fetchFormatInfo($args, $request)
 {
     $submission = $this->getSubmission();
     $json = new JSONMessage();
     $galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
     $galleys = $galleyDao->getGalleysByArticle($submission->getId());
     $formats = array();
     foreach ($galleys as $galley) {
         $formats[$galley->getId()] = $galley->getLocalizedName();
     }
     $json->setStatus(true);
     $json->setContent(true);
     $json->setAdditionalAttributes(array('formats' => $formats));
     return $json->getString();
 }
开发者ID:jalperin,项目名称:ojs,代码行数:21,代码来源:IssueEntryHandler.inc.php


示例16: saveForm

 function saveForm($args, $request)
 {
     $json = new JSONMessage();
     $form = null;
     $submission = $this->getSubmission();
     $stageId = $this->getStageId();
     $notificationKey = null;
     $this->_getFormFromCurrentTab($form, $notificationKey, $request);
     if ($form) {
         // null if we didn't have a valid tab
         $form->readInputData();
         if ($form->validate($request)) {
             $form->execute($request);
             // Create trivial notification in place on the form
             $notificationManager = new NotificationManager();
             $user = $request->getUser();
             $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __($notificationKey)));
         } else {
             // Could not validate; redisplay the form.
             $json->setStatus(true);
             $json->setContent($form->fetch($request));
         }
         if ($request->getUserVar('displayedInContainer')) {
             $router = $request->getRouter();
             $dispatcher = $router->getDispatcher();
             $url = $dispatcher->url($request, ROUTE_COMPONENT, null, $this->_getHandlerClassPath(), 'fetch', null, array('submissionId' => $submission->getId(), 'stageId' => $stageId, 'tabPos' => $this->getTabPosition(), 'hideHelp' => true));
             $json->setAdditionalAttributes(array('reloadContainer' => true, 'tabsUrl' => $url));
             $json->setContent(true);
             // prevents modal closure
         }
         return $json;
     } else {
         fatalError('Unknown or unassigned format id!');
     }
 }
开发者ID:kadowa,项目名称:omp-vgwort-plugin,代码行数:35,代码来源:VGWortCatalogEntryTabHandler.inc.php


示例17: updateFinalDraftFiles

 /**
  * Save 'manage final draft files' form
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function updateFinalDraftFiles($args, $request)
 {
     $submission = $this->getSubmission();
     import('lib.pkp.controllers.grid.files.final.form.ManageFinalDraftFilesForm');
     $manageFinalDraftFilesForm = new ManageFinalDraftFilesForm($submission->getId());
     $manageFinalDraftFilesForm->readInputData();
     if ($manageFinalDraftFilesForm->validate()) {
         $dataProvider = $this->getDataProvider();
         $manageFinalDraftFilesForm->execute($args, $request, $dataProvider->getCategoryData($this->getStageId()));
         // Let the calling grid reload itself
         return DAO::getDataChangedEvent();
     } else {
         $json = new JSONMessage(false);
         return $json->getString();
     }
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:22,代码来源:ManageFinalDraftFilesGridHandler.inc.php


示例18: fetchCategory

 /**
  * Render a category with all the rows inside of it.
  * @param $args array
  * @param $request Request
  * @return string the serialized row JSON message or a flag
  *  that indicates that the row has not been found.
  */
 function fetchCategory(&$args, &$request)
 {
     // Instantiate the requested row (includes a
     // validity check on the row id).
     $row =& $this->getRequestedCategoryRow($request, $args);
     $json = new JSONMessage(true);
     if (is_null($row)) {
         // Inform the client that the category does no longer exist.
         $json->setAdditionalAttributes(array('elementNotFound' => (int) $args['rowId']));
     } else {
         // Render the requested category
         $this->setFirstDataColumn();
         $json->setContent($this->_renderCategoryInternally($request, $row));
     }
     // Render and return the JSON message.
     return $json->getString();
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:24,代码来源:CategoryGridHandler.inc.php


示例19: 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());
     $json = new JSONMessage();
     // Try to save the form data.
     $submissionMetadataViewForm->readInputData();
     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')));
     } else {
         $json->setStatus(false);
     }
     return $json->getString();
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:24,代码来源:SubmissionInformationCenterHandler.inc.php


示例20: updateReviewFiles

 /**
  * Save 'manage review files' form.
  * @param $args array
  * @param $request PKPRequest
  * @return string Serialized 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, $dataProvider->getCategoryData($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 {
         $json = new JSONMessage(false);
         return $json->getString();
     }
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:25,代码来源:ManageReviewFilesGridHandler.inc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP JSSDK类代码示例发布时间:2022-05-23
下一篇:
PHP JSON类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap