Location: PHPKode > projects > LDAPted > ldapted/includes/XMLlist.php
<?php
/***************************************************************************
 *
 *                                  XMLinterface.php
 *                              -------------------
 *
 *   begin                : Friday, Juni 26, 2003
 *   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 XMLlist extends XMLDocument {
  
  var $error;
  var $layoutOptions;
  var $options;

  function XMLlist($filename) {
    $this->init($filename);

    //if ( ! $error ) {
    //$this->layoutOptions = $this->get_layout_options();
    //} else {
    //  $this->error=$error;
    //}
  }
  
  function get_attribute_description( $attribute, $lang="en" ) {
    $return = 
      $this->get_xml_content("/list/attribute[@name=\"".$attribute."\"]/description[@lang=\"".$lang."\"]",0,1);
    return $return[0];
  }
  
  function get_attributes() {
    return 
      $this->get_xml_attributes("/list/attribute","name");
  }
  
  function get_sortAttribute() {
    $sort =
      $this->get_xml_attributes("/list/attribute[@sort=\"true\"]","name");
    if ( $sort[0] != "" ) {
      $sort = $sort[0];
    } else {
      $sort = "dn";
    }
    return $sort;
  }
  
  function get_label($attribute,$lang="en") {
    $return = 
      $this->get_xml_content("/list/attribute[@name=\"".$attribute."\"]/label[@lang=\"".$lang."\"]",0,1);
    return $return[0];
  }

  function get_type($attribute) {
    $return =
      $this->get_xml_attributes("/list/attribute[@name=\"".$attribute."\"]","type");
    return $return[0];
  }

  function get_layout_options() {
    if (!$this->layoutOption) {
      $this->layoutOption = $this->get_xml_content_by_key("/list/layout/option","name");
    }
    return $this->layoutOption;
  }

  function get_attribute_options($attribute) {
    return $this->get_xml_content_by_key("/list/attribute[@name=\"".$attribute."\"]/option","name");
  }

  function get_name() {
    $return = $this->get_xml_attributes("/list","name");
    return $return[0];
  }
}

?>
Return current item: LDAPted