Esempio n. 1
0
 /**
  * Shows Forum Posts
  *
  * @param  stdClass[]   $rows       Rows to show
  * @param  cbPageNav    $pageNav    Page Navigation
  * @param  boolean      $searching  Are we searching currently ?
  * @param  string[]     $input      Inputs to show
  * @param  UserTable    $viewer     Viewing User
  * @param  UserTable    $user       Viewed at User
  * @param  TabTable     $tab        Current Tab
  * @param  PluginTable  $plugin     Current Plugin
  * @return string
  */
 public static function showPosts($rows, $pageNav, $searching, $input, $viewer, $user, $tab, $plugin)
 {
     global $_CB_framework;
     $tabPaging = $tab->params->get('tab_posts_paging', 1);
     $canSearch = $tab->params->get('tab_posts_search', 1) && ($searching || $pageNav->total);
     $return = '<div class="forumsPostsTab tab-content">' . '<form action="' . $_CB_framework->userProfileUrl($user->id, true, $tab->tabid) . '" method="post" name="forumPostsForm" id="forumPostsForm" class="forumPostsForm">';
     if ($canSearch) {
         $return .= '<div class="forumsHeader row" style="margin-bottom: 10px;">' . '<div class="col-sm-offset-8 col-sm-4 text-right">' . '<div class="input-group">' . '<span class="input-group-addon"><span class="fa fa-search"></span></span>' . $input['search'] . '</div>' . '</div>' . '</div>';
     }
     $return .= '<table class="forumsContainer table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 50%;" class="text-left">' . CBTxt::T('Subject') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Category') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Date') . '</th>' . '</tr>' . '</thead>' . '<tbody>';
     if ($rows) {
         foreach ($rows as $row) {
             $return .= '<tr>' . '<td style="width: 50%;" class="text-left"><a href="' . (isset($row->url) ? $row->url : cbforumsModel::getForumURL($row->category_id, $row->id)) . '">' . cbforumsClass::cleanPost($row->subject) . '</a></td>' . '<td style="width: 25%;" class="text-left hidden-xs"><a href="' . (isset($row->category_url) ? $row->category_url : cbforumsModel::getForumURL($row->category_id)) . '">' . cbforumsClass::cleanPost($row->category_name) . '</a></td>' . '<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate(date('Y-m-d H:i:s', $row->date)) . '</td>' . '</tr>';
         }
     } else {
         $return .= '<tr>' . '<td colspan="3" class="text-left">';
         if ($searching) {
             $return .= CBTxt::T('No post search results found.');
         } else {
             if ($viewer->id == $user->id) {
                 $return .= CBTxt::T('You have no posts.');
             } else {
                 $return .= CBTxt::T('This user has no posts.');
             }
         }
         $return .= '</td>' . '</tr>';
     }
     $return .= '</tbody>';
     if ($tabPaging && $pageNav->total > $pageNav->limit) {
         $return .= '<tfoot>' . '<tr>' . '<td colspan="3" class="text-center">' . $pageNav->getListLinks() . '</td>' . '</tr>' . '</tfoot>';
     }
     $return .= '</table>' . $pageNav->getLimitBox(false) . '</form>' . '</div>';
     return $return;
 }
Esempio n. 2
0
 /**
  * Renders the Articles tab
  *
  * @param  Table[]      $rows       Articles to render
  * @param  cbPageNav    $pageNav    Pagination
  * @param  boolean      $searching  Currently searching
  * @param  string[]     $input      HTML of input elements
  * @param  UserTable    $viewer     Viewing user
  * @param  UserTable    $user       Viewed user
  * @param  stdClass     $model      The model reference
  * @param  TabTable     $tab        Current Tab
  * @param  PluginTable  $plugin     Current Plugin
  * @return string                   HTML
  */
 public static function showArticleTab($rows, $pageNav, $searching, $input, $viewer, $user, $model, $tab, $plugin)
 {
     global $_CB_framework;
     $tabPaging = $tab->params->get('tab_paging', 1);
     $canSearch = $tab->params->get('tab_search', 1) && ($searching || $pageNav->total);
     $return = '<div class="articlesTab">' . '<form action="' . $_CB_framework->userProfileUrl($user->id, true, $tab->tabid) . '" method="post" name="articleForm" id="articleForm" class="articleForm">';
     if ($canSearch) {
         $return .= '<div class="articlesHeader row" style="margin-bottom: 10px;">' . '<div class="col-sm-offset-8 col-sm-4 text-right">' . '<div class="input-group">' . '<span class="input-group-addon"><span class="fa fa-search"></span></span>' . $input['search'] . '</div>' . '</div>' . '</div>';
     }
     $return .= '<table class="articlesContainer table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 50%;" class="text-left">' . CBTxt::T('Article') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Category') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Created') . '</th>' . '</tr>' . '</thead>' . '<tbody>';
     if ($rows) {
         foreach ($rows as $row) {
             $return .= '<tr>' . '<td style="width: 50%;" class="text-left"><a href="' . cbarticlesModel::getUrl($row, true, 'article') . '">' . $row->get('title') . '</a></td>' . '<td style="width: 25%;" class="text-left hidden-xs">' . ($row->get('category') ? '<a href="' . cbarticlesModel::getUrl($row, true, 'category') . '">' . $row->get('category_title') . '</a>' : CBTxt::T('None')) . '</td>' . '<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate($row->get('created')) . '</td>' . '</tr>';
         }
     } else {
         $return .= '<tr>' . '<td colspan="3" class="text-left">';
         if ($searching) {
             $return .= CBTxt::T('No article search results found.');
         } else {
             if ($viewer->id == $user->id) {
                 $return .= CBTxt::T('You have no articles.');
             } else {
                 $return .= CBTxt::T('This user has no articles.');
             }
         }
         $return .= '</td>' . '</tr>';
     }
     $return .= '</tbody>';
     if ($tabPaging && $pageNav->total > $pageNav->limit) {
         $return .= '<tfoot>' . '<tr>' . '<td colspan="3" class="text-center">' . $pageNav->getListLinks() . '</td>' . '</tr>' . '</tfoot>';
     }
     $return .= '</table>' . $pageNav->getLimitBox(false) . '</form>' . '</div>';
     return $return;
 }
Esempio n. 3
0
 /**
  * Shows Forum Category Subscriptions
  *
  * @param  stdClass[]   $rows       Rows to show
  * @param  cbPageNav    $pageNav    Page Navigation
  * @param  boolean      $searching  Are we searching currently ?
  * @param  string[]     $input      Inputs to show
  * @param  UserTable    $viewer     Viewing User
  * @param  UserTable    $user       Viewed at User
  * @param  TabTable     $tab        Current Tab
  * @param  PluginTable  $plugin     Current Plugin
  * @return string
  */
 public static function showCategorySubscriptions($rows, $pageNav, $searching, $input, $viewer, $user, $tab, $plugin)
 {
     global $_CB_framework;
     $tabPaging = $tab->params->get('tab_subs_paging', 1);
     $canSearch = $tab->params->get('tab_subs_search', 1) && ($searching || $pageNav->total);
     $unsuballUrl = "javascript: if ( confirm( '" . addslashes(CBTxt::T('Are you sure you want to delete all Subscriptions?')) . "' ) ) { location.href = '" . addslashes($_CB_framework->userProfileUrl($user->id, false, $tab->tabid) . '&forums_unsubcat=all') . "'; }";
     $return = '<div class="forumsCatSubsTab">' . '<form action="' . $_CB_framework->userProfileUrl($user->id, true, $tab->tabid) . '" method="post" name="forumCatSubsForm" id="forumCatSubsForm" class="forumCatSubsForm">';
     if ($canSearch) {
         $return .= '<div class="forumsHeader row" style="margin-bottom: 10px;">' . '<div class="col-sm-offset-8 col-sm-4 text-right">' . '<div class="input-group">' . '<span class="input-group-addon"><span class="fa fa-search"></span></span>' . $input['search'] . '</div>' . '</div>' . '</div>';
     }
     $return .= '<table class="forumsContainer table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 99%;" class="text-left">' . CBTxt::T('Category') . '</th>' . '<th style="width: 1%;" class="text-right">' . ($rows ? '<a href="javascript: void(0);" onclick="' . $unsuballUrl . '" title="' . htmlspecialchars(CBTxt::T('Delete All')) . '"><span class="fa fa-trash-o"></span></a>' : '&nbsp;') . '</th>' . '</tr>' . '</thead>' . '<tbody>';
     if ($rows) {
         foreach ($rows as $row) {
             $unsubUrl = "javascript: if ( confirm( '" . addslashes(CBTxt::T('Are you sure you want to delete this Subscription?')) . "' ) ) { location.href = '" . addslashes($_CB_framework->userProfileUrl($user->id, false, $tab->tabid) . '&forums_unsubcat=' . $row->id) . "'; }";
             $return .= '<tr>' . '<td style="width: 99%;" class="text-left"><a href="' . (isset($row->category_url) ? $row->category_url : cbforumsModel::getForumURL($row->category_id)) . '">' . cbforumsClass::cleanPost($row->category_name) . '</a></td>' . '<td style="width: 1%;" class="text-right"><a href="javascript: void(0);" onclick="' . $unsubUrl . '" title="' . htmlspecialchars(CBTxt::T('Delete')) . '"><span class="fa fa-trash-o"></span></a></td>' . '</tr>';
         }
     } else {
         $return .= '<tr>' . '<td colspan="2" class="text-left">';
         if ($searching) {
             $return .= CBTxt::T('No category subscription search results found.');
         } else {
             if ($viewer->id == $user->id) {
                 $return .= CBTxt::T('You have no category subscriptions.');
             } else {
                 $return .= CBTxt::T('This user has no category subscriptions.');
             }
         }
         $return .= '</td>' . '</tr>';
     }
     $return .= '</tbody>';
     if ($tabPaging && $pageNav->total > $pageNav->limit) {
         $return .= '<tfoot>' . '<tr>' . '<td colspan="4" class="text-center">' . $pageNav->getListLinks() . '</td>' . '</tr>' . '</tfoot>';
     }
     $return .= '</table>' . $pageNav->getLimitBox(false) . '</form>' . '</div>';
     return $return;
 }
