/
newQuestion_view.php
208 lines (169 loc) · 13.2 KB
/
newQuestion_view.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?php
/**
* This view display the page to add a new question to a controller, and to choose its group.
* TODO : It will have to be merged with other question function such as "edit" or "copy".
*
*/
?>
<?php $this->renderPartial("./survey/Question/newQuestion_subviews/_ajax_variables", $ajaxDatas); ?>
<div class="side-body" id="edit-question-body">
<h3><?php eT("Add a new question"); ?></h3>
<div class="row">
<!-- Form for the whole page-->
<?php echo CHtml::form(array("admin/database/index"), 'post',array('class'=>'form30 form-horizontal','id'=>'frmeditquestion','name'=>'frmeditquestion')); ?>
<!-- The tabs & tab-fanes -->
<div class="col-lg-8 content-right">
<?php $this->renderPartial('./survey/Question/newQuestion_subviews/_tabs',array('eqrow'=>$eqrow,'addlanguages'=>$addlanguages, 'surveyid'=>$surveyid, 'gid'=>NULL, 'qid'=>NULL, 'action'=>'addquestion' ));?>
</div>
<!-- The Accordion -->
<div class="col-lg-4" style="padding-left: 0px; padding-right: 0px;">
<?php
// TODO : find why the $groups can't be generated from controller
// $this->renderPartial('./survey/Question/newQuestion_subviews/_accordion_container', $accordionDatas);
?>
<div id='questionbottom'>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<!-- General Options -->
<div class="panel panel-default" id="questionTypeContainer">
<!-- General Options : Header -->
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<?php eT("General Option");?>
</a>
</h4>
</div>
<!-- General Options : Body -->
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<div>
<div class="form-group">
<label class="col-sm-4 control-label" for='question_type_button'><?php eT("Question Type:"); ?></label>
<?php if($selectormodeclass!="none"): ?>
<?php
foreach (getQuestionTypeList($eqrow['type'], 'array') as $key=> $questionType)
{
if (!isset($groups[$questionType['group']]))
{
$groups[$questionType['group']] = array();
}
$groups[$questionType['group']][$key] = $questionType['description'];
}
?>
<input type="hidden" id="question_type" name="type" value="<?php echo $eqrow['type']; ?>" />
<div class="col-sm-8 btn-group" id="question_type_button" style="z-index: 1000">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="z-index: 1000">
<?php foreach($groups as $name => $group):?>
<?php foreach($group as $type => $option):?>
<?php if($type == $eqrow['type']){echo '<span class="buttontext">' . $option . '</span>';}?>
<?php endforeach;?>
<?php endforeach;?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" style="z-index: 1000">
<?php foreach($groups as $name => $group):?>
<small><?php echo $name;?></small>
<?php foreach($group as $type => $option):?>
<li>
<a href="#" class="questionType" aria-data-value="<?php echo $type; ?>" <?php if($type == $eqrow['type']){echo 'active';}?>><?php echo $option;?></a>
</li>
<?php endforeach;?>
<li role="separator" class="divider"></li>
<?php endforeach;?>
</ul>
</div>
<?php else: ?>
<?php
$aQtypeData=array();
foreach (getQuestionTypeList($eqrow['type'], 'array') as $key=> $questionType)
{
$aQtypeData[]=array('code'=>$key,'description'=>$questionType['description'],'group'=>$questionType['group']);
}
echo CHtml::dropDownList(
'type',
'category',
CHtml::listData($aQtypeData,'code','description','group'),
array(
'class' => 'none',
'id'=>'question_type',
'options' => array($eqrow['type']=>array('selected'=>true))
)
);
?>
<?php endif; ?>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for='gid'><?php eT("Question group:"); ?></label>
<div class="col-sm-8">
<select name='gid' id='gid' class="form-control">
<?php echo getGroupList3($eqrow['gid'],$surveyid); ?>
</select>
</div>
</div>
<div class="form-group" id="OtherSelection">
<label class="col-sm-4 control-label"><?php eT("Option 'Other':"); ?></label>
<div class="col-sm-8">
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array('name' => 'optionother'));?>
</div>
</div>
<div id='MandatorySelection' class="form-group">
<label class="col-sm-4 control-label"><?php eT("Mandatory:"); ?></label>
<!-- 'value'=>($eqrow['mandatory'] == "Y") -->
<div class="col-sm-8">
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array('name' => 'mandatory', 'value'=> '0' ));?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for='relevance'><?php eT("Relevance equation:"); ?></label>
<div class="col-sm-8">
<textarea cols='1' class="form-control" rows='1' id='relevance' name='relevance' ></textarea>
</div>
</div>
<div id='Validation' class="form-group">
<label class="col-sm-4 control-label" for='preg'><?php eT("Validation:"); ?></label>
<div class="col-sm-8">
<input type='text' id='preg' name='preg' size='50' value="<?php echo $eqrow['preg']; ?>" />
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Advanced Settings-->
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingTwo">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
<?php eT("Advanced settings"); ?>
</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
<div class="panel-body">
<div id="advancedquestionsettingswrapper" >
<div class="loader">
<?php eT("Loading..."); ?>
</div>
<div id="advancedquestionsettings">
<!-- Content append via ajax -->
</div>
</div>
<br />
<br/>
</div>
</div>
</div>
</div>
</div>
</div>
<input type='hidden' name='action' value='insertquestion' />
<input type='submit' class="hidden" value='<?php eT("Add question"); ?>' />
<input type='hidden' id='sid' name='sid' value='<?php echo $surveyid; ?>' />
</form>
<script type='text/javascript'>
<!--
document.getElementById('title').focus();
//-->
</script>
</div>
</div>