Projet

Général

Profil

Paste
Télécharger (3,54 ko) Statistiques
| Branche: | Révision:

root / htmltest / sites / all / modules / module_filter / module_filter.theme.inc @ dc45a079

1
<?php
2

    
3
/**
4
 * @file
5
 *
6
 * @author greenSkin
7
 */
8

    
9
function theme_module_filter_modules_table($variables) {
10
  $form = $variables['form'];
11

    
12
  // Individual table headers.
13
  $rows = array();
14
  // Iterate through all the modules, which are
15
  // children of this fieldset.
16
  foreach (element_children($form) as $key) {
17
    // Stick it into $module for easier accessing.
18
    $module = $form[$key];
19
    $row = array();
20
    unset($module['enable']['#title']);
21
    $row[] = array('class' => array('checkbox'), 'data' => drupal_render($module['enable']));
22
    $label = '<label';
23
    if (isset($module['enable']['#id'])) {
24
      $label .= ' for="'. $module['enable']['#id'] .'"';
25
    }
26
    $row[] = $label .'><strong>' . drupal_render($module['name']) . '</strong></label>';
27
    $row[] = drupal_render($module['version']);
28
    // Add the description, along with any modules it requires.
29
    $description = drupal_render($module['description']);
30
    if ($module['#requires']) {
31
      $description .= '<div class="admin-requirements">' . t('Requires: !module-list', array('!module-list' => implode(', ', $module['#requires']))) . '</div>';
32
    }
33
    if ($module['#required_by']) {
34
      $description .= '<div class="admin-requirements">' . t('Required by: !module-list', array('!module-list' => implode(', ', $module['#required_by']))) . '</div>';
35
    }
36
    $row[] = array('data' => $description, 'class' => array('description'));
37
    // Display links (such as help or permissions) in their own columns.
38
    foreach (array('help', 'permissions', 'configure') as $key) {
39
      $row[] = array('data' => drupal_render($module['links'][$key]), 'class' => array($key));
40
    }
41

    
42
    $id = module_filter_get_id($module['#package']);
43
    $rows[] = array(
44
      'data' => $row,
45
      'class' => array($id .'-tab-content')
46
    );
47
  }
48

    
49
  return theme('table', array('header' => $form['#header'], 'rows' => $rows, 'attributes' => array('class' => array('package'))));
50
}
51

    
52
/**
53
 * Theme callback for the modules tabbed form.
54
 */
55
function theme_module_filter_system_modules_tabs($variables) {
56
  $form = $variables['form'];
57

    
58
  $count_enabled = variable_get('module_filter_count_enabled', 1);
59

    
60
  // Display packages.
61
  $all = t('All');
62
  $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>' : '';
63
  $tabs = array('all' => '<li class="active"><a id="all-tab" class="project-tab overlay-exclude" href="#all">' . $all . $all_count . '</a></li>');
64
  foreach ($form['#packages'] as $package) {
65
    $id = module_filter_get_id($package);
66

    
67
    $count = ($count_enabled) ? '<span class="counts">' . t('!enabled of !total', array('!enabled' => $form['#tab_counts'][$package]['enabled'], '!total' => $form['#tab_counts'][$package]['total'])) . '</span>' : '';
68
    $tabs[$id] = '<li><a id="' . $id . '-tab" class="project-tab overlay-exclude" href="#' . str_replace('-', '_', $id) . '">' . $package . $count . '</a></li>';
69
  }
70

    
71
  $output = '<div id="module-filter-wrapper">';
72
  $output .= '<div id="module-filter-left">';
73
  $output .= '<div id="module-filter-tabs"><ul>'. implode($tabs) . '</ul></div>';
74
  $output .= '<div id="module-filter-submit">' . drupal_render($form['actions']) . '</div></div>';
75
  $output .= '<div id="module-filter-right"><div id="module-filter-squeeze">' . drupal_render($form['module_filter']);
76
  $output .= drupal_render($form['modules']) . '</div></div>';
77
  $output .= '<div class="clear-block"></div>';
78
  $output .= '</div>';
79
  $output .= drupal_render_children($form);
80
  return $output;
81
}