<?php
require_once "config.inc.php";
require_once "controllers/user.class.php";
$c = new Users();
$current_user = $c->getCurrentUser();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=TITLE?></title>
<link rel="stylesheet" type="text/css" href="common.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="javascript.js"></script>
</head>
<body>
<div class="divContainer">
<div class="divHeader">
<ul class="ulHeaderMenu">
<li><a href="task.php"><?=$c->getMessage("tasks")?></a></li>
<?php
if ($current_user->get("admin") == "yes") {
echo "<li><a href='project.php'>".$c->getMessage("projects")."</a></li>\n";
echo "<li><a class='ulHeaderMenu_current' href='user.php'>".$c->getMessage("users")."</a></li>\n";
}
?>
<li><a href="profile.php"><?=$c->getMessage("profile")?></a></li>
</ul>
<p class="pLogin"><strong><?=$c->getMessage("welcome")?>, <?=htmlentities($current_user->get("username"))?></strong><br /><a class="warning" href="logout.php"><?=$c->getMessage("exit")?></a></p>
</div>
<div class="divBody">
<form id="form1" action="<?=htmlentities($c->getCurrentPage())?>" method="post">
<p>
<span style="float: right; ">
<strong style="padding-right: 10px; "><?=$c->getMessage("with_selected_lines")?></strong>
<input class="inputWarningButton" style="width: 8em; " type="button" value="<?=$c->getMessage("delete")?>" onclick="javascript: return confirmAction('form1', '<?=$c->getMessage("are_you_really_sure")?>', 'delete'); " />
</span>
<input class="inputButton" style="width: 11em; " type="button" value="<?=$c->getMessage("new_user")?>" onclick="javascript: nextPage('form1', 'user_edit.php'); " />
</p>
<table class="tableData" style="width: 100%; " border="0" cellpadding="0" cellspacing="0">
<tr>
<th style="width: 2em; "> </th>
<th style="width: 8em; "><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'date', sense:'<?=$c->getRelativeSense('date')?>'}); "><?=$c->getMessage("date")?></a> <?=$c->getStringSense('date')?></th>
<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'username', sense:'<?=$c->getRelativeSense('username')?>'}); "><?=$c->getMessage("username")?></a> <?=$c->getStringSense('username')?></th>
<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'full_name', sense:'<?=$c->getRelativeSense('full_name')?>'}); "><?=$c->getMessage("full_name")?></a> <?=$c->getStringSense('full_name')?></th>
<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'email', sense:'<?=$c->getRelativeSense('email')?>'}); "><?=$c->getMessage("email")?></a> <?=$c->getStringSense('email')?></th>
<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'admin', sense:'<?=$c->getRelativeSense('admin')?>'}); "><?=$c->getMessage("administrator")?></a> <?=$c->getStringSense('admin')?></th>
<th style="width: 4em; "> </th>
<th style="width: 4em; "> </th>
</tr>
<?php
$even_row = FALSE;
$rows = $c->getRows();
foreach($rows as $row) {
// row style
$row_style = $even_row? " class='tableData_trEven'": " class='tableData_trOdd'";
echo "<tr".$row_style.">\n";
echo "<td><input type='checkbox' name='item_id[]' value='".$row["id"]."' /></td>\n";
echo "<td>".date(DATE_FORMAT, strtotime($row["created_on"]))."</td>\n";
echo "<td><a href='#' onclick='javascript: this.blur(); return windowOpen(\"user_description.php?user_id=".$row["id"]."\", \"_blank\", 600, 600);'>".htmlentities(util_truncate($row["username"], 30))."</a></td>\n";
echo "<td>".htmlentities(util_truncate($row["full_name"], 100))."</td>\n";
echo "<td><a href='mailto:".urlencode($row["email"])."'>".htmlentities($row["email"])."</a></td>\n";
echo "<td>".$c->getMessage($row["admin"])."</td>\n";
echo "<td style='text-align: right; '><a href='#' onclick='javascript: return nextPage(\"form1\", \"user_edit.php?user_id=".$row["id"]."\"); '>Editar</a></td>\n";
echo "<td style='text-align: right; '><a class='warning' href='#' onclick='javascript: return confirmAction(\"form1\", \"¿Estás seguro?\", \"delete_item\", ".$row["id"]."); '>Borrar</a></td>\n";
echo "</tr>\n";
$even_row = !$even_row;
}
?>
</table>
</form>
</div>
</div>
</body>
</html>