You are here

function spaces_contacts_block in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_contacts/spaces_contacts.module \spaces_contacts_block()

Implementation of hook_block()

File

spaces_contacts/spaces_contacts.module, line 33

Code

function spaces_contacts_block($op = 'list', $delta = 0) {
  if ($op == 'list') {
    $blocks['contact_list']['info'] = t('Spaces Contacts: Contact List');
    return $blocks;
  }
  else {
    if ($op == 'view') {
      switch ($delta) {
        case 'contact_list':
          $users = _spaces_contacts_users();
          $items = array();
          if ($users) {
            foreach ($users as $account) {
              $item = new stdClass();
              $item->title = theme('username', $account);
              $items[] = theme('datetime_view_style_item', $item);
            }
            $block['content'] = theme('item_list', $items);
          }
          else {
            $block['content'] = "<p>" . t('No contacts found.') . "</p>";
          }
          $block['subject'] = t('Contacts');
          return $block;
      }
    }
  }
}