Location: PHPKode > scripts > Todo List > todo-list/add.php
<?
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 ("Common_Todo.cls");
Include_Once ("Todo_View.cls");
Include_Once (dirPath() . "Shared/_app.inc");

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

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

	if ($nFolderID == 0) return;

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

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

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

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

	// ==========================================
	// Get Item

	$itmTodo = $fldrTarget->Create_Item ("Todo", "Test Todo", $clsCommon_Todo);

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

	$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();

	// ==========================================
	// View

	$pnlCalendar->setPanelName ("ENetArch.Calendar");
	$pnlCalendar->getSession ();

	$pnlTodo->setPanelName ("ENetArch.Todos");
	$pnlTodo->setPanelPriorities ($pnlTask_Priorities);
	$pnlTodo->setPanelTaskTypes ($pnlTask_Types);
	$pnlTodo->getPOST();

	$pnlTodo->updateObject ($itmTodo);
	$itmTodo->setField ("dTarget", $pnlCalendar->getDate());
	$itmTodo->Store();

	header ("Location:list.php?nFolderID=" . $nFolderID . "&");

	return;

	// ==========================================
	// for testing

	print ("<HR>");
	foreach ($_REQUEST as $key => $value)
		print ($key . " = " . $value . "<BR>\n");

	print ("<table>\n");
	$pnlTodo->printState();;
	$pnlTodo->drawHeader();
	$pnlTodo->drawPanel();
	print ("</table>");

}
?>
Return current item: Todo List