Example #1
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;
 }
Example #2
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 #3
0
	/**
	 * render frontend group panes
	 *
	 * @param cbgjGroup $row
	 * @param cbgjCategory $category
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showGroupPanes( $row, $category, $user, $plugin ) {
		$authorized		=	cbgjClass::getAuthorization( $category, $row, $user );

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

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

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

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

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

		return $return;
	}
Example #4
0
 /**
  * @param  OrderedTable  $row
  * @param  UserTable     $user
  * @param  stdClass      $model
  * @param  PluginTable   $plugin
  */
 static function showBlog($row, $user, $model, $plugin)
 {
     global $_CB_framework;
     $_CB_framework->setPageTitle($row->get('title'));
     $_CB_framework->appendPathWay(htmlspecialchars(CBTxt::T('Blogs')), $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), true, 'cbblogsTab'));
     $_CB_framework->appendPathWay(htmlspecialchars($row->get('title')), $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'show', 'id' => (int) $row->get('id'))));
     $cbUser =& CBuser::getInstance((int) $row->get('user'), false);
     $return = '<div class="blowShow">' . '<div class="blogsTitle page-header"><h3>' . $row->get('title') . ' <small>' . CBTxt::T('WRITTEN_BY_BLOG_AUTHOR', 'Written by [blog_author]', array('[blog_author]' => $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true))) . '</small></h3></div>' . '<div class="blogsHeader well well-sm">' . CBTxt::T('CATEGORY_CATEGORY', 'Category: [category]', array('[category]' => $row->get('category'))) . ' &nbsp;/&nbsp; ' . CBTxt::T('CREATED_CREATED', 'Created: [created]', array('[created]' => cbFormatDate($row->get('created')))) . ($row->get('modified') && $row->get('modified') != '0000-00-00 00:00:00' ? ' &nbsp;/&nbsp; ' . CBTxt::T('MODIFIED_MODIFIED', 'Modified: [modified]', array('[modified]' => cbFormatDate($row->get('modified')))) : null) . '</div>' . '<div class="blogsText">' . $row->get('blog_intro') . $row->get('blog_full') . '</div>' . '</div>';
     echo $return;
 }
	/**
	 * @param  OrderedTable  $row
	 * @param  UserTable     $user
	 * @param  stdClass      $model
	 * @param  PluginTable   $plugin
	 */
	static function showconsultation( $row, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $plugin, $bids )
	{
		global $_CB_framework;

		$_CB_framework->setPageTitle( $row->get( 'title' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( 'consultations' ) ), $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), true, 'cbconsultationsTab' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $row->get( 'title' ) ), $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'consultations', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) );

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

		$return			=	'<div class="blowShow">'
						.		'<div class="consultationsTitle page-header"><h3>' . $row->get( 'title' ) . ' <small>' . CBTxt::T( 'WRITTEN_BY_consultation_AUTHOR', 'Written by [consultation_author]', array( '[consultation_author]' => $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) ) ) . '</small></h3></div>'
						.		'<div class="consultationsHeader well well-sm">'
						.			CBTxt::T( 'CATEGORY_CATEGORY', 'Category: [category]', array( '[category]' => $row->get( 'category' ) ) )
						.			' &nbsp;/&nbsp; ' . CBTxt::T( 'CREATED_CREATED', 'Created: [created]', array( '[created]' => cbFormatDate( $row->get( 'created' ) ) ) )
						.			( $row->get( 'modified' ) && ( $row->get( 'modified' ) != '0000-00-00 00:00:00' ) ? ' &nbsp;/&nbsp; ' . CBTxt::T( 'MODIFIED_MODIFIED', 'Modified: [modified]', array( '[modified]' => cbFormatDate( $row->get( 'modified' ) ) ) ) : null )
						.		'</div>'
						.		'<div class="consultationsText">' . $row->get( 'consultation_intro' ) . $row->get( 'consultation_full' ) . '</div>'
						.	'</div>';
    if($bids!=null){
      $return .= '<script >
          window.___gcfg = {
                  lang: \'ru\',
                          parsetags: \'onload\'
                              };
                              </script>

<script src="https://apis.google.com/js/platform.js" async defer></script>
';
      $return .= '<h2>Ставки</h2>';
      if(empty($bids)){
        $return .= "Нет ставок";
      }else{
        $return .= '<table cellspacing="5" class="consultationsContainer table table-hover table-responsive">';
        $return .= '<tr><th>Дата</th><th>Пользователь</th><th>e-mail</th><th>Цена</th><th></th></tr>';
        foreach($bids as $key=>$value){
          $return .='<tr>';
          $return .= '<td>'.$value->bid_date.'</td>';
          $return .= '<td>'.$value->name.'</td>';
          $return .= '<td>'.$value->email.'</td>';
          $return .= '<td>$'.$value->bid_price.'</td>';
          $return .= '<td>';
          if($key==0){
            //Old version was using Goolge Hangouts for communications.
            //$return .= '<g:hangout render="createhangout" hangout_type="normal" topic="'.addslashes($row->get('title')).'"
            //           invites="[{ id : \''.$value->email.'\', invite_type : \'EMAIL\' }]">
            //           </g:hangout>';
            //New version is using CloudInterpreter
            $return .= '<a target="_blank" href="http://dev.cloudinterpreter.com:8901/'.md5($row->get('id')).'"><button class="btn btn-success">Начать консультацию</button></a>';
          }
          $return .= '</td>';
          $return .='</tr>';
        }
        $return .= '</table>';
      }
		}
    echo $return;
	}
	/**
	 * render frontend category panes
	 *
	 * @param cbgjCategory $row
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showCategoryPanes( $row, $user, $plugin ) {
		$authorized		=	cbgjClass::getAuthorization( $row, null, $user );

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

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

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

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

		return $return;
	}
Example #7
0
 /**
  * Shows Forum 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 showSubscriptions($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_unsub=all') . "'; }";
     $return = '<div class="forumsSubsTab">' . '<form action="' . $_CB_framework->userProfileUrl($user->id, true, $tab->tabid) . '" method="post" name="forumSubsForm" id="forumSubsForm" class="forumSubsForm">';
     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: 24%;" class="text-left hidden-xs">' . CBTxt::T('Date') . '</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_unsub=' . $row->id) . "'; }";
             $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: 24%;" class="text-left hidden-xs">' . cbFormatDate(date('Y-m-d H:i:s', $row->date)) . '</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="4" class="text-left">';
         if ($searching) {
             $return .= CBTxt::T('No subscription search results found.');
         } else {
             if ($viewer->id == $user->id) {
                 $return .= CBTxt::T('You have no subscriptions.');
             } else {
                 $return .= CBTxt::T('This user has no 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 #8
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;
 }
 /**
  * Renders a $variable for an $output
  *
  * @param  string   $variable
  * @param  string   $output
  * @param  boolean  $rounded
  * @return string|null
  */
 public function renderColumn($variable, $output = 'html', $rounded = false)
 {
     $html = $output == 'html';
     switch ($variable) {
         case 'rate':
             $ret = $this->renderItemRate($html);
             break;
         case 'discount_amount':
         case 'tax_amount':
             $ret = $this->renderJustItemRates($variable, $html, $rounded);
             break;
         case 'first_rate':
         case 'first_discount_amount':
         case 'first_tax_amount':
             $ret = cbpaidMoney::getInstance()->renderPrice($this->{$variable}, $this->currency, $html, $rounded);
             break;
         case 'quantity':
             // removes insignifiant zeros after ., as well as the . itself if no decimals:
             $matches = null;
             $matched = preg_match("/^(.+?)[.]?[0]*\$/", $this->get($variable), $matches);
             $ret = $matched ? $matches[1] : null;
             break;
         case 'validity_period':
             if ($this->start_date && $this->stop_date && $this->start_date != '0000-00-00 00:00:00' && $this->stop_date != '0000-00-00 00:00:00') {
                 $showTime = false;
                 $startDate = cbFormatDate($this->start_date, 1, $showTime);
                 $stopDate = cbFormatDate($this->stop_date, 1, $showTime);
                 $ret = htmlspecialchars($startDate);
                 if ($stopDate && $startDate != $stopDate) {
                     $ret .= ($html ? '&nbsp;-&nbsp;' : ' - ') . htmlspecialchars($stopDate);
                 }
                 if ($this->second_stop_date && $this->second_stop_date != '0000-00-00 00:00:00') {
                     $secondStartDate = cbFormatDate($this->_db->getUtcDateTime(cbpaidTimes::getInstance()->strToTime($this->stop_date) + 1), 1, $showTime);
                     $secondStopDate = cbFormatDate($this->second_stop_date, 1, $showTime);
                     $retsecond = htmlspecialchars($secondStartDate) . ($html ? '&nbsp;-&nbsp;' : ' - ') . htmlspecialchars($secondStopDate);
                     $ret = sprintf($html ? CBPTXT::Th("%s, then %s") : CBPTXT::T("%s, then %s"), $ret, $retsecond);
                 }
             } else {
                 $ret = null;
             }
             break;
         case 'tax_rule_id':
             if ($this->tax_rule_id && is_callable(array('cbpaidTaxRule', 'getInstance'))) {
                 $ret = cbpaidTaxRule::getInstance((int) $this->tax_rule_id)->getShortCode();
             } else {
                 $ret = null;
             }
             break;
         case 'original_rate':
         case 'first_original_rate':
             $ret = null;
             break;
         case 'ordering':
         case 'artnum':
         case 'description':
         case 'discount_text':
         default:
             $value = $this->get($variable);
             if ($value !== null) {
                 $ret = htmlspecialchars($this->get($variable));
             } else {
                 $ret = null;
             }
             break;
     }
     return $ret;
 }
