admin: Display buttons to add or remove choice.
This commit is contained in:
parent
ff61cf6b91
commit
3166752410
@ -255,85 +255,10 @@ if (isset($_POST['ajoutercolonne']) && $dsondage->format == 'D') {
|
||||
// [end] action quand on ajoute une colonne au format DATE
|
||||
|
||||
|
||||
//suppression de ligne dans la base
|
||||
for ($i = 0; $i < $nblignes; $i++) {
|
||||
if (isset($_POST["effaceligne$i"])) {
|
||||
$compteur=0;
|
||||
$prepared = $connect->prepare('DELETE FROM user_studs WHERE nom = ? AND id_users = ?');
|
||||
|
||||
foreach ($users as $user) {
|
||||
if ($compteur==$i){
|
||||
$prepared->execute(array($user->nom, $user->id_users));
|
||||
}
|
||||
|
||||
$compteur++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO OPZ Revoir toute cette partie suppression d'un commentaire utilisateur
|
||||
/*$sql = 'SELECT * FROM comments WHERE id_sondage='.$connect->Param('numsondage').' ORDER BY id_comment';
|
||||
$sql = $connect->Prepare($sql);
|
||||
$comment_user = $connect->Execute($sql, array($poll_id));
|
||||
$i = 0;
|
||||
while ($dcomment = $comment_user->FetchNextObject(false)) {
|
||||
if (isset($_POST['suppressioncomment'.$i])) {
|
||||
$sql = 'DELETE FROM comments WHERE id_comment = '.$connect->Param('id_comment');
|
||||
$sql = $connect->Prepare($sql);
|
||||
$connect->Execute($sql, array($dcomment->id_comment));
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
*/
|
||||
|
||||
//on teste pour voir si une ligne doit etre modifiée
|
||||
$testmodifier = false;
|
||||
$testligneamodifier = false;
|
||||
|
||||
for ($i = 0; $i < $nblignes; $i++) {
|
||||
if (isset($_POST["modifierligne$i"])) {
|
||||
$ligneamodifier=$i;
|
||||
$testligneamodifier="true";
|
||||
}
|
||||
|
||||
//test pour voir si une ligne est a modifier
|
||||
if (isset($_POST["validermodifier$i"])) {
|
||||
$modifier=$i;
|
||||
$testmodifier="true";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//si le test est valide alors on affiche des checkbox pour entrer de nouvelles valeurs
|
||||
if ($testmodifier) {
|
||||
$nouveauchoix = '';
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
// radio checked 1 = Yes, 2 = Ifneedbe, 0 = No
|
||||
if (isset($_POST["choix$i"])) {
|
||||
switch ($_POST["choix$i"]) {
|
||||
case 1: $nouveauchoix .= "1";break;
|
||||
case 2: $nouveauchoix .= "2";break;
|
||||
default: $nouveauchoix .= "0";break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$compteur=0;
|
||||
|
||||
while ($data=$user_studs->FetchNextObject(false)) {
|
||||
//mise a jour des données de l'utilisateur dans la base SQL
|
||||
if ($compteur==$modifier) {
|
||||
$sql = 'UPDATE user_studs SET reponses = '.$connect->Param('reponses').' WHERE nom = '.$connect->Param('nom').' AND id_users = '.$connect->Param('id_users');
|
||||
$sql = $connect->Prepare($sql);
|
||||
$connect->Execute($sql, array($nouveauchoix, $data->nom, $data->id_users));
|
||||
}
|
||||
|
||||
$compteur++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//suppression de colonnes dans la base
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
@ -389,185 +314,6 @@ for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
}
|
||||
|
||||
|
||||
// TODO OPZ Déjà fait en début de fichier recuperation des donnes de la base
|
||||
/*$sql = 'SELECT * FROM sondage WHERE id_sondage_admin = '.$connect->Param('numsondageadmin');
|
||||
$sql = $connect->Prepare($sql);
|
||||
$sondage = $connect->Execute($sql, array($admin_poll_id));
|
||||
|
||||
if ($sondage !== false) {
|
||||
$sql = 'SELECT * FROM sujet_studs WHERE id_sondage = '.$connect->Param('numsondage');
|
||||
$sql = $connect->Prepare($sql);
|
||||
$sujets = $connect->Execute($sql, array($poll_id));
|
||||
|
||||
$sql = 'SELECT * FROM user_studs WHERE id_sondage = '.$connect->Param('numsondage').' order by id_users';
|
||||
$sql = $connect->Prepare($sql);
|
||||
$user_studs = $connect->Execute($sql, array($poll_id));
|
||||
} else {
|
||||
|
||||
Utils::print_header(_("Error!"));
|
||||
bandeau_titre(_("Error!"));
|
||||
|
||||
echo '
|
||||
<div class="alert alert-warning">
|
||||
<h2>' . _("This poll doesn't exist !") . '</h2>
|
||||
<p>' . _('Back to the homepage of ') . ' <a href="' . Utils::get_server_name() . '"> ' . NOMAPPLICATION . '</a></p>
|
||||
</div>'."\n";
|
||||
|
||||
bandeau_pied();
|
||||
|
||||
die();
|
||||
}*/
|
||||
|
||||
// Errors
|
||||
$errors = '';
|
||||
if ((isset($_POST["boutonp"])) && $_POST["nom"] == "") {
|
||||
$errors .= '<li>' . _("Enter a name") . '</li>';
|
||||
}
|
||||
if (isset($erreur_prenom) && $erreur_prenom) {
|
||||
$errors .= '<li>' . _("The name you've chosen already exist in this poll!") . '</li>';
|
||||
}
|
||||
if (isset($erreur_injection) && $erreur_injection) {
|
||||
$errors .= '<li>' . _("Characters \" ' < et > are not permitted") . '</li>';
|
||||
}
|
||||
if (isset($erreur_ajout_date) && $erreur_ajout_date) {
|
||||
$errors .= '<li>' . _("The date is not correct !") . '</li>';
|
||||
}
|
||||
|
||||
//Poll title, description and email values
|
||||
$title = (isset($_POST["boutonnouveautitre"]) && !empty($_POST['nouveautitre'])) ? htmlentities(html_entity_decode($_POST['nouveautitre'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8') : stripslashes( $poll->title);
|
||||
$description = (isset($_POST["nouveauxcommentaires"])) ? stripslashes(htmlentities(html_entity_decode($_POST['nouveauxcommentaires'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8')) : stripslashes( $poll->comment);
|
||||
$email_admin = (isset($_POST["boutonnouvelleadresse"]) && !empty($_POST['nouvelleadresse'])) ? htmlentities(html_entity_decode($_POST['nouvelleadresse'], ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8') : stripslashes( $poll->admin_mail );
|
||||
|
||||
//Poll format (locked A-/D-, open A/D, editable A+/D+)
|
||||
$poll_rules = (isset($_POST["poll_rules"]) && !empty($_POST['btn_poll_rules'])) ? $_POST["poll_rules"] : substr($poll->format, 1, 1); // TODO OPZ Handle comment disabling
|
||||
$poll_rules_opt1 = '';$poll_rules_opt2 = '';$poll_rules_opt3 = '';
|
||||
if($poll->editable) {
|
||||
$poll_rules_text = '<span class="glyphicon glyphicon-edit"></span> '. _("Votes are editable");
|
||||
$poll_rules_opt3 = 'selected';
|
||||
} elseif($poll_rules == '-') {
|
||||
$poll_rules_text = '<span class="glyphicon glyphicon-lock"></span> '. _("Votes and comments are locked");
|
||||
$poll_rules_opt1 = 'selected';
|
||||
} else {
|
||||
$poll_rules_text = '<span class="glyphicon glyphicon-check"></span> '. _("Votes and comments are open");
|
||||
$poll_rules_opt2 = 'selected';
|
||||
}
|
||||
|
||||
if ($errors!='') {
|
||||
Utils::print_header(_("Error!"));
|
||||
bandeau_titre(_("Error!"));
|
||||
|
||||
echo '<div class="alert alert-danger"><ul class="list-unstyled">'.$errors.'</ul></div>'."\n";
|
||||
|
||||
} else {
|
||||
Utils::print_header(_('Poll administration').' - '.$title);
|
||||
bandeau_titre(_('Poll administration').' - '.$title);
|
||||
|
||||
// session_unset();
|
||||
}
|
||||
|
||||
echo '
|
||||
<form name="formulaire4" action="' . Utils::getUrlSondage($admin_poll_id, true) . '" method="POST">
|
||||
<div class="jumbotron bg-danger">
|
||||
<div class="row">
|
||||
<div class="col-md-7" id="title-form">
|
||||
<h3>'.$title.'<button class="btn btn-link btn-sm btn-edit" title="'. _('Edit the title') .'"> <span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span></button></h3>
|
||||
<div class="hidden js-title">
|
||||
<label class="sr-only" for="newtitle">'. _("Title") .'</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="newtitle" name="nouveautitre" size="40" value="'.$title.'" />
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-success" name="boutonnouveautitre" value="1" title="'. _('Save the new title') .'"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">' . _('Save') . '</span></button>
|
||||
<button class="btn btn-link btn-cancel" title="'. _('Cancel the title edit') .'"><span class="glyphicon glyphicon-remove"></span><span class="sr-only">' . _('Cancel') . '</span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="btn-group pull-right">
|
||||
<button onclick="javascript:print(); return false;" class="btn btn-default"><span class="glyphicon glyphicon-print"></span> ' . _('Print') . '</button>
|
||||
<button onclick="window.location.href=\'' . Utils::get_server_name() . 'exportcsv.php?numsondage=' . $poll_id . '\';return false;" class="btn btn-default"><span class="glyphicon glyphicon-download-alt"></span> ' . _('Export to CSV') . '</button>
|
||||
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="glyphicon glyphicon-trash"></span> <span class="sr-only">' . _("Remove") . '</span> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><button class="btn btn-link" type="submit" name="removevotes">' . _('Remove all the votes') . '</button></li>
|
||||
<li><button class="btn btn-link" type="submit" name="removecomments">' . _('Remove all the comments') . '</button></li>
|
||||
<li class="divider" role="presentation"></li>
|
||||
<li><button class="btn btn-link" type="submit" id="suppressionsondage" name="suppressionsondage" value="" >'. _("Remove the poll") .'</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group" >
|
||||
<div id="author-form">
|
||||
<h4 class="control-label">'. _("Initiator of the poll") .'</h4>
|
||||
<p> '.stripslashes($poll->admin_name).'</p>
|
||||
</div>
|
||||
<div id="email-form">
|
||||
<p>'.$email_admin.'<button class="btn btn-link btn-sm btn-edit" title="'. _('Edit the email adress') .'"><span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span></button></p>
|
||||
<div class="hidden js-email">
|
||||
<label class="sr-only" for="newemail">'. _("Email adress") .'</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="newemail" name="nouvelleadresse" size="40" value="'.$email_admin.'" />
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" name="boutonnouvelleadresse" value="1" class="btn btn-success" title="'. _('Save the email address ') .'"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">' . _('Save') . '</span></button>
|
||||
<button class="btn btn-link btn-cancel" title="'. _('Cancel the email address edit') .'"><span class="glyphicon glyphicon-remove"></span><span class="sr-only">' . _('Cancel') . '</span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-7" id="description-form">
|
||||
<h4 class="control-label">'._("Description") .'</h4><button class="btn btn-link btn-sm btn-edit" title="'. _('Edit the description') .'"><span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span></button><br />
|
||||
<p class="well">'.$description.'</p>
|
||||
<div class="hidden js-desc text-right">
|
||||
<label class="sr-only" for="newdescription">'._("Description") .'</label>
|
||||
<textarea class="form-control" id="newdescription" name="nouveauxcommentaires" rows="2" cols="40">'.$description.'</textarea>
|
||||
<button type="submit" id="btn-new-desc" name="boutonnouveauxcommentaires" value="1" class="btn btn-sm btn-success" title="'. _("Save the description") .'">'. _("Save") .'</button>
|
||||
<button class="btn btn-default btn-sm btn-cancel" title="'. _('Cancel the description edit') .'">'. _('Cancel') .'</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-5">
|
||||
<label for="public-link"><a class="public-link" href="' . Utils::getUrlSondage($poll->poll_id) . '">'._("Public link of the poll") .' <span class="btn-link glyphicon glyphicon-link"></span></a></label>
|
||||
<input class="form-control" id="public-link" type="text" readonly="readonly" value="' . Utils::getUrlSondage($poll->poll_id) . '" />
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="admin-link"><a class="admin-link" href="' . Utils::getUrlSondage($admin_poll_id, true) . '">'._("Admin link of the poll") .' <span class="btn-link glyphicon glyphicon-link"></span></a></label>
|
||||
<input class="form-control" id="admin-link" type="text" readonly="readonly" value="' . Utils::getUrlSondage($admin_poll_id, true) . '" />
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<h4 class="control-label">'. _("Expiration's date") .'</h4>
|
||||
<p>'.date("d/m/Y",strtotime($poll->end_date)).'</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-5 col-md-offset-7" >
|
||||
<div id="poll-rules-form">
|
||||
<p class="pull-right">'.$poll_rules_text.'<button class="btn btn-link btn-sm btn-edit" title="'. _('Edit the poll rules') .'"><span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span></button></p>
|
||||
<div class="hidden js-poll-rules">
|
||||
<label class="sr-only" for="newrules">'. _("Poll rules") .'</label>
|
||||
<div class="input-group">
|
||||
<select class="form-control" id="newrules" name="poll_rules">
|
||||
<option value="-" '.$poll_rules_opt1.'>'. _("Votes and comments are locked") .'</option>
|
||||
<option value="0" '.$poll_rules_opt2.'>'. _("Votes and comments are open") .'</option>
|
||||
<option value="+" '.$poll_rules_opt3.'>'. _("Votes are editable") .'</option>
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" name="btn_poll_rules" value="1" class="btn btn-success" title="'. _('Save the new rules') .'"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">' . _('Save') . '</span></button>
|
||||
<button class="btn btn-link btn-cancel" title="'. _('Cancel the rules edit') .'"><span class="glyphicon glyphicon-remove"></span><span class="sr-only">' . _('Cancel') . '</span></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>'."\n"; // .jumbotron
|
||||
|
||||
// Table headers
|
||||
$thead = '<thead>';
|
||||
@ -699,278 +445,3 @@ if ($poll->format == "D") {
|
||||
}
|
||||
|
||||
// Print headers
|
||||
echo '
|
||||
<form name="formulaire" action="' . Utils::getUrlSondage($admin_poll_id, true) . '" method="POST">
|
||||
|
||||
<div class="alert alert-info">
|
||||
<p>' . _('As poll administrator, you can change all the lines of this poll with this button ').'<span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span>,
|
||||
' . _(' remove a column or a line with ') . '<span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">' . _('Remove') . '</span>
|
||||
' . _('and add a new column with '). '<span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">'. _('Add a column') . '</span></p>
|
||||
<p>' . _('Finally, you can change the informations of this poll like the title, the comments or your email address.') . '</p>
|
||||
<p aria-hidden="true"><b>' . _('Legend:'). '</b> <span class="glyphicon glyphicon-ok"></span> =' . _('Yes') . ', <b>(<span class="glyphicon glyphicon-ok"></span>)</b> = ' . _('Ifneedbe') . ', <span class="glyphicon glyphicon-ban-circle"></span> = ' . _('No') . '</p>
|
||||
</div>
|
||||
|
||||
<div class="hidden row scroll-buttons" aria-hidden="true">
|
||||
<div class="btn-group pull-right">
|
||||
<button class="btn btn-sm btn-link scroll-left" title="' . _('Scroll to the left') . '">
|
||||
<span class="glyphicon glyphicon-chevron-left"></span>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-link scroll-right" title="' . _('Scroll to the right') . '">
|
||||
<span class="glyphicon glyphicon-chevron-right"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>'._('Votes of the poll ').'</h3>
|
||||
<div id="tableContainer" class="tableContainer">
|
||||
<table class="results">
|
||||
<caption class="sr-only">'._('Votes of the poll ').$title.'</caption>
|
||||
<thead>'. $thead . '</thead>
|
||||
<tbody>';
|
||||
|
||||
// Print poll results
|
||||
$somme[] = 0;
|
||||
$compteur = 0;
|
||||
|
||||
foreach($users as $user) {
|
||||
|
||||
$ensemblereponses = $user->reponses;
|
||||
|
||||
// Print name
|
||||
echo '<tr>
|
||||
<th class="bg-info">'.stripslashes($user->nom).'</th>'."\n";
|
||||
|
||||
// si la ligne n'est pas a changer, on affiche les données
|
||||
if (!$testligneamodifier) {
|
||||
for ($k = 0; $k < $nbcolonnes; $k++) {
|
||||
$rbd = ($border[$k]) ? ' rbd' : '';
|
||||
$car = substr($ensemblereponses, $k, 1);
|
||||
switch ($car) {
|
||||
case "1": echo '<td class="bg-success text-success'.$rbd.'" headers="'.$td_headers[$k].'"><span class="glyphicon glyphicon-ok"></span><span class="sr-only"> ' . _('Yes') . '</span></td>'."\n";
|
||||
if (isset($somme[$k]) === false) {
|
||||
$somme[$k] = 0;
|
||||
}
|
||||
$somme[$k]++; break;
|
||||
case "2": echo '<td class="bg-warning text-warning'.$rbd.'" headers="'.$td_headers[$k].'">(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only"> ' . _('Yes') . _(', ifneedbe') . '</span></td>'."\n"; break;
|
||||
default: echo '<td class="bg-danger'.$rbd.'" headers="'.$td_headers[$k].'"><span class="sr-only">' . _('No') . '</span></td>'."\n";break;
|
||||
}
|
||||
}
|
||||
} else { // sinon on remplace les choix de l'utilisateur par une ligne de radio pour recuperer de nouvelles valeurs
|
||||
// si c'est bien la ligne a modifier on met les radios
|
||||
if ($compteur == "$ligneamodifier") {
|
||||
for ($j = 0; $j < $nbcolonnes; $j++) {
|
||||
|
||||
$car = substr($ensemblereponses, $j, 1);
|
||||
|
||||
// variable pour afficher la valeur cochée
|
||||
$car_html[0]='value="0"';$car_html[1]='value="1"';$car_html[2]='value="2"';
|
||||
switch ($car) {
|
||||
case "1": $car_html[1]='value="1" checked';break;
|
||||
case "2": $car_html[2]='value="2" checked';break;
|
||||
default: $car_html[0]='value="0" checked';break;
|
||||
}
|
||||
|
||||
echo '
|
||||
<td class="bg-info" headers="'.$td_headers[$j].'">
|
||||
<ul class="list-unstyled choice">
|
||||
<li class="yes">
|
||||
<input type="radio" id="y-choice-'.$j.'" name="choix'.$j.'" '.$car_html[1].' />
|
||||
<label class="btn btn-default btn-xs" for="y-choice-'.$j.'" title="' . _('Vote "yes" for ') . $radio_title[$j] . '">
|
||||
<span class="glyphicon glyphicon-ok"></span><span class="sr-only">' . _('Yes') . '</span>
|
||||
</label>
|
||||
</li>
|
||||
<li class="ifneedbe">
|
||||
<input type="radio" id="i-choice-'.$j.'" name="choix'.$j.'" '.$car_html[2].' />
|
||||
<label class="btn btn-default btn-xs" for="i-choice-'.$j.'" title="' . _('Vote "ifneedbe" for ') . $radio_title[$j] . '">
|
||||
(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">' . _('Ifneedbe') . '</span>
|
||||
</label>
|
||||
</li>
|
||||
<li class="no">
|
||||
<input type="radio" id="n-choice-'.$j.'" name="choix'.$j.'" '.$car_html[0].'/>
|
||||
<label class="btn btn-default btn-xs" for="n-choice-'.$j.'" title="' . _('Vote "no" for ') . $radio_title[$j] . '">
|
||||
<span class="glyphicon glyphicon-ban-circle"></span><span class="sr-only">' . _('No') . '</span>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</td>'."\n";
|
||||
|
||||
}
|
||||
} else { //sinon on affiche les lignes normales
|
||||
for ($k = 0; $k < $nbcolonnes; $k++) {
|
||||
$rbd = ($border[$k]) ? ' rbd' : '';
|
||||
$car = substr($ensemblereponses, $k, 1);
|
||||
switch ($car) {
|
||||
case "1": echo '<td class="bg-success text-success'.$rbd.'" headers="'.$td_headers[$k].'"><span class="glyphicon glyphicon-ok"></span><span class="sr-only"> ' . _('Yes') . '</span></td>'."\n";
|
||||
if (isset($somme[$k]) === false) {
|
||||
$somme[$k] = 0;
|
||||
}
|
||||
$somme[$k]++; break;
|
||||
case "2": echo '<td class="bg-warning text-warning'.$rbd.'" headers="'.$td_headers[$k].'">(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only"> ' . _('Yes') . _(', ifneedbe') . '</span></td>'."\n"; break;
|
||||
default: echo '<td class="bg-danger'.$rbd.'" headers="'.$td_headers[$k].'"><span class="sr-only">' . _('No') . '</span></td>'."\n";break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//a la fin de chaque ligne se trouve les boutons modifier
|
||||
if (!$testligneamodifier=="true") {
|
||||
echo '
|
||||
<td>
|
||||
<button type="submit" class="btn btn-link btn-sm" name="modifierligne'.$compteur.'" title="'. _('Edit the line:') .' '.stripslashes($nombase).'">
|
||||
<span class="glyphicon glyphicon-pencil"></span><span class="sr-only">' . _('Edit') . '</span>
|
||||
</button>
|
||||
<button type="submit" name="effaceligne'.$compteur.'" title="'. _('Remove the line:') .' '.stripslashes($nombase).'" class="btn btn-link btn-sm">
|
||||
<span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">' . _('Remove') . '</span>
|
||||
</button>
|
||||
</td>'."\n";
|
||||
}
|
||||
|
||||
//demande de confirmation pour modification de ligne
|
||||
for ($i = 0; $i < $nblignes; $i++) {
|
||||
if (isset($_POST["modifierligne$i"])) {
|
||||
if ($compteur == $i) {
|
||||
echo '<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="validermodifier'.$compteur.'" title="'. _('Save the choices') .' '.stripslashes($nombase).'">'. _('Save') .'</button></td>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$compteur++;
|
||||
echo '</tr>'."\n";
|
||||
}
|
||||
|
||||
if (!$testligneamodifier=="true") {
|
||||
//affichage de la case vide de texte pour un nouvel utilisateur
|
||||
echo '<tr id="vote-form">
|
||||
<td class="bg-info" style="padding:5px">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
|
||||
<input type="text" id="nom" name="nom" class="form-control" title="'. _('Your name') .'" placeholder="'. _('Your name') .'" />
|
||||
</div>
|
||||
</td>'."\n";
|
||||
|
||||
//une ligne de checkbox pour le choix du nouvel utilisateur
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
echo '
|
||||
<td class="bg-info" headers="'.$td_headers[$i].'">
|
||||
<ul class="list-unstyled choice">
|
||||
<li class="yes">
|
||||
<input type="radio" id="y-choice-'.$i.'" name="choix'.$i.'" value="1" />
|
||||
<label class="btn btn-default btn-xs" for="y-choice-'.$i.'" title="' . _('Vote "yes" for ') . $radio_title[$i] . '">
|
||||
<span class="glyphicon glyphicon-ok"></span><span class="sr-only">' . _('Yes') . '</span>
|
||||
</label>
|
||||
</li>
|
||||
<li class="ifneedbe">
|
||||
<input type="radio" id="i-choice-'.$i.'" name="choix'.$i.'" value="2" />
|
||||
<label class="btn btn-default btn-xs" for="i-choice-'.$i.'" title="' . _('Vote "ifneedbe" for ') . $radio_title[$i] . '">
|
||||
(<span class="glyphicon glyphicon-ok"></span>)<span class="sr-only">' . _('Ifneedbe') . '</span>
|
||||
</label>
|
||||
</li>
|
||||
<li class="no">
|
||||
<input type="radio" id="n-choice-'.$i.'" name="choix'.$i.'" value="0" checked/>
|
||||
<label class="btn btn-default btn-xs" for="n-choice-'.$i.'" title="' . _('Vote "no" for ') . $radio_title[$i] . '">
|
||||
<span class="glyphicon glyphicon-ban-circle"></span><span class="sr-only">' . _('No') . '</span>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</td>'."\n";
|
||||
}
|
||||
|
||||
// Affichage du bouton de formulaire pour inscrire un nouvel utilisateur dans la base
|
||||
echo '<td><button type="submit" class="btn btn-success btn-sm" name="boutonp" title="'. _('Save the choices') .'">'. _('Save') .'</button></td>
|
||||
</tr>'."\n";
|
||||
|
||||
}
|
||||
|
||||
// Addition and Best choice
|
||||
//affichage de la ligne contenant les sommes de chaque colonne
|
||||
$tr_addition = '<tr id="addition"><td>'. _("Addition") .'</td>';
|
||||
$meilleurecolonne = max($somme);
|
||||
$compteursujet = 0;
|
||||
$meilleursujet = '<ul style="list-style:none">';
|
||||
for ($i = 0; $i < $nbcolonnes; $i++) {
|
||||
if (isset($somme[$i]) && $somme[$i] > 0 ) {
|
||||
if (in_array($i, array_keys($somme, max($somme)))){
|
||||
|
||||
$tr_addition .= '<td><span class="glyphicon glyphicon-star text-warning"></span><span>'.$somme[$i].'</span></td>';
|
||||
|
||||
$meilleursujet.= '<li><b>'.$radio_title[$i].'</b></li>';
|
||||
$compteursujet++;
|
||||
|
||||
} else {
|
||||
$tr_addition .= '<td>'.$somme[$i].'</td>';
|
||||
}
|
||||
} else {
|
||||
$tr_addition .= '<td></td>';
|
||||
}
|
||||
}
|
||||
$tr_addition .= '<td></td></tr>';
|
||||
|
||||
$meilleursujet = str_replace("°", "'", $meilleursujet).'</ul>';
|
||||
$vote_str = ($meilleurecolonne > 1) ? $vote_str = _('votes') : _('vote');
|
||||
|
||||
// Print Addition and Best choice
|
||||
echo $tr_addition.'
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row">'."\n";
|
||||
|
||||
if ($compteursujet == 1) {
|
||||
echo '
|
||||
<div class="col-sm-12"><h3>' . _("Best choice") . '</h3></div>
|
||||
<div class="col-sm-6 col-sm-offset-3 alert alert-success">
|
||||
<p><span class="glyphicon glyphicon-star text-warning"></span> ' . _("The best choice at this time is:") . '</p>
|
||||
' . $meilleursujet . '
|
||||
<p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . '.</p>
|
||||
</div>'."\n";
|
||||
} elseif ($compteursujet > 1) {
|
||||
echo '
|
||||
<div class="col-sm-12"><h3>' . _("Best choices") . '</h3></div>
|
||||
<div class="col-sm-6 col-sm-offset-3 alert alert-success">
|
||||
<p><span class="glyphicon glyphicon-star text-warning"></span> ' . _("The bests choices at this time are:") . '</p>
|
||||
' . $meilleursujet . '
|
||||
<p>' . _("with") . ' <b>' . $meilleurecolonne . '</b> ' . $vote_str . '.</p>
|
||||
</div>'."\n";
|
||||
}
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<hr role="presentation" />'."\n";
|
||||
|
||||
// Commments
|
||||
$comment_user = $connect->allComments($poll_id);
|
||||
|
||||
if (count($comment_user) != 0) {
|
||||
echo '<div><h3>' . _("Comments of polled people") . '</h3>'."\n";
|
||||
|
||||
$i = 0;
|
||||
while ( $dcomment=$comment_user->FetchNextObject(false)) {
|
||||
echo '
|
||||
<div class="comment">
|
||||
<button type="submit" name="suppressioncomment'.$i.'" class="btn btn-link" title="' . _('Remove the comment') . '"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">' . _('Remove') . '</span></button>
|
||||
<b>'.stripslashes($dcomment->usercomment). ' :</b>
|
||||
<span class="comment">' . stripslashes(nl2br($dcomment->comment)) . '</span>
|
||||
</div>';
|
||||
$i++;
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '
|
||||
<div class="hidden-print alert alert-info">
|
||||
<div class="col-md-6 col-md-offset-3">
|
||||
<fieldset id="add-comment"><legend>' . _("Add a comment in the poll") . '</legend>
|
||||
<div class="form-group">
|
||||
<p><label for="commentuser">'. _("Your name") .'</label><input type=text name="commentuser" class="form-control" id="commentuser" /></p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<p><label for="comment">'. _("Your comment") .'</label><br />
|
||||
<textarea name="comment" id="comment" class="form-control" rows="2" cols="40"></textarea></p>
|
||||
</div>
|
||||
<p class="text-center"><input type="submit" name="ajoutcomment" value="'. _("Send the comment") .'" class="btn btn-success"></p>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</form>';
|
||||
|
||||
bandeau_pied();
|
||||
|
@ -9,6 +9,23 @@
|
||||
<table class="results">
|
||||
<caption class="sr-only">{_('Votes of the poll')} {$poll->title}</caption>
|
||||
<thead>
|
||||
{if $admin}
|
||||
<tr>
|
||||
<th role="presentation"></th>
|
||||
{$headersDCount=0}
|
||||
{foreach $slots as $slot}
|
||||
{foreach $slot->moments as $id=>$moment}
|
||||
<td headers="M{$slot@key} D{$headersDCount} H{$headersDCount}">
|
||||
<button type="submit" name="delete_column" value="{$slot->day}@{$moment}" class="btn btn-link btn-sm" title="{_('Remove the column')} {$slot->day|date_format:$date_format.txt_short} - {$moment}"><span class="glyphicon glyphicon-remove text-danger"></span><span class="sr-only">{_('Remove')}</span></button>
|
||||
</td>
|
||||
{$headersDCount = $headersDCount+1}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
<td>
|
||||
<button type="submit" name="add_slot" class="btn btn-link btn-sm" title="{_('Add a column')}"><span class="glyphicon glyphicon-plus text-success"></span><span class="sr-only">{_("Add a column")}</span></button>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<th role="presentation"></th>
|
||||
{foreach $slots as $id=>$slot}
|
||||
|
Loading…
Reference in New Issue
Block a user