Esempio n. 4
0
	/**
	 * render frontend categories
	 *
	 * @param CategoryTable[]    $rows
	 * @param cbPageNav          $pageNav
	 * @param bool               $searching
	 * @param array              $input
	 * @param UserTable          $user
	 * @param CBplug_cbgroupjive $plugin
	 * @return string
	 */
	static function showCategories( $rows, $pageNav, $searching, $input, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_CB_framework->setPageTitle( CBTxt::T( 'Categories' ) );

		initToolTip();

		$canCreateGroup					=	CBGroupJive::canCreateGroup( $user );
		$canSearch						=	( $plugin->params->get( 'categories_search', 1 ) && ( $searching || $pageNav->total ) );
		$return							=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayCategories', array( &$return, &$rows, $user ) );

		$return							.=	'<div class="gjCategories">'
										.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'categories', 'func' => 'all' ) ) . '" method="post" name="gjCategoriesForm" id="gjCategoriesForm" class="gjCategoriesForm">';

		if ( $canCreateGroup || $canSearch ) {
			$return						.=			'<div class="gjHeader gjCategoriesHeader row">';

			if ( $canCreateGroup ) {
				$return					.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
										.					'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'new', 'return' => CBGroupJive::getReturn() ) ) . '\';" class="gjButton gjButtonNewGroup btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New Group' ) . '</button>'
										.				'</div>';
			}

			if ( $canSearch ) {
				$return					.=				'<div class="' . ( ! $canCreateGroup ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
										.					'<div class="input-group">'
										.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
										.						$input['search']
										.					'</div>'
										.				'</div>';
			}

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

		$return							.=			'<div class="gjCategoriesRows">';

		if ( $rows ) foreach ( $rows as $row ) {
			$counters					=	array();
			$content					=	null;

			$_PLUGINS->trigger( 'gj_onDisplayCategory', array( &$row, &$counters, &$content, $user ) );

			$return						.=				'<div class="gjCategoriesCategory gjContainerBox img-thumbnail">'
										.					'<div class="gjContainerBoxHeader">'
										.						'<div class="gjContainerBoxCanvas text-left">'
										.							$row->canvas( true, true )
										.						'</div>'
										.						'<div class="gjContainerBoxLogo text-center">'
										.							$row->logo( true, true, true )
										.						'</div>'
										.					'</div>'
										.					'<div class="gjContainerBoxBody text-left">'
										.						'<div class="gjContainerBoxTitle">'
										.							'<strong><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'categories', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) . '">' . CBTxt::T( $row->get( 'name' ) ) . '</a></strong>'
										.						'</div>'
										.						'<div class="gjContainerBoxCounters text-muted small row">'
										.							'<div class="gjContainerBoxCounter ' . ( $counters ? 'col-sm-6' : 'col-sm-12' ) . '"><span class="gjCategoryGroupsIcon fa-before fa-users"> ' . CBTxt::T( 'GROUPS_COUNT', '%%COUNT%% Group|%%COUNT%% Groups', array( '%%COUNT%%' => (int) $row->get( '_groups', 0 ) ) ) . '</span></div>'
										.							( $counters ? '<div class="gjContainerBoxCounter col-sm-6">' . implode( '</div><div class="gjContainerBoxCounter col-sm-6">', $counters ) . '</div>' : null )
										.						'</div>'
										.						( $content ? '<div class="gjContainerBoxContent">' . $content . '</div>' : null )
										.						( $row->get( 'description' ) ? '<div class="gjContainerBoxDescription">' . cbTooltip( 1, CBTxt::T( $row->get( 'description' ) ), CBTxt::T( $row->get( 'name' ) ), 400, null, '<span class="fa fa-info-circle text-muted"></span>' ) . '</div>' : null )
										.					'</div>'
										.				'</div>';
		} else {
			if ( $searching ) {
				$return					.=				CBTxt::T( 'No category search results found.' );
			} else {
				$return					.=				CBTxt::T( 'There are no categories available.' );
			}
		}

		$return							.=			'</div>';

		if ( $plugin->params->get( 'categories_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=			'<div class="gjCategoriesPaging text-center">'
										.				$pageNav->getListLinks()
										.			'</div>';
		}

		$return							.=			$pageNav->getLimitBox( false )
										.		'</form>'
										.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayCategories', array( &$return, &$rows, $user ) );

		$_CB_framework->setMenuMeta();

		echo $return;
	}
Esempio n. 5
0
	/**
	 * render frontend events
	 *
	 * @param EventTable[]     $rows
	 * @param cbPageNav        $pageNav
	 * @param bool             $searching
	 * @param array            $input
	 * @param array            $counters
	 * @param GroupTable       $group
	 * @param UserTable        $user
	 * @param cbgjEventsPlugin $plugin
	 * @return string
	 */
	static function showEvents( $rows, $pageNav, $searching, $input, &$counters, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_CB_framework->outputCbJQuery( "$( '.gjGroupEventDescription .cbMoreLess' ).cbmoreless();", 'cbmoreless' );

		$counters[]							=	'<span class="gjGroupEventsIcon fa-before fa-calendar"> ' . CBTxt::T( 'GROUP_EVENTS_COUNT', '%%COUNT%% Event|%%COUNT%% Events', array( '%%COUNT%%' => (int) $pageNav->total ) ) . '</span>';

		initToolTip();

		$isModerator						=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$isOwner							=	( $user->get( 'id' ) == $group->get( 'user_id' ) );
		$userStatus							=	CBGroupJive::getGroupStatus( $user, $group );
		$canCreate							=	CBGroupJive::canCreateGroupContent( $user, $group, 'events' );
		$canSearch							=	( $plugin->params->get( 'groups_events_search', 1 ) && ( $searching || $pageNav->total ) );
		$showAddress						=	$plugin->params->get( 'groups_events_address', 1 );
		$return								=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayEvents', array( &$return, &$rows, $group, $user ) );

		$return								.=	'<div class="gjGroupEvents">'
											.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '" method="post" name="gjGroupEventsForm" id="gjGroupEventsForm" class="gjGroupEventsForm">';

		if ( $canCreate || $canSearch ) {
			$return							.=			'<div class="gjHeader gjGroupEventsHeader row">';

			if ( $canCreate ) {
				$return						.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
											.					'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'new', 'group' => (int) $group->get( 'id' ) ) ) . '\';" class="gjButton gjButtonNewEvent btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New Event' ) . '</button>'
											.				'</div>';
			}

			if ( $canSearch ) {
				$return						.=				'<div class="' . ( ! $canCreate ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
											.					'<div class="input-group">'
											.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
											.						$input['search']
											.					'</div>'
											.				'</div>';
			}

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

		$return								.=			'<div class="gjGroupEventsRows">';

		if ( $rows ) foreach ( $rows as $row ) {
			$rowOwner						=	( $user->get( 'id' ) == $row->get( 'user_id' ) );
			$address						=	htmlspecialchars( $row->get( 'location' ) );

			if ( $showAddress ) {
				if ( $row->get( 'address' ) ) {
					$mapUrl					=	CBTxt::T( 'GROUP_EVENT_ADDRESS_MAP_URL', 'https://www.google.com/maps/place/[address]', array( '[location]' => urlencode( $row->get( 'location' ) ), '[address]' => urlencode( $row->get( 'address' ) ) ) );
				} else {
					$mapUrl					=	CBTxt::T( 'GROUP_EVENT_LOCATION_MAP_URL', 'https://www.google.com/maps/search/[location]', array( '[location]' => urlencode( $row->get( 'location' ) ), '[address]' => urlencode( $row->get( 'address' ) ) ) );
				}

				if ( $mapUrl ) {
					$address				=	'<a href="' . htmlspecialchars( $mapUrl ) . '" target="_blank" rel="nofollow">' . $address . '</a>';
				}
			}

			$menu							=	array();

			$integrations					=	$_PLUGINS->trigger( 'gj_onDisplayEvent', array( &$row, &$menu, $group, $user ) );

			$canAttend						=	( ( ! $rowOwner ) && ( $row->status() != 1 ) && ( ! $row->get( '_attending' ) ) && ( $userStatus >= 1 ) && ( ( ! $row->get( 'limit' ) ) || ( $row->get( 'limit' ) && ( $row->get( '_guests' ) < $row->get( 'limit' ) ) ) ) );
			$canMenu						=	( $isModerator || $isOwner || $rowOwner || ( $userStatus >= 2 ) || ( ( ! $rowOwner ) && ( $row->status() != 1 ) && ( $userStatus >= 1 ) && $row->get( '_attending' ) ) || $menu );

			$return							.=				'<div class="gjGroupEventsRow row' . ( $row->status() == 1 ? ' gjGroupEventExpired' : ( $row->status() == 2 ? ' gjGroupEventActive' : null ) ) . '">'
											.					'<div class="gjGroupEventCalendar col-md-2 hidden-sm hidden-xs">'
											.						'<div class="panel panel-default text-center">'
											.							'<div class="gjGroupEventMonth panel-body">' . cbFormatDate( $row->get( 'start' ), true, false, 'M' ) . '</div>'
											.							'<div class="gjGroupEventDay panel-footer">' . cbFormatDate( $row->get( 'start' ), true, false, 'j' ) . '</div>'
											.						'</div>'
											.					'</div>'
											.					'<div class="gjGroupEventContainer col-md-10 col-sm-12 col-xs-12">'
											.						'<div class="panel ' . ( $row->status() == 1 ? 'panel-warning' : ( $row->status() == 2 ? 'panel-primary' : 'panel-default' ) ) . '">'
											.							'<div class="gjGroupEventHeader panel-heading">'
											.								'<div class="row">'
											.									'<div class="gjGroupEventTitle ' . ( $canAttend || $canMenu ? 'col-sm-8' : 'col-sm-12' ) . '">' . htmlspecialchars( $row->get( 'title' ) ) . '</div>';

			if ( $canAttend || $canMenu ) {
				$return						.=									'<div class="gjGroupEventMenu col-sm-4 text-right">';

				if ( $canAttend ) {
					$return					.=										'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'events', 'func' => 'attend', 'id' => (int) $row->get( 'id' ) ) ) . '\';" class="gjButton gjButtonAttend btn btn-xs btn-success">' . CBTxt::T( 'Attend' ) . '</button> ';
				}

				if ( $canMenu ) {
					$menuItems				=	'<ul class="gjEventMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

					if ( ( ! $rowOwner ) && ( $row->status() != 1 ) && ( $userStatus >= 1 ) && $row->get( '_attending' ) ) {
						$menuItems			.=		'<li class="gjEventMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you do not want to attend this Event?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'unattend', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unattend' ) . '</a></li>';
					}

					if ( $isModerator || $isOwner || $rowOwner || ( $userStatus >= 2 ) ) {
						$menuItems			.=		'<li class="gjEventMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'events', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

						if ( ( $row->get( 'published' ) == -1 ) && ( $group->params()->get( 'events', 1 ) == 2 ) ) {
							if ( $isModerator || $isOwner || ( $userStatus >= 2 ) ) {
								$menuItems	.=		'<li class="gjEventMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'events', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
							}
						} elseif ( $row->get( 'published' ) == 1 ) {
							$menuItems		.=		'<li class="gjEventMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this Event?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'unpublish', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
						} else {
							$menuItems		.=		'<li class="gjEventMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'events', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
						}
					}

					if ( $menu ) {
						$menuItems			.=		'<li class="gjEventMenuItem">' . implode( '</li><li class="gjEventMenuItem">', $menu ) . '</li>';
					}

					if ( $isModerator || $isOwner || $rowOwner || ( $userStatus >= 2 ) ) {
						$menuItems			.=		'<li class="gjEventMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Event?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
					}

					$menuItems				.=	'</ul>';

					$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

					$return					.=										'<span class="gjEventMenu btn-group">'
											.											'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
											.										'</span>';
				}

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

			$return							.=								'</div>'
											.							'</div>'
											.							'<div class="gjGroupEventDetails panel-body small">';

			if ( $row->status() == 1 ) {
				$return						.=								'<div class="gjGroupEventNotice text-warning text-right">' . CBTxt::T( 'This event has ended.' ) . '</div>';
			} elseif ( $row->status() == 2 ) {
				if ( $row->get( 'end' ) ) {
					$return					.=								'<div class="gjGroupEventNotice text-primary text-right">' . CBTxt::T( 'GROUP_EVENT_ENDS_IN', 'This event is currently in progress and ends in [timeago].', array( '[timeago]' => cbFormatDate( $row->get( 'end' ), true, 'exacttimeago' ) ) ) . '</div>';
				} else {
					$return					.=								'<div class="gjGroupEventNotice text-primary text-right">' . CBTxt::T( 'This event is currently in progress.' ) . '</div>';
				}
			} else {
				$return						.=								'<div class="gjGroupEventNotice text-right">' . CBTxt::T( 'GROUP_EVENT_STARTS_IN', 'This event starts in [timeago].', array( '[timeago]' => cbFormatDate( $row->get( 'start' ), true, 'exacttimeago' ) ) ) . '</div>';
			}

			$return							.=								'<div class="gjGroupEventDate">'
											.									'<span class="gjGroupEventIcon fa fa-clock-o text-center"></span> ' . $row->date()
											.								'</div>'
											.								'<div class="gjGroupEventLocation">'
											.									'<span class="gjGroupEventIcon fa fa-map-marker text-center"></span> ' . $address
											.								'</div>'
											.								'<div class="gjGroupEventAttending row">'
											.									'<div class="gjGroupEventGuests col-sm-6">'
											.										'<span class="gjGroupEventIcon fa fa-users text-center"></span> '
											.										'<a href="' . htmlspecialchars( $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'events', 'func' => 'attending', 'id' => (int) $row->get( 'id' ) ) ) ) . '">'
											.											( $row->get( 'limit' ) ? CBTxt::T( 'GROUP_GUESTS_COUNT_LIMITED', '%%COUNT%% of [limit] Guest|%%COUNT%% of [limit] Guests', array( '%%COUNT%%' => (int) $row->get( '_guests', 0 ), '[limit]' => (int) $row->get( 'limit' ) ) ) : CBTxt::T( 'GROUP_GUESTS_COUNT', '%%COUNT%% Guest|%%COUNT%% Guests', array( '%%COUNT%%' => (int) $row->get( '_guests', 0 ) ) ) )
											.										'</a>'
											.									'</div>'
											.									'<div class="gjGroupEventHost col-sm-6 text-right">'
											.										CBuser::getInstance( (int) $row->get( 'user_id' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true )
											.									'</div>'
											.								'</div>'
											.							'</div>'
											.							'<div class="gjGroupEventDescription panel-footer">'
											.								'<div class="cbMoreLess">'
											.									'<div class="cbMoreLessContent">'
											.										( $plugin->params->get( 'groups_events_content_plugins', 0 ) ? Application::Cms()->prepareHtmlContentPlugins( $row->get( 'event' ) ) : $row->get( 'event' ) )
											.									'</div>'
											.									'<div class="cbMoreLessOpen fade-edge hidden">'
											.										'<a href="javascript: void(0);" class="cbMoreLessButton">' . CBTxt::T( 'See More' ) . '</a>'
											.									'</div>'
											.								'</div>'
											.							'</div>'
											.							( is_array( $integrations ) && $integrations ? '<div class="gjGroupEventFooter panel-footer">' . implode( '', $integrations ) . '</div>' : null )
											.						'</div>'
											.					'</div>'
											.				'</div>';
		} else {
			if ( $searching ) {
				$return						.=				CBTxt::T( 'No group event search results found.' );
			} else {
				$return						.=				CBTxt::T( 'This group currently has no events.' );
			}
		}

		$return								.=			'</div>';

		if ( $plugin->params->get( 'groups_events_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return							.=			'<div class="gjGroupEventsPaging text-center">'
											.				$pageNav->getListLinks()
											.			'</div>';
		}

		$return								.=			$pageNav->getLimitBox( false )
											.		'</form>'
											.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayEvents', array( &$return, $rows, $group, $user ) );

		return $return;
	}
Esempio n. 6
0
	/**
	 * @param cbinvitesInviteTable[] $rows
	 * @param cbPageNav              $pageNav
	 * @param bool                   $searching
	 * @param array                  $input
	 * @param UserTable              $viewer
	 * @param UserTable              $user
	 * @param TabTable               $tab
	 * @param cbTabHandler           $plugin
	 * @return string
	 */
	static function showTab( $rows, $pageNav, $searching, $input, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework, $_CB_database;

		$params						=	new Registry( $tab->params );
		$profileOwner				=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator				=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();

		$tabPaging					=	$params->get( 'tab_paging', 1 );
		$canSearch					=	( $params->get( 'tab_search', 1 ) && ( $searching || $pageNav->total ) );

		$inviteLimit				=	(int) $plugin->params->get( 'invite_limit', null );
		$canCreate					=	false;

		if ( $profileOwner ) {
			if ( $cbModerator ) {
				$canCreate			=	true;
			} elseif ( $user->get( 'id' ) && Application::MyUser()->canViewAccessLevel( $plugin->params->get( 'invite_create_access', 2 ) ) ) {
				if ( $inviteLimit ) {
					$query			=	'SELECT COUNT(*)'
									.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_invites' )
									.	"\n WHERE " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
									.	"\n AND ( " . $_CB_database->NameQuote( 'user' ) . " IS NULL OR " . $_CB_database->NameQuote( 'user' ) . " = " . $_CB_database->Quote( '' ) . " )";
					$_CB_database->setQuery( $query );
					$inviteCount	=	(int) $_CB_database->loadResult();

					if ( $inviteCount < $inviteLimit ) {
						$canCreate	=	true;
					}
				} else {
					$canCreate		=	true;
				}
			}
		}

		$return						=	'<div class="invitesTab">'
									.		'<form action="' . $_CB_framework->userProfileUrl( $user->get( 'id' ), true, $tab->tabid ) . '" method="post" name="inviteForm" id="inviteForm" class="inviteForm">';

		if ( $canCreate || $canSearch ) {
			$return					.=			'<div class="invitesHeader row" style="margin-bottom: 10px;">';

			if ( $canCreate ) {
				$return				.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
									.					'<button type="button" onclick="location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'invites', 'func' => 'new' ) ) . '\';" class="invitesButton invitesButtonNew btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New Invite' ) . '</button>'
									.				'</div>';
			}

			if ( $canSearch ) {
				$return				.=				'<div class="' . ( ! $canCreate ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
									.					'<div class="input-group">'
									.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
									.						$input['search']
									.					'</div>'
									.				'</div>';
			}

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

		$menuAccess					=	( $cbModerator || $profileOwner );

		if ( $menuAccess ) {
			if ( $rows ) foreach ( $rows as $row ) {
				if ( $row->canResend() || ( ! $row->isAccepted() ) ) {
					$menuAccess		=	true;
					break;
				}
			}
		}

		$return						.=			'<table class="invitesContainer table table-hover table-responsive">'
									.				'<thead>'
									.					'<tr>'
									.						'<th class="text-left">' . CBTxt::T( 'To' ) . '</th>'
									.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Date' ) . '</th>'
									.						'<th style="width: 5%;" class="text-center hidden-xs">' . CBTxt::T( 'Status' ) . '</th>'
									.						( $menuAccess ? '<th style="width: 1%;" class="text-right">&nbsp;</th>' : null )
									.					'</tr>'
									.				'</thead>'
									.				'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			if ( $row->get( 'user' ) ) {
				$toUser				=	CBuser::getInstance( (int) $row->get( 'user' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true );
			} else {
				$toUser				=	'******' . htmlspecialchars( $row->get( 'to' ) ) . '">' . $row->get( 'to' ) . '</a>';
			}

			$return					.=					'<tr>'
									.						'<td class="text-left">' . $toUser . '</td>'
									.						'<td style="width: 25%;" class="text-left hidden-xs">'
									.							( $row->isSent() ? '<div class="text-info" title="' . htmlspecialchars( CBTxt::T( 'Sent' ) ) . '">' . cbFormatDate( $row->get( 'sent' ) ) . '</div>' : '<div class="text-warning">' . CBTxt::T( 'Please Resend' ) . '</div>' )
									.							( $row->isAccepted() ? '<div class="text-success" title="' . htmlspecialchars( CBTxt::T( 'Accepted' ) ) . '">' . cbFormatDate( $row->get( 'accepted' ) ) . '</div>' : null )
									.						'</td>'
									.						'<td style="width: 5%;" class="text-center hidden-xs">';

			if ( $row->isAccepted() ) {
				$return				.=							'<span class="fa fa-check text-success" title="' . htmlspecialchars( CBTxt::T( 'Accepted' ) ) . '"></span>';
			} elseif ( $row->isSent() ) {
				$return				.=							'<span class="fa fa-clock-o text-warning" title="' . htmlspecialchars( CBTxt::T( 'Pending' ) ) . '"></span>';
			} else {
				$return				.=							'<span class="fa fa-warning text-danger" title="' . htmlspecialchars( CBTxt::T( 'Resend' ) ) . '"></span>';
			}

			$return					.=						'</td>';

			if ( ( $cbModerator || $profileOwner ) && ( $row->canResend() || ( ! $row->isAccepted() ) ) ) {
				$menuItems			=	'<ul class="invitesMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( $row->canResend() ) {
					$menuItems		.=		'<li class="invitesMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'invites', 'func' => 'send', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-share-square-o"></span> ' . CBTxt::T( 'Resend' ) . '</a></li>';
				}

				if ( ! $row->isAccepted() ) {
					$menuItems		.=		'<li class="invitesMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'invites', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>'
									.		'<li class="invitesMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Invite?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'invites', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				}

				$menuItems			.=	'</ul>';

				$menuAttr			=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return				.=						'<td style="width: 1%;" class="text-right">'
									.							'<div class="invitesMenu btn-group">'
									.								'<button type="button"' . $menuAttr . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
									.							'</div>'
									.						'</td>';
			} elseif ( $menuAccess ) {
				$return				.=						'<td style="width: 1%;" class="text-right"></td>';
			}

			$return					.=					'</tr>';
		} else {
			$return					.=					'<tr>'
									.						'<td colspan="' . ( $menuAccess ? 4 : 3 ) . '" class="text-left">';

			if ( $searching ) {
				$return				.=							CBTxt::T( 'No invite search results found.' );
			} else {
				if ( $viewer->id == $user->id ) {
					$return			.=							CBTxt::T( 'You have no invites.' );
				} else {
					$return			.=							CBTxt::T( 'This user has no invites.' );
				}
			}

			$return					.=						'</td>'
									.					'</tr>';
		}

		$return						.=				'</tbody>';

		if ( $tabPaging && ( $pageNav->total > $pageNav->limit ) ) {
			$return					.=				'<tfoot>'
									.					'<tr>'
									.						'<td colspan="' . ( $menuAccess ? 4 : 3 ) . '" class="text-center">'
									.							$pageNav->getListLinks()
									.						'</td>'
									.					'</tr>'
									.				'</tfoot>';
		}

		$return						.=			'</table>'
									.			$pageNav->getLimitBox( false )
									.		'</form>'
									.	'</div>';

		return $return;
	}
Esempio n. 7
0
 /**
  * Renders the Blogs tab
  *
  * @param  OrderedTable[]  $rows       Blogs to render
  * @param  cbPageNav       $pageNav    Pagination
  * @param  boolean         $searching  Currently searching
  * @param  string[]        $input      HTML of input elements
  * @param  UserTable       $viewer     Viewing user
  * @param  UserTable       $user       Viewed user
  * @param  stdClass        $model      The model reference
  * @param  TabTable        $tab        Current Tab
  * @param  PluginTable     $plugin     Current Plugin
  * @return string                      HTML
  */
 static function showBlogTab($rows, $pageNav, $searching, $input, $viewer, $user, $model, $tab, $plugin)
 {
     global $_CB_framework;
     $blogLimit = (int) $plugin->params->get('blog_limit', null);
     $tabPaging = $tab->params->get('tab_paging', 1);
     $canSearch = $tab->params->get('tab_search', 1) && ($searching || $pageNav->total);
     $canCreate = false;
     $profileOwner = $viewer->get('id') == $user->get('id');
     $cbModerator = Application::User((int) $viewer->get('id'))->isGlobalModerator();
     $canPublish = $cbModerator || $profileOwner && !$plugin->params->get('blog_approval', 0);
     if ($profileOwner) {
         if ($cbModerator) {
             $canCreate = true;
         } elseif ($user->get('id') && Application::User((int) $viewer->get('id'))->canViewAccessLevel((int) $plugin->params->get('blog_create_access', 2))) {
             if (!$blogLimit || $blogLimit && $pageNav->total < $blogLimit) {
                 $canCreate = true;
             }
         }
     }
     $return = '<div class="blogsTab">' . '<form action="' . $_CB_framework->userProfileUrl($user->get('id'), true, $tab->tabid) . '" method="post" name="blogForm" id="blogForm" class="blogForm">';
     if ($canCreate || $canSearch) {
         $return .= '<div class="blogsHeader row" style="margin-bottom: 10px;">';
         if ($canCreate) {
             $return .= '<div class="' . (!$canSearch ? 'col-sm-12' : 'col-sm-8') . ' text-left">' . '<button type="button" onclick="location.href=\'' . $_CB_framework->pluginClassUrl($plugin->element, false, array('action' => 'blogs', 'func' => 'new')) . '\';" class="blogsButton blogsButtonNew btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T('New Blog') . '</button>' . '</div>';
         }
         if ($canSearch) {
             $return .= '<div class="' . (!$canCreate ? 'col-sm-offset-8 ' : null) . 'col-sm-4 text-right">' . '<div class="input-group">' . '<span class="input-group-addon"><span class="fa fa-search"></span></span>' . $input['search'] . '</div>' . '</div>';
         }
         $return .= '</div>';
     }
     $menuAccess = $cbModerator || $profileOwner || $canPublish;
     $return .= '<table class="blogsContainer table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 50%;" class="text-left">' . CBTxt::T('Title') . '</th>' . '<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T('Category') . '</th>' . '<th style="width: 24%;" class="text-left hidden-xs">' . CBTxt::T('Created') . '</th>' . ($menuAccess ? '<th style="width: 1%;" class="text-right">&nbsp;</th>' : null) . '</tr>' . '</thead>' . '<tbody>';
     if ($rows) {
         foreach ($rows as $row) {
             $return .= '<tr>' . '<td style="width: 50%;" class="text-left">' . ($row->get('published') ? '<a href="' . cbblogsModel::getUrl($row, true, 'article') . '">' . $row->get('title') . '</a>' : $row->get('title')) . '</td>' . '<td style="width: 25%;" class="text-left hidden-xs">' . ($row->get('category_published') ? '<a href="' . cbblogsModel::getUrl($row, true, 'category') . '">' . $row->get('category') . '</a>' : $row->get('category')) . '</td>' . '<td style="width: 24%;" class="text-left hidden-xs">' . cbFormatDate($row->get('created')) . '</td>';
             if ($menuAccess) {
                 $menuItems = '<ul class="blogsMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';
                 if ($cbModerator || $profileOwner) {
                     $menuItems .= '<li class="blogsMenuItem"><a href="' . $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'edit', 'id' => (int) $row->get('id'))) . '"><span class="fa fa-edit"></span> ' . CBTxt::T('Edit') . '</a></li>';
                 }
                 if ($canPublish) {
                     if ($row->get('published')) {
                         $menuItems .= '<li class="blogsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes(CBTxt::T('Are you sure you want to unpublish this Blog?')) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl($plugin->element, false, array('action' => 'blogs', 'func' => 'unpublish', 'id' => (int) $row->get('id'))) . '\'; }"><span class="fa fa-times-circle"></span> ' . CBTxt::T('Unpublish') . '</a></li>';
                     } else {
                         $menuItems .= '<li class="blogsMenuItem"><a href="' . $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'publish', 'id' => (int) $row->get('id'))) . '"><span class="fa fa-check"></span> ' . CBTxt::T('Publish') . '</a></li>';
                     }
                 }
                 if ($cbModerator || $profileOwner) {
                     $menuItems .= '<li class="blogsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes(CBTxt::T('Are you sure you want to delete this Blog?')) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl($plugin->element, false, array('action' => 'blogs', 'func' => 'delete', 'id' => (int) $row->get('id'))) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T('Delete') . '</a></li>';
                 }
                 $menuItems .= '</ul>';
                 $menuAttr = cbTooltip(1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"');
                 $return .= '<td style="width: 1%;" class="text-right">' . '<div class="blogsMenu btn-group">' . '<button type="button"' . $menuAttr . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>' . '</div>' . '</td>';
             }
             $return .= '</tr>';
         }
     } else {
         $return .= '<tr>' . '<td colspan="' . ($menuAccess ? 4 : 3) . '" class="text-left">';
         if ($searching) {
             $return .= CBTxt::T('No blog search results found.');
         } else {
             if ($viewer->id == $user->id) {
                 $return .= CBTxt::T('You have no blogs.');
             } else {
                 $return .= CBTxt::T('This user has no blogs.');
             }
         }
         $return .= '</td>' . '</tr>';
     }
     $return .= '</tbody>';
     if ($tabPaging && $pageNav->total > $pageNav->limit) {
         $return .= '<tfoot>' . '<tr>' . '<td colspan="' . ($menuAccess ? 4 : 3) . '" class="text-center">' . $pageNav->getListLinks() . '</td>' . '</tr>' . '</tfoot>';
     }
     $return .= '</table>' . $pageNav->getLimitBox(false) . '</form>' . '</div>';
     return $return;
 }
