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