diff --git a/uvote/api/votes/bars.php b/uvote/api/votes/bars.php index 1838b0e..2f17e25 100644 --- a/uvote/api/votes/bars.php +++ b/uvote/api/votes/bars.php @@ -3,9 +3,9 @@ class bars{ public static function get_user_choice_overall($user_ID){ $vars = \SQL\UVOTE_DATA_USER_CHOICE_OVERALL::Q1(array($user_ID)); $vars['user_total_total'] = $vars['user_total_pro'] + $vars['user_total_con'] + $vars['user_total_ent']; - $vars['user_total_pro_percentage'] = round($vars['user_total_pro']/$vars['user_total_total']*100+1); - $vars['user_total_con_percentage'] = round($vars['user_total_con']/$vars['user_total_total']*100+1); - $vars['user_total_ent_percentage'] = round($vars['user_total_ent']/$vars['user_total_total']*100+1); + $vars['user_total_pro_percentage'] = $vars['user_total_total'] > 0 ? round($vars['user_total_pro']/$vars['user_total_total']*100) : 0; + $vars['user_total_con_percentage'] = $vars['user_total_total'] > 0 ? round($vars['user_total_con']/$vars['user_total_total']*100) : 0; + $vars['user_total_ent_percentage'] = $vars['user_total_total'] > 0 ? round($vars['user_total_ent']/$vars['user_total_total']*100) : 0; return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/user_total.tpl'),$vars); } public static function get_uvote_choice_overall(){ @@ -17,6 +17,15 @@ class bars{ new SYSTEM\LOG\INFO($vars['total_ent_percentage']); return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/uvote_total.tpl'),$vars); } + public static function get_bt_choice_overall(){ + $vars = \SQL\UVOTE_DATA_CHOICE_BT_OVERALL::Q1(array()); + $vars['total_total'] = $vars['pro'] + $vars['con'] + $vars['ent']; + $vars['total_pro_percentage'] = round($vars['pro']/$vars['total_total']*100+1); + $vars['total_con_percentage'] = round($vars['con']/$vars['total_total']*100+1); + $vars['total_ent_percentage'] = round($vars['ent']/$vars['total_total']*100+1); + new SYSTEM\LOG\INFO($vars['total_ent_percentage']); + return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/bt_total.tpl'),$vars); + } public static function get_uvote_choice_overall_to_bt(){ $result = ''; $vars = \SQL\UVOTE_DATA_UVOTE_TO_PARTY_OVERALL::QA(array()); @@ -26,7 +35,15 @@ class bars{ } return $result; } - + public static function get_bt_choice_overall_to_bt(){ + $result = ''; + $vars = \SQL\UVOTE_DATA_BT_TO_PARTY_OVERALL::QA(array()); + foreach($vars as $bar){ + $bar['match_percentage'] = round($bar['class_MATCH']/($bar['class_MATCH']+$bar['class_MISSMATCH'])*100,2); + $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/urvoteparties.tpl'), $bar); + } + return $result; + } public static function user_per_party_overall(){ //$vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id)); $result = ''; @@ -118,7 +135,7 @@ class bars{ $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/urvotebt_by_choice.tpl'), $row);; } if(empty($result)){ - return 'Keine relevanten Daten verfügbar'; + return 'Keine relevanten Daten verfügbar

'; } return $result; @@ -135,7 +152,7 @@ class bars{ WHERE user_ID = ?;', array(\SYSTEM\SECURITY\Security::getUser()->id)); while($row = $res->next()){ - $row['match_percentage'] = round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH'])*100,2); + $row['match_percentage'] = ($row['class_MATCH']+$row['class_MISSMATCH']) > 0 ? round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH'])*100,2) : 0; $result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/bt_to_user_overall.tpl'), $row); } diff --git a/uvote/api/votes/votes.php b/uvote/api/votes/votes.php index b9f0ca8..7cd3352 100644 --- a/uvote/api/votes/votes.php +++ b/uvote/api/votes/votes.php @@ -77,21 +77,21 @@ 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'] > 1 ? $vars['voted'] : 1; + $v = $vars['voted']; $nv = $vars['not_voted']; return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/all_polls.tpl'), - array( 'vote_percent'=> round($v/($nv+$v)*100, 2), - 'no_vote_percent'=> round($nv/($nv+$v)*100, 2), + array( 'vote_percent'=> $v > 0 ? round($v/($nv+$v)*100, 2) : 0, + 'no_vote_percent'=> $nv > 0 ? round($nv/($nv+$v)*100, 2) : 0, 'voted'=> $v, 'not_voted'=> $nv));} public static function get_user_overall_votes(){ $vars = \SQL\UVOTE_DATA_OVERALL_VOTES::Q1(array(\SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->creationDate)); - $v = $vars['voted'] > 1 ? $vars['voted'] : 1; + $v = $vars['voted']; $nv = $vars['not_voted']; return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/overall_all_polls.tpl'), - array( 'vote_perc'=> round($v/($nv+$v)*100, 2), - 'no_vote_perc'=> round($nv/($nv+$v)*100, 2), + array( 'vote_perc'=> $v > 0 ? round($v/($nv+$v)*100, 2) : 0, + 'no_vote_perc'=> $v > 0 ? round($nv/($nv+$v)*100, 2) : 0, 'voted'=> $v, 'not_voted'=> $nv));} diff --git a/uvote/files/frontend_logos/background.gif b/uvote/files/frontend_logos/background.gif new file mode 100644 index 0000000..49434d3 Binary files /dev/null and b/uvote/files/frontend_logos/background.gif differ diff --git a/uvote/files/frontend_logos/logo.png b/uvote/files/frontend_logos/logo.png new file mode 100644 index 0000000..06604da Binary files /dev/null and b/uvote/files/frontend_logos/logo.png differ diff --git a/uvote/files/frontend_logos/logo.psd b/uvote/files/frontend_logos/logo.psd index 98a3964..49afe47 100644 Binary files a/uvote/files/frontend_logos/logo.psd and b/uvote/files/frontend_logos/logo.psd differ diff --git a/uvote/files/frontend_logos/tapete.gif b/uvote/files/frontend_logos/tapete.gif new file mode 100644 index 0000000..0e47f84 Binary files /dev/null and b/uvote/files/frontend_logos/tapete.gif differ diff --git a/uvote/page/default_page/js/loadtexts.js b/uvote/page/default_page/js/loadtexts.js index 82396d4..666e045 100644 --- a/uvote/page/default_page/js/loadtexts.js +++ b/uvote/page/default_page/js/loadtexts.js @@ -83,6 +83,9 @@ function vote_click (poll_ID, vote) { }); } + + + function submit_commentrate (c_ID, val) { alert('success'); $.getJSON('./api.php?call=vote&action=commentrate&c_ID=' + c_ID + '&val=' + val, function(data) { @@ -163,24 +166,7 @@ function send_feedback (feedback) { }); } -function register_registerform(){ - //console.log("wegwegwegwegwegweg"); - $("#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 loadAjaxContent(url) { var dataTmp; diff --git a/uvote/page/default_page/tpl/loginform.tpl b/uvote/page/default_page/tpl/loginform.tpl index 9057e91..d34ef86 100644 --- a/uvote/page/default_page/tpl/loginform.tpl +++ b/uvote/page/default_page/tpl/loginform.tpl @@ -1,10 +1,7 @@ -
-
- -
+
-
-
+ -
-
+
- - -
- - -
- +
-
+ diff --git a/uvote/page/default_page/tpl/menu_loggedout.tpl b/uvote/page/default_page/tpl/menu_loggedout.tpl index 53ffbb0..931c533 100644 --- a/uvote/page/default_page/tpl/menu_loggedout.tpl +++ b/uvote/page/default_page/tpl/menu_loggedout.tpl @@ -1,6 +1,8 @@ -
-
\ No newline at end of file diff --git a/uvote/page/default_page/tpl/page.tpl b/uvote/page/default_page/tpl/page.tpl index 32589de..a696c3d 100644 --- a/uvote/page/default_page/tpl/page.tpl +++ b/uvote/page/default_page/tpl/page.tpl @@ -5,23 +5,26 @@ - + + ${css} ${js} - +
-
- +
+
+ +

${menu}
-
+
diff --git a/uvote/page/default_register/default_register.php b/uvote/page/default_register/default_register.php index 01e5414..28b112b 100644 --- a/uvote/page/default_register/default_register.php +++ b/uvote/page/default_register/default_register.php @@ -4,7 +4,8 @@ class default_register extends SYSTEM\PAGE\Page { private function css(){ return '';} - + public static function js(){ + return array(\SYSTEM\WEBPATH(new \PPAGE(),'default_register/js/default_register.js'));} public function html(){ $vars = array(); $vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=files&cat=frontend_logos&id='; diff --git a/uvote/page/default_register/js/default_register.js b/uvote/page/default_register/js/default_register.js index 3bae51d..5632870 100644 --- a/uvote/page/default_register/js/default_register.js +++ b/uvote/page/default_register/js/default_register.js @@ -1,10 +1,15 @@ function init_default_register(){ - + register_registerform(); } - /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - + +function register_registerform(){ + //console.log("wegwegwegwegwegweg"); + $.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;'); + } + }); + } diff --git a/uvote/page/default_register/tpl/register.tpl b/uvote/page/default_register/tpl/register.tpl index 2a42de5..c4df117 100644 --- a/uvote/page/default_register/tpl/register.tpl +++ b/uvote/page/default_register/tpl/register.tpl @@ -1,13 +1,13 @@
-
+

