You are here

function signup_block in Signup 6.2

Same name and namespace in other branches
  1. 5.2 includes/views.none.inc \signup_block()
  2. 5 signup.module \signup_block()

Implementation of hook_block().

Parameters

$op: The operation that is being requested. This defaults to 'list', which indicates that the method should return which blocks are available.

$delta: The specific block to display (the offset into an array).

Return value

One of two possibilities. The first is an array of available blocks. The other is an array containing a block.

Related topics

File

includes/no_views.inc, line 28
Provides all the code for required UI elements for sites that do not have views.module enabled. If views is enabled, there are default views for all of these things (which are therefore customizable and more powerful) in signup/views/views.inc.

Code

function signup_block($op = 'list', $delta = 0) {
  global $user;
  switch ($op) {
    case 'list':
      $blocks[0]['info'] = t('Current signups');
      return $blocks;
      break;
    case 'view':
      if (user_access('access content')) {
        switch ($delta) {
          case 0:
            $titles = signup_list_user_signups($user->uid);
            if (count($titles)) {
              $block['subject'] = t('Current signups');
              $block['content'] = theme_item_list($titles) . l(t('View signup schedule'), "user/{$user->uid}/signups");
            }
            return $block;
        }
      }
  }
}