Merge pull request #8739 from annando/issue-8732
Issue 8732: Fix fetch saved searches
This commit is contained in:
commit
b1e6a4e499
|
@ -36,12 +36,9 @@ class SavedSearches
|
|||
*/
|
||||
public static function getHTML($return_url, $search = '')
|
||||
{
|
||||
$o = '';
|
||||
|
||||
$saved_searches = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
|
||||
if (DBA::isResult($saved_searches)) {
|
||||
$saved = [];
|
||||
foreach ($saved_searches as $saved_search) {
|
||||
$saved_searches = DBA::select('search', ['id', 'term'], ['uid' => local_user()]);
|
||||
while ($saved_search = DBA::fetch($saved_searches)) {
|
||||
$saved[] = [
|
||||
'id' => $saved_search['id'],
|
||||
'term' => $saved_search['term'],
|
||||
|
@ -51,10 +48,15 @@ class SavedSearches
|
|||
'selected' => $search == $saved_search['term'],
|
||||
];
|
||||
}
|
||||
DBA::close($saved_searches);
|
||||
|
||||
if (empty($saved)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('widget/saved_searches.tpl');
|
||||
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$title' => DI::l10n()->t('Saved Searches'),
|
||||
'$add' => '',
|
||||
'$searchbox' => '',
|
||||
|
@ -62,7 +64,4 @@ class SavedSearches
|
|||
'$return_url' => urlencode($return_url),
|
||||
]);
|
||||
}
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user