Class PollOption

com.woltlab.wcf.data.message.poll.data.message.poll

Description

This class represents an option of a poll.

  • author: Marcel Werk
  • copyright: 2001-2009 WoltLab GmbH
  • license: GNU
DatabaseObject
   |
   --PollOption

Variable Summary

Type Name
Poll $poll

Method Summary

Return Name
PollOption __construct(array $row, Poll $poll)
void addVote()
static integer compareResult(PollOption $optionA, PollOption $optionB)
integer getBarWidth()
double getPercent()
boolean isChecked()
void removeVote()

Variables

$poll

protected Poll $poll = null

poll object


Inherited variables from DatabaseObject

DatabaseObject::$data

Methods

__construct

public PollOption __construct(array $row, Poll $poll)

Creates a new PollOption object.

Parameters:

  • $row - resultset with option data form database
  • $poll - the poll of this option

Redefinition of: DatabaseObject::__construct()


addVote

public void addVote()

Increases the number of votes by one.


compareResult

public static integer compareResult(PollOption $optionA, PollOption $optionB)

Compares the votes of two poll options.

Parameters:

  • $optionA
  • $optionB

getBarWidth

public integer getBarWidth()

Returns the bar width of this option.

  • return: bar width of this option

getPercent

public double getPercent()

Returns the percent value of this option.

  • return: percent value of this option

isChecked

public boolean isChecked()

Returns true, if this option is checked.

  • return: true, if this option is checked

removeVote

public void removeVote()

Decreases the number of votes by one.


Inherited methods from DatabaseObject

DatabaseObject::__construct(), DatabaseObject::handleData(), DatabaseObject::sort(), DatabaseObject::__get()