finished dewiring
This commit is contained in:
parent
14c7691cd9
commit
2ec1907966
@ -131,16 +131,10 @@ class votes {
|
||||
}
|
||||
|
||||
public static function write_vote($poll_ID, $vote){
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
throw new ERROR("You need to be logged in.");}
|
||||
|
||||
$con = new \SYSTEM\DB\Connection(new \SQL\uVote());
|
||||
$res = $con->prepare( 'selVote',
|
||||
'SELECT * FROM `uvote_votes` WHERE `ID` = ? AND time_end < CURDATE();',
|
||||
array($poll_ID));
|
||||
if ($res->next()){
|
||||
throw new ERROR('Your rights have expired!');}
|
||||
|
||||
'SELECT * FROM `uvote_votes` WHERE `ID` = ?;',
|
||||
array($poll_ID));
|
||||
$res = $con->prepare( 'insertVote',
|
||||
'REPLACE uvote_data
|
||||
VALUES (?, ?, ?, 0, NOW());',
|
||||
|
||||
@ -2,13 +2,15 @@
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__),'');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_page','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_register','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_bulletin','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/default_comment','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_uVote','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_urVote','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_myVote','');
|
||||
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_votelist','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_analysis','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_options','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_poll','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_active','');
|
||||
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_ended','');
|
||||
|
||||
|
||||
//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_ended','');
|
||||
//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main','');
|
||||
//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_main_uVote','');
|
||||
//SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list','');
|
||||
@ -1,4 +0,0 @@
|
||||
.progress#progress_bars_user {
|
||||
height: 20px;
|
||||
width: 350px;
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
#bulletin_main {
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#bulletin_left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#bulletin_sub1 {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
#bulletin_sub2 {
|
||||
float: left;
|
||||
width: 50%;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
#bulletin_sub3 {
|
||||
float: right;
|
||||
width: 50%;
|
||||
padding-top: 30px;
|
||||
}
|
||||
#divider {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#bulletin_sub4 {
|
||||
padding-top: 30px;
|
||||
}
|
||||
#bulletin_sub5 {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
#bulletin_sub5_sub {
|
||||
float: left;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
#bulletin_sub6 {
|
||||
float: right;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
#bulletin_sub7 {
|
||||
clear: both;
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
#comment_main {
|
||||
float: left;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
#comment_sub1 {
|
||||
float: left;
|
||||
font-size: 1;
|
||||
}
|
||||
|
||||
#comment_sub2 {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#comment_sub3 {
|
||||
font-size: 2;
|
||||
}
|
||||
|
||||
#comment_sub4 {
|
||||
float: right;
|
||||
font-size: 1;
|
||||
}
|
||||
@ -1,242 +0,0 @@
|
||||
<?php
|
||||
class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
private $poll_ID = NULL;
|
||||
|
||||
public function __construct($poll_ID) {
|
||||
$this->poll_ID=$poll_ID;}
|
||||
|
||||
public function vote_choice(){
|
||||
$vars = votes::getUserPollData($this->poll_ID);
|
||||
return $this->tablerow_class($vars);
|
||||
}
|
||||
|
||||
private static function tablerow_class($choice){
|
||||
switch($choice){
|
||||
case 1:
|
||||
return 'pro';
|
||||
case 2:
|
||||
return 'con';
|
||||
case 3:
|
||||
return 'ent';
|
||||
default:
|
||||
return 'open';
|
||||
}
|
||||
}
|
||||
|
||||
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 function choice_party (){
|
||||
$result = '';
|
||||
$party_votes = votes::get_barsperparty($this->poll_ID);
|
||||
|
||||
// $vote['bt_vote_class'] = $this->tablerow_class($vote['bt_choice']);
|
||||
foreach($party_votes as $pv){
|
||||
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/vote_bt.tpl'),
|
||||
array( 'party' => $pv['party'],
|
||||
'choice' => $this->get_party_per_poll($pv['choice']),
|
||||
'choice_class' => $this->tablerow_class($pv['choice']),
|
||||
'party_yes' => $pv['votes_pro'] > 0 ? round($pv['votes_pro']/$pv['total']*100,0) : $pv['votes_pro'],
|
||||
'party_no' => $pv['votes_contra'] > 0 ? round($pv['votes_contra']/$pv['total']*100,0) : $pv['votes_contra'],
|
||||
'party_off' => $pv['total'] > 0 ? round(($pv['total'] - $pv['nr_attending'])/$pv['total']*100,0) : $pv['total'],
|
||||
'party_ent' => $pv['nr_attending'] > 0 ? round(($pv['nr_attending'] - $pv['votes_pro'] - $pv['votes_contra'])/$pv['nr_attending']*100,0) : $pv['nr_attending']));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function get_pro_comments (){
|
||||
$result = '';
|
||||
/*$vars = votes::getUserComments($this->poll_ID, 1);
|
||||
|
||||
foreach($vars as $com){
|
||||
$rating = votes::get_commentrate($com['c_ID'], 1);
|
||||
$com['count_up'] = $rating['count'];
|
||||
$rating2 = votes::get_commentrate($com['c_ID'], 2);
|
||||
$com['count_down'] = $rating2['count'];
|
||||
// $com['c_txt'] = utf8_encode($com['c_txt']);
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/comment.tpl'), $com);
|
||||
}*/
|
||||
return $result;
|
||||
|
||||
}
|
||||
private function get_con_comments (){
|
||||
$result = '';
|
||||
/*$vars = votes::getUserComments($this->poll_ID, 2);
|
||||
|
||||
foreach($vars as $com){
|
||||
$rating = votes::get_commentrate($com['c_ID'], 1);
|
||||
$com['count_up'] = $rating['count'];
|
||||
$rating2 = votes::get_commentrate($com['c_ID'], 2);
|
||||
$com['count_down'] = $rating2['count'];
|
||||
// $com['c_txt'] = utf8_encode($com['c_txt']);
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/comment.tpl'), $com);
|
||||
}*/
|
||||
return $result;
|
||||
|
||||
}
|
||||
private function bars_user(){
|
||||
$bars = votes::get_barsperusers($this->poll_ID,false);
|
||||
$bars['vote_yes_perc'] = round($bars['yes_perc']*100,0);
|
||||
$bars['vote_no_perc'] = round($bars['no_perc']*100,0);
|
||||
$bars['vote_ent_perc'] = round($bars['ent_perc']*100,0);
|
||||
$bars['title'] = 'Gemessen auf uVote';
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/bars_user.tpl'),$bars);
|
||||
}
|
||||
|
||||
private function bars_party(){
|
||||
$partyvotes = votes::get_barsperparty($this->poll_ID);
|
||||
|
||||
$result = "";
|
||||
foreach($partyvotes as $vote){
|
||||
$vote['party_yes'] = $vote['votes_pro'] > 0 ? round($vote['votes_pro']/$vote['total']*100,0) : $vote['votes_pro'];
|
||||
$vote['party_no'] = $vote['votes_contra'] > 0 ? round($vote['votes_contra']/$vote['total']*100,0) : $vote['votes_contra'];
|
||||
$vote['party_ent'] = $vote['nr_attending'] > 0 ? round(($vote['nr_attending'] - $vote['votes_pro'] - $vote['votes_contra'])/$vote['total']*100,0) : $vote['nr_attending'];
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/table_parties.tpl'), $vote);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function icons_party(){
|
||||
$vars = votes::get_bar_bt_per_poll($this->poll_ID);
|
||||
if (!$vars['bt_total']){
|
||||
return '';}
|
||||
$info = array();
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/icons_table_parties.tpl'), $info);
|
||||
}
|
||||
|
||||
private function bars_bt(){
|
||||
$vars = votes::get_bar_bt_per_poll($this->poll_ID);
|
||||
if (!$vars['bt_total']){
|
||||
return 'Keine Ergebnisse für den Bundestag verfügbar';}
|
||||
$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/tpl/table_bt.tpl'), $vars);
|
||||
}
|
||||
|
||||
private function voice_weight(){
|
||||
$vars = votes::get_count_user_votes_per_poll($this->poll_ID);
|
||||
$vars['voteweight'] = $vars['count'] ? round(1/$vars['count']*100) : 'no votes';
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/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 '<h5>Stimme hier ab</h5>
|
||||
<a class="btn btn-success btn-default btnvote_yes"
|
||||
style="width: 70px"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3">Pro</font></a>
|
||||
<a class="btn btn-danger btn-default btnvote_no"
|
||||
style="width: 70px"
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3">Contra</font></a>
|
||||
<a class="btn btn-info btn-default btnvote_off"
|
||||
style="width: 70px"
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3">Enthaltung</font></a>';}
|
||||
$classes = array('','','');
|
||||
switch($user_poll){
|
||||
case 1: $classes = array('btn-success disabled','btn-danger','btn-info'); break;
|
||||
case 2: $classes = array('btn-success','btn-danger disabled','btn-info'); break;
|
||||
case 3: $classes = array('btn-success','btn-danger','btn-info disabled'); break;
|
||||
default: array('','','');
|
||||
}
|
||||
|
||||
return ' <h5>Ändere deine Stimme hier ab</h5>
|
||||
<a class="btn '.$classes[0].' btn-default btnvote_yes"
|
||||
style="width: 70px"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3">Pro</font></a>
|
||||
<a class="btn '.$classes[1].' btn-default btnvote_no"
|
||||
style="width: 70px"
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3">Contra</font></a>
|
||||
<a class="btn '.$classes[2].' btn-default btnvote_off"
|
||||
style="width: 70px"
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3">Enthaltung</font></a>
|
||||
';
|
||||
} else {
|
||||
return 'ye soon to come infos';
|
||||
}
|
||||
}
|
||||
|
||||
private function js(){
|
||||
return \SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin/js/vote.js'));}
|
||||
private function css(){
|
||||
return \SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\bars_user.css')).
|
||||
\SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\bulletin.css')).
|
||||
\SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_bulletin\css\comment.css'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function html(){
|
||||
$poll_expired = \SQL\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID));
|
||||
$user_vote = votes::getUserPollData($this->poll_ID);
|
||||
|
||||
$vars = array();
|
||||
$vars['choice_party'] = '';
|
||||
$vars['voice_weight'] = $vars['bars_user'] = $vars['bars_bt'] = '';
|
||||
$vars['bars_party'] = '';
|
||||
$vars['icons_party'] = '';
|
||||
$vars['vote_class'] = $this->vote_choice();
|
||||
$vars['comments_pro'] = '';
|
||||
$vars['comments_con'] = '';
|
||||
$vars['js'] = $this->js();
|
||||
$vars['css'] = $this->css();
|
||||
|
||||
$vars['vote_buttons'] = $this->vote_buttons($poll_expired,$user_vote);
|
||||
// $vars['p_fields'] = $this->p_fields();
|
||||
if($user_vote){
|
||||
$vars['comments_pro'] = $this->get_pro_comments();
|
||||
$vars['comments_con'] = $this->get_con_comments();
|
||||
$vars['icons_party'] = $this->icons_party();
|
||||
$vars['choice_party'] = $this->choice_party();
|
||||
$vars['bars_party'] = $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=files&cat=frontend_logos&id=';
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
|
||||
|
||||
$vars = array_merge($vars,votes::get_voteinfo($this->poll_ID));
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/bulletin.tpl'),$vars);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
<div id="bulletin_main">
|
||||
<h4>${title}</h4>
|
||||
${vote_buttons}
|
||||
<div id="bulletin_left">
|
||||
<img src="${frontend_logos}icon_urn_${vote_class}.png"/>
|
||||
</div>
|
||||
<div id="bulletin_sub1">
|
||||
${openvote_help_text}
|
||||
${title}
|
||||
${openvote_help_text1}
|
||||
</div>
|
||||
<div>
|
||||
${voice_weight}
|
||||
</div>
|
||||
<div id="bulletin_sub2">
|
||||
${bars_user}<br>
|
||||
${bars_bt}
|
||||
</div>
|
||||
<div id="bulletin_sub3">
|
||||
${icons_party}
|
||||
${choice_party}
|
||||
</div>
|
||||
<div id="divider"></div>
|
||||
<br>
|
||||
<div id="bulletin_sub4">
|
||||
<h4>Kommentare</h4>
|
||||
<div id="bulletin_sub5">
|
||||
<div id="bulletin_sub5_sub">
|
||||
<h5>Pro</h5>
|
||||
${comments_pro}
|
||||
</div>
|
||||
<div id="bulletin_sub6">
|
||||
<h5>Contra</h5>
|
||||
${comments_con}
|
||||
</div>
|
||||
</div>
|
||||
<div id="bulletin_sub7"></div>
|
||||
<div>
|
||||
<font size="2">Kommentar</font><br>
|
||||
<textarea id="c_txt_pro"></textarea><br>
|
||||
<font size="2">Quelle</font><br>
|
||||
<input type="text" id="c_src_pro" placeholder="optional"/><br>
|
||||
<select id="side_select" name="side_select">
|
||||
<option>Seite</option>
|
||||
<option value="1">Argument Pro</option>
|
||||
<option value="2">Argument Con</option>
|
||||
</select><br>
|
||||
<div class="btn btn-primary submit_pro" id="submit_pro" poll_ID="${poll_ID}">${submit}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--<div class="btn" id="test">
|
||||
test
|
||||
</div>
|
||||
-->
|
||||
|
||||
</div><!-- /.modal -->
|
||||
@ -1,9 +1,7 @@
|
||||
#vote_main {
|
||||
margin-bottom: 5px;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
min-height: 125px;
|
||||
border: solid lightgray 1px;
|
||||
background: beige;
|
||||
border: solid lightgray 3px;
|
||||
}
|
||||
|
||||
#vote_sub1 {
|
||||
|
||||
@ -25,111 +25,8 @@ class default_page extends SYSTEM\PAGE\Page {
|
||||
\SYSTEM\HTML\html::link(\SYSTEM\WEBPATH(new \PPAGE(),'default_page/css/loginform.css'))
|
||||
;
|
||||
}
|
||||
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 'con';
|
||||
case 3:
|
||||
return 'ent';
|
||||
default:
|
||||
return 'open';
|
||||
}
|
||||
}
|
||||
|
||||
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 static function panel_class($choice){
|
||||
switch($choice){
|
||||
case 1:
|
||||
return 'panel-success';
|
||||
case 2:
|
||||
return 'panel-danger';
|
||||
case 3:
|
||||
return 'panel-info';
|
||||
default:
|
||||
return 'panel-default';
|
||||
}
|
||||
}
|
||||
|
||||
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_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'];
|
||||
|
||||
$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/tpl/vote_bt.tpl'),
|
||||
array( 'party' => $pv['party'],
|
||||
'choice' => $this->get_party_per_poll($pv['choice']),
|
||||
'choice_class' => $this->badge_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/tpl/vote_uv.tpl'),
|
||||
array( 'badge' => self::badge_class($v['choice']),
|
||||
'perc' => $v['count'] > 0 ? round($v['count']/$vote_count['count']*100, 2) : 0));
|
||||
}
|
||||
}
|
||||
|
||||
//new panels:
|
||||
$vote['panel_class'] = self::panel_class($user_vote);
|
||||
|
||||
if($time_remain > 0){
|
||||
$result[0] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/vote.tpl'), $vote);
|
||||
} else {
|
||||
$result[1] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/vote.tpl'), $vote);
|
||||
}
|
||||
}
|
||||
return $result[0].$result[1];
|
||||
}
|
||||
|
||||
|
||||
public function getloggedinform(){
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/loggedinform.tpl'),array());}
|
||||
|
||||
@ -62,7 +62,7 @@ function get_barsperparty (poll_ID) {
|
||||
}
|
||||
|
||||
function vote_click (poll_ID, vote) {
|
||||
$.getJSON('./api.php?call=vote&page=vote&poll_ID=' + poll_ID + '&vote=' + vote, function(data) {
|
||||
$.getJSON('./api.php?call=vote&action=vote&poll_ID=' + poll_ID + '&vote=' + vote, function(data) {
|
||||
var items = [];
|
||||
if(data.status == true){
|
||||
alert("success");
|
||||
|
||||
@ -34,7 +34,8 @@
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top">
|
||||
<div class="container" id="site-content" style="">
|
||||
<nav class="navbar navbar-default navbar-inverse">
|
||||
<div class="container-fluid">
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav" id="tabs_user_main">
|
||||
@ -47,9 +48,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="row" id="site-content">
|
||||
|
||||
<div class="row" id="user_main"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
<div id="vote_main">
|
||||
<div id="vote_sub1">
|
||||
<h5>${title}</h5>
|
||||
<img src="${frontend_logos}icon_urn_${vote_class}.png">
|
||||
<a href="#!start(poll);poll.${ID}" class="btn btn-primary btn-small" poll_ID="${ID}">${full_vote_btn}</a>
|
||||
<a class="btn btn-primary btn-small btn_fade" poll_ID="${ID}">${fade}</a>
|
||||
</div>
|
||||
|
||||
<div id="vote_data_panel${ID}" poll_ID="${ID}" style="display: none; float: left;">
|
||||
<div class="${bt_vote_class}" id="bt_vote_class_">
|
||||
<img src="${frontend_logos}icon_bt.png" width="80">
|
||||
${bt}
|
||||
</div>
|
||||
<div class="${uv_vote_class}" id="uv_vote_class_">
|
||||
<img src="${frontend_logos}icon_urn.png" width="20">
|
||||
<span style="">
|
||||
<font size="2">uVote</font>
|
||||
</span>
|
||||
${uv}
|
||||
<span class="badge" style="">
|
||||
${uv_count}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="vote_sub2">
|
||||
<div id="vote_sub3" class="poll_time" time="${time_end}">
|
||||
<div id="time_done" style="height: ${time_done}%;">
|
||||
<div id="vote_sub_3_1">
|
||||
</div>
|
||||
</div>
|
||||
<div id="time_left" style="height: ${time_left}%;">
|
||||
<div id="vote_sub_3_2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class="panel ${panel_class}">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapse_${ID}">${title}</a></h4>
|
||||
bis einschließlich ${time_end}; ${time_left}% verblieben
|
||||
</div>
|
||||
<div id="collapse_${ID}" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<img src="${frontend_logos}icon_urn_${vote_class}.png">
|
||||
<a class="btn btn-primary btn-small btn_vote" poll_ID="${ID}">${full_vote_btn}</a>
|
||||
<div id="vote_data_panel${ID}" poll_ID="${ID}" style="float: right;">
|
||||
<div class="${bt_vote_class}" id="bt_vote_class_">
|
||||
<img src="${frontend_logos}icon_bt.png" width="80">
|
||||
${bt}
|
||||
</div>
|
||||
<div class="${uv_vote_class}" id="uv_vote_class_">
|
||||
<img src="${frontend_logos}icon_urn.png" width="20">
|
||||
<span style="">
|
||||
<font size="2">uVote</font>
|
||||
</span>
|
||||
${uv}
|
||||
<span class="badge" style="">
|
||||
${uv_count}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
@ -15,28 +15,21 @@ class page_uvote extends \SYSTEM\API\api_default {
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
return (new default_register ())->html();}
|
||||
return (new user_main())->html();}
|
||||
|
||||
|
||||
public static function page_user_main_uVote(){
|
||||
return (new user_main_uVote())->html();}
|
||||
public static function page_user_main_analysis(){
|
||||
return (new user_main_analysis())->html();}
|
||||
|
||||
public static function page_user_main_urVote(){
|
||||
return (new user_main_urVote())->html();}
|
||||
|
||||
public static function page_user_main_myVote(){
|
||||
return (new user_main_myVote())->html();}
|
||||
public static function page_user_main_options(){
|
||||
return (new user_main_options())->html();}
|
||||
|
||||
public static function page_user_main_poll($poll_ID) {
|
||||
//return (new user_main_poll($poll_ID))->html();}
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
return (new default_register ())->html();}
|
||||
return (new user_main_poll($poll_ID))->html();}
|
||||
|
||||
public static function page_user_list(){
|
||||
return (new user_list())->html();}
|
||||
return (new user_main_poll($poll_ID))->html();}
|
||||
|
||||
public static function page_user_list_active(){
|
||||
return (new user_list_active())->html();}
|
||||
public static function page_user_main_votelist(){
|
||||
return (new user_main_votelist())->html();}
|
||||
|
||||
public static function page_user_list_ended(){
|
||||
return (new user_list_ended())->html();}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
#tabbable_list_menu {
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
#tab-content_list_menu {
|
||||
padding-top: 10px;
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
function init_user_list(){
|
||||
$('#tabs_user_list a').click(function (e) {
|
||||
//e.preventDefault();
|
||||
});
|
||||
$('.btn_vote').click(function () {
|
||||
//vote_click($(this).attr('poll_ID'));
|
||||
//$('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID'));
|
||||
//open_vote($(this).attr('poll_ID'));
|
||||
//register_registerform();
|
||||
});
|
||||
$('.btn_fade').click(function () {
|
||||
$('#vote_data_panel' + $(this).attr('poll_ID')).toggle();
|
||||
});
|
||||
}
|
||||
|
||||
function init_user_list_active(){
|
||||
$('.btn_fade').click(function () {
|
||||
$('#vote_data_panel' + $(this).attr('poll_ID')).show();
|
||||
});
|
||||
$('.btn_vote').click(function () {
|
||||
system.load('start(user_main(poll));poll.'+ $(this).attr('poll_ID'))
|
||||
//vote_click($(this).attr('poll_ID'));
|
||||
//$('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID'));
|
||||
//open_vote($(this).attr('poll_ID'));
|
||||
//register_registerform();
|
||||
})
|
||||
}
|
||||
function init_user_list_ended(){
|
||||
$('.btn_fade').click(function () {
|
||||
$('#vote_data_panel' + $(this).attr('poll_ID')).show();
|
||||
});
|
||||
$('.btn_vote').click(function () {
|
||||
//vote_click($(this).attr('poll_ID'));
|
||||
//$('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID'));
|
||||
// open_vote($(this).attr('poll_ID'));
|
||||
// register_registerform();
|
||||
system.load('start(user_main(poll));poll.'+ $(this).attr('poll_ID'))
|
||||
})
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<div class="tabbable" id="tabbable_list_menu">
|
||||
<ul class="nav nav-tabs" id="tabs_user_list">
|
||||
<li class="active"><a href="#!start(user_list(active))" action="user_list_active">aktive Abstimmungen</a></li>
|
||||
<li class=""><a href="#!start(user_list(ended))" action="user_list_ended">abgelaufene Abstimmungen</a></li>
|
||||
</ul>
|
||||
<div class="tab-content" id="tab-content_list_menu">
|
||||
<div class="tab-pane active" id="tab_list"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
class user_list extends SYSTEM\PAGE\Page {
|
||||
|
||||
public static function css(){
|
||||
return array(\SYSTEM\WEBPATH(new PPAGE(),'user_list/css/list_menu.css'));}
|
||||
public static function js(){
|
||||
return array(\SYSTEM\WEBPATH(new PPAGE(),'user_list/js/user_list.js'));}
|
||||
|
||||
public function html(){
|
||||
$vars = array();
|
||||
|
||||
$uv = new user_list_active();
|
||||
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=img&cat=frontend_logos&id=';
|
||||
$vars['active'] = $uv->html();
|
||||
|
||||
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_list/list_menu.tpl'),$vars);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
Ended List:
|
||||
${votelist}
|
||||
@ -1,105 +0,0 @@
|
||||
<?php
|
||||
class user_list_ended extends SYSTEM\PAGE\Page {
|
||||
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 'con';
|
||||
case 3:
|
||||
return 'ent';
|
||||
default:
|
||||
return 'open';
|
||||
}
|
||||
}
|
||||
|
||||
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::getAllExpVotesOfGroup(1);
|
||||
foreach($votes as $vote){
|
||||
$time_remain = strtotime($vote['time_end'])- microtime(true);
|
||||
$time_span = strtotime($vote['time_end']) - strtotime($vote['time_start']);
|
||||
$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'];
|
||||
|
||||
$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/tpl/vote_bt.tpl'),
|
||||
array( 'party' => $pv['party'],
|
||||
'choice' => $this->get_party_per_poll($pv['choice']),
|
||||
'choice_class' => $this->badge_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/tpl/vote_uv.tpl'),
|
||||
array( 'badge' => self::badge_class($v['choice']),
|
||||
'perc' => $v['count'] > 0 ? round($v['count']/$vote_count['count']*100, 2) : 0));
|
||||
}
|
||||
}
|
||||
|
||||
//new panels:
|
||||
$vote['panel_class'] = default_page::panel_class($user_vote);
|
||||
|
||||
if($time_remain > 0){
|
||||
$result[0] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/vote.tpl'), $vote);
|
||||
} else {
|
||||
$result[1] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/vote.tpl'), $vote);
|
||||
}
|
||||
}
|
||||
return $result[0].$result[1];
|
||||
}
|
||||
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars['votelist'] = $this->generate_votelist();
|
||||
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=files&cat=frontend_logos&id=';
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_list_ended/tpl/ended.tpl'), $vars);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
.tabbable#tabbable_main_menu {
|
||||
padding-right: 50px;
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
function init_user_main(){
|
||||
register_registerform();
|
||||
|
||||
//vote_click($(this).attr('poll_ID'));
|
||||
//$('#user_main').load('./?action=open_bulletin&poll_ID=' + $(this).attr('poll_ID'));
|
||||
//open_vote($(this).attr('poll_ID'));
|
||||
//register_registerform();
|
||||
|
||||
|
||||
$('#feedback_submit').click(function (data){
|
||||
var test = $('textarea#feedback_text').val();
|
||||
send_feedback(test);
|
||||
});
|
||||
$('#tabs_user_main a').click(function (e) {
|
||||
//e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
function init_myvote(){
|
||||
$('.add_data_submit').click(function () {
|
||||
submit_add_data();
|
||||
alert('success');
|
||||
});
|
||||
}
|
||||
|
||||
function init_poll(){
|
||||
$('.btnvote_yes').click(function () {
|
||||
vote_click($(this).attr('poll_ID'),1);
|
||||
});
|
||||
$('.btnvote_no').click(function () {
|
||||
vote_click($(this).attr('poll_ID'),2);
|
||||
});
|
||||
$('.btnvote_off').click(function () {
|
||||
vote_click($(this).attr('poll_ID'),3);
|
||||
});
|
||||
$('.submit_pro').click(function () {
|
||||
submit_c_data($(this).attr('poll_ID'));
|
||||
alert('success');
|
||||
});
|
||||
$('.c_up').click(function () {
|
||||
submit_commentrate($(this).attr('c_ID'), 1);
|
||||
});
|
||||
$('.c_down').click(function () {
|
||||
submit_commentrate($(this).attr('c_ID'), 2);
|
||||
});
|
||||
$('.c_spam').click(function () {
|
||||
submit_commentrate($(this).attr('c_ID'), 3);
|
||||
});
|
||||
$('#test').click(function(){
|
||||
$('#myModal').modal();
|
||||
});
|
||||
|
||||
register_registerform();
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
|
||||
|
||||
<div class="tabbable" id="tabbable_main_menu">
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab_main"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
class user_main extends SYSTEM\PAGE\Page {
|
||||
|
||||
public static function css(){
|
||||
return array(\SYSTEM\WEBPATH(new PPAGE(),'user_main/css/main_menu.css'));}
|
||||
public static function js(){
|
||||
return array(\SYSTEM\WEBPATH(new PPAGE(),'user_main/js/user_main.js'));}
|
||||
public function exchange_loginformmain(){
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/loggedinformtop.tpl'),array());}
|
||||
|
||||
public function getloginformmain(){
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/loginform.tpl'),array());}
|
||||
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars['loginform'] = \SYSTEM\SECURITY\Security::isLoggedIn() ? $this->exchange_loginformmain() : $this->getloginformmain() ;
|
||||
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=files&cat=frontend_logos&id=';
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main/main_menu.tpl'),$vars);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
class user_main_analysis extends SYSTEM\PAGE\Page {
|
||||
private function user_overall_votes (){
|
||||
$vars = votes::get_user_overall_votes(\SYSTEM\SECURITY\Security::getUser()->id, \SYSTEM\SECURITY\Security::getUser()->creationDate);
|
||||
$v = $vars['voted'] > 1 ? $vars['voted'] : 1;
|
||||
$nv = $vars['not_voted'];
|
||||
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/tpl/overall_all_polls.tpl'),
|
||||
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),
|
||||
'voted'=> $v,
|
||||
@ -16,7 +16,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
$v = $vars['voted'];
|
||||
$nv = $vars['not_voted'];
|
||||
print_r($vars, true);
|
||||
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/tpl/all_polls.tpl'),
|
||||
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/all_polls.tpl'),
|
||||
array( 'vote_perc'=> round($v/(($nv+$v)*100+1), 2),
|
||||
'no_vote_perc'=> round($nv/(($nv+$v)*100+1), 2),
|
||||
'voted'=> $v,
|
||||
@ -37,7 +37,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
while($row = $res->next()){
|
||||
$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/tpl/bt_to_user_overall.tpl'), $row);
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/bt_to_user_overall.tpl'), $row);
|
||||
}
|
||||
return $result;
|
||||
$row['votes_cast'] = round(($row['class_MATCH']+$row['class_MISSMATCH']),2);
|
||||
@ -62,7 +62,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
$res2 = votes::vote_accord_with_party($row['party']);
|
||||
$row['according_laws'] = $this->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_urVote/tpl/urvoteparties.tpl'), $row);;
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/urvoteparties.tpl'), $row);;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -96,7 +96,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
}
|
||||
//$vote['count'];
|
||||
//$vote['choice'];
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/tpl/votecountchoice.tpl'),$vote);
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/votecountchoice.tpl'),$vote);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -122,7 +122,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
}
|
||||
//$vote['count'];
|
||||
//$vote['choice'];
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/tpl/votecountchoicebt.tpl'),$vote);
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/votecountchoicebt.tpl'),$vote);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -138,7 +138,7 @@ class user_main_urVote extends SYSTEM\PAGE\Page {
|
||||
$vars['user_overall_votes'] = $this->user_overall_votes();
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_urVote/tpl/urVote.tpl'),$vars);
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_analysis/tpl/user_main_analysis.tpl'),$vars);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class user_main_myVote extends SYSTEM\PAGE\Page {
|
||||
class user_main_options extends SYSTEM\PAGE\Page {
|
||||
|
||||
public function get_add_data (){
|
||||
$qqresult = votes::get_add_data();
|
||||
@ -14,7 +14,7 @@ class user_main_myVote extends SYSTEM\PAGE\Page {
|
||||
}
|
||||
|
||||
private function css(){
|
||||
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'user_main_myVote/css/myVote.css').'" rel="stylesheet">';}
|
||||
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'user_main_options/css/myVote.css').'" rel="stylesheet">';}
|
||||
|
||||
public function html(){
|
||||
$vars = array();
|
||||
@ -22,7 +22,7 @@ class user_main_myVote extends SYSTEM\PAGE\Page {
|
||||
$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\PAGE\text::tag('uvote'));
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_myVote/tpl/myVote.tpl'), $vars);
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_options/tpl/user_main_options.tpl'), $vars);
|
||||
}
|
||||
|
||||
}
|
||||
@ -37,7 +37,7 @@ class user_main_poll extends SYSTEM\PAGE\Page {
|
||||
// $vote['bt_vote_class'] = $this->tablerow_class($vote['bt_choice']);
|
||||
foreach($party_votes as $pv){
|
||||
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/vote_bt.tpl'),
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/vote_bt.tpl'),
|
||||
array( 'party' => $pv['party'],
|
||||
'choice' => $this->get_party_per_poll($pv['choice']),
|
||||
'choice_class' => $this->tablerow_class($pv['choice']),
|
||||
@ -54,7 +54,7 @@ class user_main_poll extends SYSTEM\PAGE\Page {
|
||||
$bars['vote_no_perc'] = round($bars['no_perc']*100,0);
|
||||
$bars['vote_ent_perc'] = round($bars['ent_perc']*100,0);
|
||||
$bars['title'] = 'Gemessen auf uVote';
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/bars_user.tpl'),$bars);
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/bars_user.tpl'),$bars);
|
||||
}
|
||||
|
||||
private function bars_party(){
|
||||
@ -65,7 +65,7 @@ class user_main_poll extends SYSTEM\PAGE\Page {
|
||||
$vote['party_yes'] = $vote['votes_pro'] > 0 ? round($vote['votes_pro']/$vote['total']*100,0) : $vote['votes_pro'];
|
||||
$vote['party_no'] = $vote['votes_contra'] > 0 ? round($vote['votes_contra']/$vote['total']*100,0) : $vote['votes_contra'];
|
||||
$vote['party_ent'] = $vote['nr_attending'] > 0 ? round(($vote['nr_attending'] - $vote['votes_pro'] - $vote['votes_contra'])/$vote['total']*100,0) : $vote['nr_attending'];
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/table_parties.tpl'), $vote);
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/table_parties.tpl'), $vote);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -76,7 +76,7 @@ class user_main_poll extends SYSTEM\PAGE\Page {
|
||||
if (!$vars['bt_total']){
|
||||
return '';}
|
||||
$info = array();
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/icons_table_parties.tpl'), $info);
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/icons_table_parties.tpl'), $info);
|
||||
}
|
||||
|
||||
private function bars_bt(){
|
||||
@ -86,13 +86,13 @@ class user_main_poll extends SYSTEM\PAGE\Page {
|
||||
$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/tpl/table_bt.tpl'), $vars);
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/table_bt.tpl'), $vars);
|
||||
}
|
||||
|
||||
private function voice_weight(){
|
||||
$vars = votes::get_count_user_votes_per_poll($this->poll_ID);
|
||||
$vars['voteweight'] = $vars['count'] ? round(1/$vars['count']*100) : 'no votes';
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/tpl/voteweight.tpl'), $vars);
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/voteweight.tpl'), $vars);
|
||||
}
|
||||
|
||||
private function p_fields (){
|
||||
@ -112,16 +112,16 @@ class user_main_poll extends SYSTEM\PAGE\Page {
|
||||
if($poll_expired){
|
||||
if(!$user_poll){
|
||||
return '<h5>Stimme hier ab</h5>
|
||||
<a class="btn btn_vote btn-success btn-default btnvote_yes"
|
||||
<a class="btn btn-success btn-default btnvote_yes"
|
||||
style="width: 70px"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3">Pro</font></a>
|
||||
<a class="btn btn_vote btn-danger btn-default btnvote_no"
|
||||
<a class="btn btn-danger btn-default btnvote_no"
|
||||
style="width: 70px"
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
size="3">Contra</font></a>
|
||||
<a class="btn btn_vote btn-info btn-default btnvote_off"
|
||||
<a class="btn btn-info btn-default btnvote_off"
|
||||
style="width: 70px"
|
||||
href="#"
|
||||
poll_ID="${poll_ID}"><font
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
<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,13 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
${welcome_text}
|
||||
|
||||
<span class="badge badge-info">${user_count}</span> Nutzer auf uVote
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row" id="list_active_container">
|
||||
${list_active}
|
||||
</div>
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
<tr>
|
||||
<td>
|
||||
<img src="${frontend_logos}icon_${party}.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,43 +0,0 @@
|
||||
<?php
|
||||
class user_main_uVote extends SYSTEM\PAGE\Page {
|
||||
|
||||
private function uvote_to_parties (){
|
||||
$votes = votes::get_uvote_to_bt_overall();
|
||||
$result = '';
|
||||
|
||||
foreach($votes as $vote){
|
||||
$vote['match_percentage'] = round($vote['class_MATCH']/($vote['class_MATCH']+$vote['class_MISSMATCH'])*100,2);
|
||||
$result .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/tpl/uvoteparties.tpl'), $vote);
|
||||
}
|
||||
print_r($votes, TRUE);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function user_count(){
|
||||
$vars = votes::get_user_count();
|
||||
return $vars['count'];
|
||||
}
|
||||
private function get_list_active(){
|
||||
$classObj = new user_list();
|
||||
$var = $classObj->html();
|
||||
return $var;
|
||||
}
|
||||
|
||||
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars['list_active'] = $this->get_list_active();
|
||||
|
||||
$vars['uvote_to_bt'] = $this->uvote_to_parties();
|
||||
|
||||
$vars['user_count'] = $this->user_count();
|
||||
$vars['frontend_logos'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL).'api.php?call=files&cat=frontend_logos&id=';
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
|
||||
return \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_uVote/tpl/uVote.tpl'),$vars);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
<div>
|
||||
<span class="badge" style="">${choice}</span>
|
||||
<span class="badge ${badge_color}" style="">${count}</span>
|
||||
|
||||
</div>
|
||||
@ -1,4 +0,0 @@
|
||||
<div>
|
||||
<span class="badge" style="">${bt_choice}</span>
|
||||
<span class="badge ${badge_color}" style="">${count}</span>
|
||||
</div>
|
||||
2
uvote/page/user_main_votelist/js/user_main_votelist.js
Normal file
2
uvote/page/user_main_votelist/js/user_main_votelist.js
Normal file
@ -0,0 +1,2 @@
|
||||
function init_user_main_votelist(){
|
||||
}
|
||||
@ -1,10 +1,8 @@
|
||||
<div class="row">
|
||||
<div class="row" style="padding-bottom: 30px;">
|
||||
<div class="col-md-12">
|
||||
${welcome_text}
|
||||
|
||||
<span class="badge badge-info">${user_count}</span> Nutzer auf uVote
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
${votelist}
|
||||
15
uvote/page/user_main_votelist/tpl/vote.tpl
Normal file
15
uvote/page/user_main_votelist/tpl/vote.tpl
Normal file
@ -0,0 +1,15 @@
|
||||
<div id="vote_main" class="row">
|
||||
<div class="col-md-1">
|
||||
<img src="${frontend_logos}icon_urn_${vote_class}.png">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
${title}
|
||||
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<a href="#!start(poll);poll.${ID}" class="btn btn-primary btn-small" poll_ID="${ID}">${full_vote_btn}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
2
uvote/page/user_main_votelist/tpl/vote_bt.tpl
Normal file
2
uvote/page/user_main_votelist/tpl/vote_bt.tpl
Normal file
@ -0,0 +1,2 @@
|
||||
<img src="${frontend_logos}icon_${party}.png" width="30">
|
||||
<span id="vote_bt_span" class="badge ${choice_class}">${choice}</span><br>
|
||||
1
uvote/page/user_main_votelist/tpl/vote_uv.tpl
Normal file
1
uvote/page/user_main_votelist/tpl/vote_uv.tpl
Normal file
@ -0,0 +1 @@
|
||||
<span class="badge ${badge}">${perc}%</span>
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class user_list_active extends SYSTEM\PAGE\Page {
|
||||
class user_main_votelist extends SYSTEM\PAGE\Page {
|
||||
|
||||
private function get_party_per_poll($choice){
|
||||
switch($choice){
|
||||
@ -32,7 +32,7 @@ class user_list_active extends SYSTEM\PAGE\Page {
|
||||
case 1:
|
||||
return 'badge-success';
|
||||
case 2:
|
||||
return 'badge-important';
|
||||
return 'badge-danger';
|
||||
case 3:
|
||||
return 'badge-info';
|
||||
default:
|
||||
@ -69,7 +69,7 @@ class user_list_active extends SYSTEM\PAGE\Page {
|
||||
$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/tpl/vote_bt.tpl'),
|
||||
$vote['bt'] .= \SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_votelist/tpl/vote_bt.tpl'),
|
||||
array( 'party' => $pv['party'],
|
||||
'choice' => $this->get_party_per_poll($pv['choice']),
|
||||
'choice_class' => $this->badge_class($pv['choice'])));
|
||||
@ -86,17 +86,28 @@ class user_list_active extends SYSTEM\PAGE\Page {
|
||||
}
|
||||
|
||||
//new panels:
|
||||
$vote['panel_class'] = default_page::panel_class($user_vote);
|
||||
$vote['panel_class'] = self::panel_class($user_vote);
|
||||
|
||||
if($time_remain > 0){
|
||||
$result[0] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/vote.tpl'), $vote);
|
||||
$result[0] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_votelist/tpl/vote.tpl'), $vote);
|
||||
} else {
|
||||
$result[1] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/vote.tpl'), $vote);
|
||||
$result[1] .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_votelist/tpl/vote.tpl'), $vote);
|
||||
}
|
||||
}
|
||||
return $result[0].$result[1];
|
||||
}
|
||||
|
||||
public static function panel_class($choice){
|
||||
switch($choice){
|
||||
case 1:
|
||||
return 'panel-success';
|
||||
case 2:
|
||||
return 'panel-danger';
|
||||
case 3:
|
||||
return 'panel-info';
|
||||
default:
|
||||
return 'panel-default';
|
||||
}
|
||||
}
|
||||
public function html(){
|
||||
$vars = array();
|
||||
$vars['votelist'] = $this->generate_votelist();
|
||||
@ -104,7 +115,7 @@ class user_list_active extends SYSTEM\PAGE\Page {
|
||||
$vars['user_count'] = $this->user_count();
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote_register'));
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('uvote'));
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_list_active/tpl/active.tpl'), $vars);
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_votelist/tpl/user_main_votelist.tpl'), $vars);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user