diff --git a/uvote/api/votes/bars.php b/uvote/api/votes/bars.php index 3755b42..4c7cc3d 100644 --- a/uvote/api/votes/bars.php +++ b/uvote/api/votes/bars.php @@ -49,7 +49,7 @@ class bars{ sum(case when uvote_data.choice != uvote_votes_per_party.choice then 1 else 0 end) class_MISSMATCH FROM uvote_data INNER JOIN uvote_votes_per_party ON uvote_data.poll_ID = uvote_votes_per_party.poll_ID - WHERE user_ID = ? AND uvote_data.choice = ? GROUP BY party;', + WHERE user_ID = ? AND uvote_votes_per_party.choice = ? GROUP BY party;', array(\SYSTEM\SECURITY\Security::getUser()->id, $choice)); $i = 0; while($row = $res->next()){ @@ -87,7 +87,7 @@ class bars{ sum(case when uvote_data.choice != uvote_votes.bt_choice then 1 else 0 end) class_MISSMATCH FROM uvote_data INNER JOIN uvote_votes ON uvote_data.poll_ID = uvote_votes.ID - WHERE user_ID = ? AND uvote_data.choice = ? GROUP by user_ID;', + WHERE user_ID = ? AND uvote_votes.bt_choice = ? GROUP by user_ID;', array(\SYSTEM\SECURITY\Security::getUser()->id, $choice)); $i = 0; diff --git a/uvote/api/votes/graphs.php b/uvote/api/votes/graphs.php index 12f2815..3032ebf 100644 --- a/uvote/api/votes/graphs.php +++ b/uvote/api/votes/graphs.php @@ -37,7 +37,7 @@ class graphs { public static function donut_party_to_user_overall ($returnasjson = true){ $result = array(); - $res = \SQL\UVOTE_DATA_USER_TO_PARTIES_OVERALL::QQ(array(13)); + $res = \SQL\UVOTE_DATA_USER_TO_PARTIES_OVERALL::QQ(array(\SYSTEM\SECURITY\Security::getUser()->id)); while ($row = $res->next()){ $result[] = array( 0 => $row['party'], 'class_match' => $row['class_MATCH']); diff --git a/uvote/page/default_page/js/loadtexts.js b/uvote/page/default_page/js/loadtexts.js index 99dc6d1..82396d4 100644 --- a/uvote/page/default_page/js/loadtexts.js +++ b/uvote/page/default_page/js/loadtexts.js @@ -144,7 +144,7 @@ function send_feedback (feedback) { var val = JSON.stringify(feedback); console.log("feedback called"); $.ajax({ - url: 'http://mojotrollz.eu/web/uVote/api.php', + url: './api.php', // contentType : "application/json; charset=utf-8", data : { 'call': 'vote', @@ -224,155 +224,3 @@ function loadApiPic(id) { }); } -function load_visualisation(id, timespan){ - $('img#loader').show(); - $.getJSON('./api.php?call=graph_bt_to_uvote_overall_by_time',function(json){ - if(!json || json.status != true || !json.result){ - $('img#loader').hide(); - return; - } - json = json.result; - $('img#loader').hide(); - var data = new google.visualization.DataTable(); - first = true; - $.each(json[0], function(key, value){ - if(first){ - data.addColumn('datetime',key); - first = false; - } else { - data.addColumn('number',key); - } - }); - $.each(json, function(key, value){ - first = true; - data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));}); - - console.log(data); - 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){ - $('img#loader').show(); - $.getJSON('./api.php?call=graph_bt_to_user_overall_by_time',function(json){ - if(!json || json.status != true || !json.result){ - $('img#loader').hide(); - return; - } - json = json.result; - $('img#loader').hide(); - var data = new google.visualization.DataTable(); - first = true; - $.each(json[0], function(key, value){ - if(first){ - data.addColumn('datetime',key); - first = false; - } else { - data.addColumn('number',key); - } - }); - $.each(json, function(key, value){ - 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', 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); - }); -} - -function load_visualisation_user_to_party_overall(id, party, timespan){ - $('img#loader').show(); - $.getJSON('./api.php?call=graph_party_to_user_overall_by_time&party=' + party,function(json){ - if(!json || json.status != true || !json.result){ - $('img#loader').hide(); - return; - } - json = json.result; - $('img#loader').hide(); - var data = new google.visualization.DataTable(); - first = true; - $.each(json[0], function(key, value){ - if(first){ - data.addColumn('datetime',key); - first = false; - } else { - data.addColumn('number',key); - } - }); - $.each(json, function(key, value){ - first = true; - data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));}); - - - var options = { title: 'Übereinstimmung mit ' + party, - aggregationTarget: 'category', - selectionMode: 'multiple', - legend: 'none', - 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); - }); -} -function load_visualisation_user_to_parties_overall(id, timespan){ - $('img#loader').show(); - $.getJSON('./api.php?call=donut_party_to_user_overall',function(json){ - if(!json || json.status != true || !json.result){ - $('img#loader').hide(); - return; - } - json = json.result; - $('img#loader').hide(); - var data = new google.visualization.DataTable(); - console.log(json); - first = true; - $.each(json[0], function(key, value){ - if(first){ - data.addColumn('string',key); - first = false; - } else { - data.addColumn('number',key); - } - }); - $.each(json, function(key, value){ - first = true; - data.addRow($.map(value, function(v) { if(first){first=false;return v;}else{return [parseFloat(v)];}}));}); - var options = { title: 'Übereinstimmung mit den Fraktionen relativ zueinander', - titleTextStyle: {fontSize: 14, bold: 0, italic: 0}, - pieSliceText: 'label', - legend: 'none', - colors: ['#000736', '#0022FF', '#33FF00', '#D2067A', '#F20101'], - pieHole: '0.4', - chartArea:{}, - width: "500", - height: "400"}; - new google.visualization.PieChart(document.getElementById(id)).draw(data, options); - }); -} -function load_visualisation_user(id, timespan){ -google.load("visualization", "1", {packages:["corechart"]}); - google.setOnLoadCallback(drawChart); - function drawChart() { - var data = google.visualization.arrayToDataTable([ - ['Task', 'Hours per Day'], - ['Work', 11], - ['Eat', 2], - ['Commute', 2], - ['Watch TV', 2], - ['Sleep', 7] - ]); - - var options = { - title: 'My Daily Activities', - pieHole: 0.4, - }; - - var chart = new google.visualization.PieChart(document.getElementById('donutchart')); - chart.draw(data, options); - } - } \ No newline at end of file diff --git a/uvote/page/user_main_analysis/js/user_main_analysis.js b/uvote/page/user_main_analysis/js/user_main_analysis.js index d83dc9e..dfed045 100644 --- a/uvote/page/user_main_analysis/js/user_main_analysis.js +++ b/uvote/page/user_main_analysis/js/user_main_analysis.js @@ -1,5 +1,139 @@ function init_user_main_analysis(){ +load_visualisation_user_to_party_overall('graph_user_to_party_overall_cdu', 'cdu', 84600); +load_visualisation_user_to_party_overall('graph_user_to_party_overall_csu', 'csu', 84600); +load_visualisation_user_to_party_overall('graph_user_to_party_overall_spd', 'spd', 84600); +load_visualisation_user_to_party_overall('graph_user_to_party_overall_gruene', 'gruene', 84600); +load_visualisation_user_to_party_overall('graph_user_to_party_overall_linke', 'linke', 84600); +load_visualisation_user_to_parties_overall('donut_user_to_party_overall', 84600); +} +function load_visualisation(id, timespan){ + $('img#loader').show(); + $.getJSON('./api.php?call=graph_bt_to_uvote_overall_by_time',function(json){ + if(!json || json.status != true || !json.result){ + $('img#loader').hide(); + return; + } + json = json.result; + $('img#loader').hide(); + var data = new google.visualization.DataTable(); + first = true; + $.each(json[0], function(key, value){ + if(first){ + data.addColumn('datetime',key); + first = false; + } else { + data.addColumn('number',key); + } + }); + $.each(json, function(key, value){ + first = true; + data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));}); + + 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){ + $('img#loader').show(); + $.getJSON('./api.php?call=graph_bt_to_user_overall_by_time',function(json){ + if(!json || json.status != true || !json.result){ + $('img#loader').hide(); + return; + } + json = json.result; + $('img#loader').hide(); + var data = new google.visualization.DataTable(); + first = true; + $.each(json[0], function(key, value){ + if(first){ + data.addColumn('datetime',key); + first = false; + } else { + data.addColumn('number',key); + } + }); + $.each(json, function(key, value){ + 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', 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); + }); +} + +function load_visualisation_user_to_party_overall(id, party, timespan){ + $('img#loader').show(); + $.getJSON('./api.php?call=graph_party_to_user_overall_by_time&party=' + party,function(json){ + if(!json || json.status != true || !json.result){ + $('img#loader').hide(); + return; + } + json = json.result; + $('img#loader').hide(); + var data = new google.visualization.DataTable(); + first = true; + $.each(json[0], function(key, value){ + if(first){ + data.addColumn('datetime',key); + first = false; + } else { + data.addColumn('number',key); + } + }); + $.each(json, function(key, value){ + first = true; + data.addRow($.map(value, function(v) { if(first){first=false;return [new Date(v)];}else{return [parseFloat(v)];}}));}); + + + var options = { title: 'Übereinstimmung mit ' + party, + aggregationTarget: 'category', + selectionMode: 'multiple', + legend: 'none', + 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); + }); +} +function load_visualisation_user_to_parties_overall(id, timespan){ + $('img#loader').show(); + $.getJSON('./api.php?call=donut_party_to_user_overall',function(json){ + if(!json || json.status != true || !json.result){ + $('img#loader').hide(); + return; + } + json = json.result; + $('img#loader').hide(); + var data = new google.visualization.DataTable(); + first = true; + $.each(json[0], function(key, value){ + if(first){ + data.addColumn('string',key); + first = false; + } else { + data.addColumn('number',key); + } + }); + $.each(json, function(key, value){ + first = true; + data.addRow($.map(value, function(v) { if(first){first=false;return v;}else{return [parseFloat(v)];}}));}); + var options = { title: 'Übereinstimmung mit den Fraktionen relativ zueinander', + titleTextStyle: {fontSize: 14, bold: 0, italic: 0}, + pieSliceText: 'label', + legend: 'none', + colors: ['#000736', '#0022FF', '#33FF00', '#D2067A', '#F20101'], + pieHole: '0.4', + chartArea:{}, + width: "500", + height: "400"}; + new google.visualization.PieChart(document.getElementById(id)).draw(data, options); + }); } \ No newline at end of file diff --git a/uvote/page/user_main_analysis/tpl/user_main_analysis.tpl b/uvote/page/user_main_analysis/tpl/user_main_analysis.tpl index fcd08ae..610f073 100644 --- a/uvote/page/user_main_analysis/tpl/user_main_analysis.tpl +++ b/uvote/page/user_main_analysis/tpl/user_main_analysis.tpl @@ -25,13 +25,23 @@
${basic_stats}
- +
+ ${analysis_help_basic stats} + ${analysis_math_basic stats} +
+ +
${user_temp_votes}

${user_overall_votes}
+
+ ${analysis_help_basic_votes} + ${analysis_math_basic votes} +
+ @@ -52,14 +62,23 @@
${choices_user_ID} +
+ ${analysis_help_user_to_party_overall} + ${analysis_math_user_to_party_overall} +
+ +
- - -
+
+
+ ${analysis_help_user_to_party_overall_donut} + ${analysis_math_user_to_party_overall_donut} +
+
@@ -67,24 +86,40 @@    Bilanz: Fraktionen nach Stimmverhalten
-
-
+
+
+
Übereinstimmung der pro Stimmen
${choices_user_ID_per_party_pro}
- -
+
+ ${analysis_help_user_to_party_overall_by_vote_pro} + ${analysis_math_user_to_party_overall_by_vote_pro} +
+
+
+
Übereinstimmung der contra Stimmen
${choices_user_ID_per_party_con}
- -
+
+ ${analysis_help_user_to_party_overall_by_vote_pro} + ${analysis_math_user_to_party_overall_by_vote_pro} +
+
+
+
Übereinstimmung der Enthaltungen
${choices_user_ID_per_party_ent}
+
+ ${analysis_help_user_to_party_overall_by_vote_pro} + ${analysis_math_user_to_party_overall_by_vote_pro} +
+
@@ -100,6 +135,7 @@ Bundestag gesamt ${choices_bt_to_user}
+
Übereinstimmung mit dem Bundestag @@ -181,12 +217,6 @@ - - - - - - diff --git a/uvote/sai/saimod_uvote_vote_edit/main.tpl b/uvote/sai/saimod_uvote_vote_edit/main.tpl index c7c8cca..80e4490 100644 --- a/uvote/sai/saimod_uvote_vote_edit/main.tpl +++ b/uvote/sai/saimod_uvote_vote_edit/main.tpl @@ -1,27 +1,16 @@
- - - + +

poll start

- - 00:00 + - 00:00

poll end

- - 00:00 -
-Submit + - 00:00 +

tags

+

-

BT DATEN

- -
- - - - - - -
-Submit +Submit
\ No newline at end of file diff --git a/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.js b/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.js index 069cefd..d8e3945 100644 --- a/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.js +++ b/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.js @@ -1,44 +1,20 @@ function init_saimod_uvote_vote_edit(){ - - $('.btn_editvote').click(function() { - alert (''); - var poll_ID = $('#input_poll_title').attr('poll_ID'); - var title = $('#input_poll_title').val(); - var iframe_link = $('#input_poll_link').val(); - vote_data_edit(poll_ID, title, iframe_link); - - - -// var data = new Array(); -// alert("bla") -// $.ajax({ -// url: SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_uvote_vote_edit&action='+ vote, -// contentType : "application/json; charset=utf-8", -// vote : JSON.stringify({ -// sai_mod: 'saimod_uvote_vote_edit', -// action: 'new_vote', -// json: data, -// }), -// dataType : 'json', -// type : 'POST' , -// success: function(vote) { -// alert("success"); -// }}); -// alert("js läuft"); - })}; +$('.bt_data_submit').click(function() { + var poll_ID = $(this).attr('poll_ID'); + var title = $('#' + poll_ID + '_vote_title').val(); + var time_start = $('#' + poll_ID + '_time_start').val(); + var iframe_link = $('#' + poll_ID + '_iframe_link').val(); + var data = {poll_ID: poll_ID, title: title, iframe_link: iframe_link} + $.getJSON('./sai.php?sai_mod=.SAI.saimod_uvote_vote_edit&action=edit_vote&data=' + JSON.stringify(data), function(data) { + var items = []; + if(data.status == true){ + alert("success"); + } else { + alert(data.result.message); + } + }); + }); +}; - -function vote_data_edit (poll_ID, title, iframe_link) { - alert('vote_data_edit'); - - $.getJSON('./api.php?call=vote&action=new_vote&poll_ID=' + poll_ID + '&title=' + title + '&iframe_link=' + iframe_link, function(data) { - var items = []; - if(data.status == true){ - alert("success"); - } else { - alert(data.result.message); - } - }); -} diff --git a/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.php b/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.php index ebde3e6..888d080 100644 --- a/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.php +++ b/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.php @@ -16,10 +16,8 @@ class saimod_uvote_vote_edit extends \SYSTEM\SAI\SaiModule { } public static function sai_mod_saimod_uvote_new_vote(){ - $result = ''; - $vote = array(); - $result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_uvote_vote_edit/vote.tpl'), $vote); - + + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_uvote_vote_edit/main.tpl')); } @@ -38,10 +36,9 @@ class saimod_uvote_vote_edit extends \SYSTEM\SAI\SaiModule { $vote['bt_vote_class'] = self::tablerow_class($vote['bt_choice']); $vote['time_left'] = round($time_remain/($time_span+1)*100,0); $vote['time_done'] = 100-$vote['time_left']; - $vote['new_vote'] = self::sai_mod_saimod_uvote_new_vote(); - $result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_uvote_vote_edit/vote.tpl'), $vote); + + $result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_uvote_vote_edit/main.tpl'), $vote); } - return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \PSAI(),'saimod_uvote_vote_edit/saimod_uvote_vote_edit.tpl'), array('list' => $result)); } @@ -57,13 +54,16 @@ class saimod_uvote_vote_edit extends \SYSTEM\SAI\SaiModule { return ''; } } - + public static function sai_mod__SAI_saimod_uvote_vote_edit_action_edit_vote($data){ + $data = \json_decode($data); + new \SYSTEM\LOG\WARNING(print_r($data, TRUE)); + } public static function html_li_menu(){return '
  • Edit Votes
  • ';} public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} - public static function sai_mod_saimod_uvote_vote_edit_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array( - \SYSTEM\WEBPATH(new PSAI(),'saimod_uvote_vote_edit/saimod_uvote_vote_edit.js') - ));} - public static function sai_mod_saimod_uvote_vote_edit_flag_css(){return \SYSTEM\LOG\JsonResult::toString(array() + public static function js(){return array( + \SYSTEM\WEBPATH(new \PSAI(),'saimod_uvote_vote_edit/saimod_uvote_vote_edit.js') );} + public static function css(){return array() + ;} } \ No newline at end of file diff --git a/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.tpl b/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.tpl index d37ceab..7d78a7a 100644 --- a/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.tpl +++ b/uvote/sai/saimod_uvote_vote_edit/saimod_uvote_vote_edit.tpl @@ -1,4 +1,3 @@ -${new_vote} ${list}
    \ No newline at end of file diff --git a/uvote/sai/saimod_uvote_vote_edit/vote.tpl b/uvote/sai/saimod_uvote_vote_edit/vote.tpl index 906565b..cce4f0d 100644 --- a/uvote/sai/saimod_uvote_vote_edit/vote.tpl +++ b/uvote/sai/saimod_uvote_vote_edit/vote.tpl @@ -1,48 +1,71 @@ - - - - - - +
    +
    + + +
    +
    Nr.${ID} - - +
    +
    Edit - - - cdu - 123 - 123 - 123
    - csu123 - 123 - 123 - 123
    - spd123 - 123 - 123 - 123
    - grüne123 - 123 - 123 - 123
    - linke123 - 123 - 123 - 123
    - - +
    +
    +
    +
    + cdu +
    +
    + +
    +
    +
    +
    + csu +
    +
    + +
    +
    +
    +
    + spd +
    +
    + +
    +
    +
    +
    + grüne +
    +
    + +
    +
    +
    +
    + linke +
    +
    + +
    +
    +
    +
    uv - 123 - 123 - 123 - - - - - - - +
    + 123 +
    + 123 +
    + 123 + +
    +
    + + \ No newline at end of file