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


PHP NewsModel类代码示例

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


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

示例1: actionDel

 public function actionDel()
 {
     $del = new NewsModel();
     $del->id = [':id' => $_POST['id']];
     $del->del();
     header("Location: /index.php");
 }
开发者ID:Zerotul2015,项目名称:kemit,代码行数:7,代码来源:AdminController.php

示例2: actionSearch

 public function actionSearch()
 {
     $search = new NewsModel();
     $search->colummn = $_POST['column'];
     $search->value = $_POST['value'];
     $view = new View();
     $view->items = $search->findByColumn($search->colummn, $search->value);
     $view->display('search.php');
 }
开发者ID:Zerotul2015,项目名称:kemit,代码行数:9,代码来源:NewsController.php

示例3: actionFindByColumn

 public function actionFindByColumn()
 {
     $value = $_POST['title'];
     $findNews = new NewsModel();
     $find = $findNews->findByColumn('title', $value);
     $view = new View();
     $view->findNews = $find;
     $view->display('test.php');
 }
开发者ID:aosnafanja,项目名称:php.local,代码行数:9,代码来源:AdminController.php

示例4: news_one_show

 function news_one_show($id = null)
 {
     $one_news_model = new NewsModel();
     $one_news = $one_news_model->get_one_news($id);
     //        var_dump($news);die;
     $view = new View();
     $view->set_file_name('admin_news_one');
     $params = array('news' => $one_news);
     $view->show($params);
 }
开发者ID:levon379,项目名称:mvc,代码行数:10,代码来源:Admin.php

示例5: load

 function load()
 {
     parent::load();
     if (intval($this->data['new_gnews']) == 0 || $this->player->isSpy) {
         $this->redirect('village1.php');
         return null;
     }
     $m = new NewsModel();
     $this->siteNews = $m->getGlobalSiteNews();
     $m->dispose();
 }
开发者ID:vcelis,项目名称:tatar-wars,代码行数:11,代码来源:shownew.php

示例6: load

 public function load()
 {
     parent::load();
     if (intval($this->data['new_gnews']) == 0 || $this->player->isSpy) {
         $this->redirect("village1.php");
     } else {
         $m = new NewsModel();
         $this->siteNews = $m->getGlobalSiteNews();
         $m->dispose();
     }
 }
开发者ID:halshaman,项目名称:TravianDboor,代码行数:11,代码来源:shownew.php

示例7: viewNewsPage

    function viewNewsPage($user_id)
    {
        $htmlPage = "";
        $user_id = (int) $user_id;
        $newsModel = new NewsModel();
        $newsView = new NewsView();
        $aNewsSubscribe = $newsModel->getNewsSubscribeByUserId($user_id);
        if (!$aNewsSubscribe) {
            $aNewsTree = $newsView->getAllNewsTree();
            $isOnlySubscribeNewsTree = false;
        } else {
            $aNewsTree = $newsView->getNewsTreeByListNewsSubscribe($aNewsSubscribe);
            $isOnlySubscribeNewsTree = true;
        }
        $htmlPage = '<ul class="content-preview-list">';
        foreach ($aNewsTree as $newsTree) {
            /*    $newsCount = $newsView -> getNewsCountByNewsTreeId($newsTree['id'], $user_id, $isOnlySubscribeNewsTree);
                    if ($newsCount < 1) continue;
                    $htmlPage .= '
                 	<!-- Категория -->
                 	<div class="block_ee1"><div class="block_ee2"><div class="block_ee3"><div class="block_ee4">
                 		<div class="block_title">
                 			<div class="block_title_left">
                 			   <h2>
                 			   '.$newsView->ShowNewsTreeBreadCrumbByNewsTreeId($newsTree['id'], false).' (<a href="'.Project::getRequest()->createUrl('News', 'News', null, false).'/shownow:allnews/filterNewsTree:'.$newsTree['id'].'">все новости ['.$newsCount.']</a>)
                 			   </h2>
                 			</div>
                 			<div class="block_title_right"><img src="'.$this -> image_url.'close.png" width="21" height="24" onclick="ShowOrHide(this, \'rss_cat_n'.$newsTree['id'].'\')" style="cursor: pointer;" /></div>
                 		</div>'; */
            $htmlPage .= '<li class="expanded-view">
						<h3><a href="#">МИД России: Тбилиси выдает желаемое за действительное <img src="assets/i/temp/temp.1.jpg" alt="МИД России: Тбилиси выдает желаемое за действительное" /></a></h3>
						<p>В Москве опровергают сообщения о том, что якобы минувшим днем российские войска в Южной Осетии вели огонь по грузинской территории... <a href="#">»</a></p>
						<div class="meta">
							<span class="auth">Вести.Ru</span>
							<span class="date">20 минут назад</span>
						</div>
					</li>';
            /*		$htmlPage .= '<div id="rss_cat_n'.$newsTree['id'].'">'.
                          $newsView->ShowNewsListPreviewByNewsTreeId($newsTree['id'], 'full', $user_id, 4, array(), $isOnlySubscribeNewsTree).'
               		   <div class="rmb14"></div>
               		</div>
               
               	</div></div></div></div>
               	<!-- /Категория -->
                  '; */
        }
        $htmlPage .= '</ul>';
        return $htmlPage;
    }
