/
tokenform.php
211 lines (192 loc) · 11.3 KB
/
tokenform.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
202
203
204
205
206
207
208
209
210
211
<?php
/**
* Add token entry
*/
?>
<div class="side-body">
<h3>
<?php
if ($subaction == "edit")
{
eT("Edit token entry");
foreach ($tokendata as $Key => $Value)
{
$$Key = $Value;
}
}
else
{
eT("Add token entry");
$tokenid = "";
}
?>
</h3>
<div class="row">
<div class="col-lg-12 content-right">
<?php echo CHtml::form(array("admin/tokens/sa/{$subaction}/surveyid/{$surveyid}/tokenid/{$tokenid}"), 'post', array('id'=>'edittoken', 'class'=>'form-horizontal')); ?>
<!-- ID -->
<div class="form-group">
<label class="col-sm-2 control-label">ID:</label>
<div class="col-sm-10">
<p class="form-control-static">
<?php if ($subaction == "edit")
echo $tokenid;
else
eT("Auto");
?>
</p>
</div>
</div>
<!-- First name -->
<div class="form-group">
<label class="col-sm-2 control-label" for='firstname'><?php eT("First name"); ?>:</label>
<div class="col-sm-2">
<input class='form-control' type='text' size='30' id='firstname' name='firstname' value="<?php if (isset($firstname)){echo $firstname;} ?>" /></div>
</div>
<!-- Last name -->
<div class="form-group">
<label class="col-sm-2 control-label" for='lastname'><?php eT("Last name"); ?>:</label>
<div class="col-sm-2">
<input class='form-control' type='text' size='30' id='lastname' name='lastname' value="<?php if (isset($lastname)){echo $lastname;} ?>" />
</div>
</div>
<!-- Email -->
<div class="form-group">
<label class="col-sm-2 control-label" for='email'><?php eT("Email"); ?>:</label>
<div class="col-sm-2">
<input class='form-control' type='email' multiple='multiple' maxlength='320' size='50' id='email' name='email' value="<?php if (isset($email)){echo $email;} ?>" />
</div>
</div>
<!-- Email Status -->
<div class="form-group">
<label class="col-sm-2 control-label" for='emailstatus'><?php eT("Email Status"); ?>:</label>
<div class="col-sm-2">
<input class='form-control' type='text' maxlength='320' size='50' id='emailstatus' name='emailstatus' placeholder='OK' value="<?php if (isset($emailstatus)){echo $emailstatus;}else{echo "OK";}?>" />
</div>
</div>
<!-- Token -->
<div class="form-group">
<label class="col-sm-2 control-label" for='token'><?php eT("Token"); ?>:</label>
<div class="col-sm-2">
<input class='form-control' type='text' size='20' name='token' id='token' value="<?php if (isset($token)){echo $token;} ?>" />
<?php if ($subaction == "addnew"): ?>
<span id="helpBlock" class="help-block"><?php eT("You can leave this blank, and automatically generate tokens using 'Generate Tokens'"); ?></span>
<?php endif; ?>
</div>
</div>
<!-- Language -->
<div class="form-group">
<label class="col-sm-2 control-label" for='language'><?php eT("Language"); ?>:</label>
<div class="col-sm-2">
<?php if (isset($language)){echo languageDropdownClean($surveyid, $language);}else{echo languageDropdownClean($surveyid, Survey::model()->findByPk($surveyid)->language);}?>
</div>
</div>
<!-- Invitation sent -->
<div class="form-group">
<label class="col-sm-2 control-label" for='sent'><?php eT("Invitation sent?"); ?></label>
<div class="col-sm-2">
<input class='form-control' type='text' size='20' id='sent' name='sent' value="<?php if (isset($sent)){echo $sent;}else{echo "N";}?>" />
</div>
</div>
<!-- Reminder sent -->
<div class="form-group">
<label class="col-sm-2 control-label" for='remindersent'><?php eT("Reminder sent?"); ?></label>
<div class="col-sm-2">
<input class='form-control' type='text' size='20' id='remindersent' name='remindersent' value="<?php if (isset($remindersent)){echo $remindersent;}else{echo "N";}?>" />
</div>
</div>
<!-- Reminder count -->
<?php if ($subaction == "edit"): ?>
<div class="form-group">
<label class="col-sm-2 control-label" for='remindercount'><?php eT("Reminder count:"); ?></label>
<div class="col-sm-2">
<input class='form-control' type='text' size='6' id='remindercount' name='remindercount' value="<?php echo $remindercount; ?>" />
</div>
</div>
<?php endif; ?>
<!-- Completed -->
<div class="form-group">
<label class="col-sm-2 control-label" for='completed'><?php eT("Completed?"); ?></label>
<div class="col-sm-2">
<input class='form-control' type='text' size='20' id='completed' name='completed' value="<?php if (isset($completed)){echo $completed;}else{echo "N";}?>" />
</div>
</div>
<!-- Uses left -->
<div class="form-group">
<label class="col-sm-2 control-label" for='usesleft'><?php eT("Uses left:"); ?></label>
<div class="col-sm-2">
<input class='form-control' type='text' size='20' id='usesleft' name='usesleft' value="<?php if (isset($usesleft)){echo $usesleft;}else{echo "1";}?>" />
</div>
</div>
<!-- Valid from to -->
<div class="form-group">
<label class="col-sm-2 control-label" for='validfrom'><?php eT("Valid from"); ?>:</label>
<div class="col-sm-2 has-feedback">
<i class='fa fa-calendar form-control-feedback'></i>
<?php Yii::app()->getController()->widget('yiiwheels.widgets.datetimepicker.WhDateTimePicker', array(
'name' => "validfrom",
'value' => isset($validfrom) ? $validfrom : '',
'pluginOptions' => array(
'format' => $dateformatdetails['jsdate'] . " HH:mm",
'singleDatePicker' => true,
'startDate' => date("Y-m-d", time()),
'drops' => 'up', // TODO: Does not work. Why?
'timePicker' => true,
'timePicker12Hour' => false, // NB: timePicker24Hour = true does not work
'timePickerIncrement' => 1
)
));
?>
<span class='help-block'><?php echo sprintf(gT('Format: %s'), $dateformatdetails['jsdate'] . ' ' . gT('hh:mm')); ?></span>
</div>
<label class="col-sm-2 control-label" for='validuntil'><?php eT('Until:'); ?></label>
<div class="col-sm-2 has-feedback">
<i class='fa fa-calendar form-control-feedback'></i>
<?php Yii::app()->getController()->widget('yiiwheels.widgets.datetimepicker.WhDateTimePicker', array(
'name' => "validuntil",
'value' => isset($validuntil) ? $validuntil : '',
'pluginOptions' => array(
'format' => $dateformatdetails['jsdate'] . " HH:mm",
'singleDatePicker' => true,
'startDate' => date("Y-m-d", time()),
'drops' => 'up',
'timePicker' => true,
'timePicker12Hour' => false,
'timePickerIncrement' => 1
)
));
?>
<span class='help-block'><?php echo sprintf(gT('Format: %s'), $dateformatdetails['jsdate'] . ' ' . gT('hh:mm')); ?></span>
</div>
</div>
<!-- Attributes -->
<?php foreach ($attrfieldnames as $attr_name => $attr_description): ?>
<div class="form-group">
<label class="col-sm-2 control-label" for='<?php echo $attr_name; ?>'><?php echo $attr_description['description'] . ($attr_description['mandatory'] == 'Y' ? '*' : '') ?>:</label>
<div class="col-sm-10">
<input type='text' size='55' id='<?php echo $attr_name; ?>' name='<?php echo $attr_name; ?>' value='<?php if (isset($$attr_name)){echo htmlspecialchars($$attr_name, ENT_QUOTES, 'UTF-8');}?>' />
</div>
</div>
<?php endforeach; ?>
<!-- Buttons -->
<p>
<?php
switch ($subaction)
{
case "edit":
?>
<input type='submit' value='<?php eT("Update token entry"); ?>' />
<input type='hidden' name='subaction' value='updatetoken' />
<input type='hidden' name='tid' value='<?php echo $tokenid; ?>' />
<?php break;
case "addnew": ?>
<input type='submit' class='hidden' value='<?php eT("Add token entry"); ?>' />
<input type='hidden' name='subaction' value='inserttoken' />
<?php break;
} ?>
<input type='hidden' name='sid' value='<?php echo $surveyid; ?>' />
</p>
</form>
</div>
</div>
</div>