diff --git a/uVote/api/votes/votes.php b/uVote/api/votes/votes.php index d206d82..f568fbc 100644 --- a/uVote/api/votes/votes.php +++ b/uVote/api/votes/votes.php @@ -20,6 +20,10 @@ class votes { return $result; } + public static function get_user_choice_per_poll($poll_ID, $user_ID){ + return \DBD\UVOTE_DATA_USER_CHOICE_PER_POLL::Q1(array($poll_ID, $user_ID)); + } + public static function getUserPollData($poll_ID){ if (!\SYSTEM\SECURITY\Security::isLoggedIn()){ return NULL;} @@ -80,6 +84,9 @@ class votes { public static function get_user_temp_votes($user_ID){ return \DBD\UVOTE_DATA_TEMP_VOTES::Q1(array($user_ID, $user_ID, $user_ID));} + public static function get_user_overall_votes($user_ID, $creationDate){ + return \DBD\UVOTE_DATA_OVERALL_VOTES::Q1(array($user_ID, $user_ID, $user_ID, $creationDate));} + public static function get_bar_bt_per_poll($poll_ID){ return \DBD\UVOTE_DATA_BT_PER_POLL::Q1(array($poll_ID));} diff --git a/uVote/dbd/qq/UVOTE_DATA_OVERALL_VOTES.php b/uVote/dbd/qq/UVOTE_DATA_OVERALL_VOTES.php new file mode 100644 index 0000000..0ea7227 --- /dev/null +++ b/uVote/dbd/qq/UVOTE_DATA_OVERALL_VOTES.php @@ -0,0 +1,14 @@ + FROM_UNIXTIME(?);' +);}} diff --git a/uVote/dbd/qq/UVOTE_DATA_USER_CHOICE_PER_POLL.php b/uVote/dbd/qq/UVOTE_DATA_USER_CHOICE_PER_POLL.php new file mode 100644 index 0000000..02aeb6d --- /dev/null +++ b/uVote/dbd/qq/UVOTE_DATA_USER_CHOICE_PER_POLL.php @@ -0,0 +1,11 @@ +${title} -
-
${vote_yes_perc}%
-
${vote_no_perc}%
-
${vote_ent_perc}%
-
\ No newline at end of file + +
+
${vote_yes_perc}%
+
${vote_no_perc}%
+
${vote_ent_perc}%
diff --git a/uVote/page/default_bulletin/bulletin.tpl b/uVote/page/default_bulletin/bulletin.tpl index 226045c..3d50288 100644 --- a/uVote/page/default_bulletin/bulletin.tpl +++ b/uVote/page/default_bulletin/bulletin.tpl @@ -1,22 +1,26 @@ -
-
- ${bars_user} -
-
- ${voice_weight} -
-
- - ${bars_bt} -
-
- ${bars_party} -
-
- - -
+
+
+ + + Ergebnis uVote + ${bars_user} + + + Ergebnis Bundestag + ${bars_bt} + +
+ + ${voice_weight} + + + + ${bars_party} + +
+
+ ${vote_buttons}
diff --git a/uVote/page/default_bulletin/default_bulletin.php b/uVote/page/default_bulletin/default_bulletin.php index d67863a..461fdc2 100644 --- a/uVote/page/default_bulletin/default_bulletin.php +++ b/uVote/page/default_bulletin/default_bulletin.php @@ -4,6 +4,26 @@ class default_bulletin extends SYSTEM\PAGE\Page { public function __construct($poll_ID) { $this->poll_ID=$poll_ID;} + + public function vote_choice(){ + $result = ''; + $vars = votes::get_user_choice_per_poll($this->poll_ID, \SYSTEM\SECURITY\Security::getUser()->id); + $vars['vote_class'] = $this->tablerow_class($vars); + return $vars['vote_class']; + } + + private static function tablerow_class($choice){ + switch($choice){ + case 1: + return 'pro'; + case 2: + return 'con'; + case 3: + return 'ent'; + default: + return 'open'; + } + } private function bars_user(){ $bars = votes::get_barsperusers($this->poll_ID,false); @@ -60,7 +80,7 @@ class default_bulletin extends SYSTEM\PAGE\Page { private function vote_buttons($poll_expired,$user_poll){ if($poll_expired){ if(!$user_poll){ - return '

Stimme hier ab

+ return '
Stimme hier ab
Ändere deine bereits abgegebene Stimme hier ab + return ' +
Ändere deine Stimme hier ab
Enthaltung'; + size="3">Enthaltung + '; } else { return 'ye soon to come infos'; } @@ -113,8 +135,9 @@ class default_bulletin extends SYSTEM\PAGE\Page { $user_vote = votes::getUserPollData($this->poll_ID); $vars = array(); - $vars['voice_weight'] = $vars['bars_user'] = $vars['bars_bt'] = ''; + $vars['voice_weight'] = $vars['bars_user'] = $vars['bars_bt'] = ''; $vars['bars_party'] = 'Erst nach der Abgabe deiner Stimme werden dir die daten angezeigt'; + $vars['vote_class'] = $this->vote_choice(); $vars['js'] = $this->js(); $vars['css'] = $this->css(); diff --git a/uVote/page/default_bulletin/table_bt.tpl b/uVote/page/default_bulletin/table_bt.tpl index 25ea9eb..636508e 100644 --- a/uVote/page/default_bulletin/table_bt.tpl +++ b/uVote/page/default_bulletin/table_bt.tpl @@ -1,8 +1,6 @@ -
-

Ergebnis Bundestag

-
-
${bt_pro}%
-
${bt_con}%
-

${bt_ent}%

-
-
\ No newline at end of file + +
+
${bt_pro}%
+
${bt_con}%
+

${bt_ent}%

+ diff --git a/uVote/page/default_page/js/loadtexts.js b/uVote/page/default_page/js/loadtexts.js index 36c579a..d9f8d1e 100644 --- a/uVote/page/default_page/js/loadtexts.js +++ b/uVote/page/default_page/js/loadtexts.js @@ -141,6 +141,7 @@ function vote_click (poll_ID, vote) { var items = []; if(data.status == true){ alert("success"); + $('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID')); } else { alert(data.result.message); } diff --git a/uVote/page/default_page/page.tpl b/uVote/page/default_page/page.tpl index d31a66f..19a037c 100644 --- a/uVote/page/default_page/page.tpl +++ b/uVote/page/default_page/page.tpl @@ -20,7 +20,7 @@ - +