diff --git a/uVote/api/votes/votes.php b/uVote/api/votes/votes.php
index fd63261..cf43f0b 100644
--- a/uVote/api/votes/votes.php
+++ b/uVote/api/votes/votes.php
@@ -34,13 +34,14 @@ class votes {
$res = $res->next();
$result = array();
$result['poll_ID'] = $poll_ID;
- $result['count'] = $res['count'];
+ $result['count'] = $res['count'] >= 1 ? $res['count'] : 1;
//yes
$res = $con->prepare( 'selVoteBy_count',
'SELECT COUNT(*) as "count" FROM `uvote_data` WHERE `poll_ID` = ? AND choice = 1;',
array($poll_ID));
$res = $res->next();
$result['yes'] = $res['count'];
+
$result['yes_perc'] = $res['count'] / $result['count'];
//no
$res = $con->prepare( 'selVoteBy_count',
@@ -60,6 +61,10 @@ class votes {
return $return_as_json ? JsonResult::toString($result) : $result;
}
+ public static function get_bar_bt_per_poll($poll_ID){
+ return \DBD\UVOTE_DATA_BT_PER_POLL::Q1(array($poll_ID));}
+
+
public static function get_voteinfo($poll_ID){
$con = new \SYSTEM\DB\Connection(new \DBD\uVote());
$res = $con->prepare( 'selVoteByID',
@@ -87,14 +92,14 @@ class votes {
$con = new \SYSTEM\DB\Connection(new \DBD\uVote());
$res = $con->prepare( 'selVote',
- 'SELECT * FROM `uvote_data` WHERE `poll_ID` = ? AND user_ID = ?;',
- array($poll_ID, \SYSTEM\SECURITY\Security::getUser()->id));
+ 'SELECT * FROM `uvote_votes` WHERE `ID` = ? AND time_end < CURDATE();',
+ array($poll_ID));
if ($res->next()){
- throw new ERROR('You already voted!');}
+ throw new ERROR('Your rights have expired!');}
$res = $con->prepare( 'insertVote',
- 'INSERT INTO uvote_data
- VALUES (?, ?, ?);',
+ 'REPLACE uvote_data
+ VALUES (?, ?, ?, 0);',
array($poll_ID, \SYSTEM\SECURITY\Security::getUser()->id, $vote));
return JsonResult::ok();
}
@@ -115,9 +120,8 @@ class votes {
public static function open_vote($poll_ID){
$vote = votes::getVoteOfGroup($poll_ID);
- new INFO(print_r($vote, true));
- $vars = array('vote_text' => $vote['text'], 'vote_title' => $vote['title'], 'vote_init' => $vote['initiative'], 'poll_ID' => $vote['ID'], 'time_end' => $vote['time_end']);
- $result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/full_vote.tpl'), $vars);
+// $vars = array('vote_text' => $vote['text'], 'vote_title' => $vote['title'], 'vote_init' => $vote['initiative'], 'poll_ID' => $vote['ID'], 'time_end' => $vote['time_end']);
+ $result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/full_vote.tpl'), $vote);
return $result;
}
}
diff --git a/uVote/dbd/qq/UVOTE_DATA_BT_PER_POLL.php b/uVote/dbd/qq/UVOTE_DATA_BT_PER_POLL.php
new file mode 100644
index 0000000..b2af6f8
--- /dev/null
+++ b/uVote/dbd/qq/UVOTE_DATA_BT_PER_POLL.php
@@ -0,0 +1,16 @@
+ CURDATE();'
+);}}
\ No newline at end of file
diff --git a/uVote/page/default_bulletin/bars_user.tpl b/uVote/page/default_bulletin/bars_user.tpl
new file mode 100644
index 0000000..09ee604
--- /dev/null
+++ b/uVote/page/default_bulletin/bars_user.tpl
@@ -0,0 +1,6 @@
+
${title}
+
+
Yes
+
No
+
Ent
+
\ No newline at end of file
diff --git a/uVote/page/default_bulletin/bulletin.tpl b/uVote/page/default_bulletin/bulletin.tpl
index 259aec2..12d1d51 100644
--- a/uVote/page/default_bulletin/bulletin.tpl
+++ b/uVote/page/default_bulletin/bulletin.tpl
@@ -3,22 +3,19 @@
+ Pro
+ Contra
+ Enthaltung' :
+ print_r($poll_data,TRUE);
+ $vars['poll_ID'] = $this->poll_ID;
$vars = array_merge($vars,votes::get_voteinfo($this->poll_ID));
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/bulletin.tpl'),$vars);
}
diff --git a/uVote/page/default_bulletin/table_bt.tpl b/uVote/page/default_bulletin/table_bt.tpl
new file mode 100644
index 0000000..9ac6950
--- /dev/null
+++ b/uVote/page/default_bulletin/table_bt.tpl
@@ -0,0 +1,8 @@
+
+
Ergebnis Bundestag
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uVote/page/default_bulletin/table_parties.tpl b/uVote/page/default_bulletin/table_parties.tpl
new file mode 100644
index 0000000..d42008c
--- /dev/null
+++ b/uVote/page/default_bulletin/table_parties.tpl
@@ -0,0 +1,8 @@
+
+${party}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uVote/page/default_cover/cover.tpl b/uVote/page/default_cover/cover.tpl
index bced509..4be7ec8 100644
--- a/uVote/page/default_cover/cover.tpl
+++ b/uVote/page/default_cover/cover.tpl
@@ -1,6 +1,6 @@