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


PHP EB::pagination方法代码示例

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


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

示例1: getPagination

 /**
  * Method to get a pagination object for the categories
  *
  * @access public
  * @return integer
  */
 function getPagination()
 {
     // Lets load the content if it doesn't already exist
     if (empty($this->_pagination)) {
         jimport('joomla.html.pagination');
         $this->_pagination = EB::pagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit'));
     }
     return $this->_pagination;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:oauth.php

示例2: getPagination

 /**
  * Method to get a pagination object for the categories
  *
  * @access public
  * @return integer
  */
 public function getPagination()
 {
     if ($this->pagination) {
         return $this->pagination;
     }
     jimport('joomla.html.pagination');
     $this->pagination = EB::pagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit'));
     return $this->pagination;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:drafts.php

示例3: getArchive


//.........这里部分代码省略.........
     }
     if ($includeJSEvent) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT, 'a');
     }
     if ($includeJSGrp) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_JOMSOCIAL_GROUP, 'a');
     }
     $contributeSQL .= ')';
     $queryWhere .= $contributeSQL;
     //get teamblogs id.
     $query = '';
     if (!empty($modCid)) {
         $catAccess['include'] = $modCid;
     }
     //do not list out protected blog in rss
     if (JRequest::getCmd('format', '') == 'feed') {
         if ($config->get('main_password_protect', true)) {
             $queryWhere .= ' AND a.`blogpassword`="" ';
         }
     }
     //blog privacy setting
     // @integrations: jomsocial privacy
     $file = JPATH_ROOT . '/components/com_community/libraries/core.php';
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_privacy') && $easysocial->exists() && !EB::isSiteAdmin()) {
         $esPrivacyQuery = $easysocial->buildPrivacyQuery('a');
         $queryWhere .= $esPrivacyQuery;
     } else {
         if ($config->get('main_jomsocial_privacy') && JFile::exists($file) && !EB::isSiteAdmin()) {
             require_once $file;
             $my = JFactory::getUser();
             $jsFriends = CFactory::getModel('Friends');
             $friends = $jsFriends->getFriendIds($my->id);
             // Insert query here.
             $queryWhere .= ' AND (';
             $queryWhere .= ' (a.`access`= 0 ) OR';
             $queryWhere .= ' ( (a.`access` = 20) AND (' . $db->Quote($my->id) . ' > 0 ) ) OR';
             if (empty($friends)) {
                 $queryWhere .= ' ( (a.`access` = 30) AND ( 1 = 2 ) ) OR';
             } else {
                 $queryWhere .= ' ( (a.`access` = 30) AND ( a.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
             }
             $queryWhere .= ' ( (a.`access` = 40) AND ( a.' . $db->nameQuote('created_by') . '=' . $my->id . ') )';
             $queryWhere .= ' )';
         } else {
             if ($my->id == 0) {
                 $queryWhere .= ' AND a.`access` = ' . $db->Quote(BLOG_PRIVACY_PUBLIC);
             }
         }
     }
     if (empty($archiveDay)) {
         $fromDate = $archiveYear . '-' . $archiveMonth . '-01 00:00:00';
         $toDate = $archiveYear . '-' . $archiveMonth . '-31 23:59:59';
     } else {
         $fromDate = $archiveYear . '-' . $archiveMonth . '-' . $archiveDay . ' 00:00:00';
         $toDate = $archiveYear . '-' . $archiveMonth . '-' . $archiveDay . ' 23:59:59';
     }
     // When language filter is enabled, we need to detect the appropriate contents
     $filterLanguage = JFactory::getApplication()->getLanguageFilter();
     if ($filterLanguage) {
         $queryWhere .= EBR::getLanguageQuery('AND', 'a.language');
     }
     $tzoffset = EB::date()->getOffSet(true);
     $queryWhere .= ' AND ( DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) >= ' . $db->Quote($fromDate) . ' AND DATE_ADD(a.`created`, INTERVAL ' . $tzoffset . ' HOUR) <= ' . $db->Quote($toDate) . ' ) ';
     if ($isBloggerMode !== false) {
         $queryWhere .= ' AND a.`created_by` = ' . $db->Quote($isBloggerMode);
     }
     // category access here
     //category access
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('a.`id`', $catAccess);
     $queryWhere .= ' AND (' . $catAccessSQL . ')';
     //ordering
     $queryOrder = ' ORDER BY a.`created` DESC';
     //limit
     $limit = $this->getState('limit');
     $limitstart = $this->getState('limitstart');
     $queryLimit = ' LIMIT ' . $limitstart . ',' . $limit;
     //set pagination
     $query = 'SELECT COUNT(1) FROM `#__easyblog_post` AS a';
     $query .= $queryWhere;
     $db->setQuery($query);
     $this->_total = $db->loadResult();
     jimport('joomla.html.pagination');
     $this->_pagination = EB::pagination($this->_total, $limitstart, $limit);
     //get archive
     $query = 'SELECT a.*';
     $query .= ' FROM `#__easyblog_post` AS a';
     $query .= $queryWhere;
     $query .= $queryExclude;
     $query .= $queryInclude;
     $query .= $queryOrder;
     $query .= $queryLimit;
     $db->setQuery($query);
     if ($db->getErrorNum() > 0) {
         JError::raiseError($db->getErrorNum(), $db->getErrorMsg() . $db->stderr());
     }
     $result = $db->loadObjectList();
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:archive.php

