almost there

This commit is contained in:
Naeltard 2015-10-15 02:26:40 +02:00
parent e794356a60
commit 3adfdc6704
20 changed files with 290 additions and 154 deletions

View File

@ -8,6 +8,24 @@ class bars{
$vars['user_total_ent_percentage'] = round($vars['user_total_ent']/$vars['user_total_total']*100+1);
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/user_total.tpl'),$vars);
}
public static function get_uvote_choice_overall(){
$vars = \SQL\UVOTE_DATA_CHOICE_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/uvote_total.tpl'),$vars);
}
public static function get_uvote_choice_overall_to_bt(){
$result = '';
$vars = \SQL\UVOTE_DATA_UVOTE_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));
@ -26,7 +44,7 @@ class bars{
$res2 = votes::vote_accord_with_party($row['party']);
$row['according_laws'] = self::build_according_law_html($res2, $row['party']);
$row['match_percentage'] = round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH'])*100,2);
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/urvoteparties.tpl'), $row);;
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/urvoteparties.tpl'), $row);
}
return $result;
}

View File

@ -16,10 +16,15 @@ class graphs {
public static function graph_bt_to_user_overall_by_time ($timespan = 84600,$returnasjson = true){
$result = array();
$res = \SQL\UVOTE_DATA_GRAPH_BT_TO_USER_OVERALL_BY_TIME::QQ(array($timespan, \SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->id));
$matchhandler = 0;
$missmatchhandler = 0;
while ($row = $res->next()){
$match = $row['class_match']+$matchhandler;
$missmatch = $row['class_mismatch']+$missmatchhandler;
$result[] = array( 0 => $row['day'],
'class_match' => $row['class_match'] / ($row['class_match']+$row['class_mismatch']+1),
'class_mismatch' => $row['class_mismatch'] / ($row['class_match']+$row['class_mismatch']+1));
'class_match' => ($match) / ($match+$missmatch)*100);
$matchhandler = $match;
$missmatchhandler = $missmatch;
}
return $returnasjson ? SYSTEM\LOG\JsonResult::toString($result) : $result;
}

View File

@ -80,8 +80,8 @@ class votes {
$v = $vars['voted'] > 1 ? $vars['voted'] : 1;
$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+1), 2),
'no_vote_percent'=> round($nv/(($nv+$v)*100+1), 2),
array( 'vote_percent'=> round($v/($nv+$v)*100, 2),
'no_vote_percent'=> round($nv/($nv+$v)*100, 2),
'voted'=> $v,
'not_voted'=> $nv));}

View File

@ -1,8 +1,8 @@
<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(u))"><span class="glyphicon glyphicon-edit"></span>&nbsp;Abstimmen</a></li>
<li><a href="#!start(user_main(ur))"><span class="glyphicon glyphicon-stats"></span>&nbsp;Auswerten</a></li>
<li class="active"><a href="#!start"><span class="glyphicon glyphicon-home"></span>&nbsp;Start</a></li>
<li><a href="#!list"><span class="glyphicon glyphicon-edit"></span>&nbsp;Abstimmen</a></li>
<li><a href="#!analysis"><span class="glyphicon glyphicon-stats"></span>&nbsp;Auswerten</a></li>
<!--<li><a href="#!start(user_main(my))"><span class="glyphicon glyphicon-cog"></span>&nbsp;Mithelfen</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>

View File

@ -60,15 +60,16 @@ function load_visualisation_urvote(id, timespan){
first = true;
data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));});
var options = {title: id,
aggregationTarget: 'category',
var options = {title: 'Übereinstimmung mit dem Bundestag',
aggregationTarget: 'category',
selectionMode: 'multiple',
legend: 'none',
curveType: 'function', /*focusTarget: 'category',*/ chartArea:{},
vAxis:{logScale: false},
legend: 'none',
interpolateNulls: false,
width: "800",
chartArea:{},
// vAxis:{logScale: false},
vAxis: {viewWindow: {min: 0, max: 100}},
lineWidth: 7,
interpolateNulls: false,
width: "800",
height: "250"};
new google.visualization.LineChart(document.getElementById(id)).draw(data, options);
});

View File

