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


PHP JSONMessage::setContent方法代码示例

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


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

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

示例2: fetchReportGenerator

 /**
  * Fetch form to generate custom reports.
  * @param $args array
  * @param $request Request
  * @return JSONMessage JSON object
  */
 function fetchReportGenerator($args, $request)
 {
     $this->setupTemplate($request);
     $reportGeneratorForm = $this->_getReportGeneratorForm($request);
     $reportGeneratorForm->initData($request);
     $formContent = $reportGeneratorForm->fetch($request);
     $json = new JSONMessage(true);
     if ($request->getUserVar('refreshForm')) {
         $json->setEvent('refreshForm', $formContent);
     } else {
         $json->setContent($formContent);
     }
     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: 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

示例5: initData

 /**
  * @copydoc Form::initData()
  */
 function initData()
 {
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     $userGroup = $userGroupDao->getById($this->getUserGroupId());
     $stages = WorkflowStageDAO::getWorkflowStageTranslationKeys();
     $this->setData('stages', $stages);
     $this->setData('assignedStages', array());
     // sensible default
     $roleDao = DAORegistry::getDAO('RoleDAO');
     /* @var $roleDao RoleDAO */
     import('lib.pkp.classes.core.JSONMessage');
     $jsonMessage = new JSONMessage();
     $jsonMessage->setContent($roleDao->getForbiddenStages());
     $this->setData('roleForbiddenStagesJSON', $jsonMessage->getString());
     if ($userGroup) {
         $assignedStages = $userGroupDao->getAssignedStagesByUserGroupId($this->getContextId(), $userGroup->getId());
         $data = array('userGroupId' => $userGroup->getId(), 'roleId' => $userGroup->getRoleId(), 'name' => $userGroup->getName(null), 'abbrev' => $userGroup->getAbbrev(null), 'assignedStages' => array_keys($assignedStages), 'showTitle' => $userGroup->getShowTitle(), 'permitSelfRegistration' => $userGroup->getPermitSelfRegistration());
         foreach ($data as $field => $value) {
             $this->setData($field, $value);
         }
     }
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:25,代码来源:UserGroupForm.inc.php

示例6: fetchFile

 /**
  * Fetch a file that has been uploaded.
  *
  * @param $args array
  * @param $request Request
  * @return string
  */
 function fetchFile($args, $request)
 {
     // Get the setting name.
     $settingName = $args['settingName'];
     // Try to fetch the file.
     $tabForm = $this->getTabForm();
     $tabForm->initData($request);
     $renderedElement = $tabForm->renderFileView($settingName, $request);
     $json = new JSONMessage();
     if ($renderedElement == false) {
         $json->setAdditionalAttributes(array('noData' => $settingName));
     } else {
         $json->setElementId($settingName);
         $json->setContent($renderedElement);
     }
     return $json->getString();
 }
开发者ID:utlib,项目名称:ojs,代码行数:24,代码来源:WebsiteSettingsTabHandler.inc.php

示例7: fetchNotification

 /**
  * Return formatted notification data using Json.
  * @param $args array
  * @param $request Request
  *
  * @return JSONMessage
  */
 function fetchNotification($args, &$request)
 {
     $this->setupTemplate();
     $user =& $request->getUser();
     $context =& $request->getContext();
     $notificationDao =& DAORegistry::getDAO('NotificationDAO');
     $notifications = array();
     // Get the notification options from request.
     $notificationOptions = $request->getUserVar('requestOptions');
     if (is_array($notificationOptions)) {
         // Retrieve the notifications.
         $notifications = $this->_getNotificationsByOptions($notificationOptions, $context->getId(), $user->getId());
     } else {
         // No options, get only TRIVIAL notifications.
         $notifications =& $notificationDao->getByUserId($user->getId(), NOTIFICATION_LEVEL_TRIVIAL);
         $notifications =& $notifications->toArray();
     }
     import('lib.pkp.classes.core.JSONMessage');
     $json = new JSONMessage();
     if (is_array($notifications) && !empty($notifications)) {
         $formattedNotificationsData = array();
         $notificationManager = new NotificationManager();
         // Format in place notifications.
         $formattedNotificationsData['inPlace'] = $notificationManager->formatToInPlaceNotification($request, $notifications);
         // Format general notifications.
         $formattedNotificationsData['general'] = $notificationManager->formatToGeneralNotification($request, $notifications);
         // Delete trivial notifications from database.
         $notificationManager->deleteTrivialNotifications($notifications);
         $json->setContent($formattedNotificationsData);
     }
     return $json->getString();
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:39,代码来源:NotificationHandler.inc.php

示例8: fetchRow

 /**
  * Render a row and send it to the client. If the row no
  * longer exists then inform the client.
  * @param $args array
  * @param $request Request
  * @return JSONMessage JSON object.
  */
 function fetchRow(&$args, $request)
 {
     // Instantiate the requested row (includes a
     // validity check on the row id).
     $row = $this->getRequestedRow($request, $args);
     $json = new JSONMessage(true);
     if (is_null($row)) {
         // Inform the client that the row does no longer exist.
         $json->setAdditionalAttributes(array('elementNotFound' => $args['rowId']));
     } else {
         // Render the requested row
         $renderedRow = $this->renderRow($request, $row);
         $json->setContent($renderedRow);
         // Add the sequence map so grid can place the row at the correct position.
         $sequenceMap = $this->getRowsSequence($request);
         $json->setAdditionalAttributes(array('sequenceMap' => $sequenceMap));
     }
     $this->callFeaturesHook('fetchRow', array('request' => &$request, 'grid' => &$this, 'row' => &$row, 'jsonMessage' => &$json));
     // Render and return the JSON message.
     return $json;
 }
开发者ID:jalperin,项目名称:pkp-lib,代码行数:28,代码来源:GridHandler.inc.php

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

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

示例11: updateIdentifiers

 /**
  * Update submission pub ids.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function updateIdentifiers($args, $request)
 {
     import('lib.pkp.controllers.tab.pubIds.form.PKPPublicIdentifiersForm');
     $submission = $this->getSubmission();
     $stageId = $this->getStageId();
     $form = new PKPPublicIdentifiersForm($submission, $stageId, array('displayedInContainer' => true));
     $form->readInputData();
     if ($form->validate($request)) {
         $form->execute($request);
         $json = new JSONMessage();
         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 {
         return new JSONMessage(true, $form->fetch($request));
     }
 }
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:29,代码来源:CatalogEntryTabHandler.inc.php


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