'. ''. ''. ''. ''. ''. ''; ''; } private function css(){ return '';} private static function tablerow_class($choice){ switch($choice){ case 1: return 'pro'; case 2: return 'contra'; case 3: return 'ent'; default: return ''; } } public function generate_votelist(){ $result = array('',''); $votes = votes::getAllVotesOfGroup(1); foreach($votes as $vote){ $time_remain = strtotime($vote['time_end'])- microtime(true); $time_span = strtotime($vote['time_end']) - strtotime($vote['time_start']); $vote['vote_class'] = $this->tablerow_class(votes::getUserPollData($vote['ID'])); $vote['bt_vote_class'] = $this->tablerow_class($vote['bt_choice']); $vote['full_vote_btn'] = $time_remain > 0 ? 'Abstimmen' : 'Ansehen'; $vote['time_left'] = round($time_remain/($time_span+1)*100,0); $vote['time_done'] = 100-$vote['time_left']; $cdu = votes::get_party_choice($vote['ID'], 'cdu'); $vote['cdu'] = $this->get_party_per_poll($cdu['choice']); $vote['choice_class_cdu'] = $this->tablerow_class($cdu['choice']); $csu = votes::get_party_choice($vote['ID'], 'csu'); $vote['csu'] = $this->get_party_per_poll($csu['choice']); $vote['choice_class_csu'] = $this->tablerow_class($csu['choice']); $spd = votes::get_party_choice($vote['ID'], 'spd'); $vote['spd'] = $this->get_party_per_poll($spd['choice']); $vote['choice_class_spd'] = $this->tablerow_class($spd['choice']); $gruene = votes::get_party_choice($vote['ID'], 'gruene'); $vote['gruene'] = $this->get_party_per_poll($gruene['choice']); $vote['choice_class_gruene'] = $this->tablerow_class($gruene['choice']); $linke = votes::get_party_choice($vote['ID'], 'linke'); $vote['linke'] = $this->get_party_per_poll($linke['choice']); $vote['choice_class_linke'] = $this->tablerow_class($linke['choice']); $uvote = votes::get_users_choice_per_poll($vote['ID']); $vote['uv_vote_class'] = count($uvote) > 0 ? $this->tablerow_class($uvote[0]['choice']) : ''; $vote['uv_pro'] = $vote['uv_con'] = $vote['uv_ent'] = '<2'; foreach($uvote as $v){ switch($v['choice']){ case 1: $vote['uv_pro'] = $v['count'] > 1 ? $v['count'] : '<2'; break; case 2: $vote['uv_con'] = $v['count'] > 1 ? $v['count'] : '<2'; break; case 3: $vote['uv_ent'] = $v['count'] > 1 ? $v['count'] : '<2'; break; default: } } $vote['title'] = utf8_encode($vote['title']); if($time_remain > 0){ $result[0] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote.tpl'), $vote); } else { $result[1] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote.tpl'), $vote); } } return $result[0].$result[1]; } private function get_party_per_poll($choice){ switch($choice){ case 1: return 'PRO'; case 2: return 'CON'; case 3: return 'ENT'; default: return 'NONE'; } } public function get_coverpage(){ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/cover.tpl'), array());} public function getloggedinform(){ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/loggedinform.tpl'),array());} public function exchange_registerform(){ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/register_form.tpl'),array());} public function getloginform(){ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/loginform.tpl'),array());} public function exchange_loginform(){ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/loggedinformtop.tpl'),array());} public function html(){ $vars = array(); $vars['js'] = $this->js(); $vars['css'] = $this->css(); $vars['votelist'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->generate_votelist() : $this->get_coverpage() ; $vars['registerform'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->getloggedinform() : $this->exchange_registerform(); $vars['loginform'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->exchange_loginform() : $this->getloginform() ; $vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id='; $vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE)); $vars = array_merge($vars, \SYSTEM\locale::getStrings(150)); return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/page.tpl'), $vars); } }