本文整理汇总了PHP中NewsModel::getNewsTreeFeedsById方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsModel::getNewsTreeFeedsById方法的具体用法?PHP NewsModel::getNewsTreeFeedsById怎么用?PHP NewsModel::getNewsTreeFeedsById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsModel
的用法示例。
在下文中一共展示了NewsModel::getNewsTreeFeedsById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
}
}
示例2: ShowNewsTreeBreadCrumbByNewsTreeFeedsId
public function ShowNewsTreeBreadCrumbByNewsTreeFeedsId($news_tree_feeds_id, $isSetAnchor = true)
{
$newsModel = new NewsModel();
$newsUrl = Project::getRequest()->createUrl('News', 'News');
$newsTreeFeeds = $newsModel->getNewsTreeFeedsById($news_tree_feeds_id);
$newsModel->getNewsTreeBreadCrumb($newsTreeFeeds['news_tree_id']);
$newsModel->_aNewsTreeBreadCrumb = array_reverse($newsModel->_aNewsTreeBreadCrumb);
$aNewsTreeBreadCrumb = $newsModel->_aNewsTreeBreadCrumb;
$sNewsTreeBreadCrumb = $this->ShowNewsTreeBreadCrumb($aNewsTreeBreadCrumb, $isSetAnchor);
if ($newsTreeFeeds['feeds_name']) {
$sNewsTreeBreadCrumb .= ' -> ';
if ($isSetAnchor) {
$sNewsTreeBreadCrumb .= '<a href="' . $newsUrl . '/filterNewsTreeFeeds:' . $news_tree_feeds_id . '">';
}
$sNewsTreeBreadCrumb .= $newsTreeFeeds['feeds_name'];
if ($isSetAnchor) {
$sNewsTreeBreadCrumb .= '</a>';
}
}
return $sNewsTreeBreadCrumb;
}