forked from tylerhall/Shine
-
Notifications
You must be signed in to change notification settings - Fork 1
/
feedback-view.php
232 lines (213 loc) · 6.88 KB
/
feedback-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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?PHP
require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$nav = 'feedback';
$f = new Feedback($_GET['id']);
if(!$f->ok()) redirect('feedback.php');
if(isset($_POST['btnNew']))
{
$f->new = 1;
$f->update();
redirect('feedback.php');
}
elseif(isset($_POST['btnDelete']))
{
$f->delete();
redirect('feedback.php');
}
else
{
$f->new = 0;
$f->update();
}
if(isset($_POST['btnNotes']))
{
$f->notes = $_POST['notes'];
$f->update();
redirect('feedback-view.php?id=' . $f->id);
}
// Get related orders
$db = Database::getDatabase();
$email = $db->quote($f->email);
$orders = DBObject::glob('Order', 'SELECT * FROM shine_orders WHERE payer_email = ' . $email . ' ORDER BY dt DESC');
// Get related feedbacks
$email = $db->quote($f->email);
$feedbacks = DBObject::glob('Feedback', 'SELECT * FROM shine_feedback WHERE email = ' . $email . ' AND id <> ' . $f->id . ' ORDER BY dt DESC');
// Get related activations
$order_ids = array(-1); // -1 prevents sql error when no orders are added to the array
foreach($orders as $o)
$order_ids[] = $o->id;
$order_ids = implode(',', $order_ids);
$activations = DBObject::glob('Activation', "SELECT * FROM shine_activations WHERE (order_id IN ($order_ids)) OR (ip = '{$f->ip}') ORDER BY dt DESC");
?>
<?PHP include('inc/header.inc.php'); ?>
<div id="bd">
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<div class="block tabs spaces">
<div class="hd">
<h2>Orders</h2>
<ul>
<li><a href="feedback.php">All Feedback</a></li>
<li><a href="feedback.php?type=support">Support Questions</a></li>
<li><a href="feedback.php?type=bug">Bug Reports</a></li>
<li><a href="feedback.php?type=feature">Feature Requests</a></li>
<li class="active"><a href="feedback-view.php?id=<?PHP echo $f->id; ?>">Feedback #<?PHP echo $f->id; ?></a></li>
</ul>
<div class="clear"></div>
</div>
<div class="bd">
<table class="lines">
<tr>
<th>App Name</th>
<td><?PHP echo $f->__appname . ' ' . $f->__appversion;?></td>
</tr>
<tr>
<th>System</th>
<td><?PHP echo $f->__systemversion;?></td>
</tr>
<tr>
<th>Email</th>
<td><a href="mailto:<?PHP echo $f->__email;?>"><?PHP echo $f->__email;?></a></td>
</tr>
<tr>
<th>Type</th>
<td><?PHP echo ucwords($f->type);?></td>
</tr>
<tr>
<th>Message</th>
<td><?PHP echo nl2br($f->__message);?></td>
</tr>
<?PHP if($f->type == "feature") : ?>
<tr>
<th>Importance</th>
<td><?PHP echo $f->__importance;?></td>
</tr>
<?PHP endif; ?>
<?PHP if($f->type == "bug") : ?>
<tr>
<th>Critical</th>
<td><?PHP echo ($f->critical == 0) ? "No" : "Yes!"; ?></td>
</tr>
<?PHP endif; ?>
<tr>
<th>Date Submitted</th>
<td><?PHP echo dater('n/j/Y g:ia', $f->dt); ?></td>
</tr>
<tr>
<th>IP</th>
<td><?PHP echo $f->ip;?></td>
</tr>
</table>
<form action="feedback-view.php?id=<?PHP echo $f->id;?>" method="post">
<p>
<input type="submit" name="btnNew" value="Mark as New" id="btnnew"/>
<input type="submit" name="btnDelete" value="Delete" id="btndelete" onclick="return confirm('Are you sure?');"/>
</p>
</form>
</div>
</div>
<div class="block">
<div class="hd">
<h2>Feedback Notes</h2>
</div>
<div clcass="bd">
<form action="feedback-view.php?id=<?PHP echo $f->id; ?>" method="post" class="bd">
<textarea style="width:100%;" name="notes" id="notes"><?PHP echo $f->__notes; ?></textarea>
<input type="submit" name="btnNotes" value="Save Notes" id="btnNotes">
<span class="info">Notes will NOT be sent or made visible to customers.</span>
</form>
</div>
</div>
</div></div>
</div>
<div id="sidebar" class="yui-b">
<div class="block">
<div class="hd">
<h3>Customer Info</h3>
</div>
<div id="rapportive" class="bd"></div>
</div>
<div class="block">
<div class="hd">
<h2>Related Feedback</h2>
</div>
<div class="bd">
<table>
<thead>
<tr>
<td>Date</td>
<td>App Name</td>
<td>Type</td>
</tr>
</thead>
<tbody>
<?PHP foreach($feedbacks as $f) : ?>
<tr>
<td><?PHP echo time2str($f->dt); ?></td>
<td><?PHP echo $f->__appname . ' ' . $f->__appversion;?></td>
<td><a href="feedback-view.php?id=<?PHP echo $f->id; ?>"><?PHP echo ucwords($f->__type); ?></a></td>
</tr>
<?PHP endforeach; ?>
</tbody>
</table>
</div>
</div>
<div class="block">
<div class="hd">
<h2>Related Orders</h2>
</div>
<div class="bd">
<table>
<thead>
<tr>
<td>Date</td>
<td>Name</td>
<td>App Name</td>
</tr>
</thead>
<tbody>
<?PHP foreach($orders as $o) : ?>
<tr>
<td><?PHP echo time2str($o->dt); ?></td>
<td><a href="order.php?id=<?PHP echo $o->id; ?>"><?PHP echo utf8_encode($o->first_name); ?> <?PHP echo utf8_encode($o->last_name); ?></a></td>
<td><?PHP echo $o->applicationName(); ?></td>
</tr>
<?PHP endforeach; ?>
</tbody>
</table>
</div>
</div>
<div class="block">
<div class="hd">
<h2>Related Activations</h2>
</div>
<div class="bd">
<table>
<thead>
<tr>
<td>Date</td>
<td>App Name</td>
<td>IP</td>
</tr>
</thead>
<tbody>
<?PHP foreach($activations as $a) : ?>
<tr>
<td><?PHP echo time2str($a->dt); ?></td>
<td><?PHP echo $a->applicationName(); ?></td>
<td><a href="activations.php?q=<?PHP echo $a->ip; ?>"><?PHP echo $a->ip; ?></a></td>
</tr>
<?PHP endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?PHP include('inc/footer.inc.php'); ?>
<script type="text/javascript" charset="utf-8">
$(function() {
$('#rapportive').load('rapportive.php?email=<?PHP echo $f->__email; ?>');
});
</script>