Example #1
0
function cs_ajax_user_popover()
{
    $handle_id = qa_post_text('handle');
    $handle = qa_post_text('handle');
    require_once QA_INCLUDE_DIR . 'qa-db-users.php';
    if (isset($handle)) {
        $userid = qa_handle_to_userid($handle);
        //$badges = cs_user_badge($handle);
        if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
            $userid = qa_handle_to_userid($handle);
            $cover = get_user_meta($userid, 'cover');
            $cover = $cover[0];
        } else {
            $data = cs_user_data($handle);
        }
        ?>
		<div id="<?php 
        echo $userid;
        ?>
_popover" class="user-popover">
			<div class="counts clearfix">
				<div class="points">
					<?php 
        echo '<span>' . $data['points'] . '</span>Points';
        ?>
				</div>
				<div class="qcount">
					<?php 
        echo '<span>' . $data['qposts'] . '</span>Questions';
        ?>
				</div>
				<div class="acount">
					<?php 
        echo '<span>' . $data['aposts'] . '</span>Answers';
        ?>
				</div>
				<div class="ccount">
					<?php 
        echo '<span>' . $data['cposts'] . '</span>Comments';
        ?>
				</div>
			</div>
			<div class="bottom">	
				<div class="avatar pull-left"><?php 
        echo cs_get_avatar($handle, 30);
        ?>
</div>
				<span class="name"><?php 
        echo cs_name($handle);
        ?>
</span>				
				<span class="level"><?php 
        echo qa_user_level_string($data['level']);
        ?>
</span>				
			</div>
		</div>	
		<?php 
    }
    die;
}
Example #2
0
    function ranking($ranking)
    {
        $this->part_title($ranking);
        $class = @$ranking['type'] == 'users' ? 'qa-top-users' : 'qa-top-tags';
        $rows = min($ranking['rows'], count($ranking['items']));
        if (@$ranking['type'] == 'users') {
            $this->output('<div class="page-users-list clearfix">');
            /* if($ranking['items'])
               $columns=ceil(count($ranking['items'])/$rows); */
            if ($ranking['items']) {
                foreach ($ranking['items'] as $user) {
                    if (isset($user['raw'])) {
                        $handle = $user['raw']['handle'];
                    } else {
                        $handle = ltrim(strip_tags($user['label']));
                    }
                    $data = cs_user_data($handle);
                    $avatar = cs_get_avatar($handle, 150, false);
                    $this->output('
							<div class="user-card">
							<div class="user-card-inner">	
								<div class="card-container">
								' . (isset($avatar) ? '
									<div class="f1_card">
										<div class="front face">
											<img class="avatar" height="150" src="' . $avatar . '" />
										</div>
										<div class="back face center">
											<span class="activity q"><i>' . $data['qposts'] . '</i>' . qa_lang_html('cleanstrap/questions') . ' </span>
											<span class="activity a"><i>' . $data['aposts'] . '</i>' . qa_lang_html('cleanstrap/answers') . ' </span>
											<span class="activity c"><i>' . $data['cposts'] . '</i>' . qa_lang_html('cleanstrap/comments') . ' </span>
										</div>
									</div>
									' : '
									<div class="card-metas center">
										<span class="activity q"><i>' . $data['qposts'] . '</i>' . qa_lang_html('cleanstrap/questions') . ' </span>
										<span class="activity a"><i>' . $data['aposts'] . '</i>' . qa_lang_html('cleanstrap/answers') . ' </span>
										<span class="activity c"><i>' . $data['cposts'] . '</i>' . qa_lang_html('cleanstrap/comments') . ' </span>
									</div>													
								') . '
								</div>	
								<div class="card-bottom">
								<a class="user-name" href="' . qa_path_html('user/' . $handle) . '">' . cs_name($handle) . '</a>								
								<span class="score">' . $data['points'] . qa_lang_html('cleanstrap/points') . ' </span>
								</div>');
                    if (qa_opt('badge_active') && function_exists('qa_get_badge_list')) {
                        $this->output('<td class="badge-list">' . cs_user_badge($handle) . '</td>');
                    }
                    $this->output('</div>');
                    $this->output('</div>');
                }
            } else {
                $this->output('
							<div class="no-items">
								<h3 class="icon-sad">' . qa_lang_html('cleanstrap/no_users') . '</h3>
								<p>' . qa_lang_html('cleanstrap/edit_user_detail') . '</p>
							</div>');
            }
            $this->output('</div>');
        } elseif (@$ranking['type'] == 'tags') {
            if ($rows > 0) {
                $this->output('<div class="row ' . $class . '">');
                $columns = ceil(count($ranking['items']) / $rows);
                for ($column = 0; $column < $columns; $column++) {
                    $this->set_context('ranking_column', $column);
                    $this->output('<div class="col-lg-' . ceil(12 / $columns) . '">');
                    $this->output('<ul>');
                    for ($row = 0; $row < $rows; $row++) {
                        $this->set_context('ranking_row', $row);
                        $this->cs_tags_item(@$ranking['items'][$column * $rows + $row], $class, $column > 0);
                    }
                    $this->clear_context('ranking_column');
                    $this->output('</ul>');
                    $this->output('</div>');
                }
                $this->clear_context('ranking_row');
                $this->output('</div>');
            } else {
                $this->output('
					<div class="no-items">
					<h3 class="icon-sad">' . qa_lang('cleanstrap/no_tags') . '</h3>
					<p>' . qa_lang('cleanstrap/no_results_detail') . '</p>
					</div>');
            }
        } else {
            if ($rows > 0) {
                $this->output('<table class="' . $class . '-table">');
                $columns = ceil(count($ranking['items']) / $rows);
                for ($row = 0; $row < $rows; $row++) {
                    $this->set_context('ranking_row', $row);
                    $this->output('<tr>');
                    for ($column = 0; $column < $columns; $column++) {
                        $this->set_context('ranking_column', $column);
                        $this->ranking_item(@$ranking['items'][$column * $rows + $row], $class, $column > 0);
                    }
                    $this->clear_context('ranking_column');
                    $this->output('</tr>');
                }
                $this->clear_context('ranking_row');
                $this->output('</table>');
            } else {
                $this->output('
						<div class="no-items">
							<h3 class="icon-sad">' . qa_lang_html('cleanstrap/no_results') . '</h3>
							<p>' . qa_lang_html('cleanstrap/no_results_detail') . '</p>
						</div>');
            }
        }
    }