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


PHP JSONMessage::setAdditionalAttributes方法代码示例

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


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

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

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

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

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

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

 /**
  * Display the plugin.
  * @param $args array
  * @param $request PKPRequest
  */
 function display($args, $request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $context = $request->getContext();
     parent::display($args, $request);
     $templateMgr->assign('plugin', $this);
     switch (array_shift($args)) {
         case 'index':
         case '':
             $templateMgr->display($this->getTemplatePath() . 'index.tpl');
             break;
         case 'uploadImportXML':
             $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()));
             } else {
                 $json = new JSONMessage(false, __('common.uploadFailed'));
             }
             return $json->getString();
         case 'importBounce':
             $json = new JSONMessage(true);
             $json->setEvent('addTab', array('title' => __('plugins.importexport.users.results'), 'url' => $request->url(null, null, null, array('plugin', $this->getName(), 'import'), array('temporaryFileId' => $request->getUserVar('temporaryFileId')))));
             return $json->getString();
         case 'import':
             $temporaryFileId = $request->getUserVar('temporaryFileId');
             $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
             $user = $request->getUser();
             $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
             if (!$temporaryFile) {
                 $json = new JSONMessage(true, __('plugins.importexport.users.uploadFile'));
                 return $json->getString();
             }
             $temporaryFilePath = $temporaryFile->getFilePath();
             $users = $this->importUsers(file_get_contents($temporaryFilePath), $context, $user);
             $templateMgr->assign('users', $users);
             $json = new JSONMessage(true, $templateMgr->fetch($this->getTemplatePath() . 'results.tpl'));
             return $json->getString();
         case 'export':
             $exportXml = $this->exportUsers((array) $request->getUserVar('selectedUsers'), $request->getContext(), $request->getUser());
             header('Content-type: application/xml');
             echo $exportXml;
             break;
         case 'exportAllUsers':
             $exportXml = $this->exportAllUsers($request->getContext(), $request->getUser());
             header('Content-type: application/xml');
             echo $exportXml;
             break;
         default:
             $dispatcher = $request->getDispatcher();
             $dispatcher->handle404();
     }
 }
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:61,代码来源:PKPUserImportExportPlugin.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: display

 /**
  * Display the plugin.
  * @param $args array
  * @param $request PKPRequest
  */
 function display($args, $request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $press = $request->getPress();
     parent::display($args, $request);
     $templateMgr->assign('plugin', $this);
     switch (array_shift($args)) {
         case 'index':
         case '':
             $templateMgr->display($this->getTemplatePath() . 'index.tpl');
             break;
         case 'uploadImportXML':
             $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()));
             } else {
                 $json = new JSONMessage(false, __('common.uploadFailed'));
             }
             return $json->getString();
         case 'importBounce':
             $json = new JSONMessage(true);
             $json->setEvent('addTab', array('title' => __('plugins.importexport.native.results'), 'url' => $request->url(null, null, null, array('plugin', $this->getName(), 'import'), array('temporaryFileId' => $request->getUserVar('temporaryFileId')))));
             return $json->getString();
         case 'import':
             AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION);
             $temporaryFileId = $request->getUserVar('temporaryFileId');
             $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
             $user = $request->getUser();
             $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
             if (!$temporaryFile) {
                 $json = new JSONMessage(true, __('plugins.inportexport.native.uploadFile'));
                 return $json->getString();
             }
             $temporaryFilePath = $temporaryFile->getFilePath();
             $deployment = new NativeImportExportDeployment($press, $user);
             libxml_use_internal_errors(true);
             $submissions = $this->importSubmissions(file_get_contents($temporaryFilePath), $deployment);
             $templateMgr->assign('submissions', $submissions);
             $validationErrors = array_filter(libxml_get_errors(), create_function('$a', 'return $a->level == LIBXML_ERR_ERROR ||  $a->level == LIBXML_ERR_FATAL;'));
             $templateMgr->assign('validationErrors', $validationErrors);
             libxml_clear_errors();
             // Are there any submissions import errors
             $processedSubmissionsIds = $deployment->getProcessedObjectsIds(ASSOC_TYPE_SUBMISSION);
             if (!empty($processedSubmissionsIds)) {
                 $submissionsErrors = array_filter($processedSubmissionsIds, create_function('$a', 'return !empty($a);'));
                 if (!empty($submissionsErrors)) {
                     $templateMgr->assign('submissionsErrors', $processedSubmissionsIds);
                 }
             }
             // If there are any submissions or validataion errors
             // delete imported submissions.
             if (!empty($submissionsErrors) || !empty($validationErrors)) {
                 // remove all imported sumissions
                 $deployment->removeImportedObjects(ASSOC_TYPE_SUBMISSION);
             }
             // Display the results
             $json = new JSONMessage(true, $templateMgr->fetch($this->getTemplatePath() . 'results.tpl'));
             return $json->getString();
         case 'export':
             $exportXml = $this->exportSubmissions((array) $request->getUserVar('selectedSubmissions'), $request->getContext(), $request->getUser());
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $exportFileName = $this->getExportFileName($this->getExportPath(), 'monographs', $press, '.xml');
             $fileManager->writeFile($exportFileName, $exportXml);
             $fileManager->downloadFile($exportFileName);
             $fileManager->deleteFile($exportFileName);
             break;
         default:
             $dispatcher = $request->getDispatcher();
             $dispatcher->handle404();
     }
 }
