Example #1
0
	/**
	 * render frontend overview
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	static function showOverview( $rows, $pageNav, $user, $plugin ) {
		global $_CB_framework;

		$generalTitle	=	$plugin->params->get( 'general_title', $plugin->name );

		$_CB_framework->setPageTitle( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) );

		if ( $generalTitle != '' ) {
			$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() );
		}

		$_CB_framework->appendPathWay( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ), cbgjClass::getPluginURL( array( 'overview' ) ) );

		$main			=	HTML_groupjiveOverviewMain::showOverviewMain( $rows, $pageNav, $user, $plugin );

		$return			=	'<div class="gjOverview">';

		if ( $plugin->params->get( 'general_panes', 1 ) ) {
			$return		.=		'<div class="gjHeader">'
						.			HTML_groupjiveOverviewPanes::showOverviewPanes( $user, $plugin )
						.		'</div>'
						.		'<div class="gjBody">'
						.			$main
						.		'</div>';
		} else {
			$return		.=		$main;
		}

		$return			.=	'</div>';

		echo $return;
	}
Example #2
0
	/**
	 * render frontend group panes
	 *
	 * @param cbgjGroup $row
	 * @param cbgjCategory $category
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showGroupPanes( $row, $category, $user, $plugin ) {
		$authorized		=	cbgjClass::getAuthorization( $category, $row, $user );

		if ( $row->get( 'published' ) == 1 ) {
			$state		=	'<div><i class="icon-ban-circle"></i> <a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'unpublish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [group]?', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '">' . CBTxt::Ph( 'Unpublish [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>';
		} else {
			$state		=	'<div><i class="icon-ok"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'publish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Publish [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>';
		}

		$groupAdmins	=	$row->getAdmins();
		$groupMods		=	$row->getModerators();

		$return			=	'<legend class="gjHeaderTitle">' . $row->getName() . '</legend>'
						.	'<div class="gjGrid row-fluid">'
						.		'<div class="gjGridLeft span9">'
						.			'<div class="gjGridLeftLogo span4">'
						.				$row->getLogo( true )
						.			'</div>'
						.			'<div class="gjGridLeftInfo span8">'
						.				cbgjClass::getIntegrations( 'gj_onBeforeGroupInfo', array( $row, $category, $user, $plugin ) )
						.				( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? '<div>' . cbgjClass::getOverride( 'group', true ) . ': ' . $row->nestedCount() . '</div>' : null )
						.				( $row->userCount() ? '<div>' . cbgjClass::getOverride( 'user', true ) . ': ' . $row->userCount() . '</div>' : null )
						.				( $row->get( 'user_id' ) ? '<div>' . cbgjClass::getOverride( 'owner' ) . ': ' . $row->getOwnerName( true ) . '</div>' : null )
						.				( ! empty( $groupMods ) ? '<div>' . cbgjClass::getOverride( 'moderator', true ) . ': ' . implode( ', ', $groupMods ) . '</div>' : null )
						.				( ! empty( $groupAdmins ) ? '<div>' . cbgjClass::getOverride( 'admin', true ) . ': ' . implode( ', ', $groupAdmins ) . '</div>' : null )
						.				'<div>' . CBTxt::Ph( 'Type: [grp_type]', array( '[grp_type]' => $row->getType() ) ) . '</div>'
						.				'<div>' . CBTxt::Ph( 'Access: [grp_access]', array( '[grp_access]' => $row->getAccess() ) ) . '</div>'
						.				'<div>' . cbgjClass::getOverride( 'category' ) . ': ' . $category->getName( 0, true ) . '</div>'
						.				( $row->get( 'parent' ) ? '<div>' . cbgjClass::getOverride( 'group' ) . ': ' . $row->getParent()->getName( 0, true ) . '</div>' : null )
						.				'<div>' . CBTxt::Ph( 'Created: [grp_date]', array( '[grp_date]' => cbFormatDate( $row->get( 'date' ), 1, false ) ) ) . '</div>'
						.				cbgjClass::getIntegrations( 'gj_onAfterGroupInfo', array( $row, $category, $user, $plugin ) )
						.			'</div>';

		if ( $row->get( 'description' ) ) {
			$return		.=			'<div class="gjGridLeftDesc span12 well well-small">'
						.				$row->getDescription()
						.			'</div>';
		}

		$return			.=		'</div>'
						.		'<div class="gjGridRight span3">'
						.			cbgjClass::getIntegrations( 'gj_onBeforeGroupMenu', array( $row, $category, $user, $plugin ), null, null )
						.			( cbgjClass::hasAccess( array( 'grp_join', 'grp_approved' ), $authorized, true ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . ( cbgjClass::hasAccess( 'grp_invited', $authorized ) ? CBTxt::Th( 'Accept Invite' ) : CBTxt::Ph( 'Join [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( array( 'grp_nested_create', 'grp_approved' ), $authorized, true ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'new', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( array( 'grp_leave', 'grp_approved' ), $authorized, true ) ? '<div><i class="icon-minus"></i> <a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'leave', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to leave this [group]?', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '">' . CBTxt::Ph( 'Leave [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ? '<div><i class="icon-pencil"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'edit', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Edit [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'grp_message', $authorized ) && $row->userCount() ? '<div><i class="icon-envelope"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'message', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Message [users]', array( '[users]' => cbgjClass::getOverride( 'user', true ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'grp_can_publish', $authorized ) ? $state : null )
						.			( cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ? '<div><i class="icon-remove"></i> <a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'delete', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [group] and all its associated [users]?', array( '[group]' => cbgjClass::getOverride( 'group' ), '[users]' => cbgjClass::getOverride( 'user', true ) ) ) ) . '">' . CBTxt::Ph( 'Delete [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			cbgjClass::getIntegrations( 'gj_onAfterGroupMenu', array( $row, $category, $user, $plugin ), null, null )
						.			( cbgjClass::hasAccess( 'grp_usr_notifications', $authorized ) ? '<div><i class="icon-info-sign"></i> <a href="' . cbgjClass::getPluginURL( array( 'notifications', 'show', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Th( 'Notifications' ) . '</a></div>' : null )
						.			( $row->get( 'parent' ) ? '<div><i class="icon-share-alt"></i> <a href="' . $row->getParent()->getUrl() . '">' . CBTxt::Ph( 'Back to [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( ! $row->get( 'parent' ) ? '<div><i class="icon-share-alt"></i> <a href="' . $category->getUrl() . '">' . CBTxt::Ph( 'Back to [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.		'</div>'
						.	'</div>';

		return $return;
	}
	/**
	 * render frontend category panes
	 *
	 * @param cbgjCategory $row
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showCategoryPanes( $row, $user, $plugin ) {
		$authorized		=	cbgjClass::getAuthorization( $row, null, $user );

		if ( $row->get( 'published' ) == 1 ) {
			$state		=	'<div><i class="icon-ban-circle"></i> <a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'unpublish', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [category]?', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '">' . CBTxt::Ph( 'Unpublish [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>';
		} else {
			$state		=	'<div><i class="icon-ok"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Publish [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>';
		}

		$return			=	'<legend class="gjHeaderTitle">' . $row->getName() . '</legend>'
						.	'<div class="gjGrid row-fluid">'
						.		'<div class="gjGridLeft span9">'
						.			'<div class="gjGridLeftLogo span4">'
						.				$row->getLogo( true )
						.			'</div>'
						.			'<div class="gjGridLeftInfo span8">'
						.				cbgjClass::getIntegrations( 'gj_onBeforeCategoryInfo', array( $row, $user, $plugin ) )
						.				( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? '<div>' . cbgjClass::getOverride( 'category', true ) . ': ' . $row->nestedCount() . '</div>' : null )
						.				( $row->groupCount() ? '<div>' . cbgjClass::getOverride( 'group', true ) . ': ' . $row->groupCount() . '</div>' : null )
						.				( $row->get( 'user_id' ) ? '<div>' . cbgjClass::getOverride( 'owner' ) . ': ' . $row->getOwnerName( true ) . '</div>' : null )
						.				'<div>' . CBTxt::Ph( 'Types: [cat_types]', array( '[cat_types]' => implode( ', ', $row->getTypes() ) ) ) . '</div>'
						.				'<div>' . CBTxt::Ph( 'Access: [cat_access]', array( '[cat_access]' => $row->getAccess() ) ) . '</div>'
						.				( $row->get( 'parent' ) ? '<div>' . cbgjClass::getOverride( 'category' ) . ': ' . $row->getParent()->getName( 0, true ) . '</div>' : null )
						.				'<div>' . CBTxt::Ph( 'Created: [cat_date]', array( '[cat_date]' => cbFormatDate( $row->get( 'date' ), 1, false ) ) ) . '</div>'
						.				cbgjClass::getIntegrations( 'gj_onAfterCategoryInfo', array( $row, $user, $plugin ) )
						.			'</div>';

		if ( $row->get( 'description' ) ) {
			$return		.=			'<div class="gjGridLeftDesc span12 well well-small">'
						.				$row->getDescription()
						.			'</div>';
		}

		$return			.=		'</div>'
						.		'<div class="gjGridRight span3">'
						.			cbgjClass::getIntegrations( 'gj_onBeforeCategoryMenu', array( $row, $user, $plugin ), null, null )
						.			( cbgjClass::hasAccess( 'cat_nested_create', $authorized ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'new', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'cat_grp_create', $authorized ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'groups', 'new', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><i class="icon-pencil"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'edit', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Edit [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'cat_message', $authorized ) && $row->groupCount() ? '<div><i class="icon-envelope"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'message', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Ph( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) . '</a></div>' : null )
						.			( cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ? $state : null )
						.			( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><i class="icon-remove"></i> <a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'delete', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [category] and all its associated [groups]?', array( '[category]' => cbgjClass::getOverride( 'category' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) ) . '">' . CBTxt::Ph( 'Delete [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.			cbgjClass::getIntegrations( 'gj_onAfterCategoryMenu', array( $row, $user, $plugin ), null, null )
						.			( cbgjClass::hasAccess( 'cat_usr_notifications', $authorized ) ? '<div><i class="icon-info-sign"></i> <a href="' . cbgjClass::getPluginURL( array( 'notifications', 'show', (int) $row->get( 'id' ) ) ) . '">' . CBTxt::Th( 'Notifications' ) . '</a></div>' : null )
						.			( $row->get( 'parent' ) ? '<div><i class="icon-share-alt"></i> <a href="' . $row->getParent()->getUrl() . '">' . CBTxt::Ph( 'Back to [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
						.			( ! $row->get( 'parent' ) ? '<div><i class="icon-share-alt"></i> <a href="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '">' . CBTxt::Ph( 'Back to [overview]', array( '[overview]' => cbgjClass::getOverride( 'overview' ) ) ) . '</a></div>' : null )
						.		'</div>'
						.	'</div>';

		return $return;
	}
	/**
	 * render frontend category message
	 *
	 * @param cbgjCategory $row
	 * @param array $input
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	static function showCategoryMessage( $row, $input, $user, $plugin ) {
		$row->setPathway( CBTxt::P( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), cbgjClass::getPluginURL( array( 'categories', 'message', (int) $row->get( 'id' ) ) ) );

		$return			=	'<div class="gjCategoryMessage">'
						.		'<form action="' . cbgjClass::getPluginURL( array( 'categories', 'send', (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">'
						.			'<legend class="gjEditTitle">' . CBTxt::Ph( 'Message [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) . '</legend>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Subject' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['subject']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [groups] message subject.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Body' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['body']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [groups] message body.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';

		if ( $input['captcha'] !== false ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					'<div style="margin-bottom: 5px;">' . $input['captcha']['code'] . '</div>'
						.					'<div>' . $input['captcha']['input'] . '</div>'
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.					'</span>'
						.				'</div>'
						.			'</div>';
		}

		$return			.=			'<div class="gjButtonWrapper form-actions">'
						.				'<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Message' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" />&nbsp;'
						.				'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'show', (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
	/**
	 * render frontend overview message
	 *
	 * @param array $input
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	static function showOverviewMessage( $input, $user, $plugin ) {
		global $_CB_framework;

		$generalTitle	=	$plugin->params->get( 'general_title', $plugin->name );
		$pageTitle		=	CBTxt::P( 'Message [category]', array( '[category]' => cbgjClass::getOverride( 'category', true ) ) );

		$_CB_framework->setPageTitle( htmlspecialchars( $pageTitle ) );

		if ( $generalTitle != '' ) {
			$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() );
		}

		$_CB_framework->appendPathWay( htmlspecialchars( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) ), cbgjClass::getPluginURL( array( 'overview' ) ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), cbgjClass::getPluginURL( array( 'overview', 'message' ) ) );

		$return			=	'<div class="gjOverviewMessage">'
						.		'<form action="' . cbgjClass::getPluginURL( array( 'overview', 'send' ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">'
						.			'<legend class="gjEditTitle">' . $pageTitle . '</legend>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Subject' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['subject']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [categories] message subject.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Body' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['body']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [categories] message body.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>'
						.			'<div class="gjButtonWrapper form-actions">'
						.				'<input type="submit" value="' . htmlspecialchars( CBTxt::T( 'Send Message' ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" />&nbsp;'
						.				'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( array( 'overview' ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
	/**
	 * render frontend overview panes
	 *
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showOverviewPanes( $user, $plugin ) {
		$overviewDesc			=	CBTxt::Th( $plugin->params->get( 'overview_desc', null ) );
		$authorized				=	cbgjClass::getAuthorization( null, null, $user );
		$categoryCount			=	count( cbgjData::getCategories( array( 'cat_access', 'mod_lvl1' ), array( 'parent', '=', 0 ) ) );

		$return					=	'<legend class="gjHeaderTitle">' . cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) . '</legend>'
								.	'<div class="gjGrid row-fluid">'
								.		'<div class="gjGridLeft span9">'
								.			'<div class="gjGridLeftLogo span4">'
								.				'<img alt="' . htmlspecialchars( CBTxt::T( 'Logo' ) ) . '" src="' . $plugin->livePath . '/images/' . $plugin->params->get( 'overview_logo', 'default_overview.png' ) . '" class="gjLogoDefault img-polaroid" />'
								.			'</div>'
								.			'<div class="gjGridLeftInfo span8">'
								.				cbgjClass::getIntegrations( 'gj_onBeforeOverviewInfo', array( $user, $plugin ) )
								.				( $categoryCount ? '<div>' . cbgjClass::getOverride( 'category', true ) . ': ' . $categoryCount . '</div>' : null )
								.				cbgjClass::getIntegrations( 'gj_onAfterOverviewInfo', array( $user, $plugin ) )
								.			'</div>';

		if ( $overviewDesc ) {
			if ( $plugin->params->get( 'overview_desc_content', 0 ) ) {
				$overviewDesc	=	cbgjClass::prepareContentPlugins( $overviewDesc );
			}

			$return				.=			'<div class="gjGridLeftDesc span12 well well-small">' . $overviewDesc . '</div>';
		}

		$return					.=		'</div>'
								.		'<div class="gjGridRight span3">'
								.			cbgjClass::getIntegrations( 'gj_onBeforeOverviewMenu', array( $user, $plugin ), null, null )
								.			( cbgjClass::hasAccess( 'cat_create', $authorized ) ? '<div><i class="icon-plus"></i> <a href="' . cbgjClass::getPluginURL( array( 'categories', 'new' ) ) . '">' . CBTxt::Ph( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div>' : null )
								.			( cbgjClass::hasAccess( 'usr_mod', $authorized ) && $categoryCount ? '<div><i class="icon-envelope"></i> <a href="' . cbgjClass::getPluginURL( array( 'overview', 'message' ) ) . '">' . CBTxt::Ph( 'Message [categories]', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) . '</a></div>' : null )
								.			( cbgjClass::hasAccess( 'usr_panel', $authorized ) ? '<div><i class="icon-home"></i> <a href="' . cbgjClass::getPluginURL( array( 'panel' ) ) . '">' . CBTxt::Ph( 'My [panel]', array( '[panel]' => cbgjClass::getOverride( 'panel' ) ) ) . '</a></div>' : null )
								.			cbgjClass::getIntegrations( 'gj_onAfterOverviewMenu', array( $user, $plugin ), null, null )
								.			( cbgjClass::hasAccess( 'gen_usr_notifications', $authorized ) ? '<div><i class="icon-info-sign"></i> <a href="' . cbgjClass::getPluginURL( array( 'notifications', 'show' ) ) . '">' . CBTxt::Th( 'Notifications' ) . '</a></div>' : null )
								.		'</div>'
								.	'</div>';

		return $return;
	}
Example #7
0
	public function getAccess( $trigger, $fbConfig, $params ) {
		if ( $trigger == 'getAllowedForumsRead' ) {
			$plugin					=	cbgjClass::getPlugin();
			$forum					=	$plugin->params->get( 'forum_id', null );

			if ( $forum ) {
				$forums				=	array();

				$categories			=	cbgjData::getCategories( array( 'forum_cat_access' ), array( 'params', 'REGEX', 'forum_id=[[:digit:]]+' ) );

				if ( $categories ) foreach ( $categories as $category ) {
					$catParams		=	$category->getParams();

					$forums[]		=	$catParams->get( 'forum_id', null );
				}

				$groups				=	cbgjData::getGroups( array( 'forum_grp_access' ), array( 'params', 'REGEX', 'forum_id=[[:digit:]]+' ) );

				if ( $groups ) foreach ( $groups as $group ) {
					$grpParams		=	$group->getParams();

					$forums[]		=	$grpParams->get( 'forum_id', null );
				}

				if ( ! empty( $forums ) ) {
					$forums[]		=	$forum;
					$existingAccess	=	explode( ',', $params[1] );
					$cleanAccess	=	array_diff( $forums, $existingAccess );
					$newAccess		=	array_merge( $existingAccess, $cleanAccess );

					cbArrayToInts( $newAccess );

					$params[1]		=	implode( ',', $newAccess );
				}
			}
		} elseif ( $trigger == 'checkSubscribers' ) {
			$plugin					=	cbgjClass::getPlugin();
			$forum					=	$plugin->params->get( 'forum_id', null );

			if ( $forum ) {
				$forumId			=	$params[0]->id;
				$users				=	$params[1];
				$ids				=	array();

				if ( $forumId && $users ) foreach ( $users as $user ) {
					$category		=	cbgjData::getCategories( array( array( 'forum_cat_access' ), $user ), array( 'params', 'REGEX', 'forum_id=[[:<:]]' . (int) $forumId . '[[:>:]]' ), null, null, false );

					if ( $category->get( 'id' ) ) {
						$ids[]		=	$user;
					}

					$group			=	cbgjData::getGroups( array( array( 'forum_grp_access' ), $user ), array( 'params', 'REGEX', 'forum_id=[[:<:]]' . (int) $forumId . '[[:>:]]' ), null, null, false );

					if ( $group->get( 'id' ) ) {
						$ids[]		=	$user;
					}
				}

				if ( ! empty( $ids ) ) {
					$existingAccess	=	$params[1];
					$cleanAccess	=	array_diff( $ids, $existingAccess );
					$newAccess		=	array_merge( $existingAccess, $cleanAccess );

					cbArrayToInts( $newAccess );

					$params[1]		=	array_values( array_unique( $newAccess ) );
				}
			}
		} elseif ( ( $trigger == 'onStart' ) && cbGetParam( $_REQUEST, 'catid', 0 ) ) {
			$plugin					=	cbgjClass::getPlugin();
			$backlink				=	$plugin->params->get( 'forum_backlink', 1 );
			$forum					=	$plugin->params->get( 'forum_id', null );

			if ( $backlink && $forum ) {
				cbgjClass::getTemplate( 'cbgroupjiveforums' );

				$catid				=	(int) cbGetParam( $_REQUEST, 'catid', 0 );

				if ( $forum == $catid ) {
					echo '<div id="cbGj"><div id="cbGjInner"><div class="gjTop gjTopCenter"><a href="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '" role="button" class="gjButton btn"><i class="icon-share-alt"></i> ' . CBTxt::P( 'Back to [overview]', array( '[overview]' => cbgjClass::getOverride( 'overview' ) ) ) . '</a></div></div></div>';
				} else {
					$category		=	cbgjData::getCategories( array( 'cat_access', 'mod_lvl1' ), array( 'params', 'REGEX', 'forum_id=[[:<:]]' . (int) $catid . '[[:>:]]' ), null, null, false );

					if ( $category->get( 'id' ) ) {
						echo '<div id="cbGj"><div id="cbGjInner"><div class="gjTop gjTopCenter"><a href="' . $category->getUrl() . '" role="button" class="gjButton btn"><i class="icon-share-alt"></i> ' . CBTxt::P( 'Back to [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div></div></div>';
					} else {
						$group		=	cbgjData::getGroups( array( 'grp_access', 'mod_lvl2' ), array( 'params', 'REGEX', 'forum_id=[[:<:]]' . (int) $catid . '[[:>:]]' ), null, null, false );

						if ( $group->get( 'id' ) ) {
							echo '<div id="cbGj"><div id="cbGjInner"><div class="gjTop gjTopCenter"><a href="' . $group->getUrl() . '" role="button" class="gjButton btn"><i class="icon-share-alt"></i> ' . CBTxt::P( 'Back to [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div></div></div>';
						}
					}
				}
			}
		}
	}
Example #8
0
	/**
	 * render frontend users
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param cbgjCategory $category
	 * @param cbgjGroup $group
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showUsers( $rows, $pageNav, $category, $group, $user, $plugin ) {
		$groupUsersSearch		=	$plugin->params->get( 'group_users_search', 1 );
		$groupUsersPaging		=	$plugin->params->get( 'group_users_paging', 1 );
		$groupUsersLimitbox		=	$plugin->params->get( 'group_users_limitbox', 1 );

		$return					=	'<form action="' . $group->getUrl() . '" method="post" name="gjForm_users" id="gjForm_users" class="gjUsers_form">'
								.		( $groupUsersSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) {
			$return				.=		'<div class="gjContent">';

			foreach ( $rows as $row ) {
				$authorized		=	cbgjClass::getAuthorization( $category, $group, $user, $row->getOwner() );
				$adminUrl		=	cbgjClass::getPluginURL( array( 'users', 'admin', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] to [admin]?', array( '[user]' => cbgjClass::getOverride( 'user' ), '[admin]' => cbgjClass::getOverride( 'admin' ) ) ) );
				$modUrl			=	cbgjClass::getPluginURL( array( 'users', 'mod', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] to [mod]?', array( '[user]' => cbgjClass::getOverride( 'user' ), '[mod]' => cbgjClass::getOverride( 'moderator' ) ) ) );
				$activeUrl		=	cbgjClass::getPluginURL( array( 'users', 'active', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Active?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) );
				$inactiveUrl	=	cbgjClass::getPluginURL( array( 'users', 'inactive', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Inactive?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) );
				$banUrl			=	cbgjClass::getPluginURL( array( 'users', 'ban', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to ban this [user]?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) );
				$deleteUrl		=	cbgjClass::getPluginURL( array( 'users', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [user]?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ) );

				if ( $row->get( 'status' ) == 0 ) {
					$typeClass	=	'gjUserTypePENDING';
					$type		=	CBTxt::Th( 'Pending' );
				} elseif ( $row->get( 'status' ) == -1 ) {
					$typeClass	=	'gjUserTypeBANNED';
					$type		=	CBTxt::Th( 'Banned' );
				} elseif ( $row->get( 'status' ) == 2 ) {
					$typeClass	=	'gjUserTypeMOD';
					$type		=	cbgjClass::getOverride( 'moderator' );
				} elseif ( $row->get( 'status' ) == 3 ) {
					$typeClass	=	'gjUserTypeADMIN';
					$type		=	cbgjClass::getOverride( 'admin' );
				} elseif ( $row->get( 'status' ) == 4 ) {
					$typeClass	=	'gjUserTypeOWNER';
					$type		=	cbgjClass::getOverride( 'owner' );
				} else {
					$typeClass	=	'gjUserTypeUSER';
					$type		=	cbgjClass::getOverride( 'user' );
				}

				if ( ( ! in_array( $row->get( 'status' ), array( -1, 4 ) ) ) && ( ( $row->get( 'status' ) != 3 ) || cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) {
					$ban		=	'<div><a href="javascript: void(0);" onclick="' . $banUrl . '"><i class="icon-lock"></i> ' . CBTxt::T( 'Ban' ) . '</a></div>';
				} elseif ( ( $row->get( 'status' ) == -1 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) {
					$ban		=	'<div><a href="javascript: void(0);" onclick="' . $activeUrl . '"><i class="icon-ok"></i> ' . CBTxt::T( 'Unban' ) . '</a></div>';
				} else {
					$ban		=	null;
				}

				if ( ( $row->get( 'status' ) == 1 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) {
					$promote	=	'<div><a href="javascript: void(0);" onclick="' . $modUrl . '"><i class="icon-thumbs-up"></i> ' . CBTxt::T( 'Promote' ) . '</a></div>';
				} elseif ( ( $row->get( 'status' ) == 2 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) {
					$promote	=	'<div><a href="javascript: void(0);" onclick="' . $adminUrl . '"><i class="icon-thumbs-up"></i> ' . CBTxt::T( 'Promote' ) . '</a></div>';
				} else {
					$promote	=	null;
				}

				if ( ( $row->get( 'status' ) == 2 ) && cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ) {
					$demote		=	'<div><a href="javascript: void(0);" onclick="' . $activeUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>';
				} elseif ( ( $row->get( 'status' ) == 3 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) {
					$demote		=	'<div><a href="javascript: void(0);" onclick="' . $modUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>';
				} elseif ( ( $row->get( 'status' ) == 1 ) && cbgjClass::hasAccess( 'mod_lvl4', $authorized ) ) {
					$demote		=	'<div><a href="javascript: void(0);" onclick="' . $inactiveUrl . '"><i class="icon-thumbs-down"></i> ' . CBTxt::T( 'Demote' ) . '</a></div>';
				} else {
					$demote		=	null;
				}

				if ( ( $row->get( 'status' ) != 4 ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) {
					$delete		=	'<div><a href="javascript: void(0);" onclick="' . $deleteUrl . '"><i class="icon-remove"></i> ' . CBTxt::T( 'Delete' ) . '</a></div>';
				} else {
					$delete		=	null;
				}

				$beforeMenu		=	cbgjClass::getIntegrations( 'gj_onBeforeGroupUserMenu', array( $row, $group, $category, $user, $plugin ) );
				$afterMenu		=	cbgjClass::getIntegrations( 'gj_onAfterGroupUserMenu', array( $row, $group, $category, $user, $plugin ) );

				$return			.=			'<div class="gjContentBox mini-layout">'
								.				'<div class="gjContentBoxRow">' . $row->getOwnerName( true ) . '</div>'
								.				'<div class="gjContentBoxRow">' . $row->getOwnerAvatar( true ) . '</div>'
								.				'<div class="gjContentBoxRow">' . $row->getOwnerOnline() . '</div>'
								.				'<div class="gjContentBoxRow">'
								.					cbgjClass::getIntegrations( 'gj_onBeforeGroupUserInfo', array( $row, $group, $category, $user, $plugin ) )
								.					'<span class="' . $typeClass . '" title="' . cbFormatDate( $row->get( 'date' ), 1, false ) . '">' . $type . '</span>'
								.					cbgjClass::getIntegrations( 'gj_onAfterGroupUserInfo', array( $row, $group, $category, $user, $plugin ) )
								.				'</div>';

				if ( ( $row->get( 'status' ) == 0 ) && cbgjClass::hasAccess( 'mod_lvl4', $authorized ) ) {
					$return		.=				'<div class="gjContentBoxRow">'
								.					'<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'users', 'active', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to set this [user] as Active?', array( '[user]' => cbgjClass::getOverride( 'user' ) ) ), true ) . '" />'
								.				'</div>';
				}

				if ( $beforeMenu || $ban || $delete || $promote || $demote || $afterMenu ) {
					$return		.=				'<div class="gjContentBoxRow">'
								.					cbgjClass::getDropdown( ( $beforeMenu . $ban . $delete . $promote . $demote . $afterMenu ), CBTxt::T( 'Menu' ) )
								.				'</div>';
				}

				$return			.=			'</div>';
			}

			$return				.=		'</div>';
		} else {
			$return				.=		'<div class="gjContent">';

			if ( $groupUsersSearch && $pageNav->searching ) {
				$return			.=			CBTxt::Ph( 'No [user] search results found.', array( '[user]' => cbgjClass::getOverride( 'user' ) ) );
			} else {
				$return			.=			CBTxt::Ph( 'There are no [users] available.', array( '[users]' => cbgjClass::getOverride( 'user', true ) ) );
			}

			$return				.=		'</div>';
		}

		if ( $groupUsersPaging ) {
			$return				.=		'<div class="gjPaging pagination pagination-centered">'
								.			( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
								.			( ! $groupUsersLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
								.		'</div>';
		}

		$return					.=		cbGetSpoofInputTag( 'plugin' )
								.	'</form>';

		return $return;
	}
Example #9
0
	/**
	 * render frontend panel main
	 *
	 * @param string $function
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showPanelMain( $function, $user, $plugin ) {
		global $_CB_framework;

		$authorized				=	cbgjClass::getAuthorization( null, null, $user );
		$newCategory			=	( $plugin->params->get( 'panel_new_category', 1 ) && cbgjClass::hasAccess( 'cat_create', $authorized ) );
		$newGroup				=	( $plugin->params->get( 'panel_new_group', 1 ) && cbgjClass::hasAccess( 'grp_create', $authorized ) );

		$return					=	null;

		if ( $newCategory || $newGroup ) {
			$return				.=	'<div class="gjTop gjTopCenter">'
								.		'<div class="btn-group">'
								.			( $newCategory ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'new' ), true, true, false, null, true ) . '" />' : null )
								.			( $newGroup ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new' ), true, true, false, null, true ) . '" />' : null )
								.		'</div>'
								.	'</div>';
		}

		switch ( $function ) {
			case 'categories':
			default:
				if ( $plugin->params->get( 'panel_category_display', 1 ) ) {
					$title		=	htmlspecialchars( CBTxt::P( 'My [categories]', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) );

					$_CB_framework->setPageTitle( $title );
					$_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'categories' ) ) );

					$return		.=	cbgjTab::getCategories( $user, $user, $plugin, false );
					break;
				}
			case 'groups':
				if ( $plugin->params->get( 'panel_group_display', 1 ) ) {
					$title		=	htmlspecialchars( CBTxt::P( 'My [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) );

					$_CB_framework->setPageTitle( $title );
					$_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'groups' ) ) );

					$return		.=	cbgjTab::getGroups( $user, $user, $plugin, false );
					break;
				}
			case 'joined':
				if ( $plugin->params->get( 'panel_joined_display', 1 ) ) {
					$title		=	htmlspecialchars( CBTxt::P( 'Joined [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) );

					$_CB_framework->setPageTitle( $title );
					$_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'joined' ) ) );

					$return		.=	cbgjTab::getJoined( $user, $user, $plugin, false );
					break;
				}
			case 'invites':
				if ( $plugin->params->get( 'panel_invites_display', 1 ) ) {
					$title		=	htmlspecialchars( CBTxt::T( 'My Invites' ) );

					$_CB_framework->setPageTitle( $title );
					$_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'invites' ) ) );

					$return		.=	cbgjTab::getInvites( $user, $user, $plugin, false );
					break;
				}
			case 'invited':
				if ( $plugin->params->get( 'panel_invited_display', 1 ) ) {
					$title		=	htmlspecialchars( CBTxt::T( 'Invited To' ) );

					$_CB_framework->setPageTitle( $title );
					$_CB_framework->appendPathWay( $title, cbgjClass::getPluginURL( array( 'panel', 'invited' ) ) );

					$return		.=	cbgjTab::getInvited( $user, $user, $plugin, false );
					break;
				}
		}

		return $return;
	}
Example #10
0
	/**
	 * render frontend overview main
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showOverviewMain( $rows, $pageNav, $user, $plugin ) {
		$authorized			=	cbgjClass::getAuthorization( null, null, $user );
		$overviewSearch		=	$plugin->params->get( 'overview_search', 1 );
		$overviewPaging		=	$plugin->params->get( 'overview_paging', 1 );
		$overviewLimitbox	=	$plugin->params->get( 'overview_limitbox', 1 );
		$categoryDescLimit	=	(int) $plugin->params->get( 'overview_cat_desc_limit', 150 );
		$categoryApprove	=	$plugin->params->get( 'category_approve', 0 );
		$newCategory		=	( $plugin->params->get( 'overview_new_category', 0 ) && cbgjClass::hasAccess( 'cat_create', $authorized ) );
		$newGroup			=	( $plugin->params->get( 'overview_new_group', 0 ) && cbgjClass::hasAccess( 'grp_create', $authorized ) );

		$return				=	null;

		if ( $newCategory || $newGroup ) {
			$return			.=	'<div class="gjTop gjTopCenter">'
							.		'<div class="btn-group">'
							.			( $newCategory ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'new' ), true ) . '" />' : null )
							.			( $newGroup ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new' ), true, true, false, null, true ) . '" />' : null )
							.		'</div>'
							.	'</div>';
		}

		$return				.=	'<form action="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '" method="post" name="gjForm" id="gjForm" class="gjForm">'
							.		( $overviewSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) foreach ( $rows as $row ) {
			$authorized		=	cbgjClass::getAuthorization( $row, null, $user );

			if ( $row->get( 'published' ) == 1 ) {
				$state		=	'<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'unpublish', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [category]?', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), true, false, null, true ) . '"><i class="icon-ban-circle"></i> ' . CBTxt::Th( 'Unpublish' ) . '</a></div>';
			} else {
				$state		=	'<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-ok"></i> ' . CBTxt::Th( 'Publish' ) . '</a></div>';
			}

			$canApprove		=	( $categoryApprove && ( $row->get( 'published' ) == -1 ) && cbgjClass::hasAccess( 'cat_can_publish', $authorized ) );

			$beforeMenu		=	cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryMenu', array( $row, $user, $plugin ) );
			$afterMenu		=	cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryMenu', array( $row, $user, $plugin ) );

			$return			.=		'<div class="gjContent row-fluid">'
							.			'<div class="gjContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>'
							.			'<div class="gjContentBody mini-layout span10">'
							.				'<div class="gjContentBodyHeader row-fluid">'
							.					'<div class="gjContentBodyTitle span9"><h5>' . $row->getName( 0, true ) . '<small> ' . cbFormatDate( $row->get( 'date' ), 1, false ) . '</small></h5></div>'
							.					'<div class="gjContentBodyMenu span3">';

			if ( $canApprove ) {
				$return		.=						'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />';
			} else {
				if ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'cat_approved', $authorized ) ) ) ) {
					$return	.=						cbgjClass::getIcon( null, CBTxt::P( 'This [category] is currently unpublished.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'icon-eye-close' );
				}
			}

			if ( $beforeMenu || cbgjClass::hasAccess( array( 'mod_lvl1', 'cat_can_publish' ), $authorized ) || $afterMenu ) {
				$menuItems	=	$beforeMenu
							.	( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'edit', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-pencil"></i> ' . CBTxt::Th( 'Edit' ) . '</a></div>' : null )
							.	( ( ! $canApprove ) && cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ? $state : null )
							.	( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'delete', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [category] and all its associated [groups]?', array( '[category]' => cbgjClass::getOverride( 'category' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), true, false, null, true ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' : null )
							.	$afterMenu;

				$return		.=						cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) );
			}

			$return			.=					'</div>'
							.				'</div>'
							.				'<div class="gjContentBodyInfo">' . ( $row->getDescription( $categoryDescLimit ) ? '<div class="well well-small">' . $row->getDescription( $categoryDescLimit ) . '</div>' : null ) . '</div>'
							.				'<div class="gjContentDivider"></div>'
							.				'<div class="gjContentBodyFooter">'
							.					cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' )
							.					( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? cbgjClass::getOverride( 'category', $row->nestedCount() ) . ' | ' : null )
							.					( $row->groupCount() ? cbgjClass::getOverride( 'group', $row->groupCount() ) . ' | ' : null )
							.					implode( ', ', $row->getTypes() )
							.					cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' )
							.				'</div>'
							.			'</div>'
							.		'</div>';
		} else {
			$return			.=		'<div class="gjContent">';

			if ( $overviewSearch && $pageNav->searching ) {
				$return		.=			CBTxt::Ph( 'No [category] search results found.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) );
			} else {
				$return		.=			CBTxt::Ph( 'There are no [categories] available.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) );
			}

			$return			.=		'</div>';
		}

		if ( $overviewPaging ) {
			$return			.=		'<div class="gjPaging pagination pagination-centered">'
							.			( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
							.			( ! $overviewLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
							.		'</div>';
		}

		$return				.=		cbGetSpoofInputTag( 'plugin' )
							.	'</form>';

		return $return;
	}
Example #11
0
	/**
	 * render frontend category edit
	 *
	 * @param cbgjCategory $row
	 * @param array $input
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	static function showCategoryEdit( $row, $input, $user, $plugin ) {
		$authorized		=	cbgjClass::getAuthorization( $row, null, $user );
		$pageTitle		=	CBTxt::P( ( $row->get( 'id' ) ? 'Edit [category]' : 'Create [category]' ), array( '[category]' => cbgjClass::getOverride( 'category' ) ) );

		$row->setPathway( $pageTitle, cbgjClass::getPluginURL( ( $row->get( 'id' ) ? array( 'categories', 'edit', (int) $row->get( 'id' ) ) : array( 'categories', 'new', (int) $row->get( 'parent' ) ) ) ) );

		$tabs			=	new cbTabs( 0, 1 );

		$onEdit			=	cbgjClass::getIntegrations( 'gj_onCategoryEdit', array( $tabs, $row, $user, $plugin ), null, null );

		$return			=	'<div class="gjCategoryEdit">'
						.		'<form action="' . cbgjClass::getPluginURL( array( 'categories', 'save', (int) $row->get( 'id' ) ), null, true, false, null, 'current' ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm form-horizontal">'
						.			'<legend class="gjEditTitle">' . $pageTitle . '</legend>';

		if ( cbgjClass::hasAccess( 'usr_mod', $authorized ) || $row->getParentAccess( array( 'mod_lvl1', $user ) ) ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Published' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['publish']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( CBTxt::P( 'Select publish status of [category]. Unpublished [categories] will not be visible to the public as well as its [groups].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[categories]' => cbgjClass::getOverride( 'category', true ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
		}

		if ( cbgjClass::hasAccess( 'usr_mod', $authorized ) || ( $plugin->params->get( 'category_nested', 1 ) && ( ! $row->get( 'parent' ) ) ) ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Parent' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['parent']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( CBTxt::P( 'Select parent [category]. Selecting parent [category] allows for nested [category] display.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
		} elseif ( $row->get( 'parent' ) ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Parent' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$row->getParent()->getName()
						.					'<input type="hidden" id="parent" name="parent" value="' . (int) $row->get( 'parent' ) . '" />'
						.				'</div>'
						.			'</div>';
		}

		$return			.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Name' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['name']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [category] name. This is the name that will distinguish this [category] from others. Suggested to input something unique and intuitive.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>'
						.			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Description' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['description']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( CBTxt::P( 'Input [category] description. Your [category] description should be short and to the point; describing what your [category] is all about.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';

		if ( $input['inputlimit'] !== false ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Input Limit' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['inputlimit']
						.				'</div>'
						.			'</div>';
		}

		$return			.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Logo' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					'<div style="margin-bottom: 10px;">' . $row->getLogo( true ) . '</div>'
						.					( $row->get( 'logo' ) ? '<div style="margin-bottom: 5px;">' . $input['del_logo'] . '</div>' : null )
						.					'<div>'
						.						$input['file']
						.						'<span class="gjEditContentInputIcon help-inline">'
						.							cbgjClass::getIcon( CBTxt::P( 'Select [category] logo. A logo should represent the focus of your [category]; please be respectful and tasteful when selecting a logo.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) )
						.						'</span>'
						.					'</div>'
						.				'</div>'
						.			'</div>';

		if ( $plugin->params->get( 'category_types_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Types' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['types']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Select [categories] available [group] types. Types determine the way a [group] is joined (e.g. Invite requires new [users] to be invited to join a [group]).', array( '[categories]' => cbgjClass::getOverride( 'category', true ), '[group]' => cbgjClass::getOverride( 'group' ), '[users]' => cbgjClass::getOverride( 'user', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
		}

		if ( $plugin->params->get( 'category_access_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Access' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['access']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( CBTxt::P( 'Select [category] access. Access determines who can effectively see your [category]. The group selected as well as those above it will have access (e.g. Registered will also be accessible to Author).', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
		}

		if ( cbgjClass::hasAccess( 'grp_create', $authorized ) ) {
			if ( $plugin->params->get( 'category_create_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) {
				$return	.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Create' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['create']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( CBTxt::P( 'Enable or disable the creation of [groups] in this [category]. Moderators and [owner] are exempt from this configuration and can always create [groups].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[owner]' => cbgjClass::getOverride( 'owner' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
			}

			if ( $plugin->params->get( 'category_createaccess_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) {
				$return	.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Create Access' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['create_access']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( CBTxt::P( 'Select [group] create access. Create access determines who can create [groups] in this [category]. The group selected as well as those above it will have access (e.g. Registered will also be accessible to Author). Moderators and [owner] are exempt from this configuration and can always create [groups].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[owner]' => cbgjClass::getOverride( 'owner' ), '[group]' => cbgjClass::getOverride( 'group' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
			}
		}

		if ( cbgjClass::hasAccess( 'cat_nested', $authorized ) ) {
			if ( $plugin->params->get( 'category_nested_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) {
				$return	.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Nested' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['nested']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( CBTxt::P( 'Enable or disable the creation of [categories] in this [category]. Moderators and [owner] are exempt from this configuration and can always create [categories].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[categories]' => cbgjClass::getOverride( 'category', true ), '[owner]' => cbgjClass::getOverride( 'owner' ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
			}

			if ( $plugin->params->get( 'category_nestedaccess_config', 1 ) || cbgjClass::hasAccess( 'usr_mod', $authorized ) ) {
				$return	.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Nested Access' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['nested_access']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( CBTxt::P( 'Select [categories] create access. Create access determines who can create [categories] in this [category]. The group selected as well as those above it will have access (e.g. Registered will also be accessible to Author). Moderators and [owner] are exempt from this configuration and can always create [categories].', array( '[category]' => cbgjClass::getOverride( 'category' ), '[categories]' => cbgjClass::getOverride( 'category', true ), '[owner]' => cbgjClass::getOverride( 'owner' ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
			}
		}

		if ( cbgjClass::hasAccess( 'usr_mod', $authorized ) ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . cbgjClass::getOverride( 'owner' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$input['owner']
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.						cbgjClass::getIcon( CBTxt::P( 'Input [category] [owner]. [category] [owner] determines the creator of the [category] specified as User ID.', array( '[category]' => cbgjClass::getOverride( 'category' ), '[owner]' => cbgjClass::getOverride( 'owner' ) ) ) )
						.					'</span>'
						.				'</div>'
						.			'</div>';
		}

		if ( $onEdit ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Integrations' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					$tabs->startPane( 'gjIntegrationsTabs' )
						.						$onEdit
						.					$tabs->endPane()
						.				'</div>'
						.			'</div>';
		}

		if ( $input['captcha'] !== false ) {
			$return		.=			'<div class="gjEditContentInput control-group">'
						.				'<label class="gjEditContentInputTitle control-label">' . CBTxt::Th( 'Captcha' ) . '</label>'
						.				'<div class="gjEditContentInputField controls">'
						.					'<div style="margin-bottom: 5px;">' . $input['captcha']['code'] . '</div>'
						.					'<div>' . $input['captcha']['input'] . '</div>'
						.					'<span class="gjEditContentInputIcon help-inline">'
						.						cbgjClass::getIcon( null, CBTxt::T( 'Required' ), 'icon-star' )
						.					'</span>'
						.				'</div>'
						.			'</div>';
		}

		$return			.=			'<div class="gjButtonWrapper form-actions">'
						.				'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? CBTxt::P( 'Update [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) : CBTxt::P( 'Create [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) ) . '" class="gjButton gjButtonSubmit btn btn-primary" />&nbsp;'
						.				'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn btn-mini" onclick="' . cbgjClass::getPluginURL( ( $row->get( 'id' ) ? array( 'categories', 'show', (int) $row->get( 'id' ) ) : ( $row->get( 'parent' ) ? array( 'categories', 'show', (int) $row->get( 'parent' ) ) : array( 'overview' ) ) ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ), true, false, null, false, false, true ) . '" />'
						.			'</div>'
						.			cbGetSpoofInputTag( 'plugin' )
						.		'</form>'
						.	'</div>';

		echo $return;
	}
	/**
	 * prepare frontend tab groups render
	 *
	 * @param  moscomprofilerUser $displayed
	 * @param  moscomprofilerUser $user
	 * @param  object             $plugin
	 * @param  boolean            $tabbed
	 * @return mixed
	 */
	public function getGroups( $displayed, $user, $plugin, $tabbed = true ) {
		cbgjClass::getTemplate( 'tab_groups' );

		$paging					=	new cbgjPaging( 'tab_groups' );

		$limit					=	$paging->getlimit( (int) $plugin->params->get( 'group_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 );

		if ( $plugin->params->get( 'group_tab_joined', 0 ) ) {
			$where[]			=	array( 'user_id', '=', (int) $displayed->id, array( 'e.user_id', '=', (int) $displayed->id, 'e.status', '!IN', array( -1, 0, 4 ) ) );
		} else {
			$where[]			=	array( 'user_id', '=', (int) $displayed->id );
		}

		switch( $plugin->params->get( 'group_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( 'group_tab_paging', 1 ) ? array( $pageNav->limitstart, $pageNav->limit ) : null ) );

		$pageNav->search		=	$paging->getInputSearch( 'gjTabForm_groups', 'search', CBTxt::P( 'Search [groups]...', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), $search );
		$pageNav->searching		=	$searching;
		$pageNav->limitbox		=	$paging->getLimitbox( $pageNav );
		$pageNav->pagelinks		=	$paging->getPagesLinks( $pageNav );

		return HTML_groupjiveTabGroups::showGroups( $rows, $pageNav, $displayed, $user, $plugin, $tabbed );
	}
Example #13
0
	/**
	 * render frontend panel panes
	 *
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showPanelPanes( $user, $plugin ) {
		$panelDesc				=	CBTxt::Th( $plugin->params->get( 'panel_desc', null ) );
		$panelCategoryDisplay	=	$plugin->params->get( 'panel_category_display', 1 );
		$panelGroupDisplay		=	$plugin->params->get( 'panel_group_display', 1 );
		$panelJoinedDisplay		=	$plugin->params->get( 'panel_joined_display', 1 );
		$panelInvitesDisplay	=	$plugin->params->get( 'panel_invites_display', 1 );
		$panelInvitedDisplay	=	$plugin->params->get( 'panel_invited_display', 1 );
		$authorized				=	cbgjClass::getAuthorization( null, null, $user );
		$ownedCategories		=	count( cbgjData::getCategories( null, array( 'user_id', '=', $user->id ) ) );

		if ( $plugin->params->get( 'group_tab_joined', 0 ) ) {
			$access				=	array( 'user_id', '=', (int) $user->id, array( 'e.user_id', '=', (int) $user->id, 'e.status', '!IN', array( -1, 0, 4 ) ) );
		} else {
			$access				=	array( 'user_id', '=', (int) $user->id );
		}

		$ownedGroups			=	count( cbgjData::getGroups( null, $access ) );

		if ( $plugin->params->get( 'joined_tab_owned', 0 ) ) {
			$access				=	array( 'user_id', '=', (int) $user->id, array( 'e.user_id', '=', (int) $user->id, 'e.status', '!IN', array( -1, 0, 4 ) ) );
		} else {
			$access				=	array( 'e.user_id', '=', (int) $user->id, 'e.status', '!IN', array( -1, 0, 4 ) );
		}

		$joinedGroups			=	count( cbgjData::getGroups( null, $access ) );
		$ownedInvites			=	count( cbgjData::getInvites( null, array( 'user_id', '=', (int) $user->id ) ) );
		$invitedTo				=	count( cbgjData::getInvites( null, array( 'user', '=', (int) $user->id, array( 'email', '=', $user->email ) ) ) );

		$return					=	'<legend class="gjHeaderTitle">' . cbgjClass::getOverride( 'panel' ) . '</legend>'
								.	'<div class="gjGrid row-fluid">'
								.		'<div class="gjGridLeft span9">'
								.			'<div class="gjGridLeftLogo span4">'
								.				'<img alt="' . htmlspecialchars( CBTxt::Th( 'Logo' ) ) . '" src="' . $plugin->livePath . '/images/' . $plugin->params->get( 'panel_logo', 'default_panel.png' ) . '" class="gjLogoDefault img-polaroid" />'
								.			'</div>'
								.			'<div class="gjGridLeftInfo span8">'
								.				cbgjClass::getIntegrations( 'gj_onBeforePanelInfo', array( $user, $plugin ) )
								.				( $panelCategoryDisplay && $ownedCategories ? '<div>' . cbgjClass::getOverride( 'category', true ) . ': ' . $ownedCategories . '</div>' : null )
								.				( $panelGroupDisplay && $ownedGroups ? '<div>' . cbgjClass::getOverride( 'group', true ) . ': ' . $ownedGroups . '</div>' : null )
								.				( $panelJoinedDisplay && $joinedGroups ? '<div>' . CBTxt::Ph( 'Joined: [grp_joined_count]', array( '[grp_joined_count]' => $joinedGroups ) ) . '</div>' : null )
								.				( $panelInvitesDisplay && $ownedInvites ? '<div>' . CBTxt::Ph( 'Invites: [grp_invite_count]', array( '[grp_invite_count]' => $ownedInvites ) ) . '</div>' : null )
								.				( $panelInvitedDisplay && $invitedTo ? '<div>' . CBTxt::Ph( 'Invited: [grp_invited_count]', array( '[grp_invited_count]' => $invitedTo ) ) . '</div>' : null )
								.				cbgjClass::getIntegrations( 'gj_onAfterPanelInfo', array( $user, $plugin ) )
								.			'</div>';

		if ( $panelDesc ) {
			if ( $plugin->params->get( 'panel_desc_content', 0 ) ) {
				$panelDesc		=	cbgjClass::prepareContentPlugins( $panelDesc );
			}

			$return				.=			'<div class="gjGridLeftDesc span12 well well-small">' . $panelDesc . '</div>';
		}

		$return					.=		'</div>'
								.		'<div class="gjGridRight span3">'
								.			cbgjClass::getIntegrations( 'gj_onBeforePanelMenu', array( $user, $plugin ) )
								.			( $panelCategoryDisplay && cbgjClass::hasAccess( 'usr_reg', $authorized ) ? '<div><i class="icon-home"></i> <a href="' . cbgjClass::getPluginURL( array( 'panel', 'categories' ) ) . '">' . CBTxt::Ph( 'My [categories]', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ) . '</a></div>' : null )
								.			( $panelGroupDisplay && cbgjClass::hasAccess( 'usr_reg', $authorized ) ? '<div><i class="icon-user"></i> <a href="' . cbgjClass::getPluginURL( array( 'panel', 'groups' ) ) . '">' . CBTxt::Ph( 'My [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) . '</a></div>' : null )
								.			( $panelJoinedDisplay && cbgjClass::hasAccess( 'usr_reg', $authorized ) ? '<div><i class="icon-user"></i> <a href="' . cbgjClass::getPluginURL( array( 'panel', 'joined' ) ) . '">' . CBTxt::Ph( 'Joined [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ) . '</a></div>' : null )
								.			( $panelInvitesDisplay && cbgjClass::hasAccess( 'usr_reg', $authorized ) ? '<div><i class="icon-inbox"></i> <a href="' . cbgjClass::getPluginURL( array( 'panel', 'invites' ) ) . '">' . CBTxt::Th( 'My Invites' ) . '</a></div>' : null )
								.			( $panelInvitedDisplay && cbgjClass::hasAccess( 'usr_reg', $authorized ) ? '<div><i class="icon-inbox"></i> <a href="' . cbgjClass::getPluginURL( array( 'panel', 'invited' ) ) . '">' . CBTxt::Th( 'Invited To' ) . '</a></div>' : null )
								.			cbgjClass::getIntegrations( 'gj_onAfterPanelMenu', array( $user, $plugin ) )
								.			( cbgjClass::hasAccess( 'gen_usr_notifications', $authorized ) ? '<div><i class="icon-info-sign"></i> <a href="' . cbgjClass::getPluginURL( array( 'notifications', 'show' ) ) . '">' . CBTxt::Th( 'Notifications' ) . '</a></div>' : null )
								.			'<div><i class="icon-share-alt"></i> <a href="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '">' . CBTxt::Ph( 'Back to [overview]', array( '[overview]' => cbgjClass::getOverride( 'overview' ) ) ) . '</a></div>'
								.		'</div>'
								.	'</div>';

		return $return;
	}
	/**
	 * save menus
	 *
	 * @param string $id
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	private function saveMenus( $user, $plugin ) {
		$types								=	cbGetParam( $_POST, 'type', array() );
		$categories							=	cbGetParam( $_POST, 'cats', array() );
		$groups								=	cbGetParam( $_POST, 'grps', array() );

		if ( $categories ) {
			cbArrayToInts( $categories );
		}

		if ( $groups ) {
			cbArrayToInts( $groups );
		}

		if ( $types ) {
			foreach ( $types as $type ) {
				switch ( $type ) {
					case 'categories':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( $category->getName(), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=show&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[category_name] menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'groups':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( $group->getName(), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=show&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[group_name] menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No groups specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'new-category-nested':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[category_name] New [category]', array( '[category_name]' => $category->getName(), '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=new&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[category_name] new category menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'new-category-group':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[category_name] New [group]', array( '[category_name]' => $category->getName(), '[group]' => cbgjClass::getOverride( 'group' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=new&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[category_name] new group menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'new-group-nested':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[group_name] New [category]', array( '[group_name]' => $group->getName(), '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=new&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[group_name] new category menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'approve-category':
						if ( ! cbgjClass::setMenu( CBTxt::P( '[category] Approval', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=approval', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Category approval menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'approve-group':
						if ( ! cbgjClass::setMenu( CBTxt::P( '[group] Approval', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=approval', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Group approval menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'new-category':
						if ( ! cbgjClass::setMenu( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=new', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'New category menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'new-group':
						if ( ! cbgjClass::setMenu( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=new', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'New group menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'all-categories':
						if ( ! cbgjClass::setMenu( CBTxt::P( 'All [categories]', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=all', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'All categories menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'all-groups':
						if ( ! cbgjClass::setMenu( CBTxt::P( 'All [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=all', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'All groups menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'all-my-categories':
						if ( ! cbgjClass::setMenu( CBTxt::P( 'All [categories]', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=allmy', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'All categories menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'all-my-groups':
						if ( ! cbgjClass::setMenu( CBTxt::P( 'All [groups]', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=allmy', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'All groups menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'edit-group':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( 'Edit [group_name]', array( '[group_name]' => $group->getName() ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=edit&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( 'Edit [group_name] menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No groups specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'join':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( 'Join [group_name]', array( '[group_name]' => $group->getName() ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=join&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( 'Join [group_name] menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No groups specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'leave':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( 'Leave [group_name]', array( '[group_name]' => $group->getName() ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=leave&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( 'Leave [group_name] menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No groups specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'message-groups':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[category_name] Message [groups]', array( '[category_name]' => $category->getName(), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=message&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[category_name] message groups menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'message-users':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[group_name] Message [users]', array( '[group_name]' => $group->getName(), '[users]' => cbgjClass::getOverride( 'user', true ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=groups&func=message&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[group_name] message users menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No groups specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'edit-category':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( 'Edit [category_name]', array( '[category_name]' => $category->getName() ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=categories&func=edit&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( 'Edit [category_name] menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'notifications-category':
						if ( $categories ) {
							foreach ( $categories as $catid ) {
								$category	=	cbgjData::getCategories( null, array( 'id', '=', (int) $catid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[category_name] Notifications', array( '[category_name]' => $category->getName() ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=notifications&func=show&cat=' . $category->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[category_name] Notifications menu failed to create!', array( '[category_name]' => $category->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No categories specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'notifications-group':
						if ( $groups ) {
							foreach ( $groups as $grpid ) {
								$group		=	cbgjData::getGroups( null, array( 'id', '=', (int) $grpid ), null, null, false );

								if ( ! cbgjClass::setMenu( CBTxt::P( '[group_name] Notifications', array( '[group_name]' => $group->getName() ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=notifications&func=show&cat=' . $group->get( 'category' ) . '&grp=' . $group->get( 'id' ), $plugin ) ) {
									cbgjClass::getPluginURL( array( 'menus' ), CBTxt::P( '[group_name] Notifications menu failed to create!', array( '[group_name]' => $group->getName() ) ), false, true, 'error' );
								}
							}
						} else {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No groups specified to create menus for.' ), false, true, 'error' );
						}
						break;
					case 'message':
						if ( ! cbgjClass::setMenu( CBTxt::P( 'Message [categories]', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=overview&func=message', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Message categories menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'notifications':
						if ( ! cbgjClass::setMenu( CBTxt::T( 'Notifications' ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=notifications&func=show', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Notifications menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'panel':
						if ( ! cbgjClass::setMenu( CBTxt::T( 'Panel' ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=panel', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Panel menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'overview':
						if ( ! cbgjClass::setMenu( CBTxt::P( '[categories] Overview', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element . '&action=overview', $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Overview menu failed to create!' ), false, true, 'error' );
						}
						break;
					case 'plugin':
						$general_title	=	CBTxt::T( $plugin->params->get( 'general_title', null ) );

						if ( ! cbgjClass::setMenu( ( $general_title ? $general_title : $plugin->name ), 'index.php?option=' . $plugin->option . '&task=pluginclass&plugin=' . $plugin->element, $plugin ) ) {
							cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Plugin menu failed to create!' ), false, true, 'error' );
						}
						break;
					default:
						cbgjClass::getIntegrations( 'gj_onMenusIntegrationsSave', array( $type, $categories, $groups, $user, $plugin ), null, 'raw' );
						break;
				}
			}

			cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'Menus created successfully!' ), false, true );
		} else {
			cbgjClass::getPluginURL( array( 'menus' ), CBTxt::T( 'No menus to create.' ), false, true, 'error' );
		}
	}
Example #15
0
	/**
	 * render frontend all groups
	 *
	 * @param boolean $self
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return mixed
	 */
	static function showGroupAll( $self, $rows, $pageNav, $user, $plugin ) {
		global $_CB_framework, $_LANG;

		$generalTitle			=	$plugin->params->get( 'general_title', $plugin->name );

		$_CB_framework->setPageTitle( cbgjClass::getOverride( 'group', true ) );

		if ( $generalTitle != '' ) {
			$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() );
		}

		$_CB_framework->appendPathWay( cbgjClass::getOverride( 'group', true ), cbgjClass::getPluginURL( array( 'groups', ( $self ? 'allmy' : 'all' ) ) ) );

		$groupAllSearch			=	$plugin->params->get( 'group_all_search', 1 );
		$groupAllPaging			=	$plugin->params->get( 'group_all_paging', 1 );
		$groupAllLimitbox		=	$plugin->params->get( 'group_all_limitbox', 1 );
		$groupAllDescLimit		=	(int) $plugin->params->get( 'group_all_desc_limit', 150 );
		$groupApprove			=	$plugin->params->get( 'group_approve', 0 );
		$authorized				=	cbgjClass::getAuthorization( null, null, $user );
		$return					=	'<div class="gjGroupAll">';

		if ( cbgjClass::hasAccess( 'grp_create', $authorized ) ) {
			$return				.=		'<div class="gjTop gjTopCenter">'
								.			'<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new' ), true, true, false, null, true ) . '" />'
								.		'</div>';
		}

		$return					.=		'<form action="' . cbgjClass::getPluginURL( array( 'groups', ( $self ? 'allmy' : 'all' ) ) ) . '" method="post" name="gjForm" id="gjForm" class="gjForm">'
								.			( $groupAllSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) foreach ( $rows as $row ) {
			$category			=	$row->getCategory();
			$authorized			=	cbgjClass::getAuthorization( $category, $row, $user );

			if ( $row->get( 'published' ) == 1 ) {
				$state			=	'<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'unpublish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [group]?', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), true, false, null, true ) . '"><i class="icon-ban-circle"></i> ' . CBTxt::Th( 'Unpublish' ) . '</a></div>';
			} else {
				$state			=	'<div><a href="' . cbgjClass::getPluginURL( array( 'groups', 'publish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-ok"></i> ' . CBTxt::Th( 'Publish' ) . '</a></div>';
			}

			$canApprove			=	( $groupApprove && ( $row->get( 'published' ) == -1 ) && cbgjClass::hasAccess( 'grp_can_publish', $authorized ) );

			$beforeMenu			=	cbgjClass::getIntegrations( 'gj_onBeforeCategoryGroupMenu', array( $row, $category, $user, $plugin ) );
			$afterMenu			=	cbgjClass::getIntegrations( 'gj_onAfterCategoryGroupMenu', array( $row, $category, $user, $plugin ) );

			$return				.=			'<div class="gjContent row-fluid">'
								.				'<div class="gjContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>'
								.				'<div class="gjContentBody mini-layout span10">'
								.					'<div class="gjContentBodyHeader row-fluid">'
								.						'<div class="gjContentBodyTitle span9"><h5>' . $row->getName( 0, true ) . '<small> ' . cbFormatDate( $row->get( 'date' ), 1, false ) . ' - ' . $category->getName( 0, true ) . ( $row->get( 'parent' ) ? ' - ' . $row->getParent()->getName( 0, true ) : null ) . '</small></h5></div>'
								.						'<div class="gjContentBodyMenu span3">';

			if ( $canApprove ) {
				$return			.=							'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'publish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />';
			} else {
				if ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'grp_approved', $authorized ) ) ) ) {
					$return		.=							cbgjClass::getIcon( null, CBTxt::P( 'This [group] is currently unpublished.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), 'icon-eye-close' );
				}

				if ( cbgjClass::hasAccess( 'grp_join', $authorized ) ) {
					$return		.=							' <input type="button" value="' . htmlspecialchars( ( cbgjClass::hasAccess( 'grp_invited', $authorized ) ? CBTxt::T( 'Accept Invite' ) : CBTxt::T( 'Join' ) ) ) . '" class="gjButton gjButtonCancel btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />';
				}
			}

			if ( $beforeMenu || cbgjClass::hasAccess( array( 'grp_leave', 'mod_lvl2', 'mod_lvl3' ), $authorized ) || $afterMenu || ( ( ! $canApprove ) && cbgjClass::hasAccess( 'grp_can_publish', $authorized ) ) || ( $canApprove && cbgjClass::hasAccess( 'grp_join', $authorized ) ) ) {
				$menuItems		=	$beforeMenu
								.	( $canApprove && cbgjClass::hasAccess( 'grp_join', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-plus"></i> ' . CBTxt::Th( 'Join' ) . '</a></div>' : null )
								.	( cbgjClass::hasAccess( 'grp_leave', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'leave', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to leave this [group]?', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), true, false, null, true ) . '"><i class="icon-minus"></i> ' . CBTxt::Th( 'Leave' ) . '</a></div>' : null )
								.	( cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ? '<div><a href="' . cbgjClass::getPluginURL( array( 'groups', 'edit', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-pencil"></i> ' . CBTxt::Th( 'Edit' ) . '</a></div>' : null )
								.	( ( ! $canApprove ) && cbgjClass::hasAccess( 'grp_can_publish', $authorized ) ? $state : null )
								.	( cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'delete', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [group] and all its associated [users]?', array( '[group]' => cbgjClass::getOverride( 'group' ), '[users]' => cbgjClass::getOverride( 'user', true ) ) ), true, false, null, true ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' : null )
								.	$afterMenu;

				$return			.=							cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) );
			}

			$return				.=						'</div>'
								.					'</div>'
								.					'<div class="gjContentBodyInfo">' . ( $row->getDescription( $groupAllDescLimit ) ? '<div class="well well-small">' . $row->getDescription( $groupAllDescLimit ) . '</div>' : null ) . '</div>'
								.					'<div class="gjContentDivider"></div>'
								.					'<div class="gjContentBodyFooter">'
								.						cbgjClass::getIntegrations( 'gj_onBeforeCategoryGroupInfo', array( $row, $category, $user, $plugin ), null, 'span' )
								.						( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? cbgjClass::getOverride( 'group', $row->nestedCount() ) . ' | ' : null )
								.						( $row->userCount() ? cbgjClass::getOverride( 'user', $row->userCount() ) . ' | ' : null )
								.						$row->getType()
								.						cbgjClass::getIntegrations( 'gj_onAfterCategoryGroupInfo', array( $row, $category, $user, $plugin ), null, 'span' )
								.					'</div>'
								.				'</div>'
								.			'</div>';
		} else {
			$return				.=			'<div class="gjContent">';

			if ( $groupAllSearch && $pageNav->searching ) {
				$return			.=				CBTxt::Ph( 'No [group] search results found.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) );
			} else {
				$return			.=				CBTxt::Ph( 'There are no [groups] available.', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) );
			}

			$return				.=			'</div>';
		}

		if ( $groupAllPaging ) {
			$return				.=			'<div class="gjPaging pagination pagination-centered">'
								.				( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
								.				( ! $groupAllLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
								.			'</div>';
		}

		$return					.=			cbGetSpoofInputTag( 'plugin' )
								.		'</form>'
								.	'</div>';

		echo $return;
	}
	/**
	 * render frontend invites list
	 *
	 * @param array $rows
	 * @param cbgjCategory $category
	 * @param cbgjGroup $group
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return mixed
	 */
	static function showInvitesList( $rows, $category, $group, $user, $plugin ) {
		$group->setPathway( CBTxt::T( 'Invites List' ), true );

		$inviteBy			=	explode( '|*|', $plugin->params->get( 'group_invites_by', '1|*|2|*|3|*|4' ) );

		$return				=	'<div class="gjInvitesList">'
							.		'<form action="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="gjForm" id="gjForm" class="gjForm">'
							.			'<legend class="gjEditTitle">' . cbgjClass::getOverride( 'user', true ) . '</legend>';

		if ( $rows ) {
			$return			.=			'<div class="gjContent">';

			foreach ( $rows as $row ) {
				$cbUser		=&	CBuser::getInstance( (int) $row->get( 'id' ) );

				if ( ! $cbUser ) {
					$cbUser	=&	CBuser::getInstance( null );
				}

				$recipient	=&	$cbUser->getUserData();

				if ( in_array( 1, $inviteBy ) ) {
					$invite	=	(int) $recipient->id;
				} elseif ( in_array( 4, $inviteBy ) ) {
					$invite	=	$recipient->email;
				} elseif ( in_array( 2, $inviteBy ) ) {
					$invite	=	$recipient->username;
				} elseif ( in_array( 3, $inviteBy ) ) {
					$invite	=	$recipient->name;
				}

				if ( ! $invite ) {
					$invite	=	(int) $row->get( 'id' );
				}

				$inviteUrl	=	"document.gjForm.invites_invite.value = '" . addslashes( $invite ) . "';"
							.	"document.gjForm.submit();";

				$return		.=				'<div class="gjContentBox mini-layout">'
							.					'<div class="gjContentBoxRow">' . $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</div>'
							.					'<div class="gjContentBoxRow">' . $cbUser->getField( 'avatar', null, 'html', 'none', 'list', 0, true ) . '</div>'
							.					'<div class="gjContentBoxRow">' . $cbUser->getField( 'onlinestatus', null, 'html', 'none', 'profile', 0, true  ) . '</div>'
							.					'<div class="gjContentBoxRow">'
							.						'<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Invite' ) ) . '" class="gjButton btn btn-success" onclick="' . $inviteUrl . '" />'
							.					'</div>'
							.				'</div>';
			}

			$return			.=			'</div>';
		} else {
			$return			.=			'<div class="gjContent">' . CBTxt::Ph( 'There are no [users] available to invite.', array( '[users]' => cbgjClass::getOverride( 'user', true ) ) ) . '</div>';
		}

		$return				.=			'<div class="gjButtonWrapper form-actions">'
							.				'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="gjButton gjButtonCancel btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'show', (int) $category->get( 'id' ), (int) $group->get( 'id' ) ), CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '" />'
							.			'</div>'
							.			'<input type="hidden" name="invites_invite" id="invites_invite" value="" />'
							.			'<input type="hidden" name="invites_list" id="invites_list" value="1" />'
							.			cbGetSpoofInputTag( 'plugin' )
							.		'</form>'
							.	'</div>';

		echo $return;
	}
Example #17
0
	/**
	 * render frontend group main
	 *
	 * @param cbgjGroup $row
	 * @param cbgjCategory $category
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showGroupMain( $row, $category, $user, $plugin ) {
		global $_CB_framework;

		$componentClass			=	new CBplug_cbgroupjive();
		$authorized				=	cbgjClass::getAuthorization( $category, $row, $user );

		$tabs					=	new cbTabs( 1, 1 );

		$beforeTab				=	cbgjClass::getIntegrations( 'gj_onBeforeGroupTab', array( $tabs, $row, $category, $user, $plugin ), null, null );
		$afterTab				=	cbgjClass::getIntegrations( 'gj_onAfterGroupTab', array( $tabs, $row, $category, $user, $plugin ), null, null );

		$return					=	null;

		if ( ( $row->get( 'published' ) == -1 ) && $plugin->params->get( 'group_approve', 0 ) ) {
			$return				.=	'<div class="alert alert-error">' . CBTxt::P( 'This [group] is currently pending approval.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</div>';
		} elseif ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'grp_approved', $authorized ) ) ) ) {
			$return				.=	'<div class="alert alert-error">' . CBTxt::P( 'This [group] is currently unpublished.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</div>';
		} else {
			if ( $user->id ) {
				if ( ( $row->get( 'type' ) == 2 ) && cbgjClass::hasAccess( 'grp_usr_inactive', $authorized ) ) {
					$return		.=	'<div class="alert alert-error">' . CBTxt::P( '[group] join request awaiting approval.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</div>';
				}
			}
		}

		if ( $plugin->params->get( 'group_new_group', 0 ) && cbgjClass::hasAccess( 'grp_nested_create', $authorized ) ) {
			$return				.=	'<div class="gjTop gjTopCenter">'
								.		'<div class="btn-group">'
								.			'<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), true ) . '" />'
								.		'</div>'
								.	'</div>';
		}

		$return					.=	$tabs->startPane( 'gjGroupTabs' );

		$tabContent				=	false;

		if ( cbgjClass::hasAccess( 'grp_approved', $authorized ) && $row->nestedCount() && ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) || $row->get( 'nested' ) ) ) {
			$return				.=		$tabs->startTab( null, cbgjClass::getOverride( 'group', true ), 'gjGroups' )
								.			'<div class="gjNestedGroups">'
								.				$componentClass->showNestedGroups( $row, $category, $user, $plugin )
								.			'</div>'
								.		$tabs->endTab();

			$tabContent			=	true;
		}

		$return					.=		$beforeTab;

		if ( cbgjClass::hasAccess( 'grp_approved', $authorized ) && ( ( ( ! $row->get( 'users' ) ) && cbgjClass::hasAccess( 'mod_lvl5', $authorized ) ) || $row->users ) ) {
			$return				.=		$tabs->startTab( null, cbgjClass::getOverride( 'user', true ), 'gjUsers' )
								.			'<div class="gjUsers">'
								.				$componentClass->showUsers( $row, $category, $user, $plugin )
								.			'</div>'
								.		$tabs->endTab();

			$tabContent			=	true;
		}

		if ( cbgjClass::hasAccess( array( 'grp_approved', 'grp_invite' ), $authorized, true ) ) {
			$return				.=		$tabs->startTab( null, htmlspecialchars( CBTxt::T( 'Invites' ) ), 'gjInvites' )
								.			'<div class="gjInvites">'
								.				$componentClass->showInvites( $category, $row, $user, $plugin )
								.			'</div>'
								.		$tabs->endTab();

			$tabContent			=	true;
		}

		if ( ( ! $tabContent ) && ( ! $beforeTab ) && ( ! $afterTab ) ) {
			if ( $user->id ) {
				if ( cbgjClass::hasAccess( 'grp_approved', $authorized ) && ( ! ( $row->get( 'type' ) == 2 ) && cbgjClass::hasAccess( 'grp_usr_inactive', $authorized ) ) ) {
					$return		.=		'<div>'
								.			CBTxt::Ph( 'Please join the [group] to view its content.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) )
								.		'</div>';
				}
			} else {
				$return			.=		'<div>'
								.			CBTxt::Ph( 'Please login or register to view [group] content.', array( '[group]' => cbgjClass::getOverride( 'group' ) ) )
								.		'</div>';
			}
		}

		$return					.=		$afterTab
								.	$tabs->endPane();

		if ( isset( $_GET['tab'] ) ) {
			$tab				=	urldecode( stripslashes( cbGetParam( $_GET, 'tab' ) ) );
		} elseif ( isset( $_POST['tab'] ) ) {
			$tab				=	stripslashes( cbGetParam( $_POST, 'tab' ) );
		} else {
			$tab				=	null;
		}

		if ( $tab ) {
			$js					=	"$( '#gjGroupTabs .tab-row .tab a' ).each( function() {"
								.		"if ( $( this ).text().toLowerCase() == '" . addslashes( strtolower( $tab ) ) . "' ) {"
								.			"$( this ).parent( '.tab' ).trigger( 'click' );"
								.		"}"
								.	"});";

			$_CB_framework->outputCbJQuery( $js );
		}

		return $return;
	}
Example #18
0
	/**
	 * render frontend category main
	 *
	 * @param cbgjCategory $row
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showCategoryMain( $row, $user, $plugin ) {
		global $_CB_framework;

		$componentClass			=	new CBplug_cbgroupjive();
		$authorized				=	cbgjClass::getAuthorization( $row, null, $user );

		$tabs					=	new cbTabs( 1, 1 );

		$newCategory			=	( $plugin->params->get( 'category_new_category', 0 ) && cbgjClass::hasAccess( 'cat_nested_create', $authorized ) );
		$newGroup				=	( $plugin->params->get( 'category_new_group', 0 ) && cbgjClass::hasAccess( 'cat_grp_create', $authorized ) );
		$hasNested				=	( $row->nestedCount() && cbgjClass::hasAccess( 'cat_approved', $authorized ) );
		$beforeTab				=	cbgjClass::getIntegrations( 'gj_onBeforeCategoryTab', array( $tabs, $row, $user, $plugin ), null, null );
		$afterTab				=	cbgjClass::getIntegrations( 'gj_onAfterCategoryTab', array( $tabs, $row, $user, $plugin ), null, null );

		$return					=	null;

		if ( ( $row->get( 'published' ) == -1 ) && $plugin->params->get( 'category_approve', 0 ) ) {
			$return				.=	'<div class="alert alert-error">' . CBTxt::P( 'This [category] is currently pending approval.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</div>';
		} elseif ( ( $row->get( 'published' ) == 0 ) || ( ( $row->get( 'published' ) == 1 ) && ( ! cbgjClass::hasAccess( 'cat_approved', $authorized ) ) ) ) {
			$return				.=	'<div class="alert alert-error">' . CBTxt::P( 'This [category] is currently unpublished.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</div>';
		}

		if ( $newCategory || $newGroup ) {
			$return				.=	'<div class="gjTop gjTopCenter">'
								.		'<div class="btn-group">'
								.			( $newCategory ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'new', (int) $row->get( 'id' ) ), true ) . '" />' : null )
								.			( $newGroup ? '<input type="button" value="' . htmlspecialchars( CBTxt::P( 'New [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) ) . '" class="gjButton btn" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'new', (int) $row->get( 'id' ) ), true ) . '" />' : null )
								.		'</div>'
								.	'</div>';
		}

		if ( $beforeTab || $afterTab || $hasNested ) {
			$return				.=	$tabs->startPane( 'getCategoryTabs' );

			if ( $hasNested && ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) ) {
				$return			.=		$tabs->startTab( null, cbgjClass::getOverride( 'category', true ), 'gjCategories' )
								.			'<div class="gjNestedCategories">'
								.				$componentClass->showNestedCategories( $row, $user, $plugin )
								.			'</div>'
								.		$tabs->endTab();
			}

			$return				.=		$beforeTab;

			if ( cbgjClass::hasAccess( 'cat_approved', $authorized ) ) {
				$return			.=		$tabs->startTab( null, cbgjClass::getOverride( 'group', true ), 'gjGroups' );
			}
		}

		if ( cbgjClass::hasAccess( 'cat_approved', $authorized ) ) {
			$return				.=			'<div class="gjCategoryGroups">'
								.				$componentClass->showCategoryGroups( $row, $user, $plugin )
								.			'</div>';
		}

		if ( $beforeTab || $afterTab || $hasNested ) {
			if ( cbgjClass::hasAccess( 'cat_approved', $authorized ) ) {
				$return			.=		$tabs->endTab();
			}

			$return				.=		$afterTab
								.	$tabs->endPane();
		}

		if ( isset( $_GET['tab'] ) ) {
			$tab				=	urldecode( stripslashes( cbGetParam( $_GET, 'tab' ) ) );
		} elseif ( isset( $_POST['tab'] ) ) {
			$tab				=	stripslashes( cbGetParam( $_POST, 'tab' ) );
		} else {
			$tab				=	null;
		}

		if ( $tab ) {
			$js					=	"$( '#getCategoryTabs .tab-row .tab a' ).each( function() {"
								.		"if ( $( this ).text().toLowerCase() == '" . addslashes( strtolower( $tab ) ) . "' ) {"
								.			"$( this ).parent( '.tab' ).trigger( 'click' );"
								.		"}"
								.	"});";

			$_CB_framework->outputCbJQuery( $js );
		}

		return $return;
	}
	/**
	 * prepares and appends category pathway and title
	 *
	 * @param string $title
	 * @param mixed $url
	 */
	public function setPathway( $title = null, $url = null ) {
		global $_CB_framework;

		$plugin				=	cbgjClass::getPlugin();
		$generalTitle		=	$plugin->params->get( 'general_title', $plugin->name );

		if ( $title !== false ) {
			if ( ! $title ) {
				$title		=	$this->getName();
			}

			if ( $title ) {
				$_CB_framework->setPageTitle( htmlspecialchars( $title ) );
			}
		} else {
			$title			=	$this->getName();
		}

		if ( $generalTitle != '' ) {
			$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() );
		}

		$_CB_framework->appendPathWay( htmlspecialchars( cbgjClass::getOverride( 'category', true ) . ' ' . cbgjClass::getOverride( 'overview' ) ), cbgjClass::getPluginURL( array( 'overview' ) ) );
		$this->setParentPathway();

		if ( $url ) {
			if ( $this->get( 'id' ) ) {
				$_CB_framework->appendPathWay( $this->getName(), $this->getUrl() );
			}

			if ( $url === true ) {
				if ( $this->get( 'id' ) ) {
					$url	=	$this->getUrl();
				} else {
					$url	=	cbgjClass::getPluginURL( array( 'overview', 'show' ) );
				}
			}

			if ( $title ) {
				$_CB_framework->appendPathWay( htmlspecialchars( $title ), $url );
			}
		} else {
			if ( $title ) {
				$_CB_framework->appendPathWay( htmlspecialchars( $title ), $this->getUrl() );
			}
		}
	}
Example #20
0
	/**
	 * render frontend tab invites
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $displayed
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @param boolean $tabbed
	 * @return mixed
	 */
	static function showInvited( $rows, $pageNav, $displayed, $user, $plugin, $tabbed ) {
		global $_CB_framework;

		$invitedTabSearch		=	$plugin->params->get( 'invited_tab_search', 1 );
		$invitedTabPaging		=	$plugin->params->get( 'invited_tab_paging', 1 );
		$invitedTabLimitbox		=	$plugin->params->get( 'invited_tab_limitbox', 1 );
		$invitedTabDescLimit	=	(int) $plugin->params->get( 'invited_tab_desc_limit', 150 );

		if ( ! $tabbed ) {
			$formUrl			=	cbgjClass::getPluginURL( array( 'panel', 'invited' ) );
		} else {
			$formUrl			=	$_CB_framework->userProfileUrl( $displayed->id, true, $plugin->tab->tabid );
		}

		$return					=	'<div class="gjTabInvited">'
								.		'<form action="' . $formUrl . '" method="post" name="gjTabForm_invited" id="gjTabForm_invited" class="gjForm">'
								.			( $invitedTabSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) foreach ( $rows as $row ) {
			$category			=	$row->getCategory();
			$authorized			=	cbgjClass::getAuthorization( $category, $row, $user );

			if ( $row->get( 'published' ) == 1 ) {
				$state			=	'<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'unpublish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to unpublish this [group]?', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), true, false, null, true ) . '"><i class="icon-ban-circle"></i> ' . CBTxt::Th( 'Unpublish' ) . '</a></div>';
			} else {
				$state			=	'<div><a href="' . cbgjClass::getPluginURL( array( 'groups', 'publish', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-ok"></i> ' . CBTxt::Th( 'Publish' ) . '</a></div>';
			}

			$beforeMenu			=	cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInvitedMenu', array( $row, $category, $displayed, $user, $plugin ) );
			$afterMenu			=	cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInvitedMenu', array( $row, $category, $displayed, $user, $plugin ) );

			$return				.=			'<div class="gjContent row-fluid">'
								.				'<div class="gjContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>'
								.				'<div class="gjContentBody mini-layout span10">'
								.					'<div class="gjContentBodyHeader row-fluid">'
								.						'<div class="gjContentBodyTitle span9"><h5>' . $row->getName( 0, true ) . '<small> ' . cbFormatDate( $row->get( 'date' ), 1, false ) . ' - ' . $category->getName( 0, true ) . ( $row->get( 'parent' ) ? ' - ' . $row->getParent()->getName( 0, true ) : null ) . '</small></h5></div>'
								.						'<div class="gjContentBodyMenu span3">';

			if ( cbgjClass::hasAccess( 'grp_join', $authorized ) ) {
				$return			.=							'<input type="button" value="' . htmlspecialchars( ( cbgjClass::hasAccess( 'grp_invited', $authorized ) ? CBTxt::T( 'Accept Invite' ) : CBTxt::T( 'Join' ) ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />';
			}

			if ( $beforeMenu || cbgjClass::hasAccess( array( 'grp_leave', 'mod_lvl2', 'mod_lvl3', 'grp_can_publish' ), $authorized ) || $afterMenu ) {
				$menuItems		=	$beforeMenu
								.	( cbgjClass::hasAccess( 'grp_leave', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'leave', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to leave this [group]?', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ), true, false, null, true ) . '"><i class="icon-minus"></i> ' . CBTxt::Th( 'Leave' ) . '</a></div>' : null )
								.	( cbgjClass::hasAccess( 'mod_lvl3', $authorized ) ? '<div><a href="' . cbgjClass::getPluginURL( array( 'groups', 'edit', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-pencil"></i> ' . CBTxt::Th( 'Edit' ) . '</a></div>' : null )
								.	( cbgjClass::hasAccess( 'grp_can_publish', $authorized ) ? $state : null )
								.	( cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'delete', (int) $category->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [group] and all its associated [users]?', array( '[group]' => cbgjClass::getOverride( 'group' ), '[users]' => cbgjClass::getOverride( 'user', true ) ) ), true, false, null, true ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' : null )
								.	$afterMenu;

				$return			.=							cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) );
			}

			$return				.=						'</div>'
								.					'</div>'
								.					'<div class="gjContentBodyInfo">' . ( $row->getDescription( $invitedTabDescLimit ) ? '<div class="well well-small">' . $row->getDescription( $invitedTabDescLimit ) . '</div>' : null ) . '</div>'
								.					'<div class="gjContentDivider"></div>'
								.					'<div class="gjContentBodyFooter">'
								.						cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInvitedInfo', array( $row, $category, $displayed, $user, $plugin ), null, 'span' )
								.						( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl2', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? cbgjClass::getOverride( 'group', $row->nestedCount() ) . ' | ' : null )
								.						( $row->userCount() ? cbgjClass::getOverride( 'user', $row->userCount() ) . ' | ' : null )
								.						$row->getType()
								.						cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInvitedInfo', array( $row, $category, $displayed, $user, $plugin ), null, 'span' )
								.					'</div>'
								.				'</div>'
								.			'</div>';
		} else {
			$return				.=			'<div class="gjContent">';

			if ( $invitedTabSearch && $pageNav->searching ) {
				$return			.=				CBTxt::Th( 'No invite search results found.' );
			} else {
				if ( $displayed->id == $user->id ) {
					$return		.=				CBTxt::Ph( 'You are not invited to any [groups].', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) );
				} else {
					$return		.=				CBTxt::Ph( 'This user is not invited to any [groups].', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) );
				}
			}

			$return				.=			'</div>';
		}

		if ( $invitedTabPaging ) {
			$return				.=			'<div class="gjPaging pagination pagination-centered">'
								.				( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
								.				( ! $invitedTabLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
								.			'</div>';
		}

		$return					.=			cbGetSpoofInputTag( 'plugin' )
								.		'</form>'
								.	'</div>';

		return $return;
	}
								.					( $nestedCount ? '<div class="gjModuleContentBoxRow">' . cbgjClass::getOverride( 'group', $row->nestedCount() ) . '</div>' : null )
								.					( $row->userCount() ? '<div class="gjModuleContentBoxRow">' . cbgjClass::getOverride( 'user', $row->userCount() ) . '</div>' : null )
								.					'<div class="gjModuleContentBoxRow"><input type="button" value="' . htmlspecialchars( CBTxt::T( 'Join' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $row->get( 'category' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" /></div>'
								.				'</div>';
		} else {
			$return				.=				'<div class="gjModuleContent row-fluid">'
								.					'<div class="gjModuleContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>'
								.					'<div class="gjModuleContentBody span10">'
								.						'<div class="gjModuleContentBodyTitle">' . $row->getName( $nameLength, true ) . '</div>'
								.						'<div class="gjModuleContentBodyInfo">'
								.							( $nestedCount ? cbgjClass::getOverride( 'group', $row->nestedCount() ) : null )
								.							( $row->userCount() ? ( $nestedCount ? ' | ' : null ) . cbgjClass::getOverride( 'user', $row->userCount() ) : null )
								.						'</div>'
								.						'<div class="gjModuleContentBodyFooter"><input type="button" value="' . htmlspecialchars( CBTxt::T( 'Join' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'groups', 'join', (int) $row->get( 'category' ), (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" /></div>'
								.					'</div>'
								.				'</div>'
								.				'<div class="gjModuleContentDivider"></div>';
		}
	} else {
		$return					.=				CBTxt::P( 'You are not invited to any [groups].', array( '[groups]' => cbgjClass::getOverride( 'group', true ) ) );
	}

	$return						.=			'</div>';
}

$return							.=		'</div>'
								.	'</div>';

echo $return;
?>
	/**
	 * render frontend categories approval
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 */
	static function showCategoryApproval( $rows, $pageNav, $user, $plugin ) {
		global $_CB_framework;

		$generalTitle				=	$plugin->params->get( 'general_title', $plugin->name );

		$_CB_framework->setPageTitle( CBTxt::P( '[category] Approval', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) );

		if ( $generalTitle != '' ) {
			$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( $generalTitle ) ), cbgjClass::getPluginURL() );
		}

		$_CB_framework->appendPathWay( CBTxt::P( '[category] Approval', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ), cbgjClass::getPluginURL( array( 'categories', 'approval' ) ) );

		$categoryApprovalSearch		=	$plugin->params->get( 'category_approval_search', 1 );
		$categoryApprovalPaging		=	$plugin->params->get( 'category_approval_paging', 1 );
		$categoryApprovalLimitbox	=	$plugin->params->get( 'category_approval_limitbox', 1 );
		$categoryApprovalDescLimit	=	(int) $plugin->params->get( 'category_approval_desc_limit', 150 );

		$return						=	'<div class="gjCategoryApproval">'
									.		'<form action="' . cbgjClass::getPluginURL( array( 'categories', 'approval' ) ) . '" method="post" name="gjForm" id="gjForm" class="gjForm">'
									.			( $categoryApprovalSearch && ( $pageNav->searching || $pageNav->total ) ? '<div class="gjTop gjTopRight">' . $pageNav->search . '</div>' : null );

		if ( $rows ) foreach ( $rows as $row ) {
			$authorized				=	cbgjClass::getAuthorization( $row, null, $user );
			$beforeMenu				=	cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryMenu', array( $row, $user, $plugin ) );
			$afterMenu				=	cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryMenu', array( $row, $user, $plugin ) );

			$return					.=			'<div class="gjContent row-fluid">'
									.				'<div class="gjContentLogo span2">' . $row->getLogo( true, true, true ) . '</div>'
									.				'<div class="gjContentBody mini-layout span10">'
									.					'<div class="gjContentBodyHeader row-fluid">'
									.						'<div class="gjContentBodyTitle span9"><h5>' . $row->getName( 0, true ) . '<small> ' . cbFormatDate( $row->get( 'date' ), 1, false ) . ( $row->get( 'parent' ) ? ' - ' . $row->getParent()->getName( 0, true ) : null ) . '</small></h5></div>'
									.						'<div class="gjContentBodyMenu span3">';

			if ( cbgjClass::hasAccess( 'cat_can_publish', $authorized ) ) {
				$return				.=						'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Approve' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'publish', (int) $row->get( 'id' ) ), true, true, false, null, true ) . '" />';
			}

			if ( $beforeMenu || cbgjClass::hasAccess( 'mod_lvl1', $authorized ) || $afterMenu ) {
				$menuItems			=	$beforeMenu
									.	( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="' . cbgjClass::getPluginURL( array( 'categories', 'edit', (int) $row->get( 'id' ) ), null, true, false, null, true ) . '"><i class="icon-pencil"></i> ' . CBTxt::Th( 'Edit' ) . '</a></div>' : null )
									.	( cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ? '<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'categories', 'delete', (int) $row->get( 'id' ) ), CBTxt::P( 'Are you sure you want to delete this [category] and all its associated [groups]?', array( '[category]' => cbgjClass::getOverride( 'category' ), '[groups]' => cbgjClass::getOverride( 'group', true ) ) ), true, false, null, true ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>' : null )
									.	$afterMenu;

				$return				.=							cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) );
			}

			$return					.=						'</div>'
									.					'</div>'
									.					'<div class="gjContentBodyInfo">' . ( $row->getDescription( $categoryApprovalDescLimit ) ? '<div class="well well-small">' . $row->getDescription( $categoryApprovalDescLimit ) . '</div>' : null ) . '</div>'
									.					'<div class="gjContentDivider"></div>'
									.					'<div class="gjContentBodyFooter">'
									.						cbgjClass::getIntegrations( 'gj_onBeforeOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' )
									.						( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() ? cbgjClass::getOverride( 'category', $row->nestedCount() ) . ' | ' : null )
									.						( $row->groupCount() ? cbgjClass::getOverride( 'group', $row->groupCount() ) . ' | ' : null )
									.						implode( ', ', $row->getTypes() )
									.						cbgjClass::getIntegrations( 'gj_onAfterOverviewCategoryInfo', array( $row, $user, $plugin ), null, 'span' )
									.					'</div>'
									.				'</div>'
									.			'</div>';
		} else {
			$return					.=			'<div class="gjContent">';

			if ( $categoryApprovalSearch && $pageNav->searching ) {
				$return				.=				CBTxt::Ph( 'No [category] search results found.', array( '[category]' => cbgjClass::getOverride( 'category' ) ) );
			} else {
				$return				.=				CBTxt::Ph( 'There are no [categories] pending approval.', array( '[categories]' => cbgjClass::getOverride( 'category', true ) ) );
			}

			$return					.=			'</div>';
		}

		if ( $categoryApprovalPaging ) {
			$return					.=			'<div class="gjPaging pagination pagination-centered">'
									.				( $pageNav->total > $pageNav->limit ? $pageNav->pagelinks : null )
									.				( ! $categoryApprovalLimitbox ? $pageNav->getLimitBox( false ) : ( $pageNav->total ? '<div class="gjPagingLimitbox">' . $pageNav->limitbox . '</div>' : null ) )
									.			'</div>';
		}

		$return						.=		'</form>'
									.	'</div>';

		echo $return;
	}