phpDocumentor SGL
cms
[ class tree: SGL ] [ index: SGL ] [ all elements ]

Class: SGL_Attribute

Source Location: /lib/Attribute.php

Class SGL_Attribute

Property Summary
mixed   $alias  
mixed   $contentId  
mixed   $contentTypeId  
mixed   $desc  
mixed   $id  
mixed   $langCode  
mixed   $name  
mixed   $params  
mixed   $typeId  
mixed   $typeName  
mixed   $value  
mixed   $version  

[ Top ]
Method Summary
static SGL_Attribute   getById()   Returns an attribute object referenced by supplied id.
SGL_Attribute   __construct()   Constructor.
mixed   changeType()   Modifies the attributes type.
boolean   delete()   Deletes the current attribute instance.
string   get()   Returns value property of SGL_Attribute.
array   getParams()   Returns attribute list params.
integer   getType()   Returns an integer representing the type id of the attribute.
mixed   rename()   Changes the name property of SGL_Attribute.
SGL_Attribute   save()   Saves the current attribute instance.
void   set()   Sets value property for SGL_Attribute.
array   _getParams()   Enter description here...
void   _serializeParams()   Serializes attribute params for storage.

[ Top ]
Properties
mixed   $alias [line 33]
API Tags:
Access:  public


[ Top ]
mixed   $contentId [line 27]
API Tags:
Access:  public


[ Top ]
mixed   $contentTypeId [line 31]
API Tags:
Access:  public


[ Top ]
mixed   $desc [line 34]
API Tags:
Access:  public


[ Top ]
mixed   $id [line 25]
API Tags:
Access:  public


[ Top ]
mixed   $langCode [line 29]
API Tags:
Access:  public


[ Top ]
mixed   $name [line 32]
API Tags:
Access:  public


[ Top ]
mixed   $params [line 35]
API Tags:
Access:  public


[ Top ]
mixed   $typeId [line 26]
API Tags:
Access:  public


[ Top ]
mixed   $typeName [line 30]
API Tags:
Access:  public


[ Top ]
mixed   $value [line 36]
API Tags:
Access:  public


[ Top ]
mixed   $version [line 28]
API Tags:
Access:  public


[ Top ]
Methods
static method getById  [line 137]

  static SGL_Attribute getById( integer $id  )

Returns an attribute object referenced by supplied id.

  1.    $bar SGL_Attribute::getById($id)// never by name, too ambiguous
  2.    $bar->rename('fluux');
  3.    $bar->delete();

Parameters:
integer   $id: 

API Tags:
Access:  public


[ Top ]
Constructor __construct  [line 71]

  SGL_Attribute __construct( [object $oData = null]  )

Constructor.

Populates the object if $oData is supplied.

  1.    $oRestoReview  SGL_Content::createType('RestaurantReview')
  2.        ->addAttribute(new SGL_Attribute(
  3.            array('name' => 'dateEaten''typeId' => SGL_CONTENT_ATTR_TYPE_DATE)))
  4.        ->addAttribute(new SGL_Attribute(
  5.            array('name' => 'dishName''typeId' => SGL_CONTENT_ATTR_TYPE_TEXT)))
  6.        ->addAttribute(new SGL_Attribute(
  7.            array('name' => 'overallRating''typeId' => SGL_CONTENT_ATTR_TYPE_FLOAT)))
  8.        ->save();

Parameters:
object   $oData: 

API Tags:
Access:  public


[ Top ]
changeType  [line 180]

  mixed changeType( integer $newTypeId  )

Modifies the attributes type.

  1.    // changing an attribute's type
  2.    $bar SGL_Attribute::getById($id);
  3.    $bar->changeType(SGL_ATTRTYPE_FLOAT);
  4.  
  5.    // changing an attribute's value
  6.    $bar SGL_Attribute::getById($id);
  7.    $bar->value 'new value';
  8.    $oAttrib $bar->save();

Parameters:
integer   $newTypeId: 

API Tags:
Return:  true of PEAR error
Access:  public


[ Top ]
delete  [line 217]

  boolean delete( )

Deletes the current attribute instance.

  1.    $attr SGL_Attribute::getById($id);
  2.    $attr->delete();


API Tags:
Access:  public


[ Top ]
get  [line 115]

  string get( )

Returns value property of SGL_Attribute.


API Tags:
Access:  public


[ Top ]
getParams  [line 268]

  array getParams( )

Returns attribute list params.

  1.    $attr SGL_Attribute::getById($id);
  2.    if ($attr->getType(== SGL_CONTENT_ATTR_TYPE_RADIO{
  3.        $aParams $attr->getParams();
  4.    }


API Tags:
Access:  public


[ Top ]
getType  [line 158]

  integer getType( )

Returns an integer representing the type id of the attribute.

Types are represented by constants.

  1.    $attrib SGL_Attribute::getById($id);
  2.    $type $attrib->getType();


API Tags:
See:  CmsDAO::_initialiseAttribTypeConstants()
Access:  public


[ Top ]
rename  [line 199]

  mixed rename( string $newName  )

Changes the name property of SGL_Attribute.

  1.    $bar SGL_Attribute::getById($id);
  2.    $bar->rename('fluux');

Parameters:
string   $newName: 

API Tags:
Return:  true of PEAR error
Access:  public


[ Top ]
save  [line 236]

  SGL_Attribute save( )

Saves the current attribute instance.

  1.    $bar SGL_Attribute::getById($id);
  2.    $bar->value 'new value';
  3.    $oAttrib $bar->save();


API Tags:
Access:  public


[ Top ]
set  [line 104]

  void set( string $value  )

Sets value property for SGL_Attribute.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]
_getParams  [line 290]

  array _getParams( array $aAttributeParams  )

Enter description here...

Parameters:
array   $aAttributeParams: 

API Tags:
Access:  protected


[ Top ]
_serializeParams  [line 249]

  void _serializeParams( )

Serializes attribute params for storage.


API Tags:
Access:  protected


[ Top ]

Documentation generated on Thu, 25 Dec 2008 22:04:52 +0000 by phpDocumentor 1.4.1