@ -7,9 +7,16 @@
</h4>
</div>
<div class="panel-body" id="acc_1_body">
<div class="col-md-12">
<div class="col-md-8">
${urvote_body_text}
</div>
<div class="col-md-4" style="border-left: #d9edf7 solid 2px">
${urvote_info_info_1}
<span class="glyphicon glyphicon-info-sign"></span>
${urvote_info_info_2}
<span class="glyphicon glyphicon-certificate"></span>
${urvote_info_info_3}
</div>
</div>
</div>
</div>
@ -30,7 +37,7 @@
<div class="col-md-8">
${basic_stats}
</div>
<div class="col-md-4" style="font-size: 10pt;">
<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_basic_stats}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
@ -44,7 +51,7 @@
<br>
<div>${user_overall_votes}</div>
</div>
<div class="col-md-4" style="font-size: 10pt;">
<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_basic_votes}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
@ -70,12 +77,13 @@
<div class="row">
<div class="col-md-8">
<h4>Absolute Übereinstimmungsrate</h4>
<font size="1">auf %Angabe clicken für Details</font>
<hr>
<font size="1">auf ? clicken für Details</font>
<br>
<br>
${choices_user_ID}
</div>
<div class="col-md-4" style="font-size: 10pt;">
<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_user_to_party_overall}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
@ -86,9 +94,10 @@
<div class="row" style="padding-top: 20px;">
<div class="col-md-8">
<h4>Relative Übereinstimmung</h4>
<hr>
<div id="donut_user_to_party_overall" class="row" style="padding: 0; margin: 0;"></div>
</div>
<div class="col-md-4" style="font-size: 10pt;">
<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_party_donut}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
@ -116,41 +125,89 @@
<h5>Übereinstimmung der pro Stimmen</h5>
${choices_user_ID_per_party_pro}
</div>
<div class="col-md-4" style="font-size: 10pt;">
<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_uservera_to_party_pro}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_uservera_to_party_pro}
</div>
</div>
<hr>
<div class="row" style="padding-top: 20px;">
<div class="col-md-8">
<img class="img-responsive" src="${frontend_logos}icon_urn_con.png"/>
<h5>Übereinstimmung der contra Stimmen</h5>
${choices_user_ID_per_party_con}
</div>
<div class="col-md-4" style="font-size: 10pt;">
<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_user_to_party_overall_by_vote_pro}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_user_to_party_overall_by_vote_pro}
${analysis_help_uservera_to_party_con}
</div>
</div>
<hr>
<div class="row" style="padding-top: 20px;">
<div class="col-md-8">
<img class="img-responsive" src="${frontend_logos}icon_urn_ent.png"/>
<h5>Übereinstimmung der Enthaltungen</h5>
${choices_user_ID_per_party_ent}
</div>
<div class="col-md-4" style="font-size: 10pt;">
${analysis_help_user_to_party_overall_by_vote_pro}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_user_to_party_overall_by_vote_pro}
<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_uservera_to_party_ent}
</div>
</div>
</div>
</div>
</div>
<div class="row panel-group" id="acc_6" style="padding-top: 10px;">
<div class="panel panel-default panel-danger">
<div class="panel-heading" style="padding: 0">
<a data-toggle="collapse" data-parent="#acc_6" href="#acc_6_body">
<div style="width: 100%; height: 100%; padding: 10px;">
<h4 class="panel-title">
<span class="glyphicon glyphicon-random"></span>&nbsp;&nbsp;&nbsp;Entwicklung: Fraktionen
</h4>
</div>
</a>
</div>
<div id="acc_6_body" class="panel-body panel-collapse collapse">
<div class="row">
<div class="col-md-9">
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_cdu.png"/>
</div>
<div id="graph_user_to_party_overall_cdu" class="row"></div>
<hr>
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_csu.png"/>
</div>
<div id="graph_user_to_party_overall_csu" class="row"></div>
<hr>
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_spd.png"/>
</div>
<div id="graph_user_to_party_overall_spd" class="row"></div>
<hr>
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_gruene.png"/>
</div>
<div id="graph_user_to_party_overall_gruene" class="row"></div>
<hr>
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_linke.png"/>
</div>
<div id="graph_user_to_party_overall_linke" class="row"></div>
</div>
<div class="col-md-3" style="font-size: 10pt; border-left: #d9edf7 solid 2px">
<h4><span class="glyphicon glyphicon-info-sign"></span></h4>
${analysis_help_overtime_party}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_overtime_party}
</div>
</div>
</div>
</div>
</div>
<div class="panel-group row" id="acc_7" style="padding-top: 10px;">
<div class="panel panel-default panel-warning">
<div class="panel-heading" style="padding: 0">
@ -168,8 +225,11 @@
Bundestag gesamt
${choices_bt_to_user}
</div>
<div class="col-md-4">
<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}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_bt}
</div>
</div>
<hr>
@ -181,7 +241,11 @@
${choices_user_ID_per_bt_con}
${choices_user_ID_per_bt_ent}
</div>
<div class="col-md-4">
<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_by_vote}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_bt_by_vote}
</div>
</div>
</div>
@ -189,45 +253,7 @@
</div>
<div class="row panel-group" id="acc_6" style="padding-top: 10px;">
<div class="panel panel-default panel-danger">
<div class="panel-heading" style="padding: 0">
<a data-toggle="collapse" data-parent="#acc_6" href="#acc_6_body">
<div style="width: 100%; height: 100%; padding: 10px;">
<h4 class="panel-title">
<span class="glyphicon glyphicon-random"></span>&nbsp;&nbsp;&nbsp;Entwicklung: Fraktionen
</h4>
</div>
</a>
</div>
<div id="acc_6_body" class="panel-body panel-collapse collapse">
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_cdu.png"/>
</div>
<div id="graph_user_to_party_overall_cdu" class="row"></div>
<hr>
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_csu.png"/>
</div>
<div id="graph_user_to_party_overall_csu" class="row"></div>
<hr>
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_spd.png"/>
</div>
<div id="graph_user_to_party_overall_spd" class="row"></div>
<hr>
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_gruene.png"/>
</div>
<div id="graph_user_to_party_overall_gruene" class="row"></div>
<hr>
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_linke.png"/>
</div>
<div id="graph_user_to_party_overall_linke" class="row"></div>
</div>
</div>
</div>
<div class="row panel-group" id="acc_8" style="padding-top: 10px;">
<div class="panel panel-default panel-danger">
<div class="panel-heading" style="padding: 0">
@ -241,43 +267,75 @@
</div>
<div id="acc_8_body" class="panel-body panel-collapse collapse">
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_bt.png"/>
</div>
<div id="graph_user_to_party_overall_bt" class="row"></div>
<div class="col-md-9">
<div class="row">
<img class="img-responsive" src="${frontend_logos}icon_bt.png"/>
</div>
<div id="graph_user_to_party_overall_bt" class="row"></div>
</div>
<div class="col-md-3" style="font-size: 10pt; border-left: #d9edf7 solid 2px">
<h4><span class="glyphicon glyphicon-info-sign"></span></h4>
${analysis_help_overtime_bt}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_overtime_bt}
</div>
<hr>
</div>
</div>
</div>
</div>
<div class="row panel-group" id="acc_3" style="padding-top: 10px;">
<div class="panel panel-default panel-primary">
<div class="panel panel-default panel-success">
<div class="panel-heading" style="padding: 0">
<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="color: white">
<h4 class="panel-title" style="">
<span class="glyphicon glyphicon-globe"></span>&nbsp;&nbsp;&nbsp;community Statistik
</h4>
</div>
</a>
</div>
<div id="acc_3_body" class="panel-body panel-collapse collapse">
<div class="col-md-6">
<h5>Entscheidungsverhalten der uVote Community</h5>
<span style="">
<div class="row">
<div class="col-md-8">
<h4>Entscheidungsverhalten der uVote Community</h4>
${votes_all}
</span>
<span style=""> Wie oft die uVote Community
<br> insgesamt Dafür, Dagegen oder
<br> Enthaltung gestimmt hat.</span>
</div>
<div class="col-md-6">
<h5>Entscheidungsverhalten des Bundestags</h5>
<span style="">
${votes_all_bt}
</span>
<span style=""> Wie oft der Bundestag
<br> Dafür, Dagegen oder
<br> Enthaltung gestimmt hat.</span>
</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_community}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_community}
</div>
</div>
</div>
</div>
</div>
<div class="row panel-group" id="acc_9" 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_9" href="#acc_9_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: community & Fraktionen
</h4>
</div>
</a>
</div>
<div id="acc_9_body" class="panel-body panel-collapse collapse">
<div class="row">
<div class="col-md-8">
<h4>Übereinstimmung community und Fraktionen</h4>
${votes_all_to_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_community_to_fr}
<h4><span class="glyphicon glyphicon-certificate"></span></h4>
${analysis_math_community_to_fr}
</div>
</div>
</div>
</div>
</div>

