Example #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;
 }
Example #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;
 }
 /**
  * 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;
 }
Example #4
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;
	}
Example #5
0
	function createPageNvigator( $total, $limitstart, $limit ) {
		cbimport( 'cb.pagination' );
		$this->pageNav = new cbPageNav( $total, $limitstart, $limit, array( &$this, 'fieldName' ), $this );
		$this->pageNav->setControllerView( $this );
	}
 /**
  * @param ListTable     $row
  * @param UserTable[]   $users
  * @param array         $columns
  * @param FieldTable[]  $fields
  * @param array         $input
  * @param string|null   $search
  * @param int           $searchmode
  * @param cbPageNav     $pageNav
  * @param UserTable     $myUser
  * @param FieldTable[]  $searchableFields
  * @param stdClass      $searchValues
  * @param cbTabs        $tabs
  * @param string|null   $errorMsg
  * @param bool          $listAll
  * @param int           $random
  */
 static function usersList(&$row, &$users, &$columns, &$fields, &$input, $search, $searchmode, $pageNav, &$myUser, &$searchableFields, &$searchValues, &$tabs, $errorMsg, $listAll = true, $random = 0)
 {
     global $_CB_framework, $_PLUGINS, $_POST, $_GET, $_REQUEST;
     $params = new Registry($row->params);
     // The Itemid for this userlist; kept for trigger B/C:
     $Itemid = getCBprofileItemid(null, 'userslist', '&listid=' . (int) $row->listid);
     $results = $_PLUGINS->trigger('onBeforeDisplayUsersList', array(&$row, &$users, &$columns, &$fields, &$input, $row->listid, &$search, &$Itemid, 1));
     // $uid = 1
     // Plugin content divided by location:
     $pluginAdditions = array('search', 'header', 'footer');
     $pluginAdditions['search'] = array();
     $pluginAdditions['header'] = array();
     $pluginAdditions['footer'] = array();
     if (is_array($results) && count($results) > 0) {
         foreach ($results as $res) {
             if (is_array($res)) {
                 foreach ($res as $k => $v) {
                     $pluginAdditions[$k][] = $v;
                 }
             }
         }
     }
     outputCbTemplate(1);
     outputCbJs();
     cbValidator::loadValidation();
     $cbTemplate = HTML_comprofiler::_cbTemplateLoad();
     if ($errorMsg) {
         $_CB_framework->enqueueMessage($errorMsg, 'error');
     }
     // Page title and pathway:
     $listTitleHtml = cbReplaceVars($row->title, $myUser);
     $listTitleNoHtml = strip_tags(cbReplaceVars($row->title, $myUser, false, false));
     $listDescription = cbReplaceVars($row->description, $myUser);
     $_CB_framework->setPageTitle($listTitleNoHtml);
     $_CB_framework->appendPathWay($listTitleHtml);
     // Add row click JS:
     if ($params->get('allow_profilelink', 1)) {
         $allowProfileLink = true;
     } else {
         $allowProfileLink = false;
     }
     $js = "var cbUserURLs = [];";
     if (is_array($users) && $allowProfileLink) {
         // Ensures the jQuery array index matches the same as HTML ID index (e.g. cbU0, cbU1):
         $index = 0;
         foreach ($users as $user) {
             $js .= "cbUserURLs[{$index}] = '" . addslashes($_CB_framework->userProfileUrl((int) $user->id, false)) . "';";
             $index++;
         }
     }
     $js .= "\$( '.cbUserListRow' ).click( function( e ) {" . "if ( ! ( \$( e.target ).is( 'a' ) || ( \$( e.target ).is( 'img' ) && \$( e.target ).parent().is( 'a' ) ) || \$( e.target ).hasClass( 'cbClicksInside' ) || ( \$( e.target ).parents( '.cbClicksInside' ).length > 0 ) || ( \$( this ).attr( 'id' ) == '' ) ) ) {" . "var index = \$( this ).prop( 'id' ).substr( 3 );";
     if ($allowProfileLink) {
         $js .= "window.location = cbUserURLs[index];";
     }
     $js .= "return false;" . "}" . "});";
     $_CB_framework->outputCbJQuery($js);
     // Search JS:
     $isSearching = $search !== null;
     if ($isSearching && $params->get('list_search_collapse', 0) && !in_array($searchmode, array(1, 2))) {
         $isCollapsed = true;
     } else {
         $isCollapsed = false;
     }
     if (count($searchableFields) > 0) {
         cbUsersList::outputAdvancedSearchJs($isCollapsed ? null : $search);
     }
     // Base form URL:
     $baseUrl = $_CB_framework->rawViewUrl('userslist', true, array('listid' => (int) $row->listid, 'searchmode' => 0), 'html', 0, '&listid=' . (int) $row->listid);
     // Searching attributes:
     $showAll = $search === null;
     $criteriaTitle = cbReplaceVars(CBTxt::Th('UE_SEARCH_CRITERIA', 'Search criteria'), $myUser);
     if ($searchmode == 0 || $searchmode == 1 && count(get_object_vars($searchValues)) || $searchmode == 2) {
         $resultsTitle = cbReplaceVars(CBTxt::Th('UE_SEARCH_RESULTS', 'Search results'), $myUser);
     } else {
         $resultsTitle = null;
     }
     // Search content:
     $searchTabContent = $tabs->getSearchableContents($searchableFields, $myUser, $searchValues, $params->get('list_compare_types', 0));
     if (count($pluginAdditions['search'])) {
         $searchTabContent .= '<div class="cbUserListSearchPlugins">' . '<div>' . implode('</div><div>', $pluginAdditions['search']) . '</div>' . '</div>';
     }
     // User row content:
     $tableContent =& HTML_comprofiler::_getListTableContent($users, $columns, $fields);
     if ($params->get('list_grid_layout', 0)) {
         $layout = 'grid';
     } else {
         $layout = 'list';
     }
     $gridHeight = (int) $params->get('list_grid_height', 200);
     $gridWidth = (int) $params->get('list_grid_width', 200);
     if ($params->get('list_show_selector', 1)) {
         $listSelector = true;
     } else {
         $listSelector = false;
     }
     $pageClass = $_CB_framework->getMenuPageClass();
     $return = '<div class="cbUsersList cb_template cb_template_' . selectTemplate('dir') . ($pageClass ? ' ' . htmlspecialchars($pageClass) : null) . '">' . '<form action="' . $_CB_framework->rawViewUrl('userslist', true, array('listid' => (int) $row->listid), 'html', 0, '&listid=' . (int) $row->listid) . '" method="get" id="adminForm" name="adminForm" class="cb_form form-auto cbValidation">' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="userslist" />' . (!$listSelector ? '<input type="hidden" name="listid" value="' . (int) $row->listid . '" />' : null) . '<input type="hidden" name="Itemid" value="' . (int) $Itemid . '" />' . '<input type="hidden" name="limitstart" value="0" />' . '<input type="hidden" name="searchmode" value="' . (int) $searchmode . '" />' . '<input type="hidden" name="search" value="" />' . ($random ? '<input type="hidden" name="rand" value="' . (int) $random . '" />' : null) . cbGetSpoofInputTag('userslist') . $_PLUGINS->callTemplate($cbTemplate, 'List', 'drawListHead', array(&$input, $row->listid, $pageNav->total, $showAll, $searchTabContent, $isSearching, $baseUrl, $listTitleHtml, $listDescription, $criteriaTitle, $resultsTitle, $listAll, $listSelector, $isCollapsed, $searchmode), 'html');
     if ($searchmode == 0 || $searchmode == 1 && count(get_object_vars($searchValues)) || $searchmode == 2) {
         $canPage = $params->get('list_paging', 1) && ($pageNav->limitstart != 0 || $pageNav->limit <= $pageNav->total);
         if (count($pluginAdditions['header'])) {
             $return .= '<div class="cbUserListHeader">' . '<div>' . implode('</div><div>', $pluginAdditions['header']) . '</div>' . '</div>';
         }
         $return .= $_PLUGINS->callTemplate($cbTemplate, 'List', 'drawListBody', array(&$users, &$columns, &$tableContent, $row->listid, $allowProfileLink, $layout, $gridHeight, $gridWidth, $searchmode), 'html');
         if ($canPage) {
             $return .= '<div class="cbUserListPagination cbUserListPaginationBottom text-center">' . $pageNav->getListLinks() . '</div>';
         }
         if (count($pluginAdditions['footer'])) {
             $return .= '<div class="cbUserListFooter">' . '<div>' . implode('</div><div>', $pluginAdditions['footer']) . '</div>' . '</div>';
         }
     }
     $return .= '</form>' . '</div>' . cbPoweredBy();
     echo $return;
     $_CB_framework->setMenuMeta();
 }
