/
browse.php
176 lines (171 loc) · 10.6 KB
/
browse.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
<?php
$uidNames = array();
/* Build the options for additional languages */
$j = 1;
$getlangvalues = getLanguageData(false,Yii::app()->session['adminlang']);
if (Yii::app()->session['adminlang'] != 'auto')
{
$lname[0] = Yii::app()->session['adminlang'] . ":" . $getlangvalues[Yii::app()->session['adminlang']]['description'];
}
foreach ($getlangvalues as $keycode => $keydesc)
{
if (Yii::app()->session['adminlang'] != $keycode)
{
$cleanlangdesc = str_replace(";", " -", $keydesc['description']);
$lname[$j] = $keycode . ":" . $cleanlangdesc;
$j++;
}
}
$langnames = implode(";", $lname);
/* Build the columnNames for the extra attributes */
/* and, build the columnModel */
$names = GetTokenFieldsAndNames($surveyid, true);
$attributes = GetAttributeFieldNames($surveyid);
if (count($attributes) > 0)
{
foreach ($names as $name)
{
$attnames[] = '"' . $name . '"';
}
foreach ($attributes as $row)
{
$uidNames[] = '{ "name":"' . $row . '", "index":"' . $row . '", "sorttype":"string", "sortable": true, "align":"center", "editable":true, "width":75}';
}
$columnNames = implode(',', $attnames); //Add to the end of the standard list of columnNames
}
else
{
$columnNames = "";
}
/* Build the javasript variables to pass to the jqGrid */
?>
<script type="text/javascript">
var mapButton = "<?php $clang->eT("Next") ?>";
var error = "<?php $clang->eT("Error") ?>";
var removecondition = "<?php $clang->eT("Remove condition") ?>";
var cancelBtn = "<?php $clang->eT("Cancel") ?>";
var exportBtn = "<?php $clang->eT("Export") ?>";
var okBtn = "<?php $clang->eT("OK") ?>";
var noRowSelected = "<?php $clang->eT("You have no row selected") ?>";
var searchBtn = "<?php $clang->eT("Search") ?>";
var shareMsg = "<?php $clang->eT("You can see and edit settings for shared participant in share panel.") ?>"; //PLEASE REVIEW
var jsonSearchUrl = "<?php echo Yii::app()->getController()->createUrl("admin/tokens/getSearch_json/surveyid/$surveyid/search"); ?>";
var getSearchIDs = "<?php echo Yii::app()->getController()->createUrl("admin/participants/getSearchIDs"); ?>";
var addbutton = "<?php echo Yii::app()->getRequest()->getBaseUrl() . "/images/plus.png" ?>";
var minusbutton = "<?php echo Yii::app()->getRequest()->getBaseUrl() . "/images/deleteanswer.png" ?>";
var delUrl = "<?php echo Yii::app()->getController()->createUrl("admin/tokens/delete/surveyid/" . $surveyid); ?>";
var cancelBtn = "<?php $clang->eT("Cancel") ?>";
var okBtn = "<?php echo $clang->eT("OK") ?>";
var delmsg = "<?php $clang->eT("Are you sure you want to delete this entry?") ?>";
var surveyID = "<?php echo $surveyid; ?>";
var jsonUrl = "<?php echo Yii::app()->getController()->createUrl('admin/tokens/getTokens_json/surveyid/' . $surveyid); ?>";
var editUrl = "<?php echo Yii::app()->getController()->createUrl('admin/tokens/editToken/surveyid/' . $surveyid); ?>";
var remindurl = "<?php echo Yii::app()->getController()->createUrl("admin/tokens/remind/surveyid/{$surveyid}/tids/|"); ?>";
var invitemsg = "<?php echo $clang->eT("Send invitation emails to the selected entries (if they have not yet been sent an invitation email)"); ?>"
var remindmsg = "<?php echo $clang->eT("Send reminder email to the selected entries (if they have already received the invitation email)"); ?>"
var inviteurl = "<?php echo Yii::app()->getController()->createUrl("admin/tokens/email/surveyid/{$surveyid}/tids/|"); ?>";
var searchtypes = ["<?php $clang->eT("Equals") ?>","<?php $clang->eT("Contains") ?>","<?php $clang->eT("Not equal") ?>","<?php $clang->eT("Not contains") ?>","<?php $clang->eT("Greater than") ?>","<?php $clang->eT("Less than") ?>"]
var colNames = ["ID","<?php $clang->eT("Action") ?>","<?php $clang->eT("First name") ?>","<?php $clang->eT("Last name") ?>","<?php $clang->eT("Email address") ?>","<?php $clang->eT("Email status") ?>","<?php $clang->eT("Token") ?>","<?php $clang->eT("Language") ?>","<?php $clang->eT("Invitation sent?") ?>","<?php $clang->eT("Reminder sent?") ?>","<?php $clang->eT("Reminder count") ?>","<?php $clang->eT("Completed?") ?>","<?php $clang->eT("Uses left") ?>","<?php $clang->eT("Valid from") ?>","<?php $clang->eT("Valid until") ?>",<?php echo $columnNames; ?>];
var colModels = [{ "name":"tid", "index":"tid", "width":20, "align":"center", "sorttype":"int", "sortable": true, "editable":false, "hidden":false},
{ "name":"action", "index":"action", "sorttype":"string", "sortable": false, "width":70, "align":"center", "editable":false},
{ "name":"firstname", "index":"firstname", "sorttype":"string", "sortable": true, "width":100, "align":"center", "editable":true},
{ "name":"lastname", "index":"lastname", "sorttype":"string", "sortable": true,"width":100, "align":"center", "editable":true},
{ "name":"email", "index":"email","align":"center","width":100, "sorttype":"string", "sortable": true, "editable":true},
{ "name":"emailstatus", "index":"emailstatus","align":"center","width":80,"sorttype":"string", "sortable": true, "editable":true, "edittype":"checkbox", "editoptions":{ "value":"OK:N"}},
{ "name":"token", "index":"token","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true},
{ "name":"language", "index":"language","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true, "edittype":"select", "editoptions":{"value":"<?php echo $langnames; ?>"}},
{ "name":"sent", "index":"sent","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true, "edittype":"checkbox", "editoptions":{ "value":"Y:N"}},
{ "name":"remindersent", "index":"remindersent","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true, "edittype":"checkbox", "editoptions":{ "value":"Y:N"}},
{ "name":"remindercount", "index":"remindercount","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true},
{ "name":"completed", "index":"completed","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true, "edittype":"checkbox", "editoptions":{ "value":"Y:N"}},
{ "name":"usesleft", "index":"usesleft","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true},
{ "name":"validfrom", "index":"validfrom","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true, "editoptions":{ dataInit:function (elem) {$(elem).datepicker();}}},
{ "name":"validuntil", "index":"validuntil","align":"center", "sorttype":"int", "sortable": true,"width":80,"editable":true, "editoptions":{ dataInit:function (elem) {$(elem).datepicker();}}},<?php echo implode(",\n", $uidNames); ?>];
<!--
for(i=0; i<document.forms.length; i++)
{
var el = document.createElement('input');
el.type = 'hidden';
el.name = 'checksessionbypost';
el.value = 'kb9e2u4s55';
document.forms[i].appendChild(el);
}
function addHiddenElement(theform,thename,thevalue)
{
var myel = document.createElement('input');
myel.type = 'hidden';
myel.name = thename;
theform.appendChild(myel);
myel.value = thevalue;
return myel;
}
function sendPost(myaction,checkcode,arrayparam,arrayval)
{
var myform = document.createElement('form');
document.body.appendChild(myform);
myform.action =myaction;
myform.method = 'POST';
for (i=0;i<arrayparam.length;i++)
{
addHiddenElement(myform,arrayparam[i],arrayval[i])
}
addHiddenElement(myform,'checksessionbypost',checkcode)
myform.submit();
}
//-->
</script>
<div id ="search" style="display:none">
<?php
$optionsearch = array('' => 'Select One',
'firstname' => $clang->gT("First name"),
'lastname' => $clang->gT("Last name"),
'email' => $clang->gT("Email address"),
'emailstatus' => $clang->gT("Email status"),
'token' => $clang->gT("Token"),
'language' => $clang->gT("Language"),
'sent' => $clang->gT("Invitation sent?"),
'sentreminder' => $clang->gT("Reminder sent?"),
'remindercount' => $clang->gT("Reminder count"),
'completed' => $clang->gT("Completed?"),
'usesleft' => $clang->gT("Uses left"),
'validfrom' => $clang->gT("Valid from"),
'validuntil' => $clang->gT("Valid until"));
$optioncontition = array('' => 'Select One',
'equal' => $clang->gT("Equals"),
'contains' => $clang->gT("Contains"),
'notequal' => $clang->gT("Not equal"),
'notcontains' => $clang->gT("Not contains"),
'greaterthan' => $clang->gT("Greater than"),
'lessthan' => $clang->gT("Less than"));
?>
<table id='searchtable'>
<tr>
<td><?php echo CHtml::dropDownList('field_1', 'id="field_1"', $optionsearch); ?></td>
<td><?php echo CHtml::dropDownList('condition_1', 'id="condition_1"', $optioncontition); ?></td>
<td><input type="text" id="conditiontext_1" style="margin-left:10px;" /></td>
<td><img src=<?php echo Yii::app()->getRequest()->getBaseUrl() . "/images/plus.png" ?> id="addbutton" style="margin-bottom:4px"></td>
</tr>
</table>
<br/>
</div>
<br/>
<table id="displaytokens"></table> <div id="pager"></div>
<!--p><input type="button" name="sendinvitations" id="sendinvitations" value="Send Invitations" onclick='window.open("<?php echo Yii::app()->getController()->createUrl("admin/tokens/email/surveyid/{$surveyid}/tids/|"); ?>"+$("#displaytokens").getGridParam("selarrrow").join("|"), "_blank")' /><input type="button" name="sendreminders" id="sendreminders" value="Send Reminders" onclick='window.open("<?php echo Yii::app()->getController()->createUrl("admin/tokens/remind/surveyid/{$surveyid}/tids/|"); ?>"+$("#displaytokens").getGridParam("selarrrow").join("|"), "_blank")' />
</p-->
</table>
<div id="fieldnotselected" title="<?php $clang->eT("Error") ?>" style="display:none">
<p>
<?php $clang->eT("Please select a field"); ?>
</p>
</div>
<div id="conditionnotselected" title="<?php $clang->eT("Error") ?>" style="display:none">
<p>
<?php $clang->eT("Please select a condition"); ?>
</p>
</div>
<div id="norowselected" title="<?php $clang->eT("Error") ?>" style="display:none">
<p>
<?php $clang->eT("Please select at least one token"); ?>
</p>
</div>
<div class="ui-widget ui-helper-hidden" id="client-script-return-msg" style="display:none"></div>