. */ require_once(FILESYSTEMROOTPATH."jc/include/dao/ElectionsDao.php"); class ElectionsService { private $electionsDao; /** * Default constructor * * @param ElectionsDao */ public function __construct(ElectionsDao $electionsDao) { $this->electionsDao = $electionsDao; } /** * Load an election by id * * @param string id of the election to be loaded * @return an election object */ public function load($id) { return $this->electionsDao->load($id); } /** * Load elections by agorae_id * * @return array of elections */ public function loadByAgora($agora_id) { return $this->electionsDao->loadByAgora($agora_id); } public function loadOpen($agora_id){ return $this->electionsDao->loadOpen($agora_id); } public function countVotes($id) { $this->electionsDao->countVotes($id); } public function loadClosed($agora_id){ return $this->electionsDao->loadClosed($agora_id); } /** * Save or update election: * * @param election object * @return boolean [success or fail] */ public function saveOrUpdate($election){ return $this->electionsDao->saveOrUpdate($election); } public function get_last_id(){ return $this->electionsDao->get_last_id(); } } ?>