Example #7
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;
	}
Example #8
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;
	}
Example #9
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;
	}
Example #10
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;
	}
	/**
	 * prepare frontend events render
	 *
	 * @param string     $return
	 * @param GroupTable $group
	 * @param string     $users
	 * @param string     $invites
	 * @param array      $counters
	 * @param array      $buttons
	 * @param array      $menu
	 * @param cbTabs     $tabs
	 * @param UserTable  $user
	 * @return array|null
	 */
	public function showEvents( &$return, &$group, &$users, &$invites, &$counters, &$buttons, &$menu, &$tabs, $user )
	{
		global $_CB_framework, $_CB_database;

		CBGroupJive::getTemplate( 'events', true, true, $this->element );

		$canModerate			=	( CBGroupJive::isModerator( $user->get( 'id' ) ) || ( CBGroupJive::getGroupStatus( $user, $group ) >= 2 ) );
		$limit					=	(int) $this->params->get( 'groups_events_limit', 15 );
		$limitstart				=	$_CB_framework->getUserStateFromRequest( 'gj_group_events_limitstart{com_comprofiler}', 'gj_group_events_limitstart' );
		$search					=	$_CB_framework->getUserStateFromRequest( 'gj_group_events_search{com_comprofiler}', 'gj_group_events_search' );
		$where					=	null;

		if ( $search && $this->params->get( 'groups_events_search', 1 ) ) {
			$where				.=	"\n AND ( e." . $_CB_database->NameQuote( 'title' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR e." . $_CB_database->NameQuote( 'event' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR e." . $_CB_database->NameQuote( 'address' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR e." . $_CB_database->NameQuote( 'location' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . " )";
		}

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

		$query					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events' ) . " AS e"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = e.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE e." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $canModerate ) {
			$query				.=	"\n AND ( e." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR e.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
		}

		$query					.=	$where;
		$_CB_database->setQuery( $query );
		$total					=	(int) $_CB_database->loadResult();

		if ( ( ! $total ) && ( ! $searching ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'events' ) ) ) {
			return null;
		}

		$pageNav				=	new cbPageNav( $total, $limitstart, $limit );

		$pageNav->setInputNamePrefix( 'gj_group_events_' );

		$guests					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events_attendance' ) . " AS ea"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS eacb"
								.	' ON eacb.' . $_CB_database->NameQuote( 'id' ) . ' = ea.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS eaj"
								.	' ON eaj.' . $_CB_database->NameQuote( 'id' ) . ' = eacb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE ea." . $_CB_database->NameQuote( 'event' ) . " = e." . $_CB_database->NameQuote( 'id' )
								.	"\n AND eacb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND eacb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND eaj." . $_CB_database->NameQuote( 'block' ) . " = 0";

		$now					=	Application::Database()->getUtcDateTime();

		$query					=	'SELECT e.*'
								.	', TIMESTAMPDIFF( SECOND, ' . $_CB_database->Quote( $now ) . ',e.' . $_CB_database->NameQuote( 'start' ) . ' ) AS _start_ordering'
								.	', TIMESTAMPDIFF( SECOND, ' . $_CB_database->Quote( $now ) . ', e.' . $_CB_database->NameQuote( 'end' ) . ' ) AS _end_ordering'
								.	', a.' . $_CB_database->NameQuote( 'id' ) . ' AS _attending'
								.	', ( ' . $guests . ' ) AS _guests'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events' ) . " AS e"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = e.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_plugin_events_attendance' ) . " AS a"
								.	' ON a.' . $_CB_database->NameQuote( 'user_id' ) . ' = ' . (int) $user->get( 'id' )
								.	' AND a.' . $_CB_database->NameQuote( 'event' ) . ' = e.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE e." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $canModerate ) {
			$query				.=	"\n AND ( e." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR e.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
		}

		$query					.=	$where
								.	"\n ORDER BY IF( _start_ordering < 0 AND _end_ordering > 0, 1, IF( _start_ordering > 0, 2, 3 ) ), ABS( _start_ordering )";
		if ( $this->params->get( 'groups_events_paging', 1 ) ) {
			$_CB_database->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
		} else {
			$_CB_database->setQuery( $query );
		}
		$rows					=	$_CB_database->loadObjectList( null, '\CB\Plugin\GroupJiveEvents\Table\EventTable', array( $_CB_database ) );

		$input					=	array();

		$input['search']		=	'<input type="text" name="gj_group_events_search" value="' . htmlspecialchars( $search ) . '" onchange="document.gjGroupEventsForm.submit();" placeholder="' . htmlspecialchars( CBTxt::T( 'Search Events...' ) ) . '" class="form-control" />';

		CBGroupJiveEvents::getEvent( $rows );
		CBGroupJive::preFetchUsers( $rows );

		$group->set( '_events', $pageNav->total );

		return array(	'id'		=>	'events',
						'title'		=>	CBTxt::T( 'Events' ),
						'content'	=>	HTML_groupjiveEvents::showEvents( $rows, $pageNav, $searching, $input, $counters, $group, $user, $this )
					);
	}
	/**
	 * prepare frontend photos render
	 *
	 * @param string     $return
	 * @param GroupTable $group
	 * @param string     $users
	 * @param string     $invites
	 * @param array      $counters
	 * @param array      $buttons
	 * @param array      $menu
	 * @param cbTabs     $tabs
	 * @param UserTable  $user
	 * @return array|null
	 */
	public function showPhotos( &$return, &$group, &$users, &$invites, &$counters, &$buttons, &$menu, &$tabs, $user )
	{
		global $_CB_framework, $_CB_database;

		CBGroupJive::getTemplate( 'photos', true, true, $this->element );

		$canModerate			=	( CBGroupJive::isModerator( $user->get( 'id' ) ) || ( CBGroupJive::getGroupStatus( $user, $group ) >= 2 ) );
		$limit					=	(int) $this->params->get( 'groups_photo_limit', 15 );
		$limitstart				=	$_CB_framework->getUserStateFromRequest( 'gj_group_photo_limitstart{com_comprofiler}', 'gj_group_photo_limitstart' );
		$search					=	$_CB_framework->getUserStateFromRequest( 'gj_group_photo_search{com_comprofiler}', 'gj_group_photo_search' );
		$where					=	null;

		if ( $search && $this->params->get( 'groups_photo_search', 1 ) ) {
			$where				.=	"\n AND ( p." . $_CB_database->NameQuote( 'title' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR p." . $_CB_database->NameQuote( 'filename' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR p." . $_CB_database->NameQuote( 'description' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . " )";
		}

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

		$query					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_photo' ) . " AS p"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = p.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE p." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $canModerate ) {
			$query				.=	"\n AND ( p." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR p.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
		}

		$query					.=	$where;
		$_CB_database->setQuery( $query );
		$total					=	(int) $_CB_database->loadResult();

		if ( ( ! $total ) && ( ! $searching ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'photo' ) ) ) {
			return null;
		}

		$pageNav				=	new cbPageNav( $total, $limitstart, $limit );

		$pageNav->setInputNamePrefix( 'gj_group_photo_' );

		switch( (int) $this->params->get( 'groups_photo_orderby', 2 ) ) {
			case 1:
				$orderBy		=	'p.' . $_CB_database->NameQuote( 'date' ) . ' ASC';
				break;
			case 3:
				$orderBy		=	'p.' . $_CB_database->NameQuote( 'filename' ) . ' ASC';
				break;
			case 4:
				$orderBy		=	'p.' . $_CB_database->NameQuote( 'filename' ) . ' DESC';
				break;
			case 2:
			default:
				$orderBy		=	'p.' . $_CB_database->NameQuote( 'date' ) . ' DESC';
				break;
		}

		$query					=	'SELECT p.*'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_photo' ) . " AS p"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = p.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE p." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $canModerate ) {
			$query				.=	"\n AND ( p." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR p.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
		}

		$query					.=	$where
								.	"\n ORDER BY " . $orderBy;
		if ( $this->params->get( 'groups_photo_paging', 1 ) ) {
			$_CB_database->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
		} else {
			$_CB_database->setQuery( $query );
		}
		$rows					=	$_CB_database->loadObjectList( null, '\CB\Plugin\GroupJivePhoto\Table\PhotoTable', array( $_CB_database ) );

		$input					=	array();

		$input['search']		=	'<input type="text" name="gj_group_photo_search" value="' . htmlspecialchars( $search ) . '" onchange="document.gjGroupPhotoForm.submit();" placeholder="' . htmlspecialchars( CBTxt::T( 'Search Photos...' ) ) . '" class="form-control" />';

		CBGroupJivePhoto::getPhoto( $rows );
		CBGroupJive::preFetchUsers( $rows );

		$group->set( '_photos', $pageNav->total );

		return array(	'id'		=>	'photo',
						'title'		=>	CBTxt::T( 'Photos' ),
						'content'	=>	HTML_groupjivePhoto::showPhotos( $rows, $pageNav, $searching, $input, $counters, $group, $user, $this )
					);
	}
