Пример #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;
 }
Пример #2
0
 /**
  * Shows Forum Category Subscriptions
  *
  * @param  stdClass[]   $rows       Rows to show
  * @param  cbPageNav    $pageNav    Page Navigation
  * @param  boolean      $searching  Are we searching currently ?
  * @param  string[]     $input      Inputs to show
  * @param  UserTable    $viewer     Viewing User
  * @param  UserTable    $user       Viewed at User
  * @param  TabTable     $tab        Current Tab
  * @param  PluginTable  $plugin     Current Plugin
  * @return string
  */
 public static function showCategorySubscriptions($rows, $pageNav, $searching, $input, $viewer, $user, $tab, $plugin)
 {
     global $_CB_framework;
     $tabPaging = $tab->params->get('tab_subs_paging', 1);
     $canSearch = $tab->params->get('tab_subs_search', 1) && ($searching || $pageNav->total);
     $unsuballUrl = "javascript: if ( confirm( '" . addslashes(CBTxt::T('Are you sure you want to delete all Subscriptions?')) . "' ) ) { location.href = '" . addslashes($_CB_framework->userProfileUrl($user->id, false, $tab->tabid) . '&forums_unsubcat=all') . "'; }";
     $return = '<div class="forumsCatSubsTab">' . '<form action="' . $_CB_framework->userProfileUrl($user->id, true, $tab->tabid) . '" method="post" name="forumCatSubsForm" id="forumCatSubsForm" class="forumCatSubsForm">';
     if ($canSearch) {
         $return .= '<div class="forumsHeader row" style="margin-bottom: 10px;">' . '<div class="col-sm-offset-8 col-sm-4 text-right">' . '<div class="input-group">' . '<span class="input-group-addon"><span class="fa fa-search"></span></span>' . $input['search'] . '</div>' . '</div>' . '</div>';
     }
     $return .= '<table class="forumsContainer table table-hover table-responsive">' . '<thead>' . '<tr>' . '<th style="width: 99%;" class="text-left">' . CBTxt::T('Category') . '</th>' . '<th style="width: 1%;" class="text-right">' . ($rows ? '<a href="javascript: void(0);" onclick="' . $unsuballUrl . '" title="' . htmlspecialchars(CBTxt::T('Delete All')) . '"><span class="fa fa-trash-o"></span></a>' : '&nbsp;') . '</th>' . '</tr>' . '</thead>' . '<tbody>';
     if ($rows) {
         foreach ($rows as $row) {
             $unsubUrl = "javascript: if ( confirm( '" . addslashes(CBTxt::T('Are you sure you want to delete this Subscription?')) . "' ) ) { location.href = '" . addslashes($_CB_framework->userProfileUrl($user->id, false, $tab->tabid) . '&forums_unsubcat=' . $row->id) . "'; }";
             $return .= '<tr>' . '<td style="width: 99%;" class="text-left"><a href="' . (isset($row->category_url) ? $row->category_url : cbforumsModel::getForumURL($row->category_id)) . '">' . cbforumsClass::cleanPost($row->category_name) . '</a></td>' . '<td style="width: 1%;" class="text-right"><a href="javascript: void(0);" onclick="' . $unsubUrl . '" title="' . htmlspecialchars(CBTxt::T('Delete')) . '"><span class="fa fa-trash-o"></span></a></td>' . '</tr>';
         }
     } else {
         $return .= '<tr>' . '<td colspan="2" class="text-left">';
         if ($searching) {
             $return .= CBTxt::T('No category subscription search results found.');
         } else {
             if ($viewer->id == $user->id) {
                 $return .= CBTxt::T('You have no category subscriptions.');
             } else {
                 $return .= CBTxt::T('This user has no category subscriptions.');
             }
         }
         $return .= '</td>' . '</tr>';
     }
     $return .= '</tbody>';
     if ($tabPaging && $pageNav->total > $pageNav->limit) {
         $return .= '<tfoot>' . '<tr>' . '<td colspan="4" class="text-center">' . $pageNav->getListLinks() . '</td>' . '</tr>' . '</tfoot>';
     }
     $return .= '</table>' . $pageNav->getLimitBox(false) . '</form>' . '</div>';
     return $return;
 }
