comment
This commit is contained in:
parent
cc998349a8
commit
9d421ecb22
@ -15,6 +15,11 @@ class api_uvote extends \SYSTEM\API\api_login {
|
||||
|
||||
}
|
||||
|
||||
public static function call_vote_action_commentrate($c_ID, $val) {
|
||||
return votes::write_commentrate($c_ID, $val);
|
||||
|
||||
}
|
||||
|
||||
public static function call_vote_action_new_vote($ID, $title, $iframe_link) {
|
||||
return votes::write_poll($ID, $title, $iframe_link);
|
||||
|
||||
|
||||
@ -124,6 +124,9 @@ class votes {
|
||||
public static function get_user_count(){
|
||||
return \DBD\UVOTE_DATA_USER_COUNT_USERS::Q1(array());}
|
||||
|
||||
public static function get_commentrate($c_ID, $val){
|
||||
return \DBD\UVOTE_DATA_USER_COMMENTRATE_PER_COMMENT::Q1(array($c_ID, $val));}
|
||||
|
||||
public static function get_count_user_votes_per_poll($poll_ID){
|
||||
return \DBD\UVOTE_DATA_USER_COUNT_CHOICE_PER_POLL::Q1(array($poll_ID));}
|
||||
|
||||
@ -187,9 +190,14 @@ class votes {
|
||||
|
||||
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.");}
|
||||
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 write_commentrate($c_ID, $val){
|
||||
if(!\SYSTEM\SECURITY\Security::isLoggedIn()){
|
||||
throw new ERROR("You need to be logged in.");}
|
||||
return \DBD\UVOTE_DATA_USER_COMMENTRATE_INSERT::Q1(array($c_ID, \SYSTEM\SECURITY\Security::getUser()->id, $val));}
|
||||
|
||||
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_COMMENTRATE_INSERT.php
Normal file
12
uVote/dbd/qq/UVOTE_DATA_USER_COMMENTRATE_INSERT.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class UVOTE_DATA_USER_COMMENTRATE_INSERT extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'INSERT INTO `uvote_user_comments_additional` (`c_ID`, `user_ID`, `val`, `timestamp`)
|
||||
VALUES (?, ?, ?, NOW());'
|
||||
);}}
|
||||
11
uVote/dbd/qq/UVOTE_DATA_USER_COMMENTRATE_PER_COMMENT.php
Normal file
11
uVote/dbd/qq/UVOTE_DATA_USER_COMMENTRATE_PER_COMMENT.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace DBD;
|
||||
|
||||
class UVOTE_DATA_USER_COMMENTRATE_PER_COMMENT extends \SYSTEM\DB\QP {
|
||||
protected static function query(){
|
||||
return new \SYSTEM\DB\QQuery(get_class(),
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT COUNT(*) as count FROM uvote_user_comments_additional where c_ID = ? AND val = ?;'
|
||||
);}}
|
||||
@ -7,5 +7,5 @@ class UVOTE_GENERATE_COMMENTS_PER_POLL extends \SYSTEM\DB\QP {
|
||||
//pg
|
||||
'',
|
||||
//mys
|
||||
'SELECT * FROM `uvote_user_comments` WHERE `poll_ID` = ? AND c_choice = ? ORDER BY (txt_up-txt_down) ASC;'
|
||||
'SELECT * FROM `uvote_user_comments` WHERE `poll_ID` = ? AND c_choice = ? ORDER BY (txt_up-txt_down) ASC;'
|
||||
);}}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 386 KiB After Width: | Height: | Size: 60 KiB |
BIN
uVote/img/frontend_logos/cover2.png
Normal file
BIN
uVote/img/frontend_logos/cover2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 386 KiB |
@ -1,4 +1,15 @@
|
||||
<div style="float: left">
|
||||
<div><font size="1">${timestamp}</font></div>
|
||||
<div>${c_txt}</div>
|
||||
<div><font size="2">${c_src}</font></div>
|
||||
<br>
|
||||
<div style="">
|
||||
<font size="2">${nr_up}</font>
|
||||
<a class="btn btn-success btn-mini c_up" c_ID="${c_ID}"><i class="icon-white icon-thumbs-up"></i></a>
|
||||
<font size="2">${nr_down}</font>
|
||||
<a class="btn btn-danger btn-mini c_down" c_ID="${c_ID}"><i class="icon-white icon-thumbs-down"></i></a>
|
||||
<a class="btn btn-warning btn-mini c_spam" c_ID="${c_ID}"><i class="icon-white icon-exclamation-sign"></i></a>
|
||||
</div>
|
||||
<div><font size="1">Quelle:</font><font size="2">${c_src}</font></div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
@ -58,7 +58,9 @@ class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
private function get_pro_comments (){
|
||||
$result = '';
|
||||
$vars = votes::getUserComments($this->poll_ID, 1);
|
||||
|
||||
foreach($vars as $com){
|
||||
$com['count'] = votes::get_commentrate($com['c_ID'], 1);
|
||||
$com['c_txt'] = utf8_encode($com['c_txt']);
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/comment.tpl'), $com);
|
||||
}
|
||||
@ -67,9 +69,11 @@ class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
}
|
||||
private function get_con_comments (){
|
||||
$result = '';
|
||||
$vars = votes::getUserComments($this->poll_ID, 2);
|
||||
|
||||
$vars = votes::getUserComments($this->poll_ID, 2);
|
||||
|
||||
foreach($vars as $com){
|
||||
$com['count'] = votes::get_commentrate($com['c_ID'], 2);
|
||||
$com['nr_down'] = $c['count'];
|
||||
$com['c_txt'] = utf8_encode($com['c_txt']);
|
||||
$result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_bulletin/comment.tpl'), $com);
|
||||
}
|
||||
@ -185,6 +189,8 @@ class default_bulletin extends SYSTEM\PAGE\Page {
|
||||
private function css(){
|
||||
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_page\css\default_page.css').'" rel="stylesheet">';}
|
||||
|
||||
|
||||
|
||||
public function html(){
|
||||
$poll_expired = \DBD\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID));
|
||||
$user_vote = votes::getUserPollData($this->poll_ID);
|
||||
|
||||
4
uVote/page/default_comment/comment.tpl
Normal file
4
uVote/page/default_comment/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>
|
||||
87
uVote/page/default_comment/default_comment.php
Normal file
87
uVote/page/default_comment/default_comment.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
class default_comment 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_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 js(){
|
||||
return '<script src="'.SYSTEM\WEBPATH(new PPAGE(),'default_bulletin/js/vote.js').'"></script>';}
|
||||
private function css(){
|
||||
return '<link href="'.SYSTEM\WEBPATH(new PPAGE(),'default_page\css\default_page.css').'" rel="stylesheet">';}
|
||||
|
||||
public function html(){
|
||||
$poll_expired = \DBD\UVOTE_POLL_EXPIRED::Q1(array($this->poll_ID));
|
||||
$user_vote = votes::getUserPollData($this->poll_ID);
|
||||
|
||||
$vars = array();
|
||||
$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['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=img&cat=frontend_logos&id=';
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE));
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(150));
|
||||
$vars = array_merge($vars, \SYSTEM\locale::getStrings(100));
|
||||
|
||||
$vars = array_merge($vars,votes::get_voteinfo($this->poll_ID));
|
||||
return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_comment/comment.tpl'),$vars);
|
||||
}
|
||||
|
||||
}
|
||||
@ -45,11 +45,13 @@ $(document).ready(function() {
|
||||
});
|
||||
$('.btn_vote').click(function () {
|
||||
//vote_click($(this).attr('poll_ID'));
|
||||
$('#user_main').load('./?action=open_bulletin&poll_ID=' + $(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')).show();
|
||||
});
|
||||
|
||||
//load_user_main_tab('user_main_uVote');
|
||||
});
|
||||
@ -133,15 +135,22 @@ function load_user_list_tab(action){
|
||||
|
||||
case 'user_list_active':
|
||||
$('#tab_active').load('./?action='+ action, function(){
|
||||
$('.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();
|
||||
|
||||
})});
|
||||
return;
|
||||
case 'user_list_ended':
|
||||
$('#tab_ended').load('./?action='+ action, function(){
|
||||
$('.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'));
|
||||
@ -199,6 +208,18 @@ function vote_click (poll_ID, vote) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submit_commentrate (c_ID, val) {
|
||||
$.getJSON('./api.php?call=vote&action=commentrate&c_ID=' + c_ID + '&val=' + val, function(data) {
|
||||
var items = [];
|
||||
if(data.status == true){
|
||||
alert("success");
|
||||
} else {
|
||||
alert(data.result.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submit_c_data (poll_ID) {
|
||||
var c_txt = $("#c_txt_pro").val();
|
||||
var c_src = $("#c_src_pro").val();
|
||||
@ -280,6 +301,15 @@ function open_vote (poll_ID) {
|
||||
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();
|
||||
});
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<td class="${bt_vote_class}" style="width: 80px; margin-top: 10px; border-left: 1px solid lightgray;">
|
||||
<img src="${frontend_logos}icon_${party}.png" width="30"/><span class="badge badge-success" style="float:right;">${choice}</span><br/>
|
||||
<div class="${bt_vote_class}" style="width: 80px; margin-top: 10px; border-left: 1px solid lightgray;">
|
||||
<img src="${frontend_logos}icon_${party}.png" width="30"><span class="badge badge-success" style="float:right;">${choice}</span><br>
|
||||
|
||||
</td>
|
||||
</div>
|
||||
@ -1,27 +1,37 @@
|
||||
<table style="margin-bottom: 5px; width: 95%; height: 100px; border: solid lightgray 1px; background: beige;">
|
||||
<tr>
|
||||
<td style="padding: 5px; padding-top: 0;">
|
||||
<h5>${title}</h5>
|
||||
<img src="${frontend_logos}icon_urn_${vote_class}.png"/>
|
||||
<a class="btn btn-primary btn-small btn_vote" style="" poll_ID="${ID}">${full_vote_btn}</a>
|
||||
</td>
|
||||
<td class="${bt_vote_class}" style="width: 80px; margin-top: 5px; border-left: 1px solid lightgray; padding: 2px;">
|
||||
<img src="${frontend_logos}icon_bt.png" width="80"/>
|
||||
<div style="margin-bottom: 5px; width: 92%; min-height: 125px; border: solid lightgray 1px; background: beige;">
|
||||
<div style="float: left; width: 75%; padding: 5px; padding-top: 0;">
|
||||
<h5>${title}</h5>
|
||||
<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>
|
||||
<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}" style="float: left; width: 80px; border-left: 1px solid lightgray; padding-right: 2px; padding-left: 2px;">
|
||||
<img src="${frontend_logos}icon_bt.png" width="80">
|
||||
${bt}
|
||||
</td>
|
||||
<td class="${uv_vote_class}" style="width: 60px; height: 100%; border-left: 1px solid lightgray; padding: 2px;">
|
||||
<img src="${frontend_logos}icon_urn.png" width="20"/>
|
||||
<span style="float: right"><font size="2">uVote</font></span>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="${uv_vote_class}" style="float: left; height: 125px; width: 60px; border-left: 1px solid lightgray; padding-right: 2px; padding-left: 2px;">
|
||||
<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>
|
||||
|
||||
</td>
|
||||
<td style="margin: 0; padding: 0; width: 3px;" >
|
||||
<table class="poll_time" time="${time_end}" style="width: 100%; height: 100%; margin: 0; padding: 0;">
|
||||
<tr id="time_done" style="height: ${time_done}%; background: white; margin: 0; padding: 0;"><td style="width: 1px; margin: 0; padding: 0;"></td></tr>
|
||||
<tr id="time_left" style="height: ${time_left}%; background: blue; margin: 0; padding: 0;"><td style="width: 1px; margin: 0; padding: 0;"></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<span class="badge" style="">
|
||||
${uv_count}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin: 0; padding: 0; float: right;" >
|
||||
<div class="poll_time" time="${time_end}" style="width: 100%; height: 125px; margin: 0; padding: 0;">
|
||||
<div id="time_done" style="height: ${time_done}%; background: white; margin: 0; padding: 0;">
|
||||
<div style="width: 5px; margin: 0; padding: 0;">
|
||||
</div>
|
||||
</div>
|
||||
<div id="time_left" style="height: ${time_left}%; background: blue; margin: 0; padding: 0;">
|
||||
<div style="width: 5px; margin: 0; padding: 0;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1 +1 @@
|
||||
<img src="${frontend_logos}icon_${party}.png" width="30"/><span class="badge ${choice_class}" style="float:right;">${choice}</span><br/>
|
||||
<img src="${frontend_logos}icon_${party}.png" width="30"><span class="badge ${choice_class}" style="float:right;">${choice}</span><br>
|
||||
@ -1,5 +1,6 @@
|
||||
<div style="width: 50%; padding: 60px;">
|
||||
<img src="${frontend_logos}logo2.png"/>
|
||||
<img src="${frontend_logos}logo2.png"/>
|
||||
<img src="${frontend_logos}cover.png"/>
|
||||
<br />
|
||||
<br />
|
||||
<form class="textbox" id="register_user_form">
|
||||
|
||||
@ -3,10 +3,11 @@ 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_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','');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user