Public Member Functions | |
| __construct ($a_ldap_connection, $a_result) | |
| Constructor. | |
| get () | |
| Get search result as array. | |
| getRows () | |
| Get all result rows. | |
| numRows () | |
| get number of rows | |
| __destruct () | |
Private Member Functions | |
| toSimpleArray () | |
| Transform ldap result in simple array. | |
| getEntries () | |
| Wrapper for ldap_get_entries. | |
Private Attributes | |
| $ldap_handle = null | |
| $result = null | |
| $entries = null | |
| $num_results = null | |
| $data = null | |
Definition at line 34 of file class.ilLDAPResult.php.
| ilLDAPResult::__construct | ( | $ | a_ldap_connection, | |
| $ | a_result | |||
| ) |
Constructor.
public
| resource | ldap connection | |
| resource | ldap result |
Definition at line 51 of file class.ilLDAPResult.php.
References toSimpleArray().
{
$this->ldap_handle = $a_ldap_connection;
$this->result = $a_result;
$this->toSimpleArray();
}
Here is the call graph for this function:| ilLDAPResult::__destruct | ( | ) |
Definition at line 155 of file class.ilLDAPResult.php.
{
@ldap_free_result($this->result);
}
| ilLDAPResult::get | ( | ) |
Get search result as array.
public
Definition at line 66 of file class.ilLDAPResult.php.
{
return $this->data ? $this->data : array();
}
| ilLDAPResult::getEntries | ( | ) | [private] |
Wrapper for ldap_get_entries.
private
Definition at line 166 of file class.ilLDAPResult.php.
Referenced by toSimpleArray().
{
return $this->entries = @ldap_get_entries($this->ldap_handle,$this->result);
// this way ldap_get_entries is binary safe
$i=0;
$tmp_entries = array();
$entry = ldap_first_entry($this->ldap_handle,$this->result);
do {
$attributes = @ldap_get_attributes($this->ldap_handle, $entry);
for($j=0; $j<$attributes['count']; $j++)
{
$values = ldap_get_values_len($this->ldap_handle, $entry,$attributes[$j]);
$tmp_entries[$i][strtolower($attributes[$j])] = $values;
}
$i++;
} while ($entry = @ldap_next_entry($this->ldap_handle,$entry));
if($i)
{
$tmp_entries['count'] = $i;
}
$this->entries = $tmp_entries;
return $this->entries;
}
Here is the caller graph for this function:| ilLDAPResult::getRows | ( | ) |
Get all result rows.
public
Definition at line 77 of file class.ilLDAPResult.php.
{
return $this->all_rows ? $this->all_rows : array();
}
| ilLDAPResult::numRows | ( | ) |
get number of rows
public
Definition at line 89 of file class.ilLDAPResult.php.
{
return $this->num_results;
}
| ilLDAPResult::toSimpleArray | ( | ) | [private] |
Transform ldap result in simple array.
private
Definition at line 101 of file class.ilLDAPResult.php.
References $data, and getEntries().
Referenced by __construct().
{
$this->data = array();
$this->num_results = 0;
if(!$this->entries = $this->getEntries())
{
return false;
}
$this->num_results = $this->entries['count'];
if($this->entries['count'] == 0)
{
return true;
}
for($row_counter = 0; $row_counter < $this->entries['count'];$row_counter++)
{
$data = array();
foreach($this->entries[$row_counter] as $key => $value)
{
$key = strtolower($key);
if(is_int($key))
{
continue;
}
if($key == 'dn')
{
$data['dn'] = $value;
continue;
}
if($value['count'] > 1)
{
for($i = 0; $i < $value['count']; $i++)
{
$data[$key][] = $value[$i];
}
}
elseif($value['count'] == 1)
{
$data[$key] = $value[0];
}
}
$this->all_rows[] = $data;
if($row_counter == 0)
{
$this->data = $data;
}
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:ilLDAPResult::$data = null [private] |
Definition at line 41 of file class.ilLDAPResult.php.
Referenced by toSimpleArray().
ilLDAPResult::$entries = null [private] |
Definition at line 38 of file class.ilLDAPResult.php.
ilLDAPResult::$ldap_handle = null [private] |
Definition at line 36 of file class.ilLDAPResult.php.
ilLDAPResult::$num_results = null [private] |
Definition at line 40 of file class.ilLDAPResult.php.
ilLDAPResult::$result = null [private] |
Definition at line 37 of file class.ilLDAPResult.php.
1.7.1