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


PHP Input::setGet方法代码示例

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


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

示例1: toggleVisibility

 /**
  * @param $intId
  * @param $blnVisible
  * @param DataContainer|null $dc
  */
 public function toggleVisibility($intId, $blnVisible, DataContainer $dc = null)
 {
     // Set the ID and action
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     if ($dc) {
         $dc->id = $intId;
         // see #8043
     }
     // Check the field access
     if (!$this->User->hasAccess('tl_api_client::disable', 'alexf')) {
         throw new AccessDeniedException('Not enough permissions to activate/deactivate member ID ' . $intId . '.');
     }
     $objVersions = new Versions('tl_api_client', $intId);
     $objVersions->initialize();
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA']['tl_api_client']['fields']['disable']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA']['tl_api_client']['fields']['disable']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     $time = time();
     // Update the database
     $this->Database->prepare("UPDATE tl_api_client SET tstamp={$time}, disable='" . ($blnVisible ? '' : 1) . "' WHERE id=?")->execute($intId);
     $objVersions->create();
     $this->log('A new version of record "tl_api_client.id=' . $intId . '" has been created' . $this->getParentEntries('tl_api_client', $intId), __METHOD__, TL_GENERAL);
 }
开发者ID:Craffft,项目名称:api-client-bundle,代码行数:37,代码来源:ApiClient.php

