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:
Hypolite Petovan 2018-01-14 22:22:37 -05:00
commit 522cc7bb17
6 changed files with 68 additions and 51 deletions

View file

@ -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>';
}