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
Next revisionBoth sides next revision
en:create:functions:buttontopage [11.08.2016 10:57] – [example: multilingual annotation] s.kuhn89en:create:functions:buttontopage [25.08.2020 12:29] – [Non-linear Questionnaires] sophia.schauer
Line 20: Line 20:
  
  
-===== Example 1 =====+===== Go back several pages =====
  
 The participant shall have the opportunity to leap to a previous page. The participant shall have the opportunity to leap to a previous page.
Line 39: Line 39:
  
  
-===== Example 2 =====+===== Easy navigation =====
  
 The participant shall have the option to leap to two specific pages during the whole survey.  The participant shall have the option to leap to two specific pages during the whole survey. 
Line 66: Line 66:
  
  
-===== Example 3 =====+===== Editing previous sections =====
  
 Again we want to offer the participant several buttons in order to navigate within the questionnaire. However this time the participant has the option to leap to chapters of the questionaire that he/she has already completed. Again we want to offer the participant several buttons in order to navigate within the questionnaire. However this time the participant has the option to leap to chapters of the questionaire that he/she has already completed.
Line 111: Line 111:
 </code> </code>
  
 +===== Non-linear Questionnaires =====
  
-===== Example: multilingual annotation =====+The questionnaire should not (necessarily) be answered linearly? With ''buttonToPage()'' an extensive navigation can be realized. 
 + 
 +In preparation, give all pages on which a section begins a [[:en:glossary#page_ids|Page IDs]] under **Compile questionnaire** and enter as a comment for the page a title for the section as it should appear in the navigation. 
 + 
 +There are two ways to display the navigation on all pages: 
 + 
 +  - Use placeholders and use them directly in the **questionnaire layout** -> //HTML-template// in front of the placeholder ''%questionnaire%'' -- then the PHP code with ''buttonToPage()'' has to be placed only once on the first page of the questionnaire, but the current page cannot be highlighted in color with this solution. 
 +  - Place the PHP code for navigation on each page of the questionnaire, e.g. at the top of each page. Below is an example of what the PHP code for this might look like: 
 + 
 +<code php> 
 +html( 
 +  // A <div> provides the optical demarcation between navigation and page content 
 +  '<div style="border: 2px solid #CCCCCC; border-left: 0 none; border-right: 0 none; padding: 20px 0 12px 0; margin-bottom: 3em;">'
 +  // Another <div> allows the flexible arrangement of the navigation buttons 
 +  '<div class="s2flex navButtons" style="flex-wrap: wrap; margin-right: -8px">'.NL. 
 +  buttonToPage('start'). 
 +  buttonToPage('contact'). 
 +  buttonToPage('study'). 
 +  buttonToPage('transcript'). 
 +  buttonToPage('dokuments'). 
 +  buttonToPage('notes'). 
 +  '<div style="width: 2em;"></div>'
 +  buttonToPage('send'). 
 +  '</div>'
 +  '</div>' 
 +); 
 +</code> 
 + 
 +If you want to make the buttons a bit more attractive, you can add some CSS code to the **questionnaire layout** in the //HTML-template// at the ''<style>'' section: 
 + 
 +<code css> 
 +div.navButtons button { 
 +  border: 2px solid %color.4%; 
 +  border-radius: 5px; 
 +  padding: 7px 6px; 
 +  margin-bottom: 8px; 
 +  flex-grow: 1; 
 +  margin-right: 8px; 
 +
 +div.navButtons button.currentPage { 
 +  background-color: %color.4%; 
 +  color: white; 
 +
 +</code> 
 + 
 + 
 +===== Example: Multilingual Annotation =====
  
 In a multilingual questionnaire ([[:en:create:multilang]]) the annotation of each button has to be adapted. In order to do so you can pass an array onto the second parameter. In a multilingual questionnaire ([[:en:create:multilang]]) the annotation of each button has to be adapted. In order to do so you can pass an array onto the second parameter.
en/create/functions/buttontopage.txt · Last modified: 09.03.2022 12:04 by ruth.noppeney
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki