Votes Class Reference
Facade class for votes. More...
Static Public Member Functions |
|
static | create ($params, $instance, &$created) |
Create a vote instance. |
|
static | create_instance_adapter (IDataObject $inst) |
Create adapter to find votes for instance.
|
|
static | find_for_instance (IDataObject $inst) |
Find all votes for instance. |
|
static | get_average_for_instance (IDataObject $inst, $precision=0) |
Calucate average for instance. |
Detailed Description
Facade class for votes.
Definition at line 7 of file votes.facade.php.
Member Function Documentation
static Votes::create | ( | $ | params, | |
$ | instance, | |||
&$ | created | |||
) | [static] |
Create a vote instance.
- Parameters:
-
array $params IDataObject $instance DAOVotes $created
- Returns:
- Status
Definition at line 52 of file votes.facade.php.
00052 { 00053 $params['instance'] = $instance; 00054 $cmd = CommandsFactory::create_command('votes', 'create', $params); 00055 $ret = $cmd->execute(); 00056 $created = $cmd->get_result(); 00057 return $ret; 00058 }
static Votes::create_instance_adapter | ( | IDataObject $ | inst | ) | [static] |
Create adapter to find votes for instance.
- Returns:
- DAOVotes
Definition at line 13 of file votes.facade.php.
00013 { 00014 $dao = new DAOVotes(); 00015 $dao->instance = $inst; 00016 return $dao; 00017 }
static Votes::find_for_instance | ( | IDataObject $ | inst | ) | [static] |
Find all votes for instance.
- Parameters:
-
IDataObject $inst
- Returns:
- array
Definition at line 25 of file votes.facade.php.
00025 { 00026 $dao = self::create_instance_adapter($inst); 00027 return $dao->find_all(); 00028 }
static Votes::get_average_for_instance | ( | IDataObject $ | inst, | |
$ | precision = 0 |
|||
) | [static] |
Calucate average for instance.
- Parameters:
-
IDataObject $inst
- Returns:
- int
Definition at line 36 of file votes.facade.php.
00036 { 00037 $aggr = VotesAggregates::get_for_instance($inst); 00038 if ($aggr) { 00039 return $aggr->get_average($precision); 00040 } 00041 return 0; 00042 }
The documentation for this class was generated from the following file:
- contributions/voting/model/classes/votes.facade.php