Location: PHPKode > scripts > Appointment Calendar > add.php
<?
function dirPath() { return ("../../"); }

Include_Once (dirPath() . "Shared/Classes/Ladder/Ladder_Ladder.cls");
Include_Once ("Common_Panel.cls");
Include_Once ("Time_Length.cls");
Include_Once ("Time_Start.cls");
Include_Once ("Calendar_Week.cls");
Include_Once ("Common_Appointment.cls");
Include_Once ("Appointment_Edit.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_Appointment = gblLadder()->getClass ("Common_Appointment")->ID();

	// ==========================================
	// Get Appointments Folder

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

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

	$itmAppointment = $fldrTarget->Create_Item ("Appointment", "Test Appointment", $clsCommon_Appointment);

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

	$pnlApt = new ENetArch_Panels_Common_Appointment();

	$pnlTime_Start = new ENetArch_Panels_Common_Time_Start();
	$pnlTime_Lengths = new ENetArch_Panels_Common_Time_Lengths();

	$pnlCalendar = new ENetArch_Panels_Common_Calendar_Week();

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

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

	$pnlApt->setPanelName ("ENetArch.Appointments");
	$pnlApt->setPanelTimes ($pnlTime_Start);
	$pnlApt->setPanelLengths ($pnlTime_Lengths);
	$pnlApt->getPOST();

	$pnlApt->updateObject ($itmAppointment);
	$itmAppointment->setField ("dTarget", $pnlCalendar->getDate());
	$itmAppointment->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");
	$pnlApt->drawHeader();
	$pnlApt->drawPanel();
	print ("</table>");

}
?>
Return current item: Appointment Calendar