show poll

This commit is contained in:
Ulf Gebhardt 2015-09-30 22:57:02 +02:00
parent db92f5bb44
commit ec2b333a7a
12 changed files with 68 additions and 59 deletions

View File

@ -13,9 +13,6 @@ class api_uvote extends \SYSTEM\API\api_system {
public static function call_vote_action_feedback($feedback) {
return votes::write_feedback($feedback);}
public static function call_vote_action_open_vote($poll_ID) {
return votes::open_vote($poll_ID);}
public static function call_vote_action_barsperusers($poll_ID){
return votes::get_barsperusers($poll_ID);}

View File

@ -170,10 +170,4 @@ class votes {
new WARNING("feedback was added");
return JsonResult::ok();
}
public static function open_vote($poll_ID){
$vote = self::get_voteinfo($poll_ID); //votes::getVoteOfGroup($poll_ID);
$result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/tpl/full_vote.tpl'), $vote);
return $result;
}
}

View File

@ -8,6 +8,7 @@ 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_poll','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_active','');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/user_list_ended','');

View File

@ -174,38 +174,6 @@ function register_registerform(){
});
}
function open_vote (poll_ID) {
$('#user_list').load('./api.php?call=vote&action=open_vote&poll_ID=' + poll_ID, function(){
$('.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();
});
}
function loadAjaxContent(url) {
var dataTmp;
$.get(url, function (data) {

View File

@ -24,7 +24,9 @@ class page_uvote extends \SYSTEM\API\api_default {
public static function page_user_main_myVote(){
return (new user_main_myVote())->html();}
public static function page_user_main_poll($poll_ID) {
return (new user_main_poll($poll_ID))->html();}
public static function page_user_list(){
return (new user_list())->html();}

View File

@ -4,9 +4,9 @@ function init_user_list(){
});
$('.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();
//$('#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();
@ -18,21 +18,22 @@ function init_user_list_active(){
$('#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'))
//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();
})
$('#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'))
})
}

View File

@ -14,4 +14,34 @@ function init_myvote(){
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();
}

View File

@ -0,0 +1,13 @@
<?php
class user_main_poll extends SYSTEM\PAGE\Page {
private $poll_ID = null;
public function __construct($poll_ID){
$this->poll_ID = $poll_ID;
}
public function html(){
$vote = votes::get_voteinfo($this->poll_ID); //votes::getVoteOfGroup($poll_ID);
$result = SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'user_main_poll/tpl/full_vote.tpl'), $vote);
return $result;
}
}

View File

@ -8,6 +8,7 @@ class DATA_UVOTE extends \SYSTEM\DB\QI {
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/schema_uvote_votes_per_party.sql'),
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/schema_uvote_user_additional.sql'),
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_text.sql'),
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_page.sql'));
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_page.sql'),
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_api.sql'));
}
}

View File

@ -0,0 +1 @@
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (130, 1, 2, 1, 'user_main_poll', 'poll_ID', 'UINT');

View File

@ -1,2 +1,3 @@
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (10, 1, 'user_list', 'start', -1, 0, 0, '#user_list', './?page=user_list', 'init_user_list', 'user_list');
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (11, 1, 'user_main', 'start', -1, 0, 0, '#user_main', './?page=user_main', 'init_user_main', 'user_main');
INSERT INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (25, 1, 'poll', 'start', 11, 0, 1, '#tab_main', './?page=user_main_poll&poll_ID=${poll}', 'init_poll', 'user_main_poll');