示例2: 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']['eventreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['events']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         \Input::setGet('events', \Input::get('auto_item'));
     }
     // Do not index or cache the page if no event has been specified
     if (!\Input::get('events')) {
         /** @var PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->cal_calendar = $this->sortOutProtected(\StringUtil::deserialize($this->cal_calendar));
     // Do not index or cache the page if there are no calendars
     if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) {
         /** @var PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
开发者ID:contao,项目名称:calendar-bundle,代码行数:40,代码来源:ModuleEventReader.php

示例3: generate

 /**
  *
  */
 public function generate()
 {
     // backend view
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . $this->name . ' ###';
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->import('FrontendUser', 'User');
     // set fe view id
     $this->feViewID = md5($this->id);
     // change template
     if (TL_MODE == 'FE' && $this->fm_addMap) {
         $this->strTemplate = 'mod_fmodule_map';
     }
     //auto_page Attribute
     if (!isset($_GET['item']) && Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         Input::setGet('item', Input::get('auto_item'));
     }
     return parent::generate();
 }
开发者ID:alnv,项目名称:fmodul,代码行数:25,代码来源:ModuleListView.php

示例4: paginationMenu

 /**
  * Return a pagination menu to browse results
  *
  * @return string
  */
 protected function paginationMenu()
 {
     /** @var AttributeBagInterface $objSessionBag */
     $objSessionBag = \System::getContainer()->get('session')->getBag('contao_backend');
     $session = $objSessionBag->all();
     $filter = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 4 ? $this->strTable . '_' . CURRENT_ID : $this->strTable;
     list($offset, $limit) = explode(',', $this->limit);
     // Set the limit filter based on the page number
     if (isset($_GET['lp'])) {
         $lp = intval(\Input::get('lp')) - 1;
         if ($lp >= 0 && $lp < ceil($this->total / $limit)) {
             $session['filter'][$filter]['limit'] = $lp * $limit . ',' . $limit;
             $objSessionBag->replace($session);
         }
         $this->redirect(preg_replace('/&(amp;)?lp=[^&]+/i', '', \Environment::get('request')));
     }
     if ($limit) {
         \Input::setGet('lp', $offset / $limit + 1);
     }
     $objPagination = new \Pagination($this->total, $limit, 7, 'lp', new \BackendTemplate('be_pagination'), true);
     return $objPagination->generate();
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:27,代码来源:DC_Table.php

示例5: compile


//.........这里部分代码省略.........
         // Do not index or cache the page if the page number is outside the range
         if ($page < 1 || $page > max(ceil($total / $this->perPage), 1)) {
             throw new PageNotFoundException('Page not found');
         }
         $offset = ($page - 1) * $this->perPage;
         $limit = min($this->perPage + $offset, $total);
         $objPagination = new \Pagination($total, $this->perPage, \Config::get('maxPaginationLinks'), $id);
         $this->Template->pagination = $objPagination->generate("\n  ");
     }
     $strMonth = '';
     $strDate = '';
     $strEvents = '';
     $dayCount = 0;
     $eventCount = 0;
     $headerCount = 0;
     $imgSize = false;
     // Override the default image size
     if ($this->imgSize != '') {
         $size = deserialize($this->imgSize);
         if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
             $imgSize = $this->imgSize;
         }
     }
     // Parse events
     for ($i = $offset; $i < $limit; $i++) {
         $event = $arrEvents[$i];
         $blnIsLastEvent = false;
         // Last event on the current day
         if ($i + 1 == $limit || !isset($arrEvents[$i + 1]['firstDate']) || $event['firstDate'] != $arrEvents[$i + 1]['firstDate']) {
             $blnIsLastEvent = true;
         }
         /** @var FrontendTemplate|object $objTemplate */
         $objTemplate = new \FrontendTemplate($this->cal_template);
         $objTemplate->setData($event);
         // Month header
         if ($strMonth != $event['month']) {
             $objTemplate->newMonth = true;
             $strMonth = $event['month'];
         }
         // Day header
         if ($strDate != $event['firstDate']) {
             $headerCount = 0;
             $objTemplate->header = true;
             $objTemplate->classHeader = ($dayCount % 2 == 0 ? ' even' : ' odd') . ($dayCount == 0 ? ' first' : '') . ($event['firstDate'] == $arrEvents[$limit - 1]['firstDate'] ? ' last' : '');
             $strDate = $event['firstDate'];
             ++$dayCount;
         }
         // Show the teaser text of redirect events (see #6315)
         if (is_bool($event['details'])) {
             $objTemplate->hasDetails = false;
         }
         // Add the template variables
         $objTemplate->classList = $event['class'] . ($headerCount % 2 == 0 ? ' even' : ' odd') . ($headerCount == 0 ? ' first' : '') . ($blnIsLastEvent ? ' last' : '') . ' cal_' . $event['parent'];
         $objTemplate->classUpcoming = $event['class'] . ($eventCount % 2 == 0 ? ' even' : ' odd') . ($eventCount == 0 ? ' first' : '') . ($offset + $eventCount + 1 >= $limit ? ' last' : '') . ' cal_' . $event['parent'];
         $objTemplate->readMore = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $event['title']));
         $objTemplate->more = $GLOBALS['TL_LANG']['MSC']['more'];
         $objTemplate->locationLabel = $GLOBALS['TL_LANG']['MSC']['location'];
         // Short view
         if ($this->cal_noSpan) {
             $objTemplate->day = $event['day'];
             $objTemplate->date = $event['date'];
         } else {
             $objTemplate->day = $event['firstDay'];
             $objTemplate->date = $event['firstDate'];
         }
         $objTemplate->addImage = false;
         // Add an image
         if ($event['addImage'] && $event['singleSRC'] != '') {
             $objModel = \FilesModel::findByUuid($event['singleSRC']);
             if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
                 if ($imgSize) {
                     $event['size'] = $imgSize;
                 }
                 $event['singleSRC'] = $objModel->path;
                 $this->addImageToTemplate($objTemplate, $event);
             }
         }
         $objTemplate->enclosure = array();
         // Add enclosure
         if ($event['addEnclosure']) {
             $this->addEnclosuresToTemplate($objTemplate, $event);
         }
         $strEvents .= $objTemplate->parse();
         ++$eventCount;
         ++$headerCount;
     }
     // No events found
     if ($strEvents == '') {
         $strEvents = "\n" . '<div class="empty">' . $strEmpty . '</div>' . "\n";
     }
     // See #3672
     $this->Template->headline = $this->headline;
     $this->Template->events = $strEvents;
     // Clear the $_GET array (see #2445)
     if ($blnClearInput) {
         \Input::setGet('year', null);
         \Input::setGet('month', null);
         \Input::setGet('day', null);
     }
 }
开发者ID:burguin,项目名称:test02,代码行数:101,代码来源:ModuleEventlist.php

