You are here

function shoutbox_view in Shoutbox 6.2

Same name and namespace in other branches
  1. 7.2 shoutbox.module \shoutbox_view()
  2. 7 shoutbox.module \shoutbox_view()

View the shoutbox

Parameters

$block: TRUE if the output desired is for a block, otherwise FALSE

3 calls to shoutbox_view()
shoutbox_block in ./shoutbox.module
Implementation of hook_block()
shoutbox_group_page in shoutbox_group/shoutbox_group.module
Generate dedicated shoutbox page for group
shoutbox_user_page in shoutbox_user/shoutbox_user.module
Page callback for user shoutbox page
1 string reference to 'shoutbox_view'
shoutbox_menu in ./shoutbox.module
Implementation of hook_menu().

File

./shoutbox.module, line 238
Shout box module displays a block for users to create short messages for the whole site. Uses AHAH to update the database and display content.

Code

function shoutbox_view($block = FALSE) {

  // Load externals
  theme('shoutbox_external_files');

  // Output the shoutbox form.
  $output .= drupal_get_form('shoutbox_add_form');

  // Determine the post count
  if (!$block) {
    $show_amount = variable_get('shoutbox_showamount_page', '30');
  }
  else {
    $show_amount = variable_get('shoutbox_showamount_block', '10');
  }

  // Output the existing shoutbox posts.
  $shoutbox_posts_data = shoutbox_display_posts($show_amount, TRUE, TRUE);

  // JS Settings
  _shoutbox_js_config();

  // Theme output
  $output .= theme('shoutbox_page', $shoutbox_posts_data);

  // Alterations only needed if there are shouts
  if ($shoutbox_posts_data['count']) {
    if ($block) {

      // If block, show link to page
      $page_path = 'shoutbox';

      // Allow other modules to alter the link path
      shoutbox_invoke('link', $shout, $page_path);

      // Generate the link
      $output .= theme('shoutbox_block_page_link', $page_path);
    }
    else {

      // If page, show pagers
      $output .= theme('pager', NULL, $show_amount, 1);
    }
  }
  return $output;
}