예제 #1
0
function ra_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 = ra_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 {
            $profile = ra_user_profile($handle);
            $cover = @$profile['cover'];
        }
        if (isset($cover)) {
            $image_file = explode('.', $cover);
            $cover = 'style="background:url(' . qa_opt('site_url') . 'images/' . @$image_file[0] . '_s.' . $image_file[1] . ') no-repeat scroll 0 0 / cover;"';
        }
        ?>
		<div id="<?php 
        echo $userid;
        ?>
_popover" class="user-popover">
			<div class="cover" <?php 
        echo @$cover;
        ?>
>
				<div class="avatar pull-left"><?php 
        echo ra_get_avatar($handle, 50);
        ?>
</div>
			</div>
			<div class="bar">		
				<span class="followers-count pull-right icon-star btn btn-warning"><?php 
        echo ra_user_followers_count($handle);
        ?>
</span>
				<h3 class="name"><?php 
        echo ra_name($handle);
        ?>
</h3>				
			</div>
			<div class="extra clearfix">
				<div class="points">
					<?php 
        echo '<span>' . ra_user_points($handle) . '</span>' . _ra_lang('P');
        ?>
				</div>
				<div class="badges">
					<?php 
        echo $badges;
        ?>
				</div>
			</div>
		</div>	
		<?php 
    }
    die;
}
예제 #2
0
    function sc_ra_user_cover()
    {
        if (qw_hook_exist(__FUNCTION__)) {
            $args = func_get_args();
            array_unshift($args, $this);
            return qw_event_hook(__FUNCTION__, $args, NULL);
        }
        if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
            require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
            $handle = qa_post_userid_to_handle($this->content['raw']['userid']);
            $userid = $this->content['raw']['userid'];
        } else {
            $handle = $this->content['raw']['account']['handle'];
            $userid = $this->content['raw']['account']['userid'];
        }
        $user = ra_user_data($handle);
        $profile = ra_user_profile($handle);
        ob_start();
        ?>
			<div class="user-top clearfix">
				<?php 
        if (qa_get_logged_in_userid() == $userid) {
            ?>
					<a id="upload-cover" class="btn btn-default"><?php 
            ra_lang('Change cover');
            ?>
</a>
				<?php 
        }
        ?>
				<div class="user-bar">
					<div class="avatar pull-left">
						<?php 
        echo ra_get_avatar($handle, 150);
        ?>
					</div>			
				</div>	
				<div class="user-bar-holder">
					<div class="user-stat pull-right">
						<ul>
							<li class="points"><?php 
        echo $user[0]['points'];
        ?>
 <span><?php 
        ra_lang('Points');
        ?>
</span></li>
							<li class="followers"><?php 
        ra_user_followers_count($handle, true);
        ?>
 <span><?php 
        ra_lang('Followers');
        ?>
</span></li>
						</ul>
					</div>
					<div class="user-nag">	
						<div class="user-buttons pull-right">
							<?php 
        $this->favorite();
        if (!defined('QA_WORDPRESS_INTEGRATE_PATH') && qa_opt('allow_private_messages') && qa_get_logged_in_userid() != $this->content['raw']['account']['userid'] && !($this->content['raw']['account']['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
            echo '<a class="btn btn-primary btn-sm icon-envelope-alt" href="' . qa_path_html('message/' . $handle) . '">' . _ra_lang('Send message') . '</a>';
        }
        ?>
						</div>
						<h3 class="user-name"><?php 
        echo ra_name($handle);
        ?>
</h3>				
					</div>
				</div>
			</div>
		<?php 
        $this->output(ob_get_clean());
    }
예제 #3
0
">
					<?php 
$context->ra_list_avatar($args, 40);
?>
				</a>			
			</div>
			<div class="answeredby">
				<a href="<?php 
echo qa_path_html('user/' . $handle);
?>
"><?php 
echo ra_name($handle);
?>
</a>
				<span class="points"><?php 
echo _ra_lang('Points') . '<span>' . ra_user_points($handle) . '</span>';
?>
</span>
			</div>
		</div>
		<div class="content-inner">
			<?php 
$context->error(@$args['error']);
$context->a_item_content($args);
$context->post_meta($args, 'qa-a-item');
?>
		</div>
		<?php 
if (isset($args['main_form_tags'])) {
    $context->output('<form ' . $args['main_form_tags'] . '>');
}
예제 #4
0
function get_user_activity($handle)
{
    $userid = qa_handle_to_userid($handle);
    require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    $loginuserid = qa_get_logged_in_userid();
    $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
    list($useraccount, $questions, $answerqs, $commentqs, $editqs) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_recent_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_activity')), qa_db_user_recent_a_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_c_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_edit_qs_selectspec($loginuserid, $identifier));
    if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) {
        // check the user exists
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
    //	Get information on user references
    $questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
    $questions = array_slice($questions, 0, qa_opt('page_size_activity'));
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false);
    $htmldefaults = qa_post_html_defaults('Q');
    $htmldefaults['whoview'] = false;
    $htmldefaults['voteview'] = false;
    $htmldefaults['avatarsize'] = 0;
    foreach ($questions as $question) {
        $qa_content[] = qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
    }
    $output = '<div class="widget user-activities">';
    $output .= '<h3 class="widget-title">' . ra_name($handle) . '\'s ' . _ra_lang('activities') . '</h3>';
    $output .= '<ul class="question-list">';
    if (isset($qa_content)) {
        foreach ($qa_content as $qs) {
            if ($qs['what'] == 'answered') {
                $icon = 'icon-chat-3 answered';
            } elseif ($qs['what'] == 'asked') {
                $icon = 'icon-question asked';
            } elseif ($qs['what'] == 'commented') {
                $icon = 'icon-chat-2 commented';
            } elseif ($qs['what'] == 'edited' || $qs['what'] == 'answer edited') {
                $icon = 'icon-edit edited';
            } elseif ($qs['what'] == 'closed') {
                $icon = 'icon-error closed';
            } elseif ($qs['what'] == 'answer selected') {
                $icon = 'icon-checked selected';
            } elseif ($qs['what'] == 'recategorized') {
                $icon = 'icon-folder-close recategorized';
            } else {
                $icon = 'icon-pin undefined';
            }
            $output .= '<li class="activity-item">';
            $output .= '<div class="type pull-left ' . $icon . '"></div>';
            $output .= '<div class="list-right">';
            $output .= '<h5 class="when"><a href="' . @$qs['what_url'] . '">' . $qs['what'] . '</a> ' . implode(' ', $qs['when']) . '</h5>';
            $output .= '<h5 class="what"><a href="' . $qs['url'] . '">' . $qs['title'] . '</a></h5>';
            $output .= '</div>';
            $output .= '</li>';
        }
    } else {
        $output .= '<li>' . _ra_lang('No activity yet.') . '</li>';
    }
    $output .= '</ul>';
    $output .= '</div>';
    return $output;
}