fuck js
This commit is contained in:
parent
abf505ba94
commit
cb333417a5
@ -10,6 +10,11 @@ class api_uvote extends \SYSTEM\API\api_login {
|
||||
|
||||
}
|
||||
|
||||
public static function call_vote_action_comment($poll_ID, $c_choice, $c_txt, $c_src) {
|
||||
return votes::write_comment($poll_ID, $c_choice, $c_txt, $c_src);
|
||||
|
||||
}
|
||||
|
||||
public static function call_vote_action_new_vote($ID, $title, $iframe_link) {
|
||||
return votes::write_poll($ID, $title, $iframe_link);
|
||||
|
||||
|
||||
@ -27,13 +27,21 @@ class votes {
|
||||
public static function getAllVotesOfGroup($groupid){
|
||||
return \DBD\UVOTE_GENERATE_VOTELIST::QA(array($groupid));}
|
||||
|
||||
public static function getAllExpVotesOfGroup($groupid){
|
||||
return \DBD\UVOTE_GENERATE_VOTELIST_EXP::QA(array($groupid));}
|
||||
|
||||
public static function getUserComments($poll_ID, $c_choice){
|
||||
return \DBD\UVOTE_GENERATE_COMMENTS_PER_POLL::QA(array($poll_ID, $c_choice));}
|
||||
|
||||
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));}
|
||||
|
||||
|
||||
public static function insertUserComment($c_choice, $poll_ID, $user_ID, $c_txt, $c_src, $timestamp){
|
||||
return \DBD\UVOTE_DATA_USER_COMMENT_INSERT::QI(array($c_choice, $poll_ID, $user_ID, $c_txt, $c_src, $timestamp));}
|
||||
/*public static function getVoteOfGroup($poll_ID){
|
||||
$con = new \SYSTEM\DB\Connection(new \DBD\uVote());
|
||||
$res = $con->prepare( 'selVoteByGrp',
|
||||
@ -177,6 +185,11 @@ class votes {
|
||||
throw new ERROR("You need to be logged in.");}
|
||||
return \DBD\UVOTE_DATA_USER_ADD_DATA_INSERT::Q1(array(\SYSTEM\SECURITY\Security::getUser()->id, $location, $birthyear, $gender, $children, \SYSTEM\SECURITY\Security::getUser()->id, $location, $birthyear, $gender, $children));}
|
||||
|
||||
public static function write_comment($poll_ID, $c_choice, $c_txt, $c_src){
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
throw new ERROR("You need to be logged in.");}
|
||||
return \DBD\UVOTE_DATA_USER_COMMENT_INSERT::Q1(array($c_choice, $poll_ID, \SYSTEM\SECURITY\Security::getUser()->id, $c_txt, $c_src));}
|
||||
|
||||
public static function get_add_data(){
|
||||
return \DBD\UVOTE_DATA_USER_ADD_DATA::Q1(array(\SYSTEM\SECURITY\Security::getUser()->id));
|
||||
}
|
||||
|
||||
12
uVote/dbd/qq/UVOTE_DATA_USER_COMMENT_INSERT.php
Normal file
12
uVote/dbd/qq/UVOTE_DATA_USER_COMMENT_INSERT.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class UVOTE_DATA_USER_COMMENT_INSERT extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'INSERT INTO `uvote_user_comments` (`c_choice`, `poll_ID`, `user_ID`, `c_txt`, `c_src`, `timestamp`)
|
||||
VALUES (?, ?, ?, ?, ?, NOW());'
|
||||
);}}
|
||||
11
uVote/dbd/qq/UVOTE_GENERATE_COMMENTS_PER_POLL.php
Normal file
11
uVote/dbd/qq/UVOTE_GENERATE_COMMENTS_PER_POLL.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class UVOTE_GENERATE_COMMENTS_PER_POLL extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT * FROM `uvote_user_comments` WHERE `poll_ID` = ? AND c_choice = ? ORDER BY (txt_up-txt_down) ASC;'
|
||||
);}}
|
||||
@ -7,5 +7,5 @@ class UVOTE_GENERATE_VOTELIST extends \SYSTEM\DB\QP {
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT * FROM `uvote_votes` WHERE `group` = ? ORDER BY (time_end-time_start) ASC;'
|
||||
'SELECT * FROM `uvote_votes` WHERE `group` = ? AND time_end > NOW() ORDER BY (time_end-time_start) ASC;'
|
||||
);}}
|
||||
11
uVote/dbd/qq/UVOTE_GENERATE_VOTELIST_EXP.php
Normal file
11
uVote/dbd/qq/UVOTE_GENERATE_VOTELIST_EXP.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class UVOTE_GENERATE_VOTELIST_EXP extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT * FROM `uvote_votes` WHERE `group` = ? AND time_end < NOW() ORDER BY (time_end-time_start) ASC;'
|
||||
);}}
|
||||
@ -1,56 +1,51 @@
|
||||
<div style="float: left;">
|
||||
|
||||
<h4>${title}</h4>
|
||||
<div style="margin-top: 30px;">
|
||||
${openvote_help_text}${title}${openvote_help_text1}
|
||||
</div>
|
||||
<div style="float: right; margin-top: 30px;">
|
||||
<div>
|
||||
<div>
|
||||
${vote_buttons}
|
||||
<div style="float: right;">
|
||||
<div style="float: left;">
|
||||
<img src="${frontend_logos}icon_urn_${vote_class}.png"/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div>
|
||||
${voice_weight}
|
||||
</div>
|
||||
<div style="margin-top: 30px;">
|
||||
${openvote_help_text}
|
||||
${title}
|
||||
${openvote_help_text1}
|
||||
</div>
|
||||
<div style="">
|
||||
|
||||
<div>
|
||||
|
||||
|
||||
<div>
|
||||
${voice_weight}
|
||||
</div>
|
||||
<div style="float: left; width: 50%">
|
||||
<div>
|
||||
${bars_user}
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
${bars_bt}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="float: left;">
|
||||
<div style="float: left; width: 50%;">
|
||||
${icons_party}
|
||||
${choice_party}
|
||||
</div>
|
||||
<img src="${frontend_logos}logo2.png" style="" width="35%"/>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
|
||||
<div style="width: 50%">
|
||||
${comments_pro}
|
||||
${comments_con}
|
||||
<font></font>
|
||||
<textarea id="c_txt_pro">
|
||||
</textarea>
|
||||
<font></font>
|
||||
<input type="text" id="c_src_pro"/><br>
|
||||
<div class="btn btn-primary submit_pro" id="submit_pro" poll_ID="${poll_ID}">${submit}</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--<div class="btn" id="test">
|
||||
test
|
||||
</div>
|
||||
-->
|
||||
<div class="modal fade" id="myModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Modal title</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>One fine body…</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
|
||||
</div><!-- /.modal -->
|
||||
4
uVote/page/default_bulletin/comment.tpl
Normal file
4
uVote/page/default_bulletin/comment.tpl
Normal file
@ -0,0 +1,4 @@
|
||||
<div><font size="1">${timestamp}</font></div>
|
||||
<div>${c_txt}</div>
|
||||
<div><font size="2">${c_src}</font></div>
|
||||
<br>
|
||||
@ -55,6 +55,27 @@ class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function get_pro_comments (){
|
||||
$result = '';
|
||||
$vars = votes::getUserComments($this->poll_ID, 1);
|
||||
foreach($vars as $com){
|
||||
$com['c_txt'] = utf8_encode($com['c_txt']);
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/comment.tpl'), $com);
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
private function get_con_comments (){
|
||||
$result = '';
|
||||
$vars = votes::getUserComments($this->poll_ID, 2);
|
||||
|
||||
foreach($vars as $com){
|
||||
$com['c_txt'] = utf8_encode($com['c_txt']);
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/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);
|
||||
@ -174,12 +195,16 @@ class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
$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();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<h5>${urvote_party_table_desc}</h5>
|
||||
<div style="width: 500px; float: left">
|
||||
<div style="width: 500px;">
|
||||
<div style="float: left"><img src="${frontend_logos}icon_urn.png" width="30"/></div>
|
||||
<div style="float: left"></div>
|
||||
<div style="margin-left: 50px; float: left"><img src="${frontend_logos}icon_urn_pro.png" width="30"/></div>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div style="float: left; margin-right: 10px;">
|
||||
<div style="float: right; margin-right: 10px;">
|
||||
<div style="width: 50px; height: 20px;">
|
||||
<div class="badge badge-success" style="">${party_yes}%</div>
|
||||
<div class="badge badge-danger" style="">${party_no}%</div>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
Quelle: <a href="${iframe_link}">${iframe_link} </a>
|
||||
</div>
|
||||
<div class="span6" style="width: 50%;">
|
||||
<iframe src="${iframe_link}" width="730" height="650"></iframe>
|
||||
<iframe src="${iframe_link}" width="730" height="4000"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -36,18 +36,20 @@ $(document).ready(function() {
|
||||
//load_user_main_tab('user_main_uVote');
|
||||
});
|
||||
|
||||
$('#user_list').load('./?action=user_list', function(){
|
||||
$('#user_list').load('./?action=user_list', function(){
|
||||
$('#tabs_user_list a').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
load_user_list_tab($(this).attr('action'));
|
||||
|
||||
});
|
||||
$('.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();
|
||||
});
|
||||
$('#tabs_user_list a').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
load_user_list_tab($(this).attr('action'));
|
||||
});
|
||||
|
||||
|
||||
//load_user_main_tab('user_main_uVote');
|
||||
});
|
||||
@ -130,10 +132,22 @@ function load_user_list_tab(action){
|
||||
switch(action){
|
||||
|
||||
case 'user_list_active':
|
||||
$('#tab_active').load('./?action='+ action);
|
||||
$('#tab_active').load('./?action='+ action);
|
||||
$('.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();
|
||||
});
|
||||
return;
|
||||
case 'user_list_ended':
|
||||
$('#tab_ended').load('./?action='+ action);
|
||||
$('.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();
|
||||
});
|
||||
return;
|
||||
default:
|
||||
}
|
||||
@ -185,6 +199,22 @@ function vote_click (poll_ID, vote) {
|
||||
}
|
||||
});
|
||||
}
|
||||
function submit_c_data (poll_ID, c_choice) {
|
||||
var c_txt = document.getElementById("c_txt_pro").textContent;
|
||||
var c_src = document.getElementById("c_src_pro").textContent;
|
||||
alert(c_choice);
|
||||
$.getJSON('./api.php?call=vote&action=comment&poll_ID=' + poll_ID + '&c_choice=' + c_choice + '&c_txt=' + c_txt + '&c_src=' + c_src, function(data) {
|
||||
var items = [];
|
||||
if(data.status == true){
|
||||
alert("success");
|
||||
$('#user_main').load('./?action=open_bulletin&poll_ID=' + poll_ID, function(){
|
||||
open_vote(poll_ID);
|
||||
});
|
||||
} else {
|
||||
alert(data.result.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submit_add_data () {
|
||||
var a = document.getElementById("location");
|
||||
@ -244,9 +274,18 @@ function open_vote (poll_ID) {
|
||||
$('.btnvote_off').click(function () {
|
||||
vote_click($(this).attr('poll_ID'),3);
|
||||
});
|
||||
$('.submit_pro').click(function () {
|
||||
submit_c_data($(this).attr('poll_ID',1));
|
||||
alert('success');
|
||||
});
|
||||
$('.submit_con').click(function () {
|
||||
submit_c_data($(this).attr('poll_ID'));
|
||||
alert('success');
|
||||
});
|
||||
$('#test').click(function(){
|
||||
$('#myModal').modal();
|
||||
});
|
||||
|
||||
register_registerform();
|
||||
});
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
|
||||
<div id="site-content" style="padding: 0; margin: 0; margin-left: 40px;">
|
||||
|
||||
<div id="user_main" style="position: absolute; padding: 0; padding-top: 0px; width: 50%;"></div>
|
||||
<div id="user_main" style="position: absolute; padding: 0; padding-top: 0px; width: 49%;"></div>
|
||||
|
||||
<div id="user_list" style="padding: 0px; width: 50%; float: right;">
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ class user_list_ended extends SYSTEM\PAGE\Page {
|
||||
|
||||
public function generate_votelist(){
|
||||
$result = array('','');
|
||||
$votes = votes::getAllVotesOfGroup(1);
|
||||
$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']);
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
<div style="margin-left: 40px; float: left;">
|
||||
${user_temp_votes}
|
||||
</div>
|
||||
<div style="margin-left: 40px; float: left;">
|
||||
<br>
|
||||
<div style="margin-left: 40px; float: right;">
|
||||
${user_overall_votes}
|
||||
</div>
|
||||
<div id="graph_bt_user_overall" style=""></div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user