Location: PHPKode > projects > PushOk SEMA > html/web/time_track/time_track_form.php
<?PHP
// Pushok's SEMA (Small Enterprise Management Application)
//
// Copyright (C) 2004 Pushok Software http://www.pushok.com
//
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html

/*
subscription: contain form to create new time_track
*/
$nIdParent = 0;
if ( isset($_GET['idparent']) && $_GET['idparent']>0 )
	$nIdParent = $_GET['idparent'];
	
if ( !$nIdParent )
	web_RedirectRelative("sema.php");	
	
class web_TimeTrack extends web_Layout 
{
	function Info()
	{
		global $nIdParent;
		
		$this->formStart(_LW("New time track"));
        echo "<FORM method=post>";
		echo "<INPUT type=\"hidden\" name=\"idform\" value=\"FM_TIMETRACK_CREATE\"></INPUT>\n";
		$sLink = web_GetPrevPage();
		if (!strlen($sLink))
			$sLink = "?page=/web/time_track/time_track_main.php&idparent=$nIdParent";
		echo "<INPUT type=\"hidden\" name=\"onsuccess\" value=\"$sLink\"></INPUT>\n";
		echo "<INPUT type=\"hidden\" name=\"onerror\" value=\"?".web_GetPageGetParams()."\"></INPUT>\n";
		echo "<INPUT type=\"hidden\" name=\"idparent\" value=\"$nIdParent\"></INPUT>\n";
		
		// if was some error then show the message about
		$bError = isset($_SESSION['last_post']);

		// comment column 
		$sFieldValue = "";
		if ( $bError )
			$sFieldValue = $_SESSION['last_post']['data']['comment'];
		$this->formInputItem(_LW("Comment"),"edit","comment",$sFieldValue);
		
		// start column 
		$sFieldValue = date("Y-m-d");//default value
		if ( $bError )
			$sFieldValue = $_SESSION['last_post']['data']['start'];
		$this->formInputItem(_LW("Start"),"date","start",$sFieldValue);
			
		// end column 
		$sFieldValue = date("Y-m-d");//default value
		if ( $bError )
			$sFieldValue = $_SESSION['last_post']['data']['end'];
		$this->formInputItem(_LW("End"),"date","end",$sFieldValue);
			
		// work volume column 
		$sFieldValue = "";
		if ( $bError )
			$sFieldValue = $_SESSION['last_post']['data']['work_volume'];
		$this->formInputItem(_LW("Work volume"),"edit","work_volume",$sFieldValue);
		
		$sFieldValue = _LW("Create");
		$this->formInputItem($sFieldValue,"submit","","");						
        echo "</FORM>";
		
		$this->formEnd();
		?>
		<?PHP
	}
}

$oPage = new web_TimeTrack;
$oPage->m_windowHeader = _LW("Create time track");
$oPage->WebStack("time_track_form.php", $oPage->m_windowHeader, $oPage->m_windowHeader, web_GetPageGetParams());

if ( !isset($_SESSION['iduser']) )
	web_RedirectRelative("sema.php");
	
$oPage->RenderPage();

?>
Return current item: PushOk SEMA