Esempio n. 8
0
	/**
	 * render frontend videos
	 *
	 * @param VideoTable[]    $rows
	 * @param cbPageNav       $pageNav
	 * @param bool            $searching
	 * @param array           $input
	 * @param array           $counters
	 * @param GroupTable      $group
	 * @param UserTable       $user
	 * @param cbgjVideoPlugin $plugin
	 * @return string
	 */
	static function showVideos( $rows, $pageNav, $searching, $input, &$counters, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_CB_framework->outputCbJQuery( "$( '.gjVideoPlayer' ).mediaelementplayer();", 'media' );

		$counters[]						=	'<span class="gjGroupVideoIcon fa-before fa-film"> ' . CBTxt::T( 'GROUP_VIDEOS_COUNT', '%%COUNT%% Video|%%COUNT%% Videos', array( '%%COUNT%%' => (int) $pageNav->total ) ) . '</span>';

		initToolTip();

		$isModerator					=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$isOwner						=	( $user->get( 'id' ) == $group->get( 'user_id' ) );
		$userStatus						=	CBGroupJive::getGroupStatus( $user, $group );
		$canCreate						=	CBGroupJive::canCreateGroupContent( $user, $group, 'video' );
		$canSearch						=	( $plugin->params->get( 'groups_video_search', 1 ) && ( $searching || $pageNav->total ) );
		$return							=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayVideos', array( &$return, &$rows, $group, $user ) );

		$return							.=	'<div class="gjGroupVideo">'
										.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '" method="post" name="gjGroupVideoForm" id="gjGroupVideoForm" class="gjGroupVideoForm">';

		if ( $canCreate || $canSearch ) {
			$return						.=			'<div class="gjHeader gjGroupVideoHeader row">';

			if ( $canCreate ) {
				$return					.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
										.					'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'video', 'func' => 'new', 'group' => (int) $group->get( 'id' ) ) ) . '\';" class="gjButton gjButtonNewVideo btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New Video' ) . '</button>'
										.				'</div>';
			}

			if ( $canSearch ) {
				$return					.=				'<div class="' . ( ! $canCreate ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
										.					'<div class="input-group">'
										.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
										.						$input['search']
										.					'</div>'
										.				'</div>';
			}

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

		$return							.=			'<div class="gjGroupVideoRows">';

		if ( $rows ) foreach ( $rows as $row ) {
			$rowCounters				=	array();
			$content					=	null;
			$menu						=	array();

			$_PLUGINS->trigger( 'gj_onDisplayVideo', array( &$row, &$rowCounters, &$content, &$menu, $group, $user ) );

			$return						.=				'<div class="gjGroupVideoRow gjContainerBox img-thumbnail">'
										.					'<div class="gjContainerBoxHeader">'
										.						'<video width="640" height="360" style="width: 100%; height: 100%;" id="gjVideoPlayer' . (int) $row->get( 'id' ) . '" src="' . htmlspecialchars( $row->get( 'url' ) ) . '" type="' . htmlspecialchars( $row->mimeType() ) . '" controls="controls" preload="none" class="gjVideoPlayer"></video>'
										.					'</div>'
										.					'<div class="gjContainerBoxBody text-left">'
										.						'<div class="gjContainerBoxTitle">'
										.							'<a href="' . htmlspecialchars( $row->get( 'url' ) ) . '" target="_blank" rel="nofollow">' . htmlspecialchars( ( $row->get( 'title' ) ? $row->get( 'title' ) : $row->name() ) ) . '</a>'
										.						'</div>'
										.						'<div class="gjContainerBoxCounters text-muted small row">'
										.							'<div class="gjGroupVideoPublisher gjContainerBoxCounter col-sm-6">' . CBuser::getInstance( (int) $row->get( 'user_id' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</div>'
										.							'<div class="gjContainerBoxCounter col-sm-6 text-right">'
										.								'<span title="' . htmlspecialchars( $row->get( 'date' ) ) . '">'
										.									cbFormatDate( $row->get( 'date' ), true, false, CBTxt::T( 'GROUP_VIDEO_DATE_FORMAT', 'M j, Y' ) )
										.								'</span>'
										.							'</div>'
										.							( $rowCounters ? '<div class="gjContainerBoxCounter col-sm-6">' . implode( '</div><div class="gjContainerBoxCounter col-sm-6">', $rowCounters ) . '</div>' : null )
										.						'</div>'
										.						( $content ? '<div class="gjContainerBoxContent">' . $content . '</div>' : null )
										.						( $row->get( 'caption' ) ? '<div class="gjContainerBoxDescription">' . cbTooltip( 1, $row->get( 'caption' ), $row->name(), 400, null, '<span class="fa fa-info-circle text-muted"></span>' ) . '</div>' : null );

			if ( ( $isModerator || $isOwner || ( $userStatus >= 2 ) ) && ( $row->get( 'published' ) == -1 ) && ( $group->params()->get( 'video', 1 ) == 2 ) ) {
				$return					.=						'<div class="gjContainerBoxButton text-right">'
										.							'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'video', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '\';" class="gjButton gjButtonApprove btn btn-xs btn-success">' . CBTxt::T( 'Approve' ) . '</button>'
										.						'</div>';
			}

			$return						.=					'</div>';

			if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) || $menu ) {
				$menuItems				=	'<ul class="gjVideoMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) ) {
					$menuItems			.=		'<li class="gjVideoMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'video', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

					if ( ( $row->get( 'published' ) == -1 ) && ( $group->params()->get( 'video', 1 ) == 2 ) ) {
						if ( $isModerator || $isOwner || ( $userStatus >= 2 ) ) {
							$menuItems	.=		'<li class="gjVideoMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'video', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
						}
					} elseif ( $row->get( 'published' ) == 1 ) {
						$menuItems		.=		'<li class="gjVideoMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this Video?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'video', 'func' => 'unpublish', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
					} else {
						$menuItems		.=		'<li class="gjVideoMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'video', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
					}
				}

				if ( $menu ) {
					$menuItems			.=		'<li class="gjVideoMenuItem">' . implode( '</li><li class="gjVideoMenuItem">', $menu ) . '</li>';
				}

				if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) ) {
					$menuItems			.=		'<li class="gjVideoMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Video?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'video', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				}

				$menuItems				.=	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return					.=					'<div class="gjContainerBoxMenu">'
										.						'<div class="gjVideoMenu btn-group">'
										.							'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.						'</div>'
										.					'</div>';
			}

			$return						.=				'</div>';
		} else {
			if ( $searching ) {
				$return					.=				CBTxt::T( 'No group video search results found.' );
			} else {
				$return					.=				CBTxt::T( 'This group currently has no videos.' );
			}
		}

		$return							.=			'</div>';

		if ( $plugin->params->get( 'groups_video_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=			'<div class="gjGroupVideoPaging text-center">'
										.				$pageNav->getListLinks()
										.			'</div>';
		}

		$return							.=			$pageNav->getLimitBox( false )
										.		'</form>'
										.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayVideos', array( &$return, $rows, $group, $user ) );

		return $return;
	}
Esempio n. 9
0
	/**
	 * @param cbantispamWhitelistTable[] $rows
	 * @param cbPageNav                  $pageNav
	 * @param UserTable                  $viewer
	 * @param UserTable                  $user
	 * @param TabTable                   $tab
	 * @param cbTabHandler               $plugin
	 * @return string
	 */
	static public function showWhitelists( $rows, $pageNav, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework;

		/** @var Registry $params */
		$params						=	$tab->params;
		$tabWhitelistUser			=	(int) $params->get( 'tab_whitelist_user', 1 );
		$tabWhitelistIp				=	(int) $params->get( 'tab_whitelist_ip', 1 );
		$tabWhitelistEmail			=	(int) $params->get( 'tab_whitelist_email', 0 );
		$tabWhitelistDomain			=	(int) $params->get( 'tab_whitelist_domain', 0 );

		$return						=	'<div class="whitelistsTab">'
									.		'<form action="' . $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), true, (int) $tab->get( 'tabid' ) ) . '" method="post" name="whitelistsForm" id="whitelistsForm" class="whitelistsForm">';

		if ( $tabWhitelistUser || $tabWhitelistIp || $tabWhitelistEmail || $tabWhitelistDomain ) {
			$return					.=			'<div class="whitelistsHeader text-left" style="margin-bottom: 10px;">'
									.				'<div class="btn-group">'
									.					( $tabWhitelistUser ? '<button type="button" onclick="location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'whitelist', 'func' => 'user', 'usr' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\';" class="whitelistsButton whitelistsButtonWhitelistUser btn btn-default"><span class="fa fa-user"></span> ' . CBTxt::T( 'Whitelist User' ) . '</button>' : null )
									.					( $tabWhitelistIp ? '<button type="button" onclick="location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'whitelist', 'func' => 'ip', 'usr' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\';" class="whitelistsButton whitelistsButtonWhitelistIP btn btn-default"><span class="fa fa-flag"></span> ' . CBTxt::T( 'Whitelist IP Address' ) . '</button>' : null )
									.					( $tabWhitelistEmail ? '<button type="button" onclick="location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'whitelist', 'func' => 'email', 'usr' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\';" class="whitelistsButton whitelistsButtonWhitelistEmail btn btn-default"><span class="fa fa-at"></span> ' . CBTxt::T( 'Whitelist Email Address' ) . '</button>' : null )
									.					( $tabWhitelistDomain ? '<button type="button" onclick="location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'whitelist', 'func' => 'domain', 'usr' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\';" class="whitelistsButton whitelistsButtonWhitelistDomain btn btn-default"><span class="fa fa-globe"></span> ' . CBTxt::T( 'Whitelist Email Domain' ) . '</button>' : null )
									.				'</div>'
									.			'</div>';
		}

		$return						.=			'<table class="whitelistsContainer table table-hover table-responsive">'
									.				'<thead>'
									.					'<tr>'
									.						'<th class="text-left">' . CBTxt::T( 'Value' ) . '</th>'
									.						'<th style="width: 20%;" class="text-center hidden-xs">' . CBTxt::T( 'Type' ) . '</th>'
									.						'<th style="width: 30%;" class="text-center hidden-xs">' . CBTxt::T( 'Reason' ) . '</th>'
									.						'<th style="width: 1%;" class="text-right">&nbsp;</th>'
									.					'</tr>'
									.				'</thead>'
									.				'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			$menuItems				=	'<ul class="whitelistsMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">'
									.		'<li class="whitelistsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'whitelist', 'func' => 'edit', 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>'
									.		'<li class="whitelistsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Whitelist?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'whitelist', 'func' => 'delete', 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>'
									.	'</ul>';

			$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

			switch ( $row->get( 'type' ) ) {
				case 'user':
					$type			=	CBTxt::T( 'User' );
					break;
				case 'ip':
					$type			=	CBTxt::T( 'IP Address' );
					break;
				case 'email':
					$type			=	CBTxt::T( 'Email Address' );
					break;
				case 'domain':
					$type			=	CBTxt::T( 'Email Domain' );
					break;
				default:
					$type			=	CBTxt::T( 'Unknown' );
					break;
			}

			$return					.=					'<tr>'
									.						'<td class="text-left">' . $row->get( 'value' ) . '</td>'
									.						'<td style="width: 20%;" class="text-center hidden-xs">' . $type . '</td>'
									.						'<td style="width: 30%;" class="text-left hidden-xs">' . $row->get( 'reason' ) . '</td>'
									.						'<td style="width: 1%;" class="text-right">'
									.							'<div class="whitelistsMenu btn-group">'
									.								'<button type="button"' . $menuAttr . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
									.							'</div>'
									.						'</td>'
									.					'</tr>';
		} else {
			$return					.=					'<tr>'
									.						'<td colspan="3" class="text-left">';

			if ( $viewer->get( 'id' ) == $user->get( 'id' ) ) {
				$return				.=							CBTxt::T( 'You have no whitelists.' );
			} else {
				$return				.=							CBTxt::T( 'This user has no whitelists.' );
			}

			$return					.=						'</td>'
									.					'</tr>';
		}

		$return						.=				'</tbody>';

		if ( $params->get( 'tab_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return					.=				'<tfoot>'
									.					'<tr>'
									.						'<td colspan="3" class="text-center">'
									.							$pageNav->getListLinks()
									.						'</td>'
									.					'</tr>'
									.				'</tfoot>';
		}

		$return						.=			'</table>'
									.			$pageNav->getLimitBox( false )
									.		'</form>'
									.	'</div>';

		return $return;
	}
