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 );
		}
	}
	public function getAuto( $user, $plugin ) {
		global $_CB_framework;

		cbgjClass::getTemplate( 'cbgroupjiveauto' );

		$paging				=	new cbgjPaging( 'auto' );

		$limit				=	$paging->getlimit( 30 );
		$limitstart			=	$paging->getLimistart();
		$search				=	$paging->getFilter( 'trigger' );
		$access				=	$paging->getFilter( 'access' );
		$state				=	$paging->getFilter( 'state' );
		$id					=	$paging->getFilter( 'id' );
		$where				=	array();

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

		if ( isset( $access ) && ( $access != '' ) ) {
			$where[]		=	array( 'access', '=', (int) $access );
		}

		if ( isset( $state ) && ( $state != '' ) ) {
			$where[]		=	array( 'published', '=', (int) $state );
		}

		if ( isset( $id ) && ( $id != '' ) ) {
			$where[]		=	array( 'id', '=', (int) $id );
		}

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

		$total				=	count( cbgjAutoData::getAutos( null, $where ) );

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

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

		$rows				=	array_values( cbgjAutoData::getAutos( null, $where, null, array( $pageNav->limitstart, $pageNav->limit ) ) );

		$input				=	array();

		$input['trigger']	=	$paging->getInputText( 'adminForm', 'trigger', $search, '30' );

		$listAccess			=	array();
		$listAccess[]		=	moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Access -' ) );
		$listAccess[]		=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'Custom ACL' ) );
		$listAccess[]		=	moscomprofilerHTML::makeOption( '-1', CBTxt::T( 'Everybody' ) );
		$listAccess[]		=	moscomprofilerHTML::makeOption( '-2', CBTxt::T( 'All Non-Registered Users' ) );
		$listAccess[]		=	moscomprofilerHTML::makeOption( '-3', CBTxt::T( 'All Registered Users' ) );
		$listAccess[]		=	moscomprofilerHTML::makeOption( '-4', CBTxt::T( 'All Non-Moderators' ) );
		$listAccess[]		=	moscomprofilerHTML::makeOption( '-5', CBTxt::T( 'All Moderators' ) );
		$listAccess[]		=	moscomprofilerHTML::makeOptGroup( CBTxt::T( 'CMS ACL' ) );
		$listAccess			=	array_merge( $listAccess, $_CB_framework->acl->get_group_children_tree( null, 'USERS', false ) );
		$input['access']	=	$paging->getInputSelect( 'adminForm', 'access', $listAccess, $access );

		$listState			=	array();
		$listState[]		=	moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select State -' ) );
		$listState[]		=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Published' ) );
		$listState[]		=	moscomprofilerHTML::makeOption( '0', CBTxt::T( 'Unpublished' ) );
		$input['state']		=	$paging->getInputSelect( 'adminForm', 'state', $listState, $state );

		$input['id']		=	$paging->getInputText( 'adminForm', 'id', $id, '6' );

		$pageNav->searching	=	$searching;

		if ( class_exists( 'HTML_cbgroupjiveauto' ) ) {
			HTML_cbgroupjiveauto::showAuto( $rows, $pageNav, $input, $user, $plugin );
		} else {
			$this->showAuto( $rows, $pageNav, $input, $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 #4
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 );
		}
	}
	/**
	 * prepare backend integrations render
	 *
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	private function showIntegrations( $user, $plugin ) {
		global $_CB_framework, $_CB_database;

		$paging				=	new cbgjPaging( 'integrations' );

		$limit				=	$paging->getlimit( 30 );
		$limitstart			=	$paging->getLimistart();
		$search				=	$paging->getFilter( 'search' );
		$access				=	$paging->getFilter( 'access' );
		$state				=	$paging->getFilter( 'state' );
		$id					=	$paging->getFilter( 'id' );
		$where				=	array();

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

		if ( isset( $access ) && ( ! in_array( $access, array( '', '-1' ) ) ) ) {
			$where[]		=	'( ' . $_CB_database->NameQuote( 'access' ) . ' = ' . (int) $access . ' )';
		}

		if ( isset( $state ) && ( $state != '' ) ) {
			$where[]		=	'( ' . $_CB_database->NameQuote( 'published' ) . ' = ' . (int) $state . ' )';
		}

		if ( isset( $id ) && ( $id != '' ) ) {
			$where[]		=	'( ' . $_CB_database->NameQuote( 'id' ) . ' = ' . (int) $id . ' )';
		}

		$query				=	'SELECT COUNT(*)'
							.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin' )
							.	"\n WHERE " . $_CB_database->NameQuote( 'type' ) . " = " . $_CB_database->Quote( 'user/plug_cbgroupjive/plugins' )
							.	( 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 *'
							.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin' )
							.	"\n WHERE " . $_CB_database->NameQuote( 'type' ) . " = " . $_CB_database->Quote( 'user/plug_cbgroupjive/plugins' )
							.	( count( $where ) ? "\n AND " . implode( "\n AND ", $where ) : null )
							.	"\n ORDER BY " . $_CB_database->NameQuote( 'ordering' ) . " ASC";
		$_CB_database->setQuery( $query, (int) $pageNav->limitstart, (int) $pageNav->limit );
		$rows				=	$_CB_database->loadObjectList();

		$input				=	array();

		$accessLevels		=	$_CB_framework->acl->get_access_children_tree( true );

		$listAccess			=	array();
		$listAccess[]		=	moscomprofilerHTML::makeOption( '-1', CBTxt::T( '- Select Access -' ) );
		$listAccess			=	array_merge( $listAccess, $accessLevels );
		$input['access']	=	$paging->getInputSelect( 'adminForm', 'access', $listAccess, ( in_array( $access, array( '', '-1' ) ) ? -1 : $access ), true );

		$listState			=	array();
		$listState[]		=	moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select State -' ) );
		$listState[]		=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Published' ) );
		$listState[]		=	moscomprofilerHTML::makeOption( '0', CBTxt::T( 'Unpublished' ) );
		$input['state']		=	$paging->getInputSelect( 'adminForm', 'state', $listState, $state );

		$input['search']	=	$paging->getInputText( 'adminForm', 'search', $search, '30' );
		$input['id']		=	$paging->getInputText( 'adminForm', 'id', $id, '6' );

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

		HTML_cbgjAdmin::showIntegrations( $rows, $pageNav, $input, $accessLevels, $user, $plugin );
	}