Fix display issues
- Add baseurl to widgets search links - Add aside to search page - Fix number of available profiles in country widgets
This commit is contained in:
parent
bbe2fca6ac
commit
522cc7bb17
6 changed files with 68 additions and 51 deletions
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
function tags_widget()
|
||||
use Friendica\Directory\App;
|
||||
|
||||
function tags_widget(App $a)
|
||||
{
|
||||
$o = '';
|
||||
|
||||
|
@ -10,29 +12,30 @@ function tags_widget()
|
|||
$o .= '<h3>' . t('Trending Interests') . '</h3>';
|
||||
$o .= '<ul>';
|
||||
foreach ($r as $rr) {
|
||||
$o .= '<li><a href="search?query=' . $rr['term'] . '" >' . $rr['term'] . '</a> (' . $rr['total'] . ')</li>';
|
||||
$o .= '<li><a href="' . $a->get_baseurl() . '/search?query=' . $rr['term'] . '" >' . $rr['term'] . '</a> (' . $rr['total'] . ')</li>';
|
||||
}
|
||||
$o .= '</ul></div>';
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
function country_widget()
|
||||
function country_widget(App $a)
|
||||
{
|
||||
$o = '';
|
||||
|
||||
$r = q("SELECT `country-name`, COUNT(`country-name`) AS `total`"
|
||||
. " FROM `profile`"
|
||||
. " WHERE `country-name` != ''"
|
||||
. " GROUP BY `country-name`"
|
||||
. " ORDER BY COUNT(`country-name`) DESC"
|
||||
. " LIMIT 20");
|
||||
$r = q("SELECT `country-name`, COUNT(`country-name`) AS `total`
|
||||
FROM `profile`
|
||||
WHERE `country-name` != ''
|
||||
AND `available`
|
||||
GROUP BY `country-name`
|
||||
ORDER BY COUNT(`country-name`) DESC
|
||||
LIMIT 20");
|
||||
if (count($r)) {
|
||||
$o .= '<div class="widget">';
|
||||
$o .= '<h3>' . t('Locations') . '</h3>';
|
||||
$o .= '<ul>';
|
||||
foreach ($r as $rr) {
|
||||
$o .= '<li><a href="search?query=' . $rr['country-name'] . '" >' . $rr['country-name'] . '</a> (' . $rr['total'] . ')</li>';
|
||||
$o .= '<li><a href="' . $a->get_baseurl() . '/search?query=' . $rr['country-name'] . '" >' . $rr['country-name'] . '</a> (' . $rr['total'] . ')</li>';
|
||||
}
|
||||
$o .= '</ul></div>';
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ $db = new dba($db_host, $db_user, $db_pass, $db_data);
|
|||
unset($db_host, $db_user, $db_pass, $db_data);
|
||||
|
||||
$a->init_pagehead();
|
||||
$a->page['aside'] = '<div id="logo"><img src="images/friendica-32.png" alt="friendica logo" /> <a href="http://friendica.com">Friendica</a></div><div id="slogan">Your friends. Your web.</div>';
|
||||
$a->page['aside'] = '';
|
||||
|
||||
session_start();
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ function directory_init(App $a)
|
|||
{
|
||||
$a->set_pager_itemspage(30);
|
||||
|
||||
$a->page['aside'] .= tags_widget();
|
||||
$a->page['aside'] .= country_widget();
|
||||
$a->page['aside'] .= tags_widget($a);
|
||||
$a->page['aside'] .= country_widget($a);
|
||||
}
|
||||
|
||||
function directory_content(App $a)
|
||||
|
@ -82,6 +82,7 @@ function directory_content(App $a)
|
|||
$view->addHelper('filterForumsUrl', SearchHelper::get('filterForumsUrl'));
|
||||
|
||||
$view->output(array(
|
||||
'aside' => $a->page['aside'],
|
||||
'total' => number_format($total),
|
||||
'results' => $r,
|
||||
'filter' => $filter,
|
||||
|
|
|
@ -5,6 +5,16 @@ use Friendica\Directory\Rendering\View;
|
|||
use Friendica\Directory\Helper\Search as SearchHelper;
|
||||
use Friendica\Directory\Helper\Profile as ProfileHelper;
|
||||
|
||||
require_once 'include/widget.php';
|
||||
|
||||
function search_init(App $a)
|
||||
{
|
||||
$a->set_pager_itemspage(30);
|
||||
|
||||
$a->page['aside'] .= tags_widget($a);
|
||||
$a->page['aside'] .= country_widget($a);
|
||||
}
|
||||
|
||||
function search_content(App $a)
|
||||
{
|
||||
//Filters
|
||||
|
@ -89,6 +99,7 @@ function search_content(App $a)
|
|||
$view->addHelper('filterForumsUrl', SearchHelper::get('filterForumsUrl'));
|
||||
|
||||
$view->output(array(
|
||||
'aside' => $a->page['aside'],
|
||||
'total' => number_format($total),
|
||||
'results' => $r,
|
||||
'filter' => $filter,
|
||||
|
|
|
@ -1,33 +1,32 @@
|
|||
<div class="sub-menu-outer">
|
||||
<div class="sub-menu-inner search-options">
|
||||
<a class="option <?php echo empty($filter) ? 'active' : '' ?>" href="<?php echo $this->filterAllUrl(''); ?>">All</a>
|
||||
<a class="option <?php echo $filter == 'people' ? 'active' : '' ?>" href="<?php echo $this->filterPeopleUrl(''); ?>">People</a>
|
||||
<a class="option <?php echo $filter == 'forums' ? 'active' : '' ?>" href="<?php echo $this->filterForumsUrl(''); ?>">Forums</a>
|
||||
</div>
|
||||
<div class="sub-menu-inner search-options">
|
||||
<a class="option <?php echo empty($filter) ? 'active' : '' ?>" href="<?php echo $this->filterAllUrl(''); ?>">All</a>
|
||||
<a class="option <?php echo $filter == 'people' ? 'active' : '' ?>" href="<?php echo $this->filterPeopleUrl(''); ?>">People</a>
|
||||
<a class="option <?php echo $filter == 'forums' ? 'active' : '' ?>" href="<?php echo $this->filterForumsUrl(''); ?>">Forums</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="directory-results">
|
||||
<aside>
|
||||
<?php echo tags_widget() ?>
|
||||
<?php echo country_widget() ?>
|
||||
</aside>
|
||||
<section>
|
||||
<div class="profiles">
|
||||
<?php if (count($results)): ?>
|
||||
<aside>
|
||||
<?php echo $aside ?>
|
||||
</aside>
|
||||
<section>
|
||||
<div class="profiles">
|
||||
<?php if (count($results)): ?>
|
||||
|
||||
<?php
|
||||
foreach ($results as $profile) {
|
||||
echo $this->view('_profile', array('profile' => $profile));
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
foreach ($results as $profile) {
|
||||
echo $this->view('_profile', ['profile' => $profile]);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php else: ?>
|
||||
<?php else: ?>
|
||||
|
||||
<h3>There were no results</h3>
|
||||
<h3>There were no results</h3>
|
||||
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
|
||||
</div>
|
||||
<?php echo $this->paginate();?>
|
||||
</section>
|
||||
</div>
|
||||
<?php echo $this->paginate(); ?>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
@ -6,24 +6,27 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-results">
|
||||
<h3>Results for "<?php echo $query; ?>" (<?php echo $total; ?>)</h3>
|
||||
<div class="profiles">
|
||||
<?php if (count($results)): ?>
|
||||
|
||||
<?php
|
||||
<div class="directory-results">
|
||||
<aside>
|
||||
<?php echo $aside ?>
|
||||
</aside>
|
||||
<section>
|
||||
<h3>Results for "<?php echo $query; ?>" (<?php echo $total; ?>)</h3>
|
||||
<div class="profiles">
|
||||
<?php if (count($results)): ?>
|
||||
|
||||
<?php
|
||||
foreach ($results as $profile) {
|
||||
echo $this->view('_profile', array('profile' => $profile));
|
||||
}
|
||||
?>
|
||||
echo $this->view('_profile', ['profile' => $profile]);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<?php else: ?>
|
||||
<h3>There were no results</h3>
|
||||
|
||||
<h3>There were no results</h3>
|
||||
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php echo $this->paginate();?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php echo $this->paginate(); ?>
|
||||
</section>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue