Пример #1
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;
 }
Пример #2
0
 /**
  * Generates the HTML to display the user profile tab
  *
  * @param  TabTable        $tab   The tab database entry
  * @param  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;
     $model = cbforumsClass::getModel();
     if (!$model->file) {
         return CBTxt::T('No supported forum model found!');
     }
     outputCbJs(1);
     outputCbTemplate(1);
     $plugin = cbforumsClass::getPlugin();
     $viewer =& CBuser::getUserDataInstance($_CB_framework->myId());
     $message = null;
     cbforumsClass::getTemplate('tab');
     if ($user->get('id') == $_CB_framework->myId()) {
         $profileUrl = cbSef('index.php?option=com_comprofiler&tab=' . (int) $tab->tabid, false);
         if ($this->params->get('tab_favs_display', 1)) {
             $unfavorite = cbGetParam($_REQUEST, 'forums_unfav', null);
             if ($unfavorite) {
                 if (cbforumsModel::unFavorite($unfavorite, $user, $plugin)) {
                     cbRedirect($profileUrl, CBTxt::T('Favorite deleted successfully!'));
                 } else {
                     cbRedirect($profileUrl, CBTxt::T('Favorite failed to delete.'), 'error');
                 }
             }
         }
         if ($this->params->get('tab_subs_display', 1)) {
             $unsubscribePost = cbGetParam($_REQUEST, 'forums_unsub', null);
             if ($unsubscribePost) {
                 if (cbforumsModel::unSubscribe($unsubscribePost, $user, $plugin)) {
                     cbRedirect($profileUrl, CBTxt::T('Subscription deleted successfully!'));
                 } else {
                     cbRedirect($profileUrl, CBTxt::T('Subscription failed to delete.'), 'error');
                 }
             }
             $unsubscribeCat = cbGetParam($_REQUEST, 'forums_unsubcat', null);
             if ($unsubscribeCat) {
                 if (cbforumsModel::unSubscribeCategory($unsubscribeCat, $user, $plugin)) {
                     cbRedirect($profileUrl, CBTxt::T('Category subscription deleted successfully!'));
                 } else {
                     cbRedirect($profileUrl, CBTxt::T('Category subscription failed to delete.'), 'error');
                 }
             }
         }
     }
     $tab->params = $this->params;
     $class = $plugin->params->get('general_class', null);
     $return = '<div id="cbForums" class="cbForums' . ($class ? ' ' . htmlspecialchars($class) : null) . '">' . '<div id="cbForumsInner" class="cbForumsInner">' . HTML_cbforumsTab::showTab($viewer, $user, $tab, $plugin) . '</div>' . '</div>';
     return $return;
 }
Пример #3
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;
	}