Example #13
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;
	}
	/**
	 * prepare frontend wall replies render
	 *
	 * @param WallTable  $reply
	 * @param GroupTable $group
	 * @param UserTable  $user
	 * @return array|null
	 */
	public function showReplies( $reply, $group, $user )
	{
		global $_CB_framework, $_CB_database;

		CBGroupJive::getTemplate( 'replies', true, true, $this->element );

		$canModerate			=	( CBGroupJive::isModerator( $user->get( 'id' ) ) || ( CBGroupJive::getGroupStatus( $user, $group ) >= 2 ) );
		$limit					=	(int) $this->params->get( 'groups_wall_replies_limit', 15 );
		$limitstart				=	$_CB_framework->getUserStateFromRequest( 'gj_group_wall_replies_limitstart{com_comprofiler}', 'gj_group_wall_replies_limitstart' );

		if ( $reply->get( '_replies' ) ) {
			$query				=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_wall' ) . " AS r"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = r.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE r." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND r." . $_CB_database->NameQuote( 'reply' ) . " = " . (int) $reply->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

			if ( ! $canModerate ) {
				$query			.=	"\n AND ( r." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR r.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
			}

			$_CB_database->setQuery( $query );
			$total				=	(int) $_CB_database->loadResult();
		} else {
			$total				=	0;
		}

		if ( ( ! $total ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'wall' ) ) ) {
			return null;
		}

		$pageNav				=	new cbPageNav( $total, $limitstart, $limit );

		$pageNav->setClasses( array( 'cbPaginationLinks' => 'cbPaginationLinks pagination pagination-sm' ) );
		$pageNav->setInputNamePrefix( 'gj_group_wall_replies_' );

		if ( $reply->get( '_replies' ) ) {
			switch( (int) $this->params->get( 'groups_wall_replies_orderby', 2 ) ) {
				case 1:
					$orderBy	=	'r.' . $_CB_database->NameQuote( 'date' ) . ' ASC';
					break;
				case 2:
				default:
					$orderBy	=	'r.' . $_CB_database->NameQuote( 'date' ) . ' DESC';
					break;
			}

			$query				=	'SELECT r.*'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_wall' ) . " AS r"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = r.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE r." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND r." . $_CB_database->NameQuote( 'reply' ) . " = " . (int) $reply->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

			if ( ! $canModerate ) {
				$query			.=	"\n AND ( r." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR r.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
			}

			$query				.=	"\n ORDER BY " . $orderBy;
			if ( $this->params->get( 'groups_wall_replies_paging', 1 ) ) {
				$_CB_database->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
			} else {
				$_CB_database->setQuery( $query );
			}
			$rows				=	$_CB_database->loadObjectList( null, '\CB\Plugin\GroupJiveWall\Table\WallTable', array( $_CB_database ) );

			CBGroupJiveWall::getPost( $rows );
			CBGroupJive::preFetchUsers( $rows );
		} else {
			$rows				=	array();
		}

		return HTML_groupjiveWallReplies::showReplies( $reply, $rows, $pageNav, $group, $user, $this );
	}
