Permalink
Browse files

venue pages; nearby pages; stats

  • Loading branch information...
1 parent 66cb027 commit f4e68f56e915ec6bd28d675189923b80e5d1f540 straup committed Jul 6, 2012
View
@@ -220,6 +220,11 @@ q {
z-index:50;
}
+.marker-youarehere {
+ z-index: 100;
+ opacity:1;
+}
+
.marker-history-todo {
background-color:#adadad;
}
@@ -363,6 +368,12 @@ button {
margin: 0px;
}
+#venue_stats ul {
+ font-size: small;
+ padding: 0px;
+ margin: 0px;
+}
+
#venue_details ul {
font-size: small;
padding: 0px;
@@ -155,6 +155,33 @@ function privatesquare_checkins_for_user(&$user, $more=array()){
#################################################################
+ function privatesquare_checkins_statuses_for_user(&$user, $more=array()){
+
+ $cluster_id = $user['cluster_id'];
+ $enc_user = AddSlashes($user['id']);
+
+ $sql = "SELECT status_id, COUNT(id) AS cnt FROM PrivatesquareCheckins WHERE user_id='{$enc_user}'";
+
+ if (isset($more['venue_id'])){
+ $enc_venue = AddSlashes($more['venue_id']);
+ $sql .= " AND venue_id='{$enc_venue}'";
+ }
+
+ $sql .= " GROUP BY status_id";
+
+ $rsp = db_fetch_users($cluster_id, $sql);
+
+ $stats = array();
+
+ foreach ($rsp['rows'] as $row){
+ $stats[$row['status_id']] = $row['cnt'];
+ }
+
+ return $stats;
+ }
+
+ #################################################################
+
function privatesquare_checkins_localities_for_user(&$user, $more=array()){
$defaults = array(
@@ -1,19 +1,19 @@
-{capture assign="page_title"}{$owner.username} | status | {$str_status}{if $venues.0.locality} | {$venues.0.locality.name|escape}{/if}{/capture}
+{capture assign="page_title"}{$owner.username} | lists | {$str_status}{if $woeid} | {$venues.0.locality.name|escape}{/if}{/capture}
{include file="inc_head.txt"}
<div id="displaymap" class="map" data-extent="{$geo_stats.bounding_box|@join:","|escape}" data-hash="false" data-interactive="false" data-provider="toner">
{include file="inc_map_header_markers.txt markers=$venues}
</div>
-<h3 class="header-right">{$str_status|escape}{if $venues.0.locality}, in {$venues.0.locality.name|escape}{/if}</h3>
+<h3 class="header-right">{$str_status|escape}{if $woeid}, in {$venues.0.locality.name|escape}{/if}</h3>
{foreach from=$venues item="row"}
<div class="checkin" data-venue="{$row.venue_id|escape}">
<h3 class="header-left">
<a href="{$row|@urls_venue}">{$row.venue.name|escape}</a>
- <span class="header-loc">{$row.created|date_format|escape}{if $row.locality}, in <a href="{$owner|@urls_foo_for_user}{$status_id|escape}/{$row.venue.locality|escape}/">{$row.locality.name|escape}</a>{/if}{if $row.count_checkins} &#8212; {if $row.count_checkins == 1}you've been here once since then{else}you've been here {$row.count_checkins|escape} times since{/if}{/if}</span>
+ <span class="header-loc">{$row.created|date_format|escape}{if $row.locality}, in <a href="{$owner|@urls_lists_for_user}{$status_id|escape}/{$row.venue.locality|escape}/">{$row.locality.name|escape}</a>{/if}{if $row.count_checkins} &#8212; {if $row.count_checkins == 1}you've been here once since then{else}you've been here {$row.count_checkins|escape} times since{/if}{/if}</span>
</h3>
<div class="map" data-zoom="14" data-center="{$row.latitude|escape},{$row.longitude|escape}" data-hash="false" data-interactive="false" data-provider="toner">
@@ -1,13 +1,14 @@
-{capture assign="page_title"}{$owner.username} | status | {$str_status}{if $venues.0.locality} | {$venues.0.locality.name|escape}{/if}{/capture}
+{capture assign="page_title"}{$owner.username} | status | {$str_status} | nearby here{if $latitude and $longitude} | {$latitude|escape}, {$longitude|escape}{/if}{/capture}
{include file="inc_head.txt"}
{if $latitude and $longitude}
<div id="displaymap" class="map" data-extent="{$geo_stats.bounding_box|@join:","|escape}" data-hash="false" data-interactive="false" data-provider="toner">
{include file="inc_map_header_markers.txt markers=$venues}
+<div class="marker marker-header marker-youarehere" data-location="{$latitude|escape},{$longitude|escape}"><span class="marker-history-text"></span></div>
</div>
-<h3 class="header-right">{$str_status|escape}{if $venues.0.locality}, in {$venues.0.locality.name|escape}{/if}</h3>
+<h3 class="header-right">{$str_status|escape}, nearby here</h3>
{foreach from=$venues item="row"}
@@ -19,6 +20,7 @@
</h3>
<div class="map" data-zoom="14" data-center="{$row.latitude|escape},{$row.longitude|escape}" data-hash="false" data-interactive="false" data-provider="toner">
+ <div class="marker marker-history marker-youarehere" data-location="{$latitude|escape},{$longitude|escape}"><span class="marker-history-text">you are here-ish</span></div>
<div class="marker marker-history{if $row.status_id==2} marker-history-todo{/if}" data-location="{$row.latitude|escape},{$row.longitude|escape}"><span class="marker-history-text">{$row.venue.name|escape}</span></div>
</div>
</div>
@@ -21,10 +21,14 @@
{include file="inc_checkin_venue.txt"}
<div class="map" data-zoom="14" data-center="{$venue.latitude|escape},{$venue.longitude|escape}" data-hash="false" data-interactive="false" data-provider="toner">
- <div class="marker marker-history" data-location="{$venue.latitude|escape},{$venue.longitude|escape}"><span class="marker-history-text">{$venue.name|escape}</span></div>
+ <div class="marker marker-history{if !$has_visited} marker-history-todo{/if}" data-location="{$venue.latitude|escape},{$venue.longitude|escape}"><span class="marker-history-text">{$venue.name|escape}</span></div>
</div>
+ {if $has_visited}
<button id="iamhere">I am here again</button>
+ {else}
+ <button id="iamhere">I am here now</button>
+ {/if}
{if $venue.latitude and $venue.longitude}
<div class="geo">
@@ -76,13 +80,41 @@
{/foreach}
</ul>
+<div id="venue_stats">
+<h4>You said</h4>
+
+<ul>
+{foreach from=$statuses item="count" key="status_id"}
+{if $status_id >= 2}
+
+{if $count==1}
+<li><q><a href="{$owner|@urls_lists_for_user}{$status_id|escape}/nearby?latitude={$venue.latitude|escape}&longitude={$venue.longitude|escape}">{$status_map.$status_id|escape}</a></q> &#8212; once</li>
+{else}
+<li><q><a href="{$owner|@urls_lists_for_user}{$status_id|escape}/nearby?latitude={$venue.latitude|escape}&longitude={$venue.longitude|escape}">{$status_map.$status_id|escape}</a></q> &#8212; {$count|escape} times</li>
+{/if}
+
+{else}
+
+{if $count==1}
+<li><q>{$status_map.$status_id|escape}</q> &#8212; once</li>
+{else}
+<li><q>{$status_map.$status_id|escape}</q> &#8212; {$count|escape} times</li>
+{/if}
+
+{/if}
+{/foreach}
+</ul>
+
+</div>
+
<div id="venue_details">
<h4>Details</h4>
<ul>
<li><a href="{$venue|@foursquare_urls_venue}">foursquare:venue={$venue_id|escape}</a></li>
<li><a href="{$owner|@urls_places_for_user}{$venue.locality.locality|escape}/">woe:locality={$venue.locality.locality|escape}</a></li>
</ul>
+
</div>
{include file="inc_export_links.txt"}
View
@@ -96,6 +96,13 @@
$GLOBALS['smarty']->assign("str_status", $str_status);
$pagination_url = urls_lists_for_user($owner) . "{$status_url}/";
+
+ if ($woeid){
+
+ $pagination_url .= "{$woeid}/";
+ $GLOBALS['smarty']->assign("woeid", $woeid);
+ }
+
$GLOBALS['smarty']->assign("pagination_url", $pagination_url);
$export_formats = privatesquare_export_valid_formats();
View
@@ -39,6 +39,19 @@
$GLOBALS['smarty']->assign_by_ref("status_map", $status_map);
$GLOBALS['smarty']->assign_by_ref("broadcast_map", $broadcast_map);
+ $statuses = privatesquare_checkins_statuses_for_user($owner, $more);
+
+ if (count(array_keys($statuses)) > 1){
+ $has_visited = 1;
+ }
+
+ else if (isset($statuses['2'])){
+ $has_visited = 0;
+ }
+
+ $GLOBALS['smarty']->assign_by_ref("statuses", $statuses);
+ $GLOBALS['smarty']->assign_by_ref("has_visited", $has_visited);
+
$GLOBALS['smarty']->assign_by_ref("venue", $venue);
$checkin_crumb = crumb_generate("api", "privatesquare.venues.checkin");

0 comments on commit f4e68f5

Please sign in to comment.