- Welcome + Willkommen auf uvote.eu!

-
+
${welcome_text}
@@ -88,10 +88,27 @@ - +
-
+
+ diff --git a/uvote/page/page_uvote.php b/uvote/page/page_uvote.php index 8c75c83..02cc4d5 100644 --- a/uvote/page/page_uvote.php +++ b/uvote/page/page_uvote.php @@ -33,5 +33,15 @@ class page_uvote extends \SYSTEM\API\api_default { public static function page_user_main_impressum(){ return (new user_main_impressum())->html();} + + + public static function page_user_main_loggedout_start(){ + return \SYSTEM\PAGE\text::get('welcome_text'); + } + public static function page_user_main_loggedout_news(){ + return user_main_start::newsfeed(); + } + private function default_register(){ + return (new default_register ())->html();} } \ No newline at end of file diff --git a/uvote/page/user_main_analysis/tpl/bt_total.tpl b/uvote/page/user_main_analysis/tpl/bt_total.tpl new file mode 100644 index 0000000..e4036af --- /dev/null +++ b/uvote/page/user_main_analysis/tpl/bt_total.tpl @@ -0,0 +1,52 @@ +
+
+

Beschlüsse des Bundestages in absoluten Zahlen

+
+
+
+
+
+
+ +
+
+ pro Stimmen +
+
${pro}
+
+
+
+
+
+
+ +
+
+ contra Stimmen +
+
${con}
+
+
+
+
+
+
+ +
+
+ Enthaltungen +
+
${ent}
+
+
+
+
+
+ +
+
+
+
Total: ${total_total}
+
+
+
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 bf0b916..4c78909 100644 --- a/uvote/page/user_main_analysis/tpl/user_main_analysis.tpl +++ b/uvote/page/user_main_analysis/tpl/user_main_analysis.tpl @@ -214,7 +214,7 @@

-    Bilanz: Bundestag +    Bilanz: Bundestag

@@ -290,7 +290,7 @@

-    community Statistik +    community Daten

@@ -326,6 +326,7 @@

Übereinstimmung community und Fraktionen

+
${votes_all_to_bt}
@@ -339,7 +340,62 @@
- +
+
+ +
+
+
+

+ ${bt_basic_stats} +
+
+

+ ${analysis_help_bt_basic} +

+ ${analysis_math_bt_basic} +
+
+ +
+
+
+
+
+ +
+
+
+

Übereinstimmung Bundestag und Fraktionen

+ ${choices_bt} +
+
+

+ ${analysis_help_choices_bt} +

+ ${analysis_math_choices_bt} +
+
+ +
+
+