Merge dir into template_rework

This commit is contained in:
rabuzarus 2015-10-17 22:22:20 +02:00
commit e55f9f8f07
3 changed files with 72 additions and 56 deletions

View File

@ -6,6 +6,8 @@ function directory_init(&$a) {
if(local_user()) { if(local_user()) {
require_once('include/contact_widgets.php'); require_once('include/contact_widgets.php');
$a->page['aside'] .= follow_widget();
$a->page['aside'] .= findpeople_widget(); $a->page['aside'] .= findpeople_widget();
} }
@ -44,27 +46,12 @@ function directory_content(&$a) {
else else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
$tpl = get_markup_template('directory_header.tpl'); $gdirpath = '';
$dirurl = get_config('system','directory');
$globaldir = ''; if(strlen($dirurl)) {
$gdirpath = get_config('system','directory'); $gdirpath = zrl($dirurl,true);
if(strlen($gdirpath)) {
$globaldir = '<ul><li><div id="global-directory-link"><a href="'
. zrl($gdirpath,true) . '">' . t('Global Directory') . '</a></div></li></ul>';
} }
$admin = '';
$o .= replace_macros($tpl, array(
'$search' => $search,
'$globaldir' => $globaldir,
'$desc' => t('Find on this site'),
'$admin' => $admin,
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
'$sitedir' => t('Site Directory'),
'$submit' => t('Find')
));
if($search) { if($search) {
$search = dbesc($search); $search = dbesc($search);
@ -159,8 +146,6 @@ function directory_content(&$a) {
$about = ((x($profile,'about') == 1) ? t('About:') : False); $about = ((x($profile,'about') == 1) ? t('About:') : False);
$tpl = get_markup_template('directory_item.tpl');
if($a->theme['template_engine'] === 'internal') { if($a->theme['template_engine'] === 'internal') {
$location_e = template_escape($location); $location_e = template_escape($location);
} }
@ -168,23 +153,23 @@ function directory_content(&$a) {
$location_e = $location; $location_e = $location;
} }
$entry = replace_macros($tpl,array( $entry = array(
'$id' => $rr['id'], 'id' => $rr['id'],
'$profile_link' => $profile_link, 'profile_link' => $profile_link,
'$photo' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB), 'photo' => proxy_url($a->get_cached_avatar_image($rr[$photo]), false, PROXY_SIZE_THUMB),
'$alt_text' => $rr['name'], 'alt_text' => $rr['name'],
'$name' => $rr['name'], 'name' => $rr['name'],
'$details' => $pdesc . $details, 'details' => $pdesc . $details,
'$page_type' => $page_type, 'page_type' => $page_type,
'$profile' => $profile, 'profile' => $profile,
'$location' => $location_e, 'location' => $location_e,
'$gender' => $gender, 'gender' => $gender,
'$pdesc' => $pdesc, 'pdesc' => $pdesc,
'$marital' => $marital, 'marital' => $marital,
'$homepage' => $homepage, 'homepage' => $homepage,
'$about' => $about, 'about' => $about,
)); );
$arr = array('contact' => $rr, 'entry' => $entry); $arr = array('contact' => $rr, 'entry' => $entry);
@ -193,12 +178,27 @@ function directory_content(&$a) {
unset($profile); unset($profile);
unset($location); unset($location);
$o .= $entry; if(! $arr['entry'])
continue;
$entries[] = $arr['entry'];
} }
$o .= "<div class=\"directory-end\" ></div>\r\n"; $tpl = get_markup_template('directory_header.tpl');
$o .= paginate($a);
$o .= replace_macros($tpl, array(
'$search' => $search,
'$globaldir' => t('Global Directory'),
'$gdirpath' => $gdirpath,
'$desc' => t('Find on this site'),
'$entries' => $entries,
'$finding' => t('Finding:'),
'$findterm' => (strlen($search) ? $search : ""),
'$title' => t('Site Directory'),
'$submit' => t('Find'),
'$paginate' => paginate($a),
));
} }
else else

View File

@ -1,10 +1,12 @@
<h1>{{$sitedir}}</h1> {{include file="section_title.tpl"}}
{{$globaldir}} {{if $gdirpath}}
{{$admin}} <ul>
<li><div id="global-directory-link"><a href="{{$gdirpath}}">{{$globaldir}}</a></div></li>
</ul>
{{/if}}
{{$finding}}
<div id="directory-search-wrapper"> <div id="directory-search-wrapper">
<form id="directory-search-form" action="directory" method="get" > <form id="directory-search-form" action="directory" method="get" >
@ -13,5 +15,17 @@
<input type="submit" name="submit" id="directory-search-submit" value="{{$submit|escape:'html'}}" class="button" /> <input type="submit" name="submit" id="directory-search-submit" value="{{$submit|escape:'html'}}" class="button" />
</form> </form>
</div> </div>
{{if $findterm}}
<h4>{{$finding}} '{{$findterm}}'</h4>
{{/if}}
<div id="directory-search-end"></div> <div id="directory-search-end"></div>
{{foreach $entries as $entry}}
{{include file="directory_item.tpl"}}
{{/foreach}}
<div class="directory-end" ></div>
{{$paginate}}

View File

@ -1,12 +1,14 @@
<div class="directory-item lframe" id="directory-item-{{$id}}" > <div class="directory-item lframe" id="directory-item-{{$entry.id}}" >
<div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$id}}" > <div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$entry.id}}" >
<div class="contact-photo" id="directory-photo-{{$id}}" > <div class="contact-photo" id="directory-photo-{{$entry.id}}" >
<a href="{{$profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$id}}" ><img class="directory-photo-img" src="{{$photo}}" alt="{{$alt_text}}" title="{{$alt_text}}" /></a> <a href="{{$entry.profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$entry.id}}" >
<img class="directory-photo-img" src="{{$entry.photo}}" alt="{{$entry.alt_text}}" title="{{$entry.alt_text}}" />
</a>
</div> </div>
</div> </div>
<div class="contact-name" id="directory-name-{{$id}}">{{$name}}</div> <div class="contact-name" id="directory-name-{{$entry.id}}">{{$entry.name}}</div>
<div class="contact-details">{{$details}}</div> <div class="contact-details">{{$entry.details}}</div>
</div> </div>