Esempio n. 10
0
	/**
	 * render frontend groups
	 *
	 * @param int                $mode 0: All, 1: My, 2: Joined, 3: Invited, 4: Approved, 5: Category (unused), 6: Profile (unused), 7: Module (unused)
	 * @param GroupTable[]       $rows
	 * @param cbPageNav          $pageNav
	 * @param bool               $searching
	 * @param array              $input
	 * @param UserTable          $user
	 * @param CBplug_cbgroupjive $plugin
	 * @return string
	 */
	static function showGroups( $mode, $rows, $pageNav, $searching, $input, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_CB_framework->setPageTitle( ( $mode == 4 ? CBTxt::T( 'Group Approval' ) : ( $mode == 3 ? CBTxt::T( 'Group Invites' ) : ( $mode == 2 ? CBTxt::T( 'Joined Groups' ) : ( $mode == 1 ? CBTxt::T( 'My Groups' ) : CBTxt::T( 'Groups' ) ) ) ) ) );

		initToolTip();

		$isModerator					=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$canCreateGroup					=	CBGroupJive::canCreateGroup( $user );
		$canSearch						=	( $plugin->params->get( 'groups_search', 1 ) && ( $searching || $pageNav->total ) );
		$return							=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayGroups', array( &$return, &$rows, $mode, $user ) );

		$return							.=	'<div class="gjGroups">'
										.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => ( $mode == 4 ? 'approval' : ( $mode == 3 ? 'invited' : ( $mode == 2 ? 'joined' : ( $mode == 1 ? 'my' : 'all' ) ) ) ) ) ) . '" method="post" name="gjGroupsForm" id="gjGroupsForm" class="gjGroupsForm">';

		if ( $canCreateGroup || $canSearch ) {
			$return						.=			'<div class="gjHeader gjGroupsHeader row">';

			if ( $canCreateGroup ) {
				$return					.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
										.					'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'new', 'return' => CBGroupJive::getReturn() ) ) . '\';" class="gjButton gjButtonNewGroup btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New Group' ) . '</button>'
										.				'</div>';
			}

			if ( $canSearch ) {
				$return					.=				'<div class="' . ( ! $canCreateGroup ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
										.					'<div class="input-group">'
										.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
										.						$input['search']
										.					'</div>'
										.				'</div>';
			}

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

		$return							.=			'<div class="gjGroupsRows">';

		if ( $rows ) foreach ( $rows as $row ) {
			$rowOwner					=	( $user->get( 'id' ) == $row->get( 'user_id' ) );
			$userStatus					=	CBGroupJive::getGroupStatus( $user, $row );

			$counters					=	array();
			$content					=	null;
			$menu						=	array();

			$_PLUGINS->trigger( 'gj_onDisplayGroup', array( &$row, &$counters, &$content, &$menu, $mode, $user ) );

			$return						.=				'<div class="gjGroupsGroup gjContainerBox img-thumbnail">'
										.					'<div class="gjContainerBoxHeader">'
										.						'<div class="gjContainerBoxCanvas text-left">'
										.							$row->canvas( true, true )
										.						'</div>'
										.						'<div class="gjContainerBoxLogo text-center">'
										.							$row->logo( true, true, true )
										.						'</div>'
										.					'</div>'
										.					'<div class="gjContainerBoxBody text-left">'
										.						'<div class="gjContainerBoxTitle">'
										.							'<strong><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) . '">' . htmlspecialchars( CBTxt::T( $row->get( 'name' ) ) ) . '</a></strong>'
										.						'</div>';

			if ( $row->get( 'category' ) ) {
				$return					.=						'<div class="gjContainerBoxSubTitle small">'
										.							'<strong><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'categories', 'func' => 'show', 'id' => (int) $row->get( 'category' ) ) ) . '">' . htmlspecialchars( CBTxt::T( $row->get( '_category_name' ) ) ) . '</a></strong>'
										.						'</div>';
			}

			$return						.=						'<div class="gjContainerBoxCounters text-muted small row">'
										.							'<div class="gjContainerBoxCounter col-sm-6"><span class="gjGroupTypeIcon fa-before fa-globe"> ' . $row->type() . '</span></div>'
										.							'<div class="gjContainerBoxCounter col-sm-6"><span class="gjGroupUsersIcon fa-before fa-user"> ' . CBTxt::T( 'GROUP_USERS_COUNT', '%%COUNT%% User|%%COUNT%% Users', array( '%%COUNT%%' => (int) $row->get( '_users', 0 ) ) ) . '</span></div>'
										.							( $counters ? '<div class="gjContainerBoxCounter col-sm-6">' . implode( '</div><div class="gjContainerBoxCounter col-sm-6">', $counters ) . '</div>' : null )
										.						'</div>'
										.						( $content ? '<div class="gjContainerBoxContent">' . $content . '</div>' : null )
										.						( $row->get( 'description' ) ? '<div class="gjContainerBoxDescription">' . cbTooltip( 1, CBTxt::T( $row->get( 'description' ) ), CBTxt::T( $row->get( 'name' ) ), 400, null, '<span class="fa fa-info-circle text-muted"></span>' ) . '</div>' : null );

			if ( $isModerator && ( $row->get( 'published' ) == -1 ) && $plugin->params->get( 'groups_create_approval', 0 ) ) {
				$return					.=						'<div class="gjContainerBoxButton text-right">'
										.							'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'publish', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '\';" class="gjButton gjButtonApprove btn btn-xs btn-success">' . CBTxt::T( 'Approve' ) . '</button>'
										.						'</div>';
			} elseif ( ! $rowOwner ) {
				if ( $userStatus === null ) {
					$return				.=						'<div class="gjContainerBoxButton text-right">'
										.							( $row->get( '_invite_id' ) ? '<button type="button" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to reject all invites to this Group?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'reject', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '\'; })" class="gjButton gjButtonReject btn btn-xs btn-danger">' . CBTxt::T( 'Reject' ) . '</button> ' : null )
										.							'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'join', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '\';" class="gjButton gjButtonJoin btn btn-xs btn-success">' . ( $row->get( '_invite_id' ) ? CBTxt::T( 'Accept Invite' ) : CBTxt::T( 'Join' ) ) . '</button>'
										.						'</div>';
				} elseif ( $userStatus === 0 ) {
					$return				.=						'<div class="gjContainerBoxButton text-right">'
										.							'<button type="button" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel your pending join request to this Group?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'cancel', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '\'; })" class="gjButton gjButtonCancel btn btn-xs btn-danger">' . CBTxt::T( 'Cancel' ) . '</button> '
										.							'<span class="gjButton gjButtonPending btn btn-xs btn-warning disabled">' . CBTxt::T( 'Pending Approval' ) . '</span>'
										.						'</div>';
				}
			}

			$return						.=					'</div>';

			if ( $isModerator || $rowOwner || $menu ) {
				$menuItems				=	'<ul class="gjGroupMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( $isModerator || $rowOwner ) {
					$menuItems			.=		'<li class="gjGroupMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'edit', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

					if ( ( $row->get( 'published' ) == -1 ) && $plugin->params->get( 'groups_create_approval', 0 ) ) {
						if ( $isModerator ) {
							$menuItems	.=		'<li class="gjGroupMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'publish', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
						}
					} elseif ( $row->get( 'published' ) == 1 ) {
						$menuItems		.=		'<li class="gjGroupMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this Group?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'unpublish', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '\'; })"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
					} else {
						$menuItems		.=		'<li class="gjGroupMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'publish', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
					}
				}

				if ( $menu ) {
					$menuItems			.=		'<li class="gjGroupMenuItem">' . implode( '</li><li class="gjGroupMenuItem">', $menu ) . '</li>';
				}

				if ( $isModerator || $rowOwner ) {
					$menuItems			.=		'<li class="gjGroupMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Group?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'groups', 'func' => 'delete', 'id' => (int) $row->get( 'id' ), 'return' => CBGroupJive::getReturn() ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				}

				$menuItems				.=	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return					.=					'<div class="gjContainerBoxMenu">'
										.						'<div class="gjGroupMenu btn-group">'
										.							'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.						'</div>'
										.					'</div>';
			}

			$return						.=				'</div>';
		} else {
			if ( $searching ) {
				$return					.=				CBTxt::T( 'No group search results found.' );
			} else {
				$return					.=				CBTxt::T( 'There are no groups available.' );
			}
		}

		$return							.=			'</div>';

		if ( $plugin->params->get( 'groups_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=			'<div class="gjGroupsPaging text-center">'
										.				$pageNav->getListLinks()
										.			'</div>';
		}

		$return							.=			$pageNav->getLimitBox( false )
										.		'</form>'
										.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayGroups', array( &$return, &$rows, $mode, $user ) );

		$_CB_framework->setMenuMeta();

		echo $return;
	}
Esempio n. 11
0
	/**
	 * returns paging limit dropdown
	 *
     * @param cbPageNav $pageNav
     * @param string $class
	 * @return string
	 */
	public function getLimitBox( $pageNav, $class = 'input-small' ) {
		return str_replace( 'class="inputbox"', 'class="' . $class . '"', $pageNav->getLimitBox() );
	}
Esempio n. 12
0
	/**
	 * render frontend group invites
	 *
	 * @param InviteTable[]      $rows
	 * @param cbPageNav          $pageNav
	 * @param bool               $searching
	 * @param array              $input
	 * @param GroupTable         $group
	 * @param UserTable          $user
	 * @param CBplug_cbgroupjive $plugin
	 * @return string
	 */
	static function showInvites( $rows, $pageNav, $searching, $input, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		initToolTip();

		$canCreateInvite				=	CBGroupJive::canCreateGroupContent( $user, $group, 'invites' );
		$canSearch						=	( $plugin->params->get( 'groups_invites_search', 0 ) && ( $searching || $pageNav->total ) );
		$return							=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayInvites', array( &$return, &$rows, $group, $user ) );

		$return							.=	'<div class="gjGroupInvites">'
										.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '" method="post" name="gjGroupInvitesForm" id="gjGroupInvitesForm" class="gjGroupInvitesForm">';

		if ( $canCreateInvite || $canSearch ) {
			$return						.=			'<div class="gjHeader gjGroupInvitesHeader row">';

			if ( $canCreateInvite ) {
				$return					.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
										.					'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'invites', 'func' => 'new', 'group' => (int) $group->get( 'id' ) ) ) . '\';" class="gjButton gjButtonNewInvite btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New Invite' ) . '</button>'
										.				'</div>';
			}

			if ( $canSearch ) {
				$return					.=				'<div class="' . ( ! $canCreateInvite ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
										.					'<div class="input-group">'
										.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
										.						$input['search']
										.					'</div>'
										.				'</div>';
			}

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

		$return							.=			'<table class="gjGroupInvitesRows table table-hover table-responsive">'
										.				'<thead>'
										.					'<tr>'
										.						'<th class="text-left">' . CBTxt::T( 'To' ) . '</th>'
										.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Date' ) . '</th>'
										.						'<th style="width: 5%;" class="text-center">' . CBTxt::T( 'Status' ) . '</th>'
										.						'<th style="width: 1%;">&nbsp;</th>'
										.					'</tr>'
										.				'</thead>'
										.				'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			$menu						=	array();

			$_PLUGINS->trigger( 'gj_onDisplayInvite', array( &$row, &$menu, $group, $user ) );

			if ( $row->get( 'user' ) ) {
				$toUser					=	CBuser::getInstance( (int) $row->get( 'user' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true );
			} else {
				$toUser					=	'******' . htmlspecialchars( $row->get( 'email' ) ) . '">' . $row->get( 'email' ) . '</a>';
			}

			$return						.=					'<tr>'
										.						'<td class="text-left">' . $toUser . '</td>'
										.						'<td style="width: 25%;" class="text-left hidden-xs">'
										.							( $row->invited() ? '<div class="text-info" title="' . htmlspecialchars( CBTxt::T( 'Invited' ) ) . '">' . cbFormatDate( $row->get( 'invited' ) ) . '</div>' : '<div class="text-warning">' . CBTxt::T( 'Please Resend' ) . '</div>' )
										.							( $row->accepted() ? '<div class="text-success" title="' . htmlspecialchars( CBTxt::T( 'Accepted' ) ) . '">' . cbFormatDate( $row->get( 'accepted' ) ) . '</div>' : null )
										.						'</td>'
										.						'<td style="width: 5%;" class="text-center hidden-xs">';

			if ( $row->accepted() ) {
				$return					.=							'<span class="gjInviteAcceptedIcon fa fa-check text-success" title="' . htmlspecialchars( CBTxt::T( 'Accepted' ) ) . '"></span>';
			} elseif ( $row->invited() ) {
				$return					.=							'<span class="gjInvitePendingIcon fa fa-clock-o text-warning" title="' . htmlspecialchars( CBTxt::T( 'Pending' ) ) . '"></span>';
			} else {
				$return					.=							'<span class="gjInviteResentIcon fa fa-warning text-danger" title="' . htmlspecialchars( CBTxt::T( 'Resend' ) ) . '"></span>';
			}

			$return						.=						'</td>';

			$menuItems					=	'<ul class="gjInviteMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

			if ( $row->canResend() ) {
				$menuItems				.=		'<li class="gjInviteMenuItems"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'invites', 'func' => 'send', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-share-square-o"></span> ' . CBTxt::T( 'Resend' ) . '</a></li>';
			}

			if ( ! $row->accepted() ) {
				$menuItems				.=		'<li class="gjInviteMenuItems"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'invites', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';
			}

			if ( $menu ) {
				$menuItems				.=		'<li class="gjInviteMenuItems">' . implode( '</li><li class="gjGroupMenuItem">', $menu ) . '</li>';
			}

			$menuItems					.=		'<li class="gjInviteMenuItems"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Invite?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'invites', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>'
										.	'</ul>';

			$menuAttr					=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

			$return						.=						'<td style="width: 1%;" class="text-right">'
										.							'<div class="gjInviteMenu btn-group">'
										.								'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.							'</div>'
										.						'</td>'
										.					'</tr>';
		} else {
			$return						.=					'<tr>'
										.						'<td colspan="4" class="text-left">';

			if ( $searching ) {
				$return					.=							CBTxt::T( 'No group invite search results found.' );
			} else {
				$return					.=							CBTxt::T( 'You currently have no invites in this group.' );
			}

			$return						.=						'</td>'
										.					'</tr>';
		}

		$return							.=				'</tbody>';

		if ( $plugin->params->get( 'groups_invites_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=				'<tfoot>'
										.					'<tr>'
										.						'<td colspan="4" class="gjGroupInvitesPaging text-center">'
										.							$pageNav->getListLinks()
										.						'</td>'
										.					'</tr>'
										.				'</tfoot>';
		}

		$return							.=			'</table>'
										.			$pageNav->getLimitBox( false )
										.		'</form>'
										.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayInvites', array( &$return, &$rows, $group, $user ) );

		return $return;
	}
Esempio n. 13
0
	/**
	 * render frontend files
	 *
	 * @param FileTable[]    $rows
	 * @param cbPageNav      $pageNav
	 * @param bool           $searching
	 * @param array          $input
	 * @param array          $counters
	 * @param GroupTable     $group
	 * @param UserTable      $user
	 * @param cbgjFilePlugin $plugin
	 * @return string
	 */
	static function showFiles( $rows, $pageNav, $searching, $input, &$counters, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$counters[]							=	'<span class="gjGroupFileIcon fa-before fa-file-o"> ' . CBTxt::T( 'GROUP_FILES_COUNT', '%%COUNT%% File|%%COUNT%% Files', array( '%%COUNT%%' => (int) $pageNav->total ) ) . '</span>';

		initToolTip();

		$isModerator						=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$isOwner							=	( $user->get( 'id' ) == $group->get( 'user_id' ) );
		$userStatus							=	CBGroupJive::getGroupStatus( $user, $group );
		$canCreate							=	CBGroupJive::canCreateGroupContent( $user, $group, 'file' );
		$canSearch							=	( $plugin->params->get( 'groups_file_search', 1 ) && ( $searching || $pageNav->total ) );
		$return								=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayFiles', array( &$return, &$rows, $group, $user ) );

		$return								.=	'<div class="gjGroupFile">'
											.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '" method="post" name="gjGroupFileForm" id="gjGroupFileForm" class="gjGroupFileForm">';

		if ( $canCreate || $canSearch ) {
			$return							.=			'<div class="gjHeader gjGroupFileHeader row">';

			if ( $canCreate ) {
				$return						.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
											.					'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'file', 'func' => 'new', 'group' => (int) $group->get( 'id' ) ) ) . '\';" class="gjButton gjButtonNewFile btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New File' ) . '</button>'
											.				'</div>';
			}

			if ( $canSearch ) {
				$return						.=				'<div class="' . ( ! $canCreate ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
											.					'<div class="input-group">'
											.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
											.						$input['search']
											.					'</div>'
											.				'</div>';
			}

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

		$return								.=			'<table class="gjGroupFileRows table table-hover table-responsive">'
											.				'<thead>'
											.					'<tr>'
											.						'<th colspan="2">&nbsp;</th>'
											.						'<th style="width: 15%;" class="text-center">' . CBTxt::T( 'Type' ) . '</th>'
											.						'<th style="width: 15%;" class="text-left">' . CBTxt::T( 'Size' ) . '</th>'
											.						'<th style="width: 20%;" class="text-left hidden-xs">' . CBTxt::T( 'Date' ) . '</th>'
											.						'<th style="width: 1%;" class="text-right">&nbsp;</th>'
											.					'</tr>'
											.				'</thead>'
											.				'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			$extension						=	null;
			$size							=	0;
			$title							=	( $row->get( 'title' ) ? htmlspecialchars( $row->get( 'title' ) ) : $row->name() );
			$item							=	$title;

			if ( $row->exists() ) {
				$downloadPath				=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'file', 'func' => 'download', 'id' => (int) $row->get( 'id' ) ), 'raw', 0, true );
				$extension					=	$row->extension();
				$size						=	$row->size();

				switch ( $extension ) {
					case 'txt':
					case 'pdf':
					case 'jpg':
					case 'jpeg':
					case 'png':
					case 'gif':
					case 'js':
					case 'css':
					case 'mp4':
					case 'mp3':
					case 'wav':
						$item				=	'<a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'file', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ), 'raw', 0, true ) . '" target="_blank">'
											.		$item
											.	'</a>';
						break;
					default:
						$item				=	'<a href="' . $downloadPath . '" target="_blank">'
											.		$item
											.	'</a>';
						break;
				}

				$download					=	'<a href="' . $downloadPath . '" target="_blank" title="' . htmlspecialchars( CBTxt::T( 'Click to Download' ) ) . '" class="gjGroupDownloadIcon btn btn-xs btn-default">'
											.		'<span class="fa fa-download"></span>'
											.	'</a>';
			} else {
				$download					=	'<button type="button" class="gjButton gjButtonDownloadFile btn btn-xs btn-default disabled">'
											.		'<span class="fa fa-download"></span>'
											.	'</button>';
			}

			if ( $row->get( 'description' ) ) {
				$item						.=	' ' . cbTooltip( 1, $row->get( 'description' ), $title, 400, null, '<span class="fa fa-info-circle text-muted"></span>' );
			}

			$menu							=	array();

			$_PLUGINS->trigger( 'gj_onDisplayFile', array( &$row, &$menu, $group, $user ) );

			$return							.=					'<tr>'
											.						'<td style="width: 1%;" class="text-center">' . $download . '</td>'
											.						'<td style="width: 45%;" class="gjGroupFileItem text-left">'
											.							$item
											.							'<div class="gjGroupFileUploader small">' . CBuser::getInstance( (int) $row->get( 'user_id' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</div>'
											.						'</td>'
											.						'<td style="width: 15%;" class="text-center"><span class="gjGroupFileTypeIcon fa fa-' . $row->icon() . '" title="' . htmlspecialchars( ( $extension ? strtoupper( $extension ) : CBTxt::T( 'Unknown' ) ) ) . '"></span></td>'
											.						'<td style="width: 15%;" class="text-left">' . $size . '</td>'
											.						'<td style="width: 20%;" class="text-left hidden-xs">'
											.							'<span title="' . htmlspecialchars( $row->get( 'date' ) ) . '">'
											.								cbFormatDate( $row->get( 'date' ), true, false, CBTxt::T( 'GROUP_FILE_DATE_FORMAT', 'M j, Y' ) )
											.							'</span>'
											.						'</td>';

			if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) || $menu ) {
				$menuItems					=	'<ul class="gjFileMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) ) {
					$menuItems				.=		'<li class="gjFileMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'file', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

					if ( ( $row->get( 'published' ) == -1 ) && ( $group->params()->get( 'file', 1 ) == 2 ) ) {
						if ( $isModerator || $isOwner || ( $userStatus >= 2 ) ) {
							$menuItems		.=		'<li class="gjFileMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'file', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
						}
					} elseif ( $row->get( 'published' ) == 1 ) {
						$menuItems			.=		'<li class="gjFileMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this File?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'file', 'func' => 'unpublish', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
					} else {
						$menuItems			.=		'<li class="gjFileMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'file', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
					}
				}

				if ( $menu ) {
					$menuItems				.=		'<li class="gjFileMenuItem">' . implode( '</li><li class="gjFileMenuItem">', $menu ) . '</li>';
				}

				if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) ) {
					$menuItems				.=		'<li class="gjFileMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this File?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'file', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				}

				$menuItems					.=	'</ul>';

				$menuAttr					=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return						.=						'<td style="width: 1%;" class="text-right">'
											.							'<div class="gjFileMenu btn-group">'
											.								'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
											.							'</div>'
											.						'</td>';
			} else{
				$return						.=						'<td style="width: 1%;"></td>';
			}

			$return							.=					'</tr>';
		} else {
			$return							.=					'<tr>'
											.						'<td colspan="6" class="text-left">';

			if ( $searching ) {
				$return						.=							CBTxt::T( 'No group file search results found.' );
			} else {
				$return						.=							CBTxt::T( 'This group currently has no files.' );
			}

			$return							.=						'</td>'
											.					'</tr>';
		}

		$return								.=				'</tbody>';

		if ( $plugin->params->get( 'groups_file_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return							.=				'<tfoot>'
											.					'<tr>'
											.						'<td colspan="6" class="gjGroupFilePaging text-center">'
											.							$pageNav->getListLinks()
											.						'</td>'
											.					'</tr>'
											.				'</tfoot>';
		}

		$return								.=			'</table>'
											.			$pageNav->getLimitBox( false )
											.		'</form>'
											.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayFiles', array( &$return, $rows, $group, $user ) );

		return $return;
	}
Esempio n. 14
0
	/**
	 * render frontend replies
	 *
	 * @param WallTable      $reply
	 * @param WallTable[]    $rows
	 * @param cbPageNav      $pageNav
	 * @param GroupTable     $group
	 * @param UserTable      $user
	 * @param cbgjWallPlugin $plugin
	 * @return string
	 */
	static function showReplies( $reply, $rows, $pageNav, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$isModerator						=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$messageLimit						=	( ! $isModerator ? (int) $plugin->params->get( 'groups_wall_character_limit', 0 ) : 0 );

		$js									=	"$( '.gjGroupWallNewReply:not(.gjGroupWallNewReplyOpen)' ).on( 'click', function() {"
											.		"$( this ).find( '.gjGroupWallLimit,.gjGroupWallNewReplyFooter' ).removeClass( 'hidden' );"
											.		"$( this ).addClass( 'gjGroupWallNewReplyOpen' );"
											.		"$( this ).find( 'textarea' ).autosize({"
											.			"append: '',"
											.			"resizeDelay: 0,"
											.			"placeholder: false"
											.		"});"
											.	"});"
											.	"$( '.gjGroupWallReplies .cbMoreLess' ).cbmoreless();";

		if ( $messageLimit ) {
			$js								.=	"$( '.gjGroupWallNewReply textarea' ).on( 'keyup input change', function() {"
											.		"var inputLength = $( this ).val().length;"
											.		"if ( inputLength > " . (int) $messageLimit . " ) {"
											.			"$( this ).val( $( this ).val().substr( 0, " . (int) $messageLimit . " ) );"
											.		"} else {"
											.			"$( this ).siblings( '.gjGroupWallLimit' ).find( '.gjGroupWallLimitCurrent' ).html( $( this ).val().length );"
											.		"}"
											.	"});";
		}

		$_CB_framework->outputCbJQuery( $js, array( 'cbmoreless', 'autosize' ) );

		$isOwner							=	( $user->get( 'id' ) == $group->get( 'user_id' ) );
		$userStatus							=	CBGroupJive::getGroupStatus( $user, $group );
		$canCreate							=	CBGroupJive::canCreateGroupContent( $user, $group, 'wall' );
		$return								=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayWall', array( &$return, &$rows, $group, $user ) );

		$return								.=	'<div class="gjGroupWallReplies">'
											.		'<div class="gjGroupWallRows">';

		if ( $rows ) foreach ( $rows as $row ) {
			$menu							=	array();

			$integrations					=	$_PLUGINS->trigger( 'gj_onDisplayWall', array( &$row, &$menu, $group, $user ) );

			$cbUser							=	CBuser::getInstance( (int) $row->get( 'user_id' ), false );

			$return							.=			'<div class="gjGroupWallRow">'
											.				'<div class="gjGroupWallHeader media clearfix">'
											.					'<div class="gjGroupWallAvatar media-left">'
											.						$cbUser->getField( 'avatar', null, 'html', 'none', 'list', 0, true )
											.					'</div>'
											.					'<div class="gjGroupWallDetails media-body">'
											.						'<div class="cbMoreLess">'
											.							'<div class="cbMoreLessContent">'
											.								'<strong>' . $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</strong> '
											.								$row->post()
											.							'</div>'
											.							'<div class="cbMoreLessOpen fade-edge hidden">'
											.								'<a href="javascript: void(0);" class="cbMoreLessButton">' . CBTxt::T( 'See More' ) . '</a>'
											.							'</div>'
											.						'</div>'
											.						'<div class="gjGroupWallDate text-muted small">'
											.							cbFormatDate( $row->get( 'date' ), true, 'timeago' )
											.						'</div>'
											.					'</div>'
											.				'</div>'
											.				( is_array( $integrations ) && $integrations ? '<div class="gjGroupWallFooter panel-footer">' . implode( '', $integrations ) . '</div>' : null );

			if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) || $menu ) {
				$menuItems					=	'<ul class="gjWallMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) ) {
					$menuItems				.=		'<li class="gjWallMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'wall', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

					if ( ( $row->get( 'published' ) == -1 ) && ( $group->params()->get( 'wall', 1 ) == 2 ) ) {
						if ( $isModerator || $isOwner || ( $userStatus >= 2 ) ) {
							$menuItems		.=		'<li class="gjWallMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'wall', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
						}
					} elseif ( $row->get( 'published' ) == 1 ) {
						$menuItems			.=		'<li class="gjWallMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this Post?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'wall', 'func' => 'unpublish', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
					} else {
						$menuItems			.=		'<li class="gjWallMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'wall', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
					}
				}

				if ( $menu ) {
					$menuItems				.=		'<li class="gjWallMenuItem">' . implode( '</li><li class="gjWallMenuItem">', $menu ) . '</li>';
				}

				if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) ) {
					$menuItems				.=		'<li class="gjWallMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Post?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'wall', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				}

				$menuItems					.=	'</ul>';

				$menuAttr					=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return						.=				'<div class="gjWallMenu btn-group">'
											.					'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
											.				'</div>';
			}

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

		if ( $plugin->params->get( 'groups_wall_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return							.=			'<div class="gjGroupWallRow gjGroupWallPaging text-center">'
											.				'<form action="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '" method="post" name="gjGroupWallFormPaging" id="gjGroupWallFormPaging" class="gjGroupWallForm">'
											.					$pageNav->getListLinks()
											.					$pageNav->getLimitBox( false )
											.				'</form>'
											.			'</div>';
		}

		if ( $canCreate ) {
			$return							.=			'<div class="gjGroupWallRow gjGroupWallNewReply">'
											.				'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'wall', 'func' => 'save' ) ) . '" method="post" name="gjGroupWallFormNewReply' . (int) $reply->get( 'id' ) . '" id="gjGroupWallFormNewReply' . (int) $reply->get( 'id' ) . '" class="gjGroupWallForm cbValidation">';

			if ( $messageLimit ) {
				$return						.=					'<div class="gjGroupWallLimit small hidden">'
											.						'<div class="gjGroupWallLimitCurrent">0</div>'
											.						' / <div class="gjGroupWallLimitMax">' . (int) $messageLimit . '</div>'
											.					'</div>';
			}

			$return							.=					'<textarea name="post" rows="1" class="form-control required" placeholder="' . htmlspecialchars( CBTxt::T( 'Write a reply...' ) ) . '"' . ( $messageLimit ? ' maxlength="' . (int) $messageLimit . '"' : null ) . '></textarea>'
											.					'<div class="gjGroupWallNewReplyFooter text-right hidden">'
											.						'<button type="submit" class="gjButton gjButtonSubmit btn btn-primary btn-xs" ' . cbValidator::getSubmitBtnHtmlAttributes() . '>' . CBTxt::T( 'Reply' ) . '</button>'
											.					'</div>'
											.					'<input type="hidden" name="group" value="' . (int) $group->get( 'id' ) . '" />'
											.					'<input type="hidden" name="reply" value="' . (int) $reply->get( 'id' ) . '" />'
											.					cbGetSpoofInputTag( 'plugin' )
											.				'</form>'
											.			'</div>';
		}

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

		$_PLUGINS->trigger( 'gj_onAfterDisplayWall', array( &$return, $rows, $group, $user ) );

		return $return;
	}
