working state
included anträge included js api for poll
This commit is contained in:
parent
14d3de26a7
commit
21766764cc
@ -4,7 +4,8 @@ class api_uvote extends \SYSTEM\API\api_system {
|
||||
//votes
|
||||
public static function call_vote_action_vote($poll_ID, $vote) {
|
||||
return votes::write_vote($poll_ID, $vote);}
|
||||
|
||||
public static function call_vote_action_vote_sub($poll_ID, $vote) {
|
||||
return votes::write_vote_sub($poll_ID, $vote);}
|
||||
public static function call_vote_action_data($location, $birthyear, $gender, $children) {
|
||||
return votes::write_data($location, $birthyear, $gender, $children);}
|
||||
|
||||
@ -58,8 +59,8 @@ class api_uvote extends \SYSTEM\API\api_system {
|
||||
if($set == 'bilance_choice'){
|
||||
return stats_bilance_choice::basic_bilance_choice($cat);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,12 +22,21 @@ class votes {
|
||||
return NULL;}
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$res = $con->prepare( 'selVoteByGrp',
|
||||
'SELECT * FROM `uvote_data` WHERE `user_ID` = ? AND poll_ID = ?;',
|
||||
'SELECT * FROM `uvote_data` WHERE `user_ID` = ? AND poll_ID = ? AND uvote_data.group = 1;',
|
||||
array(\SYSTEM\SECURITY\Security::getUser()->id,$poll_ID));
|
||||
$result = $res->next();
|
||||
return $result['choice'];
|
||||
}
|
||||
public static function getUserPollDataSub($poll_ID){
|
||||
if (!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
return NULL;}
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$res = $con->prepare( 'selVoteByGrp',
|
||||
'SELECT * FROM `uvote_data` WHERE `user_ID` = ? AND poll_ID = ? AND uvote_data.group = 2;',
|
||||
array(\SYSTEM\SECURITY\Security::getUser()->id,$poll_ID));
|
||||
$result = $res->next();
|
||||
return $result['choice'];
|
||||
}
|
||||
|
||||
|
||||
public static function get_barsperusers($poll_ID,$return_as_json = true){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
@ -133,13 +142,31 @@ class votes {
|
||||
public static function get_voteinfo($poll_ID){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$res = $con->prepare( 'selVoteByID',
|
||||
'SELECT * FROM `uvote_votes` WHERE `ID` = ?;',
|
||||
'SELECT * FROM `uvote_votes` WHERE `ID` = ? AND uvote_votes.group = 1;',
|
||||
array($poll_ID));
|
||||
$res = $res->next();
|
||||
// $res['title'] = utf8_encode($res['title']);
|
||||
return $res;
|
||||
}
|
||||
public static function get_sublinks($poll_ID){
|
||||
$result = '';
|
||||
$res = \SQL\UVOTE_DATA_POLL_INITIATIVE::QA(array($poll_ID));
|
||||
foreach ($res as $row){
|
||||
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/buttons/sub_button.tpl'), $row);
|
||||
}
|
||||
// $res['title'] = utf8_encode($res['title']);
|
||||
return $result;
|
||||
}
|
||||
public static function get_voteinfo_sub($poll_ID){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$res = $con->prepare( 'selVoteByIDSub',
|
||||
'SELECT * FROM `uvote_votes` WHERE `ID` = ? AND uvote_votes.group = 2;',
|
||||
array($poll_ID));
|
||||
$res = $res->next();
|
||||
// $res['title'] = utf8_encode($res['title']);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
public static function get_party_choice($poll_ID, $party){
|
||||
$res = \SQL\UVOTE_DATA_PARTY_CHOICE_PER_POLL::Q1(array($poll_ID, $party));
|
||||
@ -153,7 +180,18 @@ class votes {
|
||||
array($poll_ID));
|
||||
$res = $con->prepare( 'insertVote',
|
||||
'REPLACE uvote_data
|
||||
VALUES (?, ?, ?, 0, NOW());',
|
||||
VALUES (?, ?, ?, 1, NOW());',
|
||||
array($poll_ID, \SYSTEM\SECURITY\Security::getUser()->id, $vote));
|
||||
return JsonResult::ok();
|
||||
}
|
||||
public static function write_vote_sub($poll_ID, $vote){
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
$res = $con->prepare( 'selVote',
|
||||
'SELECT * FROM `uvote_votes` WHERE `ID` = ?;',
|
||||
array($poll_ID));
|
||||
$res = $con->prepare( 'insertVote',
|
||||
'REPLACE uvote_data
|
||||
VALUES (?, ?, ?, 2, NOW());',
|
||||
array($poll_ID, \SYSTEM\SECURITY\Security::getUser()->id, $vote));
|
||||
return JsonResult::ok();
|
||||
}
|
||||
|
||||
@ -9,4 +9,5 @@ SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_start','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_votelist','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_analysis','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_options','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_poll','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_poll','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_poll_sub','');
|
||||
@ -69,23 +69,6 @@ function get_barsperparty (poll_ID) {
|
||||
});
|
||||
}
|
||||
|
||||
function vote_click (poll_ID, vote) {
|
||||
$.getJSON('./api.php?call=vote&action=vote&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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function submit_commentrate (c_ID, val) {
|
||||
alert('success');
|
||||
$.getJSON('./api.php?call=vote&action=commentrate&c_ID=' + c_ID + '&val=' + val, function(data) {
|
||||
|
||||
@ -24,7 +24,12 @@ class page_uvote extends \SYSTEM\API\api_default {
|
||||
//return (new user_main_poll($poll_ID))->html();}
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
return (new default_register ())->html();}
|
||||
return (new user_main_poll($poll_ID))->html();}
|
||||
return (new user_main_poll($poll_ID))->html();}
|
||||
public static function page_user_main_poll_sub($poll_ID) {
|
||||
//return (new user_main_poll($poll_ID))->html();}
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
return (new default_register ())->html();}
|
||||
return (new user_main_poll_sub($poll_ID))->html();}
|
||||
|
||||
public static function page_user_main_votelist(){
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<h4><span class="glyphicon glyphicon-info-sign"></span></h4>
|
||||
${analysis_help_basic_votes}
|
||||
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
|
||||
${analysis_math_basic votes}
|
||||
${analysis_math_basic_votes}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -11,5 +11,16 @@ function init_user_main_poll(){
|
||||
$('#user_main').resize(function(){
|
||||
$('#pollframe').height($('#user_main').height());
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
function vote_click (poll_ID, vote) {
|
||||
$.getJSON('./api.php?call=vote&action=vote&poll_ID=' + poll_ID + '&vote=' + vote, function(data) {
|
||||
var items = [];
|
||||
if(data.status == true){
|
||||
alert("success");
|
||||
system.reload();
|
||||
} else {
|
||||
alert(data.result.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
8
uvote/page/user_main_poll/tpl/buttons/sub_button.tpl
Normal file
8
uvote/page/user_main_poll/tpl/buttons/sub_button.tpl
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="row" style="padding-top: 10px;">
|
||||
${title}<br>
|
||||
<a href="#!start(poll_sub);poll.${ID}" poll_ID="${ID}">
|
||||
<button class="btn btn-primary" id="poll_init" type="button">
|
||||
<i class="glyphicon glyphicon-eye-open"></i> Öffnen
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
<div class="col-md-4">
|
||||
<div id="poll_body" class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="row">
|
||||
<div class="panel-group" id="poll_3">
|
||||
<div class="panel panel-default panel-info">
|
||||
@ -9,16 +9,37 @@
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body row" id="poll_3_body">
|
||||
<div class="col-md-12">
|
||||
<h4 style="word-break: break-all;">${title}</h4>
|
||||
${openvote_help_text}
|
||||
${title} abstimmen.
|
||||
<hr>
|
||||
${voice_weight}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h4 style="word-break: break-all;">${title}</h4>
|
||||
${openvote_help_text}
|
||||
${title} abstimmen.
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="row">
|
||||
<div class="panel-group" id="poll_7">
|
||||
<div class="panel panel-default panel-info">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#poll_7" href="#poll_7_body"><i class="glyphicon glyphicon-paperclip"></i> Änderungsanträge</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body panel-collapse collapse" id="poll_7_body" style="padding: 0;">
|
||||
<div class="row" style="padding: 0; margin: 0;">
|
||||
<div class="row">
|
||||
<div class="col-md-12" style="padding-bottom: 10px;">
|
||||
${sub_buttons}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="panel-group" id="poll_6">
|
||||
@ -28,7 +49,7 @@
|
||||
<a data-toggle="collapse" data-parent="#poll_6" href="#poll_6_body"><i class="glyphicon glyphicon-stats"></i> Statistik</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body panel-collapse" id="poll_6_body" style="padding: 0;">
|
||||
<div class="panel-body panel-collapse collapse" id="poll_6_body" style="padding: 0;">
|
||||
<div class="row" style="padding: 0; margin: 0;">
|
||||
<div class="panel-group" id="poll_1" style="padding: 0; margin: 0;">
|
||||
<div class="panel panel-default panel-warning">
|
||||
@ -65,6 +86,8 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-8" style="height: 100%">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="panel-group" id="poll_4">
|
||||
<div class="panel panel-default panel-info">
|
||||
@ -76,6 +99,7 @@
|
||||
<div class="panel-body" id="poll_4_body">
|
||||
<div class="row">
|
||||
${vote_buttons}
|
||||
${voice_weight}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -90,5 +114,5 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h5>Ändere deine Stimme hier ab</h5>
|
||||
<button id="btnvote_yes" class="btn btn_vote ${yes} btn-default btnvote_yes"
|
||||
<button id="btnvote_yes" class="btn btn-success btn_vote ${yes} btn-default btnvote_yes"
|
||||
style=""
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3"><span class="glyphicon glyphicon-ok-sign"></span> Pro</font></button>
|
||||
<button id="btnvote_no" class="btn btn_vote ${no} btn-default btnvote_no"
|
||||
<button id="btnvote_no" class="btn btn-danger btn_vote ${no} btn-default btnvote_no"
|
||||
style=""
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3"><span class="glyphicon glyphicon-remove-sign"></span> Contra</font></button>
|
||||
<button id="btnvote_off" class="btn btn_vote ${ent} btn-default btnvote_off"
|
||||
<button id="btnvote_off" class="btn btn-info btn_vote ${ent} btn-default btnvote_off"
|
||||
style=""
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h5>Abgestimmt mit:</h5>
|
||||
<img class="img-responsive"src="${frontend_logos}icon_urn_${choice}.png"/>
|
||||
<img class="img-responsive" src="${frontend_logos}icon_urn${choice}.png"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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();
|
||||
|
||||
28
uvote/page/user_main_poll_sub/js/user_main_poll_sub.js
Normal file
28
uvote/page/user_main_poll_sub/js/user_main_poll_sub.js
Normal file
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
6
uvote/page/user_main_poll_sub/tpl/bars_user.tpl
Normal file
6
uvote/page/user_main_poll_sub/tpl/bars_user.tpl
Normal file
@ -0,0 +1,6 @@
|
||||
<h4>uvote community</h4>
|
||||
<div class="progress" id="progress_bars_user">
|
||||
<div class="progress-bar progress-bar-success" style="width: ${vote_yes_perc}%;">${vote_yes_perc}%</div>
|
||||
<div class="progress-bar progress-bar-danger" style="width: ${vote_no_perc}%;">${vote_no_perc}%</div>
|
||||
<div class="progress-bar progress-bar-info" style="width: ${vote_ent_perc}%;">${vote_ent_perc}%</div>
|
||||
</div>
|
||||
17
uvote/page/user_main_poll_sub/tpl/comment.tpl
Normal file
17
uvote/page/user_main_poll_sub/tpl/comment.tpl
Normal file
@ -0,0 +1,17 @@
|
||||
<div id="comment_main">
|
||||
<div id="comment_sub1">${timestamp}</div>
|
||||
<a style="float: right" class="btn btn-warning btn-mini c_spam" c_ID="${c_ID}"><i class="icon-white icon-exclamation-sign"></i></a>
|
||||
<div id="comment_sub2"></div>
|
||||
<div>${c_txt}</div>
|
||||
<br>
|
||||
<div id="comment_sub3">
|
||||
${count_up}
|
||||
<a class="btn btn-success btn-mini c_up" c_ID="${c_ID}"><i class="icon-white icon-thumbs-up"></i></a>
|
||||
${count_down}
|
||||
<a class="btn btn-danger btn-mini c_down" c_ID="${c_ID}"><i class="icon-white icon-thumbs-down"></i></a>
|
||||
<div id="comment_sub4">Quelle:<font size="2">${c_src}</font></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
96
uvote/page/user_main_poll_sub/tpl/full_vote.tpl
Normal file
96
uvote/page/user_main_poll_sub/tpl/full_vote.tpl
Normal file
@ -0,0 +1,96 @@
|
||||
<div id="poll_body" class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="row">
|
||||
<div class="panel-group" id="poll_3">
|
||||
<div class="panel panel-default panel-info">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#poll_3" href="#poll_3_body"><i class="glyphicon glyphicon-info-sign"></i> Info</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body row" id="poll_3_body">
|
||||
<div class="col-md-12">
|
||||
<h4 style="word-break: break-all;">${title}</h4>
|
||||
${openvote_help_text}
|
||||
${title} abstimmen.
|
||||
<hr>
|
||||
${voice_weight}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="panel-group" id="poll_6">
|
||||
<div class="panel panel-default panel-info">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#poll_6" href="#poll_6_body"><i class="glyphicon glyphicon-stats"></i> Statistik</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body panel-collapse" id="poll_6_body" style="padding: 0;">
|
||||
<div class="row" style="padding: 0; margin: 0;">
|
||||
<div class="panel-group" id="poll_1" style="padding: 0; margin: 0;">
|
||||
<div class="panel panel-default panel-warning">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#poll_1" href="#poll_1_body">Endergebnis</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body panel-collapse collapse" id="poll_1_body">
|
||||
${bars_user}<br>
|
||||
${bars_bt}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding: 0; margin: 0;">
|
||||
<div class="panel-group" id="poll_2" style="padding: 0; margin: 0;">
|
||||
<div class="panel panel-default panel-warning">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#poll_2" href="#poll_2_body">Ergebnis nach Fraktionen</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body panel-collapse collapse" id="poll_2_body">
|
||||
${choice_party}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8" style="height: 100%">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="panel-group" id="poll_4">
|
||||
<div class="panel panel-default panel-info">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<a data-toggle="collapse" data-parent="#poll_4" href="#poll_4_body"><i class="glyphicon glyphicon-check"></i> Abstimmen</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body" id="poll_4_body">
|
||||
<div class="row">
|
||||
${vote_buttons}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="text-align: center;">
|
||||
Quelle: <a href="${iframe_link}">${iframe_link} </a>
|
||||
</div>
|
||||
<div class="row" style="text-align: center;">
|
||||
<iframe id="poll_frame" class="col-md-12" height="700" style="padding: 0; overflow-y: scroll;" src="${iframe_link}"></iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<h5>${urvote_party_table_desc}</h5>
|
||||
7
uvote/page/user_main_poll_sub/tpl/table_bt.tpl
Normal file
7
uvote/page/user_main_poll_sub/tpl/table_bt.tpl
Normal file
@ -0,0 +1,7 @@
|
||||
${choice_show}
|
||||
Stimmverteilung Bundestag
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-success" style="width: ${bt_pro}%;">${bt_pro}%</div>
|
||||
<div class="progress-bar progress-bar-danger" style="width: ${bt_con}%;">${bt_con}%</div>
|
||||
<div class="progress-bar progress-bar-info" style="width: ${bt_ent}%;"><p>${bt_ent}%</p></div>
|
||||
</div>
|
||||
3
uvote/page/user_main_poll_sub/tpl/table_bt_choice.tpl
Normal file
3
uvote/page/user_main_poll_sub/tpl/table_bt_choice.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
<img class="img-responsive" src="${frontend_logos}icon_bt.png"/>
|
||||
Der Bundestag hat "${choice_full}" <img class="img-responsive" style="float: right;" src="${frontend_logos}icon_urn_${choice}.png"/> abgestimmt.<br><br>
|
||||
${disclaimer}
|
||||
12
uvote/page/user_main_poll_sub/tpl/table_parties.tpl
Normal file
12
uvote/page/user_main_poll_sub/tpl/table_parties.tpl
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="badge badge-success" style="">${party_yes}%</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="badge badge-danger" style="">${party_no}%</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="badge badge-info" style="">${party_ent}%</div>
|
||||
</div>
|
||||
</div>
|
||||
11
uvote/page/user_main_poll_sub/tpl/vote_bt.tpl
Normal file
11
uvote/page/user_main_poll_sub/tpl/vote_bt.tpl
Normal file
@ -0,0 +1,11 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4" style=""><img class="img-responsive" src="${frontend_logos}icon_${party}.png"></div>
|
||||
<div class="col-md-8">
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-success" style="width: ${party_yes}%">${party_yes}%</div>
|
||||
<div class="progress-bar progress-bar-danger" style="width: ${party_no}%">${party_no}%</div>
|
||||
<div class="progress-bar progress-bar-info" style="width: ${party_ent}%">${party_ent}%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
24
uvote/page/user_main_poll_sub/tpl/vote_buttons.tpl
Normal file
24
uvote/page/user_main_poll_sub/tpl/vote_buttons.tpl
Normal file
@ -0,0 +1,24 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h5>Ändere deine Stimme hier ab</h5>
|
||||
<button id="btnvote_yes" class="btn btn_vote ${yes} btn-default btnvote_yes"
|
||||
style=""
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3"><span class="glyphicon glyphicon-ok-sign"></span> Pro</font></button>
|
||||
<button id="btnvote_no" class="btn btn_vote ${no} btn-default btnvote_no"
|
||||
style=""
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3"><span class="glyphicon glyphicon-remove-sign"></span> Contra</font></button>
|
||||
<button id="btnvote_off" class="btn btn_vote ${ent} btn-default btnvote_off"
|
||||
style=""
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3"><span class="glyphicon glyphicon-ban-circle"></span> Enthaltung</font></button>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h5>Abgestimmt mit:</h5>
|
||||
<img class="img-responsive"src="${frontend_logos}icon_urn_${choice}.png"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
18
uvote/page/user_main_poll_sub/tpl/vote_buttons_fresh.tpl
Normal file
18
uvote/page/user_main_poll_sub/tpl/vote_buttons_fresh.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h5>Stimme hier ab</h5>
|
||||
<button id="btnvote_yes" class="btn btn-success btn-default"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3"><span class="glyphicon glyphicon-ok-sign"></span> Pro</font></button>
|
||||
<button id="btnvote_no" class="btn btn-danger btn-default"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3"><span class="glyphicon glyphicon-remove-sign"></span> Contra</font></button>
|
||||
<button id="btnvote_off" class="btn btn-info btn-default"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3"><span class="glyphicon glyphicon-ban-circle"></span> Enthaltung</font></button>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h5>Noch nich Abgestimmt...</h5>
|
||||
<img class="img-responsive"src="${frontend_logos}icon_urn.png"/>
|
||||
</div>
|
||||
</div>
|
||||
4
uvote/page/user_main_poll_sub/tpl/voteweight.tpl
Normal file
4
uvote/page/user_main_poll_sub/tpl/voteweight.tpl
Normal file
@ -0,0 +1,4 @@
|
||||
<div style="margin-top: 20px;">
|
||||
Dein aktuelles Stimmgewicht bei dieser Abstimmung:
|
||||
<span class="badge badge-info">${voteweight}%</span>
|
||||
</div>
|
||||
111
uvote/page/user_main_poll_sub/user_main_poll_sub.php
Normal file
111
uvote/page/user_main_poll_sub/user_main_poll_sub.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
class user_main_poll_sub extends SYSTEM\PAGE\Page {
|
||||
private $poll_ID = null;
|
||||
public function __construct($poll_ID){
|
||||
$this->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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,17 +1,20 @@
|
||||
<div id="vote_main" class="row">
|
||||
|
||||
<div class="col-md-2">
|
||||
<label class="label label-primary" style="padding: 5px">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
${statusmarker}
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
${title}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<img src="${frontend_logos}icon_urn_${vote_class}.png">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<a href="#!start(poll);poll.${ID}" class="btn btn-primary btn-small" poll_ID="${ID}"><span class="glyphicon glyphicon-eye-open"></span> Abstimmen</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
${title}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<span class="glyphicon glyphicon-info-sign"></span>
|
||||
${statusmarker}
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
|
||||
8
uvote/sql/qq/UVOTE_DATA_POLL_INITIATIVE.php
Normal file
8
uvote/sql/qq/UVOTE_DATA_POLL_INITIATIVE.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
|
||||
class UVOTE_DATA_POLL_INITIATIVE extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT * FROM uvote_votes WHERE uvote_votes.group = 2 AND initiative = ?;'
|
||||
;}}
|
||||
@ -4,5 +4,5 @@ namespace SQL;
|
||||
class UVOTE_POLL_EXPIRED extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT * FROM `uvote_votes` WHERE `ID` = ?;'
|
||||
'SELECT * FROM `uvote_votes` WHERE `ID` = ? AND uvote_votes.group = ?;'
|
||||
;}}
|
||||
Loading…
x
Reference in New Issue
Block a user