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


PHP PageModel::getTable方法代码示例

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


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

示例1: languageLabels

 public function languageLabels($row, $label, $dc = null, $imageAttribute = '', $blnReturnImage = false, $blnProtected = false)
 {
     // generate the default label
     $objDcaClass = null;
     if (in_array('cacheicon', ModuleLoader::getActive())) {
         $objDcaClass = new tl_page_cacheicon();
     } elseif (in_array('Avisota', ModuleLoader::getActive())) {
         $objDcaClass = new tl_page_avisota();
     } else {
         $objDcaClass = new tl_page();
     }
     $label = $objDcaClass->addIcon($row, $label, $dc, $imageAttribute, $blnReturnImage, $blnProtected);
     // return the label for root or folder page
     if ($row['type'] == 'root' || $row['type'] == 'folder') {
         return $label;
     }
     // load the current page
     $objPage = PageModel::findWithDetails($row['id']);
     // prepare alternate pages
     $objAlternates = null;
     if ($objPage->languageMain) {
         // get all pages referencing the same fallback page
         $t = \PageModel::getTable();
         $objAlternates = PageModel::findBy(array("{$t}.languageMain = ? OR {$t}.id = ?"), array($objPage->languageMain, $objPage->languageMain));
     } else {
         // get all pages referencing the current page as its fallback
         $objAlternates = PageModel::findByLanguageMain($objPage->id);
     }
     // check if alternates were found
     if ($objAlternates !== null) {
         $label .= '<ul class="tl_page_language_alternates">';
         // go through each page and add link
         while ($objAlternates->next()) {
             if ($objAlternates->id == $objPage->id) {
                 continue;
             }
             $objAlternates->current()->loadDetails();
             $label .= '<li><a href="contao/main.php?do=page&amp;node=' . $objAlternates->id . '&amp;ref=' . TL_REFERER_ID . '">' . $objAlternates->language . '</a></li>';
         }
         $label .= '</ul>';
     }
     return $label;
 }
开发者ID:fritzmg,项目名称:contao-changelanguage-labels,代码行数:43,代码来源:tl_page.php

示例2: collectItems

 public function collectItems(CollectItemsEvent $event)
 {
     $item = $event->getParentItem();
     if ($item->getType() == 'page') {
         $table = \PageModel::getTable();
         $columns = array("{$table}.pid=?");
         if (!BE_USER_LOGGED_IN) {
             $time = time();
             $columns[] = "({$table}.start='' OR {$table}.start<{$time}) AND ({$table}.stop='' OR {$table}.stop>{$time}) AND {$table}.published=1";
         }
         $pages = \PageModel::findBy($columns, array($item->getExtra('id')), array('order' => 'sorting'));
         if ($pages) {
             $factory = $event->getFactory();
             foreach ($pages as $page) {
                 $factory->createItem('page', $page->id, $item);
             }
         }
     }
     if ($item->getType() == 'pages') {
         $ids = explode(',', $item->getName());
         $ids = array_filter($ids);
         $table = \PageModel::getTable();
         $columns = array('(' . implode(' OR ', array_fill(0, count($ids), "{$table}.id=?")) . ')');
         $sorting = "FIELD({$table}.id, " . implode(', ', array_fill(0, count($ids), "?")) . ")";
         if (!BE_USER_LOGGED_IN) {
             $time = time();
             $columns[] = "({$table}.start='' OR {$table}.start<{$time}) AND ({$table}.stop='' OR {$table}.stop>{$time}) AND {$table}.published=1";
         }
         $pages = \PageModel::findBy($columns, array_merge($ids, $ids), array('order' => $sorting));
         if ($pages) {
             $factory = $event->getFactory();
             foreach ($pages as $page) {
                 $factory->createItem('page', $page->id, $item);
             }
         }
     }
 }
开发者ID:bit3,项目名称:contao-xnavigation-page,代码行数:37,代码来源:PageProvider.php

