You are here

function theme_guestbook_list in Guestbook 6.2

Same name and namespace in other branches
  1. 5.2 guestbook.module \theme_guestbook_list()
  2. 5 guestbook.module \theme_guestbook_list()
  3. 6 guestbook.module \theme_guestbook_list()
  4. 7.2 guestbook.module \theme_guestbook_list()
1 theme call to theme_guestbook_list()
guestbook_list in ./guestbook.module
Output a list of all guestbooks; menu callback.

File

./guestbook.module, line 915

Code

function theme_guestbook_list($guestbooks, $header, $limit = 40) {
  $output = '';

  // Site guestbook.
  if (isset($guestbooks[0])) {
    $output .= '<p>' . l(variable_get('guestbook_site_title', t('Site guestbook')), 'guestbook');
    $output .= ' (' . format_plural($guestbooks[0]['num'], '1 entry', '@count entries') . ', ' . t('last update') . ': ' . _guestbook_timeinterval($guestbooks[0]['created']) . ')</p>';
    unset($guestbooks[0]);
  }

  // User guestbooks.
  if (count($guestbooks)) {
    $output .= '<h4>' . t('User guestbooks') . '</h4>';
    $rows = array();
    foreach ($guestbooks as $guestbook) {
      $rows[] = array(
        l($guestbook['name'], guestbook_path($guestbook['uid'])),
        format_plural($guestbook['num'], '1 entry', '@count entries'),
        array(
          'data' => _guestbook_timeinterval($guestbook['created']),
          'align' => 'right',
        ),
      );
    }
    $output .= theme('table', $header, $rows);
  }
  $output .= theme('pager', NULL, $limit, 0);
  return $output;
}