/[drupal]/contributions/modules/ldap_integration/ldapdata.theme.inc
ViewVC logotype

Contents of /contributions/modules/ldap_integration/ldapdata.theme.inc

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


Revision 1.3 - (show annotations) (download) (as text)
Wed Mar 18 12:12:02 2009 UTC (8 months, 1 week ago) by miglius
Branch: MAIN
CVS Tags: DRUPAL-6--1-0-BETA2, DRUPAL-6--1-0-BETA1, HEAD
Changes since 1.2: +17 -11 lines
File MIME type: text/x-php
ldap_integration: moved configuration functions form the files to the admin UI section, #405464
1 <?php
2 // $Id: ldapdata.theme.inc,v 1.2 2009/02/19 16:56:16 miglius Exp $
3
4 /**
5 * @file
6 * Themes for ldapdata module.
7 */
8
9 //////////////////////////////////////////////////////////////////////////////
10 // Theme callbacks
11
12 /**
13 * Theme function for the admin edit form.
14 */
15 function theme_ldapdata_admin_edit($form) {
16 $output = '';
17 $rows = array();
18 foreach (element_children($form) as $element) {
19 if ($element == 'attributes') {
20 if (isset($form['attributes']['table'])) {
21 foreach (element_children($form['attributes']['table']) as $key) {
22 $row = array();
23 $row[] = drupal_render($form['attributes']['table'][$key]);
24 $row[] = drupal_render($form['attributes']['ldapdata_roattrs'][$key]);
25 $row[] = drupal_render($form['attributes']['ldapdata_rwattrs'][$key]);
26 $rows[] = $row;
27 }
28 }
29 else {
30 $rows[] = array(array('data' => t('No attributes configured.'), 'colspan' => 3));
31 }
32 $form['attributes']['#children'] = drupal_render($form['attributes']['ldapdata_attrs']);
33 $form['attributes']['#children'] .= theme('table', $form['attributes']['header']['#value'], $rows);
34 $form['attributes']['#children'] .= drupal_render($form['attributes']['ldapdata_filter_php']);
35 $output .= drupal_render($form['attributes']);
36 }
37 else {
38 $output .= drupal_render($form[$element]);
39 }
40 }
41
42 $output .= drupal_render($form);
43
44 return $output;
45 }
46
47 /**
48 * Theme functon for the LDAP attribute.
49 */
50 function theme_ldapdata_ldap_attribute($value, $type) {
51 switch ($type) {
52 case 'url':
53 $ret = strpos($value, '://') ? $value : "http://$value";
54 $ret = "<a href=\"$ret\">$ret</a>";
55 break;
56 case 'txt':
57 default:
58 $ret = $value;
59 break;
60 }
61
62 return $ret;
63 }
64

  ViewVC Help
Powered by ViewVC 1.1.2