query($query); if ( $db->result->num_rows !=0 ) { while( $sondage = $db->result->fetch_array() ) { $diff = $sondage['diff']; $ateliers['lien'] = $base_url . "dbarr/public/opensurvey/studs.php?sondage=" . $sondage["id_sondage"]; $ateliers["titre"] = $sondage["titre"]; if ($diff < 0) { $query = "UPDATE llx_opensurvey_sondage SET STATUS='2' where id_sondage='" . $sondage['id_sondage'] . "'"; $db2->query($query); }elseif ( $diff <= 2760 ) { $query = "SELECT * FROM llx_opensurvey_user_studs WHERE id_sondage='" . $sondage["id_sondage"] . "'"; $id = $sondage["id_sondage"]; $r = explode(" ", $sondage['sujet'], 2); if ( trim( $r[0], " ") != "Atelier" and !empty($minimPart)) { $minParticipants = $minimPart; }else { $minParticipants = 2; } $db2->query($query); // pour chaque vote on compte les résultats par atelier if ($db2->result->num_rows > 0) { $nom_atelier = explode( ",", $sondage["sujet"] ); while( $reponse = $db2->result->fetch_array() ) { $r = str_split( $reponse["reponses"] ); $l = count( $r ); for ($x=0; $x<$l; $x++) { if ( !isset($tab[$x]) ) { $tab[$x] = 0; } $tab[$x] += $r[$x]; } } //$ateliers["commentaire"] = $nom_atelier; arsort($tab); $ateliers["atelier"] = strstr($nom_atelier[key($tab)], "@checkbox" , true ); if ( $tab[0] < $minParticipants ) { echo "annulation\n"; $ateliers['commentaires'] = annulation_atelier( $ateliers["titre"] ); }else { $ateliers['commentaires'] = confirmation_atelier( $ateliers["titre"], $ateliers["atelier"] ); } }else { echo "annulation\n"; $ateliers['commentaires'] = annulation_atelier( $ateliers["titre"] ); } /*if ( $diff <= 21600 ) { $ateliers['titre'] = $sondage["titre"]; $ateliers['commentaires'] .= $sondage["commentaires"]; } */ } } if ( !empty($ateliers['commentaires']) ) { echo $ateliers['commentaires']; send_mail("all", 'dtux@free.fr', $ateliers['commentaires']); //print_r($ateliers); } } ?>