new order

This commit is contained in:
Naeltard 2015-10-02 19:37:06 +02:00
parent 373fff9853
commit 14c7691cd9
19 changed files with 286 additions and 80 deletions

View File

@ -193,11 +193,12 @@ class default_bulletin extends SYSTEM\PAGE\Page {
}
private function js(){
return '<script src="'.SYSTEM\WEBPATH(new PPAGE(),'default_bulletin/js/vote.js').'"></script>';}
return \SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin/js/vote.js'));}
private function css(){
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_bulletin\css\bars_user.css').'" rel="stylesheet">'.
'<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_bulletin\css\bulletin.css').'" rel="stylesheet">'.
'<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_bulletin\css\comment.css').'" rel="stylesheet">';}
return \SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\bars_user.css')).
\SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\bulletin.css')).
\SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\comment.css'));
}

View File

@ -1,7 +1,7 @@
<h5>${bulletin_bars_title}</h5>
${urvote_bars_user}
<div class="progress" id="progress_bars_user">
<div class="bar bar-success" style="width: ${vote_yes_perc}%;">${vote_yes_perc}%</div>
<div class="bar bar-danger" style="width: ${vote_no_perc}%;">${vote_no_perc}%</div>
<div class="bar bar-info" style="width: ${vote_ent_perc}%;">${vote_ent_perc}%</div>
<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>

View File

@ -1,8 +1 @@
<h5>${urvote_party_table_desc}</h5>
<div style="width: 500px;">
<div style="float: left"><img src="${frontend_logos}icon_urn.png" width="30"/></div>
<div style="float: left"></div>
<div style="margin-left: 50px; float: left"><img src="${frontend_logos}icon_urn_pro.png" width="30"/></div>
<div style="margin-left: 15px; float: left"><img src="${frontend_logos}icon_urn_con.png" width="30"/></div>
<div style="margin-left: 15px; float: left"><img src="${frontend_logos}icon_urn_ent.png" width="30"/></div>
</div>

View File

@ -1,6 +1,6 @@
Ergebnis Bundestag
<div class="progress" style="height: 20px; width: 350px;">
<div class="bar bar-success" style="width: ${bt_pro}%;">${bt_pro}%</div>
<div class="bar bar-danger" style="width: ${bt_con}%;">${bt_con}%</div>
<div class="bar bar-info" style="width: ${bt_ent}%;"><p>${bt_ent}%</p></div>
<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>

View File

@ -1,6 +1,12 @@
<div style="width: 50px; height: 20px; float: right; margin-right: 10px;">
<div class="badge badge-success" style="">${party_yes}%</div>
<div class="badge badge-danger" style="">${party_no}%</div>
<div class="badge badge-info" style="">${party_ent}%</div>
<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>

View File

@ -1,8 +1,8 @@
<div style="width: 500px; float: left">
<div style="float: left"><img src="${frontend_logos}icon_${party}.png" width="30"></div>
<div style="margin-left: 5px; width: 20px; float: left"class="badge ${choice_class}">${choice}</div>
<div style="margin-left: 5px; width: 20px; float: left"class="badge badge-success">${party_yes}%</div>
<div style="margin-left: 5px; width: 20px; float: left"class="badge badge-important">${party_no}%</div>
<div style="margin-left: 5px; width: 20px; float: left"class="badge badge-info">${party_ent}%</div>
<div style="margin-left: 5px; width: 20px; float: left"class="badge ">${party_off}%</div>
<div style="width: 500px; height: 20px; float: left">
<div style="float: left"><img class="img-responsive" src="${frontend_logos}icon_${party}.png" width="30"></div>
<div style="margin-left: 5px; width: 40px; float: left" class="badge ${choice_class}">${choice}</div>
<div style="margin-left: 5px; width: 40px; float: left" class="badge badge-success">${party_yes}%</div>
<div style="margin-left: 5px; width: 40px; float: left" class="badge badge-error">${party_no}%</div>
<div style="margin-left: 5px; width: 40px; float: left" class="badge badge-info">${party_ent}%</div>
<div style="margin-left: 5px; width: 40px; float: left" class="badge ">${party_off}%</div>
</div>

View File

