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


PHP ContentModel::findBy方法代码示例

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


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

示例1: findRelatedElements

 /**
  * Find related elements of a start element
  *
  * @param Model $model
  * @param null $type
  *
  * @return Collection
  */
 public static function findRelatedElements(Model $model, $type = null)
 {
     if ($model->bootstrap_parentId == '' && $model->getType() != $model::TYPE_START) {
         return null;
     }
     $options = array('order' => 'sorting');
     if ($type === null) {
         $column = 'bootstrap_parentId';
         $values[] = $model->id;
     } else {
         $column = array('bootstrap_parentId=? ', 'type=?');
         $values[] = $model->id;
         $values[] = $model->getTypeName($type);
     }
     return \ContentModel::findBy($column, $values, $options);
 }
开发者ID:netzmacht,项目名称:contao-bootstrap,代码行数:24,代码来源:Repository.php

示例2: getContentSliderCarousels

 public function getContentSliderCarousels(DataContainer $dc)
 {
     $arrOptions = array();
     $objSlider = \ContentModel::findBy('type', 'slick-content-start');
     if ($objSlider === null) {
         return $arrOptions;
     }
     while ($objSlider->next()) {
         $objArticle = \ArticleModel::findByPk($objSlider->pid);
         if ($objArticle === null) {
             continue;
         }
         $arrOptions[$objSlider->id] = sprintf($GLOBALS['TL_LANG']['tl_content']['contentSliderCarouselSelectOption'], $objArticle->title, $objArticle->id, $objSlider->id);
     }
     return $arrOptions;
 }
开发者ID:heimrichhannot,项目名称:contao-slick,代码行数:16,代码来源:tl_content.php

示例3: generate

 /**
  * Parse the template
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         // create new backend template
         $objTemplate = new \BackendTemplate('be_include');
         // get all include elements
         $objElements = \ContentModel::findBy('module', $this->module, array('order' => 'id'));
         // prepare include breadcrumbs
         $includes = array();
         // go throuch each include element
         while ($objElements->next()) {
             // get the parent article
             $objArticle = \ArticleModel::findByPk($objElements->pid);
             if ($objArticle === null) {
                 continue;
             }
             // get the parent pages
             $objPages = \PageModel::findParentsById($objArticle->pid);
             if ($objPages === null) {
                 continue;
             }
             // get the page titles
             $arrPageTitles = array_reverse($objPages->fetchEach('title'));
             // css classes for list
             $classes = array();
             if ($objElements->id == $this->id) {
                 $classes[] = 'self';
             }
             if ($objElements->invisible) {
                 $classes[] = 'hidden';
             }
             // create breadcrumb
             $includes[] = array('crumbs' => implode(' » ', $arrPageTitles), 'article' => array('title' => $objArticle->title, 'link' => 'contao/main.php?do=article&table=tl_content&id=' . $objArticle->id . '&rt=' . REQUEST_TOKEN), 'class' => implode(' ', $classes));
         }
         // set include breadcrumbs
         if (count($includes) > 1) {
             $objTemplate->includes = $includes;
         }
         // add CSS
         $GLOBALS['TL_CSS'][] = \IncludeInfoHelper::BACKEND_CSS;
         // return info + content
         return $objTemplate->parse() . parent::generate();
     }
     // return content only
     return parent::generate();
 }
开发者ID:fritzmg,项目名称:contao-be-include-info,代码行数:50,代码来源:ContentModuleExtended.php

示例4: getIncludes

 public static function getIncludes($where, $includeId, $selfId = null)
 {
     // get all include elements
     $objElements = \ContentModel::findBy($where, $includeId, array('order' => 'id'));
     // check for result
     if ($objElements === null) {
         return array();
     }
     // prepare include breadcrumbs
     $includes = array();
     // go throuch each include element
     while ($objElements->next()) {
         // get the parent article
         $objArticle = \ArticleModel::findByPk($objElements->pid);
         if ($objArticle === null) {
             continue;
         }
         // get the parent pages
         $objPages = \PageModel::findParentsById($objArticle->pid);
         if ($objPages === null) {
             continue;
         }
         // get the page titles
         $arrPageTitles = array_reverse($objPages->fetchEach('title'));
         // css classes for list
         $classes = array();
         if ($objElements->id == $selfId) {
             $classes[] = 'self';
         }
         if ($objElements->invisible) {
             $classes[] = 'hidden';
         }
         // create breadcrumb
         $includes[] = array('crumbs' => implode(' » ', $arrPageTitles), 'article' => array('title' => $objArticle->title, 'link' => 'contao/main.php?do=article&table=tl_content&id=' . $objArticle->id . '&rt=' . REQUEST_TOKEN), 'class' => implode(' ', $classes));
     }
     // return the include elements
     return $includes;
 }
开发者ID:fritzmg,项目名称:contao-be-include-info,代码行数:38,代码来源:IncludeInfoHelper.php

示例5: updateAlbums

 /**
  * Update the Facebook albums
  */
 public function updateAlbums()
 {
     $contentModels = \ContentModel::findBy('type', 'facebook_album');
     if ($contentModels === null) {
         return;
     }
     $count = 0;
     /** @var \ContentModel $contentModel */
     foreach ($contentModels as $contentModel) {
         $accountModel = AccountModel::findByPk($contentModel->accountModel);
         if ($accountModel === null) {
             continue;
         }
         $facebookAlbum = new FacebookAlbum($accountModel);
         $facebookAlbum->setAlbumId($contentModel->facebook_album);
         if ($facebookAlbum->isOutdated()) {
             $facebookAlbum->fetchImages();
             $count++;
         }
     }
     if ($count > 0) {
         \System::log(sprintf('Facebook albums: %s have been updated', $count), __METHOD__, TL_CRON);
     }
 }