示例3: addProductsToSearchIndex

 /**
  * Adds the product urls to the array so they get indexed when search index is rebuilt in the maintenance module
  *
  * @param array  $arrPages     Absolute page urls
  * @param int    $intRoot      Root page id
  * @param bool   $blnIsSitemap True if it's a sitemap module call (= treat differently when page is protected etc.)
  *
  * @return array   Extended array of absolute page urls
  */
 public function addProductsToSearchIndex($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $t = \PageModel::getTable();
     $time = \Date::floorToMinute();
     $arrValue = array();
     $arrColumn = array("{$t}.type='root'", "{$t}.published='1'", "({$t}.start='' OR {$t}.start<'{$time}')", "({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "')");
     if ($intRoot > 0) {
         $arrColumn[] = "{$t}.id=?";
         $arrValue[] = $intRoot;
     }
     $objRoots = \PageModel::findBy($arrColumn, $arrValue);
     if (null !== $objRoots) {
         foreach ($objRoots as $objRoot) {
             $arrPageIds = \Database::getInstance()->getChildRecords($objRoot->id, $t, false);
             $arrPageIds[] = $intRoot;
             $objProducts = Product::findPublishedByCategories($arrPageIds);
             if (null !== $objProducts) {
                 foreach ($objProducts as $objProduct) {
                     // Find the categories in the current root
                     $arrCategories = array_intersect($objProduct->getCategories(), $arrPageIds);
                     $intRemaining = count($arrCategories);
                     foreach ($arrCategories as $intPage) {
                         $objPage = \PageModel::findByPk($intPage);
                         --$intRemaining;
                         // The target page does not exist
                         if ($objPage === null) {
                             continue;
                         }
                         // The target page has not been published
                         if (!$objPage->published || $objPage->start != '' && $objPage->start > $time || $objPage->stop != '' && $objPage->stop < $time + 60) {
                             continue;
                         }
                         // The target page is exempt from the sitemap
                         if ($blnIsSitemap && $objPage->sitemap == 'map_never') {
                             continue;
                         }
                         // Do not generate a reader for the index page, except if it is the only one
                         if ($intRemaining > 0 && $objPage->alias == 'index') {
                             continue;
                         }
                         // Generate the domain
                         $strDomain = $objRoot->useSSL ? 'https://' : 'http://';
                         $strDomain .= ($objRoot->dns ?: \Environment::get('host')) . TL_PATH . '/';
                         // Pass root language to page object
                         $objPage->language = $objRoot->language;
                         $arrPages[] = $strDomain . $objProduct->generateUrl($objPage);
                         // Only take the first category because this is our primary one
                         // Having multiple reader pages in the sitemap XML would mean duplicate content
                         break;
                     }
                 }
             }
         }
     }
     return array_unique($arrPages);
 }
开发者ID:bytehead,项目名称:core,代码行数:65,代码来源:Frontend.php

示例4: getDomains

 /**
  * Retreives all available domains in this installation (plus empty selection)
  *
  * @return array
  */
 public function getDomains()
 {
     // options array
     $options = array('' => $GLOBALS['TL_LANG']['tl_short_urls']['noDomain']);
     // get the root pages and their dns settings
     if (version_compare(VERSION, '3.5', '>=')) {
         if (($objPages = \PageModel::findPublishedRootPages()) !== null) {
             while ($objPages->next()) {
                 if ($objPages->dns) {
                     $options[$objPages->id] = $objPages->dns;
                 }
             }
         }
     } else {
         $t = \PageModel::getTable();
         $arrColumns = array("{$t}.type=?");
         if (!BE_USER_LOGGED_IN) {
             $time = time();
             $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'";
         }
         $objPages = \PageModel::findBy($arrColumns, 'root');
         if ($objPages !== null) {
             while ($objPages->next()) {
                 if ($objPages->dns) {
                     $options[$objPages->id] = $objPages->dns;
                 }
             }
         }
     }
     // return the options
     return $options;
 }
开发者ID:fritzmg,项目名称:contao-short-urls,代码行数:37,代码来源:tl_short_urls.php

示例5: findCategories

 /**
  * The ids of all pages we take care of. This is what should later be used eg. for filter data.
  *
  * @return array
  */
 protected function findCategories()
 {
     if (null === $this->arrCategories) {
         if ($this->defineRoot && $this->rootPage > 0) {
             $objPage = \PageModel::findWithDetails($this->rootPage);
         } else {
             global $objPage;
         }
         $t = \PageModel::getTable();
         $arrCategories = null;
         $arrUnpublished = array();
         $strWhere = "{$t}.type!='error_403' AND {$t}.type!='error_404'";
         if (!BE_USER_LOGGED_IN) {
             $time = time();
             $objUnpublished = \PageModel::findBy(array("({$t}.start!='' AND {$t}.start>{$time}) OR ({$t}.stop!='' AND {$t}.stop<{$time}) OR {$t}.published=?"), array(''));
             $arrUnpublished = $objUnpublished->fetchEach('id');
             //$strWhere .= " AND ($t.start='' OR $t.start<$time) AND ($t.stop='' OR $t.stop>$time) AND $t.published='1'";
         }
         switch ($this->iso_category_scope) {
             case 'global':
                 $arrCategories = array($objPage->rootId);
                 $arrCategories = \Database::getInstance()->getChildRecords($objPage->rootId, 'tl_page', false, $arrCategories, $strWhere);
                 $arrCategories = array_diff($arrCategories, $arrUnpublished);
                 break;
             case 'current_and_first_child':
                 $arrCategories = \Database::getInstance()->execute("SELECT id FROM tl_page WHERE pid={$objPage->id} AND {$strWhere}")->fetchEach('id');
                 $arrCategories[] = $objPage->id;
                 break;
             case 'current_and_all_children':
                 $arrCategories = array($objPage->id);
                 $arrCategories = \Database::getInstance()->getChildRecords($objPage->id, 'tl_page', false, $arrCategories, $strWhere);
                 $arrCategories = array_diff($arrCategories, $arrUnpublished);
                 break;
             case 'parent':
                 $arrCategories = array($objPage->pid);
                 break;
             case 'product':
                 /** @var \Isotope\Model\Product\Standard $objProduct */
                 $objProduct = Product_Model::findAvailableByIdOrAlias(\Haste\Input\Input::getAutoItem('product'));
                 if ($objProduct !== null) {
                     $arrCategories = $objProduct->getCategories(true);
                 } else {
                     $arrCategories = array(0);
                 }
                 break;
             case 'article':
                 $arrCategories = array($GLOBALS['ISO_CONFIG']['current_article']['pid'] ?: $objPage->id);
                 break;
             case '':
             case 'current_category':
                 $arrCategories = array($objPage->id);
                 break;
             default:
                 if (isset($GLOBALS['ISO_HOOKS']['findCategories']) && is_array($GLOBALS['ISO_HOOKS']['findCategories'])) {
                     foreach ($GLOBALS['ISO_HOOKS']['findCategories'] as $callback) {
                         $objCallback = \System::importStatic($callback[0]);
                         $arrCategories = $objCallback->{$callback}[1]($this);
                         if ($arrCategories !== false) {
                             break;
                         }
                     }
                 }
                 break;
         }
         $this->arrCategories = empty($arrCategories) ? array(0) : $arrCategories;
     }
     return $this->arrCategories;
 }
开发者ID:rhymedigital,项目名称:isotope_direct,代码行数:73,代码来源:ProductList.php

示例6: addCanonicalProductUrls

 /**
  * Adds canonical product URLs to the document
  * @param   IsotopeProduct
  */
 protected function addCanonicalProductUrls(IsotopeProduct $objProduct)
 {
     global $objPage;
     $arrPageIds = \Database::getInstance()->getChildRecords($objPage->rootId, \PageModel::getTable());
     $arrPageIds[] = $objPage->rootId;
     // Find the categories in the current root
     $arrCategories = array_intersect($objProduct->getCategories(), $arrPageIds);
     foreach ($arrCategories as $intPage) {
         // Do not use the index page as canonical link
         if ($objPage->alias == 'index' && count($arrCategories) > 1) {
             continue;
         }
         // Current page is the primary one, do not generate canonical link
         if ($intPage == $objPage->id) {
             break;
         }
         if (($objJumpTo = \PageModel::findWithDetails($intPage)) !== null) {
             $strDomain = \Environment::get('base');
             // Overwrite the domain
             if ($objJumpTo->dns != '') {
                 $strDomain = ($objJumpTo->useSSL ? 'https://' : 'http://') . $objJumpTo->dns . TL_PATH . '/';
             }
             $GLOBALS['TL_HEAD'][] = sprintf('<link rel="canonical" href="%s">', $strDomain . $objProduct->generateUrl($objJumpTo));
             break;
         }
     }
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:31,代码来源:ProductReader.php


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