- Posts: 23
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Participant "Dashboard" Possible?
- limeAJ
- Topic Author
- Offline
- Junior Member
Can I create a "dashboard" of sorts, for my participants?
I have about 12 participants, and each participant will answer the survey 20-30 times.
Would there be a way to have the participant "login", and list:
- their previous surveys
surveys pending-completition (they "Save for Later")
Create New Survey
I can do some custom coding html/javascript side... and maybe something server side.
Yet if somebody can provide some direction, I would appreciate it a lot!
Thank you!
- gabrieljenik
- Offline
- Official LimeSurvey Partner
- Posts: 272
- Thank you received: 45
I have a custom plugin for that which I can show you and should save you plenty of time.
Please contact me at gabriel@encuesta.biz
Thanks!
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
- limeAJ
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 2
I am in contact with you via email.
----
Question to other users:
Is there a way I can get a listing of each participant's answered surveys?
Thank you!
- limeAJ
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 2
I think I can build the dashboard "on the side" via regular html/javascript.
Limesurvey "creates" the urls in a certain way.... and I think I could use javascript's regex to create the links.
user#1 http://LS.server.ip.addy/limesurvey/index.php/survey/index/sid/665156/newtest/Y/lang/es/token/868 clicked on "Continue Later", and the received url via email http://LS.server.ip.addy/limesurvey/index.php/survey/index/sid/665156/loadall/reload/scid/38/lang/es/loadname/user#1/loadpass/PASSWORD/token/868 user#2 http://LS.server.ip.addy/limesurvey/index.php/survey/index/sid/665156/newtest/Y/lang/es/token/qvg clicked on "Continue Later", and the received url via email http://LS.server.ip.addy/limesurvey/index.php/survey/index/sid/665156/loadall/reload/scid/39/lang/es/loadname/user#2/loadpass/PASSWORD/token/qvg
The variables here would be:
loadname, password, and the token.
That's what I would have to tie in.
Will keep everyone posted on what I find.
Reference Links: A tip for generating a large number of individual links which include the token already
- socius
- Offline
- Premium Member
- Posts: 103
- Thank you received: 5
thanks for the question that reminded me that I thought about this some time ago.
My imagined (but not implemented) solution to this was: what about creating a survey that serves as dashboard? I.e. you could have a nicely formatted boilerplate question with personalized information (Survey Links, Due Dates, ToDo/Finished etc. with conditional formatting). This survey would have to get the information out of the other surveys resp. the token tables.
What do you think about that? Is that feasible for you? Looking forward to a discussion and possible solutions.
- limeAJ
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 2
That's a good idea.
Seems completely plausible to me, although I'm not an expert.
At the moment, I am trying to do the following:
setup a separate html/php page
In that page, "construct" the url links to the surveys themselves.
I have something very basic running, yet it's non-extensible (everything is hardcoded) and quite fragile.
The LimeSurvey RPC (api?) seems to provide the functionality that would help here.
Reading up on its documentation, I think it's possible to have the rpc (api) return a list of surveys.
What do you think?
Thanks for the comment!
- tpartner
- Offline
- LimeSurvey Community Team
- Posts: 10611
- Thank you received: 3690
You can use the API list_surveys() method to list details of all surveys accessible by a given user.The LimeSurvey RPC (api?) seems to provide the functionality that would help here.
Reading up on its documentation, I think it's possible to have the rpc (api) return a list of surveys.
A PHP script something like this, when passed a valid "username" parameter in the URL, will print a table of all surveys that that user has admin access to.
(the code is intentionally a little verbose for clarity)
<?php require_once 'jsonRPCClient.php'; define( 'LS_BASEURL', 'http://pathTo/limeSurvey/'); define( 'LS_USER', 'admin' ); define( 'LS_PASSWORD', 'password' ); if(!isset($_GET["username"])) { echo 'No user specified!'; return false; } else { $sUsername = $_GET["username"]; } // NOTE: You could do some more validation and/or conditions regarding the username here // Instantiate a new RPC client $myJSONRPCClient = new jsonRPCClient( LS_BASEURL.'/admin/remotecontrol' ); // Get a session key $sSessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD ); // Get survey info for all surveys accessible by $sUsername $surveys = $myJSONRPCClient->list_surveys($sSessionKey, $sUsername); if(array_key_exists('status', $surveys) && $surveys['status'] == 'Invalid user') { echo 'Invalid user specified!'; return false; } else { // Sort the results by survey title - http://docs.php.net/manual/en/function.array-multisort.php foreach ($surveys as $key => $row) { $sid[$key] = $row['sid']; $surveyls_title[$key] = $row['surveyls_title']; $startdate[$key] = $row['startdate']; $expires[$key] = $row['expires']; $active[$key] = $row['active']; } array_multisort($surveyls_title, SORT_ASC, $surveys); // Print the results in a table $tableHTML = '<table class="surveys-list" style="border-collapse: collapse;" border=1>'; $tableHTML .= '<tr>'; $tableHTML .= '<th>Title</th>'; $tableHTML .= '<th>SID</th>'; $tableHTML .= '<th>Start Date</th>'; $tableHTML .= '<th>Expires</th>'; $tableHTML .= '<th>Active</th>'; $tableHTML .= '<th>Link</th>'; $tableHTML .= '<tr>'; foreach ($surveys as $surveyInfo) { $tableHTML .= '<tr>'; $tableHTML .= '<td>'.$surveyInfo['surveyls_title'].'</td>'; $tableHTML .= '<td>'.$surveyInfo['sid'].'</td>'; $tableHTML .= '<td>'.$surveyInfo['startdate'].'</td>'; $tableHTML .= '<td>'.$surveyInfo['expires'].'</td>'; $tableHTML .= '<td>'.$surveyInfo['active'].'</td>'; $tableHTML .= '<td>'; if($surveyInfo['active'] == 'Y') { $tableHTML .= '<a href="'.LS_BASEURL.'index.php/'.$surveyInfo['sid'].'?newtest=Y" target="_blank">Survey Link</a>'; } $tableHTML .= '</td>'; $tableHTML .= '<tr>'; } $tableHTML .= '</table>'; echo $tableHTML; } // Release the session key $myJSONRPCClient->release_session_key( $sSessionKey ); ?>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- tammo
- Offline
- Official LimeSurvey Partner
- Posts: 962
- Thank you received: 216
Tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
- tpartner
- Offline
- LimeSurvey Community Team
- Posts: 10611
- Thank you received: 3690
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- limeAJ
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 2
So I am running into a problem in my rpc tests.
I tailed and checked various logs and http headers.
Fast forward, I enabled debug mode on the "JsonRPCClient.php" file.
The line for the rpc/api test reads:
$myJSONRPCClient = new org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'index.php?r=admin/remotecontrol', true);
From there, an error stating:
Bad Request
The CSRF token could not be verified.
The request could not be understood by the server due to malformed syntax. Please do not repeat the request without modifications.
If you think this is a server error, please contact the webmaster.
2017-08-25 16:10:41
***** End of Response *****
So I then found this link in the Limesurvey forum , which then took me to this bug report .
From there, Denis states that there is a way to disable the CSRF protection, and he mentions this wiki page.
From that wiki page, I went to modify config.php:
/limesurvey/application/config/config.php
and added the lines:
// Disable CSRF protection 'request' => array( 'enableCsrfValidation'=>false, ),
My particular Survey in this case will be 100% company internal, and it will not get published to the internet.
So I consider disabling CSRF protection to be ok.
Yet, once I disable it in config.php, I get the following error on the webpage calling the rpc/api:
***** Request ***** {"method":"get_session_key","params":["admin","password"],"id":1} ***** Response *****
CException
Application runtime path "/var/www/html/limesurvey/application/runtime" is not valid. Please make sure it is a directory writable by the Web server process.
***** End of Response *****
So I went to check the path: /var/www/html/limesurvey/application/runtime
Yet it does not exist.
Any idea what I am doing wrong?
How can I fix this?
This is the php api example page I am looking at.
- limeAJ
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 2
/var/www/html/limesurvey/application
/var/www/html/limesurvey/application/runtime
Now I reloaded the page I have for the rpc/api test, and a new error message states:
***** Request ***** {"method":"get_session_key","params":["admin","password"],"id":1} ***** Response *****
Internal Server Error
Property "LSYii_Application.request" is read only.
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.
Thank you.
2017-08-25 16:23:33
***** End of Response *****
- limeAJ
- Topic Author
- Offline
- Junior Member
- Posts: 23
- Thank you received: 2
/var/www/html/limesurvey/application/runtime
I uncommented the line, and modified it to the directory:
'runtimePath'=>'/var/www/html/limesurvey/application/runtime/'
Now I am not getting the previous error.
Yet the json reply... I am not sure if that's what I need.
I have at the moment:
***** Request ***** {"method":"get_session_key","params":["admin","password"],"id":1} ***** Response ***** ***** End of Response *****