Example #10
0
	/**
	 * @param ActivityTable[] $rows
	 * @param Activity        $stream
	 * @param int             $output 0: Normal, 1: Raw, 2: Inline, 3: Load, 4: Save
	 * @param UserTable       $user
	 * @param UserTable       $viewer
	 * @param cbPluginHandler $plugin
	 * @return null|string
	 */
	static public function showActivity( $rows, $stream, $output, $user, $viewer, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$showActions					=	(int) $stream->get( 'actions', 1 );
		$showLocations					=	(int) $stream->get( 'locations', 1 );
		$showLinks						=	(int) $stream->get( 'links', 1 );
		$showTags						=	(int) $stream->get( 'tags', 1 );

		CBActivity::loadHeaders( $output );

		$_CB_framework->outputCbJQuery( "$( '.activityStream' ).cbactivity();" );

		$canCreate						=	CBActivity::canCreate( $user, $viewer, $stream );
		$cbModerator					=	CBActivity::isModerator( (int) $viewer->get( 'id' ) );
		$sourceClean					=	htmlspecialchars( $stream->source() );
		$newForm						=	null;
		$moreButton						=	null;

		if ( ( $output != 4 ) && $stream->get( 'paging' ) && $stream->get( 'limit' ) && $rows ) {
			$moreButton					=	'<a href="' . $stream->endpoint( 'show', array( 'limitstart' => ( $stream->get( 'limitstart' ) + $stream->get( 'limit' ) ), 'limit' => $stream->get( 'limit' ) ) ) . '" class="activityButton activityButtonMore streamMore btn btn-primary btn-sm btn-block">' . CBTxt::T( 'More' ) . '</a>';
		}

		$return							=	null;

		$_PLUGINS->trigger( 'activity_onBeforeDisplayActivity', array( &$return, &$rows, $stream, $output ) );

		if ( ! in_array( $output, array( 1, 4 ) ) ) {
			$return						.=	'<div class="' . $sourceClean . 'Activity activityStream streamContainer ' . ( $stream->direction() ? 'streamContainerUp' : 'streamContainerDown' ) . '" data-cbactivity-direction="' . (int) $stream->direction() . '">';

			if ( ( $stream->source() != 'hidden' ) && ( ! $stream->get( 'id' ) ) && ( ! $stream->get( 'filter' ) ) ) {
				$newForm				=	self::showNew( $stream, $output, $user, $viewer, $plugin );
			}
		}

		$return							.=		( $stream->direction() ? $moreButton : $newForm )
										.		( ! in_array( $output, array( 1, 4 ) ) ? '<div class="' . $sourceClean . 'ActivityItems activityStreamItems streamItems">' : null );

		if ( $rows ) foreach ( $rows as $row ) {
			$rowId						=	$stream->id() . '_' . (int) $row->get( 'id' );
			$rowOwner					=	( $viewer->get( 'id' ) == $row->get( 'user_id' ) );
			$typeClass					=	( $row->get( 'type' ) ? ucfirst( strtolower( preg_replace( '/[^-a-zA-Z0-9_]/', '', $row->get( 'type' ) ) ) ) : null );
			$subTypeClass				=	( $row->get( 'subtype' ) ? ucfirst( strtolower( preg_replace( '/[^-a-zA-Z0-9_]/', '', $row->get( 'subtype' ) ) ) ) : null );
			$isStatus					=	( ( $row->get( 'type' ) == 'status' ) || ( $row->get( 'subtype' ) == 'status' ) );

			$cbUser						=	CBuser::getInstance( (int) $row->get( 'user_id' ), false );
			$title						=	( $row->get( 'title' ) ? ( $isStatus ? htmlspecialchars( $row->get( 'title' ) ) : CBTxt::T( $row->get( 'title' ) ) ) : null );
			$message					=	( $row->get( 'message' ) ? ( $isStatus ? htmlspecialchars( $row->get( 'message' ) ) : CBTxt::T( $row->get( 'message' ) ) ) : null );
			$date						=	null;
			$insert						=	null;
			$footer						=	null;
			$menu						=	array();
			$extras						=	array();

			$_PLUGINS->trigger( 'activity_onDisplayActivity', array( &$row, &$title, &$date, &$message, &$insert, &$footer, &$menu, &$extras, $stream, $output ) );

			$title						=	$stream->parser( $title )->parse( array( 'linebreaks' ) );
			$message					=	$stream->parser( $message )->parse();

			if ( $isStatus ) {
				if ( ( in_array( $row->get( 'type' ), array( 'status', 'field' ) ) ) && $row->get( 'parent' ) && ( $row->get( 'parent' ) != $_CB_framework->displayedUser() ) && ( $row->get( 'parent' ) != $row->get( 'user_id' ) ) ) {
					$targetUser			=	CBuser::getInstance( (int) $row->get( 'parent' ) );

					if ( $targetUser !== null ) {
						$title			=	' <span class="fa fa-caret-right"></span> <strong>' . $targetUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</strong>';
					}
				}

				$action					=	( $showActions ? $stream->parser( $row->action() )->parse( array( 'linebreaks' ) ) : null );
				$location				=	( $showLocations ? $row->location() : null );
				$tags					=	null;

				if ( $showTags && $row->get( '_tags' ) ) {
					$tagsStream			=	$row->tags( $stream->source() );

					if ( $tagsStream && $tagsStream->data( true ) ) {
						$tags			=	trim( CBTxt::T( 'ACTIVITY_STATUS_TAGS', 'with [tags]', array( '[tags]' => $tagsStream->stream( true ) ) ) );
					}
				}

				if ( $action || $location || $tags ) {
					$subContent			=	( $action ? $action : null )
										.	( $location ? ( $action ? ' ' : null ) . $location : null )
										.	( $tags ? ( $action || $location ? ' ' : null ) . $tags : null );

					if ( $title ) {
						$message		.=	'<div class="streamItemSubContent">&mdash; ' . $subContent . '</div>';
					} else {
						$title			=	$subContent;
					}
				}
			} elseif ( $row->get( 'type' ) == 'activity' ) {
				if ( ! $row->get( 'item' ) ) {
					continue;
				}

				$row->set( '_comments', false );
				$row->set( '_tags', false );
				$row->set( '_links', false );

				$title					=	CBTxt::T( 'ACTIVITY_OF_ACTIVITY_TITLE', '[title] [date]', array( '[title]' => $title, '[date]' => cbFormatDate( $row->get( 'date' ), true, 'timeago' ) ) );
				$message				=	null;
				$footer					=	null;

				$subActivity			=	new Activity( 'activity', $cbUser->getUserData() );

				CBActivity::loadStreamDefaults( $subActivity, $stream );

				$subActivity->set( 'id', $row->get( 'item' ) );

				if ( $row->get( 'subtype' ) == 'comment' ) {
					$subActivity->set( 'comments', 1 );
				} elseif ( $row->get( 'subtype' ) == 'tag' ) {
					$subActivity->set( 'tags', 1 );
				}

				$insert					=	$subActivity->stream( true );

				if ( ! $insert ) {
					continue;
				}
			} else {
				$title					=	( $title ? $cbUser->replaceUserVars( $title, false, false, $extras, false ) : null );
				$message				=	( $message ? $cbUser->replaceUserVars( $message, false, false, $extras, false ) : null );
			}

			$links						=	array();

			if ( ( ( $isStatus && $showLinks ) || ( ! $isStatus ) ) && ( $row->get( '_links' ) !== false ) ) {
				$links					=	$row->attachments();
			}

			if ( ( $stream->source() != 'hidden' ) && $stream->get( 'comments' ) && ( $row->get( '_comments' ) !== false ) ) {
				$comments				=	$row->comments( 'activity', $cbUser->getUserData() );

				if ( $comments ) {
					CBActivity::loadStreamDefaults( $comments, $stream, 'comments_' );

					$footer				.=	$comments->stream( true, ( $row->get( '_comments' ) ? true : false ) );
				}
			}

			$return						.=		'<div id="' . $rowId . '" class="streamItem streamPanel activityContainer' . ( $typeClass ? ' activityContainer' . $typeClass : null ) . ( $subTypeClass ? ' activityContainer' . $typeClass . $subTypeClass : null ) . ' panel panel-default" data-cbactivity-id="' . (int) $row->get( 'id' ) . '">'
										.			'<div class="streamItemInner">'
										.				'<div class="streamMedia streamPanelHeading activityContainerHeader media panel-heading clearfix">'
										.					'<div class="streamMediaLeft activityContainerLogo media-left">'
										.						$cbUser->getField( 'avatar', null, 'html', 'none', 'list', 0, true )
										.					'</div>'
										.					'<div class="streamMediaBody activityContainerTitle media-body">'
										.						'<div class="activityContainerTitleTop text-muted">'
										.							'<strong>' . $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</strong>'
										.							( $title ? ' ' . $title : null )
										.						'</div>'
										.						'<div class="activityContainerTitleBottom text-muted small">'
										.							cbFormatDate( $row->get( 'date' ), true, 'timeago' )
										.							( $row->params()->get( 'modified' ) ? ' <span class="streamIconEdited fa fa-edit" title="' . htmlspecialchars( CBTxt::T( 'Edited' ) ) . '"></span>' : null )
										.							( $date ? ' ' . $date : null )
										.						'</div>'
										.					'</div>'
										.				'</div>';

			if ( $message ) {
				$return					.=				'<div class="streamPanelBody streamItemDisplay activityContainerContent panel-body">'
										.					'<div class="activityContainerContentInner cbMoreLess">'
										.						'<div class="streamItemContent cbMoreLessContent">'
										.							$message
										.						'</div>'
										.						'<div class="cbMoreLessOpen fade-edge hidden">'
										.							'<a href="javascript: void(0);" class="cbMoreLessButton">' . CBTxt::T( 'See More' ) . '</a>'
										.						'</div>'
										.					'</div>'
										.				'</div>';
			}

			$return						.=				( $insert ? '<div class="streamItemDisplay streamItemDivider activityContainerInsert border-default">' . $insert . '</div>' : null );

			if ( $links ) {
				$return					.=				'<div class="streamPanelBody streamItemDisplay streamItemDivider activityContainerAttachments panel-body border-default">'
										.					'<div class="activityContainerAttachmentsInner">'
										.						self::showAttachments( $row, $stream, $output, $user, $viewer, $plugin )
										.					'</div>'
										.				'</div>';
			}

			$return						.=				( $footer ? '<div class="streamPanelFooter streamItemDisplay activityContainerFooter panel-footer">' . $footer . '</div>' : null );

			if ( $isStatus && ( $cbModerator || $rowOwner ) && $canCreate ) {
				$return					.=				self::showEdit( $row, $stream, $output, $user, $viewer, $plugin );
			}

			if ( $cbModerator || $rowOwner || ( $viewer->get( 'id' ) && ( ! $rowOwner ) ) || $menu ) {
				$menuItems				=	'<ul class="streamItemMenuItems activityMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( $isStatus && ( $cbModerator || $rowOwner ) && $canCreate ) {
					$menuItems			.=		'<li class="streamItemMenuItem activityMenuItem"><a href="javascript: void(0);" class="activityMenuItemEdit streamItemEditDisplay" data-cbactivity-container="#' . $rowId . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';
				}

				if ( $viewer->get( 'id' ) && ( ! $rowOwner ) ) {
					if ( $stream->source() == 'hidden' ) {
						$menuItems		.=		'<li class="streamItemMenuItem activityMenuItem"><a href="' . $stream->endpoint( 'unhide', array( 'id' => (int) $row->get( 'id' ) ) ) . '" class="activityMenuItemUnhide streamItemAction" data-cbactivity-container="#' . $rowId . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Unhide' ) . '</a></li>';
					} else {
						$menuItems		.=		'<li class="streamItemMenuItem activityMenuItem"><a href="' . $stream->endpoint( 'hide', array( 'id' => (int) $row->get( 'id' ) ) ) . '" class="activityMenuItemHide streamItemAction" data-cbactivity-container="#' . $rowId . '" data-cbactivity-confirm="' . htmlspecialchars( CBTxt::T( 'Are you sure you want to hide this Activity?' ) ) . '" data-cbactivity-confirm-button="' . htmlspecialchars( CBTxt::T( 'Hide Activity' ) ) . '"><span class="fa fa-times"></span> ' . CBTxt::T( 'Hide' ) . '</a></li>';
					}
				}

				if ( $cbModerator || $rowOwner ) {
					$menuItems			.=		'<li class="streamItemMenuItem activityMenuItem"><a href="' . $stream->endpoint( 'delete', array( 'id' => (int) $row->get( 'id' ) ) ) . '" class="activityMenuItemDelete streamItemAction" data-cbactivity-container="#' . $rowId . '" data-cbactivity-confirm="' . htmlspecialchars( CBTxt::T( 'Are you sure you want to delete this Activity?' ) ) . '" data-cbactivity-confirm-button="' . htmlspecialchars( CBTxt::T( 'Delete Activity' ) ) . '"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				}

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

				$menuItems				.=	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="fa fa-chevron-down text-muted" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle" data-cbtooltip-open-classes="open"' );

				$return					.=				'<div class="streamItemMenu activityContainerMenu">'
										.					'<span ' . trim( $menuAttr ) . '></span>'
										.				'</div>';
			}

			$return						.=			'</div>'
										.		'</div>';
		} elseif ( $output != 2 ) {
			$return						.=		'<div class="streamItemEmpty text-center text-muted small">';

			if ( $output == 1 ) {
				$return					.=			CBTxt::T( 'No more activity to display.' );
			} else {
				$return					.=			CBTxt::T( 'No activity to display.' );
			}

			$return						.=		'</div>';
		} elseif ( ( $output == 2 ) && ( ! $newForm ) ) {
			return null;
		}

		$return							.=		( ! in_array( $output, array( 1, 4 ) ) ? '</div>' : null )
										.		( ! $stream->direction() ? $moreButton : $newForm )
										.	( ! in_array( $output, array( 1, 4 ) ) ? '</div>' : null )
										.	CBActivity::reloadHeaders( $output );

		$_PLUGINS->trigger( 'activity_onAfterDisplayActivity', array( &$return, $rows, $stream, $output ) );

		return $return;
	}