示例4: getAssociationPosts

 public function getAssociationPosts($options = array())
 {
     $db = EB::db();
     $query = "select a.* from `#__easyblog_post` as a";
     $query .= " WHERE a." . $db->quoteName('published') . " = " . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= " AND a." . $db->quoteName('state') . " = " . $db->Quote(EASYBLOG_POST_NORMAL);
     if (isset($options['langcode']) && $options['langcode']) {
         $query .= " AND a." . $db->quoteName('language') . " = " . $db->Quote($options['langcode']);
     }
     if (isset($options['userid']) && $options['userid']) {
         $query .= " AND a." . $db->quoteName('created_by') . " = " . $db->Quote($options['userid']);
     }
     if (isset($options['search']) && $options['search']) {
         $query .= " AND a." . $db->quoteName('title') . " LIKE " . $db->Quote('%' . $options['search'] . '%');
     }
     // limits
     $limit = EB::call('Pagination', 'getLimit', array('listlength'));
     $limitstart = JRequest::getInt('limitstart', 0, 'REQUEST');
     // In case limit has been changed, adjust it
     $limitstart = (int) ($limit != 0 ? floor($limitstart / $limit) * $limit : 0);
     if ($limitstart < 0) {
         $limitstart = 0;
     }
     $queryLimit = " LIMIT " . $limitstart . "," . $limit;
     // total count
     $queryCnt = "SELECT COUNT(1) from (";
     $queryCnt .= $query;
     $queryCnt .= ") as x";
     $db->setQuery($queryCnt);
     $this->_total = $db->loadResult();
     $this->_pagination = EB::pagination($this->_total, $limitstart, $limit);
     $query = $query . $queryLimit;
     $db->setQuery($query);
     $results = $db->loadObjectList();
     return $results;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:36,代码来源:blog.php

示例5: getCompojoomComment

 /**
  *
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getCompojoomComment($max = 0, $userId = 0, $sort = 'latest', $base = 'comment', $search = '', $published = 'all')
 {
     $db = EB::db();
     $queryPagination = false;
     $queryLimit = '';
     $queryOrder = ' ORDER BY a.`date` DESC';
     $queryWhere = '';
     switch ($sort) {
         case 'latest':
         default:
             $queryOrder = ' ORDER BY a.`date` DESC';
             break;
     }
     if (!empty($userId)) {
         if ($base == 'comment') {
             $queryWhere .= ' WHERE a.`userid` = ' . $db->Quote($userId);
         } else {
             $queryWhere .= ' WHERE b.`created_by` = ' . $db->Quote($userId);
         }
     }
     switch ($published) {
         case 'published':
             $queryWhere .= ' AND a.`published` = ' . $db->Quote('1');
             break;
         case 'unpublished':
             $queryWhere .= ' AND a.`published` = ' . $db->Quote('0');
             break;
         case 'moderate':
             $queryWhere .= ' AND a.`published` = ' . $db->Quote('2');
             break;
         case 'all':
         default:
             break;
     }
     if (!empty($search)) {
         $queryWhere .= !empty($queryWhere) ? ' AND' : ' WHERE';
         $queryWhere .= ' a.`comment` LIKE ' . $db->Quote('%' . $search . '%');
     }
     $queryWhere .= ' AND a.`component` = ' . $db->quote('com_easyblog');
     if ($max > 0) {
         $queryLimit = ' LIMIT ' . $max;
     } else {
         $limit = $this->getState('limit');
         $limitstart = $this->getState('limitstart');
         $queryLimit = ' LIMIT ' . $limitstart . ',' . $limit;
         $queryPagination = true;
     }
     if ($queryPagination) {
         $query = 'SELECT COUNT(1)';
         $query .= ' FROM `#__comment` AS a INNER JOIN `#__easyblog_post` AS b';
         $query .= ' ON a.`contentid` = b.`id`';
         $query .= $queryWhere;
         $db->setQuery($query);
         $this->_total = $db->loadResult();
         jimport('joomla.html.pagination');
         $this->_pagination = EB::pagination($this->_total, $limitstart, $limit);
     }
     $query = 'SELECT' . ' a.`id` AS `id`,' . ' a.`contentid` AS `post_id`,' . ' a.`comment` AS `comment`,' . ' a.`name` AS `name`,' . ' a.`title` AS `title`,' . ' a.`email` AS `email`,' . ' a.`website` AS `url`,' . ' a.`ip` AS `ip`,' . ' a.`userid` AS `created_by`,' . ' a.`date` AS `created`,' . ' a.`date` AS `modified`,' . ' a.`published` AS `published`,' . ' ' . $db->quote('0000-00-00 00:00:00') . ' AS `publish_up`,' . ' ' . $db->quote('0000-00-00 00:00:00') . ' AS `publish_down`,' . ' ' . $db->quote('0') . ' AS `ordering`,' . ' a.`voting_yes` AS `vote`,' . ' ' . $db->quote('0') . ' AS `hits`,' . ' ' . $db->quote('1') . ' AS `sent`,' . ' ' . $db->quote('0') . ' AS `parent_id`,' . ' ' . $db->quote('0') . ' AS `lft`,' . ' ' . $db->quote('0') . ' AS `rgt`,' . ' b.`created_by` AS `blog_owner`, b.`title` AS `blog_title`' . ' FROM `#__comment` AS a INNER JOIN `#__easyblog_post` AS b' . ' ON a.`contentid` = b.`id`' . $queryWhere . $queryOrder . $queryLimit;
     $db->setQuery($query);
     $result = $db->loadObjectList();
     if ($db->getErrorNum() > 0) {
         JError::raiseError($db->getErrorNum(), $db->getErrorMsg() . $db->stderr());
     }
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:73,代码来源:comment.php

示例6: getPosts

 /**
  * Retrieve a list of blog posts from a specific list of categories
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPosts($categories, $limit = null)
 {
     $db = EB::db();
     $my = JFactory::getUser();
     $config = EB::config();
     // Determines if this is currently on blogger mode
     $isBloggerMode = EasyBlogRouter::isBloggerMode();
     // use in generating category access sql
     $catAccess = array();
     $catAccess['include'] = $categories;
     $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');
     }
     // Test if easysocial exists on the site
     if (EB::easysocial()->exists()) {
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_GROUP, 'a');
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'a');
     }
     $contributeSQL .= ')';
     $query = array();
     $query[] = 'SELECT a.* FROM ' . $db->quoteName('#__easyblog_post') . ' AS a';
     // Build the WHERE clauses
     $query[] = 'WHERE a.' . $db->quoteName('published') . '=' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query[] = 'AND a.' . $db->quoteName('state') . '=' . $db->Quote(EASYBLOG_POST_NORMAL);
     // If this is on blogger mode, fetch items created by the current author only
     if ($isBloggerMode !== false) {
         $query[] = ' AND a.' . $db->quoteName('created_by') . '=' . $db->Quote($isBloggerMode);
     } else {
         // Get the author id based on the category menu
         $authorId = EB::getCategoryMenuBloggerId();
         if ($authorId) {
             $query[] = ' AND a.' . $db->quoteName('created_by') . '=' . $db->Quote($authorId);
         }
     }
     //sql for blog contribution
     $query[] = $contributeSQL;
     // sql for category access
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('a.`id`', $catAccess);
     $query[] = 'AND (' . $catAccessSQL . ')';
     // If user is a guest, ensure that they can really view the blog post
     if ($this->my->guest) {
         $query[] = 'AND a.' . $db->quoteName('access') . '=' . $db->Quote(BLOG_PRIVACY_PUBLIC);
     }
     // Ensure that the blog posts is available site wide
     // $query[] = 'AND a.' . $db->quoteName('source_id') . '=' . $db->Quote('0');
     // Filter by language
     $language = EB::getCurrentLanguage();
     if ($language) {
         $query[] = 'AND (a.' . $db->quoteName('language') . '=' . $db->Quote($language) . ' OR a.' . $db->quoteName('language') . '=' . $db->Quote('*') . ' OR a.' . $db->quoteName('language') . '=' . $db->Quote('') . ')';
     }
     // Ordering options
     $ordering = $config->get('layout_postsort', 'DESC');
     // Order the posts
     $query[] = 'ORDER BY a.' . $db->quoteName('created') . ' ' . $ordering;
     // Set the pagination
     if (!is_null($limit)) {
         // Glue back the sql queries into a single string.
         $queryCount = implode(' ', $query);
         $queryCount = str_ireplace('SELECT a.*', 'SELECT COUNT(1)', $queryCount);
         $db->setQuery($queryCount);
         $count = $db->loadResult();
         $limit = $limit == 0 ? $this->getState('limit') : $limit;
         $limitstart = $this->input->get('limitstart', $this->getState('limitstart'), 'int');
         // Set the limit
         $query[] = 'LIMIT ' . $limitstart . ',' . $limit;
         $this->_pagination = EB::pagination($count, $limitstart, $limit);
     }
     // Glue back the sql queries into a single string.
     $query = implode(' ', $query);
     // Debug
     // echo str_ireplace('#__', 'jos_', $query);exit;
     $db->setQuery($query);
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:category.php

示例7: getItems

 /**
  * Retrieves a list of templates
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getItems($options = array())
 {
     $db = EB::db();
     $query = 'SELECT * FROM ' . $db->quoteName('#__easyblog_post_templates');
     if (isset($options['user_id'])) {
         $query .= ' WHERE ' . $db->quoteName('user_id') . '=' . $db->Quote($options['user_id']);
     }
     $query .= ' ORDER BY ' . $db->quoteName('id') . ' DESC';
     $db->setQuery($query);
     $result = $db->loadObjectList();
     // Get the total for pagination
     $query = str_ireplace('*', 'COUNT(1)', $query);
     $db->setQuery($query);
     $total = $db->loadResult();
     $this->pagination = EB::pagination($total, $this->getState('limitstart'), $this->getState('limit'));
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:25,代码来源:templates.php

示例8: getBloggers


//.........这里部分代码省略.........
     // check if there is exclusion from the backend settings OR from the parameter
     if (!empty($excluded) || !empty($exclusion)) {
         $tmp = explode(',', $excluded);
         if (!empty($excluded) && !empty($exclusion)) {
             $tmp = array_merge($tmp, $exclusion);
         }
         $values = array();
         foreach ($tmp as $id) {
             $values[] = $db->Quote($id);
         }
         $excludedQuery = ' AND a.`id` NOT IN (' . implode(',', $values) . ')';
     }
     //inclusion blogger
     $includedQuery = '';
     if (!empty($inclusion)) {
         $values = array();
         foreach ($inclusion as $id) {
             $values[] = $db->Quote($id);
         }
         $includedQuery = ' AND a.id IN (' . implode(',', $values) . ')';
     }
     $searchQuery = '';
     if (!empty($search)) {
         $searchQuery .= ' AND ';
         switch ($nameDisplayFormat) {
             case 'name':
                 $searchQuery .= '`name` LIKE ' . $db->Quote('%' . $search . '%');
                 break;
             case 'username':
                 $searchQuery .= '`username` LIKE ' . $db->Quote('%' . $search . '%');
                 break;
             default:
                 $searchQuery .= '`nickname` LIKE ' . $db->Quote('%' . $search . '%');
                 break;
         }
     }
     $aclQuery = EB::AclHelper()->genIsbloggerSQL();
     // $query  = 'select count( p.id ) as `totalPost`, MAX(p.`created`) as `latestPostDate`, COUNT( DISTINCT(g.content_id) ) as `featured`,';
     $query = 'select SQL_CALC_FOUND_ROWS count( p.id ) as `totalPost`, MAX(p.`created`) as `latestPostDate`, COUNT( DISTINCT(g.content_id) ) as `featured`,';
     $query .= ' a.`id`, b.`nickname`, a.`name`, a.`username`, a.`registerDate`, a.`lastvisitDate`, b.`permalink`';
     $query .= '	from `#__users` as a';
     $query .= ' 	left join `#__easyblog_post` as p on a.`id` = p.`created_by`';
     $query .= ' 	inner JOIN `#__easyblog_users` AS `b` ON p.`created_by` = b.`id`';
     $query .= ' 	left join `#__easyblog_featured` AS `g` ON a.`id`= g.`content_id` AND g.`type`= ' . $db->Quote('blogger');
     $query .= ' where (' . $aclQuery . ')';
     $query .= ' and `p`.`published` = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= ' and p.`state` = ' . $db->Quote(EASYBLOG_POST_NORMAL);
     if ($featuredOnly) {
         $query .= ' and a.`id` = g.`content_id`';
     }
     $query .= $excludedQuery;
     $query .= $includedQuery;
     $query .= $searchQuery;
     $query .= ' group by a.`id`';
     if ($filter == 'showbloggerwithpost') {
         $query .= ' having (count(p.id) > 0)';
     }
     switch ($sort) {
         case 'featured':
             $query .= ' ORDER BY `featured` DESC';
             break;
         case 'latestpost':
             $query .= '	ORDER BY `latestPostDate` DESC';
             break;
         case 'latest':
             $query .= '	ORDER BY a.`registerDate` DESC';
             break;
         case 'postcount':
             $query .= '	ORDER BY `totalPost` DESC';
             break;
         case 'active':
             $query .= ' ORDER BY a.`lastvisitDate` DESC';
             break;
         case 'alphabet':
             if ($nameDisplayFormat == 'name') {
                 $query .= '	ORDER BY a.`name` ASC';
             } else {
                 if ($nameDisplayFormat == 'username') {
                     $query .= '	ORDER BY a.`username` ASC';
                 } else {
                     $query .= '	ORDER BY b.`nickname` ASC';
                 }
             }
             break;
         default:
             break;
     }
     $query .= $limitSQL;
     $db->setQuery($query);
     $results = $db->loadObjectList();
     // now execute found_row() to get the number of records found.
     $cntQuery = 'select FOUND_ROWS()';
     $db->setQuery($cntQuery);
     $this->_total = $db->loadResult();
     if (empty($this->_pagination)) {
         jimport('joomla.html.pagination');
         $this->_pagination = EB::pagination($this->_total, $limitstart, $limit);
     }
     return $results;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:blogger.php

示例9: getCategoriesHierarchy

 public function getCategoriesHierarchy($useLimit = true)
 {
     $db = EB::db();
     $limit = '10';
     $limitstart = $this->getState('limitstart');
     $search = JRequest::getVar('search', '');
     $gid = EasyBlogHelper::getUserGids();
     $gids = '';
     if (count($gid) > 0) {
         foreach ($gid as $id) {
             $gids .= empty($gids) ? $db->Quote($id) : ',' . $db->Quote($id);
         }
     }
     $query = 'SELECT a.*, ( SELECT COUNT(id) FROM `#__easyblog_category` WHERE `lft` < a.`lft` AND `rgt` > a.`rgt`) AS depth';
     $query .= ' FROM `#__easyblog_category` AS a';
     $query .= ' WHERE a.`published` = ' . $db->Quote('1');
     if (!empty($search)) {
         $query .= ' AND a.`title` LIKE ' . $db->Quote('%' . $search . '%');
     }
     $query .= ' and a.id not in (';
     $query .= ' select id from `#__easyblog_category` as c';
     $query .= ' where not exists (';
     $query .= '		select b.category_id from `#__easyblog_category_acl` as b';
     $query .= '			where b.category_id = c.id and b.`acl_id` = ' . $db->Quote(CATEGORY_ACL_ACTION_SELECT);
     $query .= '			and b.type = ' . $db->Quote('group');
     $query .= '			and b.content_id IN (' . $gids . ')';
     $query .= '      )';
     $query .= ' and c.`private` = ' . $db->Quote(CATEGORY_PRIVACY_ACL);
     $query .= ')';
     $query .= ' AND a.`parent_id` NOT IN (SELECT `id` FROM `#__easyblog_category` AS e WHERE e.`published` = ' . $db->Quote('0') . ' AND e.`parent_id` = ' . $db->Quote('0') . ' )';
     $query .= ' ORDER BY a.`lft`';
     if ($useLimit) {
         $this->_total = $this->_getListCount($query);
         jimport('joomla.html.pagination');
         $this->_pagination = EB::pagination($this->_total, $limitstart, $limit);
         $query .= ' LIMIT ' . $limitstart . ', ' . $limit;
     }
     $db->setQuery($query);
     $result = $db->loadObjectList();
     return $result;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:41,代码来源:categories.php

示例10: getPagination

 /**
  * Method to get a pagination object for the events
  *
  * @access public
  * @return integer
  */
 public function getPagination()
 {
     jimport('joomla.html.pagination');
     $this->_pagination = EB::pagination($this->_total, $this->getState('limitstart'), $this->getState('limit'));
     return $this->_pagination;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:12,代码来源:maintenance.php

示例11: getPosts

 /**
  * Retrieves a list of posts from a specific team
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPosts($id, $limit = null)
 {
     //lets check if posts already cached or not.
     if (EB::cache()->exists($id, 'teamblogs')) {
         $data = EB::cache()->get($id, 'teamblogs');
         if (isset($data['post'])) {
             return $data['post'];
         } else {
             return array();
         }
     }
     $db = EB::db();
     $config = EB::config();
     $query = array();
     $options = array('teamId' => $id, 'concateOperator' => 'AND');
     // contribution type sql
     $contributor = EB::contributor();
     $contributeSQL = '';
     $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_TEAM, 'a', $options);
     $query[] = 'SELECT a.* FROM ' . $db->quoteName('#__easyblog_post') . ' AS a';
     $query[] = 'where a.' . $db->quoteName('published') . '=' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query[] = 'and a.' . $db->quoteName('state') . '=' . $db->Quote(EASYBLOG_POST_NORMAL);
     $query[] = $contributeSQL;
     // category access here
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('a.`id`');
     $query[] = 'AND (' . $catAccessSQL . ')';
     // Ordering options
     $ordering = $config->get('layout_teamblogsort', 'DESC');
     $query[] = ' ORDER BY a.' . $db->quoteName('created') . ' ' . $ordering;
     if (!is_null($limit) && $limit) {
         // Glue back the sql queries into a single string.
         $queryCount = implode(' ', $query);
         $queryCount = str_ireplace('SELECT a.*', 'SELECT COUNT(1)', $queryCount);
         $db->setQuery($queryCount);
         $count = $db->loadResult();
         $limit = $limit == 0 ? $this->getState('limit') : $limit;
         $limitstart = $this->input->get('limitstart', $this->getState('limitstart'), 'int');
         // Set the limit
         $query[] = 'LIMIT ' . $limitstart . ',' . $limit;
         $this->_pagination = EB::pagination($count, $limitstart, $limit);
     } else {
         // TODO: prepare the pagination object
     }
     $query = implode(' ', $query);
     // Debug
     // echo str_ireplace('#__', 'jos_', $query);exit;
     $db->setQuery($query);
     $result = $db->loadObjectList();
     return $result;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:59,代码来源:teamblogs.php

示例12: getTaggedBlogs


//.........这里部分代码省略.........
         $contributeSQL .= $contributor::genAccessSQL(EASYBLOG_POST_SOURCE_EASYSOCIAL_EVENT, 'b');
     }
     $contributeSQL .= ')';
     //get teamblogs id.
     $query = 'SELECT b.*';
     $query .= ' FROM ' . $db->nameQuote('#__easyblog_post_tag') . ' AS a ';
     $query .= ' INNER JOIN ' . $db->nameQuote('#__easyblog_post') . ' AS b ';
     $query .= ' ON a.post_id=b.id ';
     $query .= ' WHERE a.' . $db->quoteName('tag_id') . ' = ' . $db->Quote($tagId);
     $query .= ' AND b.' . $db->quoteName('published') . ' = ' . $db->Quote(EASYBLOG_POST_PUBLISHED);
     $query .= ' AND b.' . $db->quoteName('state') . '=' . $db->Quote(EASYBLOG_POST_NORMAL);
     $query .= $contributeSQL;
     // @rule: When language filter is enabled, we need to detect the appropriate contents
     $filterLanguage = JFactory::getApplication()->getLanguageFilter();
     if ($filterLanguage) {
         $query .= EBR::getLanguageQuery('AND', 'b.language');
     }
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     //blog privacy setting
     if ($config->get('main_jomsocial_privacy') && JFile::exists($file) && !EasyBlogHelper::isSiteAdmin()) {
         require_once $file;
         $jsFriends = CFactory::getModel('Friends');
         $friends = $jsFriends->getFriendIds($my->id);
         array_push($friends, $my->id);
         // Insert query here.
         $query .= ' AND (';
         $query .= ' (b.`access`= 0 ) OR';
         $query .= ' ( (b.`access` = 20) AND (' . $db->Quote($my->id) . ' > 0 ) ) OR';
         if (empty($friends)) {
             $query .= ' ( (b.`access` = 30) AND ( 1 = 2 ) ) OR';
         } else {
             $query .= ' ( (b.`access` = 30) AND ( b.' . $db->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
         }
         $query .= ' ( (b.`access` = 40) AND ( b.' . $db->nameQuote('created_by') . '=' . $my->id . ') )';
         $query .= ' )';
     } else {
         if ($my->id == 0) {
             $query .= ' AND b.`access` = ' . $db->Quote(BLOG_PRIVACY_PUBLIC);
         }
     }
     if ($isBloggerMode !== false) {
         $query .= ' AND b.`created_by` = ' . $db->Quote($isBloggerMode);
     }
     $includeCats = array();
     $includeCatIds = trim($includeCatIds);
     if (!empty($includeCatIds)) {
         $includeCats = explode(',', $includeCatIds);
         if (!empty($includeCats)) {
             $catAccess['include'] = $includeCats;
         }
     }
     // category access
     $catLib = EB::category();
     $catAccessSQL = $catLib->genAccessSQL('b.`id`', $catAccess);
     $query .= ' AND (' . $catAccessSQL . ')';
     $sort = $config->get('layout_postorder', 'latest');
     $defaultSorting = $config->get('layout_postsort', 'desc');
     if ($sorting) {
         $defaultSorting = $sorting;
     }
     switch ($sort) {
         case 'latest':
             $queryOrder = ' ORDER BY b.`created` ' . $defaultSorting;
             break;
         case 'published':
             $queryOrder = ' ORDER BY b.`publish_up` ' . $defaultSorting;
             break;
         case 'popular':
             $queryOrder = ' ORDER BY b.`hits` ' . $defaultSorting;
             break;
         case 'active':
             $queryOrder = ' ORDER BY b.`publish_down` ' . $defaultSorting;
             break;
         case 'alphabet':
             $queryOrder = ' ORDER BY b.`title` ' . $defaultSorting;
             break;
         case 'modified':
             $queryOrder = ' ORDER BY b.`modified` ' . $defaultSorting;
             break;
         case 'random':
             $queryOrder = ' ORDER BY RAND() ';
             break;
         default:
             break;
     }
     $query .= $queryOrder;
     //total tag's post sql
     $totalQuery = 'SELECT COUNT(1) FROM (';
     $totalQuery .= $query;
     $totalQuery .= ') as x';
     $query .= ' LIMIT ' . $limitstart . ',' . $limit;
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $db->setQuery($totalQuery);
     $db->loadResult();
     $this->_total = $db->loadResult();
     jimport('joomla.html.pagination');
     $this->_pagination = EB::pagination($this->_total, $limitstart, $limit);
     return $rows;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:blog.php

示例13: getRequests

 /**
  * Retrieves a list of team blog requests
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getRequests($userId = '', $useLimit = true)
 {
     $db = EB::db();
     $limit = $this->getState('limit');
     $limitstart = $this->getState('limitstart');
     // common query
     $cquery = '';
     // If user id is provided, we assume that the user is a team admin and not a site admin
     if (!empty($userId)) {
         $cquery .= ' inner join `#__easyblog_team_users` as b';
         $cquery .= '    on a.`team_id` = b.`team_id`';
         $cquery .= '    and b.`user_id` = ' . $db->Quote($userId);
         $cquery .= '    and b.`isadmin` = ' . $db->Quote('1');
     }
     $cquery .= '  inner join `#__easyblog_team` as c on a.`team_id` = c.`id`';
     $cquery .= ' where a.`ispending` = ' . $db->Quote('1');
     $query = 'select count(1) from `#__easyblog_team_request` as a';
     $query .= $cquery;
     $db->setQuery($query);
     $this->_total = $db->loadResult();
     jimport('joomla.html.pagination');
     $this->_pagination = EB::pagination($this->_total, $limitstart, $limit);
     // Actual query
     $query = 'select a.*, c.`title` from `#__easyblog_team_request` as a';
     $query .= $cquery;
     $query .= ' order by a.`created`';
     if ($useLimit) {
         $query .= ' LIMIT ' . $limitstart . ',' . $limit;
     }
     $db->setQuery($query);
     $result = $db->loadObjectList();
     return $result;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:41,代码来源:teamblogs.php


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