Ejemplo n.º 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;
}
Ejemplo n.º 2
0
">
				<a class="avatar-wrap" href="<?php 
echo qa_path_html('user/' . $handle);
?>
">
					<?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>
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
0
 function post_meta_who($post, $class)
 {
     if (qw_hook_exist(__FUNCTION__)) {
         $args = func_get_args();
         array_unshift($args, $this);
         return qw_event_hook(__FUNCTION__, $args, NULL);
     }
     if (isset($post['who'])) {
         $this->output('<span class="' . $class . '-who">');
         if (strlen(@$post['who']['prefix'])) {
             $this->output('<span class="' . $class . '-who-pad">' . $post['who']['prefix'] . '</span>');
         }
         if (isset($post['who']['data'])) {
             $handle = strip_tags($post['who']['data']);
             if ($post['who']['data'] == strip_tags($post['who']['data'])) {
                 $this->output('<span class="' . $class . '-who-data">' . $handle . '</span>');
             } else {
                 $name = ra_name($handle);
                 $this->output('<span class="' . $class . '-who-data"><a href="' . qa_path_html('user/' . $handle) . '">' . $name . '</a></span>');
             }
         }
         if (isset($post['who']['title'])) {
             $this->output('<span class="' . $class . '-who-title">' . $post['who']['title'] . '</span>');
         }
         // You can also use $post['level'] to get the author's privilege level (as a string)
         if (isset($post['who']['points'])) {
             $post['who']['points']['prefix'] = '(' . $post['who']['points']['prefix'];
             $post['who']['points']['suffix'] .= ')';
             $this->output_split($post['who']['points'], $class . '-who-points');
         }
         if (strlen(@$post['who']['suffix'])) {
             $this->output('<span class="' . $class . '-who-pad">' . $post['who']['suffix'] . '</span>');
         }
         $this->output('</span>');
     }
 }
Ejemplo n.º 5
0
				<?php 
    echo $context->qw_notification_btn();
    ?>
			</li>
			<li id="user-nag">
				<a class="profile" href="<?php 
    echo qa_path_html('user/' . qa_get_logged_in_handle());
    ?>
">
				
					<img src="<?php 
    echo ra_get_avatar(qa_get_logged_in_handle(), 20, false);
    ?>
" />	
					<span><?php 
    echo ra_name(qa_get_logged_in_handle());
    ?>
</span>
					<span class="points"><?php 
    echo qa_get_logged_in_points();
    ?>
</span>
				</a>				
			</li>
			<li class="dropdown" id="menuLogin">
				<a class="dropdown-toggle user-tools" data-toggle="dropdown" href="#">
					<i class="icon-cog"></i>
				</a>
				
				<div class="dropdown-menu">				
					<ul class="user-nav">