/**
	 * prepare backend groups render
	 *
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	private function showGroups( $user, $plugin ) {
		global $_CB_framework;

		$paging								=	new cbgjPaging( 'groups' );

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

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

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

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

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

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

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

		if ( isset( $creator ) && ( $creator != '' ) ) {
			$where[]						=	array( 'd.id', '=', (int) $creator, array( 'd.username', 'CONTAINS', $creator ), array( 'd.name', 'CONTAINS', $creator ) );
		}

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

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

		$total								=	count( cbgjData::getGroups( null, $where ) );

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

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

		$rows								=	array_values( cbgjData::getGroups( null, $where, array( array( 'b.ordering', 'ASC' ), array( 'ordering', 'ASC' ) ), array( $pageNav->limitstart, $pageNav->limit ), true, ( $parent ? $parent : 0 ) ) );

		$input								=	array();

		$categories							=	cbgjClass::getCategoryOptions();

		if ( $categories ) {
			array_unshift( $categories, moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Category -' ) ) );

			$input['category']				=	$paging->getInputSelect( 'adminForm', 'category', $categories, $category );
			$input['batch_category']		=	moscomprofilerHTML::selectList( $categories, 'batch_category', null, 'value', 'text', null, 1, false, false );
		} else {
			$input['category']				=	'-';
			$input['batch_category']		=	'-';
		}

		$groups								=	cbgjClass::getGroupOptions();

		if ( $groups ) {
			array_unshift( $groups, moscomprofilerHTML::makeOption( '0', CBTxt::T( 'No Parent' ) ) );
			array_unshift( $groups, moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Parent -' ) ) );

			$input['batch_parent']			=	moscomprofilerHTML::selectList( $groups, 'batch_parent', null, 'value', 'text', null, 1, false, false );

			if ( $category ) {
				$groups						=	cbgjClass::getGroupOptions( null, $category );

				array_unshift( $groups, moscomprofilerHTML::makeOption( '0', CBTxt::T( 'No Parent' ) ) );
				array_unshift( $groups, moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Parent -' ) ) );
			}

			if ( $groups ) {
				$input['parent']			=	$paging->getInputSelect( 'adminForm', 'parent', $groups, $parent );
			} else {
				$input['parent']			=	'-';
			}
		} else {
			$input['parent']				=	'-';
			$input['batch_parent']			=	'-';
		}

		$listAccess							=	array();
		$listAccess[]						=	moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Access -' ) );
		$listAccess[]						=	moscomprofilerHTML::makeOption( '-2', CBTxt::T( '- Everybody' ) );
		$listAccess[]						=	moscomprofilerHTML::makeOption( '-1', CBTxt::T( '- All Registered Users' ) );
		$listAccess							=	array_merge( $listAccess, $_CB_framework->acl->get_group_children_tree( null, 'USERS', false ) );
		$input['access']					=	$paging->getInputSelect( 'adminForm', 'access', $listAccess, $access );
		$input['batch_access']				=	moscomprofilerHTML::selectList( $listAccess, 'batch_access', null, 'value', 'text', null, 1, false, false );

		$listType							=	array();
		$listType[]							=	moscomprofilerHTML::makeOption( '', CBTxt::T( '- Select Type -' ) );
		$listType[]							=	moscomprofilerHTML::makeOption( '1', CBTxt::T( 'Open' ) );
		$listType[]							=	moscomprofilerHTML::makeOption( '2', CBTxt::T( 'Approval' ) );
		$listType[]							=	moscomprofilerHTML::makeOption( '3', CBTxt::T( 'Invite' ) );
		$input['type']						=	$paging->getInputSelect( 'adminForm', 'type', $listType, $type );
		$input['batch_type']				=	moscomprofilerHTML::selectList( $listType, 'batch_type', null, 'value', 'text', null, 1, false, false );

		$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['creator']					=	$paging->getInputText( 'adminForm', 'creator', $creator, '15' );
		$input['batch_creator']				=	'<input type="text" id="batch_creator" name="batch_creator" size="6" />';
		$input['id']						=	$paging->getInputText( 'adminForm', 'id', $id, '6' );

		$pageNav->searching					=	$searching;

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