本文整理汇总了PHP中blogPostModel::getTimeline方法的典型用法代码示例。如果您正苦于以下问题:PHP blogPostModel::getTimeline方法的具体用法?PHP blogPostModel::getTimeline怎么用?PHP blogPostModel::getTimeline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blogPostModel
的用法示例。
在下文中一共展示了blogPostModel::getTimeline方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: timeline
public function timeline($blog_ids = array(), $datetime = array())
{
$blogs = blogHelper::getAvailable();
if (empty($blog_ids)) {
$blog_ids = array_keys($blogs);
}
$blog_post_model = new blogPostModel();
return $blog_post_model->getTimeline($blog_ids, $blogs, $datetime);
}
示例2: execute
public function execute()
{
if ($this->getRequest()->param('blog_id') === false) {
throw new waException(_w('Blog not found'), 404);
}
$this->view->getHelper()->globals($this->getRequest()->param());
$posts_per_page = max(1, intval($this->getConfig()->getOption('posts_per_page')));
$post_model = new blogPostModel();
$options = array();
if (!$this->appSettings('show_comments', true)) {
$options['comments'] = false;
}
$options['params'] = true;
$options['text'] = 'cut';
$options['escape'] = true;
$is_search = false;
if (isset($this->search_params["search"])) {
$plugin = $this->search_params["search"];
if (!isset($this->search_params["plugin"])) {
$this->search_params["plugin"] = array();
}
if (isset($this->search_params[$plugin])) {
$this->search_params["plugin"][$plugin] = $this->search_params[$plugin];
$is_search = true;
}
}
$query = $this->getRequest()->get('query', '', waRequest::TYPE_STRING_TRIM);
if ($query) {
$this->search_params['text'] = urldecode($query);
$options['highlighted'] = true;
}
$blogs = blogHelper::getAvailable();
$posts = $post_model->search($this->search_params, $options, array('blog' => $blogs))->fetchSearchPage($this->page, $posts_per_page);
$stream_title = false;
if (isset($this->search_params['contact_id'])) {
if (count($posts)) {
reset($posts);
$post = current($posts);
$name = $post['user']['name'];
$is_search = true;
} else {
if ($contact = blogHelper::getContactInfo($this->search_params['contact_id'])) {
$name = htmlentities($contact['name'], ENT_QUOTES, 'utf-8');
$is_search = true;
} else {
throw new waException(_w('Blog not found'), 404);
}
}
$stream_title = sprintf(_w('Posts by %s'), $name);
$this->getResponse()->setTitle($stream_title);
} elseif ($is_search) {
$stream_title = $this->getResponse()->getTitle();
} elseif (isset($this->search_params['year'])) {
$stream_title = '';
if (isset($this->search_params['day'])) {
$stream_title .= intval($this->search_params['day']) . ' ';
}
if (isset($this->search_params['month'])) {
$stream_title .= _ws(date("F", gmmktime(0, 0, 0, intval($this->search_params['month']), 1))) . ' ';
}
$stream_title .= $this->search_params['year'] . ' — ' . $this->getResponse()->getTitle();
$this->getResponse()->setTitle($stream_title);
} else {
if (!empty($this->search_params['text'])) {
$stream_title = urldecode($this->search_params['text']);
$this->getResponse()->setTitle($stream_title);
$is_search = true;
}
}
$this->view->assign('stream_title', $stream_title);
$pages = $post_model->pageCount();
$url = wa()->getRouteUrl('blog/frontend', $this->search_params, true);
if ($pages && $pages < $this->page) {
$page = min($pages, $this->page);
$redirect = $url . ($page > 1 ? "?page={$page}" : '');
$this->getResponse()->redirect($redirect, 302);
}
if ($layout = $this->getLayout()) {
$links = array();
if ($pages > $this->page) {
$page = $this->page + 1;
$links['next'] = "{$url}?page={$page}";
}
if ($this->page > 1) {
$page = $this->page - 1;
$links['prev'] = $url . ($page > 1 ? "?page={$page}" : '');
}
$layout->assign('links', $links);
if (!$is_search) {
/*
* @deprecated fix assigning sidebar_timeline for next version of blog
* */
$layout->assign('sidebar_timeline', $post_model->getTimeline($this->search_params['blog_id'], $blogs, $this->search_params));
}
if (isset($this->search_params['contact_id'])) {
$layout->assign('action_info', array('search' => array('contact_id' => $this->search_params['contact_id'])));
}
$layout->assign('is_search', $is_search);
}
$this->view->assign('is_search', $is_search);
//.........这里部分代码省略.........