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


PHP BackendTemplate::parse方法代码示例

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


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

示例1: handle

 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $this->handleRunOnce();
     // PATCH
     if ($input->post('FORM_SUBMIT') == 'database-update') {
         $count = 0;
         $sql = deserialize($input->post('sql'));
         if (is_array($sql)) {
             foreach ($sql as $key) {
                 if (isset($_SESSION['sql_commands'][$key])) {
                     $this->Database->query(str_replace('DEFAULT CHARSET=utf8;', 'DEFAULT CHARSET=utf8 COLLATE ' . $GLOBALS['TL_CONFIG']['dbCollation'] . ';', $_SESSION['sql_commands'][$key]));
                     $count++;
                 }
             }
         }
         $_SESSION['sql_commands'] = array();
         Messages::addConfirmation(sprintf($GLOBALS['TL_LANG']['composer_client']['databaseUpdated'], $count));
         $this->reload();
     }
     /** @var \Contao\Database\Installer $installer */
     $installer = \System::importStatic('Database\\Installer');
     $form = $installer->generateSqlForm();
     if (empty($form)) {
         Messages::addInfo($GLOBALS['TL_LANG']['composer_client']['databaseUptodate']);
         $this->redirect('contao/main.php?do=composer');
     }
     $form = preg_replace('#(<label for="sql_\\d+")>(CREATE TABLE)#', '$1 class="create_table">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` ADD)#', '$1 class="alter_add">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` DROP)#', '$1 class="alter_drop">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(DROP TABLE)#', '$1 class="drop_table">$2', $form);
     $template = new \BackendTemplate('be_composer_client_update');
     $template->composer = $this->composer;
     $template->form = $form;
     return $template->parse();
 }
开发者ID:contao-community-alliance,项目名称:composer-client,代码行数:38,代码来源:UpdateDatabaseController.php

示例2: generate

 /**
  * @return string
  */
 public function generate()
 {
     if ($this->isVisible()) {
         return $this->template->parse();
     }
     return '';
 }
开发者ID:netzmacht,项目名称:contao-dcatools,代码行数:10,代码来源:View.php

示例3: generate

 /**
  * @return string
  */
 public function generate()
 {
     $this->configuration = AntragoConnector::getAntragoConfiguration($this->arrData['ac_configuration']);
     $this->categoryIds = deserialize($this->arrData['ac_categories']);
     $antragoCategories = json_decode(AntragoConnector::getContentFromApi($this->configuration['api_host'] . "/categories", $this->configuration['api_user'], $this->configuration['api_password']), true);
     foreach ($antragoCategories as $val) {
         $this->antragoCategories[$val['id']] = $val;
     }
     // wildcard backend
     if (TL_MODE === 'BE') {
         $template = new \BackendTemplate('be_wildcard');
         $template->wildcard = '### ANTRAGO EVENT-LISTE ###';
         $template->title = "Kategorien: " . implode(', ', deserialize($this->arrData['ac_categories']));
         return $template->parse();
     }
     // EventList Frontend
     // Data der vorhandenen Kategorien holen
     $arrCategoryData = array();
     // hole Kategorien
     foreach ($this->categoryIds as $key => $catId) {
         $arrCategoryData[$key] = array("categoryName" => $this->antragoCategories[$catId]['name'], "categoryId" => $this->antragoCategories[$catId]['id'], "eventData" => $this->getAntragoEventsById($catId));
     }
     $this->eventData = $arrCategoryData;
     return parent::generate();
 }
开发者ID:hoevelmanns,项目名称:antrago-products-connector,代码行数:28,代码来源:AntragoEventList.php

示例4: ldParseBackendTemplate

 public function ldParseBackendTemplate($strBuffer, $strTemplate)
 {
     if ($strTemplate == 'be_welcome') {
         $objTemplate = new \BackendTemplate('be_live_dashboard');
         // sample default widget
         $strContent = '
                 <div class="events">Text 1 <a href="#">Link 1</a></div>
                 <div class="events">Text 2 <a href="#">Link 2</a></div>
                 <div class="events">Text 3 <a href="#">Link 3</a></div>';
         $objWidgetTemplate = new \BackendTemplate('be_live_widget');
         $objWidgetTemplate->widgetTitle = 'Neuste Kommentare';
         $objWidgetTemplate->widgetContent = $strContent;
         $strWidget = $objWidgetTemplate->parse();
         $arrWidgets = array($strWidget);
         // HOOK: add dashboard widget
         if (isset($GLOBALS['TL_HOOKS']['addDashboardWidget']) && is_array($GLOBALS['TL_HOOKS']['addDashboardWidget'])) {
             foreach ($GLOBALS['TL_HOOKS']['addDashboardWidget'] as $callback) {
                 $this->import($callback[0]);
                 $strBuffer = $this->{$callback}[0]->{$callback}[1]($arrWidgets);
                 if ($strBuffer != '') {
                     $arrWidgets[] = $strBuffer;
                 }
             }
         }
         if (!empty($arrWidgets)) {
             $objTemplate->widgets = implode("\n", $arrWidgets);
         }
         return $objTemplate->parse();
     }
     return $strBuffer;
 }
