module_filter.theme.inc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * @file
  4. *
  5. * @author greenSkin
  6. */
  7. function theme_module_filter_modules_table($variables) {
  8. $form = $variables['form'];
  9. // Individual table headers.
  10. $rows = array();
  11. // Iterate through all the modules, which are
  12. // children of this fieldset.
  13. foreach (element_children($form) as $key) {
  14. // Stick it into $module for easier accessing.
  15. $module = $form[$key];
  16. $row = array();
  17. unset($module['enable']['#title']);
  18. $row[] = array('class' => array('checkbox'), 'data' => drupal_render($module['enable']));
  19. $label = '<label';
  20. if (isset($module['enable']['#id'])) {
  21. $label .= ' for="'. $module['enable']['#id'] .'"';
  22. }
  23. $row[] = $label .'><strong>' . drupal_render($module['name']) . '</strong></label>';
  24. $row[] = drupal_render($module['version']);
  25. // Add the description, along with any modules it requires.
  26. $description = drupal_render($module['description']);
  27. if ($module['#requires']) {
  28. $description .= '<div class="admin-requirements">' . t('Requires: !module-list', array('!module-list' => implode(', ', $module['#requires']))) . '</div>';
  29. }
  30. if ($module['#required_by']) {
  31. $description .= '<div class="admin-requirements">' . t('Required by: !module-list', array('!module-list' => implode(', ', $module['#required_by']))) . '</div>';
  32. }
  33. $row[] = array('data' => $description, 'class' => array('description'));
  34. // Display links (such as help or permissions) in their own columns.
  35. foreach (array('help', 'permissions', 'configure') as $key) {
  36. $row[] = array('data' => drupal_render($module['links'][$key]), 'class' => array($key));
  37. }
  38. $id = module_filter_get_id($module['#package']);
  39. $rows[] = array(
  40. 'data' => $row,
  41. 'class' => array($id .'-tab-content')
  42. );
  43. }
  44. return theme('table', array('header' => $form['#header'], 'rows' => $rows, 'attributes' => array('class' => array('package'))));
  45. }
  46. /**
  47. * Theme callback for the modules tabbed form.
  48. */
  49. function theme_module_filter_system_modules_tabs($variables) {
  50. $form = $variables['form'];
  51. $count_enabled = variable_get('module_filter_count_enabled', 1);
  52. // Display packages.
  53. $all = t('All');
  54. $all_count = ($count_enabled) ? '<span class="counts">' . t('!enabled of !total', array('!enabled' => $form['#tab_counts'][$all]['enabled'], '!total' => $form['#tab_counts'][$all]['total'])) . '</span>' : '';
  55. $tabs = array('all' => '<li class="active"><a id="all-tab" class="project-tab overlay-exclude" href="#all">' . $all . $all_count . '</a></li>');
  56. foreach ($form['#packages'] as $package) {
  57. $id = module_filter_get_id($package);
  58. $count = ($count_enabled) ? '<span class="counts">' . t('!enabled of !total', array('!enabled' => $form['#tab_counts'][$package]['enabled'], '!total' => $form['#tab_counts'][$package]['total'])) . '</span>' : '';
  59. $tabs[$id] = '<li><a id="' . $id . '-tab" class="project-tab overlay-exclude" href="#' . str_replace('-', '_', $id) . '">' . $package . $count . '</a></li>';
  60. }
  61. $output = '<div id="module-filter-wrapper">';
  62. $output .= '<div id="module-filter-left">';
  63. $output .= '<div id="module-filter-tabs"><ul>'. implode($tabs) . '</ul></div>';
  64. $output .= '<div id="module-filter-submit">' . drupal_render($form['actions']) . '</div></div>';
  65. $output .= '<div id="module-filter-right"><div id="module-filter-squeeze">' . drupal_render($form['module_filter']);
  66. $output .= drupal_render($form['modules']) . '</div></div>';
  67. $output .= '<div class="clear-block"></div>';
  68. $output .= '</div>';
  69. $output .= drupal_render_children($form);
  70. return $output;
  71. }