开发者ID:terminal42,项目名称:contao-facebook-albums,代码行数:27,代码来源:Automator.php

示例6: generateUrl

 public function generateUrl($arrPages)
 {
     $arrPages = array();
     $News = \NewsModel::findAll();
     if (empty($News)) {
         return array();
     }
     $arrNews = array();
     while ($News->next()) {
         if (!empty($News)) {
             $arrNews[$News->pid][] = $this->generateNewsUrl($News);
         }
     }
     $InactiveArchives = \GlossarNewsArchiveModel::findByPidsAndInactiveGlossar(array_keys($arrNews));
     if (!empty($InactiveArchives)) {
         while ($InactiveArchives->next()) {
             unset($arrNews[$InactiveArchives->id]);
         }
     }
     if (empty($arrNews)) {
         return array();
     }
     $NewsReader = \ModuleModel::findByType('newsreader');
     if (empty($NewsReader)) {
         return array();
     }
     $arrReader = array();
     while ($NewsReader->next()) {
         $arrReader[$NewsReader->id] = deserialize($NewsReader->news_archives);
     }
     $Content = \ContentModel::findBy(array("module IN ('" . implode("','", array_keys($arrReader)) . "')"), array());
     if (empty($Content)) {
         return array();
     }
     $arrContent = array();
     while ($Content->next()) {
         $arrContent[$Content->module] = $Content->pid;
     }
     $Article = \ArticleModel::findBy(array("tl_article.id IN ('" . implode("','", $arrContent) . "')"), array());
     if (empty($Article)) {
         return array();
     }
     $finishedIDs = $arrPages = array();
     while ($Article->next()) {
         // $root = $this->getRootPage($Article->pid);
         $domain = \Environment::get('base');
         $strLanguage = 'de';
         $objPages = $Article->getRelated('pid');
         $ReaderId = false;
         foreach ($arrContent as $module => $mid) {
             if ($mid == $Article->id) {
                 $ReaderId = $module;
             }
         }
         foreach ($arrReader[$ReaderId] as $news_id) {
             if (in_array($news_id, $finishedIDs)) {
                 continue;
             }
             if (!empty($arrNews[$news_id])) {
                 foreach ($arrNews[$news_id] as $news_domain) {
                     $news_domain = str_replace('.html', '', $news_domain);
                     $arrPages['de'][] = $domain . static::generateFrontendUrl($objPages->row(), substr($news_domain, strpos($news_domain, '/')), $strLanguage);
                 }
             }
             $finishedIDs[] = $news_id;
         }
     }
     return $arrPages;
 }
开发者ID:kbits,项目名称:SWGlossar,代码行数:69,代码来源:GlossarNews.php

示例7: hasContentElements

 public static function hasContentElements($intId)
 {
     return \ContentModel::findBy(array('ptable=? AND pid=?'), array('tl_news', $intId)) !== null;
 }
开发者ID:heimrichhannot,项目名称:contao-calendar_plus,代码行数:4,代码来源:CalendarPlusEventsModel.php

