Net_LDAP
[ class tree: Net_LDAP ] [ index: Net_LDAP ] [ all elements ]

Class: Net_LDAP_Search

Source Location: /Net_LDAP-0.7.0/LDAP/Search.php

Class Overview

PEAR
   |
   --Net_LDAP_Search

Result set of an LDAP search


Author(s):

  • Tarjei Huse

Version:

  • $Revision: 1.16 $

Methods


Inherited Variables

Inherited Methods


Class Details

[line 34]
Result set of an LDAP search
  • Author: Tarjei Huse
  • Version: $Revision: 1.16 $


[ Top ]


Method Detail

Net_LDAP_Search (Constructor)   [line 107]

Net_LDAP_Search Net_LDAP_Search( &$search, &$ldap, [array $attributes = array()], resource $search, Net_LDAP|resource $ldap)

Constructor
  • Access: protected

Parameters:

resource   $search   —  Search result identifier
Net_LDAP|resource   $ldap   —  Net_LDAP object or just a LDAP-Link resource
array   $attributes   —  (optional) Array with searched attribute names. (see $_searchedAttrs)
   &$search   — 
   &$ldap   — 

[ Top ]

_Net_LDAP_Search (Destructor)   [line 422]

void _Net_LDAP_Search( )

Destructor
  • Access: protected

[ Top ]

as_struct   [line 350]

array as_struct( )

Return entries as array

This method returns the entries and the selected attributes values as array. The first array level contains all found entries where the keys are the DNs of the entries. The second level arrays contian the entries attributes such that the keys is the lowercased name of the attribute and the values are stored in another indexed array. Note that the attribute values are stored in an array even if there is no or just one value.

The array has the following structure:

  1.  $return = array(
  2.            'cn=foo,dc=example,dc=com' => array(
  3.                                                 'sn'       => array('foo'),
  4.                                                 'multival' => array('val1''val2''valN')
  5.                                              )
  6.            'cn=bar,dc=example,dc=com' => array(
  7.                                                 'sn'       => array('bar'),
  8.                                                 'multival' => array('val1''valN')
  9.                                              )
  10.            )

  • Return: associative result array as described above

[ Top ]

count   [line 398]

int count( )

Returns the number of entries in the searchresult
  • Return: Number of entries in search.

[ Top ]

done   [line 430]

void done( )

Closes search result

[ Top ]

entries   [line 132]

array entries( )

Returns an assosiative array of entry objects
  • Return: Array of entry objects.

[ Top ]

getErrorCode   [line 412]

int getErrorCode( )

Get the errorcode the object got in its search.
  • Return: The ldap error number.

[ Top ]

pop_entry   [line 183]

Net_LDAP_Error pop_entry( )

Retrieve the last entry of the searchset. NOT IMPLEMENTED
  • Todo: implement me!

[ Top ]

setLink   [line 388]

void setLink( &$link, resource $link)

Set the ldap ressource link
  • Access: public

Parameters:

resource   $link   —  Link identifier
   &$link   — 

[ Top ]

setSearch   [line 376]

void setSearch( &$search, resource $search)

Set the search objects resource link
  • Access: public

Parameters:

resource   $search   —  Search result identifier
   &$search   — 

[ Top ]

shiftEntry   [line 148]

Net_LDAP_Entry|false &shiftEntry( )

Get the next entry in the searchresult.
  • Return: Reference to Net_LDAP_Entry object or false

[ Top ]

shift_entry   [line 171]

void shift_entry( )

alias function of shiftEntry() for perl-ldap interface

[ Top ]

sorted   [line 306]

array|Net_LDAP_Error sorted( [array $attrs = array('cn')], [int $order = SORT_ASC])

Return entries sorted as objects

This returns a array with sorted Net_LDAP_Entry objects. The sorting is actually done with sorted_as_struct().

Please note that attribute names are case sensitive!

Usage example:

  1.    // to sort entries first by location, then by surename, but descending:
  2.    $entries $search->sorted(array('locality','sn')SORT_DESC);

  • Return: Array with sorted Net_LDAP_Entries or error

Parameters:

array   $attrs   —  Array of sort attributes to sort; order from left to right.
int   $order   —  Ordering direction, either constant SORT_ASC or SORT_DESC

[ Top ]

sorted_as_struct   [line 207]

array|Net_LDAP_Error sorted_as_struct( [array $attrs = array('cn')], [int $order = SORT_ASC])

Return entries sorted as array

This returns a array with sorted entries and the values. Sorting is done with PHPs http://www.php.net/array_multisort. This method relies on as_struct() to fetch the raw data of the entries.

Please note that attribute names are case sensitive!

Usage example:

  1.    // to sort entries first by location, then by surename, but descending:
  2.    $entries $search->sorted_as_struct(array('locality','sn')SORT_DESC);

  • Return: Array with sorted entries or error

Parameters:

array   $attrs   —  Array of attribute names to sort; order from left to right.
int   $order   —  Ordering direction, either constant SORT_ASC or SORT_DESC

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:56:28 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.