Translations of this page:
 

Table of Contents

caseTime()

int caseTime(string pageID)

Determines the amount of time spent on a particular page, or the time the participant has spent on the questionnaire so far. The time for each one is determined in seconds.

  • pageID
    ID of the page for which the amount of time spent on it should be determined (), or one of the following special IDs: 'previous', 'this', 'hitherto', 'break' or 'begin'. If a special ID is specified, caseTime() returns the amount of time spent on this, and not the amount of time spent on a page in the questionnaire that potentially has the same name.
    • <Page ID> – ID of a page in the questionnaire
    • 'previous' – The page visited before the current page
    • 'this' – The current page. If it is the first time the page has been shown, this value will be 0. The value will be bigger if the page is redisplayed, e.g. due to missing values, or after a pause.
    • 'hitherto' – Amount of time spent on all pages the participant filled in prior to the current page.
    • 'begin' – Amount of time passed since the beginning of the questionnaire. Please take into consideration that this value can also vary from the all value without using the “Back” button and a page being redisplayed, because this also contains the time the server needs to process and generate the pages.
    • 'break' – Amount of time passed since a page was last displayed. Over the course of a normal questionnaire, this corresponds to the amount of time spent on the previous page (previous). If the previous page was redisplayed, then this is the time since it was last displayed. If the current page is redisplayed (e.g. due to incomplete information, or because the questionnaire was paused), the is the time since the page was last displayed.

Note: If a participant visits a page multiple times (e.g. because responses were missing, or by clicking on the “Back” button, the amount of time spent on the page will be added up.

Note: If the questionnaire jumps to another page by using goToPage(), the time spent on the page shown first will be counted. Therefore, ig there is a filter on page “one” which forwards the participant directly to page “two”, the time spent on page “one” will nevertheless be saved.

Example 2

If the participant needed less than 10 seconds for the previous page, the following PHP code redisplays the page – along with the text element “too_quick”.

if (caseTime('previous') < 10) {
  repeatPage('too_quick');
}

Example 2

The following PHP code starts the questionnaire again (without deleting previous responses), if the participant needed less than 1 minute for the previous pages.

This example assumes the first page has the ID “start”.

if (caseTime('hitherto') < 60) {
  text('please_check'); // information message
  setNextPage('start'); // after "Next" go to page "start"
  pageStop(); // do not display any further content on the page
}
en/create/functions/casetime.txt · Last modified: 25.08.2020 11:42 by sophia.schauer
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki