<?php
$response = $this->response;

//nacteni uzivatele
if ($response["project"]->count()) {
	$user = $response["project"]->current()->findParentRow("Application_Model_Users", "user");
}
?>
<h1>Výpis projektů</h1>
<table>
	<thead>
		<tr>
			<th>
			#
			</th>
			<th>
			Jméno
			</th>
			<th>
			Popis
			</th>
			<th>
			Vytvořen
			</th>
			<th>
			Majitel
			</th>
		</tr>
	</thead>
	<tbody>
	<?php 
	foreach ($response["project"] as $project) {
		?>
		<tr>
			<td>
			<a href="/project/get/<?php echo $project->directory_id; ?>.html"><?php echo $project->directory_id; ?></a>
			</td>
			<td>
			<?php echo $project->project_name; ?>
			</td>
			<td>
			<?php echo $project->description; ?>
			</td>
			<td>
			<?php echo $project->created_at; ?>
			</td>
			<td>
			<a href="/user/get/<?php echo $user->id; ?>.html"><?php echo $user->username; ?></a>
			</td>
		</tr>
		<?php 
	}
	?>
	</tbody>
</table>
<h2>Zobrazit projekty jiného uživatele</h2>
<form action="/project/get/list.html" method="get">
	<p>
		Identifikační číslo: <?php echo $this->formText("user[id]"); ?>
	</p>
	<p>
		<?php echo $this->formSubmit("list[submit]", "Vyhledat"); ?>
	</p>
</form>