本文整理汇总了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");
}
示例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');
}
示例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');
}
示例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);
}
示例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();
}
示例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();
}
}
示例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;
}
示例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');
}
}
}
示例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;
}
示例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();
}
示例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);
}
示例12: actionFormDeletenews
public function actionFormDeletenews()
{
$id = $_GET['id'];
$news = NewsModel::getOneById($id);
$view = new View();
$view->item = $news;
$view->display('admin/deletenews.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']);
}
}
示例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);
}
示例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();
}