From cd212755432a2573ad1b6b7953d33478e6349cc7 Mon Sep 17 00:00:00 2001 From: Nael Date: Fri, 7 Mar 2014 19:41:08 +0100 Subject: [PATCH] my_vote implemented --- uVote/api/api_uvote.php | 4 + uVote/api/votes/votes.php | 11 +- uVote/dbd/qq/UVOTE_DATA_USER_ADD_DATA.php | 11 ++ .../qq/UVOTE_DATA_USER_ADD_DATA_INSERT.php | 12 ++ uVote/page/default_page/js/loadtexts.js | 29 ++- uVote/page/default_page/page.tpl | 2 +- uVote/page/user_main_myVote/myVote.tpl | 175 ++++++++++++++++-- .../user_main_myVote/user_main_myVote.php | 25 ++- uVote/page/user_main_urVote/urVote.tpl | 2 + 9 files changed, 251 insertions(+), 20 deletions(-) create mode 100644 uVote/dbd/qq/UVOTE_DATA_USER_ADD_DATA.php create mode 100644 uVote/dbd/qq/UVOTE_DATA_USER_ADD_DATA_INSERT.php diff --git a/uVote/api/api_uvote.php b/uVote/api/api_uvote.php index 0341952..de2bbfe 100644 --- a/uVote/api/api_uvote.php +++ b/uVote/api/api_uvote.php @@ -4,6 +4,10 @@ class api_uvote extends \SYSTEM\API\api_login { public static function call_vote_action_vote($poll_ID, $vote) { return votes::write_vote($poll_ID, $vote); + } + public static function call_vote_action_data($location, $birthyear, $gender, $children) { + return votes::write_data($location, $birthyear, $gender, $children); + } public static function call_vote_action_new_vote($ID, $title, $iframe_link) { diff --git a/uVote/api/votes/votes.php b/uVote/api/votes/votes.php index b7509dd..ee64d1c 100644 --- a/uVote/api/votes/votes.php +++ b/uVote/api/votes/votes.php @@ -167,11 +167,20 @@ class votes { $res = $con->prepare( 'insertVote', 'REPLACE uvote_data - VALUES (?, ?, ?, 0, NOW());', + VALUES (?, ?, ?, 0, NOW());', array($poll_ID, \SYSTEM\SECURITY\Security::getUser()->id, $vote)); return JsonResult::ok(); } + public static function write_data($location, $birthyear, $gender, $children){ + if(!\SYSTEM\SECURITY\Security::isLoggedIn()){ + 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 get_add_data(){ + return \DBD\UVOTE_DATA_USER_ADD_DATA::Q1(array(\SYSTEM\SECURITY\Security::getUser()->id)); + } + public static function write_poll($ID, $title, $iframe_link ){ $con = new \SYSTEM\DB\Connection(new \DBD\uVote()); $res = $con->prepare( 'insertPoll', diff --git a/uVote/dbd/qq/UVOTE_DATA_USER_ADD_DATA.php b/uVote/dbd/qq/UVOTE_DATA_USER_ADD_DATA.php new file mode 100644 index 0000000..0113d2c --- /dev/null +++ b/uVote/dbd/qq/UVOTE_DATA_USER_ADD_DATA.php @@ -0,0 +1,11 @@ + uVote - impressum + impressum \ No newline at end of file