Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
en:create:functions:pagestop [05.09.2020 13:29] – [pageStop()] sophia.schaueren:create:functions:pagestop [30.04.2021 09:53] sophia.schauer
Line 7: Line 7:
 If there are other commands within a PHP code element in the questionnaire, ''pageStop()'' also prevents their execution. If there are other commands within a PHP code element in the questionnaire, ''pageStop()'' also prevents their execution.
  
-===== Example =====+===== Example: Screenout =====
  
 In the following example, ''pageStop()'' is combined with a screen out filter. This means further content (e.g. questions) can still be put on the screen out page. In the following example, ''pageStop()'' is combined with a screen out filter. This means further content (e.g. questions) can still be put on the screen out page.
Line 44: Line 44:
 } else { } else {
   goToPage('next');   goToPage('next');
 +}
 +</code>
 +
 +
 +
 +===== Example:Time Restriction =====
 +
 +Sometimes the survey project uses several questionnaires -- and not all of them should be available for the same time period. At the same time, only one survey period can be defined for the entire survey project in the **Project Settings**.
 +
 +With a small PHP filter on the first page of the questionnaire, you can specify that only an error message is displayed outside a defined time period.
 +
 +Create a new text in the **List of Questions** in a section of your choice. The following example assumes that the text has the identifier TX02. The following PHP code ensures that the questionnaire can only be completed in the period between 01/04/2021 and 30/06/2021.
 +
 +<code php>
 +if ((time() < strtotime('2021-04-01')) || (time() >= strtotime('2021-07-01'))) {
 +  text('TX02');
 +  buttonHide();
 +  pageStop();
 +}
 +</code>
 +
 +The survey period specified in the project settings must start before 4/1/2021 and/or end after 6/30/2021 for the filter to be active.
 +
 +In the same way, you can restrict that the questionnaire can only be filled out in a certain time window. The following PHP code allows filling in only from 9 to 11 o'clock.
 +
 +<code php>
 +if ((date('h') < 9) || (date('h') > 11)) {
 +  text('TX02');
 +  buttonHide();
 +  pageStop();
 } }
 </code> </code>
en/create/functions/pagestop.txt · Last modified: 07.12.2023 12:05 by empschul
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki