本文整理汇总了PHP中EasyBlogHelper::getViewableTeamIds方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::getViewableTeamIds方法的具体用法?PHP EasyBlogHelper::getViewableTeamIds怎么用?PHP EasyBlogHelper::getViewableTeamIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::getViewableTeamIds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isTeamBlogJoined
public static function isTeamBlogJoined($userId, $teamId)
{
$teamIds = EasyBlogHelper::getViewableTeamIds($userId);
return in_array($teamId, $teamIds);
}
示例2: _buildQuery
function _buildQuery()
{
$db = EasyBlogHelper::db();
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
// used for privacy
$queryWhere = '';
$queryExclude = '';
$queryExcludePending = '';
$excludeCats = array();
$isBloggerMode = EasyBlogRouter::isBloggerMode();
$where = array();
$where2 = array();
$text = JRequest::getVar('query');
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word) {
$word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
$where[] = 'a.`title` LIKE ' . $word;
$where[] = 'a.`content` LIKE ' . $word;
$where[] = 'a.`intro` LIKE ' . $word;
$where2[] = 't.title LIKE ' . $word;
$wheres2[] = implode(' OR ', $where2);
$wheres[] = implode(' OR ', $where);
}
$where = '(' . implode(') OR (', $wheres) . ')';
$where2 = '(' . implode(') OR (', $wheres2) . ')';
//get teamblogs id.
$teamBlogIds = '';
$query = '';
if ($config->get('main_includeteamblogpost')) {
$teamBlogIds = EasyBlogHelper::getViewableTeamIds();
if (count($teamBlogIds) > 0) {
$teamBlogIds = implode(',', $teamBlogIds);
}
}
// get all private categories id
$excludeCats = EasyBlogHelper::getPrivateCategories();
if (!empty($excludeCats)) {
$queryWhere .= ' AND a.`category_id` NOT IN (' . implode(',', $excludeCats) . ')';
}
$jsPostIds = self::getJomSocialPosts();
if ($config->get('main_includeteamblogpost') && !empty($teamBlogIds)) {
if (!empty($jsPostIds)) {
$tmpIds = implode(',', $jsPostIds);
$queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
} else {
$queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
}
} else {
if (!empty($jsPostIds)) {
$tmpIds = implode(',', $jsPostIds);
$queryWhere .= ' AND (a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
} else {
$queryWhere .= ' AND a.`issitewide` = ' . $db->Quote('1');
}
}
if ($isBloggerMode) {
$queryWhere .= ' AND a.`created_by`=' . $db->Quote($isBloggerMode);
}
$query = 'SELECT a.*, b.`title` AS `category` , CONCAT(a.`content` , a.`intro`) AS text';
$query .= ' FROM `#__easyblog_post` as a USE INDEX (`easyblog_post_search`)';
if ($config->get('main_includeteamblogpost')) {
$query .= ' LEFT JOIN `#__easyblog_team_post` AS u ON a.id = u.post_id';
}
$query .= ' LEFT JOIN `#__easyblog_category` AS b';
$query .= ' ON a.category_id = b.id';
// Always inner join with jos_users and a.created_by so that only valid blogs are loaded
$query .= ' INNER JOIN ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__users') . ' AS c ON a.`created_by`=c.`id`';
$query .= ' WHERE (' . $where;
$query .= ' OR a.`id` IN( ';
$query .= ' SELECT tp.`post_id` FROM `#__easyblog_tag` AS t ';
$query .= ' INNER JOIN `#__easyblog_post_tag` AS tp ON tp.`tag_id` = t.`id` ';
$query .= ' WHERE ' . $where2;
$query .= ') )';
if ($my->id < 1) {
//guest should only see public post.
$query .= ' AND a.`private` = ' . $db->Quote('0');
}
//do not show unpublished post
$query .= ' AND a.`published` = ' . $db->Quote('1');
$query .= $queryWhere;
$query .= ' ORDER BY a.`created` DESC';
// echo $query;
return $query;
}
示例3: getArchivePostByMonth
function getArchivePostByMonth($month = '', $year = '', $showPrivate = false)
{
$db = EasyBlogHelper::db();
$user = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
// used for privacy
$queryWhere = '';
$queryExclude = '';
$queryExcludePending = '';
$excludeCats = array();
if ($user->id == 0) {
$showPrivate = false;
}
if (!$showPrivate) {
$excludeCats = EasyBlogHelper::getPrivateCategories();
}
//blog privacy setting
// @integrations: jomsocial privacy
$privateBlog = '';
$file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
$easysocial = EasyBlogHelper::getHelper('EasySocial');
if ($config->get('integrations_easysocial_privacy') && $easysocial->exists() && !EasyBlogHelper::isSiteAdmin()) {
$esPrivacyQuery = $easysocial->buildPrivacyQuery('a');
$privateBlog .= $esPrivacyQuery;
} else {
if ($config->get('main_jomsocial_privacy') && JFile::exists($file) && !EasyBlogHelper::isSiteAdmin()) {
require_once $file;
$jsFriends = CFactory::getModel('Friends');
$friends = $jsFriends->getFriendIds($user->id);
// Insert query here.
$privateBlog .= ' AND (';
$privateBlog .= ' (a.`private`= 0 ) OR';
$privateBlog .= ' ( (a.`private` = 20) AND (' . $db->Quote($user->id) . ' > 0 ) ) OR';
if (empty($friends)) {
$privateBlog .= ' ( (a.`private` = 30) AND ( 1 = 2 ) ) OR';
} else {
$privateBlog .= ' ( (a.`private` = 30) AND ( a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
}
$privateBlog .= ' ( (a.`private` = 40) AND ( a.' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . '=' . $user->id . ') )';
$privateBlog .= ' )';
} else {
if ($user->id == 0) {
$privateBlog .= ' AND a.`private` = ' . $db->Quote(0);
}
}
}
$privateBlog = $showPrivate ? '' : $privateBlog;
//get teamblogs id.
$teamBlogIds = '';
$query = '';
if ($config->get('main_includeteamblogpost')) {
$teamBlogIds = EasyBlogHelper::getViewableTeamIds();
if (count($teamBlogIds) > 0) {
$teamBlogIds = implode(',', $teamBlogIds);
}
}
if (!empty($excludeCats)) {
$queryWhere .= ' AND a.`category_id` NOT IN (' . implode(',', $excludeCats) . ')';
}
$jsPostIds = self::getJomSocialPosts();
if ($config->get('main_includeteamblogpost') && !empty($teamBlogIds)) {
if (!empty($jsPostIds)) {
$tmpIds = implode(',', $jsPostIds);
$queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
} else {
$queryWhere .= ' AND (u.team_id IN (' . $teamBlogIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
}
} else {
if (!empty($jsPostIds)) {
$tmpIds = implode(',', $jsPostIds);
$queryWhere .= ' AND (a.id IN (' . $tmpIds . ') OR a.`issitewide` = ' . $db->Quote('1') . ')';
} else {
$queryWhere .= ' AND a.`issitewide` = ' . $db->Quote('1');
}
}
$extraSQL = '';
$blogger = EasyBlogRouter::isBloggerMode();
if ($blogger !== false) {
$extraSQL = ' AND a.`created_by` = ' . $db->Quote($blogger);
}
$tzoffset = EasyBlogDateHelper::getOffSet(true);
$query = 'SELECT *, 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 ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post') . ' as a';
if ($config->get('main_includeteamblogpost')) {
$query .= ' LEFT JOIN `#__easyblog_team_post` AS u ON a.id = u.post_id';
}
$query .= ' WHERE a.`published` = ' . $db->Quote(true) . ' ';
$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') . ') ';
$query .= $extraSQL . ' ';
$query .= $queryWhere;
$query .= ' ORDER BY a.`created` ASC ';
$db->setQuery($query);
$row = $db->loadObjectList();
$postCount = new EasyblogCalendarObject($month, $year);
if (!empty($row)) {
foreach ($row as $data) {
if ($postCount->{$year}->{$month}->{$data->day} == 0) {
//.........这里部分代码省略.........
示例4: getTeamBlogCount
function getTeamBlogCount($tagId)
{
$db = EasyBlogHelper::db();
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
$isBloggerMode = EasyBlogRouter::isBloggerMode();
$extraQuery = '';
$query = 'select count(1) from `#__easyblog_post` as a';
$query .= ' inner join `#__easyblog_post_tag` as b';
$query .= ' on a.`id` = b.`post_id`';
$query .= ' and b.`tag_id` = ' . $db->Quote($tagId);
$query .= ' inner join `#__easyblog_team_post` as c';
$query .= ' on a.`id` = c.`post_id`';
if ($config->get('main_includeteamblogpost')) {
$teamBlogIds = EasyBlogHelper::getViewableTeamIds();
if (count($teamBlogIds) > 0) {
$teamBlogIds = implode(',', $teamBlogIds);
}
}
$query .= ' where a.`issitewide` = ' . $db->Quote('0');
if (!empty($extraQuery)) {
$query .= $extraQuery;
}
if ($isBloggerMode !== false) {
$query .= ' and a.`created_by` = ' . $db->Quote($isBloggerMode);
}
$db->setQuery($query);
$result = $db->loadResult();
return empty($result) ? '0' : $result;
}
示例5: getMicroPostsCount
public function getMicroPostsCount($userId, $dashboard = true)
{
$db = EasyBlogHelper::db();
$query = 'SELECT COUNT(1) FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post') . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('source') . '!=' . $db->Quote('') . ' ' . 'AND (' . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . '=' . $db->Quote($userId) . ' ' . 'AND ' . EasyBlogHelper::getHelper('SQL')->nameQuote('published') . '!=' . $db->Quote(POST_ID_TRASHED);
$teamBlogIds = EasyBlogHelper::getViewableTeamIds();
// show team postings in the entries if they are the admin
if ($dashboard && $teamBlogIds) {
$adminTeamIds = array();
foreach ($teamBlogIds as $teamId) {
// We need to test if the user has admin access.
$team = EasyBlogHelper::getTable('TeamBlog');
$team->load($teamId);
if ($team->isTeamAdmin(JFactory::getUser()->id)) {
$adminTeamIds[] = $teamId;
}
}
if (!empty($adminTeamIds)) {
$query .= ' OR `id` IN(';
$query .= ' SELECT `post_id` FROM `#__easyblog_team_post` WHERE `team_id` IN(';
for ($i = 0; $i < count($adminTeamIds); $i++) {
$query .= $db->Quote($adminTeamIds[$i]);
if (next($adminTeamIds) !== false) {
$query .= ',';
}
}
$query .= ') )';
}
}
$query .= ')';
$db->setQuery($query);
$result = $db->loadResult();
return $result;
}