Location: PHPKode > projects > TimeSheet4dotProject > ts4dp/timesheet/graphInputs.php
<?php
require_once('session.php');
require_once('global4app.php');
if ($_SESSION['uid'] == "")
{
	echo '<html><head><meta http-equiv="refresh" content="5; URL=index.php"></head><body>';
	echo '<center>Fatal Error. You haven\'t logged in properly<br/><a href=index.php>'.'Click Here To exit and login again </a> (forwarded in 5 sec.)</center></body></html>';
	exit();
}
?>
<html>
<head>
<title>Timesheet4dP</title>
<link rel=stylesheet type="text/css" href="./css/main.css">
<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
#cal1 { display:none; position:absolute;}
#cal2 { display:none; position:absolute;}
</style>

<link rel="stylesheet" type="text/css" href="./yui/fonts/fonts-min.css?_yuiversion=2.5.0" />
<link rel="stylesheet" type="text/css" href="./yui/button/assets/skins/sam/button.css?_yuiversion=2.5.0" />
<link rel="stylesheet" type="text/css" href="./yui/container/assets/skins/sam/container.css?_yuiversion=2.5.0" />
<link rel="stylesheet" type="text/css" href="./yui/calendar/assets/skins/sam/calendar.css?_yuiversion=2.5.0" />
<script type="text/javascript" src="./yui/utilities/utilities.js?_yuiversion=2.5.0"></script>
<script type="text/javascript" src="./yui/button/button.js?_yuiversion=2.5.0"></script>
<script type="text/javascript" src="./yui/container/container.js?_yuiversion=2.5.0"></script>
<script type="text/javascript" src="./yui/calendar/calendar.js?_yuiversion=2.5.0"></script>
</head>
<body class=" yui-skin-sam" bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br><br>
<script type="text/javascript">	
	var todayDate = new Date();
	var pgdate = todayDate.getMonth()+1 + "/" + todayDate.getFullYear(); // show current month on click ....
	var endDate = todayDate.getMonth()+1 + "/" + todayDate.getDate() + "/" + todayDate.getFullYear();
	var startDate = todayDate.getMonth()-11 + "/" + todayDate.getDate() + "/" + todayDate.getFullYear(); // last 1 year 
	YAHOO.namespace("example.calendar");

	YAHOO.example.calendar.init = function() {
        	
		YAHOO.example.calendar.cal1a = new YAHOO.widget.Calendar("cal1a","cal1" ,{ pagedate: ""+pgdate, mindate: ""+startDate, maxdate: ""+endDate, title:"Choose a date:", close:true });
		YAHOO.example.calendar.cal1a.render();
		YAHOO.util.Event.addListener("showCal1", "click", YAHOO.example.calendar.cal1a.show, YAHOO.example.calendar.cal1a, true);
		
		var mySelectHandler = function(type,args,obj) {
		var selected = args[0];
			
		if (YAHOO.example.calendar.cal1a.getSelectedDates().length > 0) 
		{
                var selDate = YAHOO.example.calendar.cal1a.getSelectedDates()[0];
                //alert(selDate);
                var dStr = selDate.getDate();
                var mStr = selDate.getMonth() + 1;
                var yStr = selDate.getFullYear();

                YAHOO.util.Dom.get("s1d1").value =  yStr + "-" + mStr + "-" + dStr;
            } else {
                YAHOO.util.Dom.get("s1d1").value = "";
            }			
			YAHOO.example.calendar.cal1a.hide();
		};

		YAHOO.example.calendar.cal1a.selectEvent.subscribe(mySelectHandler, YAHOO.example.calendar.cal1a, true);
		
		YAHOO.example.calendar.cal2a = new YAHOO.widget.Calendar("cal2a","cal2" ,{ pagedate: ""+pgdate, mindate: ""+startDate, maxdate: ""+endDate, title:"Choose a date:", close:true });
		YAHOO.example.calendar.cal2a.render();
		YAHOO.util.Event.addListener("showCal2", "click", YAHOO.example.calendar.cal2a.show, YAHOO.example.calendar.cal2a, true);
		
		var mySelectHandler = function(type,args,obj) {
		var selected = args[0];
			
		if (YAHOO.example.calendar.cal2a.getSelectedDates().length > 0) 
		{
                var selDate = YAHOO.example.calendar.cal2a.getSelectedDates()[0];
					 //alert(selDate);
                var dStr = selDate.getDate();
                var mStr = selDate.getMonth() + 1;
                var yStr = selDate.getFullYear();
                var DateMath=YAHOO.widget.DateMath;
					 if (DateMath.before(YAHOO.example.calendar.cal1a.getSelectedDates()[0],selDate))
					 {
					 	YAHOO.util.Dom.get("s2d2").value =  yStr + "-" + mStr + "-" + dStr;
					 }
					 else
					 {
					 	alert("Study 2 date should be greater than Study 1 date, please change accordingly"); 
					 }
					 					 
                
            } else {
                YAHOO.util.Dom.get("s2d2").value = "";
            }			
			YAHOO.example.calendar.cal2a.hide();
		};

		YAHOO.example.calendar.cal2a.selectEvent.subscribe(mySelectHandler, YAHOO.example.calendar.cal2a, true);
		
	}

	YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);
	
function checkDates()
{
	if (document.forms[0].s1d1.value == "")
	{
		alert("Please select study 1 date");
		return false;
	}
	if (document.forms[0].s2d2.value == "")
	{
		alert("Please select study 2 date");
		return false;
	}
	document.forms[0].s1d1.disabled = false;
	document.forms[0].s2d2.disabled = false;
	return true;	
}

</script>
<form method=post action=drawCompany.php onSubmit="return checkDates()">
<table width=60% cellpadding=7 cellspacing=1 border=1 align=center valign=center>
<tr><td colspan=2 align=center><h1>Choose 2 Study dates and proceed to view the user graphs...</h1></td></tr>
<tr><td><b>Study 1</b></td><td><b>Study 2</b></td></tr>
<tr><td>Date 1 &nbsp;&nbsp;&nbsp; <input type=text size=12 name=s1d1 id=s1d1 disabled> <img src="img/calbtn.gif" id=showCal1 name=showCal1 width="18" height="18" alt="Calendar" align=center style="{padding-bottom:7}"><div id=cal1 name=cal1></td><td>Date 2 &nbsp;&nbsp;&nbsp; <input type=text size=12 name=s2d2 id=s2d2 disabled> <img src="img/calbtn.gif" id=showCal2 name=showCal2 width="18" height="18" alt="Calendar" align=center style="{padding-bottom:7}"><div id=cal2 name=cal2></td></tr>
<tr><td colspan=2 align=right><input type=submit value=Proceed> </td></tr>
</table>
</form>
</body>
</html>

Return current item: TimeSheet4dotProject