Example #11
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;
	}
    function showUsers(&$rows, &$pageNav, $search, $option, &$lists, &$pluginColumns, $inputTextExtras, $searchTabContent, $canAdmin, $canManage, $canCreate, $canEdit, $canEditOwn, $canEditState)
    {
        global $_CB_framework;
        _CBsecureAboveForm('showUsers');
        outputCbTemplate(2);
        outputCbJs(2);
        global $_CB_Backend_Title;
        $_CB_Backend_Title = array(0 => array('cbicon-48-user', CBTxt::T('CB User Manager')));
        /*
         * 		Auto-submission was a pain: added 2 buttons in advanced search.
        		ob_start();
        $('#cbUserListsSearcher select,#cbUserListsSearcher input,#cbUserListsSearcher textarea').live('change', function() {
        	if ( $(this).parent('div').hasClass('cbSearchKind') ) {
        		if ( $(this).val() == '' ) {
        			$(this).parents('form')[0].submit();
        		}
        	} else {
        		$(this).parents('form')[0].submit();
        	}
        });
        
        			$cbjavascript	=	ob_get_contents();
        			ob_end_clean();
        			$_CB_framework->outputCbJQuery( $cbjavascript );
        */
        $_CB_framework->outputCbJQuery('');
        $colspans = 13 + count($pluginColumns);
        ?>
<form action="<?php 
        echo $_CB_framework->backendUrl('index.php');
        ?>
" method="post" name="adminForm" class="cb_form" id="cbshowusersform">
<?php 
        $this->_userslistFilters($search, $lists, $inputTextExtras, $searchTabContent);
        ?>
  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
   <thead>
    <tr>
      <th align="center" colspan="<?php 
        echo $colspans;
        ?>
"> <?php 
        echo $pageNav->writePagesLinks();
        ?>
</th>
    </tr>
    <tr>
      <th width="1%" class="title"><?php 
        echo CBTxt::T('#');
        ?>
</th>
      <th width="3%" class="title">
      	<input type="checkbox" name="toggle" value="" <?php 
        echo 'onClick="cbToggleAll( this, ' . count($rows) . ', \'cb\' );"';
        ?>
 />
      </th>
      <th width="23%" class="title"><?php 
        echo CBTxt::T('Name');
        ?>
</th>
      <th width="12%" class="title"><?php 
        echo CBTxt::T('UserName');
        ?>
</th>
      <th width="3%" class="title" nowrap="nowrap"><?php 
        echo CBTxt::T('Logged In');
        ?>
</th>
<?php 
        foreach ($pluginColumns as $name => $content) {
            ?>
	  <th width="15%" class="title"><?php 
            echo $name;
            ?>
</th>

<?php 
        }
        ?>
      <th width="12%" class="title"><?php 
        echo CBTxt::T('Group');
        ?>
</th>
      <th width="13%" class="title"><?php 
        echo CBTxt::T('E-Mail');
        ?>
</th>
      <th width="8%" class="title"><?php 
        echo CBTxt::T('Registered');
        ?>
</th>
      <th width="8%" class="title" nowrap="nowrap"><?php 
        echo CBTxt::T('Last Visit');
        ?>
</th>
      <th width="3%" class="title"><?php 
        echo CBTxt::T('Enabled');
        ?>
</th>
      <th width="3%" class="title"><?php 
        echo CBTxt::T('Confirmed');
        ?>
</th>
      <th width="3%" class="title"><?php 
        echo CBTxt::T('Approved');
        ?>
</th>
      <th width="1%" class="title"><?php 
        echo CBTxt::T('ID');
        ?>
</th>
    </tr>
   </thead>
   <tbody>
<?php 
        $k = 0;
        $imgpath = '../components/com_comprofiler/images/';
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $img = $row->block ? 'publish_x.png' : 'tick.png';
            $task = $row->block ? 'unblock' : 'block';
            $hover1 = $row->block ? CBTxt::T('Blocked') : CBTxt::T('Enabled');
            switch ($row->approved) {
                case 0:
                    $img2 = 'pending.png';
                    $task2 = 'approve';
                    $hover = CBTxt::T('Pending Approval');
                    break;
                case 1:
                    $img2 = 'tick.png';
                    $task2 = 'reject';
                    $hover = CBTxt::T('Approved');
                    break;
                case 2:
                    $img2 = 'publish_x.png';
                    $task2 = 'approve';
                    $hover = CBTxt::T('Rejected');
                    break;
            }
            $img3 = $row->confirmed ? 'tick.png' : 'publish_x.png';
            // $task3 = $row->confirmed ?   'reject' : 'approve';
            $hover3 = $row->confirmed ? CBTxt::T('confirmed') : CBTxt::T('unconfirmed');
            ?>
    <tr class="<?php 
            echo "row{$k}";
            ?>
">
      <td><?php 
            echo $i + 1 + $pageNav->limitstart;
            ?>
</td>
      <td>
      	<input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="cid[]" value="<?php 
            echo $row->id;
            ?>
" onClick="cbIsChecked(this.checked);" />
      </td>
      <td>
      	<?php 
            if ($canEdit && $row->id != $_CB_framework->myId() || $canEditOwn && $row->id == $_CB_framework->myId()) {
                ?>
        <a href="#edit" onClick="return cbListItemTask( this, 'edit', null, null, 'cb', '<?php 
                echo $i;
                ?>
' )">
        <?php 
                echo htmlspecialchars($row->name);
                ?>
 
        </a>
        <?php 
            } else {
                echo htmlspecialchars($row->name);
            }
            if (checkJversion() >= 2) {
                ?>
      		<div class="fltrt">
			<?php 
                if (version_compare(checkJversion('release'), '2.5', '>=') && $canManage) {
                    if ($row->note_count) {
                        // Filter notes:
                        echo '<a href="' . JRoute::_('index.php?option=com_users&view=notes&filter_search=uid:' . (int) $row->id) . '">' . JHtml::_('image', 'admin/filter_16.png', 'COM_USERS_NOTES', array('title' => JText::_('COM_USERS_FILTER_NOTES'), 'height' => '16', 'width' => '16'), true) . '</a>';
                        // Show notes:
                        echo '<a class="modal"' . ' href="' . JRoute::_('index.php?option=com_users&view=notes&tmpl=component&layout=modal&u_id=' . (int) $row->id) . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . JHtml::_('image', 'menu/icon-16-user-note.png', 'COM_USERS_NOTES', array('title' => JText::plural('COM_USERS_N_USER_NOTES', $row->note_count), 'height' => '16', 'width' => '16'), true) . '</a>';
                    }
                    if ($canCreate) {
                        echo '<a href="' . JRoute::_('index.php?option=com_users&task=note.add&u_id=' . (int) $row->id) . '">' . JHtml::_('image', 'admin/note_add_16.png', 'COM_USERS_NOTES', array('title' => JText::_('COM_USERS_ADD_NOTE'), 'height' => '16', 'width' => '16'), true) . '</a>';
                    }
                }
                ?>
			</div>
		<?php 
                if (($_CB_framework->acl->amIaSuperAdmin() || $canAdmin && $canManage) && $_CB_framework->getCfg('debug')) {
                    ?>
			<div class="fltrt">
				<a href="<?php 
                    echo JRoute::_('index.php?option=com_users&view=debuguser&user_id=' . (int) $row->id);
                    ?>
">
					<?php 
                    echo JHtml::_('image', 'menu/icon-16-stats.png', 'COM_USERS_DEBUG_USER', array('title' => JText::_('COM_USERS_DEBUG_USER'), 'height' => '16', 'width' => '16'), true);
                    ?>
</a></div>
		<?php 
                }
            }
            ?>
      </td>
      <td><?php 
            echo htmlspecialchars($row->username);
            ?>
</td>
      <td align="center"><?php 
            echo $row->loggedin ? '<img src="' . $imgpath . 'tick.png" width="16" height="16" border="0" alt="" />' : '';
            ?>
</td>
<?php 
            foreach ($pluginColumns as $name => $content) {
                ?>
	  <td><?php 
                echo $content[$row->id];
                ?>
</td>

<?php 
            }
            ?>
      <td><?php 
            echo $row->groupname;
            ?>
</td>
      <td><a href="mailto:<?php 
            echo htmlspecialchars($row->email);
            ?>
"><?php 
            echo htmlspecialchars($row->email);
            ?>
</a></td>
      <td><?php 
            echo cbFormatDate($row->registerDate);
            ?>
</td>
      <td><?php 
            echo cbFormatDate($row->lastvisitDate);
            ?>
</td>
      <td width="10%">
      	<?php 
            if ($canEditState) {
                ?>
      	<a href="javascript: void(0);" onClick="return cbListItemTask( this, '<?php 
                echo $task;
                ?>
', null, null, 'cb', '<?php 
                echo $i;
                ?>
' )">
      	<?php 
            }
            ?>
      		<img src="<?php 
            echo $imgpath . $img;
            ?>
" width="16" height="16" border="0" title="<?php 
            echo $hover1;
            ?>
" alt="<?php 
            echo $hover1;
            ?>
" />
      	<?php 
            if ($canEditState) {
                ?>
      	</a>
      	<?php 
            }
            ?>
      </td>
      <td width="10%">
      	<img src="<?php 
            echo $imgpath . $img3;
            ?>
" width="16" height="16" border="0" title="<?php 
            echo $hover3;
            ?>
" alt="<?php 
            echo $hover3;
            ?>
" />
      </td>
      <td width="10%">
      	<?php 
            if ($canEditState) {
                ?>
      	<a href="javascript: void(0);" onClick="return cbListItemTask( this, '<?php 
                echo $task2;
                ?>
', null, null, 'cb', '<?php 
                echo $i;
                ?>
' )">
      	<?php 
            }
            ?>
      		<img src="<?php 
            echo $imgpath . $img2;
            ?>
" width="16" height="16" border="0" title="<?php 
            echo $hover;
            ?>
" alt="<?php 
            echo $hover;
            ?>
" />
      	<?php 
            if ($canEditState) {
                ?>
      	</a>
      	<?php 
            }
            ?>
      </td>
      <td><?php 
            echo $row->id;
            ?>
</td>

    </tr>
    <?php 
            $k = 1 - $k;
        }
        ?>
   </tbody>
   <tfoot>
    <tr>
      <th align="center" colspan="<?php 
        echo $colspans;
        ?>
