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


PHP EB::formatter方法代码示例

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


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

示例1: display

 /**
  * Default display method for featured listings
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function display($tmpl = null)
 {
     // Set the meta tags for this page
     EB::setMeta(META_ID_FEATURED, META_TYPE_VIEW);
     // Add the RSS headers on the page
     EB::feeds()->addHeaders('index.php?option=com_easyblog&view=featured');
     // Add breadcrumbs on the site menu.
     $this->setPathway('COM_EASYBLOG_FEATURED_BREADCRUMB');
     // Get the model
     $model = EB::model('Featured');
     // Get a list of featured posts
     $posts = $model->getPosts();
     // Get the pagination
     $pagination = $model->getPagination();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Set the page title
     $title = EB::getPageTitle(JText::_('COM_EASYBLOG_FEATURED_PAGE_TITLE'));
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Get the current url
     $return = EBR::_('index.php?option=com_easyblog', false);
     $this->set('return', $return);
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     parent::display('blogs/featured/default');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:view.html.php

示例2: display

 public function display($tmpl = null)
 {
     // Checks if rss is enabled
     if (!$this->config->get('main_rss')) {
         return;
     }
     // Get the archives model
     $model = EB::model('Archive');
     // Get a list of posts
     $posts = $model->getPosts();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Set the link for this feed
     $this->doc->link = EBR::_('index.php?option=com_easyblog&view=archive');
     $this->doc->setTitle(JText::_('COM_EASYBLOG_ARCHIVED_POSTS'));
     $this->doc->setDescription(JText::_('COM_EASYBLOG_ARCHIVED_POSTS_DESC'));
     if (!$posts) {
         return;
     }
     foreach ($posts as $post) {
         $image = '';
         if ($post->getImage('medium', true, true)) {
             $image = '<img src=' . $post->getImage('medium', true, true) . '" alt="' . $post->title . '" />';
         }
         $item = new JFeedItem();
         $item->title = $post->title;
         $item->link = $post->getPermalink();
         $item->description = $image . $post->getIntro();
         $item->date = $post->getCreationDate()->format();
         $item->category = $post->getPrimaryCategory()->getTitle();
         $item->author = $post->author->getName();
         $item->authorEmail = $this->getRssEmail($post->author);
         $this->doc->addItem($item);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:35,代码来源:view.feed.php

示例3: get

 public function get()
 {
     $input = JFactory::getApplication()->input;
     $model = EasyBlogHelper::getModel('Blog');
     //$id = $input->get('id', null, 'INT');
     $id = 0;
     $search = $input->get('search', '', 'STRING');
     $featured = $input->get('featured', 0, 'INT');
     $tags = $input->get('tags', 0, 'INT');
     $user_id = $input->get('user_id', 0, 'INT');
     $posts = array();
     // If we have an id try to fetch the user
     $blog = EasyBlogHelper::table('Blog');
     $blog->load($id);
     $modelPT = EasyBlogHelper::getModel('PostTag');
     if ($tags) {
         $rows = $model->getTaggedBlogs($tags);
     } else {
         if ($featured) {
             $rows = $this->getfeature_Blog();
             $sorting = $this->plugin->params->get('sorting', 'featured');
         } else {
             if ($user_id) {
                 $blogs = EasyBlogHelper::getModel('Blog');
                 $rows = $blogs->getBlogsBy('blogger', $user_id, 'latest');
             } else {
                 //to get latest blog
                 //$sorting	= $this->plugin->params->get( 'sorting' , 'latest' );
                 //$rows 	= $model->getBlogsBy( $sorting , '' , $sorting , 0, EBLOG_FILTER_PUBLISHED, $search );
                 $rows = $model->getBlogsBy('', '', 'latest', 0, EBLOG_FILTER_PUBLISHED, null, true, array(), false, false, true, '', '', null, 'listlength', false);
                 //$rows = EB::formatter('list', $rows, false);
             }
         }
     }
     $rows = EB::formatter('list', $rows, false);
     //data mapping
     foreach ($rows as $k => $v) {
         //$item = EB::helper( 'simpleschema' )->mapPost($v,'', 100, array('text'));
         $scm_obj = new EasyBlogSimpleSchema_plg();
         $item = $scm_obj->mapPost($v, '', 100, array('text'));
         $item->tags = $modelPT->getBlogTags($item->postid);
         $item->isowner = $v->created_by == $this->plugin->get('user')->id ? true : false;
         if ($v->blogpassword != '') {
             $item->ispassword = true;
         } else {
             $item->ispassword = false;
         }
         $item->blogpassword = $v->blogpassword;
         $model = EasyBlogHelper::getModel('Ratings');
         $ratingValue = $model->getRatingValues($item->postid, 'entry');
         $item->rate = $ratingValue;
         $item->isVoted = $model->hasVoted($item->postid, 'entry', $this->plugin->get('user')->id);
         if ($item->rate->ratings == 0) {
             $item->rate->ratings = -2;
         }
         $posts[] = $item;
     }
     $this->plugin->setResponse($posts);
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:59,代码来源:latest.php

示例4: display

 public function display($tmpl = null)
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     //for trigger
     $params = $mainframe->getParams('com_easyblog');
     $joomlaVersion = EasyBlogHelper::getJoomlaVersion();
     $blogId = $this->input->get('id', 0, 'int');
     if (empty($blogId)) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_BLOG_NOT_FOUND'));
     }
     $my = JFactory::getUser();
     $blog = EB::table('Blog');
     $blog->load($blogId);
     $post = EB::post($blogId);
     // Check if blog is password protected.
     $protected = $this->isProtected($post);
     if ($protected !== false) {
         return;
     }
     // If the blog post is already deleted, we shouldn't let it to be accessible at all.
     if ($post->isTrashed()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check if the blog post is trashed
     if (!$post->isPublished() && $this->my->id != $post->created_by && !EB::isSiteAdmin()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check for team's privacy
     $allowed = $this->checkTeamPrivacy($post);
     if ($allowed === false) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_TEAMBLOG_MEMBERS_ONLY'));
     }
     // Check if the blog post is accessible.
     $accessible = $post->isAccessible();
     if (!$accessible->allowed) {
         echo $accessible->error;
         return;
     }
     // Format the post
     $post = EB::formatter('entry', $post);
     $tags = $post->getTags();
     $theme = EB::template();
     $theme->set('post', $post);
     $theme->set('tags', $tags);
     $blogHtml = $theme->output('site/blogs/entry/pdf');
     $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
     $document->setTitle($post->title . $pageTitle);
     $document->setName($post->getPermalink());
     // Fix phoca pdf plugin.
     if (method_exists($document, 'setArticleText')) {
         $document->setArticleText($blogHtml);
     }
     echo $blogHtml;
     return;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:59,代码来源:view.pdf.php

示例5: display

 public function display($tmpl = null)
 {
     // Get the model
     $model = EB::model('Search');
     $posts = $model->getData();
     $posts = EB::formatter('list', $posts);
     $this->set('posts', $posts);
     return parent::display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:9,代码来源:view.json.php

示例6: display

 /**
  * Default feed display method
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tmpl = null)
 {
     // Ensure that rss is enabled
     if (!$this->config->get('main_rss')) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_FEEDS_DISABLED'));
     }
     $id = $this->input->get('id', '', 'cmd');
     $category = EB::table('Category');
     $category->load($id);
     // Private category shouldn't allow to access.
     $privacy = $category->checkPrivacy();
     if (!$privacy->allowed) {
         return JError::raiseError(500, JText::_('COM_EASYBLOG_NOT_ALLOWED_HERE'));
     }
     // Get the nested categories
     $category->childs = null;
     EB::buildNestedCategories($category->id, $category);
     $linkage = '';
     EB::accessNestedCategories($category, $linkage, '0', '', 'link', ', ');
     $catIds = array();
     $catIds[] = $category->id;
     EB::accessNestedCategoriesId($category, $catIds);
     $category->nestedLink = $linkage;
     $model = EB::model('Blog');
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     $posts = $model->getBlogsBy('category', $catIds, $sort);
     $posts = EB::formatter('list', $posts);
     $this->doc->link = EBR::_('index.php?option=com_easyblog&view=categories&id=' . $id . '&layout=listings');
     $this->doc->setTitle($this->escape($category->getTitle()));
     $this->doc->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_CATEGORY_DESC', $this->escape($category->getTitle())));
     if (!$posts) {
         return;
     }
     $uri = JURI::getInstance();
     $scheme = $uri->toString(array('scheme'));
     $scheme = str_replace('://', ':', $scheme);
     foreach ($posts as $post) {
         $image = '';
         if ($post->hasImage()) {
             $image = '<img src="' . $post->getImage('medium', true, true) . '" width="250" align="left" />';
         }
         $item = new JFeedItem();
         $item->title = $this->escape($post->title);
         $item->link = $post->getPermalink();
         $item->description = $image . $post->getIntro();
         // replace the image source to proper format so that feed reader can view the image correctly.
         $item->description = str_replace('src="//', 'src="' . $scheme . '//', $item->description);
         $item->description = str_replace('href="//', 'href="' . $scheme . '//', $item->description);
         $item->date = $post->getCreationDate()->toSql();
         $item->category = $post->getPrimaryCategory()->getTitle();
         $item->author = $post->author->getName();
         $item->authorEmail = $this->getRssEmail($post->author);
         $this->doc->addItem($item);
     }
     // exit;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:64,代码来源:view.feed.php

示例7: execute

 public function execute()
 {
     if (!$this->items) {
         return $this->items;
     }
     // cache teamblogs
     EB::cache()->insertTeams($this->items);
     $teams = array();
     // Load up the blogs model
     $model = EB::model('TeamBlogs');
     // Get the current user's group id's
     $gid = EB::getUserGids();
     foreach ($this->items as $item) {
         $team = EB::table('TeamBlog');
         $team->load($item->id);
         // Check if the logged in user is a member of the group
         $team->isMember = $team->isMember($this->my->id, $gid);
         $team->isActualMember = $team->isMember($this->my->id, $gid, false);
         $team->members = $model->getAllMembers($team->id, 5);
         // total member count ( including actual members and users from asociated joomla group.)
         $team->memberCount = $team->getAllMembersCount();
         // post count associated with this teamblog.
         $team->postCount = $team->getPostCount();
         // Get the list of blog posts form this team
         $blogs = array();
         if ($team->access != EBLOG_TEAMBLOG_ACCESS_MEMBER || $team->isMember || EB::isSiteAdmin()) {
             $blogs = $model->getPosts($team->id, EASYBLOG_TEAMBLOG_LISTING_NO_POST);
             $blogs = EB::formatter('list', $blogs);
         }
         $team->blogs = $blogs;
         // Get the list of tags
         // $team->tags = $team->getTags();
         // Get categories used in this team
         // $team->categories = $team->getCategories();
         // Determines if the team is featured
         if (isset($item->isfeatured)) {
             $team->isFeatured = $item->isfeatured;
         } else {
             $team->isFeatured = EB::isFeatured('teamblog', $team->id);
         }
         // check if team description is emtpy or not. if yes, show default message.
         if (empty($team->description)) {
             $team->description = JText::_('COM_EASYBLOG_TEAMBLOG_NO_DESCRIPTION');
         }
         // Determines if the viewer is subscribed to this team
         $team->isTeamSubscribed = $model->isTeamSubscribedEmail($team->id, $this->my->email);
         // If the user is subscribed, we need to get his subscription id
         $team->subscription_id = $team->isTeamSubscribed;
         $teams[] = $team;
     }
     return $teams;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:52,代码来源:teamblogs.php

示例8: listings

 /**
  * Displays a list of blog posts from a specific team
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function listings()
 {
     // Get the team id that is being accessed now
     $id = $this->input->get('id', 0, 'int');
     $team = EB::table('TeamBlog');
     $team->load($id);
     if (!$id || !$team->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_TEAMBLOG_INVALID_ID'));
     }
     // set meta tags for teamblog view
     EB::setMeta($id, META_TYPE_TEAM);
     $gid = EB::getUserGids();
     $isMember = $team->isMember($this->my->id, $gid);
     $team->isMember = $isMember;
     $team->isActualMember = $team->isMember($this->my->id, $gid, false);
     // Add rss feed link
     if ($team->access == EBLOG_TEAMBLOG_ACCESS_EVERYONE || $team->isMember) {
         $this->doc->addHeadLink($team->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         $this->doc->addHeadLink($team->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
     }
     // check if team description is emtpy or not. if yes, show default message.
     if (empty($team->description)) {
         $team->description = JText::_('COM_EASYBLOG_TEAMBLOG_NO_DESCRIPTION');
     }
     // Set the breadcrumbs for this view
     $this->setViewBreadcrumb('teamblog');
     $this->setPathway($team->getTitle());
     // Retrieve the model
     $model = EB::model('TeamBlogs');
     $posts = $model->getPosts($team->id);
     $posts = EB::formatter('list', $posts);
     // Get the pagination
     $pagination = $model->getPagination();
     // Retrieve team's information
     $members = $model->getTeamMembers($team->id);
     // Determines if the team blog is featured
     $team->isFeatured = EB::isFeatured('teamblog', $team->id);
     // Set the page title
     $title = EB::getPageTitle($team->title);
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Check if subscribed
     $isTeamSubscribed = $model->isTeamSubscribedEmail($team->id, $this->my->email);
     // Get the current url
     $return = $team->getPermalink();
     $this->set('return', $return);
     $this->set('team', $team);
     $this->set('members', $members);
     $this->set('pagination', $pagination->getPagesLinks());
     $this->set('posts', $posts);
     $this->set('isTeamSubscribed', $isTeamSubscribed);
     parent::display('teamblogs/item');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:60,代码来源:view.html.php

示例9: getItems

 public static function getItems($params)
 {
     $model = EB::model('Blog');
     // Determines if we should display featured or latest entries
     $type = $params->get('showposttype', 'featured');
     // Determines if we should filter by category
     $categoryId = $params->get('catid');
     $result = array();
     if ($categoryId) {
         $categoryId = (int) $categoryId;
     }
     if ($type == 'latest' && !$categoryId) {
         $result = $model->getBlogsBy('', '', 'latest', $params->get('count'), EBLOG_FILTER_PUBLISHED, null, true, array(), false, false, false);
     }
     if ($type == 'latest' && $categoryId) {
         $result = $model->getBlogsBy('category', $categoryId, 'latest', $params->get('count'), EBLOG_FILTER_PUBLISHED, null, true, array(), false, false, false);
     }
     // If not latest posttype, show featured post.
     if ($type == 'featured') {
         if ($categoryId == 0) {
             $categoryId = '';
         }
         $result = $model->getFeaturedBlog($categoryId);
     }
     // If there's nothing to show at all, don't display anything
     if (!$result) {
         return $result;
     }
     $results = EB::formatter('list', $result);
     // Randomize items
     if ($params->get('autoshuffle')) {
         shuffle($results);
     }
     $contentKey = $params->get('contentfrom', 'content');
     $textcount = $params->get('textlimit', '200');
     $posts = array();
     foreach ($results as $result) {
         $content = $result->getContent();
         // Get the content from the selected source
         if ($contentKey == 'intro') {
             $content = $result->getIntro(true);
         }
         // Truncate the content
         if (JString::strlen(strip_tags($content)) > $textcount) {
             $content = JString::substr(strip_tags($content), 0, $textcount) . '...';
         }
         $result->content = $content;
         $posts[] = $result;
     }
     return $posts;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:51,代码来源:helper.php

示例10: display

 /**
  * Displays the default archives view
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tpl = null)
 {
     // Get the archives model
     $model = EB::model('Archive');
     // Get a list of posts
     $posts = $model->getPosts();
     // Format the posts
     $posts = EB::formatter('list', $posts);
     // Get the pagination
     $pagination = $model->getPagination();
     $this->set('posts', $posts);
     $this->set('pagination', $pagination);
     parent::display('blogs/archives/list');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:22,代码来源:view.html.php

示例11: display

 /**
  * Main display for the blog entry view
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function display($tpl = null)
 {
     // Get the blog post id from the request
     $id = $this->input->get('id', 0, 'int');
     // Load the blog post now
     $post = EB::post($id);
     // If blog id is not provided correctly, throw a 404 error page
     if (!$id || !$post->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // If the settings requires the user to be logged in, do not allow guests here.
     if ($this->my->guest && $this->config->get('main_login_read')) {
         return EB::requireLogin();
     }
     // Check if blog is password protected.
     $protected = $this->isProtected($post);
     if ($protected !== false) {
         return;
     }
     // If the blog post is already deleted, we shouldn't let it to be accessible at all.
     if ($post->isTrashed()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check if the blog post is trashed
     if (!$post->isPublished() && $this->my->id != $post->created_by && !EB::isSiteAdmin()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check for team's privacy
     $allowed = $this->checkTeamPrivacy($post);
     if ($allowed === false) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_TEAMBLOG_MEMBERS_ONLY'));
     }
     // Check if the blog post is accessible.
     $accessible = $post->isAccessible();
     if (!$accessible->allowed) {
         echo $accessible->error;
         return;
     }
     // Increment the hit counter for the blog post.
     $post->hit();
     // Format the post
     $post = EB::formatter('entry', $post);
     $theme = EB::template();
     $theme->set('post', $post);
     $output = $theme->output('site/blogs/entry/default.print');
     echo $output;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:55,代码来源:view.print.php

示例12: listings

 /**
  * Displays blog posts from a specific category
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function listings()
 {
     // Get the main category
     $id = $this->input->get('id', 0, 'int');
     $category = EB::table('Category');
     $category->load($id);
     // Check for the category privacy
     if (!$category->checkPrivacy()) {
         // @TODO: Display proper error message
         return;
     }
     $catIds = array();
     $catIds[] = $category->id;
     EB::accessNestedCategoriesId($category, $catIds);
     $model = EB::model('Category');
     $posts = $model->getPosts($catIds);
     $posts = EB::formatter('list', $posts);
     $this->set('category', $category);
     $this->set('posts', $posts);
     return parent::display();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:29,代码来源:view.json.php

示例13: getPosts

 public static function getPosts($params)
 {
     // Get the default sorting and ordering
     $sort = $params->get('sorting', 'latest');
     $order = $params->get('ordering', 'desc');
     // Get the total number of posts to display
     $limit = (int) trim($params->get('count', 0));
     // Determines if the user wants to filter items by specific ategories
     $catId = $params->get('catid');
     $categories = array();
     if ($catId) {
         $categories = explode(',', $catId);
     }
     $model = EB::model('Category');
     $result = $model->getPosts($categories, $limit);
     $posts = array();
     if (!$result) {
         return $posts;
     }
     $posts = EB::formatter('list', $result);
     return $posts;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:22,代码来源:helper.php

示例14: execute

 public function execute()
 {
     if (!$this->items) {
         return $this->items;
     }
     $limit = EB::call('Pagination', 'getLimit', array(EBLOG_PAGINATION_CATEGORIES));
     // lets cache these categories
     EB::cache()->insertCategories($this->items);
     $categories = array();
     // Get the category model
     $model = EB::model('Category');
     foreach ($this->items as $row) {
         // We want to load the table objects
         $category = EB::table('Category');
         $category->bind($row);
         // binding the extra info
         if (isset($row->cnt)) {
             $category->cnt = $row->cnt;
         }
         // Format the childs
         $category->childs = array();
         // Build childs list
         EB::buildNestedCategories($category->id, $category, false, true);
         // Parameterize initial subcategories to display. Ability to configure from backend.
         $nestedLinks = '';
         $subcategoryLimit = $this->app->getCfg('list_limit') == 0 ? 5 : $this->app->getCfg('list_limit');
         if (count($category->childs) > $subcategoryLimit) {
             $initialNestedLinks = '';
             $initialRow = new stdClass();
             $initialRow->childs = array_slice($category->childs, 0, $subcategoryLimit);
             EB::accessNestedCategories($initialRow, $initialNestedLinks, '0', '', 'link', ', ');
             $moreNestedLinks = '';
             $moreRow = new stdClass();
             $moreRow->childs = array_slice($category->childs, $initialLimit);
             EB::accessNestedCategories($moreRow, $moreNestedLinks, '0', '', 'link', ', ');
             // Hide more nested links until triggered
             $nestedLinks .= $initialNestedLinks;
             $nestedLinks .= '<span class="more-subcategories-toggle"> ' . JText::_('COM_EASYBLOG_AND') . ' <a href="javascript:void(0);" onclick="eblog.categories.loadMore( this );">' . JText::sprintf('COM_EASYBLOG_OTHER_SUBCATEGORIES', count($row->childs) - $initialLimit) . '</a></span>';
             $nestedLinks .= '<span class="more-subcategories" style="display: none;">, ' . $moreNestedLinks . '</span>';
         } else {
             EB::accessNestedCategories($category, $nestedLinks, '0', '', 'link', ', ');
         }
         // Set the nested links
         $category->nestedLink = $nestedLinks;
         // Get a list of nested categories and itself.
         $filterCategories = array($category->id);
         EB::accessNestedCategoriesId($category, $filterCategories);
         // Get a list of blog posts from this category
         $blogs = array();
         if (EB::cache()->exists($category->id, 'cats')) {
             $data = EB::cache()->get($category->id, 'cats');
             if (isset($data['post'])) {
                 $blogs = $data['post'];
             }
         } else {
             $blogs = $model->getPosts($filterCategories, $limit);
         }
         // Format the blog posts
         $blogs = EB::formatter('list', $blogs);
         // Assign other attributes to the category object
         $category->blogs = $blogs;
         // Get the total number of posts in the category
         if (!isset($category->cnt)) {
             $category->cnt = $model->getTotalPostCount($filterCategories);
         }
         // Get a list of active authors within this category.
         $category->authors = $category->getActiveBloggers();
         // Check isCategorySubscribed
         $category->isCategorySubscribed = $model->isCategorySubscribedEmail($category->id, $this->my->email);
         $categories[] = $category;
     }
     return $categories;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:73,代码来源:categories.php

示例15: getArchivePostByMonth


//.........这里部分代码省略.........
     if (EB::easysocial()->exists() && $config->get('integrations_easysocial_privacy') && !EB::isSiteAdmin()) {
         $esPrivacyQuery = EB::easysocial()->buildPrivacyQuery('a');
         $privateBlog .= $esPrivacyQuery;
     } else {
         if ($config->get('main_jomsocial_privacy') && EB::jomsocial()->exists() && !EB::isSiteAdmin()) {
             $friendsModel = CFactory::getModel('Friends');
             $friends = $friendsModel->getFriendIds($user->id);
             // Insert query here.
             $privateBlog .= ' AND (';
             $privateBlog .= ' (a.`access`= 0 ) OR';
             $privateBlog .= ' ( (a.`access` = 20) AND (' . $db->Quote($user->id) . ' > 0 ) ) OR';
             if (!$friends) {
                 $privateBlog .= ' ( (a.`access` = 30) AND ( 1 = 2 ) ) OR';
             } else {
                 $privateBlog .= ' ( (a.`access` = 30) AND ( a.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
             }
             $privateBlog .= ' ( (a.`access` = 40) AND ( a.' . $db->nameQuote('created_by') . '=' . $user->id . ') )';
             $privateBlog .= ' )';
         } else {
             if ($user->id == 0) {
                 $privateBlog .= ' AND a.`access` = ' . $db->Quote(0);
             }
         }
     }
     // Join the query ?
     $privateBlog = $showPrivate ? '' : $privateBlog;
     $isJSGrpPluginInstalled = false;
     $isJSGrpPluginInstalled = JPluginHelper::isEnabled('system', 'groupeasyblog');
     $isEventPluginInstalled = JPluginHelper::isEnabled('system', 'eventeasyblog');
     $isJSInstalled = false;
     // need to check if the site installed jomsocial.
     if (EB::jomsocial()->exists()) {
         $isJSInstalled = true;
     }
     $includeJSGrp = $isJSGrpPluginInstalled && $isJSInstalled ? true : false;
     $includeJSEvent = $isEventPluginInstalled && $isJSInstalled ? true : false;
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = ' AND ( (a.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_SITEWIDE) . ') ';
     if ($config->get('main_includeteamblogpost')) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a');
     }
     if ($includeJSEvent) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, 'a');
     }
     if ($includeJSGrp) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, 'a');
     }
     if (EB::easysocial()->exists()) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, 'a');
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'a');
     }
     $contributeSQL .= ')';
     $queryWhere .= $contributeSQL;
     //get teamblogs id.
     $query = '';
     $extraSQL = '';
     // If this is on blogger mode, we need to only pick items from the blogger.
     $blogger = EBR::isBloggerMode();
     if ($blogger !== false) {
         $extraSQL = ' AND a.`created_by` = ' . $db->Quote($blogger);
     }
     $tzoffset = EB::date()->getOffSet(true);
     $query = 'SELECT a.*, DAY( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS day,';
     $query .= ' MONTH( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS month,';
     $query .= ' YEAR( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) ) AS year ';
     $query .= ' FROM ' . $db->nameQuote('#__easyblog_post') . ' as a';
     $query .= ' WHERE a.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED) . ' ';
     $query .= ' AND a.' . $db->quoteName('state') . ' = ' . $db->Quote(EASYBLOG_POST_NORMAL) . ' ';
     $query .= $privateBlog . ' ';
     $query .= ' AND (a.`created` > ' . $db->Quote($year . '-' . $month . '-01 00:00:00') . ' AND a.`created` < ' . $db->Quote($year . '-' . $month . '-31 23:59:59') . ') ';
     // If do not display private posts, we need to append additional queries here.
     if (!$showPrivate) {
         // sql for category access
         $catLib = EB::category();
         $catAccessSQL = $catLib->genAccessSQL('a.`id`');
         $query .= ' AND (' . $catAccessSQL . ')';
     }
     $query .= $extraSQL . ' ';
     $query .= $queryWhere;
     $query .= ' ORDER BY a.`created` ASC ';
     // echo $query;exit;
     $db->setQuery($query);
     $result = $db->loadObjectList();
     $postCount = new EasyblogCalendarObject($month, $year);
     if (!empty($result)) {
         foreach ($result as $row) {
             $post = EB::post($row->id);
             // $post->bind($row);
             $post = EB::formatter('entry', $post);
             // var_dump($row);exit;
             if ($postCount->{$year}->{$month}->{$row->day} == 0) {
                 $postCount->{$year}->{$month}->{$row->day} = array($post);
             } else {
                 array_push($postCount->{$year}->{$month}->{$row->day}, $post);
             }
         }
     }
     return $postCount;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:archive.php


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