limesurvey

This commit is contained in:
root 2019-06-04 15:30:38 +02:00
parent eee28b7c2c
commit 782c8bf88e
2 changed files with 41 additions and 3 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}fb3ceUoJ3JONkQV2fav0CuKOAZb9h9vO
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}7o+kc3a8dmiDmMuVU1ti+CXx30Pt9fWd
', 'admin@transnum.cadol.es', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -375,12 +375,11 @@ class GetLimesurveyCommand extends Command
$fgdebug = false;
// Instance Limesurvey
$widlimesurvey_url = $this->container->getParameter('widlimesurvey_url');
$widlimesurvey_url = $this->container->getParameter('widlimesurvey_url')."/index.php";
if(stripos($widlimesurvey_url,"/limesurvey")==0) {
$weburl=$this->container->getParameter('weburl');
$widlimesurvey_url="https://".$weburl.$widlimesurvey_url;
}
echo $widlimesurvey_url;
$widlimesurvey_apiuser = $this->container->getParameter('widlimesurvey_apiuser');
$widlimesurvey_apikey = $this->container->getParameter('widlimesurvey_apikey');
@ -389,6 +388,45 @@ class GetLimesurveyCommand extends Command
// Connection Limesurvey
$sessionKey= $myJSONRPCClient->get_session_key( $widlimesurvey_apiuser, $widlimesurvey_apikey );
// list de l'ensemble des sondages
$surveys= $myJSONRPCClient->list_surveys($sessionKey);
foreach($surveys as $survey) {
// Si le sondage est actif
if($survey["active"]=="Y") {
// Liste des participants
$survey_id=$survey["sid"];
$users = $myJSONRPCClient->list_participants($sessionKey, $survey_id, 0, 10000);
$token="";
foreach($users as $user) {
if(isset($user["participant_info"]["email"]) && $user["participant_info"]["email"]!="") {
$q = "SELECT * FROM ".$config["dbprefixe"]."user WHERE user_email=?";
$query=$bdd01->prepare($q);
if(isset($user["participant_info"]["email"])) {
$query->execute(array($user["participant_info"]["email"]));
if($row=$query->fetch()){
/*
$myfile = fopen($config['localdirectory']."/local/limesurvey/".$row["user_id"].".html", "a");
$token=$user["token"];
$url=$widlimesurvey_url."/".$survey_id;
if($token!="")
$url.="?token=".$token;
fwrite($myfile,"<a href='".$url."' target='blank'>".$survey["surveyls_title"]."</a><br>");
fclose($myfile);
*/
}
}
}
}
}
}
// release the session key
$myJSONRPCClient->release_session_key( $sessionKey );
$this->writeln('');
return 1;
}