示例8: generateUrl

 public function generateUrl($arrPages)
 {
     $arrPages = array();
     $Event = \CalendarEventsModel::findAll();
     if (empty($Event)) {
         return array();
     }
     $arrEvent = array();
     while ($Event->next()) {
         $objCalendar = \CalendarModel::findByPk($Event->pid);
         if ($objCalendar !== null && $objCalendar->jumpTo && ($objTarget = $objCalendar->getRelated('jumpTo')) !== null) {
             $arrEvent[$Event->pid][] = $this->generateEventUrl($Event, $this->generateFrontendUrl($objTarget->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/events/%s'));
         }
     }
     $InactiveArchives = \GlossarCalendarModel::findByPidsAndInactiveGlossar(array_keys($arrEvent));
     if (!empty($InactiveArchives)) {
         while ($InactiveArchives->next()) {
             unset($arrEvent[$InactiveArchives->id]);
         }
     }
     if (empty($arrEvent)) {
         return array();
     }
     $EventReader = \ModuleModel::findByType('eventreader');
     if (empty($EventReader)) {
         return array();
     }
     $arrReader = array();
     while ($EventReader->next()) {
         $arrReader[$EventReader->id] = deserialize($EventReader->cal_calendar);
     }
     $Content = \ContentModel::findBy(array("module IN ('" . implode("','", array_keys($arrReader)) . "')"), array());
     if (empty($Content)) {
         return array();
     }
     $arrContent = array();
     while ($Content->next()) {
         $arrContent[$Content->module] = $Content->pid;
     }
     $Article = \ArticleModel::findBy(array("tl_article.id IN ('" . implode("','", $arrContent) . "')"), array());
     if (empty($Article)) {
         return array();
     }
     $finishedIDs = $arrPages = array();
     while ($Article->next()) {
         // $root = $this->getRootPage($Article->pid);
         $domain = \Environment::get('base');
         $strLanguage = 'de';
         $objPages = $Article->getRelated('pid');
         $ReaderId = false;
         foreach ($arrContent as $module => $mid) {
             if ($mid == $Article->id) {
                 $ReaderId = $module;
             }
         }
         foreach ($arrReader[$ReaderId] as $event_id) {
             if (in_array($event_id, $finishedIDs)) {
                 continue;
             }
             if (!empty($arrEvent[$event_id])) {
                 foreach ($arrEvent[$event_id] as $event_domain) {
                     $event_domain = str_replace('.html', '', $event_domain);
                     $arrPages['de'][] = $domain . static::generateFrontendUrl($objPages->row(), substr($event_domain, strpos($event_domain, '/')), $strLanguage);
                 }
             }
             $finishedIDs[] = $event_id;
         }
     }
     return $arrPages;
 }
开发者ID:kbits,项目名称:SWGlossar,代码行数:70,代码来源:GlossarEvents.php

示例9: getTabControlTabs

 public static function getTabControlTabs()
 {
     $arrOptions = array();
     if (($objContentElements = \ContentModel::findBy(array('tl_content.type = ?', 'tabType = ?'), array('tabcontrol', 'tabcontroltab'))) !== null) {
         while ($objContentElements->next()) {
             $arrTabs = deserialize($objContentElements->tab_tabs, true);
             $arrOptions[$objContentElements->id] = 'ID ' . $objContentElements->id . (count($arrTabs) > 0 ? ': ' . implode(', ', array_map(function ($arrTab) {
                 return $arrTab['tab_tabs_name'];
             }, $arrTabs)) : '');
         }
     }
     return $arrOptions;
 }
开发者ID:heimrichhannot,项目名称:contao-bootstrapper,代码行数:13,代码来源:tl_content.php

示例10: templates

 public function templates($obj)
 {
     $template = $obj->getName();
     switch ($template) {
         case 'fe_page':
         case 'fe_page_multitoggle':
             //custom
             $obj->setName($template . '_gc');
             //gc = grid controll only
             $obj->__get("layout")->__set("gridCSS", (array) $this->getGridArr($obj->layout));
             break;
         case 'form':
             $obj->setName($template . '_' . \Config::get('co_grid_prefix'));
             break;
         default:
     }
     // `-,-´ ContentElements
     if ($obj->__get('typePrefix') == 'ce_' && strpos($template, 'ce_row_start') === FALSE) {
         $strClass = $this->findContentElement($obj->__get('type'));
         if ($strClass !== NULL && $strClass != '') {
             $objModel = \ContentModel::findBy('id', $obj->__get('id'));
             if ($objModel !== NULL) {
                 $objEl = new $strClass($objModel);
                 $objEl = $this->design_elements($objEl);
                 $obj->__set('ftc_classes', $objEl->ftc_classes);
                 $obj->__set('ftcID', $objEl->ftcID);
                 $obj->__set('data_attr', $this->splitArr($objEl->data_attr));
                 $obj->__set('class', $objEl->ftc_classes);
                 $obj->__set('cssID', $objEl->ftcID);
             }
         }
     }
     if (strpos($template, 'ce_row_start') !== FALSE) {
         $obj->__set('row_data_attr_ftc', $this->splitArr($obj->row_data_attr_ftc));
     }
     // `-,-´ Article
     if (strpos($template, 'mod_article') !== FALSE) {
         $objModel = \ArticleModel::findBy('id', $obj->__get('id'));
         if ($objModel !== NULL) {
             $objEl = new \ModuleArticle($objModel);
             $objEl = $this->design_articles($objEl);
             $obj->__set('class', '' . $objEl->ftc_classes);
             $obj->__set('cssID', $objEl->ftcID . ' ');
             //.$objEl->data_attr.' '
         }
     }
     // `-,-´ Module
     if ($obj->__get('typePrefix') == 'mod_') {
         $strClass = \Module::findClass($obj->__get('type'));
         if ($strClass !== NULL && $strClass != '') {
             $objModel = \ModuleModel::findBy('id', $obj->__get('id'));
             if ($objModel !== NULL) {
                 $objEl = new $strClass($objModel);
                 $co_grid = $this->design_modules($objEl);
                 $obj->__set('class', $co_grid['class'] . ' ' . $co_grid['co_grid_classes']);
                 // $obj->__set('cssID',$co_grid['ftcID'].' '.$co_grid['data_attr'].' ');
                 $obj->__set('ftc_classes', $co_grid['class'] . ' ' . $co_grid['co_grid_classes']);
                 $obj->__set('ftcID', $co_grid['ftcID'] . ' ');
                 $obj->__set('ftc_data_attr', $co_grid['data_attr']);
             }
         }
     }
 }
开发者ID:designs2,项目名称:codeowl_grid_control,代码行数:63,代码来源:OutputGridVars.php

示例11: run

 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     $objTemplate = new \BackendTemplate('be_rsce_convert');
     $objTemplate->isActive = $this->isActive();
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->indexHeadline = $GLOBALS['TL_LANG']['tl_maintenance']['searchIndex'];
     // Rebuild the index
     if (\Input::get('act') === 'rsce_convert') {
         // Check the request token
         if (!isset($_GET['rt']) || !\RequestToken::validate(\Input::get('rt'))) {
             $this->Session->set('INVALID_TOKEN_URL', \Environment::get('request'));
             $this->redirect('contao/confirm.php');
         }
         $this->import('Database');
         $failedElements = array();
         $elementsCount = 0;
         $contentElements = \ContentModel::findBy(array(\ContentModel::getTable() . '.type LIKE ?'), 'rsce_%');
         while ($contentElements && $contentElements->next()) {
             $html = $this->getHtmlFromElement($contentElements);
             if (!$html) {
                 $failedElements[] = array('content', $contentElements->id, $contentElements->type);
             } else {
                 $this->createInitialVersion(\ContentModel::getTable(), $contentElements->id);
                 $this->Database->prepare('UPDATE ' . \ContentModel::getTable() . ' SET tstamp = ?, type = \'html\', html = ? WHERE id = ?')->executeUncached(time(), $html, $contentElements->id);
                 $elementsCount++;
                 $this->createNewVersion(\ContentModel::getTable(), $contentElements->id);
                 $this->log('A new version of record "' . \ContentModel::getTable() . '.id=' . $contentElements->id . '" has been created', __METHOD__, TL_GENERAL);
             }
         }
         $moduleElements = \ModuleModel::findBy(array(\ModuleModel::getTable() . '.type LIKE ?'), 'rsce_%');
         while ($moduleElements && $moduleElements->next()) {
             $html = $this->getHtmlFromElement($moduleElements);
             if (!$html) {
                 $failedElements[] = array('module', $moduleElements->id, $moduleElements->type);
             } else {
                 $this->createInitialVersion(\ModuleModel::getTable(), $moduleElements->id);
                 $this->Database->prepare('UPDATE ' . \ModuleModel::getTable() . ' SET tstamp = ?, type = \'html\', html = ? WHERE id = ?')->executeUncached(time(), $html, $moduleElements->id);
                 $elementsCount++;
                 $this->createNewVersion(\ModuleModel::getTable(), $moduleElements->id);
                 $this->log('A new version of record "' . \ModuleModel::getTable() . '.id=' . $moduleElements->id . '" has been created', __METHOD__, TL_GENERAL);
             }
         }
         $formElements = \FormFieldModel::findBy(array(\FormFieldModel::getTable() . '.type LIKE ?'), 'rsce_%');
         while ($formElements && $formElements->next()) {
             $html = $this->getHtmlFromElement($formElements);
             if (!$html) {
                 $failedElements[] = array('form', $formElements->id, $formElements->type);
             } else {
                 $this->createInitialVersion(\FormFieldModel::getTable(), $formElements->id);
                 $this->Database->prepare('UPDATE ' . \FormFieldModel::getTable() . ' SET tstamp = ?, type = \'html\', html = ? WHERE id = ?')->executeUncached(time(), $html, $formElements->id);
                 $elementsCount++;
                 $this->createNewVersion(\FormFieldModel::getTable(), $formElements->id);
                 $this->log('A new version of record "' . \FormFieldModel::getTable() . '.id=' . $formElements->id . '" has been created', __METHOD__, TL_GENERAL);
             }
         }
         foreach ($failedElements as $element) {
             $this->log('Failed to convert ' . $element[0] . ' element ID ' . $element[1] . ' (' . $element[2] . ') to a standard HTML element', __METHOD__, TL_ERROR);
         }
         $this->log('Converted ' . $elementsCount . ' RockSolid Custom Elements to standard HTML elements', __METHOD__, TL_GENERAL);
         $objTemplate->elementsCount = $elementsCount;
         $objTemplate->failedElements = $failedElements;
     }
     $this->loadLanguageFile('rocksolid_custom_elements');
     return $objTemplate->parse();
 }
开发者ID:madeyourday,项目名称:contao-rocksolid-custom-elements,代码行数:70,代码来源:CustomElementsConvert.php

示例12: findChildren

 /**
  * {@inheritDoc}
  */
 public function findChildren($nodeId)
 {
     $elements = \ContentModel::findBy(array('pid=?', 'ptable=?'), array($nodeId, 'tl_content_node'), array('order' => 'sorting'));
     if ($elements) {
         return $elements;
     }
     return array();
 }
开发者ID:netzmacht,项目名称:contao-content-node,代码行数:11,代码来源:BaseNode.php

示例13: getParents

 /**
  * Get parents for a specific item.
  *
  * @param \DataContainer $dataContainer The data container driver.
  *
  * @return array
  */
 public function getParents($dataContainer)
 {
     if ($dataContainer->id) {
         $row = \ContentModel::findByPk($dataContainer->id);
         if (!$row) {
             return array();
         }
         $helper = Helper::create($row);
         $start = Bootstrap::getConfigVar('wrappers.' . $helper->getGroup() . '.start.name');
         if ($start) {
             $table = \ContentModel::getTable();
             $result = \ContentModel::findBy(array($table . '.pid=?', $table . '.type=?', $table . '.sorting<?'), array($row->pid, $start, $row->sorting), array('order' => $table . '.sorting DESC'));
             if ($result) {
                 $values = array();
                 foreach ($result as $model) {
                     $headline = deserialize($model->headline, true);
                     $values[$model->id] = $headline['value'] ?: $model->type . ' ID: ' . $model->id;
                 }
                 return $values;
             }
         }
         return array();
     }
 }
开发者ID:contao-bootstrap,项目名称:core,代码行数:31,代码来源:Wrapper.php

示例14: checkIfIsLastElement

 protected function checkIfIsLastElement($objRow)
 {
     $objElements = \ContentModel::findBy(array("invisible=?", "pid=?"), array("", $objRow->pid));
     if ($objElements) {
         $checkElement = false;
         $counter = 1;
         $max = $objElements->count();
         $columns = (int) $objRow->simple_columns;
         $currColumns = (int) $GLOBALS['DPS']['COLUMNS']['COUNT'] || 0;
         if (preg_match('/-/', $columns)) {
             $arrColumnParts = explode("-", $columns);
             $intColumnOffset = (int) ((int) $arrColumnParts[1] - 1);
             $columns = (int) $arrColumnParts[0];
             $GLOBALS['DPS']['COLUMNS']['COUNT'] = $GLOBALS['DPS']['COLUMNS']['COUNT'] + (int) $intColumnOffset;
             $currColumns = (int) $GLOBALS['DPS']['COLUMNS']['COUNT'];
         }
         $currColumns = intval($currColumns);
         while ($objElements->next()) {
             //				if( $checkElement )
             //				{
             //					$currColumns++;
             //
             //					break;
             //				}
             if ($objElements->id == $objRow->id) {
                 if ($counter == $max || $columns == $currColumns) {
                     //						echo "<pre>";
                     //						print_r( $counter);
                     //						echo " == ";
                     //						print_r($max);
                     //						echo "<br>";
                     //						print_r($columns);
                     //						echo " == ";
                     //						print_r($currColumns);
                     //						exit;
                     return true;
                 }
                 //					$checkElement = true;
             }
             $counter++;
         }
     }
     return false;
 }
开发者ID:pressi,项目名称:zdps_customize,代码行数:44,代码来源:Content.php

示例15: collectItems

 public function collectItems(CollectItemsEvent $event)
 {
     $item = $event->getParentItem();
     if ($item->getType() == 'article') {
         $t = \ContentModel::getTable();
         $arrColumns = array("{$t}.pid=?", "({$t}.ptable='' OR {$t}.ptable='tl_article')", "{$t}.cssID!=''");
         if (!BE_USER_LOGGED_IN) {
             $time = time();
             $arrColumns[] = "({$t}.start='' OR {$t}.start<{$time}) AND ({$t}.stop='' OR {$t}.stop>{$time}) AND {$t}.invisible=''";
         }
         $contents = \ContentModel::findBy($arrColumns, array($item->getName()), array('order' => 'sorting'));
         if ($contents) {
             $factory = $event->getFactory();
             $reachedLevel = 7;
             foreach ($contents as $content) {
                 $headline = deserialize($content->headline, true);
                 $cssID = deserialize($content->cssID, true);
                 if (!empty($headline['value']) && !empty($headline['unit']) && !empty($cssID[0])) {
                     $elementLevel = (int) substr($headline['unit'], 1);
                     if ($elementLevel <= $reachedLevel) {
                         $factory->createItem('content', $content->id, $item);
                         $reachedLevel = $elementLevel;
                     }
                 }
             }
         }
     } else {
         if ($item->getType() == 'content') {
             $thisHeadline = deserialize($item->getExtra('headline'), true);
             if (!empty($thisHeadline['unit'])) {
                 $expectedLevel = intval(substr($thisHeadline['unit'], 1)) + 1;
                 $t = \ContentModel::getTable();
                 $arrColumns = array("{$t}.pid=?", "({$t}.ptable='' OR {$t}.ptable='tl_article')", "{$t}.cssID!=''", "{$t}.sorting > ?");
                 if (!BE_USER_LOGGED_IN) {
                     $time = time();
                     $arrColumns[] = "({$t}.start='' OR {$t}.start<{$time}) AND ({$t}.stop='' OR {$t}.stop>{$time}) AND {$t}.invisible=''";
                 }
                 $contents = \ContentModel::findBy($arrColumns, array($item->getExtra('pid'), $item->getExtra('sorting')), array('order' => 'sorting'));
                 if ($contents) {
                     $factory = $event->getFactory();
                     $reachedLevel = 7;
                     foreach ($contents as $content) {
                         $headline = deserialize($content->headline, true);
                         $cssID = deserialize($content->cssID, true);
                         if (!empty($headline['value']) && !empty($headline['unit']) && !empty($cssID[0])) {
                             $elementLevel = (int) substr($headline['unit'], 1);
                             // level is one down
                             if ($elementLevel >= $expectedLevel && $elementLevel <= $reachedLevel) {
                                 $factory->createItem('content', $content->id, $item);
                                 $reachedLevel = $elementLevel;
                             } else {
                                 if ($elementLevel < $expectedLevel) {
                                     break;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:bit3,项目名称:contao-xnavigation-content,代码行数:62,代码来源:ContentProvider.php


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