You are here

function quicktabs_block in Quick Tabs 6.2

Same name and namespace in other branches
  1. 5 quicktabs.module \quicktabs_block()
  2. 6.3 quicktabs.module \quicktabs_block()
  3. 6 quicktabs.module \quicktabs_block()

Implementation of hook_block().

File

./quicktabs.module, line 135

Code

function quicktabs_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $blocks = array();
      $result = db_query('SELECT qtid, title FROM {quicktabs}');
      while ($row = db_fetch_object($result)) {
        $blocks[$row->qtid]['info'] = $row->title;
        $blocks[$row->qtid]['cache'] = BLOCK_NO_CACHE;
      }
      return $blocks;
      break;
    case 'view':
      $mainblock = array();
      if ($quicktabs = quicktabs_load($delta)) {
        $mainblock['subject'] = $quicktabs['title'];
        $mainblock['content'] = theme('quicktabs', $quicktabs);
      }
      return $mainblock;
      break;
  }
}