function advanced_help_index_page

cis7 advanced_help.module advanced_help_index_page($module = '')
cle7 advanced_help.module advanced_help_index_page($module = '')
elmsmedia7 advanced_help.module advanced_help_index_page($module = '')
icor7 advanced_help.module advanced_help_index_page($module = '')
meedjum_blog7 advanced_help.module advanced_help_index_page($module = '')
mooc7 advanced_help.module advanced_help_index_page($module = '')

Page callback to view the advanced help topic index.

Parameters

string $module:

Return value

array

1 string reference to 'advanced_help_index_page'
advanced_help_menu in sites/all/modules/ulmus/advanced_help/advanced_help.module
Implements hook_menu().

File

sites/all/modules/ulmus/advanced_help/advanced_help.module, line 175
Pluggable system to provide advanced help facilities for Drupal and modules.

Code

function advanced_help_index_page($module = '') {
  $topics = advanced_help_get_topics();
  $settings = advanced_help_get_settings();

  $output = array();
  // Print a search widget.
  $output['advanced_help_search'] = module_exists('search') ? drupal_get_form('advanced_help_search_form') : t('Enable the search module to search help.');

  $breadcrumb = array();
  if ($module) {
    if (empty($topics[$module])) {
      return drupal_not_found();
    }

    advanced_help_get_topic_hierarchy($topics);
    $items = advanced_help_get_tree($topics, $topics[$module]['']['children']);

    $breadcrumb[] = advanced_help_l(t('Help'), 'admin/advanced_help');

    drupal_set_title(t('@module help index', array('@module' => advanced_help_get_module_name($module))));
    $output['items-module'] = array(
      '#theme' => 'item_list',
      '#items' => $items,
    );
  }
  else {
    // Print a module index.
    $modules = array();
    $result = db_query('SELECT * FROM {system}');
    foreach ($result as $info) {
      $module_info = unserialize($info->info);
      $modules[$info->name] = $module_info['name'];
    }

    asort($modules);

    $items = array();
    foreach ($modules as $module => $module_name) {
      if (!empty($topics[$module]) && empty($settings[$module]['hide'])) {
        if (isset($settings[$module]['index name'])) {
          $name = $settings[$module]['index name'];
        }
        elseif (isset($settings[$module]['name'])) {
          $name = $settings[$module]['name'];
        }
        else {
          $name = t($module_name);
        }
        $items[] = advanced_help_l($name, "admin/advanced_help/$module");
      }
    }

    drupal_set_title(t('Module help index'));
    $output['items-nomodule'] = array(
      '#theme' => 'item_list',
      '#items' => $items,
    );
  }

  $popup = !empty($_GET['popup']) && user_access('view advanced help popup');
  if ($popup) {
    $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing.
    module_invoke('admin_menu', 'suppress'); // Suppress admin_menu.
    drupal_set_breadcrumb(array_reverse($breadcrumb));
    print theme('advanced_help_popup', array('content' => $output));
    return;
  }

  $breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb));
  drupal_set_breadcrumb($breadcrumb);
  return $output;
}