Example #1
0
    public static function userCard($uid)
    {
        global $session;
        $userq = new User($uid);
        $user = $userq->get_user_info();
        $logged = $session->is_logged_in();
        if (!is_object($user)) {
            die("User was not found.");
        }
        if ($logged) {
            $is_frnd = $userq->is_friend($uid, USER_ID);
        }
        ob_start();
        ?>
			<div class='ui card'>
			<a class='ui image' href='<?php 
        echo BASE_URL . "user/{$user->id}";
        ?>
/'>
				<img src='<?php 
        echo $user->img_path;
        ?>
'>
			</a>
			<div class='content'>
				<h3 class='header'><?php 
        echo SELF::user($user->id);
        ?>
				<?php 
        if ($logged && $is_frnd) {
            ?>
					<i title='You and <?php 
            echo $user->firstName;
            ?>
 are friends' class='mdi mdi-account-multiple' style='color: #1ed02d; margin-left:5px;'></i>
				<?php 
        }
        ?>
				</h3>
				<div class='meta'>
					<span class='username'>@<?php 
        echo $user->username;
        ?>
</span>
					<div class='user-points'>
						<a class='ui label' style='color:#04c704;' title='Total Points'>
						<i class='thumbs outline up icon'></i>
						<?php 
        echo User::get_user_points($uid);
        ?>
						</a>
					</div>
				</div>
			</div>
			<?php 
        if (!$logged) {
            ?>
				<a href='/login.php' class='ui button green'>Follow</a>
			<?php 
        } elseif ($uid === USER_ID) {
        } elseif (User::is_flw($uid, USER_ID) !== true) {
            ?>
			<button id='user_flw' user-id='<?php 
            echo $uid;
            ?>
' class='ui button green'>Follow</button>
			<?php 
        } else {
            ?>
				<button id='user_unflw' user-id='<?php 
            echo $uid;
            ?>
' class='ui button red'>Following</button>
			<?php 
        }
        ?>
		</div>
		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
    }
    ?>
				</div>
			</div>
			<?php 
}
?>
		</div>
		<div class="eleven wide column profile-body">
			<div class="user-interactions">

			</div>
			<div class="profile-info ui vertical padded segment">
				<div class="user-interactions">
				<?php 
if (User::is_flw($id, USER_ID)) {
    ?>
					<button class="ui button blue following" user-id="<?php 
    echo $id;
    ?>
" id="user_unflw">Following</button>
				<?php 
} else {
    ?>
					<button class="ui button green" user-id="<?php 
    echo $id;
    ?>
" id="user_flw">Follow</button>
				<?php 
}
?>