home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / drupal-6.0.exe / drupal-6.0 / modules / help / help.admin.inc < prev    next >
Encoding:
Text File  |  2007-11-25  |  2.2 KB  |  77 lines

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