"> <?php 
        echo $pageNav->getListFooter();
        ?>
</th>
    </tr>
   </tfoot>
  </table>
  <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
  <input type="hidden" name="task" value="showusers" />
  <input type="hidden" name="boxchecked" value="0" />
  <?php 
        echo cbGetSpoofInputTag('user');
        ?>
</form>
<?php 
    }
 /**
  * Called just before emailing each user from CB Users management backend
  *
  * @param  UserTable  $user
  * @param  string     $emailSubject
  * @param  string     $emailBody
  * @param  int        $mode
  * @param  array      $extraStrings    Entries can be filled in this function and will be used to email
  * @param  boolean    $simulationMode
  */
 public function onBeforeBackendUserEmail(&$user, &$emailSubject, &$emailBody, $mode, &$extraStrings, $simulationMode)
 {
     if (cbpaidApp::authoriseAction('cbsubs.usersubscriptionview')) {
         if ($this->filter_cbpaidplan > 0) {
             $params = cbpaidApp::settingsParams();
             $showtime = $params->get('showtime', '1') == '1';
             $plansMgr = cbpaidPlansMgr::getInstance();
             $plan = $plansMgr->loadPlan((int) $this->filter_cbpaidplan);
             $sub = $plan->loadLatestSomethingOfUser($user->id, $this->filter_cbpaidsubstate);
             $extraStrings['subscription_start_date'] = $sub ? cbFormatDate($sub->getSubscriptionDate(), 1, $showtime) : CBPTXT::T('No subscription');
             if ($plan->isProductWithExpiration()) {
                 if ($sub) {
                     $extraStrings['subscription_end_date'] = $sub->getFormattedExpirationDateText();
                 } else {
                     $extraStrings['subscription_end_date'] = CBPTXT::T('No subscription');
                 }
             }
             $extraStrings['subscription_lastrenew_date'] = $sub ? cbFormatDate($sub->getLastRenewDate(), 1, $showtime) : CBPTXT::T('No subscription');
         }
     }
 }
