![]() Communications Software |
||||||||||||||||||||||||||||||||
| Plexcel for PHP - Active Directory PHP Integration | ||||||||||||||||||||||||||||||||
| plexcel_new plexcel_status plexcel_find_authorities_by_domain plexcel_get_authority plexcel_get_domain plexcel_log plexcel_preamble plexcel_authenticate plexcel_sso plexcel_logon plexcel_logoff plexcel_accept_token plexcel_is_member_of plexcel_set_password plexcel_change_password plexcel_gen_service_keytab plexcel_search_objects plexcel_get_account plexcel_add_object plexcel_modify_object plexcel_delete_object plexcel_rename_object plexcel_set_attrdefs plexcel_get_attrdefs plexcel_set_conv_attrdefs |
Synopsisbool plexcel_set_attrdefs(resource $px, array $attrdefs) DescriptionThe plexcel_set_attrdefs function sets attribute definitions that allow Plexcel functions to accept and return attribute values that are more convenient for the programmer. Note: Currently attribute definitions do not work with the PLEXCEL_SUPPLEMENTAL flag used with plexcel_get_account. Attribute definitions for more than 200 attributes commonly found in AD are preloaded which means that it may not be necessary to use this function at all. However, all other attributes, such as those from less commonly used objects or from schema customizations, will be represented within scripts as multivalued and binary (the default behavior is just like the raw LDAP API). In this case, it may be convenient for the programmer to add their own attribute definitions with this function. The $px parameter is the Plexcel context resource for which attribute definitions will be set. Attribute definitions are limited in scope to the specified Plexcel context and will not affect attribute definitions of other contexts. The $attrdefs parameter is an array of attribute definitions. An attribute definition is an array containing the elements type , flags and conv described below. The type elementThe type element instructs Plexcel as to how to represent the attribute at the script level. The following table describes the possible type values.
The flags elementThe flags element should be set to PLEXCEL_SINGLE_VALUED if the attribute is single valued or 0 if it is multivalued. If the PLEXCEL_SINGLE_VALUED flag is set, Plexcel functions that return objects will represent the attribute as a simple array value indexed by name (e.g. $obj['name'] ). Otherwise, like the raw LDAP API, single valued attributes will be represented as a 0 indexed array value within an array indexed by name (e.g. $obj['name'][0] ). When manipulating large numbers of attributes, this small change can make your significantly simpler and more efficient. The conv elementThe conv element indicates to Plexcel that certain attributes should be automatically converted between a script-level representation and the directory representation. The conv element values are always in the form PLEXCEL_CONV_<script representation>_X_<directory representation> as shown in the below table of possible conv values.
ReturnsThe plexcel_set_attrdefs function returns TRUE if the attribute definitions were successfully added to the Plexcel context resource. Otherwise, FALSE is returned in which case plexcel_status should be consulted. ExampleThe following PHP fragment illustrates how to set an attribute definition with the PLEXCEL_CONV_TIME1970M_X_TIMEUTC automatic type conversion and then print a human readable time using PHP's date function. $attrdefs = array(
'currentTime' => array(
'type' => PLEXCEL_TYPE_TIME,
'flags' => PLEXCEL_SINGLE_VALUED,
'conv' => PLEXCEL_CONV_TIME1970M_X_TIMEUTC));
if (plexcel_set_attrdefs($px, $attrdefs) == FALSE)
die('<pre>' . plexcel_status($px) . '</pre>');
// call plexcel_search_objects to get currentTime from RootDSE
// This prints a date string like Mar 16, 2007 5:58:51 PM
echo 'currentTime:' . date('M j, Y g:i:s A', $rootdse['currentTime'] / 1000.0);
Pretty-printing the currentTime with help from a plexcel_set_attrdefs conversion.
See alsoplexcel_set_conv_attrdefs | plexcel_get_attrdefs |
|||||||||||||||||||||||||||||||
|
© 2008 IOPLEX Software |
Contact Us |
Policies
|