<?php
require_once "config.inc.php";
require_once "controllers/project.class.php";
$c = new Project();
$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 class='ulHeaderMenu_current' href='project.php'>".$c->getMessage("projects")."</a></li>\n";
echo "<li><a 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="inputButton" style="width: 8em; " type="button" value="<?=$c->getMessage("open_project")?>" onclick="javascript: submitAction('form1', 'open'); " />
<input class="inputButton" style="width: 8em; " type="button" value="<?=$c->getMessage("close_project")?>" onclick="javascript: submitAction('form1', 'close'); " />
<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: 12em;" type="button" value="<?=$c->getMessage("new_project")?>" onclick="javascript: nextPage('form1', 'project_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:'title', sense:'<?=$c->getRelativeSense('title')?>'}); "><?=$c->getMessage("project")?></a> <?=$c->getStringSense('title')?></th>
<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'status', sense:'<?=$c->getRelativeSense('status')?>'}); "><?=$c->getMessage("status")?></a> <?=$c->getStringSense('status')?></th>
<th><?=$c->getMessage("users")?></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'";
// status style
$status_style = NULL;
if ($row["status"] == "open")
$status_style = " class='openProject'";
else
if ($row["status"] == "closed")
$status_style = " class='closedProject'";
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(\"project_description.php?project_id=".$row["id"]."\", \"_blank\", 600, 600);'>".htmlentities(util_truncate($row["title"], 50))."</a></td>\n";
echo "<td".$status_style.">".$c->getMessage($row["status"])."</td>\n";
echo "<td>".htmlentities(util_truncate($c->getUsers($row["id"]), 100))."</td>";
echo "<td style='text-align: right; '><a href='#' onclick='javascript: return nextPage(\"form1\", \"project_edit.php?project_id=".$row["id"]."\"); '>".$c->getMessage("edit")."</a></td>\n";
echo "<td style='text-align: right; '><a class='warning' href='#' onclick='javascript: return confirmAction(\"form1\", \"".$c->getMessage("are_you_sure")."\", \"delete_item\", ".$row["id"]."); '>".$c->getMessage("delete")."</a></td>\n";
echo "</tr>\n";
$even_row = !$even_row;
}
?>
</table>
</form>
</div>
</div>
</body>
</html>