Example #15
0
	/**
	 * @param moscomprofilerTabs $tab
	 * @param UserTable          $user
	 * @param int                $ui
	 * @return null|string
	 */
	public function getDisplayTab( $tab, $user, $ui )
	{
		global $_CB_framework, $_CB_database,$_PLUGINS;

		$viewer					=	CBuser::getMyUserDataInstance();
                $absPath							=	$_PLUGINS->getPluginPath( $plugin );
                require $absPath . '/templates/default/tab.php';
                //cbmedizdClass::getTemplate();
		if ( $viewer->id == $user->id ) {
			outputCbJs( 1 );
			outputCbTemplate( 1 );
			cbimport( 'cb.pagination' );

			cbinvitesClass::getTemplate( 'tab' );

			$limit				=	(int) $this->params->get( 'tab_limit', 15 );
			$limitstart			=	$_CB_framework->getUserStateFromRequest( 'tab_medizd_limitstart{com_comprofiler}', 'tab_medizd_limitstart' );
			$filterSearch		=	$_CB_framework->getUserStateFromRequest( 'tab_medizd_search{com_comprofiler}', 'tab_medizd_search' );
			$where				=	null;
			$join				=	null;

			if ( isset( $filterSearch ) && ( $filterSearch != '' ) ) {
				$where			.=	"\n AND ( a." . $_CB_database->NameQuote( 'name' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false )
								.	" OR b." . $_CB_database->NameQuote( 'id' ) . " = " . $_CB_database->Quote( $filterSearch )
								.	" OR a." . $_CB_database->NameQuote( 'description' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false )
								.	" OR b." . $_CB_database->NameQuote( 'name' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false ) . " )";

				$join			.=	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS b"
								.	' ON b.' . $_CB_database->NameQuote( 'id' ) . ' = a.' . $_CB_database->NameQuote( 'user_id' );
			}

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

			$query				=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_cbmedizd' ) . " AS a"
								.	$join
								.	"\n WHERE a." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->id
								.	$where
								.	"\n ORDER BY " . $_CB_database->NameQuote( 'created' ) . " DESC";
			$_CB_database->setQuery( $query );
			$total				=	$_CB_database->loadResult();

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

			$pageNav			=	new cbPageNav( $total, $limitstart, $limit );

			$pageNav->setInputNamePrefix( 'tab_medizd_' );

			$query				=	'SELECT a.*'
								.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_cbmedizd' ) . " AS a"
								.	$join
								.	"\n WHERE a." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->id
								.	$where
								.	"\n ORDER BY " . $_CB_database->NameQuote( 'created' ) . " DESC";
			if ( $this->params->get( 'tab_paging', 1 ) ) {
				$_CB_database->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
			} else {
				$_CB_database->setQuery( $query );
			}
			$rows				=	$_CB_database->loadObjectList( null, 'cbmedizdProductTable', array( $_CB_database ) );

			$input				=	array();
			$input['search']	=	'<input type="text" name="tab_medizd_search" value="' . htmlspecialchars( $filterSearch ) . '" onchange="document.medizdForm.submit();" placeholder="' . htmlspecialchars( CBTxt::T( 'MEDPR_SEARCH_PRODUCT' ) ) . '" class="form-control" />';

			$class				=	$this->params->get( 'general_class', null );

			$return				=	'<div id="cbmedizd" class="cbmedizd' . ( $class ? ' ' . htmlspecialchars( $class ) : null ) . '">'
								.		'<div id="cbmedizdInner" class="cbmedizdInner">'
								.			HTML_cbmedizdTab::showTab( $rows, $pageNav, $searching, $input, $viewer, $user, $tab, $this )
								.		'</div>'
								.	'</div>';

			return $return;
		}

		return null;
	}
Example #16
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;
	}