@ -38,7 +38,7 @@ function register_logout(){
function load_openvoteinfo (poll_ID){
var openvoteinfo;
$.get('./index.php?action=openinfo&poll_ID=' + poll_ID, function (data) {
$.get('./api.php?page=openinfo&poll_ID=' + poll_ID, function (data) {
openvoteinfo = data;
bodyelem = $("");
bodyelem.animate();
@ -62,7 +62,7 @@ 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) {
$.getJSON('./api.php?call=vote&page=vote&poll_ID=' + poll_ID + '&vote=' + vote, function(data) {
var items = [];
if(data.status == true){
alert("success");

View File

@ -34,11 +34,23 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="row" id="site-content">
<div class="row" id="user_main"></div>
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav" id="tabs_user_main">
<li class="active"><a href="#!start(user_main(u))">Abstimmen</a></li>
<li><a href="#!start(user_main(ur))">Auswerten</a></li>
<li><a href="#!start(user_main(my))">Mithelfen</a></li>
<li><a data-toggle="modal" class="brand" href="#impressum" id="impressum"><font size="2">Impressum</font></a></li>
</ul>
${loginform}
</div>
</div>
</nav>
<div class="row" id="site-content">
<div class="row" id="user_main"></div>
</div>
</div>
</body>
</html>

View File

@ -2,7 +2,7 @@
<div id="vote_sub1">
<h5>${title}</h5>
<img src="${frontend_logos}icon_urn_${vote_class}.png">
<a class="btn btn-primary btn-small btn_vote" poll_ID="${ID}">${full_vote_btn}</a>
<a href="#!start(poll);poll.${ID}" class="btn btn-primary btn-small" poll_ID="${ID}">${full_vote_btn}</a>
<a class="btn btn-primary btn-small btn_fade" poll_ID="${ID}">${fade}</a>
</div>

View File

@ -29,7 +29,7 @@ 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 default_bulletin($poll_ID))->html();}
return (new user_main_poll($poll_ID))->html();}
public static function page_user_list(){
return (new user_list())->html();}

View File

@ -1,2 +1,10 @@
<div class="row">
<div class="col-md-12">
${welcome_text}
<span class="badge badge-info">${user_count}</span> Nutzer auf uVote
</div>
</div>
${votelist}

View File

@ -39,7 +39,10 @@ class user_list_active extends SYSTEM\PAGE\Page {
return '';
}
}
private function user_count(){
$vars = votes::get_user_count();
return $vars['count'];
}
public function generate_votelist(){
$result = array('','');
$votes = votes::getAllVotesOfGroup(1);
@ -98,6 +101,7 @@ class user_list_active extends SYSTEM\PAGE\Page {
$vars = array();
$vars['votelist'] = $this->generate_votelist();
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=files&cat=frontend_logos&id=';
$vars['user_count'] = $this->user_count();
$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_list_active/tpl/active.tpl'), $vars);

View File

@ -1,5 +1,12 @@
function init_user_main(){
register_registerform();
//vote_click($(this).attr('poll_ID'));
//$('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID'));
//open_vote($(this).attr('poll_ID'));
//register_registerform();
$('#feedback_submit').click(function (data){
var test = $('textarea#feedback_text').val();
send_feedback(test);

View File

@ -1,45 +1,9 @@
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav" id="tabs_user_main">
<li class="active"><a href="#!start(user_main(u))">Abstimmen</a></li>
<li><a href="#!start(user_main(ur))">Auswerten</a></li>
<li><a href="#!start(user_main(my))">Mithelfen</a></li>
<li><a data-toggle="modal" class="brand" href="#impressum" id="impressum"><font size="2">Impressum</font></a></li>
</ul>
${loginform}
</div>
<!--<div class="navbar-inner">-->
<!-- <ul class="nav navbar-nav">
<li><a class="brand" href="" id="menu_uvote">uVote</a></li>
<li><a data-toggle="modal" class="brand" href="#impressum" id="impressum"><font size="2">impressum</font></a></li>
</ul> -->
<!--</div> -->
</div>
</nav>
<div class="tabbable" id="tabbable_main_menu">
<div class="tab-content">
<div class="tab-pane active" id="tab_main"></div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse_feedback">Feedback</a>
</h4>
</div>
<div id="collapse_feedback" class="panel-collapse collapse in">
<div class="panel-body">
<form>
<br /><img src="${frontend_logos}logo2.png" width="180"/>
<h4>uVote BETA Feedback</h4>
<textarea id="feedback_text">Sag uns was dich stört!</textarea>
<br />
<input type="submit" id="feedback_submit" />
</form>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,13 @@
function init_user_main_poll(){
$('.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);
});
}

View File

@ -1,8 +1,28 @@
<div class="row">
<div class="col-md-4">
<h4>${title}</h4>
${openvote_help_text}
${title}
${openvote_help_text1}
${vote_buttons}
${voice_weight}
</div>
<div class="col-md-4">
${bars_user}<br>
${bars_bt}
</div>
<div class="col-md-4">
${icons_party}
${choice_party}
</div>
</div>
<div class="row">
<div class="span6">
<div class="row" style="text-align: center;">
Quelle: <a href="${iframe_link}">${iframe_link} </a>
</div>
<div class="span6" id="iframe_">
<div class="row" style="text-align: center;" id="iframe_">
<iframe src="${iframe_link}" width="730" height="4000"></iframe>
</div>
</div>

View File

@ -4,9 +4,187 @@ class user_main_poll extends SYSTEM\PAGE\Page {
public function __construct($poll_ID){
$this->poll_ID = $poll_ID;
}
private static function tablerow_class($choice){
switch($choice){
case 1:
return 'pro';
case 2:
return 'con';
case 3:
return 'ent';
default:
return 'open';
}
}
private function get_party_per_poll($choice){
switch($choice){
case 1:
return 'PRO';
case 2:
return 'CON';
case 3:
return 'ENT';
default:
return 'NONE';
}
}
private function choice_party (){
$result = '';
$party_votes = votes::get_barsperparty($this->poll_ID);
// $vote['bt_vote_class'] = $this->tablerow_class($vote['bt_choice']);
foreach($party_votes as $pv){
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/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']));
}
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(),'default_bulletin/tpl/bars_user.tpl'),$bars);
}
private function bars_party(){
$partyvotes = votes::get_barsperparty($this->poll_ID);
$result = "";
foreach($partyvotes as $vote){
$vote['party_yes'] = $vote['votes_pro'] > 0 ? round($vote['votes_pro']/$vote['total']*100,0) : $vote['votes_pro'];
$vote['party_no'] = $vote['votes_contra'] > 0 ? round($vote['votes_contra']/$vote['total']*100,0) : $vote['votes_contra'];
$vote['party_ent'] = $vote['nr_attending'] > 0 ? round(($vote['nr_attending'] - $vote['votes_pro'] - $vote['votes_contra'])/$vote['total']*100,0) : $vote['nr_attending'];
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/table_parties.tpl'), $vote);
}
return $result;
}
private function icons_party(){
$vars = votes::get_bar_bt_per_poll($this->poll_ID);
if (!$vars['bt_total']){
return '';}
$info = array();
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/icons_table_parties.tpl'), $info);
}
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';}
$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(),'default_bulletin/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(),'default_bulletin/tpl/voteweight.tpl'), $vars);
}
private function p_fields (){
$result = "";
$list = array (array(1, 'Aussenpolitik'),
array(2, 'Aussenpolitik'),
array(4, 'Aussenpolitik'),
array(8, 'Aussenpolitik'));
foreach($list as $l){
if($p_fields & $l[0]) $result .= $l[1];
}
return $result;
}
private function vote_buttons($poll_expired,$user_poll){
if($poll_expired){
if(!$user_poll){
return '<h5>Stimme hier ab</h5>
<a class="btn btn_vote btn-success btn-default btnvote_yes"
style="width: 70px"
poll_ID="${poll_ID}"><font
size="3">Pro</font></a>
<a class="btn btn_vote btn-danger btn-default btnvote_no"
style="width: 70px"
href="#"
poll_ID="${poll_ID}"><font
size="3">Contra</font></a>
<a class="btn btn_vote btn-info btn-default btnvote_off"
style="width: 70px"
href="#"
poll_ID="${poll_ID}"><font
size="3">Enthaltung</font></a>';}
$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;
default: array('','','');
}
return ' <h5>Ändere deine Stimme hier ab</h5>
<a class="btn btn_vote '.$classes[0].' btn-default btnvote_yes"
style="width: 70px"
poll_ID="${poll_ID}"><font
size="3">Pro</font></a>
<a class="btn btn_vote '.$classes[1].' btn-default btnvote_no"
style="width: 70px"
href="#"
poll_ID="${poll_ID}"><font
size="3">Contra</font></a>
<a class="btn btn_vote '.$classes[2].' btn-default btnvote_off"
style="width: 70px"
href="#"
poll_ID="${poll_ID}"><font
size="3">Enthaltung</font></a>
';
} else {
return 'ye soon to come infos';
}
}
private function get_voteinfo(){
$var = votes::get_voteinfo($this->poll_ID);
return $var['iframe_link'];
}
private function js(){
return \SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin/js/vote.js'));}
private function css(){
return \SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\bars_user.css')).
\SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\bulletin.css')).
\SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\comment.css'));
}
public function html(){
$vote = votes::get_voteinfo($this->poll_ID); //votes::getVoteOfGroup($poll_ID);
$result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/full_vote.tpl'), $vote);
$poll_expired = \SQL\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID));
$user_vote = votes::getUserPollData($this->poll_ID);
$vars = array();
$vars = array_merge($vars,votes::get_voteinfo($this->poll_ID));
//$vars['comments_pro'] = $this->get_pro_comments();
//$vars['comments_con'] = $this->get_con_comments();
$vars['icons_party'] = $this->icons_party();
$vars['choice_party'] = $this->choice_party();
$vars['bars_party'] = $this->bars_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/tpl/full_vote.tpl'), $vars);
return $result;
}

View File

@ -4,5 +4,5 @@ namespace SQL;
class UVOTE_GENERATE_VOTELIST extends \SYSTEM\DB\QP {
public static function get_class(){return \get_class();}
public static function mysql(){return
'SELECT * FROM `uvote_votes` WHERE `group` = ? AND time_end > NOW() ORDER BY (time_end-time_start) ASC;'
'SELECT * FROM `uvote_votes` WHERE `group` = ? ORDER BY (time_end-time_start) ASC;'
;}}

View File

@ -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` = ? AND time_end > CURDATE();'
'SELECT * FROM `uvote_votes` WHERE `ID` = ?;'
;}}