stats voteweight,

stats users,
new style for vote.tpl
This commit is contained in:
Nael 2014-02-24 15:27:55 +01:00
parent fbcde01b67
commit c52b4c86d2
11 changed files with 69 additions and 13 deletions

View File

@ -83,6 +83,12 @@ class votes {
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_user_count(){
return \DBD\UVOTE_DATA_USER_COUNT_USERS::Q1(array());}
public static function get_count_user_votes_per_poll($poll_ID){
return \DBD\UVOTE_DATA_USER_COUNT_CHOICE_PER_POLL::Q1(array($poll_ID));}
public static function get_user_per_party_overall($user_ID){
return \DBD\UVOTE_DATA_USER_PER_PARTY_OVERALL::QA(array($user_ID));
}

View File

@ -0,0 +1,11 @@
<?php
namespace DBD;
class UVOTE_DATA_USER_COUNT_CHOICE_PER_POLL extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'',
//mys
'SELECT COUNT(*) AS count FROM uvote_data WHERE `poll_ID` = ?;'
);}}

View File

@ -0,0 +1,11 @@
<?php
namespace DBD;
class UVOTE_DATA_USER_COUNT_USERS extends \SYSTEM\DB\QQ {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'',
//mys
'SELECT COUNT(*) AS count FROM system_user;'
);}}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -2,6 +2,9 @@
<div>
${bars_user}
</div>
<div>
${voice_weight}
</div>
<div>
<h4>Ergebnis Bundestag</h4>
${bars_bt}
@ -16,6 +19,6 @@
<div style="float: left;">
${vote_buttons}
</div>
<div style="clear: both"></div>

View File

@ -38,6 +38,12 @@ class default_bulletin extends SYSTEM\PAGE\Page {
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/table_bt.tpl'), $vars);
}
private function voice_weight(){
$vars = votes::get_count_user_votes_per_poll($this->poll_ID);
$vars['voteweight'] = 1/$vars['count']*100;
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/voteweight.tpl'), $vars);;
}
private function vote_buttons($poll_expired){
$user_poll = votes::getUserPollData($this->poll_ID);
if($poll_expired){
@ -105,6 +111,7 @@ class default_bulletin extends SYSTEM\PAGE\Page {
$vars['css'] = $this->css();
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
$vars ['vote_buttons'] = $this->vote_buttons($poll_expired);
$vars['voice_weight'] = $this->voice_weight();
$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);

View File

@ -0,0 +1,4 @@
<div style="margin-top: 20px;">
Dein aktuelles Stimmgewicht bei dieser Abstimmung:
<span class="badge badge-info">${voteweight}%</span>
</div>

View File

@ -1,25 +1,27 @@
<table style="margin-bottom: 5px; width: 95%; height: 100px; border: solid lightgray 1px; background: beige;">
<tr>
<tr>
<td class="${vote_class}" style="width: 10px; margin-top: 10px; border-left: 1px solid lightgray;">
</td>
<td style="padding: 5px;">
<h4>${title}</h4>
Nr.${ID}
<a class="btn btn-primary btn-small btn_vote" style="float:right" poll_ID="${ID}">${full_vote_btn}</a>
<a class="btn btn-primary btn-small btn_vote" style="" poll_ID="${ID}">${full_vote_btn}</a>
</td>
<td class="${bt_vote_class}" style="width: 80px; margin-top: 10px; border-left: 1px solid lightgray;">
<img src="${frontend_logos}icon_bt.png" width="80"/>
<img src="${frontend_logos}icon_cdu.png" width="30"/><span class="badge ${choice_class_cdu}" style="float:right;">${cdu}</span><br/>
<img src="${frontend_logos}icon_csu.png" width="30"/><span class="badge ${choice_class_csu}" style="float:right;">${csu}</span><br/>
<img src="${frontend_logos}icon_spd.png" width="30"/><span class="badge ${choice_class_spd}" style="float:right;">${spd}</span><br/>
<img src="${frontend_logos}icon_gruene.png" width="30"/><span class="badge ${choice_class_gruene}" style="float:right;">${gruene}</span><br/>
<img src="${frontend_logos}icon_linke.png" width="30"/><span class="badge ${choice_class_linke}" style="float:right;">${linke}</span>
</td>
<td class="${uv_vote_class}" style="width: 30px; margin-top: 10px; border-left: 1px solid lightgray;">
uv
<span class="badge badge-success" style="float:right;">${uv_pro}</span>
<span class="badge badge-important" style="float:right;">${uv_con}</span>
<span class="badge" style="float:right;">${uv_ent}</span>
</td>
<td class="${vote_class}" style="width: 20px; margin-top: 10px; border-left: 1px solid lightgray;">
<td class="${uv_vote_class}" style="width: 35px; height: 100%; border-left: 1px solid lightgray;">
<img src="${frontend_logos}icon_urn.png" width="25"/>
<span class="badge badge-success" style="">${uv_pro}</span>
<span class="badge badge-important" style="">${uv_con}</span>
<span class="badge" style="">${uv_ent}</span>
</td>
<td style="margin: 0; padding: 0; width: 3px;" >
<table class="poll_time" time="${time_end}" style="width: 100%; height: 100%; margin: 0; padding: 0;">
<tr id="time_done" style="height: ${time_done}%; background: white; margin: 0; padding: 0;"><td style="width: 1px; margin: 0; padding: 0;"></td></tr>

View File

@ -15,5 +15,10 @@
</span>
<span style=""> Wie oft der Bundestag
<br> Dafür, Dagegen oder
<br> Enthaltung gestimmt hat.</span>
</div>
<br> Enthaltung gestimmt hat.</span>
</div>
<div style="clear: both; height: 50px;">
</div>
<div>
<span class="badge badge-info">${user_count}</span> Nutzer auf uVote
</div>

View File

@ -46,10 +46,17 @@ class user_main_uVote extends SYSTEM\PAGE\Page {
return $result;
}
private function user_count(){
$vars = votes::get_user_count();
return $vars['count'];
}
public function html(){
$vars = array();
$vars['votes_all'] = $this->votes_all();
$vars['votes_all_bt'] = $this->votes_all_bt();
$vars['user_count'] = $this->user_count();
$vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE));
$vars = array_merge($vars, \SYSTEM\locale::getStrings(150));
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uVote.tpl'),$vars);