Example #14
0
	/**
	 * render frontend overview main
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showOverviewMain( $rows, $pageNav, $user, $plugin ) {
		$authorized			=	cbgjClass::getAuthorization( null, null, $user );
		$overviewSearch		=	$plugin->params->get( 'overview_search', 1 );
		$overviewPaging		=	$plugin->params->get( 'overview_paging', 1 );
		$overviewLimitbox	=	$plugin->params->get( 'overview_limitbox', 1 );
		$categoryDescLimit	=	(int) $plugin->params->get( 'overview_cat_desc_limit', 150 );
		$categoryApprove	=	$plugin->params->get( 'category_approve', 0 );
		$newCategory		=	( $plugin->params->get( 'overview_new_category', 0 ) && cbgjClass::hasAccess( 'cat_create', $authorized ) );
		$newGroup			=	( $plugin->params->get( 'overview_new_group', 0 ) && cbgjClass::hasAccess( 'grp_create', $authorized ) );

		$return				=	null;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		return $return;
	}
Example #15
0
function banUser( $option, $uid, $form=1, $act=1 ) {
	global $_CB_framework, $_CB_database, $ueConfig, $_POST;

	$isModerator=isModerator( $_CB_framework->myId() );
	if ( ( $_CB_framework->myId() < 1 ) || ( $uid < 1 ) )  {
			cbNotAuth();
			exit();
	}
	if ( $ueConfig['allowUserBanning'] == 0 ) {
			echo _UE_FUNCTIONALITY_DISABLED;
			exit();
	}

	if ( $form == 1 ) {
		$_CB_database->setQuery( "SELECT bannedreason FROM #__comprofiler WHERE id = " . (int) $uid );
		$orgbannedreason	=	$_CB_database->loadresult();

		HTML_comprofiler::banUserForm( $option, $uid, $act, $orgbannedreason);
	} else {

		$now				=	$_CB_framework->now();
		$dateStr			=	cbFormatDate( $now );

		$cbNotification		=	new cbNotification();
		if ( $act == 1 ) {
			// Ban by moderator:
			if ( ( ! $isModerator ) || ( $_CB_framework->myId() != cbGetParam( $_POST, 'bannedby', 0 ) ) ) {
				cbNotAuth();
				return;
			}
			// simple spoof check security
			cbSpoofCheck( 'banUserForm' );

			$bannedreason	=	'<b>' . htmlspecialchars("["._UE_MODERATORBANRESPONSE.", " . $dateStr . "]") . "</b>\n" . htmlspecialchars( stripslashes( cbGetParam( $_POST, 'bannedreason') ) ) ."\n";
			$sql="UPDATE #__comprofiler SET banned=1, bannedby=" . (int) $_CB_framework->myId() . ", banneddate='".date('Y-m-d\TH:i:s')."', bannedreason = CONCAT_WS('','" . $_CB_database->getEscaped( $bannedreason ) . "', bannedreason) WHERE id=". (int) $uid;
			$_CB_database->SetQuery($sql);
			$_CB_database->query();

			$cbNotification->sendFromSystem($uid,_UE_BANUSER_SUB,_UE_BANUSER_MSG);
			echo _UE_USERBAN_SUCCESSFUL;
		} elseif ( $act == 0 ) {
			// Unban by moderator:
			if (!$isModerator){
				cbNotAuth();
				return;
			}
			// $mineName		=	getNameFormat($_CB_framework->myName(), $_CB_framework->myUsername,$ueConfig['name_format']);
			// DEFINE('_UE_UNBANUSER_BY_ON','User profile unbanned by %s on %s');
			// $unbannedBy	=	"<b>" . addslashes( htmlspecialchars("[".sprintf( _UE_UNBANUSER_BY_ON, $mineName, $dateStr ) ) ) . "]</b>\n";
			$unbannedBy	=	"<b>" . htmlspecialchars("[". _UE_UNBANUSER . ", " . $dateStr ) . "]</b>\n";
			$sql="UPDATE #__comprofiler SET banned=0, unbannedby=" . (int) $_CB_framework->myId() . ", bannedreason = CONCAT_WS('','" . $_CB_database->getEscaped( $unbannedBy ) . "', bannedreason), unbanneddate='".date('Y-m-d\TH:i:s')."'  WHERE id=".(int) $uid;				// , bannedreason=null, bannedby=null, banneddate=null
			$_CB_database->SetQuery($sql);
			$_CB_database->query();
			$cbNotification->sendFromSystem($uid,_UE_UNBANUSER_SUB,_UE_UNBANUSER_MSG);

			echo _UE_USERUNBAN_SUCCESSFUL;
		} elseif ( $act == 2 ) {
			// Unban request from user:
			if ( $_CB_framework->myId() != $uid ) {
				cbNotAuth();
				return;
			}
			$bannedreason = "<b>".htmlspecialchars("["._UE_USERBANRESPONSE.", " . $dateStr . "]")."</b>\n" . htmlspecialchars( stripslashes( cbGetParam( $_POST, 'bannedreason' ) ) ) ."\n";
			$sql="UPDATE #__comprofiler SET banned=2, bannedreason = CONCAT_WS('','" . $_CB_database->getEscaped( $bannedreason) . "', bannedreason) WHERE id=" . (int) $uid;
			$_CB_database->SetQuery($sql);
			$_CB_database->query();
			if($ueConfig['moderatorEmail']==1) {
				$cbNotification->sendToModerators(_UE_UNBANUSERREQUEST_SUB,_UE_UNBANUSERREQUEST_MSG);
			}
			echo _UE_USERUNBANREQUEST_SUCCESSFUL;

		}
	}
}
Example #16
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;
	}
	/**
	 * Generates extra strings for substitutions for invoices
	 *
	 * @return array
	 */
	protected function getInvoiceExtraStrings( ) {
		global $_CB_framework;

		$user						=	CBuser::getUserDataInstance( $this->user_id );
		$extraStrings				=	array(	'SITENAME'				=>	$_CB_framework->getCfg( 'sitename' ),
			'SITEURL'				=>	$_CB_framework->getCfg( 'live_site' ),
			'EMAILADDRESS'			=>	$user->email,
			'INVOICE_ID'			=>	$this->id,
			'INVOICE_NO'			=>	$this->invoice,
			'PROFORMA_INVOICE_NO'	=>	$this->proformainvoice,
			'ITEMS_NAME'			=>	$this->item_name,
			'ITEMS_NUMBERS'			=>	$this->item_number,
			'PAYMENT_STATUS'		=>	$this->payment_status,
			'PAYMENT_METHOD'		=>	$this->payment_method,
			'DATE_ORDERED'			=>	cbFormatDate( $this->time_initiated, 1, false ),
			'DATE_TIME_ORDERED'		=>	cbFormatDate( $this->time_initiated, 1, true ),
			'DATE_PAID'				=>	cbFormatDate( $this->time_completed, 1, false ),
			'TRANSACTION_ID'		=>	$this->txn_id,
			'TRANSACTION_TYPE'		=>	$this->txn_type,
			'CURRENCY'				=>	$this->mc_currency,
			'TOTAL_PRICE'			=>	sprintf( '%0.2f', $this->mc_gross ),
			'TAX_AMOUNT'			=>	sprintf( '%0.2f', $this->tax ),
			'ADDRESS_FIRST_NAME'	=>	$this->first_name,
			'ADDRESS_LAST_NAME'		=>	$this->last_name,
			'ADDRESS_COMPANY'		=>	$this->payer_business_name,
			'ADDRESS_STREET'		=>	$this->address_street,
			'ADDRESS_CITY'			=>	$this->address_city,
			'ADDRESS_STATE'			=>	$this->address_state,
			'ADDRESS_ZIPCODE'		=>	$this->address_zip,
			'ADDRESS_COUNTRY'		=>	$this->address_country,
			'ADDRESS_PHONE'			=>	$this->contact_phone,
			'PAYER_EMAIL'			=>	$this->payer_email,
			'ADDRESS_VAT_NUMBER'	=>	$this->vat_number
		);
		return $extraStrings;
	}
 /**
  * Renders a $variable for an $output
  *
  * @param  string       $variable  Variable to render
  * @param  string       $output    'html': HTML rendering, 'text': TEXT rendering
  * @param  boolean      $rounded   Round column values ?
  * @return string|null
  */
 public function renderColumn($variable, $output = 'html', $rounded = false)
 {
     $html = $output == 'html';
     switch ($variable) {
         case 'rate':
         case 'original_rate':
         case 'tax_amount':
             $ret = $this->renderItemRate($variable, $html, $rounded);
             break;
         case 'first_rate':
         case 'first_original_rate':
         case 'first_tax_amount':
             if (property_exists($this, $variable)) {
                 $ret = cbpaidMoney::getInstance()->renderPrice($this->{$variable}, $this->currency, $html, $rounded);
             } else {
                 $ret = null;
             }
             break;
         case 'validity_period':
             if ($this->start_date && $this->stop_date && $this->start_date != '0000-00-00 00:00:00' && $this->stop_date != '0000-00-00 00:00:00') {
                 $startDate = cbFormatDate($this->start_date, 0, false);
                 $stopDate = cbFormatDate($this->stop_date, 0, false);
                 $ret = htmlspecialchars($startDate);
                 if ($startDate != $stopDate) {
                     $ret .= ($html ? '&nbsp;-&nbsp;' : ' - ') . htmlspecialchars($stopDate);
                 }
             } else {
                 $ret = null;
             }
             break;
         case 'tax_rule_id':
             if ($this->tax_rule_id && is_callable(array('cbpaidTaxRule', 'getInstance'))) {
                 $ret = cbpaidTaxRule::getInstance((int) $this->tax_rule_id)->getShortCode();
             } else {
                 $ret = null;
             }
             break;
         case 'ordering':
             if ($this->payment_item_id) {
                 $paymItem = $this->_paymentBasket->getPaymentItem($this->payment_item_id);
                 if ($paymItem) {
                     $ret = htmlspecialchars($paymItem->ordering);
                 } else {
                     $ret = null;
                 }
             } else {
                 $ret = null;
             }
             break;
         case 'discount_amount':
         case 'first_discount_amount':
             $ret = null;
             break;
         case 'quantity':
         case 'artnum':
         case 'description':
         case 'discount_text':
         default:
             $ret = htmlspecialchars($this->get($variable));
             break;
     }
     return $ret;
 }
Example #19
0
	/**
	 * @param cbgalleryFolderTable $row
	 * @param string               $type
	 * @param UserTable            $viewer
	 * @param UserTable            $user
	 * @param TabTable             $tab
	 * @param cbTabHandler         $plugin
	 * @return string
	 */
	static public function showFolder( $row, $type, $viewer, $user, $tab, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		$_PLUGINS->trigger( 'gallery_onBeforeDisplayFolder', array( &$row, $type, $viewer, $user, $tab, $plugin ) );

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

		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;
		}

		$profileOwner					=	( $viewer->get( 'id' ) == $user->get( 'id' ) );
		$cbModerator					=	Application::User( (int) $viewer->get( 'id' ) )->isGlobalModerator();
		$date							=	cbFormatDate( $row->get( 'date' ), true, (int) $params->get( 'tab_' . $type . '_folder_items_time_display', 0 ), $params->get( 'tab_' . $type . '_folder_items_date_format', 'F j, Y' ), $params->get( 'tab_' . $type . '_folder_items_time_format', ' g:h A' ) );

		$return							=	'<div class="galleryFolderTitle page-header clearfix">'
										.		'<h3 class="row">'
										.			'<div class="col-sm-8 text-left">'
										.				( $row->get( 'title' ) ? htmlspecialchars( $row->get( 'title' ) ) . ( $row->get( 'id' ) !== 0 ? '<div class="small" title="' . htmlspecialchars( $row->get( 'date' ) ) . '">' . $date . '</div>' : null ) : $date )
										.			'</div>'
										.			'<div class="col-sm-4 text-right">'
										.				'<small>'
										.					'<a href="' . $_CB_framework->userProfileUrl( (int) $user->get( 'id' ), true, (int) $tab->get( 'tabid' ) ) . '">'
										.						CBuser::getInstance( (int) $row->get( 'user_id' ), false )->getField( 'formatname', null, 'html', 'none', 'profile', 0, true )
										.					'</a>'
										.				'</small>';

		if ( ( $row->get( 'id' ) !== 0 ) && ( $cbModerator || $profileOwner ) ) {
			$menuItems					=	'<ul class="galleryFolderMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">'
										.		'<li class="galleryFolderMenuItem"><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' ), 'folder' => true ) ) . '"><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="galleryFolderMenuItem"><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' ), 'folder' => true ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Approve' ) . '</a></li>';
				}
			} elseif ( $row->get( 'published' ) > 0 ) {
				$menuItems				.=		'<li class="galleryFolderMenuItem"><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' ), 'folder' => true ) ) . '\'; }"><span class="fa fa-times-circle"></span> ' . CBTxt::T( 'Unpublish' ) . '</a></li>';
			} else {
				$menuItems				.=		'<li class="galleryFolderMenuItem"><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' ), 'folder' => true ) ) . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Publish' ) . '</a></li>';
			}

			$menuItems					.=		'<li class="galleryFolderMenuItem"><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="folderMenu">'
										.					'<div class="galleryFolderMenu 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>'
										.		'</h3>'
										.	'</div>'
										.	( $row->get( 'description' ) ? '<div class="galleryFolderDescription well well-sm">' . htmlspecialchars( $row->get( 'description' ) ) . '</div>' : null );

		return $return;
	}
	/**
	 * Implements a form datetime field with date-picker
	 *
	 * @param  string              $name          The name of the form element
	 * @param  string              $value         The value of the element
	 * @param  SimpleXMLElement  $node          The xml element for the parameter
	 * @param  string              $control_name  The control name
	 * @return string                             The html for the element
	 */
	function _form_datetime( $name, $value, &$node, $control_name ) {
		global $_CB_framework;

		$showTime				=	$node->attributes( 'showtime' );

		if ( $showTime === null ) {
			$showTime			=	true;
		} else {
			$showTime			=	( ( $showTime == 'false' ) || ( $showTime == '0' ) ? false : ( ( $showTime == 'true' ) || ( $showTime == '1' ) ? true : $showTime ) );
		}

		$dateFormat				=	$node->attributes( 'dateformat' );
		$timeFormat				=	$node->attributes( 'timeformat' );

		if ( $dateFormat ) {
			$dateTimeFormat		=	$dateFormat . ( $timeFormat ? ' ' . $timeFormat : null );

			// Test if the supplied format is even a valid PHP date format:
			if ( \DateTime::createFromFormat( $dateTimeFormat, $value ) === false ) {
				// Geneate a validation rule for the supplied format so we can at least enforce it to a date format:
				$ruleRegexp		=	preg_replace_callback( '/([\w]+)/i', function( array $matches ) {
										return '\d{' . strlen( $matches[1] ) . ',' . strlen( $matches[1] ) . '}';
									},
									$dateTimeFormat );

				cbValidator::addRule( $this->control_name( $control_name, $name ), "return this.optional( element ) || /^$ruleRegexp$/i.test( value );", CBTxt::T( 'VALIDATION_ERROR_FIELD_DATE', 'Please enter a valid date.' ) );

				$validation		=	cbValidator::getRuleHtmlAttributes( $this->control_name( $control_name, $name ) );

				// Format is not valid so lets treat it like a text field:
				return $this->textfield( $name, $value, $node, $control_name, array(), $validation ) . ( ! $this->_view ? ' <span>(' . $dateTimeFormat . ')</span>' : null );
			}
		}

		$timeZone				=	$node->attributes( 'timezone' );
		$adaptTimeZone			=	( $timeZone == 'RAW' ? false : true );

		if ( $this->_view ) {
			if ( $adaptTimeZone && $timeZone ) {
				// Date needs to be timezone adjusted and a timezone has been supplied so send it for usage:
				$content		=	cbFormatDate( $value, $adaptTimeZone, $showTime, $dateFormat, $timeFormat, $timeZone );
			} else {
				// Date may or may not need to be timezone adjusted; send result of $adaptTimeZone and use global timezone:
				$content		=	cbFormatDate( $value, $adaptTimeZone, $showTime, $dateFormat, $timeFormat );
			}
		} else {
			$calendarType		=	(int) $node->attributes( 'calendartype' );
			$minYear			=	$node->attributes( 'minyear' );
			$maxYear			=	$node->attributes( 'maxyear' );
			$validate			=	$node->attributes( 'validate' );

			if ( $validate && in_array( 'required', explode( ',', $validate ) ) ) {
				$required		=	true;
			} else {
				$required		=	false;
			}

			$calendars			=	new cbCalendars( $_CB_framework->getUi(), $calendarType, $dateFormat, $timeFormat );

			$attributes			=	$this->getTooltipAttr( $node, 'data-hascbtooltip="true"' );

			$content			=	$calendars->cbAddCalendar( $this->control_name( $control_name, $name ), '', $required, $value, false, (bool) $showTime, $minYear, $maxYear, $attributes, $adaptTimeZone, ( $adaptTimeZone && $timeZone ? $timeZone : null ) );
		}

		return $content;
	}
