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


PHP JSONMessage类代码示例

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


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


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