<?php $notifications = $db->notifications; $n = $notifications->findOne(array("user" => $_SESSION['user'])); if (isset($n['count']) && $n['count'] > 0) { $badge = '<div class="badge">' . $n['count'] . '</div>'; } else { $badge = ""; } $menu = array("users/view/" . $_SESSION['user'] => '<span class="glyphicon glyphicon-user"></span> ' . $_SESSION['fb_name'], "profile/edit" => '<span class="glyphicon glyphicon-pencil"></span> ' . "Edit profile", "wall" => '<span class="glyphicon glyphicon-bell"></span> ' . "Notifications {$badge}", "travel_plan" => '<span class="glyphicon glyphicon-plane"></span> ' . "Your travel plans", "product_request" => '<span class="glyphicon glyphicon-briefcase"></span> ' . "Your product requests", "front_search" => '<span class="glyphicon glyphicon-search"></span> ' . "Search"); // hack otherwise it will not cache the profile picture and will load it every page $facebook_picture = getUserPicture($_SESSION['user']); $HTML[] = <<<EOF <div class="container-fluid"> \t<div class="row"> \t\t<div class="left-side col-sm-3"> \t\t\t<center> \t\t\t\t<img src="{$facebook_picture}" width="90%" class="circle"> \t\t\t</center> \t\t\t<ul class="side-bar-menu"> EOF; foreach ($menu as $k => $v) { $HTML[] = <<<EOF \t\t<li class="left-menu-color"><a href="?{$k}">{$v}</a> EOF; } $HTML[] = <<<EOF \t\t\t</ul> \t\t</div>
function generateUserPicture($userid, $class) { $pic = getUserPicture($userid); return <<<EOF \t<img src="{$pic}" class="{$class}"> EOF; }
$HTML[] = "<h4>No entries found</h4>"; } else { $HTML[] = "<h4>No entries found, try to change search terms</h4>"; $HTML[] = <<<EOF \t<div class="front-search front-search-extra"> \tor submit request for your product<br><br> \t<a href="?product_request/add" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span> SUBMIT NEW PRODUCT REQUEST</a> \t</div>\t EOF; } } else { foreach ($results_travelers as $k => $v) { $user = @getUser($v['user']); $user['first'] = generateUserLink($v['user']); $pic = getUserPicture($user['facebookid']); $v['from'] = "<a href='https://maps.google.com/?q={$v['from']}' target='_blank'>" . strtoupper($v['from']) . "</a>"; $v['to'] = "<a href='https://maps.google.com/?q={$v['to']}' target='_blank'>" . strtoupper($v['to']) . "</a>"; $v['date'] = convertDateTime($v['date'], false) . " - " . dateToRelative($v['date'], false); $tmp3 = empty($v['size']) ? "" : ""; $tmp4 = empty($v['weight']) ? "" : ""; // luggage type: <span class="glyphicon glyphicon-briefcase"></span> // info: <span class="glyphicon glyphicon-info-sign"></span> $tmp5 = "Created " . relativeTime($v['update']); $HTML[] = <<<EOF \t<div class="search-element"> \t\t<div class="search-profile"> \t\t\t<img src="{$pic}"> \t\t</div> \t\t<div class="search-description"> \t\t\t{$v['description']}
function getUserBasicInfo($uid) { $info = D('User')->find($uid); $basic['name'] = $info['name']; $basic['pic_square'] = getUserPicture($info['pic_square'], 'square'); return $basic; }