本文整理汇总了PHP中TYPO3\CMS\Fluid\View\StandaloneView::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP StandaloneView::assign方法的具体用法?PHP StandaloneView::assign怎么用?PHP StandaloneView::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Fluid\View\StandaloneView
的用法示例。
在下文中一共展示了StandaloneView::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
public function main()
{
$result = $error = $url = NULL;
$this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($this->templatePath . 'Main.html'));
if ($this->configuration->isValid()) {
try {
$this->checkPageId();
$url = $this->urlService->getFullUrl($this->pageId, $this->pObj->MOD_SETTINGS);
if (GeneralUtility::_GET('clear')) {
$this->pageSpeedRepository->clearByIdentifier($url);
$this->view->assign('cacheCleared', TRUE);
}
$result = $this->pageSpeedRepository->findByIdentifier($url);
} catch (\HTTP_Request2_ConnectionException $e) {
$error = 'error.http_request.connection';
// todo add log
} catch (\RuntimeException $e) {
$error = $e->getMessage();
}
} else {
$error = 'error.invalid.key';
}
$this->view->assignMultiple(array('lll' => 'LLL:EXT:page_speed/Resources/Private/Language/locallang.xlf:', 'menu' => $this->modifyFuncMenu(BackendUtility::getFuncMenu($this->pObj->id, 'SET[language]', $this->pObj->MOD_SETTINGS['language'], $this->pObj->MOD_MENU['language']), 'language'), 'configuration' => $this->configuration, 'result' => $result, 'url' => $url, 'error' => $error, 'pageId' => $this->pageId));
return $this->view->render();
}
示例2: render
/**
* @param StandaloneView $view
* @param PageRenderer $pageRenderer
* @param LoginController $loginController
* @throws \UnexpectedValueException
*/
public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController)
{
GeneralUtility::makeInstance(ObjectManager::class)->get(Dispatcher::class)->dispatch(__CLASS__, self::SIGNAL_getPageRenderer, array($pageRenderer));
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/UserPassLogin');
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/UserPassLoginForm.html'));
if (GeneralUtility::getIndpEnv('TYPO3_SSL')) {
$view->assign('presetUsername', GeneralUtility::_GP('u'));
$view->assign('presetPassword', GeneralUtility::_GP('p'));
}
}
示例3: replaceCallback
/**
* Callback function for rendering quotes.
*
* @param string $matches PCRE matches.
* @return string The quote content.
*/
protected function replaceCallback($matches)
{
$this->view->setControllerContext($this->controllerContext);
$this->view->setTemplatePathAndFilename(File::replaceSiteRelPath($this->settings['template']));
$tmp = $this->postRepository->findByUid((int) $matches[1]);
if (!empty($tmp)) {
$this->view->assign('post', $tmp);
}
$this->view->assign('quote', trim($matches[2]));
return $this->view->render();
}
示例4: initFluidTemplate
/**
* inits the standalone fluid template
*/
public function initFluidTemplate()
{
$this->searchFormView = GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
$this->searchFormView->setPartialRootPaths([$this->conf['partialRootPath']]);
$this->searchFormView->setLayoutRootPaths([$this->conf['layoutRootPath']]);
$this->searchFormView->setTemplatePathAndFilename($this->conf['templateRootPath'] . 'SearchForm.html');
// make settings available in fluid template
$this->searchFormView->assign('conf', $this->conf);
$this->searchFormView->assign('extConf', $this->extConf);
$this->searchFormView->assign('extConfPremium', $this->extConfPremium);
}
示例5: renderingTest
/**
* @param string $viewHelperTemplate
* @param string $expectedOutput
*
* @test
* @dataProvider viewHelperTemplateSourcesDataProvider
*/
public function renderingTest($viewHelperTemplate, $expectedOutput)
{
$view = new StandaloneView();
$view->getRenderingContext()->getViewHelperResolver()->addNamespace('ft', 'TYPO3Fluid\\FluidTest\\ViewHelpers');
$view->getRenderingContext()->getTemplatePaths()->setTemplateSource($viewHelperTemplate);
$view->assign('settings', ['test' => '<strong>Bla</strong>']);
$this->assertSame($expectedOutput, $view->render());
}
示例6: assignSettings
/**
* Set any TypoScript settings to the view. This is similar to a
* default MVC action controller in extbase.
*
* @param array $conf Configuration
* @return void
*/
protected function assignSettings(array $conf)
{
if (isset($conf['settings.'])) {
/** @var $typoScriptService TypoScriptService */
$typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
$settings = $typoScriptService->convertTypoScriptArrayToPlainArray($conf['settings.']);
$this->view->assign('settings', $settings);
}
}
示例7: getExtensionSummary
/**
* Render the Plugin Info
*
* @param array $params
* @param object $pObj
* @return string
*/
public function getExtensionSummary($params, &$pObj)
{
$data = GeneralUtility::xml2array($params['row']['pi_flexform']);
$this->init($data);
$this->getSelectedObjects($data);
$this->fluidRenderer->assign($this->pluginMode, true);
$this->fluidRenderer->assign('storageFolder', $this->getStorageFolder($data));
$this->fluidRenderer->assign('gallery', $this->selectedGallery);
$this->fluidRenderer->assign('album', $this->selectedAlbum);
$this->fluidRenderer->assign('item', $this->selectedItem);
$this->fluidRenderer->assign('caLabel', 'LLL:EXT:yag/Resources/Private/Language/locallang.xlf:tx_yag_flexform_controllerAction.' . $this->pluginMode);
$this->fluidRenderer->assign('theme', $this->theme);
$this->fluidRenderer->assign('context', $this->getDataValue($data, 'settings.contextIdentifier'));
return $this->fluidRenderer->render();
}
示例8: renderContent
/**
* renderContent renders sie given Fluidtemplate an adds the given data to the view helper.
* Your templates have to be in "Resources/Private/Html/Content/"
*
* @param array $data Daten für das Fluid-Template
* @param string $templateFile
*
* @return string Content
*/
public function renderContent($data, $templateFile)
{
if (file_exists($templateFile)) {
$this->view->getRequest()->setControllerExtensionName($this->extKey);
$this->view->setTemplatePathAndFilename($templateFile);
$this->view->assign('data', $data);
$content = $this->view->render();
} else {
$content = 'Could not load template!';
}
return $content;
}
示例9: makeInterfaceSelectorBox
/**
* Making interface selector:
*
* @return void
*/
public function makeInterfaceSelectorBox()
{
// If interfaces are defined AND no input redirect URL in GET vars:
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] && ($this->isLoginInProgress() || !$this->redirectUrl)) {
$parts = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']);
if (count($parts) > 1) {
// Only if more than one interface is defined we will show the selector
$interfaces = array('backend' => array('label' => $this->getLanguageService()->getLL('interface.backend'), 'jumpScript' => BackendUtility::getModuleUrl('main'), 'interface' => 'backend'), 'frontend' => array('label' => $this->getLanguageService()->getLL('interface.frontend'), 'jumpScript' => '../', 'interface' => 'frontend'));
$this->view->assign('showInterfaceSelector', true);
$this->view->assign('interfaces', $interfaces);
} elseif (!$this->redirectUrl) {
// If there is only ONE interface value set and no redirect_url is present
$this->view->assign('showInterfaceSelector', false);
$this->view->assign('interface', $parts[0]);
}
}
}
示例10: main
/**
* Main function
*
* @return void
*/
public function main()
{
/** @var ArrayBrowser $arrayBrowser */
$arrayBrowser = GeneralUtility::makeInstance(ArrayBrowser::class);
$label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
$search_field = GeneralUtility::_GP('search_field');
$templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:lowlevel/Resources/Private/Templates/Backend/Configuration.html');
$this->view->setTemplatePathAndFilename($templatePathAndFilename);
$this->view->assign('label', $label);
$this->view->assign('search_field', $search_field);
$this->view->assign('checkbox_checkRegexsearch', BackendUtility::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"'));
switch ($this->MOD_SETTINGS['function']) {
case 0:
$theVar = $GLOBALS['TYPO3_CONF_VARS'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_CONF_VARS';
break;
case 1:
$theVar = $GLOBALS['TCA'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TCA';
break;
case 2:
$theVar = $GLOBALS['TCA_DESCR'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TCA_DESCR';
break;
case 3:
$theVar = $GLOBALS['TYPO3_LOADED_EXT'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_LOADED_EXT';
break;
case 4:
$theVar = $GLOBALS['T3_SERVICES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$T3_SERVICES';
break;
case 5:
$theVar = $GLOBALS['TBE_MODULES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_MODULES';
break;
case 6:
$theVar = $GLOBALS['TBE_MODULES_EXT'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_MODULES_EXT';
break;
case 7:
$theVar = $GLOBALS['TBE_STYLES'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TBE_STYLES';
break;
case 8:
$theVar = $GLOBALS['BE_USER']->uc;
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$BE_USER->uc';
break;
case 9:
$theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
ArrayUtility::naturalKeySortRecursive($theVar);
$arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
break;
default:
$theVar = array();
}
// Update node:
$update = 0;
$node = GeneralUtility::_GET('node');
// If any plus-signs were clicked, it's registered.
if (is_array($node)) {
$this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
$update = 1;
}
if ($update) {
$this->getBackendUser()->pushModuleData($this->moduleName, $this->MOD_SETTINGS);
}
$arrayBrowser->dontLinkVar = true;
$arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
$arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
$arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
$arrayBrowser->searchKeysToo = true;
// If any POST-vars are send, update the condition array
if (GeneralUtility::_POST('search') && trim($search_field)) {
$arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
}
// mask sensitive information
$varName = trim($arrayBrowser->varName, '$');
if (isset($this->blindedConfigurationOptions[$varName])) {
ArrayUtility::mergeRecursiveWithOverrule($theVar, $this->blindedConfigurationOptions[$varName]);
}
$tree = $arrayBrowser->tree($theVar, '', '');
$this->view->assign('tree', $tree);
// Setting up the shortcut button for docheader
$buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
// Shortcut
//.........这里部分代码省略.........
示例11: setForm
/**
* Set form tag
*
* @param string $formTag Form tag to add
*
* @return void
*/
public function setForm($formTag = '')
{
$this->view->assign('formTag', $formTag);
}
示例12: listTasksAction
//.........这里部分代码省略.........
if (isset($registeredClasses[get_class($task)]) && $this->scheduler->isValidTaskObject($task)) {
// The task object is valid
$labels = array();
$name = htmlspecialchars($registeredClasses[$class]['title'] . ' (' . $registeredClasses[$class]['extension'] . ')');
$additionalInformation = $task->getAdditionalInformation();
if ($task instanceof \TYPO3\CMS\Scheduler\ProgressProviderInterface) {
$progress = round(floatval($task->getProgress()), 2);
$name .= $this->renderTaskProgressBar($progress);
}
if (!empty($additionalInformation)) {
$name .= '<div class="additional-information">' . nl2br(htmlspecialchars($additionalInformation)) . '</div>';
}
// Check if task currently has a running execution
if (!empty($schedulerRecord['serialized_executions'])) {
$labels[] = array('class' => 'success', 'text' => $this->getLanguageService()->getLL('status.running'));
$isRunning = true;
}
// Prepare display of next execution date
// If task is currently running, date is not displayed (as next hasn't been calculated yet)
// Also hide the date if task is disabled (the information doesn't make sense, as it will not run anyway)
if ($isRunning || $schedulerRecord['disable']) {
$nextDate = '-';
} else {
$nextDate = date($dateFormat, $schedulerRecord['nextexecution']);
if (empty($schedulerRecord['nextexecution'])) {
$nextDate = $this->getLanguageService()->getLL('none');
} elseif ($schedulerRecord['nextexecution'] < $GLOBALS['EXEC_TIME']) {
$labels[] = array('class' => 'warning', 'text' => $this->getLanguageService()->getLL('status.late'), 'description' => $this->getLanguageService()->getLL('status.legend.scheduled'));
}
}
// Get execution type
if ($task->getType() === AbstractTask::TYPE_SINGLE) {
$execType = $this->getLanguageService()->getLL('label.type.single');
$frequency = '-';
} else {
$execType = $this->getLanguageService()->getLL('label.type.recurring');
if ($task->getExecution()->getCronCmd() == '') {
$frequency = $task->getExecution()->getInterval();
} else {
$frequency = $task->getExecution()->getCronCmd();
}
}
// Get multiple executions setting
if ($task->getExecution()->getMultiple()) {
$multiple = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:yes');
} else {
$multiple = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:no');
}
// Define checkbox
$startExecutionElement = '<label class="btn btn-default btn-checkbox"><input type="checkbox" name="tx_scheduler[execute][]" value="' . $schedulerRecord['uid'] . '" id="task_' . $schedulerRecord['uid'] . '"><span class="t3-icon fa"></span></label>';
$actions = $editAction . $toggleHiddenAction . $deleteAction;
// Check the disable status
// Row is shown dimmed if task is disabled, unless it is still running
if ($schedulerRecord['disable'] && !$isRunning) {
$labels[] = array('class' => 'default', 'text' => $this->getLanguageService()->getLL('status.disabled'));
$showAsDisabled = true;
}
// Show no action links (edit, delete) if task is running
if ($isRunning) {
$actions = $stopAction;
} else {
$actions .= $runAction;
}
// Check if the last run failed
if (!empty($schedulerRecord['lastexecution_failure'])) {
// Try to get the stored exception array
/** @var $exceptionArray array */
$exceptionArray = @unserialize($schedulerRecord['lastexecution_failure']);
// If the exception could not be unserialized, issue a default error message
if (!is_array($exceptionArray) || empty($exceptionArray)) {
$labelDescription = $this->getLanguageService()->getLL('msg.executionFailureDefault');
} else {
$labelDescription = sprintf($this->getLanguageService()->getLL('msg.executionFailureReport'), $exceptionArray['code'], $exceptionArray['message']);
}
$labels[] = array('class' => 'danger', 'text' => $this->getLanguageService()->getLL('status.failure'), 'description' => $labelDescription);
}
// Format the execution status,
// including failure feedback, if any
$taskDesc = '';
if ($schedulerRecord['description'] !== '') {
$taskDesc = '<span class="description">' . nl2br(htmlspecialchars($schedulerRecord['description'])) . '</span>';
}
$taskName = '<span class="name"><a href="' . $link . '">' . $name . '</a></span>';
$table[] = '<tr class="' . ($showAsDisabled ? 'disabled' : '') . '">' . '<td>' . $startExecutionElement . '</td>' . '<td class="right">' . $schedulerRecord['uid'] . '</td>' . '<td>' . $this->makeStatusLabel($labels) . $taskName . $taskDesc . '</td>' . '<td>' . $execType . '</td>' . '<td>' . $frequency . '</td>' . '<td>' . $multiple . '</td>' . '<td>' . $lastExecution . '</td>' . '<td>' . $nextDate . '</td>' . '<td nowrap="nowrap"><div class="btn-group" role="group">' . $actions . '</div></td>' . '</tr>';
} else {
// The task object is not valid
// Prepare to issue an error
$executionStatusOutput = '<span class="label label-danger">' . htmlspecialchars(sprintf($this->getLanguageService()->getLL('msg.invalidTaskClass'), $class)) . '</span>';
$table[] = '<tr>' . '<td>' . $startExecutionElement . '</td>' . '<td class="right">' . $schedulerRecord['uid'] . '</td>' . '<td colspan="6">' . $executionStatusOutput . '</td>' . '<td nowrap="nowrap"><div class="btn-group" role="group">' . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . $deleteAction . '<span class="btn btn-default disabled">' . $this->moduleTemplate->getIconFactory()->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>' . '</div></td>' . '</tr>';
}
}
}
$this->getDatabaseConnection()->sql_free_result($res);
$this->view->assign('table', '<table class="table table-striped table-hover">' . implode(LF, $table) . '</table>');
// Server date time
$dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] . ' T (e';
$this->view->assign('now', date($dateFormat) . ', GMT ' . date('P') . ')');
}
return $this->view->render();
}
示例13: displayMultipleDiff
/**
* Displays a diff over multiple fields including rollback links
*
* @param array $diff Difference array
*/
public function displayMultipleDiff($diff)
{
// Get all array keys needed
$arrayKeys = array_merge(array_keys($diff['newData']), array_keys($diff['insertsDeletes']), array_keys($diff['oldData']));
$arrayKeys = array_unique($arrayKeys);
$languageService = $this->getLanguageService();
if ($arrayKeys) {
$lines = array();
foreach ($arrayKeys as $key) {
$singleLine = array();
$elParts = explode(':', $key);
// Turn around diff because it should be a "rollback preview"
if ((int) $diff['insertsDeletes'][$key] === 1) {
// insert
$singleLine['insertDelete'] = 'delete';
} elseif ((int) $diff['insertsDeletes'][$key] === -1) {
$singleLine['insertDelete'] = 'insert';
}
// Build up temporary diff array
// turn around diff because it should be a "rollback preview"
if ($diff['newData'][$key]) {
$tmpArr['newRecord'] = $diff['oldData'][$key];
$tmpArr['oldRecord'] = $diff['newData'][$key];
$singleLine['differences'] = $this->renderDiff($tmpArr, $elParts[0], $elParts[1]);
}
$elParts = explode(':', $key);
$singleLine['revertRecordLink'] = $this->createRollbackLink($key, $languageService->getLL('revertRecord', true), 1);
$singleLine['title'] = $this->generateTitle($elParts[0], $elParts[1]);
$lines[] = $singleLine;
}
$this->view->assign('revertAllLink', $this->createRollbackLink('ALL', $languageService->getLL('revertAll', true), 0));
$this->view->assign('multipleDiff', $lines);
}
}
示例14: assignContentObjectDataAndCurrent
/**
* Assign content object renderer data and current to view
*
* @param array $conf Configuration
* @return void
*/
protected function assignContentObjectDataAndCurrent(array $conf)
{
$this->view->assign('data', $this->cObj->data);
$this->view->assign('current', $this->cObj->data[$this->cObj->currentValKey]);
}
示例15: render
/**
* @param StandaloneView $view
* @param PageRenderer $pageRenderer
* @param LoginController $loginController
*/
public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController)
{
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:openid/Resources/Private/Templates/OpenidLogin.html'));
$view->assign('presetOpenId', GeneralUtility::_GP('openid_url'));
}