00001 <?php
00002
00003
00004
00005
00006
00007 class DAOVotesaggregates extends DataObjectBase {
00008 public $id;
00009 public $instance;
00010 public $average;
00011 public $numtotal;
00012 public $modificationdate;
00013
00014
00015 protected function create_table_object() {
00016 return new DBTable(
00017 'votesaggregates',
00018 array(
00019 new DBFieldInt('id', null, DBFieldInt::AUTOINCREMENT | DBFieldInt::UNSIGNED | DBFieldInt::NOT_NULL),
00020 new DBFieldInstanceReference('instance'),
00021 new DBFieldFloat('average'),
00022 new DBFieldInt('numtotal'),
00023 new DBFieldDateTime('modificationdate', DBFieldDateTime::NOW, DBFieldDateTime::TIMESTAMP),
00024 ),
00025 'id'
00026 );
00027 }
00028
00029 public function get_average($precision = 0) {
00030 $f = pow(10, $precision);
00031 $ret = intval(ceil($this->average * $f)) / $f;
00032 return $ret;
00033 }
00034 }