From 782c8bf88eea6842b6d41d441bcdf6dcff4fdd4e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 Jun 2019 15:30:38 +0200 Subject: [PATCH] limesurvey --- .../CoreBundle/Command/data/core-init-01.sql | 2 +- .../Command/GetLimesurveyCommand.php | 42 ++++++++++++++++++- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql index 23fabd4d..8905e90a 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql @@ -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'); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/GetLimesurveyCommand.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/GetLimesurveyCommand.php index 07cc63d8..db2d15ec 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/GetLimesurveyCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/GetLimesurveyCommand.php @@ -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,"".$survey["surveyls_title"]."
"); + fclose($myfile); + */ + } + } + } + } + } + } + + + // release the session key + $myJSONRPCClient->release_session_key( $sessionKey ); + $this->writeln(''); return 1; }