{assign var="pgLayout" value="file:./layouts/lite.tpl"}
<h2 class="withBG">My Survey History</h2>

{select_query return="array" assign="aSurveys"}
st.surveyId, st.dateTaken, st.pointsEarned, s.surveyName 
FROM surveys_taken st
LEFT JOIN surveys s ON (s.id = st.surveyId)
WHERE userId = {$user->id} 
ORDER BY dateTaken
{/select_query}

<table width="100%">
<thead>
	<tr>
		<td nowrap="nowrap"><small><b><u>Survey Name</u></b></small></td>
		<td nowrap="nowrap"><small><b><u>Date Taken</u></b></small></td>
		<td nowrap="nowrap"><small><b><u>Points Earned</u></b></small></td>
		<td><small><b><u>Action</u></b></small></td>
	</tr>
</thead>
{foreach from=$aSurveys item=item name=survey}
	<tr>
		<td nowrap="nowrap"><small>{$item.surveyName}</small></td>
		<td><small>{$item.dateTaken|date_format2:"m/d/y"}</small></td>
		<td><small>{$item.pointsEarned}</small></td>
		<td><small><a href="index.php?pg=surveyReview&takenId={$item.surveyId}">Review</a></small></td>
	</tr>
{/foreach}
</table>