开发者ID:contao3backendgroup,项目名称:live-dashboard,代码行数:31,代码来源:LiveDashboard.php

示例5: generate

 /**
  * Logout the current user and redirect
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### FRONTEND LOGOUT ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set last page visited
     if ($this->redirectBack) {
         $_SESSION['LAST_PAGE_VISITED'] = $this->getReferer();
     }
     $this->import('FrontendUser', 'User');
     $strRedirect = $this->Environment->base;
     // Redirect to last page visited
     if ($this->redirectBack && strlen($_SESSION['LAST_PAGE_VISITED'])) {
         $strRedirect = $_SESSION['LAST_PAGE_VISITED'];
     } elseif (strlen($this->jumpTo)) {
         $objNextPage = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=?")->limit(1)->execute($this->jumpTo);
         if ($objNextPage->numRows) {
             $strRedirect = $this->generateFrontendUrl($objNextPage->fetchAssoc());
         }
     }
     // Log out and redirect
     if ($this->User->logout()) {
         $this->redirect($strRedirect);
     }
     return '';
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:36,代码来源:ModuleLogout.php

示例6: run

 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_maintenance_mode');
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->headline = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceMode'];
     $objTemplate->isActive = $this->isActive();
     try {
         $driver = \System::getContainer()->get('lexik_maintenance.driver.factory')->getDriver();
         $isLocked = $driver->isExists();
     } catch (\Exception $e) {
         return '';
     }
     // Toggle the maintenance mode
     if (\Input::post('FORM_SUBMIT') == 'tl_maintenance_mode') {
         if ($isLocked) {
             $driver->unlock();
         } else {
             $driver->lock();
         }
         $this->reload();
     }
     if ($isLocked) {
         $objTemplate->class = 'tl_confirm';
         $objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceEnabled'];
         $objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceDisable'];
     } else {
         $objTemplate->class = 'tl_info';
         $objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceDisabled'];
         $objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceEnable'];
     }
     return $objTemplate->parse();
 }
开发者ID:contao,项目名称:core-bundle,代码行数:38,代码来源:Maintenance.php

示例7: generate

 /**
  * Display a wildcard in the back end
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newsreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Do not index or cache the page if no news item has been specified
     if (!\Input::get('items')) {
         /** @var \PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Do not index or cache the page if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         /** @var \PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:40,代码来源:ModuleNewsReader.php

示例8: generate

 /**
  * Do not display the module if there are no articles
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ARTICLE NAVIGATION ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     global $objPage;
     $this->objArticles = \ArticleModel::findPublishedWithTeaserByPidAndColumn($objPage->id, $this->strColumn);
     // Return if there are no articles
     if ($this->objArticles === null) {
         return '';
     }
     // Redirect to the first article if no article is selected
     if (!\Input::get('articles')) {
         if (!$this->loadFirst) {
             return '';
         }
         $strAlias = $this->objArticles->alias != '' && !$GLOBALS['TL_CONFIG']['disableAlias'] ? $this->objArticles->alias : $this->objArticles->id;
         $this->redirect($this->addToUrl('articles=' . $strAlias));
     }
     return parent::generate();
 }
开发者ID:rburch,项目名称:core,代码行数:31,代码来源:ModuleArticlenav.php

示例9: generate

 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newsreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     global $objPage;
     if ($this->news_template_modal) {
         $this->strTemplate = 'mod_news_modal';
         $this->news_template = $this->news_template_modal;
         // list config
         $this->news_showInModal = true;
         $this->news_readerModule = $this->id;
         // set modal css ID for generateModal() and parent::generate()
         $arrCss = deserialize($this->cssID, true);
         $arrCss[0] = NewsPlusHelper::getCSSModalID($this->id);
         $this->cssID = $arrCss;
         $this->base = \Controller::generateFrontendUrl($objPage->row());
         if ($this->Environment->isAjaxRequest && !$this->isSearchIndexer()) {
             $this->strTemplate = 'mod_news_modal_ajax';
             $this->generateAjax();
         }
         if (!$this->checkConditions()) {
             return $this->generateModal();
         }
     }
     return parent::generate();
 }
开发者ID:heimrichhannot,项目名称:contao-news_plus,代码行数:37,代码来源:ModuleNewsReaderPlus.php

示例10: addSystemMessages

 public function addSystemMessages()
 {
     $objUser = \BackendUser::getInstance();
     if ($GLOBALS['TL_CONFIG']['be_changelog_src'] == '') {
         return '';
     }
     $strFile = file_get_contents($GLOBALS['TL_CONFIG']['be_changelog_src']);
     if ($strFile == '') {
         return '';
     }
     $objJson = json_decode($strFile);
     $objTemplate = new \BackendTemplate('be_changelog');
     $objTemplate->strTitle = 'Changelog';
     $arrEntries = array();
     foreach ($objJson as $objEntry) {
         $objTemplateEntry = new \BackendTemplate('be_changelog_entry');
         $objTemplateEntry->strCssClass = $objUser->lastLogin > $objEntry->timestamp ? '' : ' tl_info';
         $objTemplateEntry->strDate = \Date::parse(\Config::get('datimFormat'), $objEntry->timestamp);
         $objTemplateEntry->strVersion = $objEntry->version;
         $objTemplateEntry->strEntries = '<li style="padding-bottom: 5px;">' . implode('</li><li style="padding-bottom: 5px;">', $objEntry->entries) . '</li>';
         $arrEntries[$objEntry->timestamp] = $objTemplateEntry->parse();
     }
     krsort($arrEntries);
     $objTemplate->strEntries = implode('', $arrEntries);
     return $objTemplate->parse();
 }
开发者ID:mindbird,项目名称:contao-be-changelog,代码行数:26,代码来源:BeChangelog.php

示例11: generate

 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### VISITORS LIST ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         if (version_compare(VERSION . '.' . BUILD, '2.8.9', '>')) {
             // Code für Versionen ab 2.9.0
             $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         } else {
             // Code für Versionen < 2.9.0
             $objTemplate->wildcard = '### VISITORS MODUL ONLY FOR CONTAO 2.9 ###';
         }
         return $objTemplate->parse();
     }
     //alte und neue Art gemeinsam zum Array bringen
     if (strpos($this->visitors_categories, ':') !== false) {
         $this->visitors_categories = deserialize($this->visitors_categories, true);
     } else {
         $this->visitors_categories = array($this->visitors_categories);
     }
     // Return if there are no categories
     if (!is_array($this->visitors_categories) || !is_numeric($this->visitors_categories[0])) {
         return '';
     }
     $this->useragent_filter = $this->visitors_useragent;
     return parent::generate();
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:34,代码来源:ModuleVisitors.php

示例12: generateWizardList

 /**
  * @param \Database_Result $records
  * @param string           $id
  * @param \DcaWizard       $dcaWizard
  *
  * @return string
  */
 public function generateWizardList($records, $id, $dcaWizard)
 {
     $return = '';
     $rows = $dcaWizard->getRows($records);
     // Alter the rows
     \System::loadLanguageFile('tl_iso_product_collection');
     $rows = array_map(function ($row) {
         // Force an algebraic sign for quantity
         $row['quantity'] = sprintf('%+d', $row['quantity']);
         // Make referenced product collection editable in a popup
         $row['product_collection_id'] = $row['product_collection_id'] ? sprintf('<a href="contao/main.php?do=iso_orders&amp;act=edit&amp;id=%1$u&amp;popup=1&amp;nb=1&amp;rt=%4$s" title="%3$s" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'%3$s\',\'url\':this.href});return false">%2$s</a>', $row['product_collection_id'], \Image::getHtml('edit.gif') . $row['product_collection_id'], sprintf($GLOBALS['TL_LANG']['tl_iso_product_collection']['edit'][1], $row['product_collection_id']), REQUEST_TOKEN) : '-';
         return $row;
     }, $rows);
     if ($rows) {
         $template = new \BackendTemplate('be_widget_dcawizard');
         $template->headerFields = $dcaWizard->getHeaderFields();
         $template->hasRows = !empty($rows);
         $template->rows = $rows;
         $template->fields = $dcaWizard->fields;
         $template->showOperations = $dcaWizard->showOperations;
         if ($dcaWizard->showOperations) {
             $template->operations = $dcaWizard->getActiveRowOperations();
         }
         $template->generateOperation = function ($operation, $row) use($dcaWizard) {
             return $dcaWizard->generateRowOperation($operation, $row);
         };
         $dom = new \DOMDocument('1.0', 'utf-8');
         $dom->loadHTML($template->parse());
         $return = $dom->saveHTML($dom->getElementsByTagName('table')->item(0));
     }
     // Add the member's total bonus points
     $return .= sprintf('<strong style="display: inline-block; margin: 4px 0 2px 6px; border-bottom: 3px double">%s</strong>', Stock::getStockForProduct($dcaWizard->currentRecord));
     return $return;
 }
