Example #1
0
	static public function getForum( $tabs, $row, $user, $plugin ) {
		global $_CB_database;

		if ( ! class_exists( 'KunenaForumMessageHelper' ) ) {
			return CBTxt::T( 'Kunena not installed, enabled, or failed to load.' );
		}

		$params				=	$row->getParams();
		$forumId			=	$params->get( 'forum_id', null );

		cbgjClass::getTemplate( 'cbgroupjiveforums' );

		$paging				=	new cbgjPaging( 'forum' );

		$limit				=	$paging->getlimit( (int) $plugin->params->get( 'forum_limit', 15 ) );
		$limitstart			=	$paging->getLimistart();
		$search				=	$paging->getFilter( 'search' );
		$where				=	array();

		if ( isset( $search ) && ( $search != '' ) ) {
			$where[]		=	'( m.' . $_CB_database->NameQuote( 'subject' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
							.	' OR t.' . $_CB_database->NameQuote( 'message' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . ' )';
		}

		$params				=	array(	'starttime' => -1,
										'where' => ( count( $where ) ? implode( ' AND ', $where ) : null )
									);

		$rows				=	KunenaForumMessageHelper::getLatestMessages( $forumId, 0, 0, $params );
		$total				=	array_shift( $rows );

		if ( $total <= $limitstart ) {
			$limitstart		=	0;
		}

		$pageNav			=	$paging->getPageNav( $total, $limitstart, $limit );

		if ( $plugin->params->get( 'forum_paging', 1 ) ) {
			$rows			=	KunenaForumMessageHelper::getLatestMessages( $forumId, (int) $pageNav->limitstart, (int) $pageNav->limit, $params );
			$rows			=	array_pop( $rows );
		} else {
			$rows			=	array_pop( $rows );
		}

		$pageNav->search	=	$paging->getInputSearch( 'gjForm_forum', 'search', CBTxt::T( 'Search Forums...' ), $search );
		$pageNav->searching	=	( $search ? true : false );
		$pageNav->limitbox	=	$paging->getLimitbox( $pageNav );
		$pageNav->pagelinks	=	$paging->getPagesLinks( $pageNav );

		if ( class_exists( 'HTML_cbgroupjiveforums' ) ) {
			return HTML_cbgroupjiveforums::showForums( $rows, $pageNav, $tabs, $row, $user, $plugin );
		} else {
			return cbgjForumsPlugin::showForum( $rows, $pageNav, $tabs, $row, $user, $plugin );
		}
	}
	/**
	 * prepare frontend tab invited render
	 *
	 * @param  moscomprofilerUser $displayed
	 * @param  moscomprofilerUser $user
	 * @param  object             $plugin
	 * @param  boolean            $tabbed
	 * @return mixed
	 */
	public function getInvited( $displayed, $user, $plugin, $tabbed = true ) {
		cbgjClass::getTemplate( 'tab_invited' );

		$paging					=	new cbgjPaging( 'tab_invited' );

		$limit					=	$paging->getlimit( (int) $plugin->params->get( 'invited_tab_limit', 15 ) );
		$limitstart				=	$paging->getLimistart();
		$search					=	$paging->getFilter( 'search' );
		$where					=	array();

		if ( isset( $search ) && ( $search != '' ) ) {
			$where[]			=	array( 'name', 'CONTAINS', $search );
		}

		$searching				=	( count( $where ) ? true : false );

		$where[]				=	array( 'f.user', '=', (int) $displayed->id, array( 'f.email', '=', $displayed->email ) );
		$where[]				=	array( 'f.accepted', 'IN', array( '0000-00-00', '0000-00-00 00:00:00', '', null ) );

		switch( $plugin->params->get( 'invited_tab_orderby', 1 ) ) {
			case 2:
				$orderBy		=	array( 'ordering', 'DESC' );
				break;
			case 3:
				$orderBy		=	array( 'date', 'ASC' );
				break;
			case 4:
				$orderBy		=	array( 'date', 'DESC' );
				break;
			case 5:
				$orderBy		=	array( 'name', 'ASC' );
				break;
			case 6:
				$orderBy		=	array( 'name', 'DESC' );
				break;
			case 7:
				$orderBy		=	'user_count_asc';
				break;
			case 8:
				$orderBy		=	'user_count_desc';
				break;
			case 9:
				$orderBy		=	'nested_count_asc';
				break;
			case 10:
				$orderBy		=	'nested_count_desc';
				break;
			default:
				$orderBy		=	null;
				break;
		}

		$total					=	count( cbgjData::getGroups( array( array( 'grp_access', 'mod_lvl2' ), $user ), $where, $orderBy ) );

		if ( $total <= $limitstart ) {
			$limitstart			=	0;
		}

		$pageNav				=	$paging->getPageNav( $total, $limitstart, $limit );

		$rows					=	cbgjData::getGroups( array( array( 'grp_access', 'mod_lvl2' ), $user ), $where, $orderBy, ( $plugin->params->get( 'invited_tab_paging', 1 ) ? array( $pageNav->limitstart, $pageNav->limit ) : null ) );

		$pageNav->search		=	$paging->getInputSearch( 'gjTabForm_invited', 'search', CBTxt::T( 'Search Invited...' ), $search );
		$pageNav->searching		=	$searching;
		$pageNav->limitbox		=	$paging->getLimitbox( $pageNav );
		$pageNav->pagelinks		=	$paging->getPagesLinks( $pageNav );

		return HTML_groupjiveTabInvited::showInvited( $rows, $pageNav, $displayed, $user, $plugin, $tabbed );
	}
Example #3
0
	static public function getForum( $tabs, $row, $user, $plugin ) {
		global $_CB_database;

		$params				=	$row->getParams();
		$forumId			=	$params->get( 'forum_id', null );

		cbgjClass::getTemplate( 'cbgroupjiveforums' );

		$paging				=	new cbgjPaging( 'forum' );

		$limit				=	$paging->getlimit( (int) $plugin->params->get( 'forum_limit', 15 ) );
		$limitstart			=	$paging->getLimistart();
		$search				=	$paging->getFilter( 'search' );
		$where				=	array();

		if ( isset( $search ) && ( $search != '' ) ) {
			$where[]		=	'( a.' . $_CB_database->NameQuote( 'subject' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
							.	' OR b.' . $_CB_database->NameQuote( 'message' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . ' )';
		}

		$query				=	'SELECT COUNT(*)'
							.	"\n FROM " . $_CB_database->NameQuote( '#__kunena_messages' ) . " AS a"
							.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__kunena_messages_text' ) . " AS b"
							.	' ON a.' . $_CB_database->NameQuote( 'id' ) . ' = b.' . $_CB_database->NameQuote( 'mesid' )
							.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__kunena_categories' ) . " AS c"
							.	' ON a.' . $_CB_database->NameQuote( 'catid' ) . ' = c.' . $_CB_database->NameQuote( 'id' )
							.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__kunena_messages' ) . " AS d"
							.	' ON a.' . $_CB_database->NameQuote( 'thread' ) . ' = d.' . $_CB_database->NameQuote( 'id' )
							.	"\n WHERE a." . $_CB_database->NameQuote( 'hold' ) . " = 0"
							.	"\n AND a." . $_CB_database->NameQuote( 'catid' ) . " = " . (int) $forumId
							.	"\n AND c." . $_CB_database->NameQuote( 'published' ) . " = 1"
							.	( count( $where ) ? "\n AND " . implode( "\n AND ", $where ) : null );
		$_CB_database->setQuery( $query );
		$total				=	$_CB_database->loadResult();

		if ( $total <= $limitstart ) {
			$limitstart		=	0;
		}

		$pageNav			=	$paging->getPageNav( $total, $limitstart, $limit );

		$query				=	'SELECT a.*'
							.	', c.' . $_CB_database->NameQuote( 'id' ) . ' AS category'
							.	', c.' . $_CB_database->NameQuote( 'name' ) . ' AS catname'
							.	', b.' . $_CB_database->NameQuote( 'message' )
							.	"\n FROM " . $_CB_database->NameQuote( '#__kunena_messages' ) . " AS a"
							.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__kunena_messages_text' ) . " AS b"
							.	' ON a.' . $_CB_database->NameQuote( 'id' ) . ' = b.' . $_CB_database->NameQuote( 'mesid' )
							.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__kunena_categories' ) . " AS c"
							.	' ON a.' . $_CB_database->NameQuote( 'catid' ) . ' = c.' . $_CB_database->NameQuote( 'id' )
							.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__kunena_messages' ) . " AS d"
							.	' ON a.' . $_CB_database->NameQuote( 'thread' ) . ' = d.' . $_CB_database->NameQuote( 'id' )
							.	"\n WHERE a." . $_CB_database->NameQuote( 'hold' ) . " = 0"
							.	"\n AND a." . $_CB_database->NameQuote( 'catid' ) . " = " . (int) $forumId
							.	"\n AND c." . $_CB_database->NameQuote( 'published' ) . " = 1"
							.	( count( $where ) ? "\n AND " . implode( "\n AND ", $where ) : null )
							.	"\n ORDER BY a." . $_CB_database->NameQuote( 'time' ) . " DESC";
		if ( $plugin->params->get( 'forum_paging', 1 ) ) {
			$_CB_database->setQuery( $query, (int) $pageNav->limitstart, (int) $pageNav->limit );
		} else {
			$_CB_database->setQuery( $query );
		}
		$rows				=	$_CB_database->loadObjectList();

		$pageNav->search	=	$paging->getInputSearch( 'gjForm_forum', 'search', CBTxt::T( 'Search Forums...' ), $search );
		$pageNav->searching	=	( $search ? true : false );
		$pageNav->limitbox	=	$paging->getLimitbox( $pageNav );
		$pageNav->pagelinks	=	$paging->getPagesLinks( $pageNav );

		if ( class_exists( 'HTML_cbgroupjiveforums' ) ) {
			return HTML_cbgroupjiveforums::showForums( $rows, $pageNav, $tabs, $row, $user, $plugin );
		} else {
			return cbgjForumsPlugin::showForum( $rows, $pageNav, $tabs, $row, $user, $plugin );
		}
	}