示例6: toggleVisibility

 /**
  * @param $intId
  * @param $blnVisible
  * @param null $dc
  */
 public function toggleVisibility($intId, $blnVisible, $dc = null)
 {
     $table = Input::get('table');
     // Check permissions to edit
     Input::setGet('id', $intId);
     Input::setGet('act', 'toggle');
     // Trigger the save_callback
     if (is_array($GLOBALS['TL_DCA'][$table]['fields']['published']['save_callback'])) {
         foreach ($GLOBALS['TL_DCA'][$table]['fields']['published']['save_callback'] as $callback) {
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $blnVisible = $this->{$callback}[0]->{$callback}[1]($blnVisible, $dc ?: $this);
             } elseif (is_callable($callback)) {
                 $blnVisible = $callback($blnVisible, $dc ?: $this);
             }
         }
     }
     // Update the database
     $this->Database->prepare("UPDATE " . $table . " SET tstamp=" . time() . ", published='" . ($blnVisible ? '1' : '') . "' WHERE id=?")->execute($intId);
 }
开发者ID:alnv,项目名称:fmodul,代码行数:25,代码来源:DCAModuleData.php

示例7: getPageIdFromUrl

 /**
  * Split the current request into fragments, strip the URL suffix, recreate the $_GET array and return the page ID
  *
  * @return mixed
  */
 public static function getPageIdFromUrl()
 {
     $strRequest = \Environment::get('relativeRequest');
     if ($strRequest == '') {
         return null;
     }
     // Get the request without the query string
     list($strRequest) = explode('?', $strRequest, 2);
     // URL decode here (see #6232)
     $strRequest = rawurldecode($strRequest);
     // The request string must not contain "auto_item" (see #4012)
     if (strpos($strRequest, '/auto_item/') !== false) {
         return false;
     }
     // Remove the URL suffix if not just a language root (e.g. en/) is requested
     if ($strRequest != '' && (!\Config::get('addLanguageToUrl') || !preg_match('@^[a-z]{2}(-[A-Z]{2})?/$@', $strRequest))) {
         $intSuffixLength = strlen(\Config::get('urlSuffix'));
         // Return false if the URL suffix does not match (see #2864)
         if ($intSuffixLength > 0) {
             if (substr($strRequest, -$intSuffixLength) != \Config::get('urlSuffix')) {
                 return false;
             }
             $strRequest = substr($strRequest, 0, -$intSuffixLength);
         }
     }
     // Extract the language
     if (\Config::get('addLanguageToUrl')) {
         $arrMatches = array();
         // Use the matches instead of substr() (thanks to Mario Müller)
         if (preg_match('@^([a-z]{2}(-[A-Z]{2})?)/(.*)$@', $strRequest, $arrMatches)) {
             \Input::setGet('language', $arrMatches[1]);
             // Trigger the root page if only the language was given
             if ($arrMatches[3] == '') {
                 return null;
             }
             $strRequest = $arrMatches[3];
         } else {
             return false;
             // Language not provided
         }
     }
     $arrFragments = null;
     // Use folder-style URLs
     if (\Config::get('folderUrl') && strpos($strRequest, '/') !== false) {
         $strAlias = $strRequest;
         $arrOptions = array($strAlias);
         // Compile all possible aliases by applying dirname() to the request (e.g. news/archive/item, news/archive, news)
         while ($strAlias != '/' && strpos($strAlias, '/') !== false) {
             $strAlias = dirname($strAlias);
             $arrOptions[] = $strAlias;
         }
         // Check if there are pages with a matching alias
         $objPages = \PageModel::findByAliases($arrOptions);
         if ($objPages !== null) {
             $arrPages = array();
             // Order by domain and language
             while ($objPages->next()) {
                 /** @var PageModel $objModel */
                 $objModel = $objPages->current();
                 $objPage = $objModel->loadDetails();
                 $domain = $objPage->domain ?: '*';
                 $arrPages[$domain][$objPage->rootLanguage][] = $objPage;
                 // Also store the fallback language
                 if ($objPage->rootIsFallback) {
                     $arrPages[$domain]['*'][] = $objPage;
                 }
             }
             $strHost = \Environment::get('host');
             // Look for a root page whose domain name matches the host name
             if (isset($arrPages[$strHost])) {
                 $arrLangs = $arrPages[$strHost];
             } else {
                 $arrLangs = $arrPages['*'] ?: array();
                 // empty domain
             }
             $arrAliases = array();
             // Use the first result (see #4872)
             if (!\Config::get('addLanguageToUrl')) {
                 $arrAliases = current($arrLangs);
             } elseif (($lang = \Input::get('language')) != '' && isset($arrLangs[$lang])) {
                 $arrAliases = $arrLangs[$lang];
             }
             // Return if there are no matches
             if (empty($arrAliases)) {
                 return false;
             }
             $objPage = $arrAliases[0];
             // The request consists of the alias only
             if ($strRequest == $objPage->alias) {
                 $arrFragments = array($strRequest);
             } else {
                 $arrFragments = explode('/', substr($strRequest, strlen($objPage->alias) + 1));
                 array_unshift($arrFragments, $objPage->alias);
             }
         }
//.........这里部分代码省略.........
开发者ID:bytehead,项目名称:core-bundle,代码行数:101,代码来源:Frontend.php

示例8: getFilterFields

 /**
  * @param $q
  * @param $tablename
  * @return array
  */
 private function getFilterFields($q, $tablename)
 {
     $notSupportedTypes = array('legend_start', 'legend_end', 'fulltext_search', 'widget');
     $notSupportedID = array('orderBy', 'sorting_fields', 'sorting_fields', 'pagination');
     parse_str($q, $qRow);
     $qArr = array();
     foreach ($qRow as $k => $v) {
         $qArr[$k] = $v;
     }
     if (empty($qArr)) {
         return array();
     }
     $allFiltersDB = $this->Database->prepare('SELECT tl_fmodules.id AS moduleID, tl_fmodules.*, tl_fmodules_filters.*  FROM tl_fmodules LEFT JOIN tl_fmodules_filters ON tl_fmodules.id = tl_fmodules_filters.pid WHERE tablename = ? ORDER BY tl_fmodules_filters.sorting')->execute($tablename);
     $arrFilter = array();
     while ($allFiltersDB->next()) {
         $tname = $allFiltersDB->fieldID;
         if (in_array($tname, $notSupportedID) || in_array($allFiltersDB->type, $notSupportedTypes)) {
             continue;
         }
         if ($qArr[$tname] || $allFiltersDB->type == 'toggle_field') {
             $arrFilter[$tname] = $allFiltersDB->row();
             $arrFilter[$tname]['value'] = $qArr[$tname];
             $arrFilter[$tname]['enable'] = true;
             $arrFilter[$tname]['operator'] = $qArr[$tname . '_int'] ? $qArr[$tname . '_int'] : '';
         }
         if ($allFiltersDB->type == 'wrapper_field' && $allFiltersDB->from_field == $allFiltersDB->to_field) {
             $fname = $allFiltersDB->from_field . '_btw';
             Input::setGet($fname, $qArr[$fname]);
         }
         if ($allFiltersDB->type == 'toggle_field' && !$qArr[$tname]) {
             $arrFilter[$tname]['value'] = '';
         }
     }
     return $arrFilter;
 }
开发者ID:alnv,项目名称:fmodul,代码行数:40,代码来源:FModuleInsertTags.php

示例9: layoutAction

 /**
  *
  * @Route("/layout")
  */
 public function layoutAction()
 {
     $this->validateRequest();
     $objPage = PageModel::findOneByType('phpbb_forum');
     // Set the correct current page for navigation
     Environment::set('relativeRequest', $this->container->get('phpbb_bridge.connector')->getBridgeConfig('forum_pageId') . $GLOBALS['TL_CONFIG']['urlSuffix']);
     $response = $this->frontendIndex->run();
     if ($objPage instanceof PageModel) {
         $page = new Forum();
         Input::setGet('format', 'json');
         $response = $page->getResponse($objPage);
     }
     return $response;
 }
开发者ID:ctsmedia,项目名称:contao-phpbb-bridge-bundle,代码行数:18,代码来源:ConnectController.php


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