From 4a92de756395b403b13849917dcb519fe57db016 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Fri, 9 Jul 2010 17:39:55 -0700 Subject: [PATCH] directory enhancements --- mod/directory.php | 32 +++++++++++++++++++++++++++----- view/style.css | 15 ++++++++++++++- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/mod/directory.php b/mod/directory.php index 6d0e1f4268..0a7d7355e7 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -10,22 +10,44 @@ function directory_content(&$a) { )); - $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1"); + $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 ORDER BY `name` ASC"); if(count($r)) { $tpl = file_get_contents('view/directory_item.tpl'); - foreach($r as $rr) { - $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); + if(in_array('small', $a->argv)) + $photo = 'thumb'; + else + $photo = 'photo'; + foreach($r as $rr) { + + $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); + $details = ''; + if(strlen($rr['locality'])) + $details .= $rr['locality']; + if(strlen($rr['region'])) { + if(strlen($rr['locality'])) + $details .= ', '; + $details .= $rr['region']; + } + if(strlen($rr['country-name'])) { + if(strlen($details)) + $details .= ', '; + $details .= $rr['country-name']; + } + if(strlen($rr['dob'])) + $details .= '
Age: ' ; // . calculate age($rr['dob'])) ; + if(strlen($rr['gender'])) + $details .= '
Gender: ' . $rr['gender']; $o .= replace_macros($tpl,array( '$id' => $rr['id'], '$profile-link' => $profile_link, - '$photo' => $rr['photo'], + '$photo' => $rr[$photo], '$alt-text' => $rr['name'], '$name' => $rr['name'], - '$details' => $details // FIXME + '$details' => $details )); diff --git a/view/style.css b/view/style.css index 7b08e2269c..609c8a8f77 100644 --- a/view/style.css +++ b/view/style.css @@ -472,9 +472,22 @@ input#dfrn-url { .directory-end { clear: both; } - +.directory-name { + text-align: center; +} +.directory-photo { + margin-left: 25px; +} +.directory-details { + font-size: 0.7em; + text-align: center; + margin-left: 5px; + margin-right: 5px; +} .directory-item { float: left; width: 225px; + height: 260px; + overflow: auto; }