Esempio n. 15
0
	/**
	 * Renders the Docman tab
	 *
	 * @param  Table[]      $rows       Articles to render
	 * @param  cbPageNav    $pageNav    Pagination
	 * @param  boolean      $searching  Currently searching
	 * @param  string[]     $input      HTML of input elements
	 * @param  UserTable    $viewer     Viewing user
	 * @param  UserTable    $user       Viewed user
	 * @param  stdClass     $model      The model reference
	 * @param  TabTable     $tab        Current Tab
	 * @param  PluginTable  $plugin     Current Plugin
	 * @return string                   HTML
	 */
	static public function showDocmanTab( $rows, $pageNav, $searching, $input, $viewer, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $tab, /** @noinspection PhpUnusedParameterInspection */ $plugin )
	{
		global $_CB_framework, $_LANG;

		$tabPaging				=	$tab->params->get( 'tab_paging', 1 );
		//$canSearch				=	( $tab->params->get( 'tab_search', 1 ) && ( $searching || $pageNav->total ) );
                $canCreate					=	false;
		$profileOwner				=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator				=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();
		
                if ( $profileOwner ) {
			if ( $cbModerator ) {
				$canCreate			=	true;
			} elseif ( $user->get( 'id' ) && Application::User( (int) $viewer->get( 'id' ) )->canViewAccessLevel( (int) $plugin->params->get( 'blog_create_access', 2 ) ) ) {
				if ( ( ! $blogLimit ) || ( $blogLimit && ( $pageNav->total < $blogLimit ) ) ) {
					$canCreate		=	true;
				}
			}
		}
                
		$return					=	'<div class="articlesTab">'
								.		'<form action="' . $_CB_framework->userProfileUrl( $user->id, true, $tab->tabid ) . '" method="post" name="articleForm" id="articleForm" class="articleForm">';

		/*if ( $canSearch ) {
			$return				.=			'<div class="articlesHeader row" style="margin-bottom: 10px;">'
								.				'<div class="col-sm-offset-8 col-sm-4 text-right">'
								.					'<div class="input-group">'
								.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
								.						$input['search']
								.					'</div>'
								.				'</div>'
								.			'</div>';
		}*/
                if ( $canCreate ) {
                $return                                 .=      '<div class="col-sm-8 text-left">'
									.					'<button type="button" onclick="location.href=\'' . JRoute::_('index.php?option=com_docman&view=document&layout=form&slug=&category_slug=&Itemid='.cbdocmanModel::getDocmanItemID()) . '\';" class="blogsButton blogsButtonNew btn btn-success"><span class="fa fa-plus-circle"></span> ' . $_LANG['New Document'] . '</button>'
									.				'</div>';

                }
                $return					.=			'<table class="articlesContainer table table-hover table-responsive">'
								.				'<thead>'
								.					'<tr>'
								.						'<th style="width: 50%;" class="text-left">' . $_LANG['Document Title'] . '</th>'
								.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Category' ) . '</th>'
								.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Created' ) . '</th>'
								.					'</tr>'
								.				'</thead>'
								.				'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			$return				.=					'<tr>'
								.						'<td style="width: 50%;" class="text-left"><a href="' . cbdocmanModel::getUrl( $row, true, 'article' ) . '">' . $row->get( 'title' ) . '</a></td>'
								.						'<td style="width: 25%;" class="text-left hidden-xs">' . ( $row->get( 'category' ) ? $row->get( 'category_title' ) : '' ) . '</td>'
								.						'<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate( $row->get( 'created_on' ) ) . '</td>'
								.					'</tr>';
		} else {
			$return				.=					'<tr>'
								.						'<td colspan="3" class="text-left">';

			if ( $searching ) {
				$return			.=							CBTxt::T( 'No article search results found.' );
			} else {
				if ( $viewer->id == $user->id ) {
					$return		.=							$_LANG['You have no article'];
				} else {
					$return		.=							$_LANG['This user has no articles.'];
				}
			}

			$return				.=						'</td>'
								.					'</tr>';
		}

		$return					.=				'</tbody>';

		if ( $tabPaging && ( $pageNav->total > $pageNav->limit ) ) {
			$return				.=				'<tfoot>'
								.					'<tr>'
								.						'<td colspan="3" class="text-center">'
								.							$pageNav->getListLinks()
								.						'</td>'
								.					'</tr>'
								.				'</tfoot>';
		}

		$return					.=			'</table>'
								.			$pageNav->getLimitBox( false )
								.		'</form>'
								.	'</div>';

		return $return;
	}
Esempio n. 16
0
	/**
	 * render frontend event attending
	 *
	 * @param AttendanceTable[]        $rows
	 * @param cbPageNav                $pageNav
	 * @param bool                     $searching
	 * @param array                    $input
	 * @param EventTable               $event
	 * @param UserTable                $user
	 * @param CBplug_cbgroupjiveevents $plugin
	 * @return string
	 */
	static function showAttending( $rows, $pageNav, $searching, $input, $event, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		initToolTip();

		$canSearch						=	( $plugin->params->get( 'groups_events_attending_search', 0 ) && ( $searching || $pageNav->total ) );
		$returnUrl						=	CBGroupJive::getReturn( true, true );

		if ( ! $returnUrl ) {
			$returnUrl					=	$_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $event->group()->get( 'id' ) ) );
		}

		$return							=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayAttending', array( &$return, &$rows, $event, $user ) );

		$return							.=	'<div class="gjEventAttending">'
										.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'events', 'func' => 'attending', 'id' => (int) $event->get( 'id' ) ) ) . '" method="post" name="gjEventAttendingForm" id="gjEventAttendingForm" class="gjEventAttendingForm">'
										.			'<div class="gjEventAttendingTitle page-header"><h3>' . htmlspecialchars( $event->get( 'title' ) ) . '</h3></div>';

		if ( $canSearch ) {
			$return						.=			'<div class="gjHeader gjEventAttendingHeader row">'
										.				'<div class="col-sm-offset-8 col-sm-4 text-right">'
										.					'<div class="input-group">'
										.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
										.						$input['search']
										.					'</div>'
										.				'</div>'
										.			'</div>';
		}

		$return							.=			'<div class="gjEventAttendingRows">';

		if ( $rows ) foreach ( $rows as $row ) {
			$cbUser						=	CBuser::getInstance( (int) $row->get( 'user_id' ), false );

			$return						.=				'<div class="gjEventAttendingUser gjContainerBox img-thumbnail">'
										.					'<div class="gjContainerBoxHeader">'
										.						'<div class="gjContainerBoxCanvas text-left">'
										.							$cbUser->getField( 'canvas', null, 'html', 'none', 'profile', 0, true )
										.						'</div>'
										.						'<div class="gjContainerBoxLogo text-left">'
										.							$cbUser->getField( 'avatar', null, 'html', 'none', 'list', 0, true )
										.						'</div>'
										.					'</div>'
										.					'<div class="gjContainerBoxBody text-left">'
										.						'<div class="gjContainerBoxTitle">'
										.							$cbUser->getField( 'onlinestatus', null, 'html', 'none', 'list', 0, true, array( '_imgMode' => 1 ) )
										.							' <strong>' . $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</strong>'
										.						'</div>'
										.					'</div>'
										.				'</div>';
		} else {
			if ( $searching ) {
				$return					.=				CBTxt::T( 'No event guest search results found.' );
			} else {
				$return					.=				CBTxt::T( 'This event currently has no guests.' );
			}
		}

		$return							.=			'</div>';

		if ( $plugin->params->get( 'groups_events_attending_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=			'<div class="gjEventAttendingPaging text-center">'
										.				$pageNav->getListLinks()
										.			'</div>';
		}

		$return							.=			$pageNav->getLimitBox( false )
										.			'<div class="form-group cb_form_line clearfix text-right">'
										.				'<input type="button" value="' . htmlspecialchars( CBTxt::T( 'Back' ) ) . '" class="gjButton gjButtonCancel btn btn-default" onclick="window.location.href = \'' . $returnUrl . '\';" />'
										.			'</div>'
										.		'</form>'
										.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayAttending', array( &$return, &$rows, $event, $user ) );

		echo $return;
	}
Esempio n. 17
0
	/**
	 * @param cbgalleryItemTable[]      $rows
	 * @param cbPageNav                 $pageNav
	 * @param cbgalleryFolderTable|null $folder
	 * @param bool                      $searching
	 * @param UserTable                 $viewer
	 * @param UserTable                 $user
	 * @param TabTable                  $tab
	 * @param cbTabHandler              $plugin
	 * @return string
	 */
	static public function showPhotos( $rows, $pageNav, $folder, $searching, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_PLUGINS->trigger( 'gallery_onBeforeDisplayPhotos', array( &$rows, $pageNav, $folder, $searching, $viewer, $user, $tab, $plugin ) );

		/** @var Registry $params */
		$params							=	$tab->params;
		$allowDownload					=	$params->get( 'tab_photos_download', 0 );
		$profileOwner					=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator					=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();

		if ( $rows ) {
			static $JS_LOADED			=	0;

			if ( ! $JS_LOADED++ ) {
				$js						=	"$( document ).on( 'click', '.galleryImageScrollLeftIcon', function() {"
										.		"var previous = $( this ).data( 'previous-photo' );"
										.		"if ( previous ) {"
										.			"$( previous ).find( '.galleryImageItem' ).click();"
										.		"}"
										.	"});"
										.	"$( document ).on( 'click', '.galleryImageScrollRightIcon', function() {"
										.		"var next = $( this ).data( 'next-photo' );"
										.		"if ( next ) {"
										.			"$( next ).find( '.galleryImageItem' ).click();"
										.		"}"
										.	"});";

				$_CB_framework->outputCbJQuery( $js );
			}
		}

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

		$i								=	0;

		if ( $rows ) foreach ( $rows as $row ) {
			$return						.=		'<div class="galleryContainer galleryContainer' . (int) $tab->get( 'tabid' ) . '_' . $i . ' img-thumbnail">';

			if ( $cbModerator || $profileOwner ) {
				$menuItems				=	'<ul class="galleryItemsMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">'
										.		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'edit', 'type' => 'photos', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

				if ( ( $row->get( 'published' ) == -1 ) && $plugin->params->get( 'photos_item_approval', 0 ) ) {
					if ( $cbModerator ) {
						$menuItems		.=		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'publish', 'type' => 'photos', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
					}
				} elseif ( $row->get( 'published' ) > 0 ) {
					$menuItems			.=		'<li class="galleryItemsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this Photo?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'items', 'func' => 'unpublish', 'type' => 'photos', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
				} else {
					$menuItems			.=		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'publish', 'type' => 'photos', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
				}

				$menuItems				.=		'<li class="galleryItemsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Photo?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'items', 'func' => 'delete', 'type' => 'photos', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>'
										.	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return					.=			'<div class="galleryContainerMenu">'
										.				'<div class="galleryItemsMenu btn-group">'
										.					'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.				'</div>'
										.			'</div>';
			}

			$title						=	( $row->get( 'title' ) ? htmlspecialchars( $row->get( 'title' ) ) : $row->getFileName() );
			$item						=	$title;
			$logo						=	null;

			if ( $row->checkExists() ) {
				if ( $row->getLinkDomain() ) {
					$showPath			=	htmlspecialchars( $row->getFilePath() );
					$previewPath		=	$showPath;
					$downloadPath		=	$showPath;
				} else {
					$showPath			=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'show', 'type' => 'photos', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ), 'v' => uniqid() ), 'raw', 0, true );
					$previewPath		=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'preview', 'type' => 'photos', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ), 'v' => uniqid() ), 'raw', 0, true );
					$downloadPath		=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'download', 'type' => 'photos', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ), 'v' => uniqid() ), 'raw', 0, true );
				}

				$image					=	'<div class="galleryImageContainer">';

				if ( $pageNav->total > 1 ) {
					$image				.=		'<div class="galleryImageScrollLeft">'
										.			'<table>'
										.				'<tr>'
										.					'<td>'
										.						'<span class="galleryImageScrollLeftIcon fa fa-chevron-left" data-previous-photo=".galleryContainer' . (int) $tab->get( 'tabid' ) . '_' . ( $i == 0 ? ( count( $rows ) - 1 ) : ( $i - 1 ) ) . '"></span>'
										.					'</td>'
										.				'</tr>'
										.			'</table>'
										.		'</div>';
				}

				$image					.=		'<div style="background-image: url(' . $showPath . ')" class="galleryImage"></div>'
										.		'<div class="galleryImageInfo">'
										.			'<div class="galleryImageInfoRow">'
										.				'<div class="galleryImageInfoTitle col-sm-8 text-left"><strong>' . $title . '</strong></div>'
										.				'<div class="galleryImageInfoOriginal col-sm-4 text-right">'
										.					'<a href="' . $showPath . '" target="_blank">'
										.						CBTxt::T( 'Original' )
										.					'</a>'
										.				'</div>'
										.			'</div>';

				if ( $row->get( 'description' ) || $allowDownload ) {
					$image				.=			'<div class="galleryImageInfoRow">'
										.				'<div class="galleryImageInfoDescription col-sm-8 text-left">' . htmlspecialchars( $row->get( 'description' ) ) . '</div>'
										.				'<div class="galleryImageInfoDownload col-sm-4 text-right">';

					if ( $allowDownload ) {
						$image			.=					'<a href="' . $downloadPath . '" target="_blank">'
										.						CBTxt::T( 'Download' )
										.					'</a>';
					}

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

				$image					.=		'</div>';

				if ( $pageNav->total > 1 ) {
					$image				.=		'<div class="galleryImageScrollRight">'
										.			'<table>'
										.				'<tr>'
										.					'<td>'
										.						'<span class="galleryImageScrollRightIcon fa fa-chevron-right" data-next-photo=".galleryContainer' . (int) $tab->get( 'tabid' ) . '_' . ( isset( $rows[$i+1] ) ? ( $i + 1 ) : 0 ) . '"></span>'
										.					'</td>'
										.				'</tr>'
										.			'</table>'
										.		'</div>';
				}

				$image					.=	'</div>';

				$item					=	cbTooltip( 1, $image, null, array( '80%', '80%' ), null, $item, 'javascript: void(0);', 'class="galleryImageItem" data-cbtooltip-modal="true" data-cbtooltip-open-solo="document" data-cbtooltip-classes="galleryImageModal"' );
				$logo					=	cbTooltip( 1, $image, null, array( '80%', '80%' ), null, '<div style="background-image: url(' . $previewPath . ')" class="galleryContainerLogo"></div>', 'javascript: void(0);', 'class="galleryImageLogo" data-cbtooltip-modal="true" data-cbtooltip-open-solo="document" data-cbtooltip-classes="galleryImageModal"' );
			}

			$width						=	(int) $params->get( 'tab_photos_width', 200 );

			if ( ! $width ) {
				$width					=	200;
			} elseif ( $width < 100 ) {
				$width					=	100;
			}

			$return						.=			'<div class="galleryContainerInner" style="height: ' . $width . 'px; width: ' . $width . 'px;">'
										.				'<div class="galleryContainerTop" style="height: ' . ( $width - 40 ) . 'px;">'
										.					$logo
										.				'</div>'
										.				'<div class="galleryContainerBottom" style="height: 40px;">'
										.					'<div class="galleryContainerContent">'
										.						'<div class="galleryContainerContentRow text-nowrap text-overflow small">'
										.							'<strong>'
										.								$item
										.							'</strong>'
										.						'</div>'
										.						'<div class="galleryContainerContentRow text-nowrap text-overflow small">'
										.							'<span title="' . htmlspecialchars( $row->get( 'date' ) ) . '">'
										.								cbFormatDate( $row->get( 'date' ), true, (int) $params->get( 'tab_photos_items_time_display', 0 ), $params->get( 'tab_photos_items_date_format', 'M j, Y' ), $params->get( 'tab_photos_items_time_format', ' g:h A' ) )
										.							'</span>'
										.							( $row->get( 'description' ) ? '<div class="galleryContainerDescription">' . cbTooltip( 1, $row->get( 'description' ), $title, 400, null, '<span class="fa fa-info-circle text-muted"></span>' ) . '</div>' : null )
										.						'</div>'
										.					'</div>'
										.				'</div>'
										.			'</div>'
										.		'</div>';

			$i++;
		} else {
			$return						.=		'<div>';

			if ( $searching ) {
				$return					.=			CBTxt::T( 'No photos search results found.' );
			} else {
				if ( $folder ) {
					$return				.=			CBTxt::T( 'This album has no photos.' );
				} else {
					if ( $viewer->get( 'id' ) == $user->get( 'id' ) ) {
						$return			.=			CBTxt::T( 'You have no photos.' );
					} else {
						$return			.=			CBTxt::T( 'This user has no photos.' );
					}
				}
			}

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

		if ( $params->get( ( $folder ? 'tab_photos_folder_items_paging' : 'tab_photos_items_paging' ), 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=		'<div class="galleryItemsPaging text-center">'
										.			$pageNav->getListLinks()
										.		'</div>';
		}

		$return							.=	'</div>'
										.	$pageNav->getLimitBox( false );

		return $return;
	}
Esempio n. 18
0
	/**
	 * @param cbinvitesInviteTable[] $rows
	 * @param cbPageNav              $pageNav
	 * @param bool                   $searching
	 * @param array                  $input
	 * @param UserTable              $viewer
	 * @param UserTable              $user
	 * @param TabTable               $tab
	 * @param cbTabHandler           $plugin
	 * @return string
	 */
	static function showTab( $rows, $pageNav, $searching, $input, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework, $_CB_database;

		$params						=	new Registry( $tab->params );
		$profileOwner				=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator				=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();

		$tabPaging					=	$params->get( 'tab_paging', 1 );
		$canSearch					=	( $params->get( 'tab_search', 1 ) && ( $searching || $pageNav->total ) );

		$inviteLimit				=	(int) $plugin->params->get( 'invite_limit', null );
		$canCreate					=	false;
                
                $user_groups_can_create = array(12,16); //proizvoditeli, komercheskie organizacii
                $gids = $user->get('gids');

		if ( $profileOwner ) {
			if ( $cbModerator ) {
				$canCreate			=	true;
			} elseif ( $user->get( 'id' )   ) {
				if ( $inviteLimit ) {
					$query			=	'SELECT COUNT(*)'
									.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_invites' )
									.	"\n WHERE " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
									.	"\n AND ( " . $_CB_database->NameQuote( 'user' ) . " IS NULL OR " . $_CB_database->NameQuote( 'user' ) . " = " . $_CB_database->Quote( '' ) . " )";
					$_CB_database->setQuery( $query );
					$inviteCount	=	(int) $_CB_database->loadResult();

					if ( $inviteCount < $inviteLimit ) {
						$canCreate	=	true;
					}
				} else {
					$canCreate		=	true;
				}
			}
		}
                $groupcancreate = false;
                if($gids){
                    foreach($gids as $gid){
                        if(in_array($gid, $user_groups_can_create)){
                            $groupcancreate = true;
                        }
                    }
                    
                }
                
                if(!$groupcancreate){
                    $canCreate = false;
                }

		$return						=	'<div class="medizdTab">'
									.		'<form action="' . $_CB_framework->userProfileUrl( $user->get( 'id' ), true, $tab->tabid ) . '" method="post" name="medizdForm" id="inviteForm" class="medizdForm">';

		if ( $canCreate || $canSearch ) {
			$return					.=			'<div class="medizdHeader row" style="margin-bottom: 10px;">';

			if ( $canCreate ) {
				$return				.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
									.					'<button type="button" onclick="location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'medizd', 'func' => 'new' ) ) . '\';" class="invitesButton invitesButtonNew btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'MEDPR_NEW_PRODUCT' ) . '</button>'
									.				'</div>';
			}

			if ( $canSearch ) {
				$return				.=				'<div class="' . ( ! $canCreate ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
									.					'<div class="input-group">'
									.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
									.						$input['search']
									.					'</div>'
									.				'</div>';
			}

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

		$menuAccess					=	( $cbModerator || $profileOwner );

		

		$return						.=			'<table class="invitesContainer table table-hover table-responsive">'
									.				'<thead>'
									.					'<tr>'
									.						'<th class="text-left">' . CBTxt::T( 'MEDPR_CODE' ) . '</th>'
									.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Name' ) . '</th>'
									.						'<th style="width: 5%;" class="text-center hidden-xs">' . CBTxt::T( 'Date' ) . '</th>'
                                                                        .                                               '<th style="width: 1%;" class="text-left hidden-xs"></th>'
									.					'</tr>'
									.				'</thead>'
									.				'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			

			$return					.=					'<tr>'
									.						'<td class="text-left"><a href="'.JRoute::_(JUri::base().'index.php?option=com_medicineproducts&view=item&id='.$row->id).'">' . $row->code . '</td>'
									.						'<td style="width: 50%;" class="text-left hidden-xs">'
									.							$row->name
									.						'</td>'
									.						'<td style="width: 25%;" class="text-center hidden-xs">'
                                                                        .                                               $row->created;

			

			$return					.=						'</td>';

			if ( ( $cbModerator || $profileOwner )    ) {
				$menuItems			=	'<ul class="invitesMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

                                    $link = $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'medizd', 'func' => 'edit', 'id' => (int) $row->get( 'id' )));
				
					$menuItems		.=		'<li class="invitesMenuItem"><a href="' . $link . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>'
									.		'<li class="invitesMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'MEDPR_CONFIRM_DEL' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'medizd', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				

				$menuItems			.=	'</ul>';

				$menuAttr			=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return				.=						'<td style="width: 1%;" class="text-right">'
									.							'<div class="invitesMenu btn-group">'
									.								'<button type="button"' . $menuAttr . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
									.							'</div>'
									.						'</td>';
			} else{
				$return				.=						'<td style="width: 1%;" class="text-right"></td>';
			}

			$return					.=					'</tr>';
		} else {
			$return					.=					'<tr>'
									.						'<td colspan="3" class="text-left">';

			if ( $searching ) {
				$return				.=							CBTxt::T( 'MEDPR_PRODUCT_SEARCH_NULL' );
			} else {
				if ( $viewer->id == $user->id ) {
					$return			.=							CBTxt::T( 'MEDPR_NO_PRODUCT' );
				} else {
					$return			.=							CBTxt::T( 'MEDPR_USER_NO_PRODUCT' );
				}
			}

			$return					.=						'</td>'
									.					'</tr>';
		}

		$return						.=				'</tbody>';

		if ( $tabPaging && ( $pageNav->total > $pageNav->limit ) ) {
			$return					.=				'<tfoot>'
									.					'<tr>'
									.						'<td colspan="3" class="text-center">'
									.							$pageNav->getListLinks()
									.						'</td>'
									.					'</tr>'
									.				'</tfoot>';
		}

		$return						.=			'</table>'
									.			$pageNav->getLimitBox( false )
									.		'</form>'
									.	'</div>';

		return $return;
	}
