X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fsurvey%2Fsurvey.inc.php;h=6d8a41028df2e7b01ad5f166f299fafba8e764e9;hb=1bf36cd12647c3d2eb8f9ec2a1f0eaad0b5f7e81;hp=5c6a109c15d1cc1a86885a1df18b9b3eda9b62d4;hpb=684195f33b11e3067200dd3a9e14304bd7d04463;p=platal.git diff --git a/modules/survey/survey.inc.php b/modules/survey/survey.inc.php index 5c6a109..6d8a410 100644 --- a/modules/survey/survey.inc.php +++ b/modules/survey/survey.inc.php @@ -190,7 +190,7 @@ class Survey $nbf = count($line); $users = array(); if ($this->isMode(self::MODE_XIDENT)) { // if the mode is non anonymous - $users = User::getBulkUsersWithUIDs(XDB::fetchAllAssoc('vid', 'SELECT v.id AS vid, v.user_id + $users = User::getBulkUsersWithUIDs(XDB::fetchAllAssoc('vid', 'SELECT v.id AS vid, v.uid FROM survey_votes AS v WHERE v.survey_id = {?} ORDER BY vid ASC', @@ -433,8 +433,8 @@ class Survey // {{{ functions vote() and hasVoted() : handles vote to a survey public function vote($uid, $args) { - XDB::execute('INSERT INTO survey_votes - SET survey_id={?}, user_id={?};', $this->id, $uid); // notes the user as having voted + XDB::execute('INSERT INTO survey_votes + SET survey_id = {?}, uid = {?};', $this->id, $uid); // notes the user as having voted $vid = XDB::insertId(); for ($i = 0; $i < count($this->questions); $i++) { $ans = $this->questions[$i]->checkAnswer($args[$i]); @@ -451,9 +451,9 @@ class Survey public function hasVoted($uid) { - $res = XDB::query('SELECT id - FROM survey_votes - WHERE survey_id={?} AND user_id={?};', $this->id, $uid); // checks whether the user has already voted + $res = XDB::query('SELECT id + FROM survey_votes + WHERE survey_id = {?} AND uid = {?};', $this->id, $uid); // checks whether the user has already voted return ($res->numRows() != 0); } // }}}