Example #17
0
	/**
	 * prepare frontend tab render
	 *
	 * @param TabTable  $tab
	 * @param UserTable $user
	 * @param int       $ui
	 * @return null|string
	 */
	public function getDisplayTab( $tab, $user, $ui )
	{
		global $_CB_framework, $_CB_database;

		if ( ! ( $tab->params instanceof ParamsInterface ) ) {
			$tab->params		=	new Registry( $tab->params );
		}

		$viewer					=	CBuser::getMyUserDataInstance();
		$isModerator			=	CBGroupJive::isModerator( $viewer->get( 'id' ) );
		$isOwner				=	( $viewer->get( 'id' ) == $user->get( 'id' ) );

		CBGroupJive::getTemplate( 'tab' );

		$limit					=	(int) $tab->params->get( 'tab_limit', 30 );
		$limitstart				=	$_CB_framework->getUserStateFromRequest( 'gj_tab_limitstart{com_comprofiler}', 'gj_tab_limitstart' );
		$search					=	$_CB_framework->getUserStateFromRequest( 'gj_tab_search{com_comprofiler}', 'gj_tab_search' );
		$where					=	null;

		if ( $search && $tab->params->get( 'tab_search', 1 ) ) {
			$where				.=	"\n AND ( g." . $_CB_database->NameQuote( 'name' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR g." . $_CB_database->NameQuote( 'description' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . " )";
		}

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

		$query					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_groups' ) . " AS g";

		if ( ! $isModerator ) {
			$query				.=	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_categories' ) . " AS c"
								.	' ON c.' . $_CB_database->NameQuote( 'id' ) . ' = g.' . $_CB_database->NameQuote( 'category' );
		}

		$query					.=	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_users' ) . " AS u"
								.	' ON u.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
								.	' AND u.' . $_CB_database->NameQuote( 'user_id' ) . ' = ' . (int) $user->get( 'id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_invites' ) . " AS i"
								.	' ON i.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
								.	' AND i.' . $_CB_database->NameQuote( 'accepted' ) . ' = ' . $_CB_database->Quote( '0000-00-00 00:00:00' )
								.	' AND ( ( i.' . $_CB_database->NameQuote( 'email' ) . ' = ' . $_CB_database->Quote( $user->get( 'email' ) )
								.	' AND i.' . $_CB_database->NameQuote( 'email' ) . ' != "" )'
								.	' OR ( i.' . $_CB_database->NameQuote( 'user' ) . ' = ' . (int) $user->get( 'id' )
								.	' AND i.' . $_CB_database->NameQuote( 'user' ) . ' > 0 ) )';

		if ( $isOwner ) {
			$query				.=	"\n WHERE ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' );

			if ( ! $isModerator ) {
				$query			.=		' OR ( g.' . $_CB_database->NameQuote( 'published' ) . ' = 1'
								.		' AND ( u.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 0, 1, 2, 3 )'
								.		' OR i.' . $_CB_database->NameQuote( 'id' ) . ' IS NOT NULL ) ) )';
			} else {
				$query			.=		' OR u.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 0, 1, 2, 3 )'
								.		' OR i.' . $_CB_database->NameQuote( 'id' ) . ' IS NOT NULL )';
			}
		} else {
			$query				.=	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_users' ) . " AS mu"
								.	' ON mu.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
								.	' AND mu.' . $_CB_database->NameQuote( 'user_id' ) . ' = ' . (int) $viewer->get( 'id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_invites' ) . " AS mi"
								.	' ON mi.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
								.	' AND mi.' . $_CB_database->NameQuote( 'accepted' ) . ' = ' . $_CB_database->Quote( '0000-00-00 00:00:00' )
								.	' AND ( ( mi.' . $_CB_database->NameQuote( 'email' ) . ' = ' . $_CB_database->Quote( $viewer->get( 'email' ) )
								.	' AND mi.' . $_CB_database->NameQuote( 'email' ) . ' != "" )'
								.	' OR ( mi.' . $_CB_database->NameQuote( 'user' ) . ' = ' . (int) $viewer->get( 'id' )
								.	' AND mi.' . $_CB_database->NameQuote( 'user' ) . ' > 0 ) )'
								.	"\n WHERE ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' );

			if ( ! $isModerator ) {
				$query			.=		' OR ( g.' . $_CB_database->NameQuote( 'published' ) . ' = 1'
								.		' AND u.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 1, 2, 3 ) ) )'
								.	"\n AND ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $viewer->get( 'id' )
								.		' OR ( g.' . $_CB_database->NameQuote( 'published' ) . ' = 1'
								.		' AND ( g.' . $_CB_database->NameQuote( 'type' ) . ' IN ( 1, 2 )'
								.		' OR mu.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 0, 1, 2, 3 )'
								.		' OR mi.' . $_CB_database->NameQuote( 'id' ) . ' IS NOT NULL ) ) )';
			} else {
				$query			.=		' OR u.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 1, 2, 3 ) )';
			}
		}

		if ( ! $isModerator ) {
			$query				.=	"\n AND ( ( c." . $_CB_database->NameQuote( 'published' ) . " = 1"
								.		' AND c.' . $_CB_database->NameQuote( 'access' ) . ' IN ' . $_CB_database->safeArrayOfIntegers( CBGroupJive::getAccess( (int) $user->get( 'id' ) ) )
								.		' AND c.' . $_CB_database->NameQuote( 'access' ) . ' IN ' . $_CB_database->safeArrayOfIntegers( CBGroupJive::getAccess( (int) $viewer->get( 'id' ) ) ) . ' )'
								.		( $this->params->get( 'groups_uncategorized', 1 ) ? ' OR g.' . $_CB_database->NameQuote( 'category' ) . ' = 0 )' : ' )' );
		}

		$query					.=	$where;
		$_CB_database->setQuery( $query );
		$total					=	(int) $_CB_database->loadResult();

		if ( ( ! $total ) && ( ! $searching ) && ( ( ! $isOwner ) || ( $isOwner && ( ! CBGroupJive::canCreateGroup( $user ) ) ) ) && ( ! Application::Config()->get( 'showEmptyTabs', 1 ) ) ) {
			return null;
		}

		$pageNav				=	new cbPageNav( $total, $limitstart, $limit );

		$pageNav->setInputNamePrefix( 'gj_tab_' );

		switch( (int) $tab->params->get( 'tab_orderby', 1 ) ) {
			case 2:
				$orderBy		=	'g.' . $_CB_database->NameQuote( 'ordering' ) . ' DESC';
				break;
			case 3:
				$orderBy		=	'g.' . $_CB_database->NameQuote( 'date' ) . ' ASC';
				break;
			case 4:
				$orderBy		=	'g.' . $_CB_database->NameQuote( 'date' ) . ' DESC';
				break;
			case 5:
				$orderBy		=	'g.' . $_CB_database->NameQuote( 'name' ) . ' ASC';
				break;
			case 6:
				$orderBy		=	'g.' . $_CB_database->NameQuote( 'name' ) . ' DESC';
				break;
			case 7:
				$orderBy		=	$_CB_database->NameQuote( '_users' ) . ' ASC';
				break;
			case 8:
				$orderBy		=	$_CB_database->NameQuote( '_users' ) . ' DESC';
				break;
			case 1:
			default:
				$orderBy		=	'g.' . $_CB_database->NameQuote( 'ordering' ) . ' ASC';
				break;
		}

		$users					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_users' ) . " AS uc"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS uccb"
								.	' ON uccb.' . $_CB_database->NameQuote( 'id' ) . ' = uc.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS ucj"
								.	' ON ucj.' . $_CB_database->NameQuote( 'id' ) . ' = uccb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE uc." . $_CB_database->NameQuote( 'group' ) . " = g." . $_CB_database->NameQuote( 'id' )
								.	"\n AND uccb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND uccb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND ucj." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $isModerator ) {
			$users				.=	"\n AND ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $viewer->get( 'id' )
								.		( ! $isOwner ? ' OR mu.' . $_CB_database->NameQuote( 'status' ) . ' >= 2' : null )
								.		' OR uc.' . $_CB_database->NameQuote( 'status' ) . ' >= 1 )';
		}

		if ( ! $this->params->get( 'groups_users_owner', 1 ) ) {
			$users				.=	"\n AND uc." . $_CB_database->NameQuote( 'status' ) . " != 4";
		}

		$query					=	'SELECT g.*'
								.	', c.' . $_CB_database->NameQuote( 'name' ) . ' AS _category_name';

		if ( $isOwner ) {
			$query				.=	', u.' . $_CB_database->NameQuote( 'status' ) . ' AS _user_status'
								.	', i.' . $_CB_database->NameQuote( 'id' ) . ' AS _invite_id';
		} else {
			$query				.=	', mu.' . $_CB_database->NameQuote( 'status' ) . ' AS _user_status'
								.	', mi.' . $_CB_database->NameQuote( 'id' ) . ' AS _invite_id';
		}

		$query					.=	', ( ' . $users . ' ) AS _users'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_groups' ) . " AS g"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_categories' ) . " AS c"
								.	' ON c.' . $_CB_database->NameQuote( 'id' ) . ' = g.' . $_CB_database->NameQuote( 'category' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_users' ) . " AS u"
								.	' ON u.' . $_CB_database->NameQuote( 'user_id' ) . ' = ' . (int) $user->get( 'id' )
								.	' AND u.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_invites' ) . " AS i"
								.	' ON i.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
								.	' AND i.' . $_CB_database->NameQuote( 'accepted' ) . ' = ' . $_CB_database->Quote( '0000-00-00 00:00:00' )
								.	' AND ( ( i.' . $_CB_database->NameQuote( 'email' ) . ' = ' . $_CB_database->Quote( $user->get( 'email' ) )
								.	' AND i.' . $_CB_database->NameQuote( 'email' ) . ' != "" )'
								.	' OR ( i.' . $_CB_database->NameQuote( 'user' ) . ' = ' . (int) $user->get( 'id' )
								.	' AND i.' . $_CB_database->NameQuote( 'user' ) . ' > 0 ) )';

		if ( $isOwner ) {
			$query				.=	"\n WHERE ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' );

			if ( ! $isModerator ) {
				$query			.=		' OR ( g.' . $_CB_database->NameQuote( 'published' ) . ' = 1'
								.		' AND ( u.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 0, 1, 2, 3 )'
								.		' OR i.' . $_CB_database->NameQuote( 'id' ) . ' IS NOT NULL ) ) )';
			} else {
				$query			.=		' OR u.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 0, 1, 2, 3 )'
								.		' OR i.' . $_CB_database->NameQuote( 'id' ) . ' IS NOT NULL )';
			}
		} else {
			$query				.=	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_users' ) . " AS mu"
								.	' ON mu.' . $_CB_database->NameQuote( 'user_id' ) . ' = ' . (int) $viewer->get( 'id' )
								.	' AND mu.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_invites' ) . " AS mi"
								.	' ON mi.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
								.	' AND mi.' . $_CB_database->NameQuote( 'accepted' ) . ' = ' . $_CB_database->Quote( '0000-00-00 00:00:00' )
								.	' AND ( ( mi.' . $_CB_database->NameQuote( 'email' ) . ' = ' . $_CB_database->Quote( $viewer->get( 'email' ) )
								.	' AND mi.' . $_CB_database->NameQuote( 'email' ) . ' != "" )'
								.	' OR ( mi.' . $_CB_database->NameQuote( 'user' ) . ' = ' . (int) $viewer->get( 'id' )
								.	' AND mi.' . $_CB_database->NameQuote( 'user' ) . ' > 0 ) )'
								.	"\n WHERE ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' );

			if ( ! $isModerator ) {
				$query			.=		' OR ( g.' . $_CB_database->NameQuote( 'published' ) . ' = 1'
								.		' AND u.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 1, 2, 3 ) ) )'
								.	"\n AND ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $viewer->get( 'id' )
								.		' OR ( g.' . $_CB_database->NameQuote( 'published' ) . ' = 1'
								.		' AND ( g.' . $_CB_database->NameQuote( 'type' ) . ' IN ( 1, 2 )'
								.		' OR mu.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 0, 1, 2, 3 )'
								.		' OR mi.' . $_CB_database->NameQuote( 'id' ) . ' IS NOT NULL ) ) )';
			} else {
				$query			.=		' OR u.' . $_CB_database->NameQuote( 'status' ) . ' IN ( 1, 2, 3 ) )';
			}
		}

		if ( ! $isModerator ) {
			$query				.=	"\n AND ( ( c." . $_CB_database->NameQuote( 'published' ) . " = 1"
								.		' AND c.' . $_CB_database->NameQuote( 'access' ) . ' IN ' . $_CB_database->safeArrayOfIntegers( CBGroupJive::getAccess( (int) $user->get( 'id' ) ) )
								.		' AND c.' . $_CB_database->NameQuote( 'access' ) . ' IN ' . $_CB_database->safeArrayOfIntegers( CBGroupJive::getAccess( (int) $viewer->get( 'id' ) ) ) . ' )'
								.		( $this->params->get( 'groups_uncategorized', 1 ) ? ' OR g.' . $_CB_database->NameQuote( 'category' ) . ' = 0 )' : ' )' );
		}

		$query					.=	$where
								.	"\n ORDER BY " . $orderBy;
		if ( $tab->params->get( 'tab_paging', 1 ) ) {
			$_CB_database->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
		} else {
			$_CB_database->setQuery( $query );
		}
		$rows					=	$_CB_database->loadObjectList( null, '\CB\Plugin\GroupJive\Table\GroupTable', array( $_CB_database ) );

		$input['search']		=	'<input type="text" name="gj_tab_search" value="' . htmlspecialchars( $search ) . '" onchange="document.gjTabForm.submit();" placeholder="' . htmlspecialchars( CBTxt::T( 'Search Groups...' ) ) . '" class="form-control" />';

		CBGroupJive::getGroup( $rows );
		CBGroupJive::preFetchUsers( $rows );

		$class					=	$this->params->get( 'general_class', null );

		$return					=	'<div class="cbGroupJive' . ( $class ? ' ' . htmlspecialchars( $class ) : null ) . '">'
								.		'<div class="cbGroupJiveInner">'
								.			HTML_groupjiveTab::showTab( $rows, $pageNav, $searching, $input, $viewer, $user, $tab, $this )
								.		'</div>'
								.	'</div>';

		return $return;
	}
