You are here

function modr8_menu in modr8 5

Same name and namespace in other branches
  1. 6 modr8.module \modr8_menu()
  2. 7 modr8.module \modr8_menu()

Implementation of hook_menu().

File

./modr8.module, line 23
Easy dedicated content moderation

Code

function modr8_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/content/modr8',
      'title' => t('Moderated content'),
      'description' => t('Approve or delete moderated content.'),
      'access' => user_access('moderate content'),
      'callback' => 'modr8_page',
    );
    $items[] = array(
      'path' => 'admin/logs/modr8',
      'title' => t('Content moderation log'),
      'description' => t('Show log of all actions on moderated content.'),
      'access' => user_access('moderate content'),
      'callback' => 'modr8_log_view',
    );
    $items[] = array(
      'path' => 'admin/settings/modr8',
      'title' => t('Modr8 settings'),
      'description' => t('Configure content moderation.'),
      'callback' => 'modr8_settings',
      'access' => user_access('administer site configuration'),
    );
  }
  elseif (arg(0) == 'node' && is_numeric($nid = arg(1))) {
    $items[] = array(
      'path' => 'node/' . $nid . '/modr8',
      'title' => t('Moderation'),
      'callback' => 'modr8_log_view',
      'callback arguments' => array(
        'node',
        $nid,
      ),
      'access' => user_access('moderate content') && db_result(db_query("SELECT COUNT(*) FROM {modr8_log} ml WHERE ml.nid = %d", $nid)),
      'weight' => 10,
      'type' => MENU_LOCAL_TASK,
    );
    if (arg(2) == 'log' && arg(3) == 'response' && ($token = arg(4)) && ($node = node_load($nid))) {
      $items[] = array(
        'path' => 'node/' . $nid . '/log/response/' . $token,
        'title' => 'Moderation response',
        'callback' => 'modr8_response_page',
        'callback arguments' => array(
          $node,
        ),
        'access' => modr8_response_access($node, $token),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}