You are here

function agenda_block in Agenda 6.2

Same name and namespace in other branches
  1. 6 agenda.module \agenda_block()

Implementation of hook_block().

File

./agenda.module, line 131

Code

function agenda_block($op = 'list', $delta = 0) {
  switch ($op) {
    case 'list':
      $res = db_query("SELECT bid, value FROM {agenda} WHERE name = 'title'");
      $blocks = array();
      while ($block = db_fetch_object($res)) {
        $blocks[$block->bid] = array(
          'info' => t('Agenda: @title', array(
            '@title' => agenda_variable_get($block->bid, 'title', 'New block'),
          )),
          'cache' => BLOCK_CACHE_GLOBAL,
        );
      }
      return $blocks;
      break;
    case 'view':
      if (!user_access('access agenda content')) {
        return FALSE;
      }
      $block = array(
        'subject' => t('Upcoming'),
        'content' => agenda_display_block($delta),
      );
      return $block;
      break;
  }
}