diff --git a/uvote/page/user_main_poll/tpl/vote_buttons.tpl b/uvote/page/user_main_poll/tpl/vote_buttons.tpl
index 8c9b4dd..fa5772d 100644
--- a/uvote/page/user_main_poll/tpl/vote_buttons.tpl
+++ b/uvote/page/user_main_poll/tpl/vote_buttons.tpl
@@ -1,16 +1,16 @@
Ändere deine Stimme hier ab
-
Pro
-
Contra
-
Abgestimmt mit:
-
+
diff --git a/uvote/page/user_main_poll/user_main_poll.php b/uvote/page/user_main_poll/user_main_poll.php
index d89580e..892aabe 100644
--- a/uvote/page/user_main_poll/user_main_poll.php
+++ b/uvote/page/user_main_poll/user_main_poll.php
@@ -73,10 +73,10 @@ class user_main_poll extends SYSTEM\PAGE\Page {
}
$classes = array('','','');
switch($user_poll){
- case 1: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'btn-success disabled','no'=>'btn-danger','ent'=>'btn-info','choice'=>'pro'); break;
- case 2: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'btn-success','no'=>'btn-danger disabled','ent'=>'btn-info','choice'=>'con'); break;
- case 3: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'btn-success','no'=>'btn-danger','ent'=>'btn-info disabled','choice'=>'ent'); break;
- default: array('','','');
+ case 1: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'disabled','no'=>'','ent'=>'','choice'=>'_pro'); break;
+ case 2: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'','no'=>'disabled','ent'=>'','choice'=>'_con'); break;
+ case 3: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'','no'=>'','ent'=>'disabled','choice'=>'_ent'); break;
+ default: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'','no'=>'','ent'=>'','choice'=>'');
}
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/vote_buttons.tpl'), $classes);
@@ -93,10 +93,11 @@ class user_main_poll extends SYSTEM\PAGE\Page {
return array(\SYSTEM\WEBPATH(new \PPAGE(),'user_main_poll/js/user_main_poll.js'));}
public function html(){
- $poll_expired = \SQL\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID));
+ $poll_expired = \SQL\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID, 1));
$user_vote = votes::getUserPollData($this->poll_ID);
$vars = array();
- $vars = array_merge($vars,votes::get_voteinfo($this->poll_ID));
+ $vars = array_merge($vars, votes::get_voteinfo($this->poll_ID));
+ $vars['sub_buttons'] = votes::get_sublinks($this->poll_ID);
$vars['choice_party'] = $this->choice_party();
$vars['bars_user'] = $this->bars_user();
$vars['bars_bt'] = $this->bars_bt();
diff --git a/uvote/page/user_main_poll_sub/js/user_main_poll_sub.js b/uvote/page/user_main_poll_sub/js/user_main_poll_sub.js
new file mode 100644
index 0000000..68d92f7
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/js/user_main_poll_sub.js
@@ -0,0 +1,28 @@
+function init_user_main_poll_sub(){
+ $('#btnvote_yes').click(function () {
+ vote_click($(this).attr('poll_ID'),1);
+ });
+ $('#btnvote_no').click(function () {
+ vote_click($(this).attr('poll_ID'),2);
+ });
+ $('#btnvote_off').click(function () {
+ vote_click($(this).attr('poll_ID'),3);
+ });
+ $('#user_main').resize(function(){
+ $('#pollframe').height($('#user_main').height());
+ });
+
+}
+function vote_click (poll_ID, vote) {
+ $.getJSON('./api.php?call=vote&action=vote_sub&poll_ID=' + poll_ID + '&vote=' + vote, function(data) {
+ var items = [];
+ if(data.status == true){
+ alert("success");
+ $('#user_main').load('./?action=open_bulletin&poll_ID=' + poll_ID, function(){
+ open_vote(poll_ID);
+ });
+ } else {
+ alert(data.result.message);
+ }
+ });
+}
\ No newline at end of file
diff --git a/uvote/page/user_main_poll_sub/tpl/bars_user.tpl b/uvote/page/user_main_poll_sub/tpl/bars_user.tpl
new file mode 100644
index 0000000..0839b29
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/bars_user.tpl
@@ -0,0 +1,6 @@
+
uvote community
+
+
${vote_yes_perc}%
+
${vote_no_perc}%
+
${vote_ent_perc}%
+
diff --git a/uvote/page/user_main_poll_sub/tpl/comment.tpl b/uvote/page/user_main_poll_sub/tpl/comment.tpl
new file mode 100644
index 0000000..e0450f9
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/comment.tpl
@@ -0,0 +1,17 @@
+
+
+
\ No newline at end of file
diff --git a/uvote/page/user_main_poll_sub/tpl/full_vote.tpl b/uvote/page/user_main_poll_sub/tpl/full_vote.tpl
new file mode 100644
index 0000000..3c01c6e
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/full_vote.tpl
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
${title}
+ ${openvote_help_text}
+ ${title} abstimmen.
+
+ ${voice_weight}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${bars_user}
+ ${bars_bt}
+
+
+
+
+
+
+
+
+
+ ${choice_party}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uvote/page/user_main_poll_sub/tpl/icons_table_parties.tpl b/uvote/page/user_main_poll_sub/tpl/icons_table_parties.tpl
new file mode 100644
index 0000000..fa6b9e8
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/icons_table_parties.tpl
@@ -0,0 +1 @@
+
${urvote_party_table_desc}
diff --git a/uvote/page/user_main_poll_sub/tpl/table_bt.tpl b/uvote/page/user_main_poll_sub/tpl/table_bt.tpl
new file mode 100644
index 0000000..f6b7b01
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/table_bt.tpl
@@ -0,0 +1,7 @@
+${choice_show}
+Stimmverteilung Bundestag
+
+
${bt_pro}%
+
${bt_con}%
+
+
diff --git a/uvote/page/user_main_poll_sub/tpl/table_bt_choice.tpl b/uvote/page/user_main_poll_sub/tpl/table_bt_choice.tpl
new file mode 100644
index 0000000..02671bf
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/table_bt_choice.tpl
@@ -0,0 +1,3 @@
+
+Der Bundestag hat "${choice_full}"
abgestimmt.
+${disclaimer}
\ No newline at end of file
diff --git a/uvote/page/user_main_poll_sub/tpl/table_parties.tpl b/uvote/page/user_main_poll_sub/tpl/table_parties.tpl
new file mode 100644
index 0000000..1fc807c
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/table_parties.tpl
@@ -0,0 +1,12 @@
+
+
diff --git a/uvote/page/user_main_poll_sub/tpl/vote_bt.tpl b/uvote/page/user_main_poll_sub/tpl/vote_bt.tpl
new file mode 100644
index 0000000..a5f5edc
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/vote_bt.tpl
@@ -0,0 +1,11 @@
+
+
+
+
+
${party_yes}%
+
${party_no}%
+
${party_ent}%
+
+
+
+
\ No newline at end of file
diff --git a/uvote/page/user_main_poll_sub/tpl/vote_buttons.tpl b/uvote/page/user_main_poll_sub/tpl/vote_buttons.tpl
new file mode 100644
index 0000000..8c9b4dd
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/vote_buttons.tpl
@@ -0,0 +1,24 @@
+
+
+
Ändere deine Stimme hier ab
+ Pro
+ Contra
+ Enthaltung
+
+
+
Abgestimmt mit:
+
+
+
+
diff --git a/uvote/page/user_main_poll_sub/tpl/vote_buttons_fresh.tpl b/uvote/page/user_main_poll_sub/tpl/vote_buttons_fresh.tpl
new file mode 100644
index 0000000..75e0c54
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/vote_buttons_fresh.tpl
@@ -0,0 +1,18 @@
+
+
+
Stimme hier ab
+ Pro
+ Contra
+ Enthaltung
+
+
+
Noch nich Abgestimmt...
+
+
+
\ No newline at end of file
diff --git a/uvote/page/user_main_poll_sub/tpl/voteweight.tpl b/uvote/page/user_main_poll_sub/tpl/voteweight.tpl
new file mode 100644
index 0000000..fc5d06f
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/tpl/voteweight.tpl
@@ -0,0 +1,4 @@
+
+ Dein aktuelles Stimmgewicht bei dieser Abstimmung:
+ ${voteweight}%
+
\ No newline at end of file
diff --git a/uvote/page/user_main_poll_sub/user_main_poll_sub.php b/uvote/page/user_main_poll_sub/user_main_poll_sub.php
new file mode 100644
index 0000000..fdff3af
--- /dev/null
+++ b/uvote/page/user_main_poll_sub/user_main_poll_sub.php
@@ -0,0 +1,111 @@
+poll_ID = $poll_ID;
+ }
+
+ private function choice_party (){
+ $result = '';
+ $party_votes = \SQL\UVOTE_DATA_PARTY_PER_POLL::QA(array($this->poll_ID));
+ foreach($party_votes as $pv){
+ $vote = array( 'party' => $pv['party'],
+ 'choice' => switchers::get_party_per_poll($pv['choice']),
+ 'choice_class' => switchers::tablerow_class($pv['choice']),
+ 'party_yes' => $pv['votes_pro'] > 0 ? round($pv['votes_pro']/$pv['total']*100,0) : ($pv['choice'] == 1 ? '100' : '0'),
+ 'party_no' => $pv['votes_contra'] > 0 ? round($pv['votes_contra']/$pv['total']*100,0) : ($pv['choice'] == 2 ? '100' : '0'),
+ 'party_off' => $pv['total'] > 0 ? round(($pv['total'] - $pv['nr_attending'])/$pv['total']*100,0) : '0',
+ 'party_ent' => $pv['nr_attending'] > 0 ? round(($pv['nr_attending'] - $pv['votes_pro'] - $pv['votes_contra'])/$pv['nr_attending']*100,0) : $pv['nr_attending']);
+ if($vote['party_yes'] == '0' && $vote['party_no'] == '0' && $vote['party_ent'] == '0'){
+ $vote['party_ent'] = 100;}
+ $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/vote_bt.tpl'),$vote);
+ }
+ return $result;
+ }
+ private function bars_user(){
+ $bars = votes::get_barsperusers($this->poll_ID,false);
+ $bars['vote_yes_perc'] = round($bars['yes_perc']*100,0);
+ $bars['vote_no_perc'] = round($bars['no_perc']*100,0);
+ $bars['vote_ent_perc'] = round($bars['ent_perc']*100,0);
+ $bars['title'] = 'Gemessen auf uVote';
+ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/bars_user.tpl'),$bars);
+ }
+
+
+
+ private function bars_bt(){
+ $vars = votes::get_bar_bt_per_poll($this->poll_ID);
+ $info = votes::get_voteinfo($this->poll_ID);
+ if (!$vars['bt_total']){
+
+ $var['disclaimer'] = 'Keine differenzierten Ergebnisse für den Bundestag verfügbar';
+ $var['choice'] = switchers::tablerow_class($info['bt_choice']);
+ $var['choice_full'] = switchers::tablerow_class($info['bt_choice']);
+ if ($var['choice_full'] == ''){
+ $var['choice_full'] = 'noch nicht';
+ }
+ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/table_bt_choice.tpl'), $var);
+ }
+
+ $vars['disclaimer'] = '';
+ $vars['choice'] = switchers::tablerow_class($info['bt_choice']);
+ $vars['choice_full'] = switchers::tablerow_class($info['bt_choice']);
+ if ($vars['choice_full'] == 'open'){
+ $vars['choice_full'] = 'noch nicht';
+ }
+ $vars['choice_show'] = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/table_bt_choice.tpl'), $vars);
+ $vars['bt_ent'] = round(($vars['bt_attending'] - $vars['bt_pro'] - $vars['bt_con'])/$vars['bt_total']*100,0);
+ $vars['bt_pro'] = round($vars['bt_pro']/$vars['bt_total']*100,0);
+ $vars['bt_con'] = round($vars['bt_con']/$vars['bt_total']*100,0);
+ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/table_bt.tpl'), $vars);
+ }
+
+ private function voice_weight(){
+ $vars = votes::get_count_user_votes_per_poll($this->poll_ID);
+ $vars['voteweight'] = $vars['count'] ? round(1/$vars['count']*100) : 'no votes';
+ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/voteweight.tpl'), $vars);
+ }
+
+ private function vote_buttons($poll_expired,$user_poll){
+
+ if(!$user_poll){
+ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/vote_buttons_fresh.tpl', array('poll_ID'=>$this->poll_ID)));
+ }
+ $classes = array('','','');
+ switch($user_poll){
+ case 1: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'disabled','no'=>'','ent'=>'','choice'=>'_pro'); break;
+ case 2: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'','no'=>'disabled','ent'=>'','choice'=>'_con'); break;
+ case 3: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'','no'=>'','ent'=>'disabled','choice'=>'_ent'); break;
+ default: $classes = array('poll_ID'=>$this->poll_ID, 'yes'=>'','no'=>'','ent'=>'','choice'=>'');
+ }
+
+ return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/vote_buttons.tpl'), $classes);
+
+ }
+ private function get_voteinfo(){
+ $var = votes::get_voteinfo($this->poll_ID);
+ return $var['iframe_link'];
+ }
+ public static function js(){
+ return array(\SYSTEM\WEBPATH(new \PPAGE(),'user_main_poll_sub/js/user_main_poll_sub.js'));}
+
+ public function html(){
+ $poll_expired = \SQL\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID, 2));
+ $user_vote = votes::getUserPollDataSub($this->poll_ID);
+ $vars = array();
+ $vars = array_merge($vars,votes::get_voteinfo_sub($this->poll_ID));
+ $vars['choice_party'] = $this->choice_party();
+ $vars['bars_user'] = $this->bars_user();
+ $vars['bars_bt'] = $this->bars_bt();
+ $vars['voice_weight'] = $this->voice_weight();
+ $vars['vote_buttons'] = $this->vote_buttons($poll_expired, $user_vote);
+ $vars['poll_ID'] = $this->poll_ID; //put it here - so its filled in!
+ $vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=files&cat=frontend_logos&id=';
+ $vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
+ $vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
+ //$vars['vote'] = $this->get_voteinfo(); //votes::getVoteOfGroup($poll_ID);
+ $result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll_sub/tpl/full_vote.tpl'), $vars);
+ return $result;
+ }
+
+}
\ No newline at end of file
diff --git a/uvote/page/user_main_votelist/tpl/vote.tpl b/uvote/page/user_main_votelist/tpl/vote.tpl
index 7bc3b85..e1185aa 100644
--- a/uvote/page/user_main_votelist/tpl/vote.tpl
+++ b/uvote/page/user_main_votelist/tpl/vote.tpl
@@ -1,17 +1,20 @@
+
+
+
+
+ ${statusmarker}
+
+
+
+ ${title}
+
-
- ${title}
-
-
-
- ${statusmarker}
-
diff --git a/uvote/sql/qq/UVOTE_DATA_POLL_INITIATIVE.php b/uvote/sql/qq/UVOTE_DATA_POLL_INITIATIVE.php
new file mode 100644
index 0000000..17c01c9
--- /dev/null
+++ b/uvote/sql/qq/UVOTE_DATA_POLL_INITIATIVE.php
@@ -0,0 +1,8 @@
+