开发者ID:NateWr,项目名称:omp,代码行数:81,代码来源:NativeImportExportPlugin.inc.php

示例10: uploadPluginFile

 /**
  * Upload a plugin file.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function uploadPluginFile($args, $request)
 {
     import('lib.pkp.classes.file.TemporaryFileManager');
     $temporaryFileManager = new TemporaryFileManager();
     $user = $request->getUser();
     // Return the temporary file id.
     if ($temporaryFile = $temporaryFileManager->handleUpload('uploadedFile', $user->getId())) {
         $json = new JSONMessage(true);
         $json->setAdditionalAttributes(array('temporaryFileId' => $temporaryFile->getId()));
         return $json;
     } else {
         return new JSONMessage(false, __('manager.plugins.uploadError'));
     }
 }
开发者ID:piero-tasso,项目名称:pkp-lib,代码行数:20,代码来源:PluginGridHandler.inc.php

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

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

示例13: fetchFormatInfo

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

示例14: display

 /**
  * Display the plugin.
  * @param $args array
  * @param $request PKPRequest
  */
 function display($args, $request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $context = $request->getContext();
     parent::display($args, $request);
     $templateMgr->assign('plugin', $this);
     switch (array_shift($args)) {
         case 'index':
         case '':
             $templateMgr->display($this->getTemplatePath() . 'index.tpl');
             break;
         case 'uploadImportXML':
             $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()));
             } else {
                 $json = new JSONMessage(false, __('common.uploadFailed'));
             }
             return $json->getString();
         case 'importBounce':
             $json = new JSONMessage(true);
             $json->setEvent('addTab', array('title' => __('plugins.importexport.users.results'), 'url' => $request->url(null, null, null, array('plugin', $this->getName(), 'import'), array('temporaryFileId' => $request->getUserVar('temporaryFileId')))));
             return $json->getString();
         case 'import':
             $temporaryFileId = $request->getUserVar('temporaryFileId');
             $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
             $user = $request->getUser();
             $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId());
             if (!$temporaryFile) {
                 $json = new JSONMessage(true, __('plugins.importexport.users.uploadFile'));
                 return $json->getString();
             }
             $temporaryFilePath = $temporaryFile->getFilePath();
             libxml_use_internal_errors(true);
             $users = $this->importUsers(file_get_contents($temporaryFilePath), $context, $user);
             $validationErrors = array_filter(libxml_get_errors(), create_function('$a', 'return $a->level == LIBXML_ERR_ERROR ||  $a->level == LIBXML_ERR_FATAL;'));
             $templateMgr->assign('validationErrors', $validationErrors);
             libxml_clear_errors();
             $templateMgr->assign('users', $users);
             $json = new JSONMessage(true, $templateMgr->fetch($this->getTemplatePath() . 'results.tpl'));
             return $json->getString();
         case 'export':
             $exportXml = $this->exportUsers((array) $request->getUserVar('selectedUsers'), $request->getContext(), $request->getUser());
             import('lib.pkp.classes.file.FileManager');
             $fileManager = new FileManager();
             $exportFileName = $this->getExportFileName($this->getExportPath(), 'users', $context, '.xml');
             $fileManager->writeFile($exportFileName, $exportXml);
             $fileManager->downloadFile($exportFileName);
             $fileManager->deleteFile($exportFileName);
             break;
         case 'exportAllUsers':
             $exportXml = $this->exportAllUsers($request->getContext(), $request->getUser());
             import('lib.pkp.classes.file.TemporaryFileManager');
             $fileManager = new TemporaryFileManager();
             $exportFileName = $this->getExportFileName($this->getExportPath(), 'users', $context, '.xml');
             $fileManager->writeFile($exportFileName, $exportXml);
             $fileManager->downloadFile($exportFileName);
             $fileManager->deleteFile($exportFileName);
             break;
         default:
             $dispatcher = $request->getDispatcher();
             $dispatcher->handle404();
     }
 }
开发者ID:pkp,项目名称:pkp-lib,代码行数:73,代码来源:PKPUserImportExportPlugin.inc.php


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