Esempio n. 19
0
	/**
	 * @param cbgalleryItemTable[]      $rows
	 * @param cbPageNav                 $pageNav
	 * @param cbgalleryFolderTable|null $folder
	 * @param bool                      $searching
	 * @param UserTable                 $viewer
	 * @param UserTable                 $user
	 * @param TabTable                  $tab
	 * @param cbTabHandler              $plugin
	 * @return string
	 */
	static public function showMusic( $rows, $pageNav, $folder, $searching, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_PLUGINS->trigger( 'gallery_onBeforeDisplayMusic', array( &$rows, $pageNav, $folder, $searching, $viewer, $user, $tab, $plugin ) );

		/** @var Registry $params */
		$params							=	$tab->params;
		$allowDownload					=	$params->get( 'tab_music_download', 0 );
		$profileOwner					=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator					=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();
		$return							=	null;

		if ( $rows ) {
			$js							=	"var musicPlayer = null;"
										.	"$( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).on( 'click', function( event ) {"
										.		"event.preventDefault();"
										.		"if ( $( this ).hasClass( 'musicItemPlaying' ) ) {"
										.			"if ( musicPlayer != null ) {"
										.				"musicPlayer.pause();"
										.			"}"
										.		"} else if ( $( this ).hasClass( 'musicItemPaused' ) ) {"
										.			"if ( musicPlayer != null ) {"
										.				"musicPlayer.play();"
										.			"}"
										.		"} else {"
										.			"$( '.musicItemsPlayer" . (int) $tab->get( 'tabid' ) . "Container' ).hide();"
										.			"if ( musicPlayer != null ) {"
										.				"musicPlayer.remove();"
										.				"$( '.musicItemsPlayer" . (int) $tab->get( 'tabid' ) . "Container > .mejs-offscreen' ).remove();"
										.			"}"
										.			"$( '#musicItemsPlayer" . (int) $tab->get( 'tabid' ) . "' ).attr( 'src', $( this ).attr( 'href' ) ).attr( 'type', $( this ).data( 'mimetype' ) ).attr( 'controls', 'controls' ).attr( 'autoplay', 'autoplay' ).attr( 'preload', 'none' );"
										.			"musicPlayer = new MediaElementPlayer( '#musicItemsPlayer" . (int) $tab->get( 'tabid' ) . "', {"
										.				"isVideo: false,"
										.				"success: function( media ) {"
										.					"media.addEventListener( 'play', function() {"
										.						"$( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . ".active' ).removeClass( 'musicItemPaused' ).addClass( 'musicItemPlaying' ).find( '.fa' ).removeClass( 'fa-play' ).addClass( 'fa-pause' );"
										.					"}, false );"
										.					"media.addEventListener( 'pause', function() {"
										.						"$( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . ".active' ).removeClass( 'musicItemPlaying' ).addClass( 'musicItemPaused' ).find( '.fa' ).removeClass( 'fa-pause' ).addClass( 'fa-play' );"
										.					"}, false );"
										.					"media.addEventListener( 'ended', function() {"
										.						"var music = $( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . ".active' );"
										.						"var repeat = $( '.musicItemRepeat" . (int) $tab->get( 'tabid' ) . "' );"
										.						"var shuffle = $( '.musicItemShuffle" . (int) $tab->get( 'tabid' ) . "' );"
										.						"var next = null;"
										.						"music.removeClass( 'musicItemPlayed' ).addClass( 'musicItemPlayed' );"
										.						"if ( repeat.hasClass( 'btn-primary' ) ) {"
										.							"if ( shuffle.hasClass( 'btn-primary' ) ) {"
										.								"next = music.closest( 'tr' ).parent().children( 'tr' ).find( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).filter( ':not(.active)' );"
										.								"if ( next.length ) {"
										.								"next = next.eq( Math.floor( Math.random() * next.length ) );"
										.								"}"
										.							"} else {"
										.								"next = music.closest( 'tr' ).nextAll( 'tr' ).find( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).first();"
										.								"if ( ! next.length ) {"
										.									"next = music.closest( 'tr' ).parent().children( 'tr' ).find( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).first();"
										.								"}"
										.							"}"
										.						"} else {"
										.							"if ( shuffle.hasClass( 'btn-primary' ) ) {"
										.								"next = music.closest( 'tr' ).parent().children( 'tr' ).find( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).filter( ':not(.musicItemPlayed,.active)' ).first();"
										.								"if ( next.length ) {"
										.									"next = next.eq( Math.floor( Math.random() * next.length ) );"
										.								"}"
										.							"} else {"
										.								"next = music.closest( 'tr' ).nextAll( 'tr' ).find( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).filter( ':not(.musicItemPlayed)' ).first();"
										.								"if ( ! next.length ) {"
										.									"next = music.closest( 'tr' ).parent().children( 'tr' ).find( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).filter( ':not(.musicItemPlayed)' ).first();"
										.								"}"
										.							"}"
										.							"if ( ! next.length ) {"
										.								"music.closest( 'tr' ).parent().children( 'tr' ).find( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).removeClass( 'musicItemPlayed' );"
										.							"}"
										.						"}"
										.						"if ( next.length ) {"
										.							"next.click();"
										.						"}"
										.					"}, false );"
										.				"}"
										.			"});"
										.			"$( '.musicItemsPlayer" . (int) $tab->get( 'tabid' ) . "Container' ).slideDown();"
										.			"$( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).find( '.fa' ).removeClass( 'fa-play fa-pause' ).addClass( 'fa-play' );"
										.			"$( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).removeClass( 'active musicItemPlaying musicItemPaused' );"
										.			"$( '.musicItemPlay" . (int) $tab->get( 'tabid' ) . "' ).closest( 'tr' ).removeClass( 'active' );"
										.			"$( this ).addClass( 'active musicItemPaused' );"
										.			"$( this ).closest( 'tr' ).addClass( 'active' );"
										.			"musicPlayer.play();"
										.		"}"
										.	"});"
										.	"$( '.musicItemToggle' ).on( 'click', function( event ) {"
										.		"event.preventDefault();"
										.		"if ( $( this ).hasClass( 'btn-primary' ) ) {"
										.			"$( this ).removeClass( 'btn-primary' ).addClass( 'btn-muted' );"
										.		"} else {"
										.			"$( this ).addClass( 'btn-primary' ).removeClass( 'btn-muted' );"
										.		"}"
										.	"});";

			$_CB_framework->outputCbJQuery( $js, 'media' );

			$width						=	(int) $params->get( 'tab_music_width', 0 );

			$return						.=	'<div class="musicItemsPlayer' . (int) $tab->get( 'tabid' ) . 'Container text-center" style="display: none; margin: 0 auto 10px auto;' . ( $width ? ' max-width: ' . $width . 'px;' : null ) . '">'
										.		'<audio width="640" style="width: 100%;" id="musicItemsPlayer' . (int) $tab->get( 'tabid' ) . '" controls="controls" autoplay="autoplay" preload="none"></audio>'
										.	'</div>';
		}

		$return							.=	'<table class="musicItemsContainer table table-hover table-responsive">'
										.		'<thead>'
										.			'<tr>'
										.				'<th style="width: 1%;" class="text-left">#</th>'
										.				'<th class="text-left" colspan="' . ( $allowDownload ? 3 : 2 ) . '">';

		if ( $rows ) {
			$return						.=					'<button type="button" class="musicItemToggle musicItemRepeat' . (int) $tab->get( 'tabid' ) . ' btn btn-xs btn-primary" title="' . htmlspecialchars( CBTxt::T( 'Repeat' ) ) . '"><span class="fa fa-refresh"></span></button>'
										.					' <button type="button" class="musicItemToggle musicItemShuffle' . (int) $tab->get( 'tabid' ) . ' btn btn-xs btn-primary" title="' . htmlspecialchars( CBTxt::T( 'Shuffle' ) ) . '"><span class="fa fa-random"></span></button>';
		}

		$return							.=				'</th>'
										.				'<th style="width: 20%;" class="text-left hidden-xs">' . CBTxt::T( 'Date' ) . '</th>'
										.				'<th style="width: 1%;" class="text-right">&nbsp;</th>'
										.			'</tr>'
										.		'</thead>'
										.		'<tbody>';

		$i								=	0;

		if ( $rows ) foreach ( $rows as $row ) {
			$exists						=	$row->checkExists();
			$title						=	( $row->get( 'title' ) ? htmlspecialchars( $row->get( 'title' ) ) : $row->getFileName() );
			$item						=	$title;

			if ( $exists ) {
				if ( $row->getLinkDomain() ) {
					$showPath			=	htmlspecialchars( $row->getFilePath() );
					$downloadPath		=	$showPath;
				} else {
					$showPath			=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'show', 'type' => 'music', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ), 'v' => uniqid() ), 'raw', 0, true );
					$downloadPath		=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'download', 'type' => 'music', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ), 'v' => uniqid() ), 'raw', 0, true );
				}

				$play					=	'<a href="' . $showPath . '" title="' . htmlspecialchars( CBTxt::T( 'Click to Play' ) ) . '" class="musicItemsPlay musicItemPlay' . (int) $tab->get( 'tabid' ) . ' btn btn-xs btn-default" data-mimetype="' . htmlspecialchars( $row->getMimeType() ) . '">'
										.		'<span class="fa fa-play"></span>'
										.	'</a>';

				$item					=	'<a href="' . $showPath . '" target="_blank">'
										.		$item
										.	'</a>';

				$download				=	'<a href="' . $downloadPath . '" target="_blank" title="' . htmlspecialchars( CBTxt::T( 'Click to Download' ) ) . '" class="musicItemsDownload btn btn-xs btn-default">'
										.		'<span class="fa fa-download"></span>'
										.	'</a>';
			} else {
				$play					=	'<button type="button" class="musicItemsPlay btn btn-xs btn-default disabled">'
										.		'<span class="fa fa-play"></span>'
										.	'</button>';

				$download				=	'<button type="button" class="musicItemsDownload btn btn-xs btn-default disabled">'
										.		'<span class="fa fa-download"></span>'
										.	'</button>';
			}

			if ( $row->get( 'description' ) ) {
				$item					.=	' ' . cbTooltip( 1, $row->get( 'description' ), $title, 400, null, '<span class="fa fa-info-circle text-muted"></span>' );
			}

			$return						.=			'<tr' . ( $exists ? ' class="musicItemPlayable"' : null ) . '>'
										.				'<td style="width: 1%;" class="text-center">' . ( $i + 1 ) . '</td>'
										.				'<td style="width: 1%;" class="text-center">' . $play . '</td>'
										.				( $allowDownload ? '<td style="width: 1%;" class="text-center">' . $download . '</td>' : null )
										.				'<td class="text-left">' . $item . '</td>'
										.				'<td style="width: 20%;" class="text-left hidden-xs">'
										.					'<span title="' . htmlspecialchars( $row->get( 'date' ) ) . '">'
										.						cbFormatDate( $row->get( 'date' ), true, (int) $params->get( 'tab_music_items_time_display', 0 ), $params->get( 'tab_music_items_date_format', 'M j, Y' ), $plugin->params->get( 'tab_music_items_time_format', ' g:h A' ) )
										.					'</span>'
										.				'</td>';

			if ( $cbModerator || $profileOwner ) {
				$menuItems				=	'<ul class="galleryItemsMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">'
										.		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'edit', 'type' => 'music', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

				if ( ( $row->get( 'published' ) == -1 ) && $plugin->params->get( 'music_item_approval', 0 ) ) {
					if ( $cbModerator ) {
						$menuItems		.=		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'publish', 'type' => 'music', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
					}
				} elseif ( $row->get( 'published' ) > 0 ) {
					$menuItems			.=		'<li class="galleryItemsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this Music?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'items', 'func' => 'unpublish', 'type' => 'music', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
				} else {
					$menuItems			.=		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'publish', 'type' => 'music', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
				}

				$menuItems				.=		'<li class="galleryItemsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Music?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'items', 'func' => 'delete', 'type' => 'music', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>'
										.	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return					.=				'<td style="width: 1%;" class="text-right">'
										.					'<div class="galleryItemsMenu btn-group">'
										.						'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.					'</div>'
										.				'</td>';
			} else{
				$return					.=				'<td style="width: 1%;"></td>';
			}

			$return						.=			'</tr>';

			$i++;
		} else {
			$return						.=			'<tr>'
										.				'<td colspan="' . ( $allowDownload ? 6 : 5 ) . '" class="text-left">';

			if ( $searching ) {
				$return					.=					CBTxt::T( 'No music search results found.' );
			} else {
				if ( $folder ) {
					$return				.=					CBTxt::T( 'This album has no music.' );
				} else {
					if ( $viewer->get( 'id' ) == $user->get( 'id' ) ) {
						$return			.=					CBTxt::T( 'You have no music.' );
					} else {
						$return			.=					CBTxt::T( 'This user has no music.' );
					}
				}
			}

			$return						.=				'</td>'
										.			'</tr>';
		}

		$return							.=		'</tbody>';

		if ( $params->get( ( $folder ? 'tab_music_folder_items_paging' : 'tab_music_items_paging' ), 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=		'<tfoot>'
										.			'<tr>'
										.				'<td colspan="' . ( $allowDownload ? 6 : 5 ) . '" class="galleryItemsPaging text-center">'
										.					$pageNav->getListLinks()
										.				'</td>'
										.			'</tr>'
										.		'</tfoot>';
		}

		$return							.=	'</table>'
										.	$pageNav->getLimitBox( false );

		return $return;
	}
Esempio n. 20
0
	/**
	 * render frontend group users
	 *
	 * @param CB\Plugin\GroupJive\Table\UserTable[] $rows
	 * @param cbPageNav                             $pageNav
	 * @param bool                                  $searching
	 * @param array                                 $input
	 * @param GroupTable                            $group
	 * @param UserTable                             $user
	 * @param CBplug_cbgroupjive                    $plugin
	 * @return string
	 */
	static function showUsers( $rows, $pageNav, $searching, $input, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		initToolTip();

		$isModerator					=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$isOwner						=	( $user->get( 'id' ) == $group->get( 'user_id' ) );
		$userStatus						=	CBGroupJive::getGroupStatus( $user, $group );
		$canSearch						=	( $plugin->params->get( 'groups_users_search', 0 ) && ( $searching || $pageNav->total ) );
		$return							=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayUsers', array( &$return, &$rows, $group, $user ) );

		$return							.=	'<div class="gjGroupUsers">'
										.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '" method="post" name="gjGroupUsersForm" id="gjGroupUsersForm" class="gjGroupUsersForm">';

		if ( $canSearch ) {
			$return						.=			'<div class="gjHeader gjGroupUsersHeader row">'
										.				'<div class="col-sm-offset-8 col-sm-4 text-right">'
										.					'<div class="input-group">'
										.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
										.						$input['search']
										.					'</div>'
										.				'</div>'
										.			'</div>';
		}

		$return							.=			'<div class="gjGroupUsersRows">';

		if ( $rows ) foreach ( $rows as $row ) {
			$canModerate				=	( ( $userStatus >= 2 ) && ( $userStatus > $row->get( 'status' ) ) && ( $user->get( 'id' ) != $row->get( 'user_id' ) ) );

			$counters					=	array();
			$content					=	null;
			$menu						=	array();

			$_PLUGINS->trigger( 'gj_onDisplayUser', array( &$row, &$counters, &$content, &$menu, $group, $user ) );

			$cbUser						=	CBuser::getInstance( (int) $row->get( 'user_id' ), false );

			switch ( (int) $row->get( 'status' ) ) {
				case -1:
					$icon				=	'<span class="gjGroupUserStatusIcon fa fa-ban text-danger"></span> ';
					break;
				case 0:
					$icon				=	'<span class="gjGroupUserStatusIcon fa fa-warning text-warning"></span> ';
					break;
				case 1:
					$icon				=	'<span class="gjGroupUserStatusIcon fa fa-user"></span> ';
					break;
				case 2:
					$icon				=	'<span class="gjGroupUserStatusIcon fa fa-gavel text-success"></span> ';
					break;
				case 3:
					$icon				=	'<span class="gjGroupUserStatusIcon fa fa-gavel text-success"></span> ';
					break;
				case 4:
					$icon				=	'<span class="gjGroupUserStatusIcon fa fa-star text-primary"></span> ';
					break;
				default:
					$icon				=	'<span class="gjGroupUserStatusIcon fa fa-question text-warning"></span> ';
					break;
			}

			$return						.=				'<div class="gjGroupUsersUser gjContainerBox img-thumbnail">'
										.					'<div class="gjContainerBoxHeader">'
										.						'<div class="gjContainerBoxCanvas text-left">'
										.							$cbUser->getField( 'canvas', null, 'html', 'none', 'profile', 0, true )
										.						'</div>'
										.						'<div class="gjContainerBoxLogo text-left">'
										.							$cbUser->getField( 'avatar', null, 'html', 'none', 'list', 0, true )
										.						'</div>'
										.					'</div>'
										.					'<div class="gjContainerBoxBody text-left">'
										.						'<div class="gjContainerBoxTitle">'
										.							$cbUser->getField( 'onlinestatus', null, 'html', 'none', 'list', 0, true, array( '_imgMode' => 1 ) )
										.							' <strong>' . $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</strong>'
										.						'</div>'
										.						'<div class="gjContainerBoxCounters text-muted small row">'
										.							( $isModerator || $isOwner || $canModerate || ( $row->get( 'status' ) != 1 ) ? '<div class="gjContainerBoxCounter col-sm-6">' . $icon . $row->status() . '</div>' : null )
										.							( $counters ? '<div class="gjContainerBoxCounter col-sm-6">' . implode( '</div><div class="gjContainerBoxCounter col-sm-6">', $counters ) . '</div>' : null )
										.						'</div>'
										.						( $content ? '<div class="gjContainerBoxContent">' . $content . '</div>' : null );

			if ( ( $isModerator || $isOwner || $canModerate ) && ( $row->get( 'status' ) == 0 ) && ( $group->get( 'type' ) == 2 ) ) {
				$return					.=						'<div class="gjContainerBoxButton text-right">'
										.							'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'users', 'func' => 'active', 'id' => (int) $row->get( 'id' ) ) ) . '\';" class="gjButton gjButtonApprove btn btn-xs btn-success">' . CBTxt::T( 'Approve' ) . '</button>'
										.						'</div>';
			}

			$return						.=					'</div>';

			if ( ( $row->get( 'status' ) != 4 ) && ( $isModerator || $isOwner || $canModerate || $menu ) ) {
				$menuItems				=	'<ul class="gjUserMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( $isModerator || $isOwner ) {
					$menuItems			.=		'<li class="gjUserMenuItems"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to promote this user to Owner?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'users', 'func' => 'owner', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-thumbs-o-up"></span> ' . CBTxt::T( 'Promote to Owner' ) . '</a></li>';
				}

				if ( ( $row->get( 'status' ) <= 2 ) && ( $isModerator || $isOwner ) ) {
					$menuItems			.=		'<li class="gjUserMenuItems"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to promote this user to Admin?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'users', 'func' => 'admin', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-thumbs-o-up"></span> ' . CBTxt::T( 'Promote to Admin' ) . '</a></li>';
				}

				if ( ( $row->get( 'status' ) <= 1 ) && ( $isModerator || $isOwner || ( $canModerate && ( $userStatus >= 3 ) ) ) ) {
					$menuItems			.=		'<li class="gjUserMenuItems"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to promote this user to Moderator?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'users', 'func' => 'moderator', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-thumbs-o-up"></span> ' . CBTxt::T( 'Promote to Moderator' ) . '</a></li>';
				}

				if ( ( $row->get( 'status' ) <= 0 ) && ( $isModerator || $isOwner || ( $canModerate && ( $userStatus >= 2 ) ) ) ) {
					$menuItems			.=		'<li class="gjUserMenuItems"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'users', 'func' => 'active', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-thumbs-o-up"></span> ' . ( ( $row->get( 'status' ) == 0 ) && ( $group->get( 'type' ) == 2 ) ? CBTxt::T( 'Approve' ) : CBTxt::T( 'Promote to Active' ) ) . '</a></li>';
				}

				if ( ( $row->get( 'status' ) >= 3 ) && ( $isModerator || $isOwner ) ) {
					$menuItems			.=		'<li class="gjUserMenuItems"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to demote this user to Moderator?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'users', 'func' => 'moderator', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-thumbs-o-down"></span> ' . CBTxt::T( 'Demote to Moderator' ) . '</a></li>';
				}

				if ( ( $row->get( 'status' ) >= 2 ) && ( $isModerator || $isOwner || ( $canModerate && ( $userStatus >= 3 ) ) ) ) {
					$menuItems			.=		'<li class="gjUserMenuItems"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to demote this user to Active?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'users', 'func' => 'active', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-thumbs-o-down"></span> ' . CBTxt::T( 'Demote to Active' ) . '</a></li>';
				}

				if ( ( $row->get( 'status' ) >= 0 ) && ( $isModerator || $isOwner || ( $canModerate && ( $userStatus >= 2 ) ) ) ) {
					$menuItems			.=		'<li class="gjUserMenuItems"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to ban this User?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'users', 'func' => 'ban', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-ban"></span> ' . CBTxt::T( 'Ban' ) . '</a></li>';
				}

				if ( $menu ) {
					$menuItems			.=		'<li class="gjUserMenuItems">' . implode( '</li><li class="gjGroupMenuItem">', $menu ) . '</li>';
				}

				if ( $isModerator || $isOwner || ( $canModerate && ( $userStatus >= 3 ) ) ) {
					$menuItems			.=		'<li class="gjUserMenuItems"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this User?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'users', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . ( ( $row->get( 'status' ) == 0 ) && ( $group->get( 'type' ) == 2 ) ? CBTxt::T( 'Reject' ) : CBTxt::T( 'Delete' ) ) . '</a></li>';
				}

				$menuItems				.=	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return					.=					'<div class="gjContainerBoxMenu">'
										.						'<div class="gjUserMenu btn-group">'
										.							'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.						'</div>'
										.					'</div>';
			}

			$return						.=				'</div>';
		} else {
			if ( $searching ) {
				$return					.=				CBTxt::T( 'No group user search results found.' );
			} else {
				$return					.=				CBTxt::T( 'This group currently has no users.' );
			}
		}

		$return							.=			'</div>';

		if ( $plugin->params->get( 'groups_users_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=			'<div class="gjGroupUsersPaging text-center">'
										.				$pageNav->getListLinks()
										.			'</div>';
		}

		$return							.=			$pageNav->getLimitBox( false )
										.		'</form>'
										.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayUsers', array( &$return, &$rows, $group, $user ) );

		return $return;
	}
