-
Notifications
You must be signed in to change notification settings - Fork 988
/
_subquestion.php
138 lines (118 loc) · 5.29 KB
/
_subquestion.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
/**
* subquestion row view
*
* @var $row
* @var $position
* @var $scale_id
* @var $activated
* @var $first
* @var $surveyid
* @var $gid
* @var $qid
* @var $language
* @var $title
* @var $question
* @var $relevance
* @var $oldCode
*
* NB : !!! If you edit this view, remember to check if answer option row view need also to be updated !!!
*/
?>
<!-- subquestion row -->
<tr id='row_<?php echo $language; ?>_<?php echo $qid; ?>_<?php echo $scale_id; ?>' class="row-container" data-common-id="<?php echo $qid; ?>_<?php echo $scale_id; ?>">
<?php // If survey is active : no move button, code not editable ?>
<?php if ($activated == 'Y'): ?>
<!-- Move icon -->
<td class="move-icon-disable">
</td>
<!-- Code (title) -->
<td class="code-title" style="vertical-align: middle;">
<input
class="code-title"
type='hidden'
name='code_<?php echo $position; ?>_<?php echo $scale_id; ?>' <?php // TODO: uniformisation with $scale_id and $position ?>
value="<?php echo $title; ?>"
maxlength='20'
size='5'
/>
<?php echo $title; ?>
</td>
<?php //If survey is not activated and first language : move button, code editable ?>
<?php elseif ($first): ?>
<?php $sPattern = ($title)?"^([a-zA-Z0-9]*|{$title})$":"^[a-zA-Z0-9]*$"; ?>
<!-- Move icon -->
<td class="move-icon" >
<span class="glyphicon glyphicon-move"></span>
</td>
<!-- Code (title) -->
<td class="code-title" style="vertical-align: middle;">
<?php if($oldCode): ?>
<input
type='hidden'
class='oldcode code-title'
id='oldcode_<?php echo $qid; ?>_<?php echo $scale_id; ?>'
name='oldcode_<?php echo $qid; ?>_<?php echo $scale_id; ?>'
value="<?php echo $title; ?>"
/>
<?php endif; ?>
<input
type='text'
class="code form-control input"
id='code_<?php echo $qid; ?>_<?php echo $scale_id; ?>'
class='code code-title'
name='code_<?php echo $qid; ?>_<?php echo $scale_id; ?>'
value="<?php echo $title; ?>"
maxlength='20' size='20'
pattern='<?php echo $sPattern; ?>'
required='required'
/>
</td>
<?php // If survey is not active, and it's not the first language : no move button, code not editable ?>
<?php else:?>
<!-- Move icon -->
<td class="move-icon-disable">
</td>
<!-- Code (title) -->
<td class="code-title" style="vertical-align: middle;">
<?php echo $title; ?>
</td>
<?php endif; ?>
<!-- No assessment values for subQuestions -->
<!-- Answer (Subquestion Text) -->
<td class="subquestion-text" style="vertical-align: middle;">
<input
type='text'
size='20'
class='answer form-control input'
id='answer_<?php echo $language; ?>_<?php echo $qid; ?>_<?php echo $scale_id; ?>'
name='answer_<?php echo $language; ?>_<?php echo $qid; ?>_<?php echo $scale_id; ?>'
placeholder='<?php eT("Some example subquestion","js") ?>'
value="<?php echo $question; ?>"
onkeypress=" if(event.keyCode==13) { if (event && event.preventDefault) event.preventDefault(); document.getElementById('save-button').click(); return false;}"
/>
</td>
<!-- Relevance equation -->
<?php if ($first):?>
<td class="relevance-equation">
<input data-toggle="tooltip" data-title="<?php eT("Click to expand"); ?>" type='text' class='relevance form-control input' id='relevance_<?php echo $qid; ?>_<?php echo $scale_id; ?>' name='relevance_<?php echo $qid; ?>_<?php echo $scale_id; ?>' value="<?php echo $relevance; ?>" onkeypress=" if(event.keyCode==13) { if (event && event.preventDefault) event.preventDefault(); document.getElementById('save-button').click(); return false;}" />
</td>
<?php else: ?>
<span style="display: none" class="relevance relevance-equation">
<?php echo $relevance; ?>
</span>
<?php endif; ?>
<!-- Icons add/edit/delete -->
<td style="vertical-align: middle;" class="subquestion-actions">
<?php echo getEditor("editanswer","answer_".$language."_".$qid."_{$scale_id}", "[".gT("Subquestion:", "js")."](".$language.")",$surveyid,$gid,$qid,'editanswer'); ?>
<?php if ( $activated != 'Y' && $first ):?>
<?php
// TODO : to merge subquestion and answer options, implies : define in controller titles
?>
<span class="icon-add text-success btnaddanswer" data-code="<?php echo $title; ?>" data-toggle="tooltip" data-scale-id="<?php echo $scale_id; ?>" data-placement="bottom" title="<?php eT("Insert a new subquestion after this one") ?>"></span>
<span class="glyphicon glyphicon-trash text-danger btndelanswer" data-toggle="tooltip" data-placement="bottom" title="<?php eT("Delete this subquestion") ?>"></span>
<?php endif; ?>
</td>
</tr>