minor statistic changes

new glyphicons
slim list
This commit is contained in:
Naeltard 2015-10-13 21:10:39 +02:00
parent 5a912b558f
commit e794356a60
9 changed files with 24 additions and 52 deletions

View File

@ -37,7 +37,6 @@ class bars{
$result .= $p['title']."<hr>";
}
$result .= "</font><hr><button id='close_popup' type='button' class='btn btn-primary'>schließen</button></div>";
new INFO($result);
return $result;
}
public static function user_per_party_by_choicetype($choice){

View File

@ -6,48 +6,19 @@ class lists{
foreach($votes as $vote){
$time_remain = strtotime($vote['time_end'])- microtime(true);
$time_span = strtotime($vote['time_end']) - strtotime($vote['time_start']);
$vote_count = votes::get_count_user_votes_per_poll($vote['ID']);
// $vote['title'] = utf8_encode($vote['title']);
$vote_count = votes::get_count_user_votes_per_poll($vote['ID']);
$vote['time_left'] = round($time_remain/($time_span+1)*100,0);
$vote['time_done'] = 100-$vote['time_left'];
$vote['full_vote_btn'] = $time_remain > 0 ? 'Abstimmen' : 'Ansehen';
$vote['uv'] = $vote['bt'] = '';
$vote['uv_count'] = $vote_count['count'] > 4 ? $vote_count['count'] : '< 5';
$user_vote = votes::getUserPollData($vote['ID']);
$vote['vote_class'] = switchers::tablerow_class($user_vote);
if($user_vote){
//user vote
$vote['vote_class'] = switchers::tablerow_class($user_vote);
//bt vote
$party_votes = votes::get_barsperparty($vote['ID']);
$vote['bt_vote_class'] = switchers::tablerow_class($vote['bt_choice']);
foreach($party_votes as $pv){
$vote['bt'] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_votelist/tpl/vote_bt.tpl'),
array( 'party' => $pv['party'],
'choice' => switchers::get_party_per_poll($pv['choice']),
'choice_class' => switchers::badge_class($pv['choice'])));
}
//uvote vote
$uvote = votes::get_users_choice_per_poll($vote['ID']);
$vote['uv_vote_class'] = count($uvote) > 0 ? switchers::tablerow_class($uvote[0]['choice']) : '';
foreach($uvote as $v){
$vote['uv'] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/vote_uv.tpl'),
array( 'badge' => switchers::badge_class($v['choice']),
'perc' => $v['count'] > 0 ? round($v['count']/$vote_count['count']*100, 2) : 0));
}
}
//new panels:
$vote['panel_class'] = switchers::panel_class($user_vote);
if($time_remain > 0){
if($time_remain > 0){
$vote['statusmarker'] = 'aktuell';
$result[0] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_votelist/tpl/vote.tpl'), $vote);
} else {
$vote['statusmarker'] = 'vergangen';
$result[1] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_votelist/tpl/vote.tpl'), $vote);
}
}

View File

@ -77,12 +77,11 @@ 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'];
$v = $vars['voted'] > 1 ? $vars['voted'] : 1;
$nv = $vars['not_voted'];
print_r($vars, true);
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/all_polls.tpl'),
array( 'vote_perc'=> round($v/(($nv+$v)*100+1), 2),
'no_vote_perc'=> round($nv/(($nv+$v)*100+1), 2),
array( 'vote_percent'=> round($v/(($nv+$v)*100+1), 2),
'no_vote_percent'=> round($nv/(($nv+$v)*100+1), 2),
'voted'=> $v,
'not_voted'=> $nv));}

View File

@ -7,8 +7,7 @@
<div class="col-md-12">
<font size="2">Teilnahme an aktuellen Abstimmungen</font>
<div class="progress">
<div class="progress-bar" style="width: ${vote_perc}%;">${vote_perc}%</div>
<div class="bar bar-info" style="width: 100%;"></div>
<div class="progress-bar" style="width: ${vote_percent}%;">${vote_percent}%</div>
</div>
<div style="">
<font size="1">Teilgenommen: ${voted}, nicht Teilgenommen: ${not_voted}</font>

