You are here

function activity_menu in Activity 5.4

Same name and namespace in other branches
  1. 5 activity.module \activity_menu()
  2. 5.2 activity.module \activity_menu()
  3. 5.3 activity.module \activity_menu()
  4. 6.2 activity.module \activity_menu()
  5. 6 activity.module \activity_menu()
  6. 7 activity.module \activity_menu()

Implementation of hook_menu().

File

./activity.module, line 22
activity.module

Code

function activity_menu($may_cache) {
  $items = array();
  global $user;
  if ($may_cache) {
    $items[] = array(
      'path' => 'activity',
      'title' => t('Activity'),
      'callback' => 'activity_page',
      'access' => user_access('view public activity'),
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'activity/delete',
      'title' => t('Delete activity'),
      'callback' => 'activity_delete',
      'access' => user_access('administer activity'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'activity/all',
      'title' => t('All activity'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'access' => user_access('view public activity'),
    );
    $items[] = array(
      'path' => 'activity/mine',
      'title' => t('My activity'),
      'access' => $user->uid,
      'type' => MENU_LOCAL_TASK,
      'access' => user_access('view own activity'),
    );
    $items[] = array(
      'path' => 'activity/all/feed',
      'title' => t('All activity RSS'),
      'callback' => 'activity_feed',
      'callback arguments' => array(
        ACTIVITY_ALL,
      ),
      'type' => MENU_CALLBACK,
      'access' => user_access('view public activity'),
    );
    $items[] = array(
      'path' => 'activity/all/json',
      'title' => t('All activity JSON'),
      'callback' => 'activity_json',
      'callback arguments' => array(
        ACTIVITY_ALL,
        1,
      ),
      'type' => MENU_CALLBACK,
      'access' => user_access('view public activity'),
    );
    $items[] = array(
      'path' => 'admin/settings/activity',
      'title' => t('Activity Settings'),
      'description' => t('Customize what will display on your users activity page.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'activity_admin_settings',
      ),
    );
  }
  else {
    if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'activity') {
      if ($activity_info = activity_get_info()) {
        foreach ($activity_info as $module => $info) {
          $module_nice_name = drupal_ucfirst(str_replace('_', ' ', substr($module, 0, -8)));
          $items[] = array(
            'path' => 'admin/settings/activity/' . $module,
            'title' => $module_nice_name . ' ' . t('Module Activity Settings'),
            'description' => t('Customize what will display on your activity pages for the @module module', array(
              '@module' => $module_nice_name,
            )),
            'callback' => 'drupal_get_form',
            'callback arguments' => array(
              'activity_module_settings',
              arg(3),
            ),
            'type' => MENU_CALLBACK,
          );
        }
      }
    }
    if ($user->uid) {
      $items[] = array(
        'path' => 'activity/' . $user->uid . '/feed',
        'title' => t('My activity'),
        'callback' => 'activity_feed',
        'callback arguments' => array(
          $user->uid,
        ),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'activity/' . $user->uid . '/json',
        'callback' => 'activity_json',
        'callback arguments' => array(
          $user->uid,
          1,
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}