uVote fixes

This commit is contained in:
Ulf Gebhardt 2014-02-16 03:27:00 +01:00
parent cb9a202f3b
commit 5a8c846c84
9 changed files with 29 additions and 60 deletions

View File

@ -62,10 +62,8 @@ class votes {
}
public static function get_all_votes(){
$res = \DBD\UVOTE_DATA_ALL_VOTES::Q1();
$votes = mysql_query($res);
$result = mysql_num_rows($votes);
return $result;
$res = \DBD\UVOTE_DATA_CHOICE_OVERALL::QA();
return $res;
}
public static function get_bar_bt_per_poll($poll_ID){

View File

@ -1,11 +1,11 @@
<?php
namespace DBD;
class UVOTE_DATA_CHOICE_OVERALL extends \SYSTEM\DB\QP {
class UVOTE_DATA_CHOICE_OVERALL extends \SYSTEM\DB\QQ {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'',
//mys
'SELECT COUNT(*) as "count" FROM uvote_data WHERE CHOICE = ?;'
'SELECT COUNT(*) as "count", choice FROM uvote_data GROUP BY choice;'
);}}

View File

@ -88,7 +88,7 @@ class default_page extends SYSTEM\PAGE\Page {
$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(),'default_page/page.html'), $vars);
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/page.tpl'), $vars);
}
}

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>uVote</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

View File

@ -5,9 +5,16 @@
<li><a href="#tab_myVote" action="user_main_myVote">myVote</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_uVote"></div>
<div class="tab-pane active" id="tab_uVote">${uVote}</div>
<div class="tab-pane" id="tab_urVote" style="overflow: hidden;"></div>
<div class="tab-pane" id="tab_myVote"></div>
</div>
</div>
${uVote}
<img src="${frontend_logos}logo2.png"/>
<form>
<br />
<h4>uVote BETA Feedback</h4>
<textarea id="feedback_text">Sag uns was dich stört!</textarea>
<br />
<input type="submit" id="feedback_submit" />
</form>

View File

@ -1,19 +1,12 @@
<?php
class user_main extends SYSTEM\PAGE\Page {
public function get_main_uVote(){
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uVote.tpl'), array());}
private static function user_all_votes(){
$result = '';
$res = votes::get_all_votes($result);
return $result;
}
class user_main extends SYSTEM\PAGE\Page {
public function html(){
$vars = array();
// $vars['votes_all'] = $this->user_all_votes();
$vars['uVote'] = $this->get_main_uVote();
$uv = new user_main_uVote();
$vars['uVote'] = $uv->html();
$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/main_menu.tpl'),$vars);
}

View File

@ -1,8 +1,7 @@
<?php
class user_main_myVote extends SYSTEM\PAGE\Page {
public function html(){
$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_myVote/myVote.tpl'),$vars);
public function html(){
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_myVote/myVote.tpl'),array());
}
}

View File

@ -1,9 +1 @@
${votes_all}
<img src="${frontend_logos}logo2.png"/>
<form>
<br />
<h4>uVote BETA Feedback</h4>
<textarea id="feedback_text">Sag uns was dich stört!</textarea>
<br />
<input type="submit" id="feedback_submit" />
</form>
${votes_all}

View File

@ -1,31 +1,11 @@
<?php
class user_main_uVote extends SYSTEM\PAGE\Page {
private function votes_overall(){
$partyvotes = votes::get_barsperparty($this->poll_ID);
$pbpp = "";
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);
}
return $pbpp;
}
class user_main_uVote extends SYSTEM\PAGE\Page {
private function votes_all(){
return print_r(votes::get_all_votes(),true);}
private static function user_all_votes(){
$res = votes::get_all_votes();
return $res;
}
public function html(){
$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['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
public function html(){
$vars = array();
$vars['votes_all'] = $this->votes_all();
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/uVote.tpl'),$vars);
}