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


PHP NewsModel::getAllNews方法代码示例

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


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

示例1: getNews

 public function getNews($date = null)
 {
     if ($date == null) {
         $news_items = NewsModel::getAllNews();
         $date = 'archive';
     } else {
         if (strlen($date) == 8) {
             $news_items = NewsModel::getAllByDate($date);
         } else {
             $news_items = array(NewsModel::getOneByDate($date));
         }
     }
     $this->addCSSFiles('news.css');
     return $this->renderPage(array('title' => 'Home', 'content_title' => 'Latest Developments', 'show_intro' => false, 'news_items' => $news_items, 'news_archive_link' => false, 'date' => $date), $this->_template);
 }
开发者ID:bgK,项目名称:scummvm-web,代码行数:15,代码来源:NewsPage.php

示例2: getNews

 public function getNews($date = null)
 {
     global $Smarty;
     if ($date == null) {
         $news_items = NewsModel::getAllNews();
         $date = 'archive';
     } else {
         if (strlen($date) == 8) {
             $news_items = NewsModel::getAllByDate($date);
         } else {
             $news_items = array(NewsModel::getOneByDate($date));
         }
     }
     $this->addCSSFiles('news.css');
     return $this->renderPage(array('title' => $Smarty->_config[0]['vars']['newsTitle'], 'content_title' => $Smarty->_config[0]['vars']['newsContentTitle'], 'show_intro' => false, 'news_items' => $news_items, 'news_archive_link' => false, 'date' => $date), $this->_template);
 }
开发者ID:rootfather,项目名称:scummvm-web,代码行数:16,代码来源:NewsPage.php

示例3: getLatestNews

 public static function getLatestNews($num = -1, $processContent = false)
 {
     if ($num == -1) {
         return NewsModel::getAllNews($processContent);
     } else {
         if (!($newslist = NewsModel::getListOfNewsDates())) {
             throw new ErrorException(self::NO_FILES);
         }
         rsort($newslist, SORT_NUMERIC);
         $newslist = array_slice($newslist, 0, $num);
         $news = array();
         foreach ($newslist as $date) {
             $news[] = NewsModel::getOneByDate($date, $processContent);
         }
         return $news;
     }
 }
开发者ID:bgK,项目名称:scummvm-web,代码行数:17,代码来源:NewsModel.php

示例4: ChangeFeedAction

 public function ChangeFeedAction()
 {
     $newsModel = new NewsModel();
     $request = Project::getRequest();
     $news_tree_feeds_id = $request->news_tree_feeds_id;
     $newsTreeFeed = $newsModel->getNewsTreeFeedsById($news_tree_feeds_id, false, false, false);
     $user = Project::getUser()->getDbUser();
     $isAdmin = $user->user_type_id == 1 ? true : false;
     $this->_view->clearFlashMessages();
     if ($news_tree_feeds_id && $newsTreeFeed && is_array($newsTreeFeed)) {
         if ($request->deleteRss) {
             if ($user->id == $newsTreeFeed['feeds_user_id'] || $isAdmin) {
                 // if OWNER or ADMIN
                 $newsModel->deleteFeeds($newsTreeFeed['feed_id']);
                 $newsModel->deleteNewsBanner($newsTreeFeed['news_banner_id']);
                 $newsModel->deleteNewsTreeFeeds($news_tree_feeds_id);
                 $newsModel->deleteNewsByNewsTreeFeedsId($news_tree_feeds_id);
             }
             Project::getResponse()->redirect(Project::getRequest()->createUrl('News', 'MyFeeds'));
         } elseif ($request->frmAction == 'change') {
             $noErrors = true;
             $category_tag = trim($request->category_tag);
             $type = $category_tag ? 1 : 0;
             // 0 - 1 Rss => 1 NewsTreeCastegory; 1 - 1 Rss => N NewsTreeCategory
             $creation_date = date("Y-m-d H:i:s");
             if ($user->user_type_id == 1 || $user->user_type_id == 4) {
                 // partner or Admin
                 $is_partner = 1;
                 $state = 0;
                 $text_parse_type = 0;
             } else {
                 // registred user
                 $is_partner = 0;
                 $state = 1;
                 $text_parse_type = 2;
             }
             if (!$request->feed_name) {
                 $this->_view->addFlashMessage(FM::ERROR, "Введите название RSS-ленты");
                 $noErrors = false;
             }
             if (!$request->feed_url) {
                 $this->_view->addFlashMessage(FM::ERROR, "Введите URL RSS-ленты");
                 $noErrors = false;
             }
             if ($noErrors) {
                 if ($user->id == $newsTreeFeed['feeds_user_id'] || $isAdmin) {
                     // if OWNER or ADMIN
                     if (strtolower(substr($request->feed_url, 0, 7)) == 'feed://') {
                         $feed_url = 'http://' . substr($request->feed_url, 7);
                     } else {
                         $feed_url = $request->feed_url;
                     }
                     if ($isAdmin) {
                         $text_parse_type = $request->text_parse_type;
                     } else {
                         $text_parse_type = -1;
                     }
                     $newsModel->changeFeeds($newsTreeFeed['feed_id'], $request->feed_name, $feed_url, $type, $state, $text_parse_type, $is_partner);
                     $newsModel->changeNewsTreeFeeds($news_tree_feeds_id, $request->news_tree_id, $newsTreeFeed['feed_id'], $newsTreeFeed['news_banner_id'], $category_tag);
                     if ($newsTreeFeed['news_banner_id']) {
                         $newsModel->changeNewsBanner($newsTreeFeed['news_banner_id'], $request->code, $state);
                     } else {
                         $news_banner_id = $newsModel->addNewsBanner($user->id, $request->code, $state);
                         $newsModel->changeOneValue('news_tree_feeds', $news_tree_feeds_id, 'news_banner_id', $news_banner_id);
                     }
                 }
                 Project::getResponse()->redirect(Project::getRequest()->createUrl('News', 'ChangeFeed') . "/change_feed/news_tree_feeds_id:" . $news_tree_feeds_id . "/");
             }
         }
         $this->_view->assign('tab_list', TabController::getOwnTabs(false, false, false, false, false, false, false, true, false, false));
         //        $this-> _view -> assign('tab_list', TabController::getNewsTabs($user->id, $isAdmin, false, false, false,  false,  false, array(), false, false, false, false, true)); // Show tabs
         $this->_view->assign('frmAction', 'change');
         $this->_view->assign('submitValue', 'Изменить');
         $this->_view->assign('feed_name', $newsTreeFeed['feeds_name']);
         $this->_view->assign('feed_url', $newsTreeFeed['url']);
         $this->_view->assign('category_tag', $newsTreeFeed['category_tag']);
         $this->_view->assign('code', $newsTreeFeed['code']);
         $this->_view->assign('news_tree_id', $newsTreeFeed['news_tree_id']);
         $this->_view->assign('text_parse_type', $newsTreeFeed['text_parse_type']);
         $this->_view->assign('news_tree_feeds_id', $news_tree_feeds_id);
         $this->_view->assign('isChange', true);
         $this->_view->assign('isAdmin', $isAdmin);
         $aListNews = $newsModel->getAllNews();
         $this->_view->assign('news_list', $aListNews);
         // all News tree
         $this->_view->AddFeedPage();
         $this->_view->parse();
     } else {
         Project::getResponse()->redirect(Project::getRequest()->createUrl('News', 'MyFeeds'));
     }
 }
开发者ID:amanai,项目名称:next24,代码行数:91,代码来源:NewsController.php


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