[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/modules/help/ -> help.admin.inc (source)

   1  <?php
   2  
   3  /**
   4   * @file
   5   * Admin page callbacks for the help module.
   6   */
   7  
   8  /**
   9   * Menu callback; prints a page listing a glossary of Drupal terminology.
  10   */
  11  function help_main() {
  12    // Add CSS
  13    drupal_add_css(drupal_get_path('module', 'help') .'/help.css', 'module', 'all', FALSE);
  14    $output = '<h2>'. t('Help topics') .'</h2><p>'. t('Help is available on the following items:') .'</p>'. help_links_as_list();
  15    return $output;
  16  }
  17  
  18  /**
  19   * Menu callback; prints a page listing general help for a module.
  20   */
  21  function help_page($name) {
  22    $output = '';
  23    if (module_hook($name, 'help')) {
  24      $module = drupal_parse_info_file(drupal_get_path('module', $name) .'/'. $name .'.info');
  25      drupal_set_title($module['name']);
  26  
  27      $temp = module_invoke($name, 'help', "admin/help#$name", drupal_help_arg());
  28      if (empty($temp)) {
  29        $output .= t("No help is available for module %module.", array('%module' => $module['name']));
  30      }
  31      else {
  32        $output .= $temp;
  33      }
  34  
  35      // Only print list of administration pages if the module in question has
  36      // any such pages associated to it.
  37      $admin_tasks = system_get_module_admin_tasks($name);
  38      if (!empty($admin_tasks)) {
  39        ksort($admin_tasks);
  40        $output .= theme('item_list', $admin_tasks, t('@module administration pages', array('@module' => $module['name'])));
  41      }
  42  
  43    }
  44    return $output;
  45  }
  46  
  47  function help_links_as_list() {
  48    $empty_arg = drupal_help_arg();
  49    $module_info = module_rebuild_cache();
  50  
  51    $modules = array();
  52    foreach (module_implements('help', TRUE) as $module) {
  53      if (module_invoke($module, 'help', "admin/help#$module", $empty_arg)) {
  54        $modules[$module] = $module_info[$module]->info['name'];
  55      }
  56    }
  57    asort($modules);
  58  
  59    // Output pretty four-column list
  60    $count = count($modules);
  61    $break = ceil($count / 4);
  62    $output = '<div class="clear-block"><div class="help-items"><ul>';
  63    $i = 0;
  64    foreach ($modules as $module => $name) {
  65      $output .= '<li>'. l($name, 'admin/help/'. $module) .'</li>';
  66      if (($i + 1) % $break == 0 && ($i + 1) != $count) {
  67        $output .= '</ul></div><div class="help-items'. ($i + 1 == $break * 3 ? ' help-items-last' : '') .'"><ul>';
  68      }
  69      $i++;
  70    }
  71    $output .= '</ul></div></div>';
  72  
  73    return $output;
  74  }
  75  


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7