-
Notifications
You must be signed in to change notification settings - Fork 993
/
advanced_settings_view.php
173 lines (164 loc) · 7.68 KB
/
advanced_settings_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
<?php
/**
* This view generate the advanced question attributes
*/
$currentfieldset='';
$categoryNum=0;
?>
<!-- Advanced Settings -->
<?php foreach ($attributedata as $index=>$aAttribute):?>
<!-- Fieldsets -->
<?php if ($currentfieldset!=$aAttribute['category']): ?>
<?php $categoryNum++; ?>
<?php if ($currentfieldset!=''): ?>
</div></div></div></div>
</div>
<?php endif; ?>
<div class="panel panel-default panel-advancedquestionsettings">
<div class="panel-heading" role="tab">
<div class="panel-title h4">
<a class="btn btn-default btn-xs hide-button hidden-xs opened handleAccordion">
<span class="fa fa-chevron-left"></span>
<span class="sr-only"><?php eT("Expand/Collapse");?></span>
</a>
<a id="button-collapse<?php echo $categoryNum ?>" class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-cat<?php echo $categoryNum ?>" aria-expanded="false" aria-controls="collapse-cat<?php echo $categoryNum ?>">
<?php echo $aAttribute['category']; ?>
</a>
</div>
</div>
<div id="collapse-cat<?php echo $categoryNum ?>" class="panel-collapse collapse" role="tabpanel" aria-labelledby="button-collapse<?php echo $categoryNum ?>">
<div class="panel-body">
<div>
<?php $currentfieldset=$aAttribute['category']; ?>
<?php endif; ?>
<div class="form-group">
<!-- Form Group -->
<!-- Label -->
<label class="control-label" for='<?php echo $aAttribute['name'];?>' title='<?php echo $aAttribute['help'];?>'>
<?php
echo $aAttribute['caption'];
if ($aAttribute['i18n']==true) { ?> (<?php echo $aAttribute['language'] ?>)<?php }
?>:
</label>
<!-- Input -->
<div class="">
<?php
$readonly = ( $aAttribute['readonly'] || ($aAttribute['readonly_when_active'] && $bIsActive) );
switch ($aAttribute['inputtype'])
{
// Switch
case 'switch':
$this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => $aAttribute['name'],
'value'=> $aAttribute['value'],
'onLabel'=>gT('On'),
'offLabel'=>gT('Off'),
'htmlOptions'=>array(
'disabled'=>$readonly,
),
));
break;
// Button group
case 'buttongroup':
$this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array(
'name' => $aAttribute['name'],
'value'=> $aAttribute['value'] ,
'selectOptions'=>$aAttribute['options'],
'htmlOptions'=>array(
'disabled'=>$readonly,
),
));
break;
// Single select
case 'singleselect':
echo CHtml::dropDownList($aAttribute['name'],$aAttribute['value'],$aAttribute['options'],array(
'class'=>"form-control",
'disabled'=>$readonly,
'encode'=>false, // gt encode it by default
));
break;
// Text
case 'text':
if($aAttribute['expression']>=2) {
echo CHtml::tag('div',array('class'=>"input-group"),"",false);
echo CHtml::tag('div',array('class'=>"input-group-addon"),"{");
}
echo CHtml::textField($aAttribute['name'],$aAttribute['value'],array(
'class'=>"form-control",
'disabled'=>$readonly,
));
if($aAttribute['expression']>=2) {
echo CHtml::tag('div',array('class'=>"input-group-addon"),"}");
echo CHtml::closeTag('div');
}
break;
// Integer
case 'integer':
echo CHtml::numberField($aAttribute['name'],$aAttribute['value'],array(
'class'=>"form-control",
'disabled'=>$readonly,
'step'=>1,
'pattern'=>'\d+',
'min'=>(isset($aAttribute['min'])?$aAttribute['min']:1),
'max'=>(isset($aAttribute['max'])?$aAttribute['max']:null)
));
break;
// Float
case 'float':
echo CHtml::numberField($aAttribute['name'],$aAttribute['value'],array(
'class'=>"form-control",
'disabled'=>$readonly,
'step'=>1,
'pattern'=>'^[-+]?[0-9]*\.[0-9]+$',
'min'=>(isset($aAttribute['min'])?$aAttribute['min']:null),
'max'=>(isset($aAttribute['max'])?$aAttribute['max']:null)
));
break;
// Columns
case 'columns':
echo CHtml::numberField($aAttribute['name'],$aAttribute['value'],array(
'class'=>"form-control",
'disabled'=>$readonly,
'step'=>1,
'pattern'=>'\d+',
'min'=>1,
'max'=>12
));
break;
// Textarea
case 'textarea':
if ($aAttribute['expression']>=2) {
echo CHtml::tag('div',array('class'=>"input-group"),"",false);
echo CHtml::tag('div',array('class'=>"input-group-addon"),"{");
}
echo CHtml::textArea($aAttribute['name'],$aAttribute['value'],array(
'class'=>"form-control",
'disabled'=>$readonly,
));
if ($aAttribute['expression']>=2) {
echo CHtml::tag('div',array('class'=>"input-group-addon"),"}");
echo CHtml::closeTag('div');
}
break;
// Question template selector
case 'question_template':
echo CHtml::dropDownList($aAttribute['name'],$aAttribute['value'],$aQuestionTemplates,array(
'class'=>"form-control",
'disabled'=>$readonly,
));
break;
}
?>
</div>
</div>
<?php endforeach;?>
</div></div></div></div>
<?php
/* Launch all needed script (here after load) needed for widget */
foreach (Yii::app()->clientScript->scripts as $index=>$script)
{
echo CHtml::script(implode("\n",$script));
}
Yii::app()->clientScript->reset();
?>
<!-- end of Advanced Settings -->