- Posts: 9
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
www.url.de?{list(Q2_SQ001.shown,Q2_SQ002.shown,Q2_SQ003.shown,Q2_SQ004.shown)}
Das hatte ich mir am Anfang auch gedacht.die End-URL mit Antworten aus der Umfrage zu bestücken
Hey,Wäre es mit der Übergabe der Saved-ID und einem Script das per API auf die Antworten zugreift nicht noch kürzer?
$survey=193161; $tbl_daten='lime_survey_'.$survey; $tbl_timing='lime_survey_'.$survey.'_timings'; $col_name=$survey.'X42X545'; $col_dob=$survey.'X42X546'; $col_gender=$survey.'X42X554'; $col_schul=$survey.'X42X547'; $col_taet=$survey.'X42X548'; $col_erf=$survey.'X42X549'; $col_upload=$survey.'X43X550'; $col_cv=$survey.'X43X551'; ...
"SELECT
{$col_quelle}SQ001 as Q1,{$col_quelle}SQ002 as Q2,{$col_quelle}SQ003 as Q3,{$col_quelle}SQ004 as Q4,
{$col_quelle}other as QOther,{$col_quelle_sonst2} as QSo2,{$col_quelle_sonst3} as QSo3,
{$col_name}SQ001 as vname,{$col_name}SQ002 as name,concat({$col_name}SQ003,', ',{$col_name}SQ004,' ',{$col_name}SQ005) as adresse,
{$col_name}SQ006 as phone,{$col_name}SQ007 as email,
{$col_dob} as dob,
{$col_gender} as gender,
{$col_schul} as schule,
{$col_upload}_filecount as fc,{$col_cv} as cv,
7-{$col_T1}SQ001 as W01,7-{$col_T1}SQ002 as W02,{$col_T1}SQ003 as W03,{$col_T1}SQ004 as W04,7-{$col_T1}SQ005 as W05,7-{$col_T1}SQ006 as W06,7-{$col_T1}SQ007 as W07,
7-{$col_T1}SQ008 as W08, ...,
FROM {$tbl_daten} WHERE id={$SID}"
<?php require_once 'jsonrpcphp/JsonRPCClient.php'; define( 'LS_BASEURL', 'https://www.myServer.de/limesurvey'); // adjust this one to your actual LimeSurvey URL define( 'LS_USER', 'ICH_ICH' ); define( 'LS_PASSWORD', 'meinPassword' ); // the survey to process $survey_id=886223; // instantiate a new client $myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' ); // receive session key $sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD ); if(is_array($sessionKey)) { header("Content-type: application/json"); echo json_encode($sessionKey); die(); } /* Get the responses */ /* export_responses( string $sSessionKey, integer $iSurveyID, string $sDocumentType, string $sLanguageCode = null, string $sCompletionStatus = 'all', string $sHeadingType = 'code', string $sResponseType = 'short', integer $iFromResponseID = null, integer $iToResponseID = null, array $aFields = null ) : array|string */ $response = $myJSONRPCClient->export_responses( $sessionKey, $survey_id, 'json', // Document type : pdf,csv,xls,doc,json null, // Language code : null : default from survey 'complete', // Stautus complete|incomplete|all NULL, // Heading : code|full|abbreviated : question text, default code 'short', // answer : short|long , default : long $SID, // die übergebene SAVEDID als Startwert $SID // die übergebene SAVEDID als Endwert ); // See https://api.limesurvey.org/classes/remotecontrol_handle.html#method_export_responses or https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/remotecontrol/remotecontrol_handle.php#L2382 or $decodedString = base64_decode($response); $aResponses = json_decode($decodedString, True); // Find the first response ID $aFirstResponse = reset($aResponses['responses'][0]); //Hier als Tabelle auf den Bildschirm gebracht. echo '<table style="border-collapse: collapse; text-align: left;">'; echo '<tr>'; // Insert column headers foreach($aFirstResponse as $key => $value) { echo '<th style="border: 1px solid #CCC; padding: 2px 7px;">'.$key .'</th>'; } echo '</tr>'; foreach($aResponses['responses'] as $key => $row) { echo '<tr>'; // Insert the data foreach(reset($row) as $key => $item) { echo '<td style="border: 1px solid #CCC; padding: 2px 7px;">'.$item .'</td>'; } echo '</tr>'; } echo '</table>'; // release the session key $myJSONRPCClient->release_session_key( $sessionKey ); ?>