Location: PHPKode > projects > LDAPted > ldapted/includes/controls/DNList.php
<?php
/***************************************************************************
 *
 *                                  CustomListe.php
 *                              -------------------
 *
 *   begin                : Friday, Jul 5, 2002
 *   copyright            : (C) 2002 The Kabramps Team
 *   email                : hide@address.com,
 *                          hide@address.com
 *
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 *   See the GNU General Public License for more details.
 *   (http://www.gnu.org/licenses/gpl.html)
 *
 ***************************************************************************/

class DNList extends CustomList {  // List is a reserved name ;-)
  
  function DNList ($attribute, $value, $xmlDoc, $tmpl, $lang) {
    $this->Liste($attribute, $value, $xmlDoc, $tmpl, $lang);
  }

  function get_view_panel () {
    global $config;
    global $ldap;

    $size = $this->attributeoptions["size"];
    if ( ( $size == "" ) || ( $size < 2 ) ) $size = 2;

    $textvalue = $this->utf8_LDAPdecode($this->value);

    unset ($textvalue["count"]);
    for ($i=0; $i < count($textvalue);$i++){
      if ( $textvalue[$i] == "" ) {
	unset($textvalue[$i]);
      }else{
        include_once ('includes/ListEntryFactory.php');
	include_once ('includes/XMLlist.php');
	$listEntryFactory = new ListEntryFactory;
	$xml       	= new XMLlist ( "adapted/lists/".$config->get_host_lists( $_SESSION['host'] ) );
	$listAttributes =   $xml->get_attributes();
	$entry = $ldap->search($textvalue[$i],$listAttributes,null,1);
	$type = explode("=",$textvalue[$i], 2);
	$type = trim($type[0]);
	$entry = $listEntryFactory->factory($entry[0], $listAttributes, $xml, $this->attributeoptions["formular"], $type, $this->tmpl, $count, $open );
	$myrows[] = $entry->get_view();
      }
    }
    
//    $this->tmpl->assign($myrows);
    $this->tmpl->assign(array("ATTRIBLABEL"	=> $this->xmlDoc->get_label($this->attribute, $this->lang),
                        "ATTRIBNAME"	=> $this->attribute,
                        "skin"		=> $skin,
			"row"		=> $myrows
                        ));
    
    return $this->tmpl->fetch($this->get_template('view'));
  }  
}

?>
Return current item: LDAPted