开发者ID:richardhj,项目名称:contao-isotope_simple_stockmanagement,代码行数:41,代码来源:Dca.php

示例13: generate

 /**
  * Display a wildcard in the back end
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['listing'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Return if the table or the fields have not been set
     if ($this->list_table == '' || $this->list_fields == '') {
         return '';
     }
     // Disable the details page
     if (\Input::get('show') && $this->list_info == '') {
         return '';
     }
     // Fallback to the default template
     if ($this->list_layout == '') {
         $this->list_layout = 'list_default';
     }
     $this->strTemplate = $this->list_layout;
     $this->list_where = $this->replaceInsertTags($this->list_where, false);
     $this->list_info_where = $this->replaceInsertTags($this->list_info_where, false);
     return parent::generate();
 }
开发者ID:juergen83,项目名称:contao,代码行数:34,代码来源:ModuleListing.php

示例14: handle

 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $repositoryManager = $this->getRepositoryManager();
     /** @var RepositoryInterface $localRepository */
     $localRepository = $repositoryManager->getLocalRepository();
     $dependencyMap = $this->calculateDependencyMap($localRepository);
     $dependencyGraph = array();
     $localPackages = $localRepository->getPackages();
     $localPackages = array_filter($localPackages, function (PackageInterface $localPackage) use($dependencyMap) {
         $name = $localPackage->getName();
         return !isset($dependencyMap[$name]) && !$localPackage instanceof \Composer\Package\AliasPackage;
     });
     $allLocalPackages = $localRepository->getPackages();
     $allLocalPackages = array_combine(array_map(function (PackageInterface $localPackage) {
         return $localPackage->getName();
     }, $allLocalPackages), $allLocalPackages);
     $localPackagesCount = count($localPackages);
     $index = 0;
     /** @var \Composer\Package\PackageInterface $package */
     foreach ($localPackages as $package) {
         $this->buildDependencyGraph($allLocalPackages, $localRepository, $package, null, $package->getPrettyVersion(), $dependencyGraph, ++$index == $localPackagesCount);
     }
     $template = new \BackendTemplate('be_composer_client_dependency_graph');
     $template->composer = $this->composer;
     $template->dependencyGraph = $dependencyGraph;
     return $template->parse();
 }
