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


PHP JSONMessage::setStatus方法代码示例

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


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

示例1: uploadFile

 /**
  * Upload a new file.
  * @param $args array
  * @param $request PKPRequest
  * @return string
  */
 function uploadFile($args, $request)
 {
     $fileUploadForm = $this->_getFileUploadForm($request);
     $json = new JSONMessage();
     $temporaryFileId = $fileUploadForm->uploadFile($request);
     if ($temporaryFileId !== false) {
         $json->setAdditionalAttributes(array('temporaryFileId' => $temporaryFileId));
     } else {
         $json->setStatus(false);
         $json->setContent(__('common.uploadFailed'));
     }
     return $json->getString();
 }
开发者ID:utlib,项目名称:ojs,代码行数:19,代码来源:WebsiteSettingsTabHandler.inc.php

示例2: 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

示例3: 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->getBySubmissionId($submission->getId());
     $formats = array();
     while ($galley = $galleys->next()) {
         $formats[$galley->getId()] = $galley->getLocalizedName();
     }
     $json->setStatus(true);
     $json->setContent(true);
     $json->setAdditionalAttributes(array('formats' => $formats));
     return $json->getString();
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:21,代码来源:IssueEntryHandler.inc.php

示例4: 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);
     $json = new JSONMessage();
     // 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')));
     } else {
         $json->setStatus(false);
     }
     return $json->getString();
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:24,代码来源:SubmissionMetadataHandler.inc.php

示例5: 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($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')));
     } else {
         $json->setStatus(false);
     }
     return $json->getString();
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:24,代码来源:PKPSubmissionInformationCenterHandler.inc.php

示例6: fetchRows

 /**
  * Fetch all grid rows from loaded data.
  * @param $args Array
  * @param $request Request
  * @return JSONMessage JSON object.
  */
 function fetchRows($args, $request)
 {
     // Render the rows.
     $this->setFirstDataColumn();
     $elements = $this->getGridDataElements($request);
     $renderedRows = $this->renderRowsInternally($request, $elements);
     $json = new JSONMessage();
     $json->setStatus(false);
     if ($renderedRows) {
         $renderedRowsString = null;
         foreach ($renderedRows as $rowString) {
             $renderedRowsString .= $rowString;
         }
         $json->setStatus(true);
         $json->setContent($renderedRowsString);
     }
     $this->callFeaturesHook('fetchRows', array('request' => &$request, 'grid' => &$this, 'jsonMessage' => &$json));
     return $json;
 }
开发者ID:jalperin,项目名称:pkp-lib,代码行数:25,代码来源:GridHandler.inc.php

示例7: saveNotificationSettings

 /**
  * Save user notification settings.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON-formatted response
  */
 function saveNotificationSettings($args, $request)
 {
     $this->setupTemplate($request);
     import('classes.notification.form.NotificationSettingsForm');
     $notificationSettingsForm = new NotificationSettingsForm();
     $notificationSettingsForm->readInputData();
     $json = new JSONMessage();
     if ($notificationSettingsForm->validate()) {
         $notificationSettingsForm->execute($request);
         $user = $request->getUser();
         $notificationMgr = new NotificationManager();
         $notificationMgr->createTrivialNotification($user->getId());
     } else {
         $json->setStatus(false);
     }
     return $json;
 }
开发者ID:energylevels,项目名称:pkp-lib,代码行数:23,代码来源:ProfileTabHandler.inc.php

示例8: fetchRegions

 /**
  * Fetch regions from the passed request
  * variable country id.
  * @param $args array
  * @param $request Request
  * @return string JSON response
  */
 function fetchRegions(&$args, &$request)
 {
     $this->validate();
     $countryId = (string) $request->getUserVar('countryId');
     import('lib.pkp.classes.core.JSONMessage');
     $json = new JSONMessage(false);
     if ($countryId) {
         $geoLocationTool =& StatisticsHelper::getGeoLocationTool();
         if ($geoLocationTool) {
             $regions = $geoLocationTool->getRegions($countryId);
             if (!empty($regions)) {
                 $regionsData = array();
                 foreach ($regions as $id => $name) {
                     $regionsData[] = array('id' => $id, 'name' => $name);
                 }
                 $json->setStatus(true);
                 $json->setContent($regionsData);
             }
         }
     }
     return $json->getString();
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:29,代码来源:ReportGeneratorHandler.inc.php

示例9: saveForm

 /**
  * Save the forms handled by this Handler.
  * @param $request Request
  * @param $args array
  * @return string JSON message
  */
 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:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:41,代码来源:PublicationEntryTabHandler.inc.php


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