User management for the world wide web

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

GenieGate_Properties Class Reference

Routines for manipulating user properties. More...

List of all members.

Public Member Functions

 GenieGate_Properties (&$dbh)
 Constructor, needs a mysql handle.

 getSection ($section, $uid)
 Gets a PropSection, which can be used for setting the properties.

 createSection ($skey, $name)
 Creates a section.

 updateSection ($skey, $label)
 Update a section.

 getSectionId ($skey)
 Return the section ID for a given key.

 getSections ($depth=FALSE)
 Get an associative array of all sections.

 removeUser ($skey, $uid)
 Remove a users properties.

 getSectionProperties ($skey)
 Return all the properties for a given section.

 createProperty ($skey, $name, $desc)
 Creates a new property.

 undefineProperty ($skey, $prop)
 Undefine (remove) a property.

 getPropertyId ($section_key, $property_key=FALSE)
 Get an internal property ID, the meaning of this number is undefined, but it is a way to tell if the specified property exists.

 getDescription ($section_key, $property_key=FALSE)
 Return the verbal description of a given section name.

 addListener (&$listener)
 Add a listener.

 changePropertyLabel ($sect, $prop, $label)
 Alter the label of a property.

 firePropertyCreated ($section, $property, $description)
 Fires off the propertyCreated event.

 firePropertyChanged ($uid, $section, $property, $old_value, $new_value)
 Tells the listeners that a property has changed.


Detailed Description

Routines for manipulating user properties.

Properties are how specialized data can be associated to a user.

In order to provide as much flexibility as possible, specialized fields (such as telephone numbers or addresses) are implemented as a property. This also saves some space in cases where not every field is used, and it allows for the possible addition of "aliases".

Properties are divided into sections, so that additional plugins and other applications can have their own specialized field names.

Definition at line 138 of file Properties.php.


Member Function Documentation

addListener &$  listener  ) 
 

Add a listener.

These recieve events when propertys are modified.

Parameters:
$listener - The instance of GenieGate_Api_Plugin that listens.

Definition at line 468 of file Properties.php.

createProperty skey,
name,
desc
 

Creates a new property.

Before a property can be accessed, it needs to be defined. this defines it. If the property already exists, it returns FALSE.

Definition at line 335 of file Properties.php.

References firePropertyCreated(), getPropertyId(), and getSectionId().

createSection skey,
name
 

Creates a section.

You should check with sectionId to see if the section already exists. (if $skey does exist, it dies with a message about it.) Therefore, if you want your application to fail because a reserved section key already exists, you can use this to do that.

This method is typically used in the initial creation of a section, you may want to use updateSection().

Parameters:
$skey - The section key. (will be needed to access properties)
$name - The verbal section name. (Comments field)
Returns:
The numerical ID for this section.
See also:
getSectionId()

updateSection()

Definition at line 183 of file Properties.php.

References getSectionId().

Referenced by updateSection().

getDescription section_key,
property_key = FALSE
 

Return the verbal description of a given section name.

If $property_key is left blank, returns the description of the section.

Parameters:
$section_key - The section key.
$property_key - The property (Optional)
Returns:
Description of the property or section.

Definition at line 435 of file Properties.php.

References getSectionId().

getPropertyId section_key,
property_key = FALSE
 

Get an internal property ID, the meaning of this number is undefined, but it is a way to tell if the specified property exists.

Returns FALSE if the property does not exist.

Parameters:
$section_key - The section to look in.
$property_key - The property to look for.
Returns:
an internal property number.

Definition at line 394 of file Properties.php.

References getSectionId().

Referenced by createProperty().

getSection section,
uid
 

Gets a PropSection, which can be used for setting the properties.

Parameters:
$uid - The user ID.
$section - The section key.
Returns:
a PropSection for access to the properties.
See also:
GenieGate_Properties_Section

Definition at line 162 of file Properties.php.

getSectionId skey  ) 
 

Return the section ID for a given key.

This can be used to determine if a Section exists.

Parameters:
$skey - Section key.
Returns:
the sid for the given section key.

Definition at line 224 of file Properties.php.

Referenced by changePropertyLabel(), createProperty(), createSection(), getDescription(), getPropertyId(), getSectionProperties(), removeUser(), undefineProperty(), and updateSection().

getSectionProperties skey  ) 
 

Return all the properties for a given section.

Parameters:
$skey - the section key.
Returns:
Associative array of property ID => Description

Definition at line 315 of file Properties.php.

References getSectionId().

getSections depth = FALSE  ) 
 

Get an associative array of all sections.

The return value is an associative array, where the key is the section's key. The value is a textual description of the section.

If $depth is TRUE, it will return a fairly complex associative array of arrays representing the section name and all it's underlying properties. (do a print_r for more detail)

$title = $result[$skey][0]; $property_name = $result[$skey][1][$property_key];

Parameters:
$depth - Get detail about properties.
Returns:
associative array.

Definition at line 260 of file Properties.php.

removeUser skey,
uid
 

Remove a users properties.

This will remove all the properties for the given user within the given section.

See also:
GenieGate_Properties_Section::removeAll
Parameters:
$skey - The Section key.
$uid - The user ID.

Definition at line 286 of file Properties.php.

References getSectionId().

undefineProperty skey,
prop
 

Undefine (remove) a property.

This removes all the property definitions.

Parameters:
$skey - The section key.
$prop - The property ID.

Definition at line 365 of file Properties.php.

References getSectionId().

updateSection skey,
label
 

Update a section.

This method will alter the label of a property section if $skey exists, otherwise it will create a new section by calling createSection() for you.

Parameters:
$skey - The section key.
$label - The label of the section.
Returns:
A numeric ID (internal table sid number)

Definition at line 203 of file Properties.php.

References createSection(), and getSectionId().


The documentation for this class was generated from the following file:
DoxyGen Documentation generated by DoxyGen