'."\n";
+
+ // si la ligne n'est pas a changer, on affiche les données
+ if (! $testligneamodifier)
{
- $obj=$db->fetch_object($resql);
+ for ($i = 0; $i < $nbcolonnes; $i++)
+ {
+ $car = substr($ensemblereponses, $i, 1);
+ //print 'xx'.$i."-".$car.'-'.$listofanswers[$i]['format'].'zz';
- $ensemblereponses = $obj->reponses;
-
- print '
'."\n";
-
- // ligne d'un usager pré-authentifié
- $mod_ok = (! empty($nombase) && in_array($nombase, $listofvoters));
-
- // Name
- print '
'.htmlentities($obj->nom).'
'."\n";
-
- // si la ligne n'est pas a changer, on affiche les données
- if (! $testligneamodifier)
+ if (empty($listofanswers[$i]['format']) || ! in_array($listofanswers[$i]['format'],array('yesno','foragainst')))
+ {
+ if (((string) $car) == "1") print '
OK
'."\n";
+ else print '
KO
'."\n";
+ // Total
+ if (! isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (((string) $car) == "1") $sumfor[$i]++;
+ }
+ if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
+ {
+ if (((string) $car) == "1") print '
'.$langs->trans("Yes").'
'."\n";
+ else if (((string) $car) == "0") print '
'.$langs->trans("No").'
'."\n";
+ else print '
'."\n";
+ // Total
+ if (! isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (! isset($sumagainst[$i])) $sumagainst[$i] = 0;
+ if (((string) $car) == "1") $sumfor[$i]++;
+ if (((string) $car) == "0") $sumagainst[$i]++;
+ }
+ if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
+ {
+ if (((string) $car) == "1") print '
'.$langs->trans("For").'
'."\n";
+ else if (((string) $car) == "0") print '
'.$langs->trans("Against").'
'."\n";
+ else print '
'."\n";
+ // Total
+ if (! isset($sumfor[$i])) $sumfor[$i] = 0;
+ if (! isset($sumagainst[$i])) $sumagainst[$i] = 0;
+ if (((string) $car) == "1") $sumfor[$i]++;
+ if (((string) $car) == "0") $sumagainst[$i]++;
+ }
+ }
+ }
+ else
+ {
+ //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs
+ if ($compteur == $ligneamodifier)
+ {
+ for ($i = 0; $i < $nbcolonnes; $i++)
+ {
+ $car = substr($ensemblereponses, $i, 1);
+ print '
'."\n";
@@ -408,8 +477,8 @@ if ($object->allow_spy) {
}
if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
{
- if (((string) $car) == "1") print '
'.$langs->trans("Yes").'
'."\n";
- else if (((string) $car) == "0") print '
'.$langs->trans("No").'
'."\n";
+ if (((string) $car) == "1") print '
'.$langs->trans("For").'
'."\n";
+ else if (((string) $car) == "0") print '
'.$langs->trans("Against").'
'."\n";
else print '
'."\n";
// Total
if (! isset($sumfor[$i])) $sumfor[$i] = 0;
@@ -430,97 +499,31 @@ if ($object->allow_spy) {
}
}
}
- else
- {
- //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs
- if ($compteur == $ligneamodifier)
- {
- for ($i = 0; $i < $nbcolonnes; $i++)
- {
- $car = substr($ensemblereponses, $i, 1);
- print '
'."\n";
- // Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
- if (((string) $car) == "1") $sumfor[$i]++;
- }
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno')
- {
- if (((string) $car) == "1") print '
'.$langs->trans("For").'
'."\n";
- else if (((string) $car) == "0") print '
'.$langs->trans("Against").'
'."\n";
- else print '
'."\n";
- // Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
- if (! isset($sumagainst[$i])) $sumagainst[$i] = 0;
- if (((string) $car) == "1") $sumfor[$i]++;
- if (((string) $car) == "0") $sumagainst[$i]++;
- }
- if (! empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst')
- {
- if (((string) $car) == "1") print '
'.$langs->trans("For").'
'."\n";
- else if (((string) $car) == "0") print '
'.$langs->trans("Against").'
'."\n";
- else print '
'."\n";
- // Total
- if (! isset($sumfor[$i])) $sumfor[$i] = 0;
- if (! isset($sumagainst[$i])) $sumagainst[$i] = 0;
- if (((string) $car) == "1") $sumfor[$i]++;
- if (((string) $car) == "0") $sumagainst[$i]++;
- }
- }
- }
- }
-
- // Button edit at end of line
- if ($compteur != $ligneamodifier && $mod_ok)
- {
- print '
'."\n";
- }
-
- //demande de confirmation pour modification de ligne
- for ($i=0; $i<$nblignes; $i++)
- {
- if (isset($_POST["modifierligne".$i]))
- {
- if ($compteur == $i)
- {
- print '
';
- print '';
- print '';
- print '
'."\n";
- }
- }
- }
-
- $compteur++;
- print '
'."\n";
}
+
+ // Button edit at end of line
+ if ($compteur != $ligneamodifier && $mod_ok)
+ {
+ print '
'."\n";
+ }
+
+ //demande de confirmation pour modification de ligne
+ for ($i=0; $i<$nblignes; $i++)
+ {
+ if (isset($_POST["modifierligne".$i]))
+ {
+ if ($compteur == $i)
+ {
+ print '
';
+ print '';
+ print '';
+ print '
'."\n";
+ }
+ }
+ }
+
+ $compteur++;
+ print ''."\n";
}
// Add line to add new record