statistics
This commit is contained in:
parent
c286b20cad
commit
41068ea7b0
@ -4,8 +4,9 @@ class votes {
|
||||
public static function getAllVotesOfGroup($groupid){
|
||||
return \DBD\UVOTE_GENERATE_VOTELIST::QA(array($groupid));}
|
||||
|
||||
public static function countAllPolls($group){
|
||||
return \DBD\UVOTE_DATA_COUNT_VOTES::QP($group);}
|
||||
public static function countAllPolls(){
|
||||
$res = \DBD\UVOTE_DATA_COUNT_VOTES::QQ();
|
||||
return $res;}
|
||||
|
||||
public static function insertPartyChoice($poll_ID, $party, $votes_pro, $votes_contra, $nr_attending, $total, $choice){
|
||||
return \DBD\UVOTE_GENERATE_VOTELIST::QI(array($poll_ID, $party, $votes_pro, $votes_contra, $nr_attending, $total, $choice));}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class UVOTE_DATA_COUNT_VOTES extends \SYSTEM\DB\QP {
|
||||
class UVOTE_DATA_COUNT_VOTES extends \SYSTEM\DB\QQ {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT COUNT(*) as "count" FROM uvote_votes WHERE group = ?'
|
||||
'SELECT COUNT(*) as "count" FROM uvote_votes;'
|
||||
);}}
|
||||
|
||||
@ -29,6 +29,7 @@ class default_page extends SYSTEM\PAGE\Page {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function generate_votelist(){
|
||||
|
||||
$result = array('','');
|
||||
@ -41,7 +42,9 @@ class default_page extends SYSTEM\PAGE\Page {
|
||||
$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'];
|
||||
|
||||
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);
|
||||
@ -68,11 +71,11 @@ class default_page extends SYSTEM\PAGE\Page {
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars['js'] = $this->js();
|
||||
$vars['css'] = $this->css();
|
||||
$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['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));
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
|
||||
private function count_all_polls (){
|
||||
$result = '';
|
||||
$vars = votes::countAllPolls(1);
|
||||
new INFO('bla'.print_r($vars, true));
|
||||
return $result;
|
||||
$vars = votes::countAllPolls();
|
||||
new INFO(print_r($vars, true));
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function user_to_bt(){
|
||||
@ -20,7 +20,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
WHERE user_ID = ?;',
|
||||
array(\SYSTEM\SECURITY\Security::getUser()->id));
|
||||
while($row = $res->next()){
|
||||
$row['match_percentage'] = round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH'])*100,2);
|
||||
$row['match_percentage'] = round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH']+1)*100,2);
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/bt_to_user_overall.tpl'), $row);;
|
||||
}
|
||||
return $result;
|
||||
@ -45,10 +45,10 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
}
|
||||
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars['choices_user_ID'] = $this->user_per_party_overall();
|
||||
$vars['choices_bt_to_user'] = $this->user_to_bt();
|
||||
$vars = array();
|
||||
$vars['poll_compare'] = $this->count_all_polls();
|
||||
$vars['choices_user_ID'] = $this->user_per_party_overall();
|
||||
$vars['choices_bt_to_user'] = $this->user_to_bt();
|
||||
$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));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user