.

DAOVotes Class Reference

Model class for Votes. More...

Inheritance diagram for DAOVotes:
DataObjectBase IDataObject IActionSource ISearchAdapter IDBTable IDBWhereHolder

List of all members.

Public Member Functions

  validate ()
  Validate this object.

Public Attributes

  $creationdate
  $id
  $instance
  $value
  $voterid
  $weight

Protected Member Functions

  create_table_object ()

Detailed Description

Model class for Votes.

Votes can hold values from 0 to 100 (so they contain percents, actually)

Definition at line 7 of file votes.model.php.


Member Function Documentation

DAOVotes::create_table_object (  )  [protected]

Reimplemented from DataObjectBase.

Definition at line 16 of file votes.model.php.

00016                                                  {
00017             return new DBTable(
00018                 'votes',
00019                         array(
00020                                 new DBFieldInt('id', null, DBFieldInt::AUTOINCREMENT | DBFieldInt::UNSIGNED | DBFieldInt::NOT_NULL),
00021                                 new DBFieldInstanceReference('instance'), 
00022                                 new DBFieldInt('value'),
00023                                 new DBFieldInt('weight'),
00024                                 new DBFieldText('voterid', 30),
00025                                 new DBFieldDateTime('creationdate', null, DBFieldDateTime::TIMESTAMP),
00026                         ),
00027                         'id'                    
00028             );
00029         }
DAOVotes::validate (  ) 

Validate this object.

Returns:
Status Error

Reimplemented from DataObjectBase.

Definition at line 36 of file votes.model.php.

00036                                    {
00037                 $ret = parent::validate();
00038                 if ($this->value < 0 || $this->value > 100) {
00039                         $ret->append(tr('Vote must be between 0 and 100', 'voting'));
00040                 }
00041                 if (empty($this->weight)) {
00042                         $this->weight = 1;
00043                 }
00044                 return $ret;
00045         }

Member Data Documentation

DAOVotes::$creationdate

Definition at line 13 of file votes.model.php.

DAOVotes::$id

Definition at line 8 of file votes.model.php.

DAOVotes::$instance

Definition at line 9 of file votes.model.php.

DAOVotes::$value

Definition at line 10 of file votes.model.php.

DAOVotes::$voterid

Definition at line 12 of file votes.model.php.

DAOVotes::$weight

Definition at line 11 of file votes.model.php.


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