Quantcast
Channel: Topics in Category: Can I do this with LimeSurvey? - LimeSurvey forums
Viewing all articles
Browse latest Browse all 17529

Restarting timer if survey taken on the same computer - by: Arthemis

$
0
0
Thank you. Here the plugin I wrote:
<?php
/**
* resetTimersNM Plugin for LimeSurvey
* Reset the timers for each question in a survey.
*
*
*
*/

class resetTimersNM extends \ls\pluginmanager\PluginBase {
static protected $description = 'Reset questions timers';
static protected $name = 'resetTimersNM';

public function init() {
$this->subscribe('beforeSurveyPage');
}

public function beforeSurveyPage() {
$oEvent = $this->event;
$iSurveyId=$oEvent->get('surveyId');

if (isset($_COOKIE)) {
unset($_COOKIE);
setcookie('limesurvey_timers', '', time() - 3600, '/'); // empty value and old timestamp
}

}
}

It works. Now I want to restart the timer only for new users on the same computer where a previous user did not submit. That is, I want to prevent users from reloading the page to get more time to answer the timed question. I identify unique users by login=uniquelogin in the URL where login is a hidden short-text question. Is there another event that is triggered by the start of the survey?
Thank you!

Viewing all articles
Browse latest Browse all 17529

Trending Articles