Example #21
0
</div>
						</a>
						<div class="media-body">
							<h4 class="cbFeedItemTitle media-heading"><a href="<?php 
        echo htmlspecialchars($item->link);
        ?>
" target="_blank"><strong><?php 
        echo $item->title;
        ?>
</strong></a></h4>
							<div class="cbFeedItemDesc"><?php 
        echo modCBAdminHelper::shortDescription($item->description, 200);
        ?>
</div>
							<small class="cbFeedItemDate"><?php 
        echo cbFormatDate($item->pubDate, true, 'timeago');
        ?>
</small>
						</div>
					</div>
				</div>
			<?php 
        if ($feedEntries) {
            if ($itemCount >= $feedEntries && $index + 1 != count($items)) {
                ?>
<button type="button" class="btn btn-primary btn-lg btn-block cbFeedShowMore"><?php 
                echo CBTxt::T('More');
                ?>
</button><?php 
                $itemCount = 0;
            }
Example #22
0
	/**
	 * render frontend tab invites
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param moscomprofilerUser $displayed
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @param boolean $tabbed
	 * @return mixed
	 */
	static function showInvites( $rows, $pageNav, $displayed, $user, $plugin, $tabbed ) {
		global $_CB_framework;

		$invitesTabSearch			=	$plugin->params->get( 'invites_tab_search', 1 );
		$invitesTabPaging			=	$plugin->params->get( 'invites_tab_paging', 1 );
		$invitesTabLimitbox			=	$plugin->params->get( 'invites_tab_limitbox', 1 );

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

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

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

			foreach ( $rows as $row ) {
				$group				=	$row->getGroup();
				$category			=	$group->getCategory();

				if ( $row->get( 'user' ) ) {
					$userAvatar		=	$row->getInvitedAvatar( true );
					$userName		=	$row->getInvitedName( true );
					$userOnline		=	$row->getInvitedOnline();
				} else {
					$userAvatar		=	'<img src="' . selectTemplate() . 'images/avatar/tnnophoto_n.png" alt="' . htmlspecialchars( $row->get( 'email' ) ) . '" title="' . htmlspecialchars( $row->get( 'email' ) ) . '" />';
					$userName		=	'******' . htmlspecialchars( $row->get( 'email' ) ) . '">' . htmlspecialchars( $row->get( 'email' ) ) . '</a>';
					$userOnline		=	null;
				}

				$menuItems			=	cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInviteMenu', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.	'<div><a href="javascript: void(0);" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'delete', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), CBTxt::T( 'Are you sure you want to delete this invite?' ) ) . '"><i class="icon-remove"></i> ' . CBTxt::Th( 'Delete' ) . '</a></div>'
									.	cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInviteMenu', array( $row, $group, $category, $displayed, $user, $plugin ) );

				$return				.=			'<div class="gjContentBox mini-layout">'
									.				'<div class="gjContentBoxRow">' . $userName . '</div>'
									.				'<div class="gjContentBoxRow">' . $userAvatar . '</div>'
									.				( $userOnline ? '<div class="gjContentBoxRow">' . $userOnline . '</div>' : null )
									.				'<div class="gjContentBoxRow">' . $group->getName( 0, true ) . '</div>'
									.				'<div class="gjContentBoxRow">' . $category->getName( 0, true ) . '</div>'
									.				'<div class="gjContentBoxRow">'
									.					cbgjClass::getIntegrations( 'gj_onBeforeProfileGroupInviteInfo', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.					'<span title="' . cbFormatDate( $row->get( 'invited' ), 1, false ) . ( $row->isAccepted() ? ' - ' . cbFormatDate( $row->get( 'accepted' ), 1, false ) : null ) . '">' . $row->getStatus() . '</span>'
									.					cbgjClass::getIntegrations( 'gj_onAfterProfileGroupInviteInfo', array( $row, $group, $category, $displayed, $user, $plugin ) )
									.				'</div>';

				if ( ( ! $row->isAccepted() ) && ( $row->dateDifference() >= 5 ) ) {
					$return			.=				'<div class="gjContentBoxRow">'
									.					'<input type="button" value="' . htmlspecialchars( CBTxt::Th( 'Resend' ) ) . '" class="gjButton btn btn-mini btn-success" onclick="' . cbgjClass::getPluginURL( array( 'invites', 'send', (int) $category->get( 'id' ), (int) $group->get( 'id' ), (int) $row->get( 'id' ) ), true ) . '" />'
									.				'</div>';
				}

				$return				.=				'<div class="gjContentBoxRow">'
									.					cbgjClass::getDropdown( $menuItems, CBTxt::Th( 'Menu' ) )
									.				'</div>';

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

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

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

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

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

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

		return $return;
	}
Example #23
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;
	}
Example #24
0
	/**
	 * render frontend users
	 *
	 * @param object $rows
	 * @param object $pageNav
	 * @param cbgjCategory $category
	 * @param cbgjGroup $group
	 * @param moscomprofilerUser $user
	 * @param object $plugin
	 * @return string
	 */
	static function showUsers( $rows, $pageNav, $category, $group, $user, $plugin ) {
		$groupUsersSearch		=	$plugin->params->get( 'group_users_search', 1 );
		$groupUsersPaging		=	$plugin->params->get( 'group_users_paging', 1 );
		$groupUsersLimitbox		=	$plugin->params->get( 'group_users_limitbox', 1 );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		return $return;
	}
