directory enhancements

This commit is contained in:
Mike Macgirvin 2010-07-09 17:39:55 -07:00
parent 03689fa6b0
commit 4a92de7563
2 changed files with 41 additions and 6 deletions

View File

@ -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)) { if(count($r)) {
$tpl = file_get_contents('view/directory_item.tpl'); $tpl = file_get_contents('view/directory_item.tpl');
foreach($r as $rr) { if(in_array('small', $a->argv))
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']); $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 .= '<br />Age: ' ; // . calculate age($rr['dob'])) ;
if(strlen($rr['gender']))
$details .= '<br />Gender: ' . $rr['gender'];
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$id' => $rr['id'], '$id' => $rr['id'],
'$profile-link' => $profile_link, '$profile-link' => $profile_link,
'$photo' => $rr['photo'], '$photo' => $rr[$photo],
'$alt-text' => $rr['name'], '$alt-text' => $rr['name'],
'$name' => $rr['name'], '$name' => $rr['name'],
'$details' => $details // FIXME '$details' => $details
)); ));

View File

@ -472,9 +472,22 @@ input#dfrn-url {
.directory-end { .directory-end {
clear: both; 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 { .directory-item {
float: left; float: left;
width: 225px; width: 225px;
height: 260px;
overflow: auto;
} }