00001 <?php
00002
00003
00012 function help_main() {
00013
00014 drupal_add_css(drupal_get_path('module', 'help') . '/help.css', 'module', 'all', FALSE);
00015 $output = '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . help_links_as_list();
00016 return $output;
00017 }
00018
00022 function help_page($name) {
00023 $output = '';
00024 if (module_hook($name, 'help')) {
00025 $module = drupal_parse_info_file(drupal_get_path('module', $name) . '/' . $name . '.info');
00026 drupal_set_title($module['name']);
00027
00028 $temp = module_invoke($name, 'help', "admin/help#$name", drupal_help_arg());
00029 if (empty($temp)) {
00030 $output .= t("No help is available for module %module.", array('%module' => $module['name']));
00031 }
00032 else {
00033 $output .= $temp;
00034 }
00035
00036
00037
00038 $admin_tasks = system_get_module_admin_tasks($name);
00039 if (!empty($admin_tasks)) {
00040 ksort($admin_tasks);
00041 $output .= theme('item_list', $admin_tasks, t('@module administration pages', array('@module' => $module['name'])));
00042 }
00043
00044 }
00045 return $output;
00046 }
00047
00048 function help_links_as_list() {
00049 $empty_arg = drupal_help_arg();
00050 $module_info = module_rebuild_cache();
00051
00052 $modules = array();
00053 foreach (module_implements('help', TRUE) as $module) {
00054 if (module_invoke($module, 'help', "admin/help#$module", $empty_arg)) {
00055 $modules[$module] = $module_info[$module]->info['name'];
00056 }
00057 }
00058 asort($modules);
00059
00060
00061 $count = count($modules);
00062 $break = ceil($count / 4);
00063 $output = '<div class="clear-block"><div class="help-items"><ul>';
00064 $i = 0;
00065 foreach ($modules as $module => $name) {
00066 $output .= '<li>' . l($name, 'admin/help/' . $module) . '</li>';
00067 if (($i + 1) % $break == 0 && ($i + 1) != $count) {
00068 $output .= '</ul></div><div class="help-items' . ($i + 1 == $break * 3 ? ' help-items-last' : '') . '"><ul>';
00069 }
00070 $i++;
00071 }
00072 $output .= '</ul></div></div>';
00073
00074 return $output;
00075 }
00076