Esempio n. 21
0
	/**
	 * @param cbgalleryItemTable[]      $rows
	 * @param cbPageNav                 $pageNav
	 * @param cbgalleryFolderTable|null $folder
	 * @param bool                      $searching
	 * @param UserTable                 $viewer
	 * @param UserTable                 $user
	 * @param TabTable                  $tab
	 * @param cbTabHandler              $plugin
	 * @return string
	 */
	static public function showFiles( $rows, $pageNav, $folder, $searching, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_PLUGINS->trigger( 'gallery_onBeforeDisplayFiles', array( &$rows, $pageNav, $folder, $searching, $viewer, $user, $tab, $plugin ) );

		/** @var Registry $params */
		$params							=	$tab->params;
		$profileOwner					=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator					=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();

		$return							=	'<table class="filesItemsContainer table table-hover table-responsive">'
										.		'<thead>'
										.			'<tr>'
										.				'<th colspan="2">&nbsp;</th>'
										.				'<th style="width: 15%;" class="text-center">' . CBTxt::T( 'Type' ) . '</th>'
										.				'<th style="width: 15%;" class="text-left">' . CBTxt::T( 'Size' ) . '</th>'
										.				'<th style="width: 20%;" class="text-left hidden-xs">' . CBTxt::T( 'Date' ) . '</th>'
										.				'<th style="width: 1%;" class="text-right">&nbsp;</th>'
										.			'</tr>'
										.		'</thead>'
										.		'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			$extension					=	null;
			$size						=	0;
			$title						=	( $row->get( 'title' ) ? htmlspecialchars( $row->get( 'title' ) ) : $row->getFileName() );
			$item						=	$title;

			if ( $row->checkExists() ) {
				if ( $row->getLinkDomain() ) {
					$showPath			=	htmlspecialchars( $row->getFilePath() );
					$downloadPath		=	$showPath;
				} else {
					$showPath			=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'show', 'type' => 'files', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ), 'v' => uniqid() ), 'raw', 0, true );
					$downloadPath		=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'download', 'type' => 'files', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ), 'v' => uniqid() ), 'raw', 0, true );
				}

				$extension				=	$row->getExtension();
				$size					=	$row->getFileSize();

				switch ( $extension ) {
					case 'txt':
					case 'pdf':
					case 'jpg':
					case 'jpeg':
					case 'png':
					case 'gif':
					case 'js':
					case 'css':
					case 'mp4':
					case 'mp3':
					case 'wav':
						$item			=	'<a href="' . $showPath . '" target="_blank">'
										.		$item
										.	'</a>';
						break;
					default:
						$item			=	'<a href="' . $downloadPath . '" target="_blank">'
										.		$item
										.	'</a>';
						break;
				}

				$download				=	'<a href="' . $downloadPath . '" target="_blank" title="' . htmlspecialchars( CBTxt::T( 'Click to Download' ) ) . '" class="filesItemsDownload btn btn-xs btn-default">'
										.		'<span class="fa fa-download"></span>'
										.	'</a>';
			} else {
				$download				=	'<button type="button" class="filesItemsDownload btn btn-xs btn-default disabled">'
										.		'<span class="fa fa-download"></span>'
										.	'</button>';
			}

			if ( $row->get( 'description' ) ) {
				$item					.=	' ' . cbTooltip( 1, $row->get( 'description' ), $title, 400, null, '<span class="fa fa-info-circle text-muted"></span>' );
			}

			$return						.=			'<tr>'
										.				'<td style="width: 1%;" class="text-center">' . $download . '</td>'
										.				'<td class="text-left">' . $item . '</td>'
										.				'<td style="width: 15%;" class="text-center"><span class="filesItemsType fa fa-' . htmlspecialchars( self::getFileIcon( $extension ) ) . '" title="' . htmlspecialchars( ( $extension ? strtoupper( $extension ) : CBTxt::T( 'Unknown' ) ) ) . '"></span></td>'
										.				'<td style="width: 15%;" class="text-left">' . $size . '</td>'
										.				'<td style="width: 20%;" class="text-left hidden-xs">'
										.					'<span title="' . htmlspecialchars( $row->get( 'date' ) ) . '">'
										.						cbFormatDate( $row->get( 'date' ), true, (int) $params->get( 'tab_files_items_time_display', 0 ), $params->get( 'tab_files_items_date_format', 'M j, Y' ), $params->get( 'tab_files_items_time_format', ' g:h A' ) )
										.					'</span>'
										.				'</td>';

			if ( $cbModerator || $profileOwner ) {
				$menuItems				=	'<ul class="galleryItemsMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">'
										.		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'edit', 'type' => 'files', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

				if ( ( $row->get( 'published' ) == -1 ) && $plugin->params->get( 'files_item_approval', 0 ) ) {
					if ( $cbModerator ) {
						$menuItems		.=		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'publish', 'type' => 'files', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
					}
				} elseif ( $row->get( 'published' ) > 0 ) {
					$menuItems			.=		'<li class="galleryItemsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this File?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'items', 'func' => 'unpublish', 'type' => 'files', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
				} else {
					$menuItems			.=		'<li class="galleryItemsMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'items', 'func' => 'publish', 'type' => 'files', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
				}

				$menuItems				.=		'<li class="galleryItemsMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this File?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'items', 'func' => 'delete', 'type' => 'files', 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>'
										.	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return					.=				'<td style="width: 1%;" class="text-right">'
										.					'<div class="galleryItemsMenu btn-group">'
										.						'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.					'</div>'
										.				'</td>';
			} else{
				$return					.=				'<td style="width: 1%;"></td>';
			}

			$return						.=			'</tr>';
		} else {
			$return						.=			'<tr>'
										.				'<td colspan="6" class="text-left">';

			if ( $searching ) {
				$return					.=					CBTxt::T( 'No file search results found.' );
			} else {
				if ( $folder ) {
					$return				.=					CBTxt::T( 'This folder has no files.' );
				} else {
					if ( $viewer->get( 'id' ) == $user->get( 'id' ) ) {
						$return			.=					CBTxt::T( 'You have no files.' );
					} else {
						$return			.=					CBTxt::T( 'This user has no files.' );
					}
				}
			}

			$return						.=				'</td>'
										.			'</tr>';
		}

		$return							.=		'</tbody>';

		if ( $params->get( ( $folder ? 'tab_files_folder_items_paging' : 'tab_files_items_paging' ), 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=		'<tfoot>'
										.			'<tr>'
										.				'<td colspan="6" class="galleryItemsPaging text-center">'
										.					$pageNav->getListLinks()
										.				'</td>'
										.			'</tr>'
										.		'</tfoot>';
		}

		$return							.=	'</table>'
										.	$pageNav->getLimitBox( false );

		return $return;
	}
