Location: PHPKode > projects > Todo Manager > todo/task.php
<?php
require_once "config.inc.php";
require_once "controllers/task.class.php";
require_once "classes/messages.class.php";

$c = new Task();
$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 class="ulHeaderMenu_current" 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 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("done")?>" onclick="javascript: submitAction('form1', 'done'); " />
						<input class="inputButton" style="width: 8em; " type="button" value="<?=$c->getMessage("pending")?>" onclick="javascript: submitAction('form1', 'pending'); " />
						<input class="inputButton" style="width: 8em; " type="button" value="<?=$c->getMessage("discard")?>" onclick="javascript: submitAction('form1', 'discard'); " />
						<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: 10em;" type="button" value="<?=$c->getMessage("new_task")?>" onclick="javascript: nextPage('form1', 'task_edit.php?project_id=<?=$c->getFilterId("project_id")?>'); " />
				</p>
				<p>
					<input class="inputButton" style="width: 3em; " type="button" value="&lt;&lt;" onclick="javascript: submitAction('form1', 'first_page'); " />
					<input class="inputButton" style="width: 3em; " type="button" value="&lt;" onclick="javascript: submitAction('form1', 'prior_page'); " />
					<input class="inputButton" style="width: 3em; " type="button" value="&gt;" onclick="javascript: submitAction('form1', 'next_page'); " />
					<input class="inputButton" style="width: 3em; " type="button" value="&gt;&gt;" onclick="javascript: submitAction('form1', 'last_page'); " />
					<strong><?=$c->getMessage("page")?> <?=$c->getPage() + 1?> <?=$c->getMessage("of")?> <?=$c->getMaxPage() + 1?></strong>
				</p>
				<table class="tableData" style="width: 100%; " border="0" cellpadding="0" cellspacing="0">
					<tr>
						<th style="width: 2em; ">&nbsp;</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 style="width: 20px; ">&nbsp;</th>
						<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'task', sense:'<?=$c->getRelativeSense('task')?>'}); "><?=$c->getMessage("task")?></a> <?=$c->getStringSense('task')?></th>
						<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'created_by', sense:'<?=$c->getRelativeSense('created_by')?>'}); "><?=$c->getMessage("created_by")?></a> <?=$c->getStringSense('created_by')?></th>
						<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'assigned_to', sense:'<?=$c->getRelativeSense('assigned_to')?>'}); "><?=$c->getMessage("assigned_to")?></a> <?=$c->getStringSense('assigned_to')?></th>
						<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'project', sense:'<?=$c->getRelativeSense('project')?>'}); "><?=$c->getMessage("project")?></a> <?=$c->getStringSense('project')?></th>
						<th><a href="#" onclick="javascript: submitAction('form1', 'order_by', {column:'priority', sense:'<?=$c->getRelativeSense('priority')?>'}); "><?=$c->getMessage("priority")?></a> <?=$c->getStringSense('priority')?></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 style="width: 4em; ">&nbsp;</th>
						<th style="width: 4em; ">&nbsp;</th>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>
							<select onchange="javascript: submitAction('form1', 'filter_by', {column: 'created_by_user_id', id: this.value}); ">
								<option value="">&nbsp;</option>
								<?php
								$users = $c->getUsers();
								foreach($users as $user) {
									$selected = $c->getFilterId("created_by_user_id") == $user["id"]? " selected='selected'": NULL;
									echo "<option value='".htmlentities($user["id"])."'".$selected.">".htmlentities($user["username"])."</option>\n";
								}
								?>
							</select>
						</td>
						<td>
							<select onchange="javascript: submitAction('form1', 'filter_by', {column: 'assigned_to_user_id', id: this.value}); ">
								<option value="">&nbsp;</option>
								<?php
								$users = $c->getUsers();
								foreach($users as $user) {
									$selected = $c->getFilterId("assigned_to_user_id") == $user["id"]? " selected='selected'": NULL;
									echo "<option value='".htmlentities($user["id"])."'".$selected.">".htmlentities($user["username"])."</option>\n";
								}
								?>
							</select>
						</td>
						<td>
							<select onchange="javascript: submitAction('form1', 'filter_by', {column: 'project_id', id: this.value}); ">
								<option value="">&nbsp;</option>
								<?php
								$projects = $c->getProjects();
								foreach($projects as $project) {
									$selected = $c->getFilterId("project_id") == $project["id"]? " selected='selected'": NULL;
									echo "<option value='".htmlentities($project["id"])."'".$selected.">".htmlentities($project["title"])."</option>\n";
								}
								?>
							</select>
						</td>
						<td>
							<select onchange="javascript: submitAction('form1', 'filter_by', {column: 'priority', id: this.value}); ">
								<option value="">&nbsp;</option>
								<option value="normal"<?=$c->getFilterId("priority") == "normal"? " selected='selected'": NULL?>><?=$c->getMessage("normal")?></option>
								<option value="high"<?=$c->getFilterId("priority") == "high"? " selected='selected'": NULL?>><?=$c->getMessage("high")?></option>
								<option value="low"<?=$c->getFilterId("priority") == "low"? " selected='selected'": NULL?>><?=$c->getMessage("low")?></option>
							</select>
						</td>
						<td>
							<select onchange="javascript: submitAction('form1', 'filter_by', {column: 'status', id: this.value}); ">
								<option value="">&nbsp;</option>
								<option value="pending"<?=$c->getFilterId("status") == "pending"? " selected='selected'": NULL?>><?=$c->getMessage("pending")?></option>
								<option value="done"<?=$c->getFilterId("status") == "done"? " selected='selected'": NULL?>><?=$c->getMessage("done")?></option>
								<option value="discard"<?=$c->getFilterId("status") == "discard"? " selected='selected'": NULL?>><?=$c->getMessage("discard")?></option>
							</select>
						</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<?php
					$even_row = FALSE;
					$rows = $c->getRows();
					foreach($rows as $row) {
						// row style
						$row_style = $even_row? " class='tableData_trEven'": " class='tableData_trOdd'";
						
						// priority style
						$priority_style = NULL;
						if ($row["priority"] == "high")
							$priority_style = " class='highPriority'";
						else
						if ($row["priority"] == "normal")
							$priority_style = " class='normalPriority'";
						else
						if ($row["priority"] == "low")
							$priority_style = " class='lowPriority'";
							
						// status style
						$status_style = NULL;
						if ($row["status"] == "pending")
							$status_style = " class='pendingStatus'";
						else
						if ($row["status"] == "done")
							$status_style = " class='doneStatus'";
						else
						if ($row["status"] == "discard")
							$status_style = " class='discardStatus'";
							
						// project status
						$project_style = NULL;
						if ($row["project_status"] == "open")
							$project_style = " class='openProject'";
						else
						if ($row["project_status"] == "closed")
							$project_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";
						if (util_empty($row["attached_file"]))
							echo "<td>&nbsp;</td>\n";
						else
							echo "<td><a href='download.php?filename=".urlencode($row["attached_file"])."' onclick='javascript: this.blur(); '><img src='images/attached.gif' alt='' /></a></td>\n";
						echo "<td><a href='#' onclick='javascript: this.blur(); return windowOpen(\"task_description.php?task_id=".$row["id"]."\", \"_blank\", 600, 600); '>".htmlentities(util_truncate($row["title"], 50))."</a></td>\n";
						echo "<td>".htmlentities(util_truncate($row["created_by"]))."</td>\n";
						echo "<td>".htmlentities(util_truncate($row["assigned_to"]))."</td>\n";
						echo "<td".$project_style.">".htmlentities(util_truncate($row["project_name"], 30))."</td>\n";
						echo "<td".$priority_style.">".$c->getMessage($row["priority"])."</td>\n";
						echo "<td".$status_style.">".$c->getMessage($row["status"])."</td>\n";
						echo "<td style='text-align: right; '><a href='#' onclick='javascript: return nextPage(\"form1\", \"task_edit.php?task_id=".$row["id"]."&amp;project_id=".$c->getFilterId("project_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>
Return current item: Todo Manager