Example #18
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;
	}
Example #19
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;
	}
Example #20
0
	/**
	 * @param UserTable  $user
	 * @param GroupTable $group
	 * @param array      $counters
	 * @return array|null
	 */
	public function getTopics( $user, &$group, &$counters )
	{
		global $_CB_framework, $_CB_database;

		$categoryId					=	(int) $group->params()->get( 'forum_id' );

		if ( ( ! $categoryId ) || ( ! $group->params()->get( 'forums', 1 ) ) || ( $group->category()->get( 'id' ) && ( ! $group->category()->params()->get( 'forums', 1 ) ) ) ) {
			return null;
		}

		CBGroupJive::getTemplate( 'forums', true, true, $this->plugin->element );

		$limit						=	(int) $this->params->get( 'groups_forums_limit', 15 );
		$limitstart					=	$_CB_framework->getUserStateFromRequest( 'gj_group_forums_limitstart{com_comprofiler}', 'gj_group_forums_limitstart' );
		$search						=	$_CB_framework->getUserStateFromRequest( 'gj_group_forums_search{com_comprofiler}', 'gj_group_forums_search' );
		$where						=	null;

		if ( $search && $this->params->get( 'groups_forums_search', 1 ) ) {
			$where					.=	'( m.' . $_CB_database->NameQuote( 'subject' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
									.	' OR t.' . $_CB_database->NameQuote( 'message' ) . ' LIKE ' . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . ' )';
		}

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

		$params						=	array(	'starttime' => -1,
												'where' => $where
											);

		$posts						=	\KunenaForumMessageHelper::getLatestMessages( $categoryId, 0, 0, $params );
		$total						=	array_shift( $posts );

		if ( ( ! $total ) && ( ! $searching ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'forums' ) ) ) {
			return null;
		}

		$pageNav					=	new \cbPageNav( $total, $limitstart, $limit );

		$pageNav->setInputNamePrefix( 'gj_group_forums_' );

		switch( (int) $this->params->get( 'groups_forums_orderby', 2 ) ) {
			case 1:
				$params['orderby']	=	'm.' . $_CB_database->NameQuote( 'time' ) . ' ASC';
				break;
		}

		if ( $this->params->get( 'groups_forums_paging', 1 ) ) {
			$posts					=	\KunenaForumMessageHelper::getLatestMessages( $categoryId, (int) $pageNav->limitstart, (int) $pageNav->limit, $params );
			$posts					=	array_pop( $posts );
		} else {
			$posts					=	array_pop( $posts );
		}

		$rows						=	array();

		/** @var \KunenaForumMessage[] $posts */
		foreach ( $posts as $post ) {
			$row					=	new PostTable();

			$row->post( $post );

			$rows[]					=	$row;
		}

		$input						=	array();

		$input['search']			=	'<input type="text" name="gj_group_forums_search" value="' . htmlspecialchars( $search ) . '" onchange="document.gjGroupForumsForm.submit();" placeholder="' . htmlspecialchars( CBTxt::T( 'Search Posts...' ) ) . '" class="form-control" />';

		CBGroupJive::preFetchUsers( $rows );

		$group->set( '_forums', $pageNav->total );

		return array(	'id'		=>	'forums',
						'title'		=>	CBTxt::T( 'Forums' ),
						'content'	=>	\HTML_groupjiveForums::showForums( $rows, $pageNav, $searching, $input, $counters, $group, $user, $this )
					);
	}
