You are here

function signup_block in Signup 5

Same name and namespace in other branches
  1. 5.2 includes/views.none.inc \signup_block()
  2. 6.2 includes/no_views.inc \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

./signup.module, line 22

Code

function signup_block($op = 'list', $delta = 0) {
  global $user;
  switch ($op) {
    case 'list':
      $blocks[0]['info'] = t('List of users current signups.');
      return $blocks;
    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;
        }
      }
      break;
  }
}