Location: PHPKode > scripts > Todo List > todo-list/list.php
<?
/*	=======================================
	Copyright 1998 - 2010 - E Net Arch
	This program is distributed under the terms of the GNU
	General Public License (or the Lesser GPL).
	======================================= */

function dirPath() { return ("../../"); }

Include_Once (dirPath() . "Shared/Classes/Ladder/Ladder_Ladder.cls");
Include_Once ("Common_Panel.cls");
Include_Once ("Task_Priorities.cls");
Include_Once ("Task_Types.cls");
Include_Once ("Calendar_Week.cls");
Include_Once ("Todo_View.cls");
Include_Once ("Common_Todos.cls");
Include_Once ("Common_List5.cls");
Include_Once (dirPath() . "Shared/_app.inc");

Function php_Main ()
{
	$nFolderID = 0;
	if (isset ($_REQUEST ['nFolderID']))
		$nFolderID = $_REQUEST ['nFolderID'];

	$dTarget = "";
	if (isset ($_REQUEST ['dTarget']))
		$dTarget = $_REQUEST ['dTarget'];

	// ==========================================
	// Validations

	if ($nFolderID == 0) return;

	// =======================================
	// Classes

	$clsCommon_Todo = gblLadder()->getClass ("Common_Todo")->ID();

	// ==========================================
	// Get Todos Folder

	$fldrTarget = gblLadder()->getItem ($nFolderID);

	// =======================================
	// Set Todos Folder

	$fldrTodos = New ENetArch_Common_Todos();
	$fldrTodos->setState ($fldrTarget);

	$fldrTaskTypes = $fldrTodos->getTaskTypes();

	// ==========================================
	// Panels

	$pnlList = new ENetArch_Panels_Common_List();
	$pnlTodo = new ENetArch_Panels_Common_Todo();

	$pnlTask_Priorities = new ENetArch_Panels_Common_Task_Priorities();
	$pnlTask_Types = new ENetArch_Panels_Common_Task_Types();

	$pnlCalendar = new ENetArch_Panels_Common_Calendar_Week();

	// ==========================================
	// Lists

	$pnlCalendar->setPanelName ("ENetArch.Calendar");
	$pnlCalendar->getSession ();
	if (trim ($dTarget) != "") $pnlCalendar->setDate ($dTarget);
	$pnlCalendar->setSession ();

	$fldrTodos->setDate ($pnlCalendar->getDate());

	$pnlTask_Types->setFolder ($fldrTaskTypes);

	$pnlList->setPanelName ("ENetArch.Todos");
	$pnlList->nPerPage = -1;
	$pnlList->nCurrentPage = 1;
	$pnlList->setRowPanel ($pnlTodo);
	$pnlList->fldrTarget = $fldrTodos;
	$pnlList->clsList = Array (1=>$clsCommon_Todo);

	$pnlTodo->setPanelPriorities ($pnlTask_Priorities);
	$pnlTodo->setPanelTaskTypes ($pnlTask_Types);

?>
	<style>	@import url("styles.css");	</style>
	<script src="jquery_lite.js"></script>
	<script src="trgrs_Todos.js"></script>
	<script>ENetArch.Todos.nFolderID = <?= $nFolderID ?>;</script>
<?
	$pnlCalendar->drawPanel();
?>
	<div ID="ENetArch_Navigation">
	<a href="javascript:void(0);" onClick="ENetArch.Todos.List ();">Refresh</a> |
	<a href="javascript:void(0);" onClick="ENetArch.Todos.New ();">New</a> |
	<a href="javascript:void(0);" onClick="ENetArch.Todos.View ();">View</a> |
	<a href="javascript:void(0);" onClick="ENetArch.Todos.Edit ();">Edit</a> |
	<a href="javascript:void(0);" onClick="ENetArch.Todos.Delete ();">Delete</a>
	</div>
<?
	print ("<form name=\"ENetArch_Todos_Form\" onSubmit =\"ENetArch.Todos.AddNew(this)\" >\n");
	$pnlList->drawPanel();
	print ("</form>");
?>
	<script>
		$("ENetArch_Navigation").style.width = $("ENetArch_Calendar").offsetWidth - 6;
		$("ENetArch_Todos").style.width = $("ENetArch_Calendar").offsetWidth;
	</script>
<?
}
?>
Return current item: Todo List