开发者ID:amanai,项目名称:next24,代码行数:49,代码来源:HomeView.php

示例8: actionDelete

 public function actionDelete()
 {
     if (empty($_GET['id'])) {
         $message = 'There is no such news ';
         $this->errMSG($message);
     } else {
         $article = new NewsModel();
         $article->id = $_GET['id'];
         if ($article->deleteRow()) {
             $this->actionAll();
         } else {
             $this->errMSG('Fail Deleting a File');
         }
     }
 }
开发者ID:TTcuXOgaJI,项目名称:Test,代码行数:15,代码来源:NewsController.php

示例9: checkLog

 public function checkLog($ptable, $tstamp, $item)
 {
     switch ($ptable) {
         case 'tl_article':
             $objArticle = \ArticleModel::findById($item['pid']);
             $objPage = \PageModel::findById($objArticle->pid);
             $item['page'] = $objPage->title;
             $item['showUrl'] = $this->generateFrontendUrl($objPage->row(), '');
             break;
         case 'tl_news':
             $objNews = \NewsModel::findById($item['pid']);
             $objArchive = \NewsArchiveModel::findById($objNews->pid);
             $objPage = \PageModel::findById($objArchive->jumpTo);
             $item['page'] = $objNews->headline;
             $item['showUrl'] = ampersand($this->generateFrontendUrl($objPage->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/items/') . (!\Config::get('disableAlias') && $objNews->alias != '' ? $objNews->alias : $objNews->id)));
             break;
         case 'tl_calendar':
             break;
         case 'tl_faq':
             $objFAQ = \FaqModel::findById($item['id']);
             $objCategory = \FaqCategoryModel::findById($item['pid']);
             $objPage = \PageModel::findById($objCategory->jumpTo);
             $item['htmlElement'] = '<div class="ce_faq"><h1>' . $objFAQ->question . '</h1>' . $objFAQ->answer . '</div>';
             $item['page'] = $objCategory->title;
             $item['title'] = $objFAQ->question;
             $item['showUrl'] = ampersand($this->generateFrontendUrl($objPage->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/items/') . (!\Config::get('disableAlias') && $objFAQ->alias != '' ? $objFAQ->alias : $objFAQ->id)));
             break;
     }
     return $item;
 }
开发者ID:contao-dot-kitchen,项目名称:content_log,代码行数:30,代码来源:ClassContentLog.php

示例10: generateRelated

 /**
  * Generate the list in related categories mode
  *
  * Use the categories of the current news item. The module must be
  * on the same page as news reader module.
  *
  * @return string
  */
 protected function generateRelated()
 {
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Return if there is no item specified
     if (!\Input::get('items')) {
         return '';
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     $news = \NewsModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->news_archives);
     // Return if the news item was not found
     if ($news === null) {
         return '';
     }
     $GLOBALS['NEWS_FILTER_CATEGORIES'] = false;
     $GLOBALS['NEWS_FILTER_DEFAULT'] = deserialize($news->categories, true);
     $GLOBALS['NEWS_FILTER_EXCLUDE'] = array($news->id);
     return parent::generate();
 }
开发者ID:codefog,项目名称:contao-news_categories,代码行数:33,代码来源:ModuleNewsList.php

示例11: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $this->Template->articles = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     // Get the news item
     $objArticle = \NewsModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->news_archives);
     if ($objArticle === null) {
         // Do not index or cache the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         // Send a 404 header
         header('HTTP/1.1 404 Not Found');
         $this->Template->articles = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
         return;
     }
     $arrArticle = $this->parseArticle($objArticle);
     $this->Template->articles = $arrArticle;
     // Overwrite the page title
     if ($objArticle->headline != '') {
         $objPage->pageTitle = strip_insert_tags($objArticle->headline);
     }
     // Overwrite the page description
     if ($objArticle->teaser != '') {
         $objPage->description = $this->prepareMetaDescription($objArticle->teaser);
     }
     // HOOK: comments extension required
     if ($objArticle->noComments || !in_array('comments', $this->Config->getActiveModules())) {
         $this->Template->allowComments = false;
         return;
     }
     $objArchive = $objArticle->getRelated('pid');
     $this->Template->allowComments = $objArchive->allowComments;
     // Adjust the comments headline level
     $intHl = min(intval(str_replace('h', '', $this->hl)), 5);
     $this->Template->hlc = 'h' . ($intHl + 1);
     $this->import('Comments');
     $arrNotifies = array();
     // Notify the system administrator
     if ($objArchive->notify != 'notify_author') {
         $arrNotifies[] = $GLOBALS['TL_ADMIN_EMAIL'];
     }
     // Notify the author
     if ($objArchive->notify != 'notify_admin') {
         if (($objAuthor = $objArticle->getRelated('author')) !== null && $objAuthor->email != '') {
             $arrNotifies[] = $objAuthor->email;
         }
     }
     $objConfig = new \stdClass();
     $objConfig->perPage = $objArchive->perPage;
     $objConfig->order = $objArchive->sortOrder;
     $objConfig->template = $this->com_template;
     $objConfig->requireLogin = $objArchive->requireLogin;
     $objConfig->disableCaptcha = $objArchive->disableCaptcha;
     $objConfig->bbcode = $objArchive->bbcode;
     $objConfig->moderate = $objArchive->moderate;
     $this->Comments->addCommentsToTemplate($this->Template, $objConfig, 'tl_news', $objArticle->id, $arrNotifies);
 }
开发者ID:rikaix,项目名称:core,代码行数:62,代码来源:ModuleNewsReader.php

示例12: actionFormDeletenews

 public function actionFormDeletenews()
 {
     $id = $_GET['id'];
     $news = NewsModel::getOneById($id);
     $view = new View();
     $view->item = $news;
     $view->display('admin/deletenews.php');
 }
开发者ID:Nilop,项目名称:mvctest,代码行数:8,代码来源:AdminController.php

示例13: modifyPalettes

 /**
  * Modify the palette according to the checkboxes selected
  *
  * @param mixed
  * @param DataContainer
  *
  * @return mixed
  */
 public function modifyPalettes()
 {
     $objNews = \NewsModel::findById($this->Input->get('id'));
     $dc =& $GLOBALS['TL_DCA']['tl_news'];
     if (!$objNews->addPreviewImage) {
         $dc['subpalettes']['addYouTube'] = str_replace('imgHeader,imgPreview,addPlayButton,', '', $dc['subpalettes']['addYouTube']);
     }
 }
开发者ID:heimrichhannot,项目名称:contao-youtube,代码行数:16,代码来源:tl_news.php

示例14: getNewsIntro

 public function getNewsIntro()
 {
     $news_items = NewsModel::getLatestNews(NEWS_ITEMS);
     $random_shot = ScreenshotsModel::getRandomScreenshot();
     $this->addCSSFiles(array('intro.css', 'news.css', '../javascripts/slimbox/css/slimbox2.css'));
     $this->addJSFiles(array('jquery-1.3.2.min.js', 'slimbox/js/slimbox2.js', 'introduction.js'));
     return $this->renderPage(array('title' => 'Home', 'content_title' => 'Latest Developments', 'show_intro' => true, 'news_items' => $news_items, 'news_archive_link' => true, 'random_shot' => $random_shot), $this->_template);
 }
开发者ID:bgK,项目名称:scummvm-web,代码行数:8,代码来源:NewsPage.php

示例15: index

 public function index()
 {
     // get medal list
     $medal_model = new MedalModel();
     $this->assign('medals', $medal_model->select());
     // get all the numbers
     $map_data_model = D('MapData');
     $ngo_num_record = $map_data_model->query_number(array('type' => 'exngo'));
     $csr_num_record = $map_data_model->query_number(array('type' => 'excsr'));
     $case_num_record = $map_data_model->query_number(array('type' => 'case'));
     $this->assign('ngo_num', $ngo_num_record);
     $this->assign('csr_num', $csr_num_record);
     $this->assign('case_num', $case_num_record);
     $news_model = new NewsModel();
     $news_list = $news_model->limit(20)->select();
     $this->assign('news_list', $news_list);
     $this->display();
 }
开发者ID:baixinxing,项目名称:ngo20map6,代码行数:18,代码来源:IndexAction.class.php


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