开发者ID:tim-bec,项目名称:composer-client,代码行数:30,代码来源:DependencyGraphController.php

示例15: handle

 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $repositoryManager = $this->getRepositoryManager();
     // calculate replace map
     $replaceMap = $this->calculateReplaceMap($repositoryManager->getLocalRepository());
     // calculate contao-legacy replace map.
     $legacyReplaceMap = $this->calculateLegacyReplaceMap($repositoryManager->getLocalRepository());
     // build list of explicit required packages
     $requiresList = $this->buildRequiresList($this->composer->getPackage(), $replaceMap);
     // build list of dependencies
     $dependenciesList = $this->buildDependenciesList($requiresList, $repositoryManager->getLocalRepository());
     // build not yet installed package list
     $notInstalledList = $this->buildNotInstalledList($this->composer->getPackage(), $repositoryManager->getLocalRepository());
     // calculate dependency graph
     $dependencyMap = $this->calculateDependencyMap($repositoryManager->getLocalRepository());
     // build grouped list of packages
     $groupedPackages = $this->buildGroupedPackagesList($this->composer->getPackage(), $repositoryManager->getLocalRepository(), $requiresList, $dependencyMap, $notInstalledList);
     $template = new \BackendTemplate('be_composer_client');
     $template->composer = $this->composer;
     $template->dependencyMap = $dependencyMap;
     $template->replaceMap = $replaceMap;
     $template->legacyReplaceMap = $legacyReplaceMap;
     $template->groupedPackages = $groupedPackages;
     $template->requiresList = $requiresList;
     $template->dependenciesList = $dependenciesList;
     if ('detached' !== $GLOBALS['TL_CONFIG']['composerExecutionMode']) {
         $template->output = $_SESSION['COMPOSER_OUTPUT'];
     }
     unset($_SESSION['COMPOSER_OUTPUT']);
     return $template->parse();
 }
开发者ID:contao-community-alliance,项目名称:composer-client,代码行数:34,代码来源:InstalledController.php


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