Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Participant "Dashboard" Possible?

  • limeAJ
  • limeAJ's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 7 months ago #157523 by limeAJ
Participant "Dashboard" Possible? was created by limeAJ
Hello,
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!
The topic has been locked.
  • gabrieljenik
  • gabrieljenik's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
6 years 7 months ago #157524 by gabrieljenik
Replied by gabrieljenik on topic Participant "Dashboard" Possible?
Hi AJ,

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 .

The topic has been locked.
  • limeAJ
  • limeAJ's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 7 months ago #157628 by limeAJ
Replied by limeAJ on topic Participant "Dashboard" Possible?
Thanks for the information Gabriel!
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!
The topic has been locked.
  • limeAJ
  • limeAJ's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 7 months ago - 6 years 7 months ago #157662 by limeAJ
Replied by limeAJ on topic Participant "Dashboard" Possible?
This is a work-in-progress, and thus I am positing here just to "document" my findings so far.

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.
Code:
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
Last edit: 6 years 7 months ago by limeAJ.
The topic has been locked.
More
6 years 6 months ago #157753 by socius
Replied by socius on topic Participant "Dashboard" Possible?
Hi limeAJ,

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.
The following user(s) said Thank You: limeAJ
The topic has been locked.
  • limeAJ
  • limeAJ's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 6 months ago #157931 by limeAJ
Replied by limeAJ on topic Participant "Dashboard" Possible?
Hello socius!
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!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 months ago - 6 years 6 months ago #157939 by tpartner
Replied by tpartner on topic Participant "Dashboard" Possible?

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.

You can use the API list_surveys() method to list details of all surveys accessible by a given user.

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)

Code:
<?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) &amp;&amp; $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.
Last edit: 6 years 6 months ago by tpartner.
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
6 years 6 months ago #157961 by tammo
Replied by tammo on topic Participant "Dashboard" Possible?
Tony: aren't you referring to LimeSurvey users in stead of respondents?

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 6 months ago #157962 by tpartner
Replied by tpartner on topic Participant "Dashboard" Possible?
Yes, I thought that was the intent - to list a set of surveys authored by a specific admin.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • limeAJ
  • limeAJ's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 6 months ago #157976 by limeAJ
Replied by limeAJ on topic Participant "Dashboard" Possible?
Ok,
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:
Code:
$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:
Code:
/limesurvey/application/config/config.php

and added the lines:
Code:
// 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.
The topic has been locked.
  • limeAJ
  • limeAJ's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 6 months ago #157977 by limeAJ
Replied by limeAJ on topic Participant "Dashboard" Possible?
Ok, so I just created the directory /runtime in the path:
Code:
/var/www/html/limesurvey/application
For a final path of:
Code:
/var/www/html/limesurvey/application/runtime
I made www-data the owner and group of that directory.

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 *****

The topic has been locked.
  • limeAJ
  • limeAJ's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 6 months ago - 6 years 6 months ago #157978 by limeAJ
Replied by limeAJ on topic Participant "Dashboard" Possible?
Ok, in the
Code:
/var/www/html/limesurvey/application/runtime

I uncommented the line, and modified it to the directory:
Code:
'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 *****

Last edit: 6 years 6 months ago by limeAJ.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose