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

Class: Net_LDAP_Search

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

Class Overview

PEAR
   |
   --Net_LDAP_Search

Result set of an LDAP search


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 31]
Result set of an LDAP search


[ Top ]


Method Detail

Net_LDAP_Search (Constructor)   [line 115]

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

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)

[ Top ]

_Net_LDAP_Search (Destructor)   [line 465]

void _Net_LDAP_Search( )

Destructor
  • Access: protected

[ Top ]

as_struct   [line 391]

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 441]

int count( )

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

[ Top ]

done   [line 475]

void done( )

Closes search result

[ Top ]

entries   [line 140]

array entries( )

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

[ Top ]

getErrorCode   [line 455]

int getErrorCode( )

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

[ Top ]

popEntry   [line 200]

Net_LDAP_Entry|false popEntry( )

Retrieve the next entry in the searchresult, but starting from last entry

This is the opposite to shiftEntry() and is also very useful to be used inside a while loop.


[ Top ]

pop_entry   [line 217]

Net_LDAP_Entry|false pop_entry( )

Alias function of popEntry() for perl-ldap interface

[ Top ]

setLink   [line 431]

void setLink( resource &$link)

Set the ldap ressource link
  • Access: public

Parameters:

resource   &$link   —  Link identifier

[ Top ]

setSearch   [line 418]

void setSearch( resource &$search)

Set the search objects resource link
  • Access: public

Parameters:

resource   &$search   —  Search result identifier

[ Top ]

shiftEntry   [line 160]

Net_LDAP_Entry|false &shiftEntry( )

Get the next entry in the searchresult.

This will return a valid Net_LDAP_Entry object or false, so you can use this method to easily iterate over the entries inside a while loop.

  • Return: Reference to Net_LDAP_Entry object or false

[ Top ]

shift_entry   [line 186]

Net_LDAP_Entry|false shift_entry( )

Alias function of shiftEntry() for perl-ldap interface

[ Top ]

sizeLimitExceeded   [line 497]

boolean sizeLimitExceeded( )

Tells if this search exceeds a sizelimit

[ Top ]

sorted   [line 346]

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 243]

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 15:32:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.