Example #25
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 #26
0
 /**
  * Returns a USERPARAMS field in specified format
  *
  * @param  FieldTable  $field
  * @param  UserTable   $user
  * @param  string      $output      'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit'
  * @param  string      $formatting  'table', 'td', 'span', 'div', 'none'
  * @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 getFieldRow(&$field, &$user, $output, $formatting, $reason, $list_compare_types)
 {
     global $_CB_framework, $ueConfig;
     $results = null;
     if (class_exists('JFactory')) {
         // Joomla 1.5 :
         $lang = JFactory::getLanguage();
         $lang->load('com_users');
     }
     $pseudoFields = array();
     //Implementing Joomla's new user parameters such as editor
     $ui = $_CB_framework->getUi();
     $userParams = $this->_getUserParams($ui, $user);
     if (is_array($userParams) && count($userParams) > 0 && ($ui == 2 || (isset($ueConfig['frontend_userparams']) ? $ueConfig['frontend_userparams'] == 1 : in_array($_CB_framework->getCfg('frontend_userparams'), array('1', null))))) {
         if ($ui == 1) {
             $excludeParams = explode('|*|', $field->params->get('hide_userparams'));
         } else {
             $excludeParams = array();
         }
         //Loop through each parameter and prepare rendering appropriately.
         foreach ($userParams as $k => $userParam) {
             if (checkJversion() >= 2) {
                 $nameId = isset($userParam[4]) ? $userParam[4] : null;
             } else {
                 $nameId = isset($userParam[5]) ? $userParam[5] : null;
             }
             if (!$excludeParams || !$nameId || $nameId && !in_array($nameId, $excludeParams)) {
                 $paramField = new FieldTable($field->getDbo());
                 $paramField->title = $userParam[0];
                 $paramField->_html = $userParam[1];
                 $paramField->description = isset($userParam[2]) && class_exists("JText") ? JText::_($userParam[2]) : null;
                 $paramField->name = isset($userParam[3]) && class_exists("JText") ? JText::_($userParam[3]) : null;
                 // very probably wrong!
                 $paramField->fieldid = 'userparam_' . $k;
                 $paramField->type = 'param';
                 // this is for cb_ftparam class to be correct.
                 if (!preg_match('/<(?:input|select|textarea)[^>]*class[^>]*>/i', $paramField->_html)) {
                     $paramField->_html = preg_replace('/<(input|select|textarea)/i', '<$1 class="form-control"', $paramField->_html);
                 }
                 $pseudoFields[] = $paramField;
             }
         }
     }
     if ($ui == 2) {
         $i_am_super_admin = Application::MyUser()->isSuperAdmin();
         $canBlockUser = Application::MyUser()->isAuthorizedToPerformActionOnAsset('core.edit.state', 'com_users');
         $canEmailEvents = $user->id == 0 && $canBlockUser || Application::User((int) $user->id)->isAuthorizedToPerformActionOnAsset('core.edit.state', 'com_users') || Application::User((int) $user->id)->canViewAccessLevel(Application::Config()->get('moderator_viewaccesslevel', 3, \CBLib\Registry\GetterInterface::INT));
         $lists = array();
         if ($canBlockUser) {
             // ensure user can't add group higher than themselves
             $gtree = $_CB_framework->acl->get_groups_below_me();
             if (!$i_am_super_admin && $user->id && Application::User((int) $user->id)->isAuthorizedToPerformActionOnAsset('core.manage', 'com_users') && (Application::User((int) $user->id)->isAuthorizedToPerformActionOnAsset('core.edit', 'com_users') || Application::User((int) $user->id)->isAuthorizedToPerformActionOnAsset('core.edit.state', 'com_users'))) {
                 $disabled = ' disabled="disabled"';
             } else {
                 $disabled = '';
             }
             if ($user->id) {
                 $strgids = array_map('strval', Application::User((int) $user->id)->getAuthorisedGroups(false));
             } else {
                 $strgids = (string) $_CB_framework->getCfg('new_usertype');
             }
             $lists['gid'] = moscomprofilerHTML::selectList($gtree, 'gid[]', 'class="form-control" size="11" multiple="multiple"' . $disabled, 'value', 'text', $strgids, 2, false, null, false);
             // build the html select list
             $lists['block'] = moscomprofilerHTML::yesnoSelectList('block', 'class="form-control"', (string) $user->block);
             $list_banned = array();
             $list_banned[] = moscomprofilerHTML::makeOption('1', CBTxt::T('Banned'));
             $list_banned[] = moscomprofilerHTML::makeOption('2', CBTxt::T('Pending'));
             $list_banned[] = moscomprofilerHTML::makeOption('0', CBTxt::T('Active'));
             $lists['banned'] = moscomprofilerHTML::selectList($list_banned, 'banned', 'class="form-control"', 'value', 'text', (string) $user->banned, 2, false, null, false);
             $list_approved = array();
             $list_approved[] = moscomprofilerHTML::makeOption('2', CBTxt::T('Rejected'));
             $list_approved[] = moscomprofilerHTML::makeOption('0', CBTxt::T('Pending'));
             $list_approved[] = moscomprofilerHTML::makeOption('1', CBTxt::T('Approved'));
             $lists['approved'] = moscomprofilerHTML::selectList($list_approved, 'approved', 'class="form-control"', 'value', 'text', (string) $user->approved, 2, false, null, false);
             $lists['confirmed'] = moscomprofilerHTML::yesnoSelectList('confirmed', 'class="form-control"', (string) $user->confirmed, CBTxt::T('Confirmed'), CBTxt::T('Pending'));
             // build the html select list
             $lists['sendEmail'] = moscomprofilerHTML::yesnoSelectList('sendEmail', 'class="form-control"', (string) $user->sendEmail);
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Group';
             // For translation parser:  CBTxt::T( 'Group' );
             $paramField->_html = $lists['gid'];
             $paramField->description = '';
             $paramField->name = 'gid';
             $pseudoFields[] = $paramField;
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Block User';
             // For translation parser:  CBTxt::T( 'Block User' );
             $paramField->_html = $lists['block'];
             $paramField->description = '';
             $paramField->name = 'block';
             $pseudoFields[] = $paramField;
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Approve User';
             // For translation parser:  CBTxt::T( 'Approve User' );
             $paramField->_html = $lists['approved'];
             $paramField->description = '';
             $paramField->name = 'approved';
             $pseudoFields[] = $paramField;
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Confirm User';
             // For translation parser:  CBTxt::T( 'Confirm User' );
             $paramField->_html = $lists['confirmed'];
             $paramField->description = '';
             $paramField->name = 'confirmed';
             $pseudoFields[] = $paramField;
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Ban User';
             // For translation parser:  CBTxt::T( 'Ban User' );
             $paramField->_html = $lists['banned'];
             $paramField->description = '';
             $paramField->name = 'banned';
             $pseudoFields[] = $paramField;
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Receive Moderator Emails';
             // For translation parser:  CBTxt::T( 'Receive Moderator Emails' );
             if ($canEmailEvents || $user->sendEmail) {
                 $paramField->_html = $lists['sendEmail'];
             } else {
                 $paramField->_html = CBTxt::T('No (User\'s group-level doesn\'t allow this)') . '<input type="hidden" name="sendEmail" value="0" />';
             }
             $paramField->description = '';
             $paramField->name = 'sendEmail';
             $pseudoFields[] = $paramField;
         }
         if ($user->id) {
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Register Date';
             // For translation parser:  CBTxt::T( 'Register Date' );
             $paramField->_html = cbFormatDate($user->registerDate);
             $paramField->description = '';
             $paramField->name = 'registerDate';
             $pseudoFields[] = $paramField;
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Last Visit Date';
             // For translation parser:  CBTxt::T( 'Last Visit Date' );
             $paramField->_html = cbFormatDate($user->lastvisitDate);
             $paramField->description = '';
             $paramField->name = 'lastvisitDate';
             $pseudoFields[] = $paramField;
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Last Reset Time';
             // For translation parser:  CBTxt::T( 'Last Reset Time' );
             $paramField->_html = cbFormatDate($user->lastResetTime);
             $paramField->description = '';
             $paramField->name = 'lastResetTime';
             $pseudoFields[] = $paramField;
             $paramField = new FieldTable($field->getDbo());
             $paramField->title = 'Password Reset Count';
             // For translation parser:  CBTxt::T( 'Password Reset Count' );
             $paramField->_html = (int) $user->resetCount;
             $paramField->description = '';
             $paramField->name = 'resetCount';
             $pseudoFields[] = $paramField;
         }
     }
     switch ($output) {
         case 'htmledit':
             foreach ($pseudoFields as $paramField) {
                 $paramField->required = $this->_isRequired($field, $user, $reason);
                 $paramField->profile = $field->profile;
                 $paramField->params = $field->params;
                 $results .= parent::getFieldRow($paramField, $user, $output, $formatting, $reason, $list_compare_types);
             }
             unset($pseudoFields);
             return $results;
             break;
         default:
             return null;
             break;
     }
 }
	/**
	 * Get a correct display of the formatted validity of a plan: override if needed
	 *
	 * @return string                     Formatted text giving validity of this subscription
	 */
	public function getFormattedExpirationDateText() {
		$params					=&	cbpaidApp::settingsParams();

		$expDate				=	$this->getExpiryDate();
		if ( $expDate === null ) {
			$text				=	CBPTXT::T( $params->get( 'regtextLifetime', 'Lifetime Subscription' ) );
		} else {
			$showtime			=	( $params->get( 'showtime', '1' ) == '1' );
			$dateFormatted		=	cbFormatDate( $this->expiry_date, 1, $showtime );

			if ( $expDate !== false ) {
				$text			=	$dateFormatted;
			} else {
				//TODO merge with drawSubscriptionNameDescription
				switch ( $this->status ) {
					case 'X':
						$text	=	CBPTXT::T('Expired %s');
						break;
					case 'U':
						$text	=	CBPTXT::T('Upgraded %s');
						break;
					case 'C':
						$text	=	CBPTXT::T('Unsubscribed %s');
						break;
					case 'R':
						$subTxt	=	CBPTXT::T( $params->get( 'subscription_name', 'subscription' ) );
						$text	=	sprintf( CBPTXT::T("%s not yet paid"), ucfirst( $subTxt ) );
						break;
					default:
						$subTxt	=	CBPTXT::T( $params->get( 'subscription_name', 'subscription' ) );
						$text	=	sprintf( CBPTXT::T("Unknown state of %s"), $subTxt );
						break;
				}
				$text			=	sprintf( $text, $dateFormatted );
			}
		}
		return $text;
	}
 /**
  * Renders the tooltip for a connection
  *
  * @param  \CB\Database\Table\MemberTable  $connection  Connection to render field tip for
  * @return string                                       HTML for the description of the connection
  */
 public static function renderConnectionToolTip($connection)
 {
     $tipField = CBTxt::Th('CONNECTION_TIP_CONNECTED_SINCE_CONNECTION_DATE', 'Connected Since [CONNECTION_DATE]', array('[CONNECTION_DATE]' => cbFormatDate($connection->membersince)));
     if ($connection->type != null) {
         $tipField .= '<br />' . CBTxt::Th('CONNECTION_TIP_TYPES_LIST', '{1} Type: [CONNECTIONS_TYPES]|]1,Inf] Types: [CONNECTIONS_TYPES]|%%COUNT%%', array('%%COUNT%%' => count(explode("|*|", $connection->type)), '[CONNECTIONS_TYPES]' => getConnectionTypes($connection->type)));
     }
     if ($connection->description != null) {
         $tipField .= '<br />' . CBTxt::Th('CONNECTION_TIP_CONNECTION_COMMENT', 'Comment: [CONNECTION_DESCRIPTION]', array('[CONNECTION_DESCRIPTION]' => htmlspecialchars($connection->description)));
     }
     return $tipField;
 }
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 CommentTable[]  $rows
	 * @param Comments        $stream
	 * @param int             $output 0: Normal, 1: Raw, 2: Inline, 3: Load, 4: Save
	 * @param UserTable       $user
	 * @param UserTable       $viewer
	 * @param cbPluginHandler $plugin
	 * @return null|string
	 */
	static public function showComments( $rows, $stream, $output, $user, $viewer, $plugin )
	{
		global $_CB_framework, $_PLUGINS;

		CBActivity::loadHeaders( $output );

		$_CB_framework->outputCbJQuery( "$( '.commentsStream' ).cbactivity();" );

		$canCreate						=	CBActivity::canCreate( $user, $viewer, $stream );
		$cbModerator					=	CBActivity::isModerator( (int) $viewer->get( 'id' ) );
		$sourceClean					=	htmlspecialchars( $stream->source() );
		$newForm						=	null;
		$moreButton						=	null;

		if ( ( $output != 4 ) && $stream->get( 'paging' ) && $stream->get( 'limit' ) && $rows ) {
			$moreButton					=	'<a href="' . $stream->endpoint( 'show', array( 'limitstart' => ( $stream->get( 'limitstart' ) + $stream->get( 'limit' ) ), 'limit' => $stream->get( 'limit' ) ) ) . '" class="commentButton commentButtonMore streamMore">' . ( $stream->get( 'type' ) == 'comment' ? CBTxt::T( 'Show more replies' ) : CBTxt::T( 'Show more comments' ) ) . '</a>';
		}

		$return							=	null;

		$_PLUGINS->trigger( 'activity_onBeforeDisplayComments', array( &$return, &$rows, $stream, $output ) );

		if ( ! in_array( $output, array( 1, 4 ) ) ) {
			$return						.=	'<div class="' . $sourceClean . 'Comments commentsStream streamContainer ' . ( $stream->direction() ? 'streamContainerUp' : 'streamContainerDown' ) . '" data-cbactivity-stream="' . base64_encode( (string) $stream ) . '" data-cbactivity-direction="' . (int) $stream->direction() . '">';

			if ( ( $stream->source() != 'hidden' ) && ( ! $stream->get( 'id' ) ) && ( ! $stream->get( 'filter' ) ) ) {
				$newForm				=	self::showNew( $stream, $output, $user, $viewer, $plugin );
			}
		}

		$return							.=		( $stream->direction() ? $moreButton : $newForm )
										.		( ! in_array( $output, array( 1, 4 ) ) ? '<div class="' . $sourceClean . 'CommentsItems commentsStreamItems streamItems">' : null );

		if ( $rows ) foreach ( $rows as $row ) {
			$rowId						=	$stream->id() . '_' . (int) $row->get( 'id' );
			$rowOwner					=	( $viewer->get( 'id' ) == $row->get( 'user_id' ) );
			$typeClass					=	( $row->get( 'type' ) ? ucfirst( strtolower( preg_replace( '/[^-a-zA-Z0-9_]/', '', $row->get( 'type' ) ) ) ) : null );
			$subTypeClass				=	( $row->get( 'subtype' ) ? ucfirst( strtolower( preg_replace( '/[^-a-zA-Z0-9_]/', '', $row->get( 'subtype' ) ) ) ) : null );

			$cbUser						=	CBuser::getInstance( (int) $row->get( 'user_id' ), false );
			$message					=	( $row->get( 'message' ) ? htmlspecialchars( $row->get( 'message' ) ) : null );
			$date						=	null;
			$insert						=	null;
			$footer						=	null;
			$menu						=	array();
			$extras						=	array();

			$_PLUGINS->trigger( 'activity_onDisplayComment', array( &$row, &$message, &$insert, &$date, &$footer, &$menu, &$extras, $stream, $output ) );

			$message					=	$stream->parser( $message )->parse( array( 'linebreaks' ) );

			if ( ( $stream->source() != 'hidden' ) && $stream->get( 'replies' ) && ( $row->get( '_comments' ) !== false ) ) {
				if ( $newForm ) {
					$date				.=	( $date ? ' ' : null ) . '<span class="streamToggle streamToggleReplies" data-cbactivity-toggle-target=".commentContainerNew" data-cbactivity-toggle-close="false" data-cbactivity-toggle-filter="false" data-cbactivity-toggle-active-classes="hidden">- <a href="javascript: void(0);">' . CBTxt::T( 'Reply' ) . '</a></span>';
				}

				$replies				=	$row->replies( $stream->source(), $stream->user() );

				if ( $replies ) {
					CBActivity::loadStreamDefaults( $replies, $stream );

					$replies->set( 'replies', 0 );

					$footer				.=	$replies->stream( true, ( $row->get( '_comments' ) ? true : false ) );
				}
			}

			$return						.=		'<div id="' . $rowId . '" class="streamItem streamItemInline commentContainer' . ( $typeClass ? ' commentContainer' . $typeClass : null ) . ( $subTypeClass ? ' commentContainer' . $typeClass . $subTypeClass : null ) . '" data-cbactivity-id="' . (int) $row->get( 'id' ) . '">'
										.			'<div class="streamItemInner streamMedia media clearfix">'
										.				'<div class="streamMediaLeft commentContainerLogo media-left">'
										.					$cbUser->getField( 'avatar', null, 'html', 'none', 'list', 0, true )
										.				'</div>'
										.				'<div class="streamMediaBody streamItemDisplay commentContainerContent media-body">'
										.					'<div class="commentContainerContentInner cbMoreLess text-small" data-cbmoreless-height="50">'
										.						'<div class="streamItemContent cbMoreLessContent">'
										.							'<strong>' . $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) . '</strong>'
										.							( $message ? ' ' . $message : null )
										.						'</div>'
										.						'<div class="cbMoreLessOpen fade-edge hidden">'
										.							'<a href="javascript: void(0);" class="cbMoreLessButton">' . CBTxt::T( 'See More' ) . '</a>'
										.						'</div>'
										.					'</div>'
										.					( $insert ? '<div class="commentContainerContentInsert">' . $insert . '</div>' : null )
										.					'<div class="commentContainerContentDate text-muted text-small">'
										.						cbFormatDate( $row->get( 'date' ), true, 'timeago' )
										.						( $row->params()->get( 'modified' ) ? ' <span class="streamIconEdited fa fa-edit" title="' . htmlspecialchars( CBTxt::T( 'Edited' ) ) . '"></span>' : null )
										.						( $date ? ' ' . $date : null )
										.					'</div>'
										.					( $footer ? '<div class="commentContainerContentFooter">' . $footer . '</div>' : null )
										.				'</div>';

			if ( ( $cbModerator || $rowOwner ) && $canCreate ) {
				$return					.=				self::showEdit( $row, $stream, $output, $user, $viewer, $plugin );
			}

			if ( $cbModerator || $rowOwner || ( $viewer->get( 'id' ) && ( ! $rowOwner ) ) || $menu ) {
				$menuItems				=	'<ul class="streamItemMenuItems commentMenuItems dropdown-menu" style="display: block; position: relative; margin: 0;">';

				if ( ( $cbModerator || $rowOwner ) && $canCreate ) {
					$menuItems			.=		'<li class="streamItemMenuItem commentMenuItem"><a href="javascript: void(0);" class="commentMenuItemEdit streamItemEditDisplay" data-cbactivity-container="#' . $rowId . '"><span class="fa fa-edit"></span> ' . CBTxt::T( 'Edit' ) . '</a></li>';
				}

				if ( $viewer->get( 'id' ) && ( ! $rowOwner ) ) {
					if ( $stream->source() == 'hidden' ) {
						$menuItems		.=		'<li class="streamItemMenuItem commentMenuItem"><a href="' . $stream->endpoint( 'unhide', array( 'id' => (int) $row->get( 'id' ) ) ) . '" class="commentMenuItemUnhide streamItemAction" data-cbactivity-container="#' . $rowId . '"><span class="fa fa-check"></span> ' . CBTxt::T( 'Unhide' ) . '</a></li>';
					} else {
						$menuItems		.=		'<li class="streamItemMenuItem commentMenuItem"><a href="' . $stream->endpoint( 'hide', array( 'id' => (int) $row->get( 'id' ) ) ) . '" class="commentMenuItemHide streamItemAction" data-cbactivity-container="#' . $rowId . '" data-cbactivity-confirm="' . htmlspecialchars( CBTxt::T( 'Are you sure you want to hide this Comment?' ) ) . '" data-cbactivity-confirm-button="' . htmlspecialchars( CBTxt::T( 'Hide Comment' ) ) . '"><span class="fa fa-times"></span> ' . CBTxt::T( 'Hide' ) . '</a></li>';
					}
				}

				if ( $cbModerator || $rowOwner ) {
					$menuItems			.=		'<li class="streamItemMenuItem commentMenuItem"><a href="' . $stream->endpoint( 'delete', array( 'id' => (int) $row->get( 'id' ) ) ) . '" class="commentMenuItemDelete streamItemAction" data-cbactivity-container="#' . $rowId . '" data-cbactivity-confirm="' . htmlspecialchars( CBTxt::T( 'Are you sure you want to delete this Comment?' ) ) . '" data-cbactivity-confirm-button="' . htmlspecialchars( CBTxt::T( 'Delete Comment' ) ) . '"><span class="fa fa-trash-o"></span> ' . CBTxt::T( 'Delete' ) . '</a></li>';
				}

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

				$menuItems				.=	'</ul>';

				$menuAttr				=	cbTooltip( 1, $menuItems, null, 'auto', null, null, null, 'class="fa fa-chevron-down text-muted" data-cbtooltip-menu="true" data-cbtooltip-classes="qtip-nostyle" data-cbtooltip-open-classes="open"' );

				$return					.=				'<div class="streamItemMenu commentContainerMenu small">'
										.					'<span ' . trim( $menuAttr ) . '></span>'
										.				'</div>';
			}

			$return						.=			'</div>'
										.		'</div>';
		} elseif ( $output != 2 ) {
			$return						.=		'<div class="streamItemEmpty text-center text-muted small">';

			if ( $output == 1 ) {
				$return					.=			CBTxt::T( 'No more comments to display.' );
			} else {
				$return					.=			CBTxt::T( 'No comments to display.' );
			}

			$return						.=		'</div>';
		} elseif ( ( $output == 2 ) && ( ! $newForm ) ) {
			return null;
		}

		$return							.=		( ! in_array( $output, array( 1, 4 ) ) ? '</div>' : null )
										.		( ! $stream->direction() ? $moreButton : $newForm )
										.	( ! in_array( $output, array( 1, 4 ) ) ? '</div>' : null )
										.	CBActivity::reloadHeaders( $output );

		$_PLUGINS->trigger( 'activity_onAfterDisplayComments', array( &$return, $rows, $stream, $output ) );

		return $return;
	}