View File

@ -1,6 +1,7 @@
<div class="row">
<div class="col-md-12">
<h4>Deine Stimmverteilung</h4>
<hr>
</div>
</div>
<div class="row">
@ -35,7 +36,6 @@
<div class="col-md-10">
<font size="1">Enthaltungen</font>
<div class="progress">
<br>
<div class="progress-bar progress-bar-info" style="width: ${user_total_ent_percentage}%">${user_total_ent}</div>
</div>
</div>

View File

@ -0,0 +1,52 @@
<div class="row">
<div class="col-md-12">
<h5>Absolute Stimmen der Community</h5>
<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

@ -0,0 +1,26 @@
<div class="row">
<div class="col-md-2">
<img src="${frontend_logos}icon_${party}.png"/>
</div>
<div class="col-md-9">
<div class="progress">
<div class="progress-bar" style="width: ${match_percentage}%;"><a style="text-decoration: none; color: white;" class="urvoteparties_uvote_popover" data-content="${according_laws}">${match_percentage}%</a></div>
</div>
</div>
<!--<td><span class="badge badge-success">${class_MATCH}</span></td>
<td><span class="badge badge-important">${class_MISSMATCH}</span></td>
<td><span class="badge">
<a class="urvoteparties_uvote_popover" data-content="${according_laws}">${match_percentage}%</a>
</span>
</td>
</tr>-->
<div class="col-md-1 urvoteparties_uvote_popover" data-content="${according_laws}">
<span class="glyphicon glyphicon-question-sign"></span>
</div>
</div>
<script>
$(function (){ $(".urvoteparties_uvote_popover").popover({html: true});
});
</script>

