Issue 8732: Fix fetch aved searches
This commit is contained in:
parent
b3c07fc726
commit
d68372c872
1 changed files with 23 additions and 24 deletions
|
@ -36,33 +36,32 @@ class SavedSearches
|
||||||
*/
|
*/
|
||||||
public static function getHTML($return_url, $search = '')
|
public static function getHTML($return_url, $search = '')
|
||||||
{
|
{
|
||||||
$o = '';
|
$saved = [];
|
||||||
|
|
||||||
$saved_searches = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
|
$saved_searches = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
|
||||||
if (DBA::isResult($saved_searches)) {
|
while ($saved_search = DBA::fetch($saved_searches)) {
|
||||||
$saved = [];
|
$saved[] = [
|
||||||
foreach ($saved_searches as $saved_search) {
|
'id' => $saved_search['id'],
|
||||||
$saved[] = [
|
'term' => $saved_search['term'],
|
||||||
'id' => $saved_search['id'],
|
'encodedterm' => urlencode($saved_search['term']),
|
||||||
'term' => $saved_search['term'],
|
'searchpath' => Search::getSearchPath($saved_search['term']),
|
||||||
'encodedterm' => urlencode($saved_search['term']),
|
'delete' => DI::l10n()->t('Remove term'),
|
||||||
'searchpath' => Search::getSearchPath($saved_search['term']),
|
'selected' => $search == $saved_search['term'],
|
||||||
'delete' => DI::l10n()->t('Remove term'),
|
];
|
||||||
'selected' => $search == $saved_search['term'],
|
}
|
||||||
];
|
DBA::close($saved_searches);
|
||||||
}
|
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('widget/saved_searches.tpl');
|
if (empty($saved)) {
|
||||||
|
return '';
|
||||||
$o = Renderer::replaceMacros($tpl, [
|
|
||||||
'$title' => DI::l10n()->t('Saved Searches'),
|
|
||||||
'$add' => '',
|
|
||||||
'$searchbox' => '',
|
|
||||||
'$saved' => $saved,
|
|
||||||
'$return_url' => urlencode($return_url),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $o;
|
$tpl = Renderer::getMarkupTemplate('widget/saved_searches.tpl');
|
||||||
|
|
||||||
|
return Renderer::replaceMacros($tpl, [
|
||||||
|
'$title' => DI::l10n()->t('Saved Searches'),
|
||||||
|
'$add' => '',
|
||||||
|
'$searchbox' => '',
|
||||||
|
'$saved' => $saved,
|
||||||
|
'$return_url' => urlencode($return_url),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue