You are here

function theme_imagepicker_browser in Image Picker 7

Same name and namespace in other branches
  1. 6.2 imagepicker.module \theme_imagepicker_browser()
2 theme calls to theme_imagepicker_browser()
_imagepicker_browse in ./imagepicker.functions.inc
_imagepicker_browse_public in ./imagepicker.functions.inc

File

./imagepicker.module, line 1500
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function theme_imagepicker_browser($variables) {
  $content = $variables['content'];
  $forms = $variables['forms'];
  $message = $variables['message'];
  $help = $variables['help'];
  $label = $variables['label'];
  $rows = $content[0];
  $max = $content[1];
  $cols = $content[2];
  $pref1 = $content[3][0];
  $pref2 = $content[3][1];
  $suff1 = $content[4][0];
  $suff2 = $content[4][1];
  $output = $label ? '<fieldset><legend>' . $label . '</legend>' : '';
  if ($rows) {

    // forms
    if ($forms) {
      $output .= isset($forms['browse_search']) ? render($forms['browse_search']) : '';
      $output .= isset($forms['browse_public']) ? render($forms['browse_public']) : '';
      $output .= isset($forms['browse_public_groups']) ? render($forms['browse_public_groups']) : '';
      $output .= isset($forms['browse_groups']) ? render($forms['browse_groups']) : '';
      $output .= isset($forms['browse_order']) ? render($forms['browse_order']) : '';
    }

    // help message
    $output .= $help ? '<div class="imgp_help">' . $help . '</div>' : '';
    $output .= $pref1;
    $ct = 0;
    foreach ($rows as $row) {
      $tooltip = $row['img_name'] . ': ' . $row['img_title'] . ' ' . $row['img_description'];
      $imglink = '<img src="' . $row['imgpath'] . '" alt="' . $row['img_title'] . '" title="' . $tooltip . '" />';
      $output .= $pref2 . l($imglink, $row['imgurl'] . $row['img_id'], array(
        'html' => TRUE,
      )) . $suff2;
      $ct++;
      if ($cols > 0 && $ct >= $cols) {
        $output .= $suff1 . $pref1;
        $ct = 0;
      }
    }
    $output .= $suff1 . theme('pager');
  }
  else {
    $output .= '<div class="messages">' . $message . '</div>';
  }
  $output .= $label ? '</fieldset>' : '';
  return $output;
}