Example #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;
	}
	/**
	 * prepare frontend group invites render
	 *
	 * @param GroupTable $group
	 * @param UserTable  $user
	 * @return mixed
	 */
	private function showGroupInvites( &$group, $user )
	{
		global $_CB_framework, $_CB_database;

		if ( ! CBGroupJive::isModerator( $user->get( 'id' ) ) ) {
			if ( ( ! $this->params->get( 'groups_invites_display', 1 ) ) && ( $group->get( 'type' ) != 3 ) ) {
				return null;
			} elseif ( ( CBGroupJive::getGroupStatus( $user, $group ) < 1 ) ) {
				return null;
			}
		}

		CBGroupJive::getTemplate( 'invites' );

		$limit					=	(int) $this->params->get( 'groups_invites_limit', 15 );
		$limitstart				=	$_CB_framework->getUserStateFromRequest( 'gj_group_invites_limitstart{com_comprofiler}', 'gj_group_invites_limitstart' );
		$search					=	$_CB_framework->getUserStateFromRequest( 'gj_group_invites_search{com_comprofiler}', 'gj_group_invites_search' );
		$where					=	null;

		if ( $search && $this->params->get( 'groups_invites_search', 0 ) ) {
			$where				.=	"\n AND ( i." . $_CB_database->NameQuote( 'email' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR j." . $_CB_database->NameQuote( 'name' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR j." . $_CB_database->NameQuote( 'username' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . " )";
		}

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

		$query					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_invites' ) . " AS i"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = i.' . $_CB_database->NameQuote( 'user' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE i." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.	"\n AND i." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND ( ( cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	' AND cb.' . $_CB_database->NameQuote( 'confirmed' ) . ' = 1'
								.	' AND j.' . $_CB_database->NameQuote( 'block' ) . ' = 0 )'
								.	' OR i.' . $_CB_database->NameQuote( 'user' ) . ' = 0 )'
								.	$where;
		$_CB_database->setQuery( $query );
		$total					=	(int) $_CB_database->loadResult();

		if ( ( ! $total ) && ( ! $searching ) && ( ! CBGroupJive::canCreateGroupContent( $user, $group, 'invites' ) ) ) {
			return null;
		}

		$pageNav				=	new cbPageNav( $total, $limitstart, $limit );

		$pageNav->setInputNamePrefix( 'gj_group_invites_' );

		switch( (int) $this->params->get( 'groups_invites_orderby', 1 ) ) {
			case 1:
				$orderBy		=	'i.' . $_CB_database->NameQuote( 'invited' ) . ' ASC';
				break;
			case 3:
				$orderBy		=	'i.' . $_CB_database->NameQuote( 'accepted' ) . ' ASC';
				break;
			case 4:
				$orderBy		=	'i.' . $_CB_database->NameQuote( 'accepted' ) . ' DESC';
				break;
			case 2:
			default:
				$orderBy		=	'i.' . $_CB_database->NameQuote( 'invited' ) . ' DESC';
				break;
		}

		$query					=	'SELECT i.*'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_invites' ) . " AS i"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = i.' . $_CB_database->NameQuote( 'user' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE i." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.	"\n AND i." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $group->get( 'id' )
								.	"\n AND ( ( cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	' AND cb.' . $_CB_database->NameQuote( 'confirmed' ) . ' = 1'
								.	' AND j.' . $_CB_database->NameQuote( 'block' ) . ' = 0 )'
								.	' OR i.' . $_CB_database->NameQuote( 'user' ) . ' = 0 )'
								.	"\n ORDER BY " . $orderBy;
		if ( $this->params->get( 'groups_invites_paging', 1 ) ) {
			$_CB_database->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
		} else {
			$_CB_database->setQuery( $query );
		}
		$rows					=	$_CB_database->loadObjectList( null, '\CB\Plugin\GroupJive\Table\InviteTable', array( $_CB_database ) );

		$input['search']		=	'<input type="text" name="gj_group_invites_search" value="' . htmlspecialchars( $search ) . '" onchange="document.gjGroupInvitesForm.submit();" placeholder="' . htmlspecialchars( CBTxt::T( 'Search Invites...' ) ) . '" class="form-control" />';

		CBGroupJive::preFetchUsers( $rows );

		$group->set( '_invites', $pageNav->total );

		return HTML_groupjiveInvites::showInvites( $rows, $pageNav, $searching, $input, $group, $user, $this );
	}
Example #23
0
	/**
	 * @param string    $type
	 * @param TabTable  $tab
	 * @param UserTable $user
	 * @param UserTable $viewer
	 * @param bool|int  $start
	 * @return null|string
	 */
	private function getItems( $type, $tab, $user, $viewer, $start = false )
	{
		global $_CB_framework, $_CB_database, $_PLUGINS;

		/** @var Registry $params */
		$params							=	$tab->params;
		$tabPrefix						=	'tab_' . (int) $tab->get( 'tabid' ) . '_';
		$publishedOnly					=	( ( $viewer->get( 'id' ) != $user->get( 'id' ) ) && ( ! Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator() ) );
		$input							=	array();

		// Items:
		$typePrefix						=	$tabPrefix . $type . '_items_';
		$limit							=	(int) $params->get( 'tab_' . $type . '_items_limit', 15 );
		$limitstart						=	( $start !== false ? (int) $start : $_CB_framework->getUserStateFromRequest( $typePrefix . 'limitstart{com_comprofiler}', $typePrefix . 'limitstart' ) );
		$search							=	$_CB_framework->getUserStateFromRequest( $typePrefix . 'search{com_comprofiler}', $typePrefix . 'search' );
		$where							=	null;

		if ( $search && $params->get( 'tab_' . $type . '_items_search', 1 ) ) {
			$where						.=	"\n AND ( " . $_CB_database->NameQuote( 'value' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
										.	" OR " . $_CB_database->NameQuote( 'title' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
										.	" OR " . $_CB_database->NameQuote( 'description' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . " )";
		}

		$itemsSearching					=	( $where ? true : false );

		$query							=	'SELECT COUNT(*)'
										.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_gallery_items' )
										.	"\n WHERE " . $_CB_database->NameQuote( 'type' ) . " = " . $_CB_database->Quote( $type )
										.	"\n AND " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
										.	"\n AND " . $_CB_database->NameQuote( 'folder' ) . " = 0"
										.	( $publishedOnly ? "\n AND " . $_CB_database->NameQuote( 'published' ) . " = 1" : null )
										.	$where;
		$_CB_database->setQuery( $query );
		$total							=	(int) $_CB_database->loadResult();

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

		$itemsPageNav					=	new cbPageNav( $total, $limitstart, $limit );

		$itemsPageNav->setInputNamePrefix( $typePrefix );

		$orderBy						=	$params->get( 'tab_' . $type . '_items_orderby', 'date_desc' );

		if ( ! $orderBy ) {
			$orderBy					=	'date_desc';
		}

		$orderBy						=	explode( '_', $orderBy );

		$query							=	'SELECT *'
										.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_gallery_items' )
										.	"\n WHERE " . $_CB_database->NameQuote( 'type' ) . " = " . $_CB_database->Quote( $type )
										.	"\n AND " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
										.	"\n AND " . $_CB_database->NameQuote( 'folder' ) . " = 0"
										.	( $publishedOnly ? "\n AND " . $_CB_database->NameQuote( 'published' ) . " = 1" : null )
										.	$where
										.	"\n ORDER BY " . $_CB_database->NameQuote( $orderBy[0] ) . " " . strtoupper( $orderBy[1] );
		if ( $params->get( 'tab_' . $type . '_items_paging', 1 ) ) {
			$_CB_database->setQuery( $query, $itemsPageNav->limitstart, $itemsPageNav->limit );
		} else {
			$_CB_database->setQuery( $query );
		}
		$items							=	$_CB_database->loadObjectList( null, 'cbgalleryItemTable', array( $_CB_database ) );
		$itemsCount						=	count( $items );

		$_PLUGINS->trigger( 'gallery_onLoadItems', array( &$items, $user ) );

		if ( $itemsCount && ( ! count( $items ) ) ) {
			return $this->getItems( $type, $tab, $user, $viewer, ( $limitstart + $limit ) );
		}

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

		$input['search_items']			=	'<input type="text" name="' . htmlspecialchars( $typePrefix . 'search' ) . '" value="' . htmlspecialchars( $search ) . '" onchange="document.' . htmlspecialchars( $type ) . 'ItemsForm.submit();" placeholder="' . htmlspecialchars( $placeholder ) . '" class="form-control" />';

		return array( $items, $itemsPageNav, $itemsSearching, $input );
	}
 /**
  * Writes the html for the pages counter, eg, Results 1-10 of x
  *
  * @deprecated 2.0 use cbPageNav
  *
  * @param  int  $limitstart  The record number to start dislpaying from
  * @param  int  $limit       Number of rows to display per page
  * @param  int  $total       Total number of rows
  */
 function writePagesCounter($limitstart, $limit, $total)
 {
     cbimport('cb.pagination');
     $pageNav = new cbPageNav($total, $limitstart, $limit);
     echo $pageNav->getPagesCounter();
 }
Example #25
0
	/**
	 * Generates the HTML to display the user profile tab
	 *
	 * @param  \CB\Database\Table\TabTable   $tab       the tab database entry
	 * @param  \CB\Database\Table\UserTable  $user      the user being displayed
	 * @param  int                           $ui        1 for front-end, 2 for back-end
	 * @return string|boolean                           Either string HTML for tab content, or false if ErrorMSG generated
	 */
	public function getDisplayTab( $tab, $user, $ui )
	{
		global $_CB_framework, $_CB_database, $_LANG;

		outputCbJs( 1 );
		outputCbTemplate( 1 );
		cbimport( 'cb.pagination' );
                
                

		$plugin				=	cbhangoutClass::getPlugin();
		$model				=	cbhangoutClass::getModel();
		$viewer				=	CBuser::getMyUserDataInstance();

		cbhangoutClass::getTemplate( 'tab' );

		$limit				=	(int) $this->params->get( 'tab_limit', 15 );
		$limitstart			=	$_CB_framework->getUserStateFromRequest( 'tab_hangout_limitstart{com_comprofiler}', 'tab_hangout_limitstart' );
		$filterSearch		=	$_CB_framework->getUserStateFromRequest( 'tab_hangout_search{com_comprofiler}', 'tab_hangout_search' );
		$where				=	null;

		if ( isset( $filterSearch ) && ( $filterSearch != '' ) ) {
			if ( $model->type != 2 ) {
				$where		.=	"\n AND ( a." . $_CB_database->NameQuote( 'title' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false )
							.	" OR a." . $_CB_database->NameQuote( 'introtext' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false )
							.	" OR a." . $_CB_database->NameQuote( 'fulltext' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false ) . " )";
			} else {
				$where		.=	"\n AND ( a." . $_CB_database->NameQuote( 'title' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false )
							.	" OR a." . $_CB_database->NameQuote( 'hangout_intro' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false )
							.	" OR a." . $_CB_database->NameQuote( 'hangout_full' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $filterSearch, true ) . '%', false ) . " )";
			}
		}

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

		$total				=	cbhangoutModel::getHangoutTotal( $where, $viewer, $user, $plugin );

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

		$pageNav			=	new cbPageNav( $total, $limitstart, $limit );

		$pageNav->setInputNamePrefix( 'tab_hangout_' );

		$rows				=	cbhangoutModel::getHangout( ( $this->params->get( 'tab_paging', 1 ) ? array( $pageNav->limitstart, $pageNav->limit ) : null ), $where, $viewer, $user, $plugin );

		$input				=	array();
		$input['search']	=	'<input type="text" name="tab_hangout_search" value="' . htmlspecialchars( $filterSearch ) . '" onchange="document.hangoutForm.submit();" placeholder="' . htmlspecialchars( CBTxt::T( 'Поиск...' ) ) . '" class="form-control" />';

		$tab->params		=	$this->params;

		$class				=	$plugin->params->get( 'general_class', null );

		$return				=	'<div id="cbHangout" class="cbBlogs' . ( $class ? ' ' . htmlspecialchars( $class ) : null ) . '">'
							.		'<div id="cbHangoutsInner" class="cbBlogsInner">'
							.			HTML_cbhangoutTab::showHangoutTab( $rows, $pageNav, $searching, $input, $viewer, $user, $model, $tab, $plugin )
							.		'</div>'
							.	'</div>';

		return $return;
	}
Example #26
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;
	}
Example #27
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;
 }
	/**
	 * prepare frontend event attending render
	 *
	 * @param int       $id
	 * @param UserTable $user
	 */
	private function showEventAttending( $id, $user )
	{
		global $_CB_framework, $_CB_database;

		$event			=	CBGroupJiveEvents::getEvent( (int) $id );
		$returnUrl		=	$_CB_framework->pluginClassUrl( $this->_gjPlugin->element, false, array( 'action' => 'groups', 'func' => 'show', 'id' => (int) $event->get( 'group' ) ) );

		if ( $event->get( 'id' ) ) {
			if ( ! CBGroupJive::canAccessGroup( $event->group(), $user ) ) {
				cbRedirect( $returnUrl, CBTxt::T( 'Group does not exist.' ), 'error' );
			} elseif ( ! CBGroupJive::isModerator( $user->get( 'id' ) ) ) {
				if ( ( $event->get( 'published' ) != 1 ) && ( CBGroupJive::getGroupStatus( $user, $event->group() ) < 2 ) ) {
					cbRedirect( $returnUrl, CBTxt::T( 'You do not have access to this event.' ), 'error' );
				}
			}
		} else {
			cbRedirect( $returnUrl, CBTxt::T( 'Event does not exist.' ), 'error' );
		}

		CBGroupJive::getTemplate( 'attending', true, true, $this->element );

		$canModerate			=	( CBGroupJive::isModerator( $user->get( 'id' ) ) || ( CBGroupJive::getGroupStatus( $user, $event->group() ) >= 2 ) );
		$limit					=	(int) $this->params->get( 'groups_events_attending_limit', 30 );
		$limitstart				=	$_CB_framework->getUserStateFromRequest( 'gj_event_attending_limitstart{com_comprofiler}', 'gj_event_attending_limitstart' );
		$search					=	$_CB_framework->getUserStateFromRequest( 'gj_event_attending_search{com_comprofiler}', 'gj_event_attending_search' );
		$where					=	null;

		if ( $search && $this->params->get( 'groups_events_attending_search', 0 ) ) {
			$where				.=	"\n AND ( j." . $_CB_database->NameQuote( 'name' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false )
								.	" OR j." . $_CB_database->NameQuote( 'username' ) . " LIKE " . $_CB_database->Quote( '%' . $_CB_database->getEscaped( $search, true ) . '%', false ) . " )";
		}

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

		$query					=	'SELECT COUNT(*)'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events_attendance' ) . " AS a"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_plugin_events' ) . " AS e"
								.	' ON e.' . $_CB_database->NameQuote( 'id' ) . ' = a.' . $_CB_database->NameQuote( 'event' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = a.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE a." . $_CB_database->NameQuote( 'event' ) . " = " . (int) $event->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $canModerate ) {
			$query				.=	"\n AND ( e." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR e.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
		}

		$query					.=	$where;
		$_CB_database->setQuery( $query );
		$total					=	(int) $_CB_database->loadResult();

		$pageNav				=	new cbPageNav( $total, $limitstart, $limit );

		$pageNav->setInputNamePrefix( 'gj_event_attending_' );

		$query					=	'SELECT a.*'
								.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_plugin_events_attendance' ) . " AS a"
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_plugin_events' ) . " AS e"
								.	' ON e.' . $_CB_database->NameQuote( 'id' ) . ' = a.' . $_CB_database->NameQuote( 'event' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__comprofiler' ) . " AS cb"
								.	' ON cb.' . $_CB_database->NameQuote( 'id' ) . ' = a.' . $_CB_database->NameQuote( 'user_id' )
								.	"\n LEFT JOIN " . $_CB_database->NameQuote( '#__users' ) . " AS j"
								.	' ON j.' . $_CB_database->NameQuote( 'id' ) . ' = cb.' . $_CB_database->NameQuote( 'id' )
								.	"\n WHERE a." . $_CB_database->NameQuote( 'event' ) . " = " . (int) $event->get( 'id' )
								.	"\n AND cb." . $_CB_database->NameQuote( 'approved' ) . " = 1"
								.	"\n AND cb." . $_CB_database->NameQuote( 'confirmed' ) . " = 1"
								.	"\n AND j." . $_CB_database->NameQuote( 'block' ) . " = 0";

		if ( ! $canModerate ) {
			$query				.=	"\n AND ( e." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
								.		' OR e.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )';
		}

		$query					.=	$where
								.	"\n ORDER BY a." . $_CB_database->NameQuote( 'date' ) . " DESC";
		if ( $this->params->get( 'groups_events_attending_paging', 1 ) ) {
			$_CB_database->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
		} else {
			$_CB_database->setQuery( $query );
		}
		$rows					=	$_CB_database->loadObjectList( null, '\CB\Plugin\GroupJiveEvents\Table\AttendanceTable', array( $_CB_database ) );

		$input					=	array();

		$input['search']		=	'<input type="text" name="gj_event_attending_search" value="' . htmlspecialchars( $search ) . '" onchange="document.gjEventAttendingForm.submit();" placeholder="' . htmlspecialchars( CBTxt::T( 'Search Attending...' ) ) . '" class="form-control" />';

		CBGroupJive::preFetchUsers( $rows );

		HTML_groupjiveAttending::showAttending( $rows, $pageNav, $searching, $input, $event, $user, $this );
	}
Example #29
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;
	}
Example #30
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;
	}