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


PHP NewsModel::findAll方法代码示例

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


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

示例1: actionAll

 public function actionAll()
 {
     $article = new NewsModel();
     $view = new View();
     $view->items = $article->findAll();
     $view->display('news/all.php');
 }
开发者ID:TTcuXOgaJI,项目名称:Test,代码行数:7,代码来源:NewsController.php

示例2: actionAll

 public function actionAll()
 {
     $news = NewsModel::findAll();
     $view = new View();
     $view->items = $news;
     $view->display('news/all.php');
 }
开发者ID:AcidHardcore,项目名称:php2_6,代码行数:7,代码来源:NewsController.php

示例3: actionAll

 public function actionAll()
 {
     $articles = NewsModel::findAll();
     if (!empty($articles)) {
         $view = new View();
         $view->articles = $articles;
         $view->display('news/all.php');
     } else {
         $e_message = 'Page not found: Пустой результат выборки по запросу';
         $e_code = 3;
         throw new E404Exception($e_message, $e_code);
     }
 }
开发者ID:RichardSyfer,项目名称:phplev2,代码行数:13,代码来源:NewsController.php

示例4: actionDelNews

 public function actionDelNews()
 {
     $news = new NewsModel();
     $view = new View();
     if (isset($_GET['id'])) {
         $item = NewsModel::findOneByPk($_GET['id']);
         $view->item = $item;
         $view->deleted = true;
         //$news->delete();
     } else {
         $newsTitles = NewsModel::findAll();
         $view->news = $newsTitles;
     }
     $view->display('admin/delnews.php');
 }
开发者ID:RichardSyfer,项目名称:phplev2,代码行数:15,代码来源:AdminController.php

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

示例6: getIncludeItems

 public function getIncludeItems(\DataContainer $dc)
 {
     $arrReturn = array();
     $strTable = '';
     $strDateKey = '';
     $strTitleKeyArchive = '';
     $strTitleKeyItem = '';
     $strPatternArchiveUrl = '%s';
     $strPatternItemUrl = '%s';
     if (!$dc->activeRecord->type) {
         return $arrReturn;
     }
     switch ($dc->activeRecord->type) {
         case 'nl_news':
             $strTable = 'tl_news';
             $strDateKey = 'date';
             $strTitleKeyItem = 'headline';
             $strTitleKeyArchive = 'title';
             $strPatternArchiveUrl = 'contao/main.php?do=news&id=%s&act=edit&popup=1&nb=1&rt=%s';
             $strPatternItemUrl = 'contao/main.php?do=news&id=%s&act=edit&popup=1&nb=1&rt=%s&table=%s';
             $objItems = \NewsModel::findAll(array('order' => $strTable . '.' . $strDateKey));
             break;
         case 'nl_events':
             $strTable = 'tl_calendar_events';
             $strDateKey = 'startDate';
             $strTitleKeyItem = 'title';
             $strTitleKeyArchive = 'title';
             $strPatternArchiveUrl = 'contao/main.php?do=calendar&id=%s&act=edit&popup=1&nb=1&rt=%s';
             $strPatternItemUrl = 'contao/main.php?do=calendar&id=%s&act=edit&popup=1&nb=1&rt=%s&table=%s';
             $objItems = \CalendarEventsModel::findAll(array('order' => $strTable . '.' . $strDateKey));
             break;
         default:
             return $arrReturn;
             break;
     }
     if (!is_null($objItems)) {
         foreach ($objItems as $objItem) {
             $objArchive = $objItem->getRelated('pid');
             $strDoArchive = ampersand(sprintf($strPatternArchiveUrl, $objItem->pid, REQUEST_TOKEN));
             $strDoItem = ampersand(sprintf($strPatternItemUrl, $objItem->id, REQUEST_TOKEN, $strTable));
             $strDateField = \Date::parse(\Config::get('dateFormat') ?: 'd.m.Y', $objItem->{$strDateKey}) . ' - ';
             $time = time();
             //"($t.start='' OR $t.start<$time) AND ($t.stop='' OR $t.stop>$time) AND $t.published=1";
             $blnPublished = (!$objItem->start || $objItem->start < $time) && (!$objItem->stop || $objItem->stop > $time) && $objItem->published;
             $arrReturn[$objItem->id] = sprintf('%s<strong><a%s href="%s" title="%s" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'%s\',\'url\':this.href});return false">%s</a></strong> (<a href="%s" title="%s" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'%s\',\'url\':this.href});return false">%s</a>)', $strDateField, $blnPublished ? '' : ' style="color:#c33"', $strDoItem, sprintf(specialchars($GLOBALS['TL_LANG']['tl_content']['editalias'][1]), $objItem->id), sprintf(specialchars($GLOBALS['TL_LANG']['tl_content']['editalias'][1]), $objItem->id), $objItem->{$strTitleKeyItem}, $strDoArchive, sprintf(specialchars($GLOBALS['TL_LANG']['tl_content']['editalias'][1]), $objArchive->id), sprintf(specialchars($GLOBALS['TL_LANG']['tl_content']['editalias'][1]), $objArchive->id), $objArchive->{$strTitleKeyArchive});
         }
     }
     return $arrReturn;
 }
开发者ID:davidenke,项目名称:newsletter_content,代码行数:49,代码来源:tl_content.php

示例7: getRelatedNews

 public static function getRelatedNews(\DataContainer $dc, array $arrRelation = array())
 {
     $arrOptionGroups = array();
     $arrOptions = array();
     // front end mode with module & relation context
     if (!empty($arrRelation)) {
         $objNews = \NewsModel::findPublishedByPids(deserialize($dc->objModule->news_archives, true), null, 0, 0, array('order' => 'headline'));
     } else {
         $objNews = \NewsModel::findAll();
     }
     if ($objNews === null) {
         return $arrOptions;
     }
     while ($objNews->next()) {
         // return as optgroup if more than 1 $arrPids
         if (($objArchive = $objNews->getRelated('pid')) === null) {
             continue;
         }
         $arrOptionGroups[$objArchive->title][$objNews->id] = $objNews->headline;
         $arrOptions[$objNews->id] = $objNews->headline;
     }
     $arrDca =& $GLOBALS['TL_DCA']['tl_submission'];
     // filter menu does not support optgroups
     if (TL_MODE == 'BE' && $dc->field != 'news') {
         return $arrOptions;
     }
     // remove optgroups if not wanted, or less than 2 optgroups
     if (count($arrOptionGroups) == 1 || $arrDca['fields'][$arrRelation['submissionField']]['eval']['optgroup'] === false) {
         return $arrOptions;
     }
     return $arrOptionGroups;
 }
开发者ID:heimrichhannot,项目名称:contao-submissions_creator,代码行数:32,代码来源:SubmissionCreator.php


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