/[drupal]/contributions/modules/ldap_lookup/ldap_lookup.blocks
ViewVC logotype

Contents of /contributions/modules/ldap_lookup/ldap_lookup.blocks

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Thu Oct 4 10:07:03 2007 UTC (2 years, 1 month ago) by kibble
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -0 lines
Version checks only
1 <?php
2 // $Id: ldap_lookup.blocks,v 1.2 2007/09/26 09:57:27 kibble Exp $
3
4 function ldap_lookup_block($op = 'list', $delta = 0) {
5
6 global $user;
7
8 if ($op == 'list') {
9 $blocks[0]['info'] = t('Display Name Navigation');
10 return $blocks;
11 } else {
12 $block = array();
13
14 switch ($delta) {
15 case 0:
16 if (!$user->uid) {
17 return;
18 }
19
20 if ($menu = theme('menu_tree')) {
21
22 if ( ! ($displayname = cache_get($user->created))) {
23
24 $ldap = _ldap_lookup_auth($user->name, NULL);
25 $ent = $ldap->retrieve($ldap->binddn);
26
27 $displayname = $ent['displayname'][0];
28 cache_set($user->created, 'cache', $ent['displayname'][0], CACHE_TEMPORARY);
29
30 unset($ldap);
31 unset($ent);
32
33 } else {
34 $displayname = $displayname->data;
35 }
36
37 /** this is very messy but I will work it out */
38 $menu = preg_replace('#<(\w+)[^>]*>\s*</\1>#im','', $menu);
39 $menu = preg_replace('#<(\w+)[^>]*>\s*</\1>#im','', $menu);
40
41 $block['subject'] = $displayname;
42 $block['content'] = '<div class="menu">'. $menu .'</div>';
43
44 }
45 return $block;
46 }
47 }
48
49 }
50
51 ?>

  ViewVC Help
Powered by ViewVC 1.1.2