Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
84 lines (62 sloc) 2.06 KB
<?php
include('inc.php');
require_once('Model/Feedback.php');
if(post('text')) {
$data = array(
'createdBy' => $user->id,
'createdAt' => date('Y-m-d H:i:s'),
'text' => post('text')
);
if(array_key_exists('location', $_COOKIE)) {
list($lat, $lng) = explode(',', $_COOKIE['location']);
$data['createdAtLat'] = $lat;
$data['createdAtLng'] = $lng;
}
Model_Feedback::insert($data);
echo json_encode(array('result'=>'ok'));
die();
}
include('templates/header.php');
?>
<div style="font-size: 22pt; margin-bottom: 10px;"><img src="/assets/tiny-contacts.png" width="282" height="20" /></div>
<div class="entity">
<div class="newNote" style="margin-top: 10px; <?=(get('thanks') ? 'display: none;' : '')?>">
<div>We appreciate your feedback!</div>
<textarea id="newNoteText"></textarea>
<input type="button" id="newNoteBtn" value="Add Note" class="btn" />
</div>
<div style="clear: both;"></div>
<div class="thanks" style="<?=(get('thanks') ? '' : 'display: none;')?> text-align: center;">
<div style="margin-top: 20px; font-size: 15pt; text-align: center;">Thanks for your feedback!</div>
<div style="margin-top: 20px;"><a href="http://twitter.com/TinyContacts">Follow Us on Twitter</a></div>
<div style="margin-top: 20px;">Back to <a href="/list">Your Contacts</a></div>
</div>
<div style="margin-top: 30px; font-weight: bold;">Recent Feedback</div>
<?php
$feedback = new Model_Feedback();
$feedback->loadAll();
foreach($feedback as $f) {
$author = new Model_Entity($f->createdBy);
echo '<div class="note">';
$date = new DateTime($f->createdAt);
$date->setTimeZone($timezone);
echo '<div class="date">' . $date->format('n/j g:ia') . '</div>';
echo '<div class="author">' . $author->name . '</div>';
echo formatText(strip_tags($f->text));
echo '</div>';
}
?>
</div>
<script type="text/javascript">
$(function(){
$("#newNoteBtn").click(function(){
$.post("/feedback", {
text: $("#newNoteText").val()
}, function(data){
window.location = "/feedback?thanks=1";
}, "json");
});
});
</script>
<?php
include('templates/footer.php');