1 step b4 beta!

This commit is contained in:
Naeltard 2015-10-17 04:37:03 +02:00
parent 3adfdc6704
commit eb4d6ede4f
27 changed files with 361 additions and 149 deletions

View File

@ -3,9 +3,9 @@ class bars{
public static function get_user_choice_overall($user_ID){
$vars = \SQL\UVOTE_DATA_USER_CHOICE_OVERALL::Q1(array($user_ID));
$vars['user_total_total'] = $vars['user_total_pro'] + $vars['user_total_con'] + $vars['user_total_ent'];
$vars['user_total_pro_percentage'] = round($vars['user_total_pro']/$vars['user_total_total']*100+1);
$vars['user_total_con_percentage'] = round($vars['user_total_con']/$vars['user_total_total']*100+1);
$vars['user_total_ent_percentage'] = round($vars['user_total_ent']/$vars['user_total_total']*100+1);
$vars['user_total_pro_percentage'] = $vars['user_total_total'] > 0 ? round($vars['user_total_pro']/$vars['user_total_total']*100) : 0;
$vars['user_total_con_percentage'] = $vars['user_total_total'] > 0 ? round($vars['user_total_con']/$vars['user_total_total']*100) : 0;
$vars['user_total_ent_percentage'] = $vars['user_total_total'] > 0 ? round($vars['user_total_ent']/$vars['user_total_total']*100) : 0;
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/user_total.tpl'),$vars);
}
public static function get_uvote_choice_overall(){
@ -17,6 +17,15 @@ class bars{
new SYSTEM\LOG\INFO($vars['total_ent_percentage']);
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/uvote_total.tpl'),$vars);
}
public static function get_bt_choice_overall(){
$vars = \SQL\UVOTE_DATA_CHOICE_BT_OVERALL::Q1(array());
$vars['total_total'] = $vars['pro'] + $vars['con'] + $vars['ent'];
$vars['total_pro_percentage'] = round($vars['pro']/$vars['total_total']*100+1);
$vars['total_con_percentage'] = round($vars['con']/$vars['total_total']*100+1);
$vars['total_ent_percentage'] = round($vars['ent']/$vars['total_total']*100+1);
new SYSTEM\LOG\INFO($vars['total_ent_percentage']);
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/bt_total.tpl'),$vars);
}
public static function get_uvote_choice_overall_to_bt(){
$result = '';
$vars = \SQL\UVOTE_DATA_UVOTE_TO_PARTY_OVERALL::QA(array());
@ -26,7 +35,15 @@ class bars{
}
return $result;
}
public static function get_bt_choice_overall_to_bt(){
$result = '';
$vars = \SQL\UVOTE_DATA_BT_TO_PARTY_OVERALL::QA(array());
foreach($vars as $bar){
$bar['match_percentage'] = round($bar['class_MATCH']/($bar['class_MATCH']+$bar['class_MISSMATCH'])*100,2);
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/urvoteparties.tpl'), $bar);
}
return $result;
}
public static function user_per_party_overall(){
//$vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id));
$result = '';
@ -118,7 +135,7 @@ class bars{
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/urvotebt_by_choice.tpl'), $row);;
}
if(empty($result)){
return 'Keine relevanten Daten verfügbar';
return 'Keine relevanten Daten verfügbar<br><br>';
}
return $result;
@ -135,7 +152,7 @@ class bars{
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'])*100,2);
$row['match_percentage'] = ($row['class_MATCH']+$row['class_MISSMATCH']) > 0 ? round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH'])*100,2) : 0;
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/bt_to_user_overall.tpl'), $row);
}

View File

@ -77,21 +77,21 @@ class votes {
public static function get_user_temp_votes(){
$vars = \SQL\UVOTE_DATA_TEMP_VOTES::Q1(array(\SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->id));
$v = $vars['voted'] > 1 ? $vars['voted'] : 1;
$v = $vars['voted'];
$nv = $vars['not_voted'];
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/all_polls.tpl'),
array( 'vote_percent'=> round($v/($nv+$v)*100, 2),
'no_vote_percent'=> round($nv/($nv+$v)*100, 2),
array( 'vote_percent'=> $v > 0 ? round($v/($nv+$v)*100, 2) : 0,
'no_vote_percent'=> $nv > 0 ? round($nv/($nv+$v)*100, 2) : 0,
'voted'=> $v,
'not_voted'=> $nv));}
public static function get_user_overall_votes(){
$vars = \SQL\UVOTE_DATA_OVERALL_VOTES::Q1(array(\SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->creationDate));
$v = $vars['voted'] > 1 ? $vars['voted'] : 1;
$v = $vars['voted'];
$nv = $vars['not_voted'];
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/overall_all_polls.tpl'),
array( 'vote_perc'=> round($v/($nv+$v)*100, 2),
'no_vote_perc'=> round($nv/($nv+$v)*100, 2),
array( 'vote_perc'=> $v > 0 ? round($v/($nv+$v)*100, 2) : 0,
'no_vote_perc'=> $v > 0 ? round($nv/($nv+$v)*100, 2) : 0,
'voted'=> $v,
'not_voted'=> $nv));}

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -83,6 +83,9 @@ function vote_click (poll_ID, vote) {
});
}
function submit_commentrate (c_ID, val) {
alert('success');
$.getJSON('./api.php?call=vote&action=commentrate&c_ID=' + c_ID + '&val=' + val, function(data) {
@ -163,24 +166,7 @@ function send_feedback (feedback) {
});
}
function register_registerform(){
//console.log("wegwegwegwegwegweg");
$("#register_user_form input").not("[type=submit]").jqBootstrapValidation(
{
preventSubmit: true,
submitError: function($form, event, errors) {},
submitSuccess: function($form, event){
$.get('./api.php?call=account&action=create&username=' + $('#register_username').val() + '&password_sha=' + $.sha1($('#user_register_password1').val()) + '&email=' + $('#register_email').val() + '&locale=deDE', function (data) {
if(data == 1){
window.location.reload();
} else {
$('#help-block-user-password-combi-wrong').attr('style', 'display: block;');
}
});
event.preventDefault();
}
});
}
function loadAjaxContent(url) {
var dataTmp;

View File

@ -1,10 +1,7 @@
<div class="col-md-12">
<form class="" id="form_login">
<div class="form-group">
<div id="help-block"></div>
<div class="row">
<div class="col-md-3">
<div class="row">
<input type="text"
size="20"
style=""
@ -13,8 +10,7 @@
minlength="3" data-validation-minlength-message="${register_user_name_too_short}"
maxlength="16" data-validation-maxlength-message="${register_user_name_too_long}"
required data-validation-required-message="${register_user_name_required}"/>
</div>
<div class="col-md-3">
<input type="password"
size="20"
style=""
@ -23,16 +19,9 @@
minlength="5" data-validation-minlength-message="${register_password_too_short}"
maxlength="16" data-validation-maxlength-message="${register_user_password_too_long}"
required data-validation-required-message="${register_user_password_required}"/>
</div>
<div class="col-md-2">
<button class="btn btn-primary" type="submit" id="login_submit"><span class="glyphicon glyphicon-log-in"></span>&nbsp;&nbsp;${login}</button>
</div>
<div class="col-md-4"><a href="#!start(user_main(imp))"><button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-tags"></span>&nbsp;Impressum</button></a></div>
</div>
</div>
</div>
</form>
</div>

View File

@ -1,6 +1,8 @@
<div class="row">
<ul>
<li>${loginform}</li>
<div class="row" style="margin-bottom: 30px;">
<ul class="nav nav-pills" id="tabs_user_main" style=" text-align: center;">
<li class="active"><a href="#!start(user_main(start))"><span class="glyphicon glyphicon-home"></span>&nbsp;Start</a></li>
<li><a href="#!start(user_main(news))"><span class="glyphicon glyphicon-bullhorn"></span>&nbsp;News</a></li>
<li><a href="#!start(user_main(imp))"><span class="glyphicon glyphicon-tags"></span>&nbsp;Impressum</a></li>
<li style="float: right">${loginform}</li>
</ul>
</div>
</div>

View File

@ -5,23 +5,26 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<meta name="author" content="">
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
${css}
${js}
</head>
<body>
<body style="background: url(${frontend_logos}tapete.gif); background-attachment: fixed;">
<div class="main_container">
<div class="container" id="site-content">
<div class="row">
<div class="col-md-12">
<img class="img-responsive" src="${frontend_logos}logo.gif"/>
<div class="row">
<div class="col-md-12" style="border: #0088cc 2px ; padding: 0;">
<img class="img-responsive" src="${frontend_logos}logo.png" style="width: 100%"/>
</div>
</div>
</div>
<div class="row"><hr></div>
<div class="row">
${menu}
</div>
<div class="row" id="user_main"></div>
<font family="Raleway"><div class="row" id="user_main"></div></font>
</div>
</div>
</body>

View File

@ -4,7 +4,8 @@ class default_register extends SYSTEM\PAGE\Page {
private function css(){
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_register/css/register.css').'" rel="stylesheet">';}
public static function js(){
return array(\SYSTEM\WEBPATH(new \PPAGE(),'default_register/js/default_register.js'));}
public function html(){
$vars = array();
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=files&cat=frontend_logos&id=';

View File

@ -1,10 +1,15 @@
function init_default_register(){
register_registerform();
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
function register_registerform(){
//console.log("wegwegwegwegwegweg");
$.get('./api.php?call=account&action=create&username=' + $('#register_username').val() + '&password_sha=' + $.sha1($('#user_register_password1').val()) + '&email=' + $('#register_email').val() + '&locale=deDE', function (data) {
if(data == 1){
window.location.reload();
} else {
$('#help-block-user-password-combi-wrong').attr('style', 'display: block;');
}
});
}

View File

@ -1,13 +1,13 @@
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">
Welcome
Willkommen auf uvote.eu!
</h4>
</div>
<div class="panel-body row">
<div class="col-md-6">
<div id="loggedout_text" class="col-md-6" style="border-right: #d9edf7 solid 2px;">
${welcome_text}
</div>
<div class="col-md-6">
@ -88,10 +88,27 @@
</tr>
</tbody>
</table>
<button class="btn btn-primary" type="submit"><i class="icon-ok icon-white"></i> ${register}</button>
<button class="btn btn-primary" type="submit"><i class="icon-ok icon-white"></i> ${register}</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
$("#register_user_form input").not("[type=submit]").jqBootstrapValidation(
{
preventSubmit: true,
submitError: function($form, event, errors) {},
submitSuccess: function($form, event){
$.get('./api.php?call=account&action=create&username=' + $('#register_username').val() + '&password_sha=' + $.sha1($('#user_register_password1').val()) + '&email=' + $('#register_email').val() + '&locale=deDE', function (data) {
if(data == 1){
window.location.reload();
} else {
$('#help-block-user-password-combi-wrong').attr('style', 'display: block;');
}
});
event.preventDefault();
}
});
</script>

View File

@ -33,5 +33,15 @@ class page_uvote extends \SYSTEM\API\api_default {
public static function page_user_main_impressum(){
return (new user_main_impressum())->html();}
public static function page_user_main_loggedout_start(){
return \SYSTEM\PAGE\text::get('welcome_text');
}
public static function page_user_main_loggedout_news(){
return user_main_start::newsfeed();
}
private function default_register(){
return (new default_register ())->html();}
}

View File

@ -0,0 +1,52 @@
<div class="row">
<div class="col-md-12">
<h4>Beschlüsse des Bundestages in absoluten Zahlen</h4>
<hr>
</div>
</div>
<div class="row">
<div class="col-md-2">
<br>
<img src="${frontend_logos}icon_urn_pro.png"/>
</div>
<div class="col-md-10">
<font size="1">pro Stimmen</font>
<div class="progress">
<div class="progress-bar progress-bar-success" style="width: ${total_pro_percentage}%">${pro}</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<br>
<img src="${frontend_logos}icon_urn_con.png"/>
</div>
<div class="col-md-10">
<font size="1">contra Stimmen</font>
<div class="progress">
<div class="progress-bar progress-bar-danger" style="width: ${total_con_percentage}%">${con}</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<br>
<img src="${frontend_logos}icon_urn_ent.png"/>
</div>
<div class="col-md-10">
<font size="1">Enthaltungen</font>
<div class="progress">
<div class="progress-bar progress-bar-info" style="width: ${total_ent_percentage}%">${ent}</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<img src="${frontend_logos}icon_urn.png"/>
</div>
<div class="col-md-10">
<div class="progress">
<div class="progress-bar progress-bar" style="width: 100%">Total: ${total_total}</div>
</div>
</div>
</div>

View File

@ -214,7 +214,7 @@
<a data-toggle="collapse" data-parent="#acc_7" href="#acc_7_body">
<div style="width: 100%; height: 100%; padding: 10px;">
<h4 class="panel-title">
<span class="glyphicon glyphicon-list-alt"></span>&nbsp;&nbsp;&nbsp;Bilanz: Bundestag
<span class="glyphicon glyphicon-th-large"></span>&nbsp;&nbsp;&nbsp;Bilanz: Bundestag
</h4>
</div>
</a>
@ -290,7 +290,7 @@
<a data-toggle="collapse" data-parent="#acc_3" href="#acc_3_body">
<div style="width: 100%; height: 100%; padding: 10px;">
<h4 class="panel-title" style="">
<span class="glyphicon glyphicon-globe"></span>&nbsp;&nbsp;&nbsp;community Statistik
<span class="glyphicon glyphicon-globe"></span>&nbsp;&nbsp;&nbsp;community Daten
</h4>
</div>
</a>
@ -326,6 +326,7 @@
<div class="row">
<div class="col-md-8">
<h4>Übereinstimmung community und Fraktionen</h4>
<br>
${votes_all_to_bt}
</div>
<div class="col-md-4" style="font-size: 10pt; border-left: #d9edf7 solid 2px">
@ -339,7 +340,62 @@
</div>
</div>
</div>
<div class="row panel-group" id="acc_10" style="padding-top: 10px;">
<div class="panel panel-default panel-success">
<div class="panel-heading" style="padding: 0">
<a data-toggle="collapse" data-parent="#acc_10" href="#acc_10_body">
<div style="width: 100%; height: 100%; padding: 10px;">
<h4 class="panel-title" style="">
<span class="glyphicon glyphicon-tasks"></span>&nbsp;&nbsp;&nbsp;Bundestag Daten
</h4>
</div>
</a>
</div>
<div id="acc_10_body" class="panel-body panel-collapse collapse">
<div class="row">
<div class="col-md-8">
<h4></h4>
${bt_basic_stats}
</div>
<div class="col-md-4" style="font-size: 10pt; border-left: #d9edf7 solid 2px">
<h4><span class="glyphicon glyphicon-info-sign"></span></h4>
${analysis_help_bt_basic}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_bt_basic}
</div>
</div>
</div>
</div>
</div>
<div class="row panel-group" id="acc_11" style="padding-top: 10px;">
<div class="panel panel-default panel-warning">
<div class="panel-heading" style="padding: 0">
<a data-toggle="collapse" data-parent="#acc_11" href="#acc_11_body">
<div style="width: 100%; height: 100%; padding: 10px;">
<h4 class="panel-title" style="">
<span class="glyphicon glyphicon-th-large"></span>&nbsp;&nbsp;&nbsp;Bilanz: Bundestag & Fraktionen
</h4>
</div>
</a>
</div>
<div id="acc_11_body" class="panel-body panel-collapse collapse">
<div class="row">
<div class="col-md-8">
<h4>Übereinstimmung Bundestag und Fraktionen</h4>
${choices_bt}
</div>
<div class="col-md-4" style="font-size: 10pt; border-left: #d9edf7 solid 2px">
<h4><span class="glyphicon glyphicon-info-sign"></span></h4>
${analysis_help_choices_bt}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_choices_bt}
</div>
</div>
</div>
</div>
</div>
<!--<div id="graph_bt_user_overall" class="row"></div>

View File

@ -27,6 +27,10 @@ class user_main_analysis extends SYSTEM\PAGE\Page {
$vars['votes_all'] = bars::get_uvote_choice_overall();
$vars['votes_all_to_bt'] = bars::get_uvote_choice_overall_to_bt();
$vars['bt_basic_stats'] = bars::get_bt_choice_overall();
$vars['choices_bt'] = bars::get_bt_choice_overall_to_bt();
$vars['frontend_logos'] = './api.php?call=files&cat=frontend_logos&id=';
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('help'));

View File

@ -1,60 +1,99 @@
<div class="row">
<div class="col-md-4">
<div class="row">
<h4>${title}</h4>
${openvote_help_text}
${title} abstimmen.
<hr>
${vote_buttons}
<hr>
${voice_weight}
<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">Info</a>
</h4>
</div>
<div class="panel-body" id="poll_3_body">
<div class="row">
<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>
<hr>
<div class="row">
<div class="panel-group" id="poll_6">
<div class="panel panel-default panel-warning">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#poll_6" href="#poll_6_body">Statistik</a>
</h4>
</div>
<div class="panel-body panel-collapse" id="poll_6_body">
<div class="row">
<div class="panel-group" id="poll_1">
<div class="panel panel-default">
<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" id="poll_1_body">
<div class="panel-body panel-collapse collapse" id="poll_1_body">
${bars_user}<br>
${bars_bt}
</div>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="panel-group" id="poll_2">
<div class="panel panel-default">
<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" id="poll_2_body">
<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-6">
<div class="col-md-8">
<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">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;" id="iframe_">
<iframe src="${iframe_link}" width="730" height="4000"></iframe>
<iframe class="col-md-12" height="700" style="padding: 0; overflow-y: scroll;" src="${iframe_link}"></iframe>
</div>
</div>
</div>

View File

@ -7,5 +7,5 @@
<div class="progress-bar progress-bar-info" style="width: ${party_ent}%">${party_ent}%</div>
</div>
</div>
</div>
</div>
<hr>

View 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>&nbsp;&nbsp;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>&nbsp;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>&nbsp;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>

View 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>&nbsp;&nbsp;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>&nbsp;&nbsp;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>&nbsp;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>

View File

@ -20,13 +20,13 @@ class user_main_poll extends SYSTEM\PAGE\Page {
private function get_party_per_poll($choice){
switch($choice){
case 1:
return 'PRO';
return 'pro';
case 2:
return 'CON';
return 'con';
case 3:
return 'ENT';
return 'ent';
default:
return 'NONE';
return '';
}
}
@ -36,15 +36,16 @@ class user_main_poll extends SYSTEM\PAGE\Page {
// $vote['bt_vote_class'] = $this->tablerow_class($vote['bt_choice']);
foreach($party_votes as $pv){
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/vote_bt.tpl'),
array( 'party' => $pv['party'],
'choice' => $this->get_party_per_poll($pv['choice']),
'choice_class' => $this->tablerow_class($pv['choice']),
'party_yes' => $pv['votes_pro'] > 0 ? round($pv['votes_pro']/$pv['total']*100,0) : $pv['votes_pro'],
'party_no' => $pv['votes_contra'] > 0 ? round($pv['votes_contra']/$pv['total']*100,0) : $pv['votes_contra'],
'party_off' => $pv['total'] > 0 ? round(($pv['total'] - $pv['nr_attending'])/$pv['total']*100,0) : $pv['total'],
'party_ent' => $pv['nr_attending'] > 0 ? round(($pv['nr_attending'] - $pv['votes_pro'] - $pv['votes_contra'])/$pv['nr_attending']*100,0) : $pv['nr_attending']));
$vote = array( 'party' => $pv['party'],
'choice' => $this->get_party_per_poll($pv['choice']),
'choice_class' => $this->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;
}
@ -82,10 +83,10 @@ class user_main_poll extends SYSTEM\PAGE\Page {
private function bars_bt(){
$vars = votes::get_bar_bt_per_poll($this->poll_ID);
if (!$vars['bt_total']){
return 'Keine Ergebnisse für den Bundestag verfügbar';}
return 'Keine differenzierten Ergebnisse für den Bundestag verfügbar.';}
$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);
$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);
}
@ -111,43 +112,18 @@ class user_main_poll extends SYSTEM\PAGE\Page {
private function vote_buttons($poll_expired,$user_poll){
if($poll_expired){
if(!$user_poll){
return '<h5>Stimme hier ab</h5>
<button id="btnvote_yes" class="btn btn-success btn-default"
style="width: 90px"
poll_ID="${poll_ID}"><font
size="3">Pro</font></button>
<button id="btnvote_no" class="btn btn-danger btn-default"
style="width: 90px"
poll_ID="${poll_ID}"><font
size="3">Contra</font></button>
<button id="btnvote_off" class="btn btn-info btn-default"
style="width: 90px"
poll_ID="${poll_ID}"><font
size="3">Enthaltung</font></button>';}
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('btn-success disabled','btn-danger','btn-info'); break;
case 2: $classes = array('btn-success','btn-danger disabled','btn-info'); break;
case 3: $classes = array('btn-success','btn-danger','btn-info disabled'); break;
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('','','');
}
return ' <h5>Ändere deine Stimme hier ab</h5>
<button id="btnvote_yes" class="btn btn_vote '.$classes[0].' btn-default btnvote_yes"
style="width: 90px"
poll_ID="${poll_ID}"><font
size="3">Pro</font></button>
<button id="btnvote_no" class="btn btn_vote '.$classes[1].' btn-default btnvote_no"
style="width: 90px"
href="#"
poll_ID="${poll_ID}"><font
size="3">Contra</font></button>
<button id="btnvote_off" class="btn btn_vote '.$classes[2].' btn-default btnvote_off"
style="width: 90px"
href="#"
poll_ID="${poll_ID}"><font
size="3">Enthaltung</font></button>
';
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/vote_buttons.tpl'), $classes);
} else {
return 'ye soon to come infos';
}

View File

@ -7,10 +7,10 @@
</h4>
</div>
<div class="panel-body">
<div class="col-md-8">
${welcome_text}
<div class="col-md-6">
${welcome_text_loggedin}
</div>
<div class="col-md-4">
<div class="col-md-6">
<div class="row">
${user_temp_votes}
</div>

View File

@ -4,7 +4,7 @@ class user_main_start extends SYSTEM\PAGE\Page {
$vars = votes::get_user_count();
return $vars['count'];
}
public function newsfeed(){
public static function newsfeed(){
$result = '';
$vars = \SQL\UVOTE_DATA_NEWSFEED::QA(array());
foreach($vars as $news){

View File

@ -4,7 +4,6 @@
<h4 class="panel-title">
<span class="glyphicon glyphicon-th-list"></span>&nbsp;Hier gehts zur Abstimmung
<div style="float: right"><input type="text"</div>
</h4>
</div>
<div class="panel-body">

View File

@ -0,0 +1,11 @@
<?php
namespace SQL;
class UVOTE_DATA_BT_TO_PARTY_OVERALL extends \SYSTEM\DB\QQ {
public static function get_class(){return \get_class();}
public static function mysql(){return
'SELECT party, sum(case when uvote_votes.bt_choice = uvote_votes_per_party.choice then 1 else 0 end) class_MATCH,
sum(case when uvote_votes.bt_choice != uvote_votes_per_party.choice then 1 else 0 end) class_MISSMATCH
FROM uvote_votes INNER JOIN uvote_votes_per_party
ON uvote_votes.ID = uvote_votes_per_party.poll_ID GROUP BY party;'
;}}

View File

@ -4,5 +4,8 @@ namespace SQL;
class UVOTE_DATA_CHOICE_BT_OVERALL extends \SYSTEM\DB\QQ {
public static function get_class(){return \get_class();}
public static function mysql(){return
'SELECT COUNT(*) as "count", bt_choice FROM uvote_votes GROUP BY bt_choice;'
'SELECT SUM(IF(bt_choice = "1",1,0)) AS pro,
SUM(IF(bt_choice = "2",1,0)) AS con,
SUM(IF(bt_choice = "3",1,0)) AS ent
FROM `uvote_votes`;'
;}}