+
Entscheidungsverhalten der uVote Community
-
+
${votes_all}
Wie oft die uVote Community
@@ -21,10 +22,11 @@
${votes_all_bt}
- Wie oft der Bundestag
+ Wie oft der Bundestag
Dafür, Dagegen oder
Enthaltung gestimmt hat.
+
diff --git a/uVote/page/user_main_uVote/user_main_uVote.php b/uVote/page/user_main_uVote/user_main_uVote.php
index df71c74..c7bc9dc 100644
--- a/uVote/page/user_main_uVote/user_main_uVote.php
+++ b/uVote/page/user_main_uVote/user_main_uVote.php
@@ -4,11 +4,12 @@ class user_main_uVote extends SYSTEM\PAGE\Page {
private function uvote_to_parties (){
$votes = votes::get_uvote_to_bt_overall();
$result = '';
- print_r($votes, TRUE);
+
foreach($votes as $vote){
$vote['match_percentage'] = round($vote['class_MATCH']/($vote['class_MATCH']+$vote['class_MISSMATCH'])*100,2);
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uvoteparties.tpl'), $vote);
}
+ print_r($votes, TRUE);
return $result;
}
@@ -80,6 +81,7 @@ class user_main_uVote extends SYSTEM\PAGE\Page {
$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));
+ $vars = array_merge($vars, \SYSTEM\locale::getStrings(100));
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uVote.tpl'),$vars);
}
diff --git a/uVote/page/user_main_urVote/all_polls.tpl b/uVote/page/user_main_urVote/all_polls.tpl
index ffd7492..87d3d65 100644
--- a/uVote/page/user_main_urVote/all_polls.tpl
+++ b/uVote/page/user_main_urVote/all_polls.tpl
@@ -1,8 +1,13 @@
Aktueller Status
-
+
Teilnahme an aktuellen Abstimmungen
-
\ No newline at end of file
+
+ Teilgenommen: ${voted},
+ nicht Teilgenommen: ${not_voted}
+
+
+
diff --git a/uVote/page/user_main_urVote/overall_all_polls.tpl b/uVote/page/user_main_urVote/overall_all_polls.tpl
new file mode 100644
index 0000000..22012d1
--- /dev/null
+++ b/uVote/page/user_main_urVote/overall_all_polls.tpl
@@ -0,0 +1,11 @@
+
+
Abstimmungsquote seit Accounterstellung
+
+
+ Teilgenommen: ${voted},
+ nicht Teilgenommen: ${not_voted}
+
+
\ No newline at end of file
diff --git a/uVote/page/user_main_urVote/urVote.tpl b/uVote/page/user_main_urVote/urVote.tpl
index c4463d9..7456a69 100644
--- a/uVote/page/user_main_urVote/urVote.tpl
+++ b/uVote/page/user_main_urVote/urVote.tpl
@@ -16,6 +16,9 @@
${user_temp_votes}
+
+ ${user_overall_votes}
+
\ No newline at end of file
diff --git a/uVote/page/user_main_urVote/user_main_urVote.php b/uVote/page/user_main_urVote/user_main_urVote.php
index ddfb89c..10cb93c 100644
--- a/uVote/page/user_main_urVote/user_main_urVote.php
+++ b/uVote/page/user_main_urVote/user_main_urVote.php
@@ -3,10 +3,22 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
+ private function user_overall_votes (){
+ $vars = votes::get_user_overall_votes(\SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->creationDate);
+ $v = $vars['voted'] > 1 ? $vars['voted'] : 1;
+ $nv = $vars['not_voted'];
+ return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/overall_all_polls.tpl'),
+ array( 'vote_perc'=> round($v/($nv+$v)*100, 2),
+ 'no_vote_perc'=> round($nv/($nv+$v)*100, 2),
+ 'voted'=> $v,
+ 'not_voted'=> $nv));
+ }
+
private function user_temp_votes (){
$vars = votes::get_user_temp_votes(\SYSTEM\SECURITY\Security::getUser()->id);
$v = $vars['voted'];
$nv = $vars['not_voted'];
+ print_r($vars, true);
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/all_polls.tpl'),
array( 'vote_perc'=> round($v/($nv+$v)*100, 2),
'no_vote_perc'=> round($nv/($nv+$v)*100, 2),
@@ -14,45 +26,45 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
'not_voted'=> $nv));
}
- private function user_to_bt(){
- //$vars = votes::get_user_per_party_overall($user_ID);
- $result = '';
- $con = new \SYSTEM\DB\Connection();
- $res = $con->prepare( 'bt_to_user',
- 'SELECT sum(case when uvote_data.choice = uvote_votes.bt_choice then 1 else 0 end) class_MATCH,
- sum(case when uvote_data.choice != uvote_votes.bt_choice then 1 else 0 end) class_MISSMATCH
- FROM uvote_data LEFT JOIN uvote_votes
- ON uvote_data.poll_ID = uvote_votes.ID
- 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']+1)*100,2);
-
- $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/bt_to_user_overall.tpl'), $row);
- }
- return $result;
- $row['votes_cast'] = round(($row['class_MATCH']+$row['class_MISSMATCH']),2);
+ private function user_to_bt(){
+ //$vars = votes::get_user_per_party_overall($user_ID);
+ $result = '';
+ $con = new \SYSTEM\DB\Connection();
+ $res = $con->prepare( 'bt_to_user',
+ 'SELECT sum(case when uvote_data.choice = uvote_votes.bt_choice then 1 else 0 end) class_MATCH,
+ sum(case when uvote_data.choice != uvote_votes.bt_choice then 1 else 0 end) class_MISSMATCH
+ FROM uvote_data LEFT JOIN uvote_votes
+ ON uvote_data.poll_ID = uvote_votes.ID
+ 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']+1)*100,2);
+
+ $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/bt_to_user_overall.tpl'), $row);
}
-
+ return $result;
+ $row['votes_cast'] = round(($row['class_MATCH']+$row['class_MISSMATCH']),2);
+}
- private function user_per_party_overall(){
- //$vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id));
- $result = '';
- $con = new \SYSTEM\DB\Connection();
- $res = $con->prepare( 'test',
- 'SELECT party, sum(case when uvote_data.choice = uvote_votes_per_party.choice then 1 else 0 end) class_MATCH,
- sum(case when uvote_data.choice != uvote_votes_per_party.choice then 1 else 0 end) class_MISSMATCH
- FROM uvote_data INNER JOIN uvote_votes_per_party
- ON uvote_data.poll_ID = uvote_votes_per_party.poll_ID
- WHERE user_ID = ? GROUP BY party;',
- 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);
- $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/urvoteparties.tpl'), $row);;
- }
- return $result;
+
+ private function user_per_party_overall(){
+ //$vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id));
+ $result = '';
+ $con = new \SYSTEM\DB\Connection();
+ $res = $con->prepare( 'test',
+ 'SELECT party, sum(case when uvote_data.choice = uvote_votes_per_party.choice then 1 else 0 end) class_MATCH,
+ sum(case when uvote_data.choice != uvote_votes_per_party.choice then 1 else 0 end) class_MISSMATCH
+ FROM uvote_data INNER JOIN uvote_votes_per_party
+ ON uvote_data.poll_ID = uvote_votes_per_party.poll_ID
+ WHERE user_ID = ? GROUP BY party;',
+ 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);
+ $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/urvoteparties.tpl'), $row);;
}
+ return $result;
+}
public function html(){
$vars = array();
@@ -61,6 +73,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
$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['user_temp_votes'] = $this->user_temp_votes();
+ $vars['user_overall_votes'] = $this->user_overall_votes();
$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(),'user_main_urVote/urVote.tpl'),$vars);