You are here

function theme_guestbook in Guestbook 5.2

Same name and namespace in other branches
  1. 5 guestbook.module \theme_guestbook()
  2. 6.2 guestbook.module \theme_guestbook()
  3. 6 guestbook.module \theme_guestbook()
  4. 7.2 guestbook.module \theme_guestbook()

Render a guestbook.

1 theme call to theme_guestbook()
guestbook_page in ./guestbook.module
Output a guestbook page; menu callback.

File

./guestbook.module, line 688

Code

function theme_guestbook($uid, $entries, $comment_entry, $limit = 20) {
  global $user;
  $form_location = variable_get('guestbook_form_location', 'above');
  $pager_position = variable_get('guestbook_pager_position', GUESTBOOK_PAGER_BELOW);

  // Intro text.
  $intro = _guestbook_info($uid, 'intro');
  $output = $intro ? check_markup($intro) : '';
  if ($_GET['q'] != 'user/' . $uid) {
    $output .= _guestbook_user_profile_link($uid);
  }

  // Form on separate page.
  $output .= $form_location == 'separate page' ? guestbook_form_entry($uid, 'link') : '';

  // Form and pager above entries.
  $output .= $form_location == 'above' ? guestbook_form_entry($uid) : '';
  $output .= $pager_position & GUESTBOOK_PAGER_ABOVE ? theme('pager', NULL, $limit, 0) : '';
  $i = 0;
  foreach ($entries as $entry) {
    $zebra = $i % 2 ? 'odd' : 'even';
    $output .= theme('guestbook_entry', $uid, $entry, $comment_entry, $zebra);
    $i++;
  }

  // Form and pager below entries.
  $output .= $pager_position & GUESTBOOK_PAGER_BELOW ? theme('pager', NULL, $limit, 0) : '';
  $output .= $form_location == 'below' ? guestbook_form_entry($uid) : '';
  if ($output == '') {
    $output = '<div class="guestbook-empty">' . t('Nobody has signed this guestbook yet.') . '</div>';
  }
  return '<div class="guestbook">' . $output . "</div>\n";
}