You are here

function user_relationships_ui_menu in User Relationships 7

Same name and namespace in other branches
  1. 5.3 user_relationships_ui/user_relationships_ui.hooks.inc \user_relationships_ui_menu()
  2. 6 user_relationships_ui/user_relationships_ui.module \user_relationships_ui_menu()

Implements hook_menu().

File

user_relationships_ui/user_relationships_ui.module, line 261
UI components of user_relationships @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217 @author Darren Ferguson (contributor) http://drupal.org/user/70179

Code

function user_relationships_ui_menu() {
  $items['relationships'] = array(
    'title' => 'My relationships',
    'type' => MENU_NORMAL_ITEM,
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'view',
    ),
    'page callback' => 'user_relationships_page',
    'file' => 'user_relationships_ui.pages.inc',
    'menu_name' => 'user-menu',
  );
  $items['relationships/list'] = array(
    'title' => 'Current',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'view',
    ),
    'menu_name' => 'user-menu',
  );
  $items['relationships/received'] = array(
    'title' => 'Received requests',
    'title callback' => 'user_relationships_ui_title_callback_pending',
    'title arguments' => array(
      'requestee_id',
    ),
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'approve',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => -9,
    'page callback' => 'user_relationships_pending_requests_page',
    'page arguments' => array(
      'requestee_id',
    ),
    'file' => 'user_relationships_ui.pages.inc',
    'menu_name' => 'user-menu',
  );
  $items['relationships/sent'] = array(
    'title' => 'Sent requests',
    'title callback' => 'user_relationships_ui_title_callback_pending',
    'title arguments' => array(
      'requester_id',
    ),
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'request',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => -8,
    'page callback' => 'user_relationships_pending_requests_page',
    'page arguments' => array(
      'requester_id',
    ),
    'file' => 'user_relationships_ui.pages.inc',
    'menu_name' => 'user-menu',
  );
  $show_tabs = db_query('SELECT rtid, show_tab FROM {user_relationships_ui_settings} WHERE show_tab = 1')
    ->fetchAllKeyed();
  foreach (user_relationships_types_load() as $rtid => $relationship) {
    if (isset($show_tabs[$rtid])) {
      $items["relationships/{$rtid}"] = array(
        'title' => $relationship->rtid,
        'title callback' => 'user_relationships_ui_title_callback',
        'type' => MENU_LOCAL_TASK,
        'access callback' => 'user_relationships_ui_check_access',
        'access arguments' => array(
          'view',
          NULL,
          1,
        ),
        'page callback' => 'user_relationships_page',
        'page arguments' => array(
          NULL,
          1,
        ),
        'file' => 'user_relationships_ui.pages.inc',
        'menu_name' => 'user-menu',
      );
    }
  }
  $items['relationships/%user_relationships/remove'] = array(
    'title' => 'Remove relationship',
    'type' => MENU_CALLBACK,
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'delete',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'user_relationships_ui_remove',
      1,
    ),
    'file' => 'user_relationships_ui.forms.inc',
  );
  $items['relationship/%user/request'] = array(
    'title' => 'Create a relationship',
    'type' => MENU_CALLBACK,
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'request',
    ),
    'page callback' => 'user_relationships_ui_request_ajax',
    'page arguments' => array(
      1,
    ),
    'file' => 'user_relationships_ui.forms.inc',
  );
  $items['user/%user/relationships'] = array(
    'title' => 'Relationships',
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'view',
      1,
    ),
    'page callback' => 'user_relationships_page',
    'page arguments' => array(
      1,
    ),
    'file' => 'user_relationships_ui.pages.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items['user/%user/relationships/list'] = array(
    'title' => 'Current',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'view',
      1,
    ),
  );
  $items['user/%user/relationships/received'] = array(
    'title' => 'Received requests',
    'title callback' => 'user_relationships_ui_title_callback_pending',
    'title arguments' => array(
      'requestee_id',
      1,
    ),
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'approve',
      1,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => -9,
    'page callback' => 'user_relationships_pending_requests_page',
    'page arguments' => array(
      'requestee_id',
      1,
    ),
    'file' => 'user_relationships_ui.pages.inc',
  );
  $items['user/%user/relationships/sent'] = array(
    'title' => 'Sent requests',
    'title callback' => 'user_relationships_ui_title_callback_pending',
    'title arguments' => array(
      'requester_id',
      1,
    ),
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'request',
      1,
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => -8,
    'page callback' => 'user_relationships_pending_requests_page',
    'page arguments' => array(
      'requester_id',
      1,
    ),
    'file' => 'user_relationships_ui.pages.inc',
  );
  foreach (user_relationships_types_load() as $rtid => $relationship) {
    $items["user/%user/relationships/{$rtid}"] = array(
      'title' => $relationship->rtid,
      'title callback' => 'user_relationships_ui_title_callback',
      'type' => MENU_LOCAL_TASK,
      'access callback' => 'user_relationships_ui_check_access',
      'access arguments' => array(
        'view',
        1,
        3,
      ),
      'page callback' => 'user_relationships_page',
      'page arguments' => array(
        1,
        3,
      ),
      'file' => 'user_relationships_ui.pages.inc',
    );
  }
  $items["user/%user/relationships/requested/%user_relationships/%"] = array(
    'title' => 'Approve Relationship',
    'type' => MENU_CALLBACK,
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'request',
      1,
    ),
    'page callback' => 'user_relationships_ui_pending_requested_ajax',
    'page arguments' => array(
      5,
      1,
      4,
    ),
    'file' => 'user_relationships_ui.forms.inc',
  );
  $items['user/%user/relationships/%user_relationships/remove'] = array(
    'title' => 'Remove relationship',
    'type' => MENU_CALLBACK,
    'access callback' => 'user_relationships_ui_check_access',
    'access arguments' => array(
      'delete',
      1,
    ),
    'page callback' => 'user_relationships_ui_remove_ajax',
    'page arguments' => array(
      1,
      3,
    ),
    'file' => 'user_relationships_ui.forms.inc',
  );
  return $items;
}