Skip to content

Commit

Permalink
show number of search results in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Vercammen committed Feb 21, 2014
1 parent 19331aa commit fe57e74
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions media_mediahaven.module
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ function media_mediahaven_browser_add($form, &$form_state = array()) {
'#value' => t('Apply'),
);


// This is our half-assed pager.
$page = isset($_GET['page-yt']) ? $_GET['page-yt'] : 0;
if (isset($form_state['input']['search'])) {
Expand All @@ -375,8 +376,7 @@ function media_mediahaven_browser_add($form, &$form_state = array()) {
if (!empty($term)) {
$search = json_decode(get_mediahaven_rest_client()->search($term, $page * 15 + 1, 15), TRUE);
}
$form['media']['#prefix'] = '<div id="container"><div id="scrollbox"><ul id="media-browser-library-list" class="media-list-thumbnails">';
$form['media']['#suffix'] = '</ul><div id="status"></div></div></div>';



$empty = FALSE;
Expand Down Expand Up @@ -440,9 +440,9 @@ function media_mediahaven_browser_add($form, &$form_state = array()) {
$next = l(t('next'), $dest, array('query' => $query));
}

$form['pager']= array(
'#markup' => $prev . ' ' . $next,
);
// $form['pager']= array(
// '#markup' => '<br>' . $prev . ' ' . $next,
// );

$form['submitted-media'] = array(
'#type' => 'hidden',
Expand All @@ -461,6 +461,13 @@ function media_mediahaven_browser_add($form, &$form_state = array()) {
'#type' => 'submit',
'#value' => t('Submit'),
);

$form['media']['#prefix'] = '<div id="container">';
if (isset($search) && $search['totalNrOfResults'] > 0) {
$form['media']['#prefix'] .= '<div>'. t('Number of results: '). $search['totalNrOfResults'] .'<span style="float:right">'. $prev . ' ' .$next.'</span></div>';
}
$form['media']['#prefix'] .= '<div id="scrollbox"><ul id="media-browser-library-list" class="media-list-thumbnails">';
$form['media']['#suffix'] = '</ul><div id="status"></div></div></div>';
return $form;
}

Expand Down

0 comments on commit fe57e74

Please sign in to comment.