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


PHP ContentModel::getTable方法代码示例

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


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

示例1: findPreviousElement

 /**
  * Try to find previous element of same type or specified type.
  *
  * @param string|null $type Name of the type. If empty current type is used.
  *
  * @return \Model|null
  */
 public function findPreviousElement($type = null)
 {
     if ($type === null) {
         $type = $this->getType();
     }
     $table = \ContentModel::getTable();
     $column = array($table . '.pid=?', $table . '.ptable=?', $table . '.type=?', $table . '.sorting<?');
     $values = array($this->model->pid, $this->model->ptable, $this->getTypeName($type), $this->model->sorting);
     return \ContentModel::findOneBy($column, $values, array('order' => $table . '.sorting DESC'));
 }
开发者ID:contao-bootstrap,项目名称:core,代码行数:17,代码来源:Helper.php

示例2: 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

示例3: 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

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