Пример #3
0
 /**
  * @param  string  $component
  * @param  object  $view
  * @param  int     $userId
  * @param  array   $params
  * @return string|null
  */
 public function getSidebar($component, $view, $userId, $params)
 {
     if (isset($params['userprofile'])) {
         $cbUser = CBuser::getInstance((int) $userId, false);
         $user = $cbUser->getUserData();
         $plugin = cbforumsClass::getPlugin();
         $userprofile = $params['userprofile'];
         if ($user->id && $userprofile->userid) {
             $display = $plugin->params->get('k20_sidebar_reg', null);
         } elseif (!$user->id && $userprofile->userid) {
             $display = $plugin->params->get('k20_sidebar_del', null);
         } elseif (!$user->id && !$userprofile->userid) {
             $display = $plugin->params->get('k20_sidebar_anon', null);
         } else {
             $display = null;
         }
         if ($display) {
             $extras = array('karmaplus' => isset($view->userkarma_plus) ? $view->userkarma_plus : null, 'karmaminus' => isset($view->userkarma_minus) ? $view->userkarma_minus : null, 'karmatitle' => isset($view->userkarma_title) ? $view->userkarma_title : null, 'karma' => isset($view->userkarma) ? $view->userkarma : null, 'rankimage' => isset($view->userrankimage) ? $view->userrankimage : null, 'ranktitle' => isset($view->userranktitle) ? $view->userranktitle : null, 'posts' => isset($view->userposts) ? $view->userposts : null, 'thankyou' => isset($view->userthankyou) ? $view->userthankyou : null, 'points' => isset($view->userpoints) ? $view->userpoints : null, 'medals' => isset($view->usermedals) ? $view->usermedals : null, 'personaltext' => isset($view->personalText) ? $view->personalText : null);
             return $cbUser->replaceUserVars($display, false, true, $extras);
         }
     }
     return null;
 }
Пример #4
0
 /**
  * Legacy Field Strings:
  * CBTxt::T( '_UE_FORUM_FORUMRANKING', 'Forum Ranking' );
  * CBTxt::T( '_UE_FORUM_TOTALPOSTS', 'Total Posts' );
  * CBTxt::T( '_UE_FORUM_KARMA', 'Karma' );
  *
  * Accessor:
  * Returns a field in specified format
  *
  * @param  FieldTable  $field
  * @param  UserTable   $user
  * @param  string      $output  'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
  * @param  string      $reason  'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists
  * @param  int         $list_compare_types   IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search
  * @return mixed
  */
 public function getField(&$field, &$user, $output, $reason, $list_compare_types)
 {
     if (!cbforumsClass::getModel()->file) {
         return null;
     }
     $forumStatus = $field->params->get('forumStatus', 'posts');
     switch ($forumStatus) {
         case 'karma':
             $value = cbforumsModel::getUserKarma($user);
             break;
         case 'rank':
             $rankTitle = $field->params->get('forumRankTitle', 1);
             $rankImage = $field->params->get('forumRankImage', 1);
             $value = cbforumsModel::getUserRank($user, $rankTitle, $rankImage);
             break;
         case 'thankyou':
             $value = cbforumsModel::getUserThankYous($user);
             break;
         default:
             $value = cbforumsModel::getUserPosts($user);
             break;
     }
     switch ($output) {
         case 'html':
         case 'rss':
             return $this->formatFieldValueLayout($value, $reason, $field, $user);
             break;
         case 'htmledit':
             return null;
             break;
         default:
             return $this->_formatFieldOutput($field->get('name'), $value, $output, false);
             break;
     }
 }
Пример #5
0
	/**
	 * @param  string  $component
	 * @param  object  $view
	 * @param  int     $userId
	 * @param  array   $params
	 * @return string|null
	 */
	public function getSidebar( /** @noinspection PhpUnusedParameterInspection */ $component, $view, $userId, $params )
	{
		if ( isset( $params['userprofile'] ) ) {
			$cbUser			=	CBuser::getInstance( (int) $userId, false );
			$user			=	$cbUser->getUserData();
			$plugin			=	cbforumsClass::getPlugin();
			$userprofile	=	$params['userprofile'];

			if ( $user->id && $userprofile->userid ) {
				$display	=	$plugin->params->get( 'k20_sidebar_reg', null );
			} elseif ( ( ! $user->id ) && $userprofile->userid ) {
				$display	=	$plugin->params->get( 'k20_sidebar_del', null );
			} elseif ( ( ! $user->id ) && ( ! $userprofile->userid ) ) {
				$display	=	$plugin->params->get( 'k20_sidebar_anon', null );
			} else {
				$display	=	null;
			}

			if ( $display ) {
				$extras		=	array(	'karmaplus' => $view->userkarma_plus,
										'karmaminus' => $view->userkarma_minus
									);

				return $cbUser->replaceUserVars( $display, false, true, $extras );
			}
		}
		return null;
	}