Merge branch 'master' of mojotrollz.eu:hosting

This commit is contained in:
Nael 2014-03-07 00:21:36 +01:00
commit 07c1b8cf70
5 changed files with 40 additions and 35 deletions

View File

@ -7,8 +7,8 @@ class votes {
$res = \DBD\UVOTE_DATA_GRAPH_BT_TO_UVOTE_OVERALL_BY_TIME::QQ(array($timespan));
while ($row = $res->next()){
$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));
'match' => $row['class_match'] > 0 ? round($row['class_match'] / ($row['class_match']+$row['class_mismatch']),2) : 0,
'mismatch' => $row['class_match'] > 0 ? round($row['class_mismatch'] / ($row['class_match']+$row['class_mismatch']),2) : 0);
}
return $returnasjson ? SYSTEM\LOG\JsonResult::toString($result) : $result;
}
@ -34,14 +34,14 @@ class votes {
public static function insertPartyChoice($poll_ID, $party, $votes_pro, $votes_contra, $nr_attending, $total, $choice){
return \DBD\UVOTE_GENERATE_VOTELIST::QI(array($poll_ID, $party, $votes_pro, $votes_contra, $nr_attending, $total, $choice));}
public static function getVoteOfGroup($poll_ID){
/*public static function getVoteOfGroup($poll_ID){
$con = new \SYSTEM\DB\Connection(new \DBD\uVote());
$res = $con->prepare( 'selVoteByGrp',
'SELECT * FROM `uvote_votes` WHERE `ID` = ? LIMIT 1;',
array($poll_ID));
$result = $res->next();
return $result;
}
}*/
public static function get_user_choice_per_poll($poll_ID, $user_ID){
return \DBD\UVOTE_DATA_USER_CHOICE_PER_POLL::Q1(array($poll_ID, $user_ID));
@ -142,6 +142,7 @@ class votes {
'SELECT * FROM `uvote_votes` WHERE `ID` = ?;',
array($poll_ID));
$res = $res->next();
$res['title'] = utf8_encode($res['title']);
return $res;
}
@ -193,7 +194,7 @@ class votes {
}
public static function open_vote($poll_ID){
$vote = votes::getVoteOfGroup($poll_ID);
$vote = self::get_voteinfo($poll_ID); //votes::getVoteOfGroup($poll_ID);
$result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/full_vote.tpl'), $vote);
return $result;
}

View File

@ -16,7 +16,7 @@ class default_page extends SYSTEM\PAGE\Page {
}
private function css(){
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_page\css\default_page.css').'" rel="stylesheet">';}
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_page/css/default_page.css').'" rel="stylesheet">';}
private function get_party_per_poll($choice){
switch($choice){
@ -86,7 +86,7 @@ class default_page extends SYSTEM\PAGE\Page {
$vote['bt'] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote_bt.tpl'),
array( 'party' => $pv['party'],
'choice' => $this->get_party_per_poll($pv['choice']),
'choice_class' => $this->tablerow_class($pv['choice'])));
'choice_class' => $this->badge_class($pv['choice'])));
}
//uvote vote

View File

@ -9,8 +9,8 @@ $(document).ready(function() {
$('.btn_vote').click(function () {
//vote_click($(this).attr('poll_ID'));
$('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID'));
open_vote($(this).attr('poll_ID'));
open_vote($(this).attr('poll_ID'));
register_registerform();
});
@ -53,22 +53,7 @@ $(document).ready(function() {
});
$('#user_main').load('./?action=user_main', function(){
$("#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();
}
});
register_registerform();
$('#feedback_submit').click(function (data){
var test = $('textarea#feedback_text').val();
send_feedback(test);
@ -85,6 +70,24 @@ $(document).ready(function() {
});
function register_registerform(){
$("#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 drawChart(){
//load_visualisation('#graph_bt_uv_overall',84600);
}
@ -146,7 +149,7 @@ function vote_click (poll_ID, vote) {
if(data.status == true){
alert("success");
$('#user_main').load('./?action=open_bulletin&poll_ID=' + poll_ID, function(){
open_vote(poll_ID);
open_vote(poll_ID);
});
} else {
alert(data.result.message);
@ -196,7 +199,7 @@ function open_vote (poll_ID) {
$('#test').click(function(){
$('#myModal').modal();
});
register_registerform();
});
}
@ -266,8 +269,9 @@ function load_visualisation(id, timespan){
data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));});
console.log(data);
var options = {title: id, aggregationTarget: 'category', selectionMode: 'multiple', curveType: 'function', /*focusTarget: 'category',*/ chartArea:{}, vAxis:{logScale: false}, interpolateNulls: false, width: "300", height: "250"};
new google.visualization.LineChart(document.getElementById(id)).draw(data, options);
var options = {title: 'Übereinstimmung uVote Community/Bundestag', aggregationTarget: 'category', selectionMode: 'multiple', /*curveType: 'function',*/ /*focusTarget: 'category',*/ chartArea:{}, vAxis:{format:'#%', logScale: false}, interpolateNulls: false, width: "300", height: "250"};
//LineChart
new google.visualization.ColumnChart(document.getElementById(id)).draw(data, options);
});
}
function load_visualisation_urvote(id, timespan){

View File

@ -7,7 +7,7 @@ class page_uvote extends \SYSTEM\API\api_default {
public static function action_open_bulletin ($poll_ID){
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
return new default_register ($poll_ID);}
return new default_register ();}
return new default_bulletin($poll_ID);}
public static function action_user_main(){

View File

@ -31,8 +31,8 @@
<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>
<div style="clear: both; height: 50px;"></div>
<div>
<span class="badge badge-info">${user_count}</span> Nutzer auf uVote
</div>