Esempio n. 22
0
	/**
	 * @param cbgalleryFolderTable[] $rows
	 * @param cbPageNav              $pageNav
	 * @param int                    $uncategorized
	 * @param string                 $type
	 * @param UserTable              $viewer
	 * @param UserTable              $user
	 * @param TabTable               $tab
	 * @param cbTabHandler           $plugin
	 * @return string
	 */
	static public function showFolders( $rows, $pageNav, $uncategorized, $type, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_PLUGINS->trigger( 'gallery_onBeforeDisplayFolders', array( &$rows, $pageNav, $uncategorized, $type, $viewer, $user, $tab, $plugin ) );

		switch( $type ) {
			case 'photos':
				$galleryType			=	CBTxt::T( 'Photos' );
				break;
			case 'files':
				$galleryType			=	CBTxt::T( 'Files' );
				break;
			case 'videos':
				$galleryType			=	CBTxt::T( 'Videos' );
				break;
			case 'music':
				$galleryType			=	CBTxt::T( 'Music' );
				break;
			default:
				$galleryType			=	CBTxt::T( 'Items' );
				break;
		}

		switch( $type ) {
			case 'photos':
			case 'videos':
			case 'music':
				$typeTranslated			=	CBTxt::T( 'Album' );
				break;
			default:
				$typeTranslated			=	CBTxt::T( 'Folder' );
				break;
		}

		/** @var Registry $params */
		$params							=	$tab->params;
		$profileOwner					=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator					=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();

		$return							=			'<div class="' . htmlspecialchars( $type ) . 'FoldersContainer" style="margin-bottom: 10px;">';

		if ( $uncategorized ) {
			switch( $type ) {
				case 'photos':
					$count				=	CBTxt::T( 'FOLDER_PHOTOS_COUNT', '%%COUNT%% Photo|%%COUNT%% Photos', array( '%%COUNT%%' => $uncategorized ) );
					break;
				case 'files':
					$count				=	CBTxt::T( 'FOLDER_FILES_COUNT', '%%COUNT%% File|%%COUNT%% Files', array( '%%COUNT%%' => $uncategorized ) );
					break;
				case 'videos':
					$count				=	CBTxt::T( 'FOLDER_VIDEOS_COUNT', '%%COUNT%% Video|%%COUNT%% Videos', array( '%%COUNT%%' => $uncategorized ) );
					break;
				case 'music':
					$count				=	CBTxt::T( 'FOLDER_MUSIC_COUNT', '%%COUNT%% Music|%%COUNT%% Music', array( '%%COUNT%%' => $uncategorized ) );
					break;
				default:
					$count				=	CBTxt::T( 'FOLDER_ITEM_COUNT', '%%COUNT%% Item|%%COUNT%% Items', array( '%%COUNT%%' => $uncategorized ) );
					break;
			}

			$return						.=		'<div class="galleryContainer img-thumbnail">'
										.			'<div class="galleryContainerInner" style="height: 100px; width: 100px;">'
										.				'<div class="galleryContainerTop" style="height: 60px">'
										.					'<div class="galleryContainerContent">'
										.						( $uncategorized ? '<span class="galleryFoldersNotEmpty fa fa-folder-open-o"></span>' : '<span class="galleryFoldersEmpty fa fa-folder-o"></span>' )
										.					'</div>'
										.				'</div>'
										.				'<div class="galleryContainerBottom" style="height: 40px">'
										.					'<div class="galleryContainerContent">'
										.						'<div class="galleryContainerContentRow text-nowrap text-overflow small">'
										.							'<strong>'
										.								'<a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'folders', 'func' => 'show', 'type' => $type, 'id' => 0, 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '">'
										.									CBTxt::T( 'Uncategorized' )
										.								'</a>'
										.							'</strong>'
										.						'</div>'
										.						'<div class="galleryContainerContentRow text-nowrap text-overflow small">' . $count . '</div>'
										.					'</div>'
										.				'</div>'
										.			'</div>'
										.		'</div>';
		}

		if ( $rows ) foreach ( $rows as $row ) {
			$return						.=		'<div class="galleryContainer img-thumbnail">';

			if ( $cbModerator || $profileOwner ) {
				$menuItems				=	'<ul class="galleryFoldersMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">'
										.		'<li class="galleryFoldersMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'folders', 'func' => 'edit', 'type' => $type, 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

				if ( ( $row->get( 'published' ) == -1 ) && $plugin->params->get( $type . '_folder_approval', 0 ) ) {
					if ( $cbModerator ) {
						$menuItems		.=		'<li class="galleryFoldersMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'folders', 'func' => 'publish', 'type' => $type, 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
					}
				} elseif ( $row->get( 'published' ) > 0 ) {
					$menuItems			.=		'<li class="galleryFoldersMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'FOLDER_UNPUBLISH_TYPE', 'Are you sure you want to unpublish this [type]?', array( '[type]' => $typeTranslated ) ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'folders', 'func' => 'unpublish', 'type' => $type, 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
				} else {
					$menuItems			.=		'<li class="galleryFoldersMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'folders', 'func' => 'publish', 'type' => $type, 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
				}

				$menuItems				.=		'<li class="galleryFoldersMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'FOLDER_DELETE_TYPE', 'Are you sure you want to delete this [folder_type] and all its [item_type]?', array( '[folder_type]' => $typeTranslated, '[item_type]' => $galleryType ) ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'folders', 'func' => 'delete', 'type' => $type, 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>'
										.	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return					.=			'<div class="galleryContainerMenu">'
										.				'<div class="galleryFoldersMenu btn-group">'
										.					'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.				'</div>'
										.			'</div>';
			}

			$title						=	( $row->get( 'title' ) ? htmlspecialchars( $row->get( 'title' ) ) : cbFormatDate( $row->get( 'date' ), true, (int) $params->get( 'tab_' . $type . '_folders_time_display', 0 ), $params->get( 'tab_' . $type . '_folders_date_format', 'M j, Y' ), $params->get( 'tab_' . $type . '_folders_time_format', ' g:h A' ) ) );

			switch( $type ) {
				case 'photos':
					$count				=	CBTxt::T( 'FOLDER_PHOTOS_COUNT', '%%COUNT%% Photo|%%COUNT%% Photos', array( '%%COUNT%%' => $row->countItems() ) );
					break;
				case 'files':
					$count				=	CBTxt::T( 'FOLDER_FILES_COUNT', '%%COUNT%% File|%%COUNT%% Files', array( '%%COUNT%%' => $row->countItems() ) );
					break;
				case 'videos':
					$count				=	CBTxt::T( 'FOLDER_VIDEOS_COUNT', '%%COUNT%% Video|%%COUNT%% Video', array( '%%COUNT%%' => $row->countItems() ) );
					break;
				case 'music':
					$count				=	CBTxt::T( 'FOLDER_MUSIC_COUNT', '%%COUNT%% Music|%%COUNT%% Music', array( '%%COUNT%%' => $row->countItems() ) );
					break;
				default:
					$count				=	CBTxt::T( 'FOLDER_ITEM_COUNT', '%%COUNT%% Item|%%COUNT%% Items', array( '%%COUNT%%' => $row->countItems() ) );
					break;
			}

			$return						.=			'<div class="galleryContainerInner" style="height: 100px; width: 100px;">'
										.				'<div class="galleryContainerTop" style="height: 60px">'
										.					'<div class="galleryContainerContent">'
										.						( $row->countItems() ? '<span class="galleryFoldersNotEmpty fa fa-folder-open-o"></span>' : '<span class="galleryFoldersEmpty fa fa-folder-o"></span>' )
										.					'</div>'
										.				'</div>'
										.				'<div class="galleryContainerBottom" style="height: 40px">'
										.					'<div class="galleryContainerContent">'
										.						'<div class="galleryContainerContentRow text-nowrap text-overflow small">'
										.							'<strong>'
										.								'<a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'folders', 'func' => 'show', 'type' => $type, 'id' => (int) $row->get( 'id' ), 'user' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '" title="' . htmlspecialchars( $row->get( 'date' ) ) . '">'
										.									$title
										.								'</a>'
										.							'</strong>'
										.						'</div>'
										.						'<div class="galleryContainerContentRow text-nowrap text-overflow small">'
										.							$count
										.							( $row->get( 'description' ) ? '<div class="galleryContainerDescription">' . cbTooltip( 1, $row->get( 'description' ), $title, 400, null, '<span class="fa fa-info-circle text-muted"></span>' ) . '</div>' : null )
										.						'</div>'
										.					'</div>'
										.				'</div>'
										.			'</div>'
										.		'</div>';
		}

		if ( $params->get( 'tab_' . $type . '_folders_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=		'<div class="galleryFoldersPaging text-center">'
										.			$pageNav->getListLinks()
										.		'</div>';
		}

		$return							.=	'</div>'
										.	$pageNav->getLimitBox( false );

		return $return;
	}
Esempio n. 23
0
	/**
	 * Renders the Articles tab
	 *
	 * @param  Table[]      $rows       Articles to render
	 * @param  cbPageNav    $pageNav    Pagination
	 * @param  boolean      $searching  Currently searching
	 * @param  string[]     $input      HTML of input elements
	 * @param  UserTable    $viewer     Viewing user
	 * @param  UserTable    $user       Viewed user
	 * @param  stdClass     $model      The model reference
	 * @param  TabTable     $tab        Current Tab
	 * @param  PluginTable  $plugin     Current Plugin
	 * @return string                   HTML
	 */
	static public function showPreparatyTab( $rows, $pageNav, $searching, $input, $viewer, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $tab, /** @noinspection PhpUnusedParameterInspection */ $plugin )
	{
		global $_CB_framework, $_LANG;
                
                $app =& JFactory::getApplication();
                $menu       = $app->getMenu();
                $active = $menu->getActive();
                $Itemid = $active->id;
                
		$tabPaging				=	$tab->params->get( 'tab_paging', 1 );
		$canSearch				=	( $tab->params->get( 'tab_search', 1 ) && ( $searching || $pageNav->total ) );
                $canCreate					=	false;
		$profileOwner				=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator				=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();
		//$canPublish					=	( $cbModerator || ( $profileOwner && ( ! $plugin->params->get( 'hangout_approval', 0 ) ) ) );

		if ( $profileOwner ) {
			if ( $cbModerator ) {
				$canCreate			=	true;
			} elseif ( $user->get( 'id' ) && Application::User( (int) $viewer->get( 'id' ) )->canViewAccessLevel( (int) $plugin->params->get( 'hangout_create_access', 2 ) ) ) {
				if ( ( ! $blogLimit ) || ( $blogLimit && ( $pageNav->total < $blogLimit ) ) ) {
					$canCreate		=	true;
				}
			}
		}
                
		$return					=	'<div class="articlesTab">'
								.		'<form action="' . $_CB_framework->userProfileUrl( $user->id, true, $tab->tabid ) . '" method="post" name="articleForm" id="articleForm" class="articleForm">';
                
                if ( $canCreate ) {
				$return				.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
									.					'<button type="button" onclick="location.href=\'' . ($_CB_framework->getCfg( 'live_site' ).'/index.php?option=com_flexicontent&view=item&typeid=2&task=add&Itemid='.$Itemid) . '\';" class="blogsButton blogsButtonNew btn btn-success"><span class="fa fa-plus-circle"></span> ' . $_LANG['New Preparat'] . '</button>'
									.				'</div>';
			}
                        
		if ( $canSearch ) {
			$return				.=			'<div class="articlesHeader row" style="margin-bottom: 10px;">'
								.				'<div class="col-sm-offset-8 col-sm-4 text-right">'
								.					'<div class="input-group">'
								.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
								.						$input['search']
								.					'</div>'
								.				'</div>'
								.			'</div>';
		}

		$return					.=			'<table class="articlesContainer table table-hover table-responsive">'
								.				'<thead>'
								.					'<tr>'
								.						'<th style="width: 50%;" class="text-left">' . $_LANG['Preparat'] . '</th>'
								.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Category' ) . '</th>'
								.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Created' ) . '</th>'
                                                                .                                               '<th style="width: 1%;" class="text-left hidden-xs"></th>'
								.					'</tr>'
								.				'</thead>'
								.				'<tbody>';
                
		
               $attribs = '';
			$image = FLEXI_J16GE ?
				JHTML::image(FLEXI_ICONPATH.'edit.png', JText::_( 'FLEXI_EDIT' ), $attribs) :
				JHTML::_('image.site', 'edit.png', FLEXI_ICONPATH, NULL, NULL, JText::_( 'FLEXI_EDIT' ), $attribs) ;
                
		if ( $rows ) foreach ( $rows as $row ) {
                    $item_url = cbpreparatyModel::getUrl( $row, true, 'article' , $Itemid);
                    //$item_url_edit = cbpreparatyModel::getUrl( $row, true, 'article' , 445);
                    $link = $_CB_framework->getCfg( 'live_site' ). '/' .$item_url  .(strstr($item_url, '?') ? '&' : '?').  'task=edit';
                    $edit_row	= $profileOwner ? '<a href="'.$link.'">'.$image.'</a>&nbsp;' : '';
                
			$return				.=					'<tr>'
								.						'<td style="width: 50%;" class="text-left">'.$edit_row.'<a href="' . cbpreparatyModel::getUrl( $row, true, 'article' ) . '">' . $row->get( 'title' ) . '</a></td>'
								.						'<td style="width: 25%;" class="text-left hidden-xs">' . ( $row->get( 'category' ) ? $row->get( 'category_title' ) : CBTxt::T( 'None' ) ) . '</td>'
								.						'<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate( $row->get( 'created' ) ) . '</td>';
                        if ( ( $cbModerator || $profileOwner )    ) {
				$menuItems			=	'<ul class="invitesMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';


				
					$menuItems		.=		'<li class="invitesMenuItem"><a href="' . $link . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>'
									.		'<li class="invitesMenuItem"><a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Drug?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'preparaty', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; }"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				

				$menuItems			.=	'</ul>';

				$menuAttr			=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return				.=						'<td style="width: 1%;" class="text-right">'
									.							'<div class="invitesMenu btn-group">'
									.								'<button type="button"' . $menuAttr . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
									.							'</div>'
									.						'</td>';
			} else{
				$return				.=						'<td style="width: 1%;" class="text-right"></td>';
			}
                        
			$return				.= 					'</tr>';
		} else {
			$return				.=					'<tr>'
								.						'<td colspan="3" class="text-left">';

			if ( $searching ) {
				$return			.=							$_LANG['No preparaty search results found.'];
			} else {
				if ( $viewer->id == $user->id ) {
					$return		.=							$_LANG['You have no preparaty.'];
				} else {
					$return		.=							$_LANG['This user has no preparaty.'];
				}
			}

			$return				.=						'</td>'
								.					'</tr>';
		}

		$return					.=				'</tbody>';

		if ( $tabPaging && ( $pageNav->total > $pageNav->limit ) ) {
			$return				.=				'<tfoot>'
								.					'<tr>'
								.						'<td colspan="3" class="text-center">'
								.							$pageNav->getListLinks()
								.						'</td>'
								.					'</tr>'
								.				'</tfoot>';
		}

		$return					.=			'</table>'
								.			$pageNav->getLimitBox( false )
								.		'</form>'
								.	'</div>';

		return $return;
	}
Esempio n. 24
0
	/**
	 * render frontend forums
	 *
	 * @param PostTableInterface[] $rows
	 * @param cbPageNav             $pageNav
	 * @param bool                  $searching
	 * @param array                 $input
	 * @param array                 $counters
	 * @param GroupTable            $group
	 * @param UserTable             $user
	 * @param ModelInterface        $model
	 * @return string
	 */
	static function showForums( $rows, $pageNav, $searching, $input, &$counters, $group, $user, $model )
	{
		global $_CB_framework, $_PLUGINS;

		$counters[]							=	'<span class="gjGroupForumsIcon fa-before fa-comments-o"> ' . CBTxt::T( 'GROUP_FORUMS_COUNT', '%%COUNT%% Discussion|%%COUNT%% Discussions', array( '%%COUNT%%' => (int) $pageNav->total ) ) . '</span>';

		$canCreate							=	CBGroupJive::canCreateGroupContent( $user, $group, 'forums' );
		$canSearch							=	( $model->params->get( 'groups_forums_search', 1 ) && ( $searching || $pageNav->total ) );
		$return								=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayForums', array( &$return, &$rows, $group, $user ) );

		$return								.=	'<div class="gjGroupForums">'
											.		'<form action="' . $_CB_framework->pluginClassUrl( $model->gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '" method="post" name="gjGroupForumsForm" id="gjGroupForumsForm" class="gjGroupForumsForm">';

		if ( $canCreate || $canSearch ) {
			$return							.=			'<div class="gjHeader gjGroupForumsHeader row">';

			if ( $canCreate ) {
				$return						.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
											.					'<button type="button" onclick="window.location.href=\'' . $model->getCategory( (int) $group->params()->get( 'forum_id' ) )->url() . '\';" class="gjButton gjButtonNewPost btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New Post' ) . '</button>'
											.				'</div>';
			}

			if ( $canSearch ) {
				$return						.=				'<div class="' . ( ! $canCreate ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
											.					'<div class="input-group">'
											.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
											.						$input['search']
											.					'</div>'
											.				'</div>';
			}

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

		$return								.=			'<table class="gjGroupForumsRows table table-hover table-responsive">'
											.				'<thead>'
											.					'<tr>'
											.						'<th style="width: 50%;" class="text-left">' . CBTxt::T( 'Subject' ) . '</th>'
											.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'By' ) . '</th>'
											.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Date' ) . '</th>'
											.					'</tr>'
											.				'</thead>'
											.				'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			$return							.=					'<tr>'
											.						'<td style="width: 50%;" class="text-left"><a href="' . $row->url() . '">' . $row->get( 'subject' ) . '</a></td>'
											.						'<td style="width: 25%;" class="text-left hidden-xs">' . CBuser::getInstance( (int) $row->get( 'user_id' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</td>'
											.						'<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate( $row->get( 'date' ) ) . '</td>'
											.					'</tr>';
		} else {
			$return							.=					'<tr>'
											.						'<td colspan="3" class="text-left">';

			if ( $searching ) {
				$return						.=							CBTxt::T( 'No group post search results found.' );
			} else {
				$return						.=							CBTxt::T( 'This group currently has no posts.' );
			}

			$return							.=						'</td>'
											.					'</tr>';
		}

		$return								.=				'</tbody>';

		if ( $model->params->get( 'groups_forums_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return							.=				'<tfoot>'
											.					'<tr>'
											.						'<td colspan="3" class="gjGroupForumsPaging text-center">'
											.							$pageNav->getListLinks()
											.						'</td>'
											.					'</tr>'
											.				'</tfoot>';
		}

		$return								.=			'</table>'
											.			$pageNav->getLimitBox( false )
											.		'</form>'
											.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayForums', array( &$return, $rows, $group, $user ) );

		return $return;
	}
Esempio n. 25
0
	/**
	 * @param cbantispamLogTable[] $rows
	 * @param cbPageNav            $pageNav
	 * @param UserTable            $viewer
	 * @param UserTable            $user
	 * @param TabTable             $tab
	 * @param cbTabHandler         $plugin
	 * @return string
	 */
	static public function showLogs( $rows, $pageNav, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework;

		/** @var Registry $params */
		$params						=	$tab->params;

		$return						=	'<div class="logsTab">'
									.		'<form action="' . $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), true, (int) $tab->get( 'tabid' ) ) . '" method="post" name="logsForm" id="logsForm" class="logsForm">'
									.			'<table class="logsContainer table table-hover table-responsive">'
									.				'<thead>'
									.					'<tr>'
									.						'<th class="text-left">' . CBTxt::T( 'IP Address' ) . '</th>'
									.						'<th style="width: 25%;" class="text-left hidden-xs">' . CBTxt::T( 'Date' ) . '</th>'
									.						'<th style="width: 10%;" class="text-center hidden-xs">' . CBTxt::T( 'Count' ) . '</th>'
									.						'<th style="width: 1%;" class="text-right">&nbsp;</th>'
									.					'</tr>'
									.				'</thead>'
									.				'<tbody>';

		if ( $rows ) foreach ( $rows as $row ) {
			$return					.=					'<tr>'
									.						'<td class="text-left">' . $row->get( 'ip_address' ) . '</td>'
									.						'<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate( $row->get( 'date' ), false ) . '</td>'
									.						'<td style="width: 10%;" class="text-center hidden-xs">' . $row->get( 'count' ) . '</td>'
									.						'<td style="width: 1%;" class="text-right">'
									.							'<a href="javascript: void(0);" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Log?' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'log', 'func' => 'delete', 'id' => (int) $row->get( 'id' ), 'usr' => (int) $user->get( 'id' ), 'tab' => (int) $tab->get( 'tabid' ) ) ) . '\'; }" title="' . htmlspecialchars( CBTxt::T( 'Delete' ) ) . '"><span class="fa fa-trash-o"></span></a>'
									.						'</td>'
									.					'</tr>';
		} else {
			$return					.=					'<tr>'
									.						'<td colspan="3" class="text-left">';

			if ( $viewer->get( 'id' ) == $user->get( 'id' ) ) {
				$return				.=							CBTxt::T( 'You have no logs.' );
			} else {
				$return				.=							CBTxt::T( 'This user has no logs.' );
			}

			$return					.=						'</td>'
									.					'</tr>';
		}

		$return						.=				'</tbody>';

		if ( $params->get( 'tab_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return					.=				'<tfoot>'
									.					'<tr>'
									.						'<td colspan="3" class="text-center">'
									.							$pageNav->getListLinks()
									.						'</td>'
									.					'</tr>'
									.				'</tfoot>';
		}

		$return						.=			'</table>'
									.			$pageNav->getLimitBox( false )
									.		'</form>'
									.	'</div>';

		return $return;
	}
Esempio n. 26
0
	/**
	 * render frontend photos
	 *
	 * @param PhotoTable[]    $rows
	 * @param cbPageNav       $pageNav
	 * @param bool            $searching
	 * @param array           $input
	 * @param array           $counters
	 * @param GroupTable      $group
	 * @param UserTable       $user
	 * @param cbgjPhotoPlugin $plugin
	 * @return string
	 */
	static function showPhotos( $rows, $pageNav, $searching, $input, &$counters, $group, $user, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$js								=	"$( document ).on( 'click', '.gjGroupPhotoImageScrollLeftIcon', function() {"
										.		"var previous = $( this ).data( 'previous-photo' );"
										.		"if ( previous ) {"
										.			"$( previous ).find( '.gjGroupPhotoItem' ).click();"
										.		"}"
										.	"});"
										.	"$( document ).on( 'click', '.gjGroupPhotoImageScrollRightIcon', function() {"
										.		"var next = $( this ).data( 'next-photo' );"
										.		"if ( next ) {"
										.			"$( next ).find( '.gjGroupPhotoItem' ).click();"
										.		"}"
										.	"});";

		$_CB_framework->outputCbJQuery( $js );

		$counters[]						=	'<span class="gjGroupPhotoIcon fa-before fa-photo"> ' . CBTxt::T( 'GROUP_PHOTOS_COUNT', '%%COUNT%% Photo|%%COUNT%% Photos', array( '%%COUNT%%' => (int) $pageNav->total ) ) . '</span>';

		initToolTip();

		$isModerator					=	CBGroupJive::isModerator( $user->get( 'id' ) );
		$isOwner						=	( $user->get( 'id' ) == $group->get( 'user_id' ) );
		$userStatus						=	CBGroupJive::getGroupStatus( $user, $group );
		$canCreate						=	CBGroupJive::canCreateGroupContent( $user, $group, 'photo' );
		$canSearch						=	( $plugin->params->get( 'groups_photo_search', 1 ) && ( $searching || $pageNav->total ) );
		$return							=	null;

		$_PLUGINS->trigger( 'gj_onBeforeDisplayPhotos', array( &$return, &$rows, $group, $user ) );

		$return							.=	'<div class="gjGroupPhoto">'
										.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->_gjPlugin->element, true, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $group->get( 'id' ) ) ) . '" method="post" name="gjGroupPhotoForm" id="gjGroupPhotoForm" class="gjGroupPhotoForm">';

		if ( $canCreate || $canSearch ) {
			$return						.=			'<div class="gjHeader gjGroupPhotoHeader row">';

			if ( $canCreate ) {
				$return					.=				'<div class="' . ( ! $canSearch ? 'col-sm-12' : 'col-sm-8' ) . ' text-left">'
										.					'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'photo', 'func' => 'new', 'group' => (int) $group->get( 'id' ) ) ) . '\';" class="gjButton gjButtonNewPhoto btn btn-success"><span class="fa fa-plus-circle"></span> ' . CBTxt::T( 'New Photo' ) . '</button>'
										.				'</div>';
			}

			if ( $canSearch ) {
				$return					.=				'<div class="' . ( ! $canCreate ? 'col-sm-offset-8 ' : null ) . 'col-sm-4 text-right">'
										.					'<div class="input-group">'
										.						'<span class="input-group-addon"><span class="fa fa-search"></span></span>'
										.						$input['search']
										.					'</div>'
										.				'</div>';
			}

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

		$i								=	0;

		$return							.=			'<div class="gjGroupPhotoRows">';

		if ( $rows ) foreach ( $rows as $row ) {
			$rowCounters				=	array();
			$content					=	null;
			$menu						=	array();

			$_PLUGINS->trigger( 'gj_onDisplayPhoto', array( &$row, &$rowCounters, &$content, &$menu, $group, $user ) );

			$title						=	( $row->get( 'title' ) ? htmlspecialchars( $row->get( 'title' ) ) : $row->name() );
			$item						=	$title;
			$logo						=	null;

			if ( $row->exists() ) {
				$showPath				=	$_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'photo', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ), 'raw', 0, true );

				$image					=	'<div class="gjGroupPhotoImageContainer">';

				if ( $pageNav->total > 1 ) {
					$image				.=		'<div class="gjGroupPhotoImageScrollLeft">'
										.			'<table>'
										.				'<tr>'
										.					'<td>'
										.						'<span class="gjGroupPhotoImageScrollLeftIcon fa fa-chevron-left" data-previous-photo=".gjGroupPhotoRow' . ( $i == 0 ? ( count( $rows ) - 1 ) : ( $i - 1 ) ) . '"></span>'
										.					'</td>'
										.				'</tr>'
										.			'</table>'
										.		'</div>';
				}

				$image					.=		'<div style="background-image: url(' . $showPath . ')" class="gjGroupPhotoImage"></div>'
										.		'<div class="gjGroupPhotoImageInfo">'
										.			'<div class="gjGroupPhotoImageInfoRow">'
										.				'<div class="gjGroupPhotoImageInfoTitle col-sm-8 text-left"><strong>' . $title . '</strong></div>'
										.				'<div class="gjGroupPhotoImageInfoOriginal col-sm-4 text-right">'
										.					'<a href="' . $showPath . '" target="_blank">'
										.						CBTxt::T( 'Original' )
										.					'</a>'
										.				'</div>'
										.			'</div>';

				if ( $row->get( 'description' ) ) {
					$image				.=			'<div class="gjGroupPhotoImageInfoRow">'
										.				'<div class="gjGroupPhotoImageInfoDescription col-sm-8 text-left">' . htmlspecialchars( $row->get( 'description' ) ) . '</div>'
										.				'<div class="gjGroupPhotoImageInfoDownload col-sm-4 text-right">'
										.				'</div>'
										.			'</div>';
				}

				$image					.=		'</div>';

				if ( $pageNav->total > 1 ) {
					$image				.=		'<div class="gjGroupPhotoImageScrollRight">'
										.			'<table>'
										.				'<tr>'
										.					'<td>'
										.						'<span class="gjGroupPhotoImageScrollRightIcon fa fa-chevron-right" data-next-photo=".gjGroupPhotoRow' . ( isset( $rows[$i+1] ) ? ( $i + 1 ) : 0 ) . '"></span>'
										.					'</td>'
										.				'</tr>'
										.			'</table>'
										.		'</div>';
				}

				$image					.=	'</div>';

				$item					=	cbTooltip( 1, $image, null, array( '80%', '80%' ), null, $item, 'javascript: void(0);', 'class="gjGroupPhotoItem" data-cbtooltip-modal="true" data-cbtooltip-open-solo="document" data-cbtooltip-classes="gjGroupPhotoImageModal"' );
				$logo					=	cbTooltip( 1, $image, null, array( '80%', '80%' ), null, '<div style="background-image: url(' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'photo', 'func' => 'preview', 'id' => (int) $row->get( 'id' ) ), 'raw', 0, true ) . ')" class="gjGroupPhotoLogo"></div>', 'javascript: void(0);', 'class="gjGroupPhotoLogo" data-cbtooltip-modal="true" data-cbtooltip-open-solo="document" data-cbtooltip-classes="gjGroupPhotoImageModal"' );
			}

			$return						.=				'<div class="gjGroupPhotoRow gjGroupPhotoRow' . $i . ' gjContainerBox img-thumbnail">'
										.					'<div class="gjContainerBoxHeader">'
										.						'<div class="gjContainerBoxCanvas">'
										.							$logo
										.						'</div>'
										.					'</div>'
										.					'<div class="gjContainerBoxBody text-left">'
										.						'<div class="gjContainerBoxTitle">'
										.							$item
										.						'</div>'
										.						'<div class="gjContainerBoxCounters text-muted small row">'
										.							'<div class="gjGroupPhotoPublisher gjContainerBoxCounter col-sm-6">' . CBuser::getInstance( (int) $row->get( 'user_id' ), false )->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</div>'
										.							'<div class="gjContainerBoxCounter col-sm-6 text-right">'
										.								'<span title="' . htmlspecialchars( $row->get( 'date' ) ) . '">'
										.									cbFormatDate( $row->get( 'date' ), true, false, CBTxt::T( 'GROUP_PHOTO_DATE_FORMAT', 'M j, Y' ) )
										.								'</span>'
										.							'</div>'
										.							( $rowCounters ? '<div class="gjContainerBoxCounter col-sm-6">' . implode( '</div><div class="gjContainerBoxCounter col-sm-6">', $rowCounters ) . '</div>' : null )
										.						'</div>'
										.						( $content ? '<div class="gjContainerBoxContent">' . $content . '</div>' : null )
										.						( $row->get( 'description' ) ? '<div class="gjContainerBoxDescription">' . cbTooltip( 1, $row->get( 'description' ), $row->name(), 400, null, '<span class="fa fa-info-circle text-muted"></span>' ) . '</div>' : null );

			if ( ( $isModerator || $isOwner || ( $userStatus >= 2 ) ) && ( $row->get( 'published' ) == -1 ) && ( $group->params()->get( 'photo', 1 ) == 2 ) ) {
				$return					.=						'<div class="gjContainerBoxButton text-right">'
										.							'<button type="button" onclick="window.location.href=\'' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'photo', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '\';" class="gjButton gjButtonApprove btn btn-xs btn-success">' . CBTxt::T( 'Approve' ) . '</button>'
										.						'</div>';
			}

			$return						.=					'</div>';

			if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) || $menu ) {
				$menuItems				=	'<ul class="gjPhotoMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) ) {
					$menuItems			.=		'<li class="gjPhotoMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'photo', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';

					if ( ( $row->get( 'published' ) == -1 ) && ( $group->params()->get( 'photo', 1 ) == 2 ) ) {
						if ( $isModerator || $isOwner || ( $userStatus >= 2 ) ) {
							$menuItems	.=		'<li class="gjPhotoMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'photo', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
						}
					} elseif ( $row->get( 'published' ) == 1 ) {
						$menuItems		.=		'<li class="gjPhotoMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to unpublish this Photo?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'photo', 'func' => 'unpublish', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
					} else {
						$menuItems		.=		'<li class="gjPhotoMenuItem"><a href="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'photo', 'func' => 'publish', 'id' => (int) $row->get( 'id' ) ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
					}
				}

				if ( $menu ) {
					$menuItems			.=		'<li class="gjPhotoMenuItem">' . implode( '</li><li class="gjPhotoMenuItem">', $menu ) . '</li>';
				}

				if ( $isModerator || $isOwner || ( $user->get( 'id' ) == $row->get( 'user_id' ) ) || ( $userStatus >= 2 ) ) {
					$menuItems			.=		'<li class="gjPhotoMenuItem"><a href="javascript: void(0);" onclick="cbjQuery.cbconfirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to delete this Photo?' ) ) . '\' ).done( function() { window.location.href = \'' . $_CB_framework->pluginClassUrl( $plugin->element, false, array( 'action' => 'photo', 'func' => 'delete', 'id' => (int) $row->get( 'id' ) ) ) . '\'; })"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				}

				$menuItems				.=	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="btn btn-default btn-xs" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle"' );

				$return					.=					'<div class="gjContainerBoxMenu">'
										.						'<div class="gjPhotoMenu btn-group">'
										.							'<button type="button" ' . trim( $menuAttr ) . '><span class="fa fa-cog"></span> <span class="fa fa-caret-down"></span></button>'
										.						'</div>'
										.					'</div>';
			}

			$return						.=				'</div>';

			$i++;
		} else {
			if ( $searching ) {
				$return					.=				CBTxt::T( 'No group photo search results found.' );
			} else {
				$return					.=				CBTxt::T( 'This group currently has no photos.' );
			}
		}

		$return							.=			'</div>';

		if ( $plugin->params->get( 'groups_photo_paging', 1 ) && ( $pageNav->total > $pageNav->limit ) ) {
			$return						.=			'<div class="gjGroupPhotoPaging text-center">'
										.				$pageNav->getListLinks()
										.			'</div>';
		}

		$return							.=			$pageNav->getLimitBox( false )
										.		'</form>'
										.	'</div>';

		$_PLUGINS->trigger( 'gj_onAfterDisplayPhotos', array( &$return, $rows, $group, $user ) );

		return $return;
	}