Location: PHPKode > scripts > Todo List > todo-list/delete.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 ("Common_Todos.cls");
Include_Once ("Todo_Edit.cls");
Include_Once (dirPath() . "Shared/_app.inc");

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

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

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

	if ($nFolderID == 0) return;
	if ($szIDs == "") 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);

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

	$pnlCalendar = new ENetArch_Panels_Common_Calendar_Week();

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

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

	$aryIDs = parseString ($szIDs, ",");

	for ($t=0; $t<count ($aryIDs); $t++)
	{
		$nPos = $aryIDs [$t];
		if ($nPos > 0)
		{
			$itmTodo = $fldrTodos->Item ($nPos, Array (1=>$clsCommon_Todo));
			$itmTodo->Delete();
		}
	}

	header ("Location:List.php?nFolderID=" . $nFolderID . "&");
}
?>
Return current item: Todo List