Thursday 21 August 2003 2:07:03 pm
There has to be documentation on this somewhere but I can't find any so here it goes.
I have modified the User class and added an enum attribute to it. (Multiple choice, option style, 2 elements with values) Now my question is how can I retrieve the selected elements from the enum for the current user? I've gotten as far as this:
$user = &eZUser::currentUser();
$userObject = &$user->attribute( "contentobject" ); $datamap = &$userObject->attribute ( "data_map" );
foreach ($datamap as $key => $value)
{
if ($key == 'my_enum')
{
$contentClassAttribute = $value->attribute ( 'contentclass_attribute' );
$contentClassAttributeID = $contentClassAttribute->attribute('id' );
$contentClassAttributeVersion = $contentClassAttribute->attribute('version' );
$array_enumValue =
eZEnumValue::fetchAllElements( $contentClassAttributeID, $contentClassAttributeVersion );
} }
(adapted from developer/ez_publish_3/documentation/development/importing_attribute_data) I Know that this doesn't work because fetchAllElements fetches all elements (amazing). Is there a function that fetches selected elements from a Enum? Or am I approaching this all wrong? I'm stumped, and I'm sure there's an easy way to do this, if there is anyone that could direct me to the appropriate documentation or give me a little guidance I would be most appreciative. Thanks in advance! Dave
|