View File

@ -3,14 +3,15 @@
<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}">Abstimmen</a>
<a href="#!start(poll);poll.${ID}" class="btn btn-primary btn-small" poll_ID="${ID}"><span class="glyphicon glyphicon-eye-open"></span>&nbsp;&nbsp;Abstimmen</a>
</div>
<div class="col-md-9">
<div class="col-md-8">
${title}
</div>
</div>
<div class="col-md-1">
<span class="glyphicon glyphicon-info-sign"></span>
${statusmarker}
</div>
</div>
<hr>

View File

@ -27,7 +27,7 @@
<input type="text" id="${ID}_time_end" value="${time_end}"/> - 00:00
<h4>bt choice</h4>
<input type="text" id="${ID}_bt_choice" value="${bt_choice}"/><br><br>
<a id="${ID}_data_submit" class="btn btn-primary bt_data_submit" poll_ID="${ID}">Submit</a>
<a id="${ID}_data_edit" class="btn btn-primary bt_data_edit" poll_ID="${ID}">Submit</a>
</div>
</div>
<hr>

View File

@ -4,8 +4,9 @@ $('.bt_data_submit').click(function() {
var title = $('#' + poll_ID + '_vote_title').val();
var time_end = $('#' + poll_ID + '_time_end').val();
var iframe_link = $('#' + poll_ID + '_iframe_link').val();
var bt_choice = $('#' + poll_ID + '_bt_choice').val();
var tags = JSON.stringify($('#' + poll_ID + '_tags').val().split(',').map(function(s) { return s.trim() }));
var data = {poll_ID: poll_ID, title: title, time_end: time_end, iframe_link: iframe_link};
var data = {poll_ID: poll_ID, title: title, time_end: time_end, iframe_link: iframe_link, bt_choice: bt_choice};
$.getJSON('./sai.php?sai_mod=.SAI.saimod_uvote_vote_edit&action=edit_vote&data=' + JSON.stringify(data) + '&tags=' + tags, function(data) {
var items = [];
if(data.status == true){
@ -15,8 +16,8 @@ $('.bt_data_submit').click(function() {
}
});
});
};
$('.bt_partydata_submit').click(function() {
$('.bt_partydata_submit').click(function() {
var poll_ID = $(this).attr('poll_ID');
var party = $('#input_party').val();
var votes_pro = $('#input_pro').val();
@ -34,6 +35,8 @@ $('.bt_partydata_submit').click(function() {
}
});
});
};

View File

@ -54,7 +54,7 @@ class saimod_uvote_vote_edit extends \SYSTEM\SAI\SaiModule {
\SYSTEM\PAGE\text::save($data['title'], $data['title'], 'deDE', $tags, 'blanc');
return \SQL\UVOTE_DATA_NEW_POLL::QA(array($data['title'], $data['time_end'], $data['iframe_link']));
}
return \SQL\UVOTE_DATA_EDIT_POLL::QA(array($data['poll_ID'], $data['title'], $data['time_end'], $data['iframe_link']));
return \SQL\UVOTE_DATA_EDIT_POLL::QA(array($data['poll_ID'], $data['title'], $data['time_end'], $data['iframe_link'], $data['bt_choice']));
}
public static function sai_mod__SAI_saimod_uvote_vote_edit_action_edit_partydata($data_json){

View File

@ -10,5 +10,5 @@ SUM(CASE WHEN user_ID = ? THEN 1 ELSE 0 END) as voted,
SUM(CASE WHEN user_ID is NULL THEN 1 ELSE 0 END) AS not_voted
FROM uvote_votes
LEFT JOIN (SELECT * FROM uvote_data WHERE uvote_data.user_ID = ?) as uvdata
ON uvdata.poll_ID = uvote_votes.ID'
ON uvdata.poll_ID = uvote_votes.ID WHERE uvote_votes.time_end > NOW();'
;}}