...
This commit is contained in:
parent
d88c36f85d
commit
f026d43b32
@ -4,8 +4,9 @@ class votes {
|
||||
public static function getAllVotesOfGroup($groupid){
|
||||
return \DBD\UVOTE_GENERATE_VOTELIST::QA(array($groupid));}
|
||||
|
||||
public static function countAllPolls($group){
|
||||
return \DBD\UVOTE_DATA_COUNT_VOTES::Q1();}
|
||||
public static function countAllPolls(){
|
||||
$res = \DBD\UVOTE_DATA_COUNT_VOTES::QQ();
|
||||
return $res;}
|
||||
|
||||
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));}
|
||||
@ -71,16 +72,40 @@ class votes {
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function get_all_votes_bt(){
|
||||
$res = \DBD\UVOTE_DATA_CHOICE_BT_OVERALL::QA();
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function get_user_temp_votes($user_ID){
|
||||
return \DBD\UVOTE_DATA_TEMP_VOTES::Q1(array($user_ID, $user_ID, $user_ID));}
|
||||
|
||||
public static function get_bar_bt_per_poll($poll_ID){
|
||||
return \DBD\UVOTE_DATA_BT_PER_POLL::Q1(array($poll_ID));}
|
||||
|
||||
public static function get_user_count(){
|
||||
return \DBD\UVOTE_DATA_USER_COUNT_USERS::Q1(array());}
|
||||
|
||||
public static function get_count_user_votes_per_poll($poll_ID){
|
||||
return \DBD\UVOTE_DATA_USER_COUNT_CHOICE_PER_POLL::Q1(array($poll_ID));}
|
||||
|
||||
public static function get_user_per_party_overall($user_ID){
|
||||
return \DBD\UVOTE_DATA_USER_PER_PARTY_OVERALL::QA(array($user_ID));
|
||||
}
|
||||
public static function get_user_to_bt_overall($user_ID){
|
||||
return \DBD\UVOTE_DATA_USER_TO_BT::QA(array($user_ID));
|
||||
}
|
||||
|
||||
public static function get_uvote_to_bt_overall(){
|
||||
return \DBD\UVOTE_DATA_UVOTE_TO_PARTY_OVERALL::QA(array());
|
||||
}
|
||||
|
||||
public static function get_users_choice_per_poll($poll_ID){
|
||||
return \DBD\UVOTE_DATA_USERS_CHOICE_PER_POLL::QA(array($poll_ID));}
|
||||
|
||||
public static function get_pfields_per_poll($poll_ID){
|
||||
return \DBD\UVOTE_DATA_USERS_CHOICE_PER_POLL::QA(array($poll_ID));}
|
||||
|
||||
public static function get_voteinfo($poll_ID){
|
||||
$con = new \SYSTEM\DB\Connection(new \DBD\uVote());
|
||||
$res = $con->prepare( 'selVoteByID',
|
||||
@ -92,6 +117,11 @@ class votes {
|
||||
|
||||
public static function get_barsperparty($poll_ID){
|
||||
return \DBD\UVOTE_DATA_PARTY_PER_POLL::QA(array($poll_ID));}
|
||||
|
||||
public static function get_party_choice($poll_ID, $party){
|
||||
$res = \DBD\UVOTE_DATA_PARTY_CHOICE_PER_POLL::Q1(array($poll_ID, $party));
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function write_vote($poll_ID, $vote){
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
|
||||
11
uVote/dbd/qq/UVOTE_DATA_PFIELDS_PER_POLL.php
Normal file
11
uVote/dbd/qq/UVOTE_DATA_PFIELDS_PER_POLL.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class UVOTE_DATA_PFIELDS_PER_POLL extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT COUNT(*) as count, choice FROM uvote_data WHERE `poll_ID` = ? GROUP BY choice ORDER BY count DESC;'
|
||||
);}}
|
||||
15
uVote/dbd/qq/UVOTE_DATA_UVOTE_TO_PARTY_OVERALL.php
Normal file
15
uVote/dbd/qq/UVOTE_DATA_UVOTE_TO_PARTY_OVERALL.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class UVOTE_DATA_UVOTE_TO_PARTY_OVERALL extends \SYSTEM\DB\QQ {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT party, sum(case when uvote_data.choice = uvote_votes_per_party.choice then 1 else 0 end) class_MATCH,
|
||||
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
|
||||
GROUP BY party;'
|
||||
);}}
|
||||
BIN
uVote/img/frontend_logos/background.png
Normal file
BIN
uVote/img/frontend_logos/background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 MiB |
BIN
uVote/img/frontend_logos/icon_urn_con.png
Normal file
BIN
uVote/img/frontend_logos/icon_urn_con.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
BIN
uVote/img/frontend_logos/icon_urn_ent.png
Normal file
BIN
uVote/img/frontend_logos/icon_urn_ent.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
BIN
uVote/img/frontend_logos/icon_urn_open.png
Normal file
BIN
uVote/img/frontend_logos/icon_urn_open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
BIN
uVote/img/frontend_logos/icon_urn_pro.png
Normal file
BIN
uVote/img/frontend_logos/icon_urn_pro.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@ -17,15 +17,15 @@ class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
private function bars_party(){
|
||||
$partyvotes = votes::get_barsperparty($this->poll_ID);
|
||||
|
||||
$pbpp = "";
|
||||
$result = "";
|
||||
foreach($partyvotes as $vote){
|
||||
$vote['party_yes'] = round($vote['votes_pro']/$vote['total']*100,0);
|
||||
$vote['party_no'] = round($vote['votes_contra']/$vote['total']*100,0);
|
||||
$vote['party_ent'] = round(($vote['nr_attending'] - $vote['votes_pro'] - $vote['votes_contra'])/$vote['total']*100,0);
|
||||
$pbpp .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/table_parties.tpl'), $vote);
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/table_parties.tpl'), $vote);
|
||||
}
|
||||
|
||||
return $pbpp;
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function bars_bt(){
|
||||
@ -38,8 +38,26 @@ class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/table_bt.tpl'), $vars);
|
||||
}
|
||||
|
||||
private function vote_buttons($poll_expired){
|
||||
$user_poll = votes::getUserPollData($this->poll_ID);
|
||||
private function voice_weight(){
|
||||
$vars = votes::get_count_user_votes_per_poll($this->poll_ID);
|
||||
$vars['voteweight'] = 1/$vars['count']*100;
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/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 '<h4>Stimme hier ab</h4>
|
||||
@ -92,20 +110,25 @@ class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
|
||||
public function html(){
|
||||
$poll_expired = \DBD\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID));
|
||||
$user_vote = votes::getUserPollData($this->poll_ID);
|
||||
|
||||
/*$poll_data = array();
|
||||
$poll_data[] = DBD\UVOTE_DATA_CHOICE_OVERALL::Q1(array(1));
|
||||
$poll_data[] = DBD\UVOTE_DATA_CHOICE_OVERALL::Q1(array(2));
|
||||
$poll_data[] = DBD\UVOTE_DATA_CHOICE_OVERALL::Q1(array(3));*/
|
||||
$vars = array();
|
||||
$vars['bars_party'] = $poll_expired ? '' : $this->bars_party();
|
||||
$vars['bars_user'] = $this->bars_user();
|
||||
$vars['bars_bt'] = $this->bars_bt();
|
||||
$vars['bars_party'] = $vars['bars_user'] = $vars['bars_bt'] = $vars['voice_weight'] = 'Vote to see results!';
|
||||
$vars['js'] = $this->js();
|
||||
$vars['css'] = $this->css();
|
||||
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
|
||||
$vars ['vote_buttons'] = $this->vote_buttons($poll_expired);
|
||||
$vars['poll_ID'] = $this->poll_ID;
|
||||
|
||||
$vars['vote_buttons'] = $this->vote_buttons($poll_expired,$user_vote);
|
||||
// $vars['p_fields'] = $this->p_fields();
|
||||
if($user_vote){
|
||||
$vars['bars_party'] = $poll_expired ? '' : $this->bars_party();
|
||||
$vars['bars_user'] = $this->bars_user();
|
||||
$vars['bars_bt'] = $this->bars_bt();
|
||||
$vars['voice_weight'] = $this->voice_weight();
|
||||
}
|
||||
|
||||
$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=img&cat=frontend_logos&id=';
|
||||
|
||||
$vars = array_merge($vars,votes::get_voteinfo($this->poll_ID));
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/bulletin.tpl'),$vars);
|
||||
}
|
||||
|
||||
@ -11,10 +11,11 @@ body {
|
||||
background: #5eb95e;
|
||||
}
|
||||
|
||||
.contra{
|
||||
.con{
|
||||
background: #ee5f5b;
|
||||
}
|
||||
|
||||
.ent{
|
||||
background: lightgrey;
|
||||
}
|
||||
|
||||
|
||||
@ -14,42 +14,98 @@ 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){
|
||||
case 1:
|
||||
return 'PRO';
|
||||
case 2:
|
||||
return 'CON';
|
||||
case 3:
|
||||
return 'ENT';
|
||||
default:
|
||||
return 'NONE';
|
||||
}
|
||||
}
|
||||
|
||||
private static function tablerow_class($choice){
|
||||
switch($choice){
|
||||
case 1:
|
||||
return 'pro';
|
||||
case 2:
|
||||
return 'contra';
|
||||
return 'con';
|
||||
case 3:
|
||||
return 'ent';
|
||||
default:
|
||||
return '';
|
||||
return 'open';
|
||||
}
|
||||
}
|
||||
public function generate_votelist(){
|
||||
|
||||
|
||||
private static function badge_class($choice){
|
||||
switch($choice){
|
||||
case 1:
|
||||
return 'badge-success';
|
||||
case 2:
|
||||
return 'badge-important';
|
||||
case 3:
|
||||
return 'badge-info';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function generate_votelist(){
|
||||
$result = array('','');
|
||||
$votes = votes::getAllVotesOfGroup(1);
|
||||
foreach($votes as $vote){
|
||||
$time_remain = strtotime($vote['time_end'])- microtime(true);
|
||||
$time_span = strtotime($vote['time_end']) - strtotime($vote['time_start']);
|
||||
$vote['vote_class'] = $this->tablerow_class(votes::getUserPollData($vote['ID']));
|
||||
$vote['bt_vote_class'] = $this->tablerow_class($vote['bt_choice']);
|
||||
$vote['full_vote_btn'] = $time_remain > 0 ? 'Abstimmen' : 'Ansehen';
|
||||
$vote_count = votes::get_count_user_votes_per_poll($vote['ID']);
|
||||
|
||||
$vote['title'] = utf8_encode($vote['title']);
|
||||
$vote['time_left'] = round($time_remain/($time_span+1)*100,0);
|
||||
$vote['time_done'] = 100-$vote['time_left'];
|
||||
if($time_remain > 0){
|
||||
|
||||
$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'] = $this->tablerow_class($user_vote);
|
||||
if($user_vote){
|
||||
//user vote
|
||||
$vote['vote_class'] = $this->tablerow_class($user_vote);
|
||||
|
||||
//bt vote
|
||||
$party_votes = votes::get_barsperparty($vote['ID']);
|
||||
$vote['bt_vote_class'] = $this->tablerow_class($vote['bt_choice']);
|
||||
foreach($party_votes as $pv){
|
||||
$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'])));
|
||||
}
|
||||
|
||||
//uvote vote
|
||||
$uvote = votes::get_users_choice_per_poll($vote['ID']);
|
||||
$vote['uv_vote_class'] = count($uvote) > 0 ? $this->tablerow_class($uvote[0]['choice']) : '';
|
||||
foreach($uvote as $v){
|
||||
$vote['uv'] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote_uv.tpl'),
|
||||
array( 'badge' => self::badge_class($v['choice']),
|
||||
'perc' => $v['count'] > 0 ? $v['count']/$vote_count['count']*100 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
if($time_remain > 0){
|
||||
$result[0] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote.tpl'), $vote);
|
||||
} else {
|
||||
$result[1] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/vote.tpl'), $vote);
|
||||
}
|
||||
}
|
||||
return $result[0].$result[1];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function get_coverpage(){
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/cover.tpl'), array());}
|
||||
|
||||
@ -68,11 +124,11 @@ class default_page extends SYSTEM\PAGE\Page {
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars['js'] = $this->js();
|
||||
$vars['css'] = $this->css();
|
||||
$vars['votelist'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->generate_votelist() : $this->get_coverpage() ;
|
||||
$vars['css'] = $this->css();
|
||||
$vars['votelist'] = $this->generate_votelist();
|
||||
$vars['registerform'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->getloggedinform() : $this->exchange_registerform();
|
||||
$vars['loginform'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->exchange_loginform() : $this->getloginform() ;
|
||||
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
|
||||
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE));
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(150));
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
</head>
|
||||
|
||||
<body style="padding-top: 50px;">
|
||||
<body style="background: ${frontend_logos}background.png, padding-top: 50px;">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner" style="padding-left: 50px; padding-right: 50px;">
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
|
||||
@ -1,24 +1,20 @@
|
||||
<table style="margin-bottom: 5px; width: 95%; height: 100px; border: solid lightgray 1px; background: beige;">
|
||||
<tr>
|
||||
<td style="padding: 5px;">
|
||||
<h4>${title}</h4>
|
||||
Nr.${ID}
|
||||
<a class="btn btn-primary btn-small btn_vote" style="float:right" poll_ID="${ID}">${full_vote_btn}</a>
|
||||
<tr>
|
||||
<!--<td class="${vote_class}" style="width: 10px; margin-top: 10px; border-left: 1px solid lightgray;">
|
||||
</td>-->
|
||||
<td style="padding: 5px; padding-top: 0;">
|
||||
<h5>${title}</h5>
|
||||
<img src="${frontend_logos}icon_urn_${vote_class}.png"/>
|
||||
<a class="btn btn-primary btn-small btn_vote" style="" poll_ID="${ID}">${full_vote_btn}</a>
|
||||
</td>
|
||||
<td class="${bt_vote_class}" style="width: 80px; margin-top: 10px; border-left: 1px solid lightgray;">
|
||||
<img src="${frontend_logos}icon_cdu.png" width="30"/><span class="badge badge-success" style="float:right;">123</span><br/>
|
||||
<img src="${frontend_logos}icon_csu.png" width="30"/><span class="badge badge-important" style="float:right;">123</span><br/>
|
||||
<img src="${frontend_logos}icon_spd.png" width="30"/><span class="badge" style="float:right;">123</span><br/>
|
||||
<img src="${frontend_logos}icon_gruene.png" width="30"/><span class="badge badge-success" style="float:right;">123</span><br/>
|
||||
<img src="${frontend_logos}icon_linke.png" width="30"/><span class="badge badge-important" style="float:right;">123</span>
|
||||
<img src="${frontend_logos}icon_bt.png" width="80"/>
|
||||
${bt}
|
||||
</td>
|
||||
<td class="" style="width: 30px; margin-top: 10px; border-left: 1px solid lightgray;">
|
||||
uv
|
||||
<span class="badge badge-success" style="float:right;">123</span>
|
||||
<span class="badge badge-important" style="float:right;">123</span>
|
||||
<span class="badge" style="float:right;">123</span>
|
||||
</td>
|
||||
<td class="${vote_class}" style="width: 20px; margin-top: 10px; border-left: 1px solid lightgray;">
|
||||
<td class="${uv_vote_class}" style="width: 50px; height: 100%; border-left: 1px solid lightgray;">
|
||||
<img src="${frontend_logos}icon_urn.png" width="25"/><br/>
|
||||
${uv}
|
||||
<span class="badge badge-info" style="">${uv_count}</span>
|
||||
</td>
|
||||
<td style="margin: 0; padding: 0; width: 3px;" >
|
||||
<table class="poll_time" time="${time_end}" style="width: 100%; height: 100%; margin: 0; padding: 0;">
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
<div style="width: 90%;">
|
||||
<img src="${frontend_logos}logo2.png"/>
|
||||
<br />
|
||||
<br />
|
||||
@ -83,4 +84,5 @@
|
||||
</table>
|
||||
<button class="btn btn-primary" type="submit"><i class="icon-ok icon-white"></i> ${register}</button>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
@ -1 +1,14 @@
|
||||
test123
|
||||
Geburtsjahr
|
||||
<br>
|
||||
<input type="text" id="feedback_text"/>
|
||||
<br>
|
||||
<ul class="dropdown-menu" style="display: block;">
|
||||
<li><a tabindex="-1" href="#">männlich</a></li>
|
||||
<li><a tabindex="-1" href="#">weiblich</a></li>
|
||||
<li><a tabindex="-1" href="#">weder noch</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a tabindex="-1" href="#">keine Angabe</a></li>
|
||||
</ul>
|
||||
|
||||
<input type="submit" id="feedback_submit" />
|
||||
|
||||
|
||||
8
uVote/page/user_main_uVote/bt_to_uvote_overall.tpl
Normal file
8
uVote/page/user_main_uVote/bt_to_uvote_overall.tpl
Normal file
@ -0,0 +1,8 @@
|
||||
<tr>
|
||||
<td style="border-top: 1px solid black;">
|
||||
<img src="${frontend_logos}icon_bt.png"/>
|
||||
</td>
|
||||
<td><span class="badge badge-success">${class_MATCH}</span></td>
|
||||
<td><span class="badge badge-important">${class_MISSMATCH}</span></td>
|
||||
<td><span class="badge">${match_percentage}%</span></td>
|
||||
</tr>
|
||||
@ -1,6 +1,24 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th>${uVote_overall_votes_title}</th>
|
||||
</tr>
|
||||
<div style="width: 50%; float: left; margin-bottom: 30px;">
|
||||
|
||||
<h5>Entscheidungsverhalten der uVote Community</h5>
|
||||
<span style="float: left;">
|
||||
${votes_all}
|
||||
</table>
|
||||
</span>
|
||||
<span style=""> Wie oft die uVote Community
|
||||
<br> insgesamt Dafür, Dagegen oder
|
||||
<br> Enthaltung gestimmt hat.</span>
|
||||
</div>
|
||||
<div style="width: 50%;">
|
||||
<h5>Entscheidungsverhalten des Bundestags</h5>
|
||||
<span style="">
|
||||
${votes_all_bt}
|
||||
</span>
|
||||
<span style="float: left;"> Wie oft der Bundestag
|
||||
<br> Dafür, Dagegen oder
|
||||
<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>
|
||||
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
class user_main_uVote extends SYSTEM\PAGE\Page {
|
||||
|
||||
|
||||
|
||||
|
||||
private function votes_all(){
|
||||
$votes = votes::get_all_votes();
|
||||
$result = '';
|
||||
@ -8,12 +11,15 @@ class user_main_uVote extends SYSTEM\PAGE\Page {
|
||||
switch($vote['choice']){
|
||||
case 1:
|
||||
$vote['choice'] = 'PRO';
|
||||
$vote['badge_color'] = 'badge-success';
|
||||
break;
|
||||
case 2:
|
||||
$vote['choice'] = 'CONTRA';
|
||||
$vote['choice'] = 'CON';
|
||||
$vote['badge_color'] = 'badge-important';
|
||||
break;
|
||||
case 3:
|
||||
$vote['choice'] = 'ENTH';
|
||||
$vote['choice'] = 'ENT';
|
||||
$vote['badge_color'] = 'badge-info';
|
||||
break;
|
||||
}
|
||||
//$vote['count'];
|
||||
@ -22,10 +28,45 @@ class user_main_uVote extends SYSTEM\PAGE\Page {
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
private function votes_all_bt(){
|
||||
$votes = votes::get_all_votes_bt();
|
||||
$result = '';
|
||||
foreach($votes as $vote){
|
||||
switch($vote['bt_choice']){
|
||||
case 1:
|
||||
$vote['bt_choice'] = 'PRO';
|
||||
$vote['badge_color'] = 'badge-success';
|
||||
break;
|
||||
case 2:
|
||||
$vote['bt_choice'] = 'CON';
|
||||
$vote['badge_color'] = 'badge-important';
|
||||
break;
|
||||
case 3:
|
||||
$vote['bt_choice'] = 'ENT';
|
||||
$vote['badge_color'] = 'badge-info';
|
||||
break;
|
||||
case 0:
|
||||
$vote['bt_choice'] = 'OFFEN';
|
||||
}
|
||||
//$vote['count'];
|
||||
//$vote['choice'];
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/votecountchoicebt.tpl'),$vote);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function user_count(){
|
||||
$vars = votes::get_user_count();
|
||||
return $vars['count'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars['votes_all'] = $this->votes_all();
|
||||
$vars['votes_all_bt'] = $this->votes_all_bt();
|
||||
$vars['user_count'] = $this->user_count();
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE));
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(150));
|
||||
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uVote.tpl'),$vars);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<tr>
|
||||
<td><span class="badge badge-info">${choice}</span></td>
|
||||
<td><span class="badge badge-success">${count}</span></td>
|
||||
</tr>
|
||||
<div>
|
||||
<span class="badge" style="">${choice}</span>
|
||||
<span class="badge ${badge_color}" style="">${count}</span>
|
||||
|
||||
</div>
|
||||
|
||||
4
uVote/page/user_main_uVote/votecountchoicebt.tpl
Normal file
4
uVote/page/user_main_uVote/votecountchoicebt.tpl
Normal file
@ -0,0 +1,4 @@
|
||||
<div>
|
||||
<span class="badge" style="">${bt_choice}</span>
|
||||
<span class="badge ${badge_color}" style="">${count}</span>
|
||||
</div>
|
||||
@ -1,13 +1,10 @@
|
||||
<div id="statistics_uvote_users">
|
||||
|
||||
<div id="statistics_uvote_users">
|
||||
<h4>${urVote_title}</h4>
|
||||
<div style="float: left;">
|
||||
<table style="border-collapse: separate;
|
||||
border-spacing: 10px 5px;">
|
||||
border-spacing: 10px 5px; width: 350px;">
|
||||
<tr>
|
||||
<h5>${urVote_title}</h5>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<h6>${urVote_user_party_compare}</h6>
|
||||
<h5>${urVote_user_party_compare}</h5>
|
||||
${choices_user_ID}
|
||||
</tr>
|
||||
|
||||
@ -15,5 +12,10 @@
|
||||
${choices_bt_to_user}
|
||||
</tr>
|
||||
</table>
|
||||
${poll_compare}
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-left: 40px; float: left;">
|
||||
${user_temp_votes}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -1,11 +1,17 @@
|
||||
<?php
|
||||
class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
|
||||
private function count_all_polls (){
|
||||
$result = '';
|
||||
$vars = votes::countAllPolls(1);
|
||||
new INFO('bla'.print_r($vars, true));
|
||||
return $result;
|
||||
|
||||
|
||||
private function user_temp_votes (){
|
||||
$vars = votes::get_user_temp_votes(\SYSTEM\SECURITY\Security::getUser()->id);
|
||||
$v = $vars['voted'];
|
||||
$nv = $vars['not_voted'];
|
||||
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/all_polls.tpl'),
|
||||
array( 'vote_perc'=> round($v/($nv+$v)*100,0),
|
||||
'no_vote_perc'=> round($nv/($nv+$v)*100,0),
|
||||
'voted'=> $v,
|
||||
'not_voted'=> $nv));
|
||||
}
|
||||
|
||||
private function user_to_bt(){
|
||||
@ -20,13 +26,17 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
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);
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/bt_to_user_overall.tpl'), $row);;
|
||||
$row['match_percentage'] = round($row['class_MATCH']/($row['class_MATCH']+$row['class_MISSMATCH']+1)*100,2);
|
||||
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/bt_to_user_overall.tpl'), $row);
|
||||
}
|
||||
return $result;
|
||||
return $result;
|
||||
$row['votes_cast'] = round(($row['class_MATCH']+$row['class_MISSMATCH']),2);
|
||||
}
|
||||
|
||||
private function user_per_party_overall(){
|
||||
|
||||
|
||||
private function user_per_party_overall(){
|
||||
//$vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id));
|
||||
$result = '';
|
||||
$con = new \SYSTEM\DB\Connection();
|
||||
@ -45,11 +55,12 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
}
|
||||
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars = array();
|
||||
// $vars['poll_compare'] = $this->count_all_polls();
|
||||
$vars['choices_user_ID'] = $this->user_per_party_overall();
|
||||
$vars['choices_bt_to_user'] = $this->user_to_bt();
|
||||
$vars['poll_compare'] = $this->count_all_polls();
|
||||
$vars['choices_bt_to_user'] = $this->user_to_bt();
|
||||
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
|
||||
$vars['user_temp_votes'] = $this->user_temp_votes();
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE));
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(150));
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/urVote.tpl'),$vars);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user