Skip to content
Snippets Groups Projects
Commit 3d0e167e authored by Olivier PEREZ's avatar Olivier PEREZ
Browse files

Clean a lot of adminstuds.php

parent 46ea697c
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -37,5 +37,11 @@ class FramaDB
function query($sql) {
return $this->pdo->query($sql);
}
function allComments($poll_id) {
$prepared = $this->prepare('SELECT * FROM comments WHERE id_sondage=? ORDER BY id_comment');
$prepared->execute(array($poll_id));
return $prepared->fetchAll();
}
}
......@@ -58,8 +58,19 @@ function ajouter_sondage($title, $comment, $adminName, $adminMail, $format, $edi
$prepared = $connect->prepare('INSERT INTO sujet_studs (id_sondage, sujet) VALUES (?, ?)');
foreach ($choices as $choice) {
$joinedSlots = '';
foreach ($choice->getSlots() as $slot) {
$prepared->execute(array($poll_id, $choice->getName().'@'.$slot));
if ($first) {
$joinedSlots = $slot;
$first = false;
} else {
$joinedSlots .= ',' . $slot;
}
}
if (empty($joinedSlots)) {
$prepared->execute(array($poll_id, $choice->getName()));
} else {
$prepared->execute(array($poll_id, $choice->getName().'@'.$joinedSlots));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment