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


PHP AjaxRequestHandler::addContent方法代码示例

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


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

示例1: dispatch

 /**
  * The main dispatcher function. Collect data and prepare HTML output.
  *
  * @param array $params array of parameters, currently unused
  * @param AjaxRequestHandler $ajaxObj object of type AjaxRequestHandler
  * @return void
  */
 public function dispatch($params = array(), AjaxRequestHandler $ajaxObj = NULL)
 {
     $params = GeneralUtility::_GP('params');
     if ($params['action'] === 'getContextHelp') {
         $result = $this->getContextHelp($params['table'], $params['field']);
         $ajaxObj->addContent('title', $result['title']);
         $ajaxObj->addContent('content', $result['description']);
         $ajaxObj->addContent('link', $result['moreInfo']);
         $ajaxObj->setContentFormat('json');
     }
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:18,代码来源:ContextHelpAjaxController.php

示例2: getRsaPublicKey

 /**
  * Gets RSA Public Key.
  *
  * @param array $parameters Parameters (not used)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $parent The calling parent AJAX object
  * @return void
  */
 public function getRsaPublicKey(array $parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $parent)
 {
     $backend = BackendFactory::getBackend();
     if ($backend !== NULL) {
         $keyPair = $backend->createNewKeyPair();
         $storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage();
         $storage->put($keyPair->getPrivateKey());
         session_commit();
         $parent->addContent('publicKeyModulus', $keyPair->getPublicKeyModulus());
         $parent->addContent('exponent', sprintf('%x', $keyPair->getExponent()));
         $parent->setContentFormat('json');
     } else {
         $parent->setError('No OpenSSL backend could be obtained for rsaauth.');
     }
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:22,代码来源:AjaxLoginHandler.php

示例3: ajaxBroker

 /**
  * Used to broker incoming requests to other calls.
  * Called by typo3/ajax.php
  *
  * @param array $unused additional parameters (not used)
  * @param AjaxRequestHandler $ajax the AJAX object for this request
  *
  * @return void
  */
 public function ajaxBroker(array $unused, AjaxRequestHandler $ajax)
 {
     $state = (bool) GeneralUtility::_POST('state');
     $checkbox = GeneralUtility::_POST('checkbox');
     if (in_array($checkbox, $this->validCheckboxKeys, true)) {
         $ajax->setContentFormat('json');
         $this->userSettingsService->set($checkbox, $state);
         $ajax->addContent('success', true);
     } else {
         $ajax->setContentFormat('plain');
         $ajax->setError('Illegal input parameters.');
     }
 }
开发者ID:TrueType,项目名称:phpunit,代码行数:22,代码来源:Ajax.php

示例4: processAjaxRequest

 /**
  * General processor for AJAX requests.
  * (called by typo3/ajax.php)
  *
  * @param array $params Additional parameters (not used here)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj The AjaxRequestHandler object of this request
  * @return void
  * @author Oliver Hader <oliver@typo3.org>
  */
 public function processAjaxRequest($params, \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj)
 {
     $this->ajaxObj = $ajaxObj;
     // Load the TSref XML information:
     $this->loadFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3editor') . 'res/tsref/tsref.xml');
     $ajaxIdParts = explode('::', $ajaxObj->getAjaxID(), 2);
     $ajaxMethod = $ajaxIdParts[1];
     $response = array();
     // Process the AJAX requests:
     if ($ajaxMethod == 'getTypes') {
         $ajaxObj->setContent($this->getTypes());
         $ajaxObj->setContentFormat('jsonbody');
     } elseif ($ajaxMethod == 'getDescription') {
         $ajaxObj->addContent('', $this->getDescription(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('typeId'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('parameterName')));
         $ajaxObj->setContentFormat('plain');
     }
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:26,代码来源:TypoScriptReferenceLoader.php

示例5: ajaxExpandCollapseWithoutProduct

 /**
  * Makes the AJAX call to expand or collapse the categorytree.
  * Called by typo3/ajax.php
  *
  * @param array $params Additional parameters (not used here)
  * @param AjaxRequestHandler $ajaxObj Ajax object
  *
  * @return void
  */
 public function ajaxExpandCollapseWithoutProduct(array $params, AjaxRequestHandler &$ajaxObj)
 {
     $parameter = $this->getParameter();
     // Get the category tree without the products and the articles
     $this->init(TRUE);
     $tree = $this->categoryTree->getBrowseableAjaxTree($parameter);
     $ajaxObj->addContent('tree', $tree);
 }
开发者ID:AndreasA,项目名称:commerce,代码行数:17,代码来源:CategoryViewHelper.php

示例6: renderFlashMessages

 /**
  * Renders the FlashMessages from queue and returns them as AJAX.
  *
  * @param array $params Always empty.
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AjaxRequestHandler object used to return content and set content types
  * @return void
  */
 public function renderFlashMessages(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $ajaxObj->addContent('result', $this->getFlashMessages());
     $ajaxObj->setContentFormat('html');
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:12,代码来源:DocumentTemplate.php

示例7: renderAjax

 /**
  * Renders the menu so that it can be returned as response to an AJAX call
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @return void
  */
 public function renderAjax($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj = NULL)
 {
     $ajaxObj->addContent('opendocsMenu', $this->getDropDown());
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:11,代码来源:OpendocsToolbarItem.php

示例8: processAjaxRequest

 /**
  * Handles the actual process from within the ajaxExec function
  * therefore, it does exactly the same as the real typo3/tce_file.php
  * but without calling the "finish" method, thus makes it simpler to deal with the
  * actual return value
  *
  * @param array $params Always empty.
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AjaxRequestHandler object used to return content and set content types
  * @return void
  */
 public function processAjaxRequest(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $this->init();
     $this->main();
     $errors = $this->fileProcessor->getErrorMessages();
     if (!empty($errors)) {
         $ajaxObj->setError(implode(',', $errors));
     } else {
         $flatResult = array();
         foreach ($this->fileData as $action => $results) {
             foreach ($results as $result) {
                 if (is_array($result)) {
                     foreach ($result as $subResult) {
                         $flatResult[$action][] = $this->flattenResultDataValue($subResult);
                     }
                 } else {
                     $flatResult[$action][] = $this->flattenResultDataValue($result);
                 }
             }
         }
         $ajaxObj->addContent('result', $flatResult);
         if ($this->redirect) {
             $ajaxObj->addContent('redirect', $this->redirect);
         }
         $ajaxObj->setContentFormat('json');
     }
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:37,代码来源:FileController.php

示例9: dispatch

 /**
  * The main dispatcher function. Collect data and prepare HTML output.
  *
  * @param array $params array of parameters from the AJAX interface, currently unused
  * @param AjaxRequestHandler $ajaxObj object of type AjaxRequestHandler
  * @return void
  */
 public function dispatch($params = array(), AjaxRequestHandler $ajaxObj = NULL)
 {
     $extPath = ExtensionManagementUtility::extPath('beuser');
     $view = GeneralUtility::makeInstance(StandaloneView::class);
     $view->setPartialRootPaths(array('default' => ExtensionManagementUtility::extPath('beuser') . 'Resources/Private/Partials'));
     $view->assign('pageId', $this->conf['page']);
     $content = '';
     // Basic test for required value
     if ($this->conf['page'] > 0) {
         // Init TCE for execution of update
         /** @var $tce DataHandler */
         $tce = GeneralUtility::makeInstance(DataHandler::class);
         $tce->stripslashes_values = FALSE;
         // Determine the scripts to execute
         switch ($this->conf['action']) {
             case 'show_change_owner_selector':
                 $content = $this->renderUserSelector($this->conf['page'], $this->conf['ownerUid'], $this->conf['username']);
                 break;
             case 'change_owner':
                 $userId = $this->conf['new_owner_uid'];
                 if (is_int($userId)) {
                     // Prepare data to change
                     $data = array();
                     $data['pages'][$this->conf['page']]['perms_userid'] = $userId;
                     // Execute TCE Update
                     $tce->start($data, array());
                     $tce->process_datamap();
                     $view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangeOwner.html');
                     $view->assign('userId', $userId);
                     $usernameArray = BackendUtility::getUserNames('username', ' AND uid = ' . $userId);
                     $view->assign('username', $usernameArray[$userId]['username']);
                     $content = $view->render();
                 } else {
                     $ajaxObj->setError('An error occurred: No page owner uid specified.');
                 }
                 break;
             case 'show_change_group_selector':
                 $content = $this->renderGroupSelector($this->conf['page'], $this->conf['groupUid'], $this->conf['groupname']);
                 break;
             case 'change_group':
                 $groupId = $this->conf['new_group_uid'];
                 if (is_int($groupId)) {
                     // Prepare data to change
                     $data = array();
                     $data['pages'][$this->conf['page']]['perms_groupid'] = $groupId;
                     // Execute TCE Update
                     $tce->start($data, array());
                     $tce->process_datamap();
                     $view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangeGroup.html');
                     $view->assign('groupId', $groupId);
                     $groupnameArray = BackendUtility::getGroupNames('title', ' AND uid = ' . $groupId);
                     $view->assign('groupname', $groupnameArray[$groupId]['title']);
                     $content = $view->render();
                 } else {
                     $ajaxObj->setError('An error occurred: No page group uid specified.');
                 }
                 break;
             case 'toggle_edit_lock':
                 // Prepare data to change
                 $data = array();
                 $data['pages'][$this->conf['page']]['editlock'] = $this->conf['editLockState'] === 1 ? 0 : 1;
                 // Execute TCE Update
                 $tce->start($data, array());
                 $tce->process_datamap();
                 $content = $this->renderToggleEditLock($this->conf['page'], $data['pages'][$this->conf['page']]['editlock']);
                 break;
             default:
                 if ($this->conf['mode'] === 'delete') {
                     $this->conf['permissions'] = (int) ($this->conf['permissions'] - $this->conf['bits']);
                 } else {
                     $this->conf['permissions'] = (int) ($this->conf['permissions'] + $this->conf['bits']);
                 }
                 // Prepare data to change
                 $data = array();
                 $data['pages'][$this->conf['page']]['perms_' . $this->conf['who']] = $this->conf['permissions'];
                 // Execute TCE Update
                 $tce->start($data, array());
                 $tce->process_datamap();
                 $view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangePermission.html');
                 $view->assign('permission', $this->conf['permissions']);
                 $view->assign('scope', $this->conf['who']);
                 $content = $view->render();
         }
     } else {
         $ajaxObj->setError('This script cannot be called directly.');
     }
     $ajaxObj->addContent($this->conf['page'] . '_' . $this->conf['who'], $content);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:95,代码来源:PermissionAjaxController.php

示例10: setAjaxShortcut

 /**
  * Gets called when a shortcut is changed, checks whether the user has
  * permissions to do so and saves the changes if everything is ok
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @return void
  */
 public function setAjaxShortcut($params = array(), AjaxRequestHandler $ajaxObj = NULL)
 {
     $databaseConnection = $this->getDatabaseConnection();
     $backendUser = $this->getBackendUser();
     $shortcutId = (int) GeneralUtility::_POST('shortcutId');
     $shortcutName = strip_tags(GeneralUtility::_POST('shortcutTitle'));
     $shortcutGroupId = (int) GeneralUtility::_POST('shortcutGroup');
     if ($shortcutGroupId > 0 || $backendUser->isAdmin()) {
         // Users can delete only their own shortcuts (except admins)
         $addUserWhere = !$backendUser->isAdmin() ? ' AND userid=' . (int) $backendUser->user['uid'] : '';
         $fieldValues = array('description' => $shortcutName, 'sc_group' => $shortcutGroupId);
         if ($fieldValues['sc_group'] < 0 && !$backendUser->isAdmin()) {
             $fieldValues['sc_group'] = 0;
         }
         $databaseConnection->exec_UPDATEquery('sys_be_shortcuts', 'uid=' . $shortcutId . $addUserWhere, $fieldValues);
         $affectedRows = $databaseConnection->sql_affected_rows();
         if ($affectedRows == 1) {
             $ajaxObj->addContent('shortcut', $shortcutName);
         } else {
             $ajaxObj->addContent('shortcut', 'failed');
         }
     }
     $ajaxObj->setContentFormat('plain');
 }
开发者ID:adrolli,项目名称:TYPO3.CMS,代码行数:32,代码来源:ShortcutToolbarItem.php

示例11: printContentForAjaxRequest

 /**
  * this is an intermediate clickmenu handler
  *
  * @param array $parameters
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
  */
 public function printContentForAjaxRequest($parameters, AjaxRequestHandler $ajaxRequestHandler)
 {
     // XML has to be parsed, no parse errors allowed
     @ini_set('display_errors', 0);
     $clipObj = GeneralUtility::makeInstance(Clipboard::class);
     $clipObj->initializeClipboard();
     // This locks the clipboard to the Normal for this request.
     $clipObj->lockToNormal();
     // Update clipboard if some actions are sent.
     $CB = GeneralUtility::_GET('CB');
     $clipObj->setCmd($CB);
     $clipObj->cleanCurrent();
     // Saves
     $clipObj->endClipboard();
     // Create clickmenu object
     $clickMenu = GeneralUtility::makeInstance(ClickMenu::class);
     // Set internal vars in clickmenu object:
     $clickMenu->clipObj = $clipObj;
     $clickMenu->extClassArray = $this->extClassArray;
     // Set content of the clickmenu with the incoming var, "item"
     $ajaxContent = $clickMenu->init();
     // send the data
     $ajaxContent = '<?xml version="1.0"?><t3ajax>' . $ajaxContent . '</t3ajax>';
     $ajaxRequestHandler->addContent('ClickMenu', $ajaxContent);
     $ajaxRequestHandler->setContentFormat('xml');
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:32,代码来源:ClickMenuController.php

示例12: checkElementKey

 /**
  * Checks if a key for an element is available
  *
  * @param array $params Array of parameters from the AJAX interface, not
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @author Benjamin Butschell <bb@webprofil.at>
  * @return void
  */
 public function checkElementKey($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->storageRepository = $this->objectManager->get("MASK\\Mask\\Domain\\Repository\\StorageRepository");
     // Get parameters, is there a better way? $params is not used yet
     $elementKey = $_GET["key"];
     // check if elementKey is available
     $isAvailable = TRUE;
     if ($this->storageRepository->loadElement("tt_content", $elementKey)) {
         $isAvailable = FALSE;
     }
     // return infos as json
     $ajaxObj->setContentFormat("plain");
     $ajaxObj->addContent("isAvailable", json_encode($isAvailable));
 }
开发者ID:butu,项目名称:mask,代码行数:23,代码来源:WizardController.php

示例13: renderAjax

 /**
  * Renders the menu so that it can be returned as response to an AJAX call
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type TYPO3AJAX
  * @return void
  */
 public function renderAjax($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     $menuContent = $this->renderMenu();
     $ajaxObj->addContent('opendocsMenu', $menuContent);
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:12,代码来源:OpendocsController.php

示例14: getListRows

 /**
  * get list rows
  *
  * @param    AjaxRequestHandler $ajaxObj the parent ajax object
  *
  * @return    void
  */
 public function getListRows(AjaxRequestHandler &$ajaxObj)
 {
     $uid = (int) $this->getParamValue('uid');
     if ($uid > 0) {
         $table = (string) $this->getParamValue('table');
         $table = $table ? $table : 'tt_content';
         $level = (int) $this->getParamValue('level');
         $this->initializeTemplateContainer();
         $elementChildren = Helper::getInstance()->getChildren($table, $uid, GeneralUtility::_GP('sortField'), (int) GeneralUtility::_GP('sortRev'));
         $row = BackendUtility::getRecord($table, $uid);
         $recordList = $this->getRecordList($table, $uid, $row);
         if ($recordList instanceof DatabaseRecordList) {
             $level++;
             foreach ($elementChildren as $elementChild) {
                 $listRows[] = $recordList->renderListRow($elementChild->getTable(), BackendUtility::getRecord($elementChild->getTable(), $elementChild->getId()), 0, $GLOBALS['TCA'][$table]['ctrl']['label'], $GLOBALS['TCA'][$table]['ctrl']['thumbnail'], 1, $level);
             }
         }
         $ajaxObj->addContent('list', $listRows);
     }
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:27,代码来源:AjaxRecordList.php

示例15: setAjaxShortcut

 /**
  * Gets called when a shortcut is changed, checks whether the user has
  * permissions to do so and saves the changes if everything is ok
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type TYPO3AJAX
  * @return void
  */
 public function setAjaxShortcut($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     $shortcutId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('shortcutId');
     $shortcutName = strip_tags(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('value'));
     $shortcutGroupId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('shortcut-group');
     if ($shortcutGroupId > 0 || $GLOBALS['BE_USER']->isAdmin()) {
         // Users can delete only their own shortcuts (except admins)
         $addUserWhere = !$GLOBALS['BE_USER']->isAdmin() ? ' AND userid=' . intval($GLOBALS['BE_USER']->user['uid']) : '';
         $fieldValues = array('description' => $shortcutName, 'sc_group' => $shortcutGroupId);
         if ($fieldValues['sc_group'] < 0 && !$GLOBALS['BE_USER']->isAdmin()) {
             $fieldValues['sc_group'] = 0;
         }
         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_be_shortcuts', 'uid=' . $shortcutId . $addUserWhere, $fieldValues);
         $affectedRows = $GLOBALS['TYPO3_DB']->sql_affected_rows();
         if ($affectedRows == 1) {
             $ajaxObj->addContent('shortcut', $shortcutName);
         } else {
             $ajaxObj->addContent('shortcut', 'failed');
         }
     }
     $ajaxObj->setContentFormat('plain');
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:30,代码来源:ShortcutToolbarItem.php


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