Skip to content

Commit

Permalink
Linked to notes from person page instead of showing atlases and scans
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Migurski committed Mar 14, 2012
1 parent 86d758d commit da11404
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 78 deletions.
53 changes: 7 additions & 46 deletions site/templates/person.html.tpl
Expand Up @@ -2,58 +2,19 @@
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>{$user_name} - fieldpapers.org</title>
<title>{$user.name} - fieldpapers.org</title>
<link rel="stylesheet" href="{$base_dir}/css/fieldpapers.css" type="text/css">
</head>
<body>
{include file="navigation.htmlf.tpl"}
<div class="container">
<h1>{$user_name}</h1>
<h1>{$user.name}</h1>

{if $user_email}
<p>
{$user_email}
</p>
{/if}
<div class="fltlft">
<h2>
{if $prints|@count == 1}
1 Atlas
{else if $print|@count >= 1}
{$prints|@count} Atlases
{/if}
| <a href="{$base_dir}/uploads.php?user={$user_id}">Uploads</a></h2>
</h2>
{foreach from=$prints item="print" name="index"}
<div class="atlasThumb">
<a href="print.php?id={$print.id}"><img src="{$print.preview_url}" alt="printed page"
name="atlasPage" width="100%" id="atlasPage"></a>

<div class="atlasName"><a href="{$base_dir}/print.php?id={$print.id}">Untitled</a></div>
<div class="atlasPlace">
{if $print.city_name && $print.country_name}
<a href="{$base_dir}/atlases.php?place={$print.place_woeid}">
{$print.city_name}
</a>,
<a href="{$base_dir}/atlases.php?place={$print.country_woeid}">
{if $print.country_name}
{$print.country_name}
{else}
Unknown Place
{/if}
</a>
{/if}
</div>
<div class="atlasMeta">
{if $print.number_of_pages == 1}
1 page,
{else if $print.number_of_pages > 1}
{$print.number_of_pages} pages,
{/if}
from <a href="{$base_dir}/atlases.php?month={"Y-m"|@date:$print.created}">{$print.age|nice_relativetime|escape}</a></div>
</div>
{/foreach}
</div>
<ol>
<li><a href="{$base_dir}/atlases.php?user={$user.id}">Atlases</a></li>
<li><a href="{$base_dir}/uploads.php?user={$user.id}">Uploads</a></li>
<li>Notes (<a href="{$base_dir}/notes.php?user={$user.id}&amp;type=json">GeoJSON</a>)</li>
</ol>

{include file="footer.htmlf.tpl"}
</div>
Expand Down
37 changes: 5 additions & 32 deletions site/www/person.php
Expand Up @@ -11,44 +11,17 @@

/**** ... ****/

$user_id = $_GET["id"];

$user = get_user($context->db, $user_id);

$context->sm->assign('user_id', $user_id);

if ($user['name'])
if(empty($_GET['id']) && $context->user)
{
$context->sm->assign('user_name', $user['name']);
} else {
$context->sm->assign('user_name', 'Anonymous');
// redirect to the calling-user's page
die(print_r($context->user, 1));
}

if ($user['email'])
if($user = get_user($context->db, $_GET['id']))
{
$context->sm->assign('user_email', $user['email']);
$context->sm->assign('user', $user);
}

// Get prints by id
$prints = get_prints($context->db, array('user' => $user['id']));

foreach($prints as $i => $print)
{
$pages = get_print_pages($context->db, $print['id']);
$prints[$i]['number_of_pages'] = count($pages);

if ($print['place_name'])
{
$place_name = explode(',', $print['place_name']);

$prints[$i]['city_name'] = $place_name[0];
} else {
$prints[$i]['city_name'] = 'Unknown City';
}
}

$context->sm->assign('prints', $prints);

if($context->type == 'text/html') {
header("Content-Type: text/html; charset=UTF-8");
print $context->sm->fetch("person.html.tpl");
Expand Down

0 comments on commit da11404

Please sign in to comment.