Projet

Général

Profil

Révision 32700c57

Ajouté par Assos Assos il y a environ 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_help/ldap_help.examples.inc
3 3
/**
4 4
 * @file
5 5
 * The ldap_help issues provides a filtered watchdog view for ldap issues.
6
 *
7 6
 */
8 7

  
9 8
/**
10
 * the goal of this function is to illustrate samples from various ldap
9
 * The goal of this function is to illustrate samples from various ldap
11 10
 * implementations (AD, openldap, etc) alongside default/common
12 11
 * ldap module configurations.  The data for the ldaps and the configuration
13 12
 * should be the same as is used in the simpletets.
......
16 15
  module_load_include('php', 'ldap_test', 'LdapTestFunctions.class');
17 16
  $test_functions = new LdapTestFunctions();
18 17
  drupal_add_library('system', 'drupal.collapse');
19
  $sample_ldaps = array(
20
   'activedirectory' => 'activedirectory1',
21
   'openldap' => 'openldap1',
22
  );
18
  $sample_ldaps = [
19
    'activedirectory' => 'activedirectory1',
20
    'openldap' => 'openldap1',
21
  ];
23 22

  
24

  
25
  $form = array();
26
  foreach ($sample_ldaps as  $ldap_type => $sample_ldap_id) {
23
  $form = [];
24
  foreach ($sample_ldaps as $ldap_type => $sample_ldap_id) {
27 25

  
28 26
    $sample_ldap_id = $sample_ldaps[$ldap_type];
29 27
    $test_functions->populateFakeLdapServerData(LDAP_TEST_LDAP_NAME, $sample_ldap_id);
30 28
    $data = $test_functions->data['ldap_servers'][$sample_ldap_id]['ldap'];
31
    $form[$sample_ldap_id] = array(
32
        '#type' => 'fieldset',
33
        '#title' => $ldap_type,
34
        '#description' => '',
35
        '#attributes' => array('class' => array('collapsible', 'collapsed')),
36
        '#collapsible' => TRUE,
37
        '#collapsed' => TRUE,
38
      );
39
    foreach (array('people', 'groups') as $ou) {
40
      $form[$sample_ldap_id][$ou] = array(
29
    $form[$sample_ldap_id] = [
30
      '#type' => 'fieldset',
31
      '#title' => $ldap_type,
32
      '#description' => '',
33
      '#attributes' => ['class' => ['collapsible', 'collapsed']],
34
      '#collapsible' => TRUE,
35
      '#collapsed' => TRUE,
36
    ];
37
    foreach (['people', 'groups'] as $ou) {
38
      $form[$sample_ldap_id][$ou] = [
41 39
        '#type' => 'fieldset',
42 40
        '#title' => "ou=$ou",
43 41
        '#description' => '',
44
        '#attributes' => array('class' => array('collapsible', 'collapsed')),
42
        '#attributes' => ['class' => ['collapsible', 'collapsed']],
45 43
        '#collapsible' => TRUE,
46 44
        '#collapsed' => TRUE,
47
      );
45
      ];
48 46
    }
49 47

  
50 48
    foreach ($data as $dn => $item) {
......
52 50
      $ou = $ou[0];
53 51
      unset($item['count']);
54 52

  
55
      $li = array();
53
      $li = [];
56 54
      foreach ($item as $attr => $values) {
57 55
        unset($values['count']);
58 56
        if (count($values) == 1) {
59 57
          $li[] = "$attr: " . $values[0] . '<br/>';
60 58
        }
61 59
        else {
62
          $li[]  = theme('item_list', array('items' => $values , 'type' => 'ul', 'title' => $attr));
60
          $li[] = theme('item_list', ['items' => $values, 'type' => 'ul', 'title' => $attr]);
63 61
        }
64 62
      }
65
      $form[$sample_ldap_id][$ou][$dn] = array(
63
      $form[$sample_ldap_id][$ou][$dn] = [
66 64
        '#type' => 'fieldset',
67
        '#attributes' => array('class' => array('collapsible', 'collapsed')),
65
        '#attributes' => ['class' => ['collapsible', 'collapsed']],
68 66
        '#title' => $dn,
69 67
        '#collapsible' => TRUE,
70 68
        '#collapsed' => TRUE,
71
      );
72
      $form[$sample_ldap_id][$ou][$dn][] = array(
73
        '#markup' => theme('item_list', array('items' => $li , 'type' => 'ul', 'title' => '')),
74
      );
69
      ];
70
      $form[$sample_ldap_id][$ou][$dn][] = [
71
        '#markup' => theme('item_list', ['items' => $li, 'type' => 'ul', 'title' => '']),
72
      ];
75 73

  
76 74
    }
77 75
  }

Formats disponibles : Unified diff