<? _title($this, $this->Language('Emailer'), array(array('href' => '?page=emailer', 'name' => 'All emails'), array('href' => '?page=emailer_add', 'name' => 'Send emails'), array('href' => '?page=statistics', 'name' => 'Email statistics'))); ?>

<form>
	<input type="hidden" name="model" value="messages"/>
	<input type="hidden" name="page" value="emailer"/>
	<table class="content">
	<tr>
		<th><input type="text" name="client_name" value="<?=$_GET['client_name'];?>"/></th>
		<th><input type="text" name="client_email" value="<?=$_GET['client_email'];?>"/></th>
		<th><input type="text" name="subject" value="<?=$_GET['subject'];?>"/></th>
		<th><input type="text" name="content" value="<?=$_GET['content'];?>"/></th>
		<th><input type="text" name="is_sent" value="<?=$_GET['is_sent'];?>"/></th>
		<th><input type="text" name="created_at" value="<?=$_GET['created_at'];?>"/></th>
		<th><input type="text" name="sent_at" value="<?=$_GET['sent_at'];?>"/></th>
		<th style="white-space: nowrap;"><input type="submit" name="search" value="<?=$this->Language('Filter');?>"/> <a href="?model=messages&page=emailer"><?=$this->Language('Clear');?></a></th>
	</tr>
	<tr>
		<th><?=$this->Language('client');?></th>
		<th><?=$this->Language('client email');?></th>
		<th><?=$this->Language('subject');?></th>
		<th><?=$this->Language('content');?></th>
		<th><?=$this->Language('is sent');?></th>
		<th><?=$this->Language('created at');?></th>
		<th><?=$this->Language('sent at');?></th>
		<th></th>
	</tr>
	<?
	while($row = $this->emails->Assoc()){

		?>
		<tr>
			<td><?=$row['client_name'];?></td>
			<td><?=$row['client_email'];?></td>
			<td><?=$row['subject'];?></td>
			<td><?=substr(strip_tags($row['content']), 0, 100);?></td>
			<td><?=$row['is_sent'];?></td>
			<td><?=$row['created_at'];?></td>
			<td><?=$row['sent_at'];?></td>
			<td></td>
		</tr>
		<?
	}
	?>

	<tr>
		<td colspan="7" align="center" style="border-bottom-width:0px;"><? page_generator($this, $this->emails->pageList, ''); ?></td>
	</tr>
	</table>
</form>