View File

@ -1,55 +1,5 @@
<?php
class user_main_analysis extends SYSTEM\PAGE\Page {
private function votes_all(){
$votes = votes::get_all_votes();
$result = '';
foreach($votes as $vote){
switch($vote['choice']){
case 1:
$vote['choice'] = 'PRO';
$vote['badge_color'] = 'badge-success';
break;
case 2:
$vote['choice'] = 'CON';
$vote['badge_color'] = 'badge-alert';
break;
case 3:
$vote['choice'] = 'ENT';
$vote['badge_color'] = 'badge-info';
break;
}
//$vote['count'];
//$vote['choice'];
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/votecountchoice.tpl'),$vote);
}
return $result;
}
private function votes_all_bt(){
$votes = votes::get_all_votes_bt();
$result = '';
foreach($votes as $vote){
switch($vote['bt_choice']){
case 1:
$vote['bt_choice'] = 'PRO';
$vote['badge_color'] = 'badge-success';
break;
case 2:
$vote['bt_choice'] = 'CON';
$vote['badge_color'] = 'badge-alert';
break;
case 3:
$vote['bt_choice'] = 'ENT';
$vote['badge_color'] = 'badge-info';
break;
case 0:
$vote['bt_choice'] = 'OFFEN';
}
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/votecountchoicebt.tpl'),$vote);
}
return $result;
}
class user_main_analysis extends SYSTEM\PAGE\Page {
public static function js(){
return array(\SYSTEM\WEBPATH(new \PPAGE(),'user_main_analysis/js/user_main_analysis.js'));}
public function html(){
@ -75,8 +25,8 @@ class user_main_analysis extends SYSTEM\PAGE\Page {
$vars['choices_user_ID_per_bt_ent'] = bars::user_per_bt_by_choicetype('3');
$vars['votes_all'] = $this->votes_all();
$vars['votes_all_bt'] = $this->votes_all_bt();
$vars['votes_all'] = bars::get_uvote_choice_overall();
$vars['votes_all_to_bt'] = bars::get_uvote_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

@ -0,0 +1 @@
{$text}

View File

@ -0,0 +1 @@
${news}

View File

@ -37,8 +37,8 @@
News
</h4>
</div>
<div class="panel-body">
<div class="panel-body" style="padding-left: 50px; padding-right: 50px;">
${news}
</div>
</div>
</div>

View File

@ -4,6 +4,14 @@ class user_main_start extends SYSTEM\PAGE\Page {
$vars = votes::get_user_count();
return $vars['count'];
}
public function newsfeed(){
$result = '';
$vars = \SQL\UVOTE_DATA_NEWSFEED::QA(array());
foreach($vars as $news){
$result .= $news['text'];
}
return $result;
}
public function html(){
@ -11,6 +19,7 @@ class user_main_start extends SYSTEM\PAGE\Page {
$vars['frontend_logos'] = './api.php?call=files&cat=frontend_logos&id=';
$vars['user_count'] = $this->user_count();
$vars['user_temp_votes'] = votes::get_user_temp_votes();
$vars['news'] = $this->newsfeed();
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_start/tpl/user_main_start.tpl'), $vars);

View File

@ -3,9 +3,12 @@
<div class="panel-heading">
<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">
${votelist}
</div>
</div>

View File

@ -4,14 +4,14 @@ class user_main_votelist extends SYSTEM\PAGE\Page {
$vars = votes::get_user_count();
return $vars['count'];
}
public function html(){
$vars = array();
$vars['votelist'] = lists::generate_votelist();
$vars['frontend_logos'] = './api.php?call=files&cat=frontend_logos&id=';
$vars['user_count'] = $this->user_count();
$vars['user_temp_votes'] = votes::get_user_temp_votes();
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_votelist/tpl/user_main_votelist.tpl'), $vars);

View File

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

View File

@ -5,7 +5,7 @@ class UVOTE_DATA_GRAPH_BT_TO_USER_OVERALL_BY_TIME extends \SYSTEM\DB\QP {
public static function get_class(){return \get_class();}
public static function mysql(){return
'SELECT
DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(a.`timestamp`) - MOD(UNIX_TIMESTAMP(a.`timestamp`),?)),"%Y/%m/%d %H:%i:%s") as day,
DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(c.`time_end`) - MOD(UNIX_TIMESTAMP(c.`time_end`),?)),"%Y/%m/%d") as day,
SUM(CASE WHEN a.choice = c.bt_choice THEN 1 ELSE 0 END) class_match,
SUM(CASE WHEN a.choice = c.bt_choice THEN 0 ELSE 1 END) class_mismatch
FROM uvote_data as a

View File

@ -5,12 +5,13 @@ class UVOTE_DATA_GRAPH_PARTY_TO_USER_OVERALL_BY_TIME extends \SYSTEM\DB\QP {
public static function get_class(){return \get_class();}
public static function mysql(){return
'SELECT
DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(a.`timestamp`) - MOD(UNIX_TIMESTAMP(a.`timestamp`),?)),"%Y/%m/%d %H:%i:%s") as day,
DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP(d.`time_end`) - MOD(UNIX_TIMESTAMP(d.`time_end`), ?)),"%Y/%m/%d") as day,
SUM(CASE WHEN a.choice = c.choice THEN 1 ELSE 0 END) class_match,
SUM(CASE WHEN a.choice = c.choice THEN 0 ELSE 1 END) class_mismatch
FROM uvote_data as a
LEFT JOIN (Select choice, poll_ID FROM uvote_data WHERE user_ID = ? GROUP BY choice LIMIT 1) b ON a.poll_ID = b.poll_ID
LEFT JOIN uvote_votes_per_party as c ON a.poll_ID = c.poll_ID
LEFT JOIN uvote_votes as d ON a.poll_ID = d.ID
WHERE c.party = ? AND user_ID = ?
GROUP BY day;'
;}}

View File

@ -0,0 +1,8 @@
<?php
namespace SQL;
class UVOTE_DATA_NEWSFEED extends \SYSTEM\DB\QQ {
public static function get_class(){return \get_class();}
public static function mysql(){return
'SELECT * FROM system_text_tag LEFT JOIN system_text ON system_text.id = system_text_tag.id WHERE system_text_tag.tag = "news" ORDER BY time_create DESC LIMIT 7;'
;}}