urvote data

This commit is contained in:
Nael 2014-02-13 02:21:08 +01:00
parent e52abd4988
commit 4c28d3890e
3 changed files with 23 additions and 4 deletions

View File

@ -63,6 +63,9 @@ class votes {
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_per_party_overall($user_ID){
return \DBD\UVOTE_DATA_USER_PER_PARTY_OVERALL::QA(array($user_ID));}
public static function get_voteinfo($poll_ID){

View File

@ -7,9 +7,9 @@ class UVOTE_DATA_USER_PER_PARTY_OVERALL extends \SYSTEM\DB\QP {
//pg
'',
//mys
'SELECT sum(case when uvote_data.choice = uvote_votes_per_party.choice then 1 else 0 end) class_MATCH,
'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 LEFT JOIN uvote_votes_per_party
ON uvote_data.poll_ID = uvote_votes_per_party.poll_ID
WHERE user_ID = ? AND party = ?;'
WHERE user_ID = ? GROUP BY party;'
);}}

View File

@ -1,6 +1,22 @@
<?php
class user_main_urVote extends SYSTEM\PAGE\Page {
public function html(){
class user_main_urVote extends SYSTEM\PAGE\Page {
private function user_per_party_overall(){
$vars = votes::get_user_per_party_overall(array(\SYSTEM\SECURITY\Security::getUser()->id));
return print_r($vars, TRUE);
// if (!$vars['bt_total']){
// return 'no data yet';}
// $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/table_bt.tpl'), $vars);
}
public function html(){
$vars = array();
$vars['choices_user_ID'] = $this->user_per_party_overall();
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/urVote.tpl'),$vars);
}