Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
StoredUserData Class Reference

Public Member Functions

 __construct ($user_id)
 
 getUserId ()
 
 hasData ()
 
 addTabularData ($name, $key, array $value, SimpleORMap $context=null)
 
 addFileRef (FileRef $fileref, SimpleORMap $context=null)
 
 addFileAtPath ($name, $path, SimpleORMap $context=null)
 
 addFileWithContents ($name, $contents, SimpleORMap $context=null)
 
 getFileData (SimpleORMap $context=null)
 
 getTabularData (SimpleORMap $context=null)
 

Data Fields

 $user_id
 

Protected Member Functions

 addData ($type, $data, SimpleORMap $context=null)
 
 getData ($type, SimpleORMap $context=null)
 

Protected Attributes

 $data
 

Detailed Description

This class is used to transport all data a plugin might have stored for a specific user. Stored data may be a number of files, tabular data or urls.

GPL2 or any later version

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Constructor & Destructor Documentation

__construct (   $user_id)

Construct a storage object for a specific user.

Parameters
User$userUser object

Member Function Documentation

addData (   $type,
  $data,
SimpleORMap  $context = null 
)
protected

Adds stored data. By passing an optional context, the data may be associated with this context.

Parameters
string$typeType of data
mixed$data
SimpleORMap$contextOptional context
addFileAtPath (   $name,
  $path,
SimpleORMap  $context = null 
)

Adds a local file on disk. By passing an optional context, the data may be associated with this context.

Parameters
string$nameFile name
string$pathFile path
SimpleORMap$contextOptional context
addFileRef ( FileRef  $fileref,
SimpleORMap  $context = null 
)

Adds a file reference. By passing an optional context, the data may be associated with this context.

Parameters
FileRef$fileref
SimpleORMap$contextOptional context
addFileWithContents (   $name,
  $contents,
SimpleORMap  $context = null 
)

Adds content as a file. By passing an optional context, the data may be associated with this context.

Parameters
string$nameFile name
string$contentsFile contents (text or binary)
SimpleORMap$contextOptional context
addTabularData (   $name,
  $key,
array  $value,
SimpleORMap  $context = null 
)

Adds tabular data under the specified key. By passing an optional context, the data may be associated with this context.

Parameters
string$nameDisplay label
string$keyTable name (e.g. database table)
array$valueArray containing the rows
SimpleORMap$contextOptional context
getData (   $type,
SimpleORMap  $context = null 
)
protected

Returns the stored data of the given type for all contexts (if $context is null) or a specific context.

Parameters
string$typeType of data
SimpleORMap$contextOptional context
Returns
array
getFileData ( SimpleORMap  $context = null)

Returns the stored file data for all contexts (if $context is null) or a specific context.

Parameters
SimpleORMap$contextOptional context
Returns
array
getTabularData ( SimpleORMap  $context = null)

Returns the stored tabular data for all contexts (if $context is null) or a specific context.

Parameters
SimpleORMap$contextOptional context
Returns
array
getUserId ( )

Returns the associated user.

Returns
User object
hasData ( )

Returns whether this object actually contains any data.

Returns
bool

Field Documentation

$data
protected
Initial value:
= [
'file' => []

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