Code coverage for /20080809/modules/help/help.admin.inc

Line #Times calledCode
1
<?php
2
// $Id: help.admin.inc,v 1.6 2008/04/14 17:48:37 dries Exp $
3
4
/**
5
 * @file
6
 * Admin page callbacks for the help module.
7
 */
8
9
/**
10
 * Menu callback; prints a page listing a glossary of Drupal terminology.
11
 */
1230
function help_main() {
13
  // Add CSS
140
  drupal_add_css(drupal_get_path('module', 'help') . '/help.css', 'module',
'all', FALSE);
150
  $output = '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available
on the following items:') . '</p>' . help_links_as_list();
160
  return $output;
170
}
18
19
/**
20
 * Menu callback; prints a page listing general help for a module.
21
 */
2230
function help_page($name) {
2316
  $output = '';
2416
  if (module_hook($name, 'help')) {
2516
    $module = drupal_parse_info_file(drupal_get_path('module', $name) . '/'
. $name . '.info');
2616
    drupal_set_title($module['name']);
27
2816
    $temp = module_invoke($name, 'help', "admin/help#$name",
drupal_help_arg());
2916
    if (empty($temp)) {
300
      $output .= t("No help is available for module %module.",
array('%module' => $module['name']));
310
    }
32
    else {
3316
      $output .= $temp;
34
    }
35
36
    // Only print list of administration pages if the module in question
has
37
    // any such pages associated to it.
3816
    $admin_tasks = system_get_module_admin_tasks($name);
3916
    if (!empty($admin_tasks)) {
401
      ksort($admin_tasks);
411
      $output .= theme('item_list', $admin_tasks, t('@module administration
pages', array('@module' => $module['name'])));
421
    }
43
4416
  }
4516
  return $output;
460
}
47
4830
function help_links_as_list() {
490
  $empty_arg = drupal_help_arg();
500
  $module_info = module_rebuild_cache();
51
520
  $modules = array();
530
  foreach (module_implements('help', TRUE) as $module) {
540
    if (module_invoke($module, 'help', "admin/help#$module", $empty_arg))
{
550
      $modules[$module] = $module_info[$module]->info['name'];
560
    }
570
  }
580
  asort($modules);
59
60
  // Output pretty four-column list
610
  $count = count($modules);
620
  $break = ceil($count / 4);
630
  $output = '<div class="clear-block"><div class="help-items"><ul>';
640
  $i = 0;
650
  foreach ($modules as $module => $name) {
660
    $output .= '<li>' . l($name, 'admin/help/' . $module) . '</li>';
670
    if (($i + 1) % $break == 0 && ($i + 1) != $count) {
680
      $output .= '</ul></div><div class="help-items' . ($i + 1 == $break *
3 ? ' help-items-last' : '') . '"><ul>';
690
    }
700
    $i++;
710
  }
720
  $output .= '</ul></div></div>';
73
740
  return $output;
750
}
76
7730