0 ? round($vars['total_pro']/$vars['total_total']*100) : 0; $vars['total_con_percentage'] = $vars['total_total'] > 0 ? round($vars['total_con']/$vars['total_total']*100) : 0; $vars['total_ent_percentage'] = $vars['total_total'] > 0 ? round($vars['total_ent']/$vars['total_total']*100) : 0; return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/tab_basic/user_total.tpl'),$vars); } public static function get_uvote_choice_overall(){ $vars = \SQL\UVOTE_DATA_CHOICE_OVERALL::Q1(array()); $vars['total_total'] = $vars['pro'] + $vars['con'] + $vars['ent']; $vars['total_pro_percentage'] = $vars['total_total'] > 0 ? round($vars['pro']/$vars['total_total']*100+1) : 0; $vars['total_con_percentage'] = $vars['total_total'] > 0 ? round($vars['con']/$vars['total_total']*100+1) : 0; $vars['total_ent_percentage'] = $vars['total_total'] > 0 ? round($vars['ent']/$vars['total_total']*100+1) : 0; new SYSTEM\LOG\INFO($vars['total_ent_percentage']); return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/tab_basic/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'] = $vars['total_total'] > 0 ? round($vars['pro']/$vars['total_total']*100+1) : 0; $vars['total_con_percentage'] = $vars['total_total'] > 0 ? round($vars['con']/$vars['total_total']*100+1) : 0; $vars['total_ent_percentage'] = $vars['total_total'] > 0 ? round($vars['ent']/$vars['total_total']*100+1) : 0; new SYSTEM\LOG\INFO($vars['total_ent_percentage']); return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/tab_basic/bt_total.tpl'),$vars); } public static function bilance_community(){ $result = ''; $vars = \SQL\UVOTE_DATA_UVOTE_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/tab_bilance/bars_community.tpl'), $bar); } return $result; } public static function bilance_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/tab_bilance/bars_community.tpl'), $bar); } return $result; } public static function bilance_user(){ $result = ''; $res = \SQL\UVOTE_DATA_USER_BILANCE::QA(array(\SYSTEM\SECURITY\Security::getUser()->id)); foreach($res as $row){ //$res2 = votes::vote_accord_with_party($row['party']); //$row['according_laws'] = self::build_according_law_html($res2, $row['party']); $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_analysis/tpl/tab_bilance/bars_user.tpl'), $row); } return $result; } public static function build_according_law_html($part, $party){ $part = json_decode($part, true); $result = "