'spaces', 'attribute' => 'feature', 'value' => 'contacts', 'block' => array( array( 'module' => 'spaces_contacts', 'delta' => 'contact_list', 'region' => 'right', 'weight' => -11, ), ), 'menu' => array('contacts'), 'spaces' => array( 'label' => t('Contacts'), 'description' => t('A contacts section with member listings.'), 'options' => array(0 => t('Disabled'), 2 => t('Enabled')), ), ); return $items; } /** * Implementation of hook_block() */ 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'] = "
". t('No contacts found.') ."
"; } $block['subject'] = t('Contacts'); return $block; } } } /** * Implementation of hook_menu() */ function spaces_contacts_menu($may_cache) { $items = array(); if ($may_cache) { $items[] = array( 'path' => 'contacts', 'title' => t('Contacts'), 'description' => t('Provides a group-aware contact listing.'), 'callback' => 'spaces_contacts_pageview', 'access' => user_access('access content'), 'type' => MENU_NORMAL_ITEM, ); } return $items; } /** * Implementation of hook_help() */ function spaces_contacts_help($page) { if (context_get('spaces', 'feature') == 'contacts') { return "". t('Contacts shows the team members that are part of this group and any additional contact information if they have provided it.') ."
"; } } /** * Implementation of hook_user() */ function spaces_contacts_user($op, &$edit, &$account, $category = NULL) { if (in_array($op, array('view', 'form')) && spaces_gid()) { context_set('spaces', 'feature', 'contacts'); } } /** * Page callback that displays a user contact listing */ function spaces_contacts_pageview() { drupal_set_title(t('Contacts')); context_set('spaces', 'feature', 'contacts'); context_set('theme', 'layout', 'wide'); $rows = array(); $users = _spaces_contacts_users(); foreach ($users as $account) { $row = array( theme('user_picture', $account), theme('username', $account), l($account->mail, 'mailto:'. $account->mail) ); if (module_exists('profile')) { $row[] = $account->profile_organization ? $account->profile_organization : null; } $rows[] = $row; } $labels = array(null, t('Name'), t('Email')); if (module_exists('profile')) { $labels[] = t('Organization'); } // wrap the table as if it were produced by a view return "