Location: PHPKode > projects > TimeSheet4dotProject > ts4dp/timesheet/indexa.php
<?php
require_once('session.php');
require_once('global4app.php');
if ($_POST['username'] == "")
{
	echo '<html><head><meta http-equiv="refresh" content="5; URL=exit.php"></head><body>';
	echo 'Fatal Error. You haven\'t logged in properly<br/><a href=exit.php>'.'Click Here To exit and login again </a> (forwarded in 5 sec.)</body></html>';
	exit();
}
else
{
	$_SESSION['username'] = $_POST['username']; 
	$result = db_loadList('select * from users where user_username =\''.$_SESSION['username'].'\'');
	foreach($result as $row)
	{
		$_SESSION['uid'] = $row['user_id'];
		//print " uid - " . $_SESSION['uid'];
	}
?>
<html>
<head>
<title>Timesheet4dP</title>
<link rel="stylesheet" type="text/css" href="./yui/fonts/fonts.css" />
<link rel="stylesheet" type="text/css" href="./yui/container/assets/container.css" />
<link type="text/css" rel="stylesheet" href="./yui/calendar/assets/skins/sam/calendar.css"> 
<link rel=stylesheet type="text/css" href="./yui/build/fonts/fonts-min.css">
<link rel=stylesheet type="text/css" href="main.css">
<script language="javascript" type="text/javascript" src="getObj.js"></script> 
<script language="JavaScript" type="text/JavaScript">
function changeProjects()
{
	getObj('projectImage').src = 'ajaxOn.gif';
	selectedCompanyID = getObj('companyName')[getObj('companyName').selectedIndex].value;
	getObj('projectName').disabled = true;
	if (selectedCompanyID > 0)
	{
		// populate projects
		var http = getHTTPObject();
      		var URLString = 'getProjects.php?companyId=' + selectedCompanyID
      		http.open("GET", URLString, true); 
      		http.onreadystatechange = function() 
      		{ 
              		if (http.readyState == 4) 
              		{ 
                    		//alert(http.responseText); 
                    		getObj("projectList").innerHTML = http.responseText;
                    		getObj('projectName').disabled = false;
		    		getObj('projectImage').src = 'ajaxOff.gif';
              		} 
      		} 
      		http.send(null);
	}
	else
	{
		alert("Select a valid company");
		getObj('projectImage').src = 'ajaxOff.gif';
		return false;
	}
}
function changeTask()
{
	getObj('taskImage').src = 'ajaxOn.gif';
	selectedProjectID = getObj('projectName')[getObj('projectName').selectedIndex].value;
	//alert(selectedProjectID);
	getObj('taskName').disabled =  true;
	if (selectedProjectID > 0)
	{
		// populate Tasks
		var http = getHTTPObject();
      var URLString = 'getTasks.php?projectId=' + selectedProjectID
      //alert (URLString);
      http.open("GET", URLString, true); 
      http.onreadystatechange = function() 
      { 
              if (http.readyState == 4) 
              { 
                    //alert(http.responseText); 
                    getObj("taskList").innerHTML = http.responseText;
                    getObj('taskName').disabled = false;
		    getObj('taskImage').src = 'ajaxOff.gif';
              } 
      } 
      http.send(null);		
	}
	else
	{
		alert("Select a valid project");
		getObj('projectImage').src = 'ajaxOff.gif';
		return false;
	}
}
</script>
<script type="text/javascript" src="./yui/yahoo/yahoo.js" ></script>
<script type="text/javascript" src="./yui/event/event.js" ></script>
<script type="text/javascript" src="./yui/dom/dom.js" ></script>
<script type="text/javascript" src="./yui/dragdrop/dragdrop.js" ></script>
<script type="text/javascript" src="./yui/animation/animation.js" ></script>
<script type="text/javascript" src="./yui/connection/connection.js" ></script>
<script type="text/javascript" src="./yui/container/container.js"></script>
<script type="text/javascript" src="./yui/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="./yui/calendar/calendar.js"></script>
<script type="text/javascript">
    YAHOO.util.Event.onDOMReady(function(){

        var dialog, calendar;

        calendar = new YAHOO.widget.Calendar("cal", {
            iframe:false,          // Turn iframe off, since container has iframe support.
            hide_blank_weeks:true  // Enable, to demonstrate how we handle changing height, using changeContent
        });

        function okHandler() {
            if (calendar.getSelectedDates().length > 0) {

                var selDate = calendar.getSelectedDates()[0];

                // Pretty Date Output, using Calendar's Locale values: Friday, 8 February 2008
                var wStr = calendar.cfg.getProperty("WEEKDAYS_LONG")[selDate.getDay()];
                var dStr = selDate.getDate();
                var mStr = calendar.cfg.getProperty("MONTHS_LONG")[selDate.getMonth()];
                var yStr = selDate.getFullYear();

                YAHOO.util.Dom.get("date").value = wStr + ", " + dStr + " " + mStr + " " + yStr;
            } else {
                YAHOO.util.Dom.get("date").value = "";
            }
            this.hide();
        }
        
        function cancelHandler() {
            this.hide();
        }

        dialog = new YAHOO.widget.Dialog("container", {
            context:["show", "tl", "bl"],
            buttons:[ {text:"Select", isDefault:true, handler: okHandler}, 
                      {text:"Cancel", handler: cancelHandler}],
            width:"16em",  // Sam Skin dialog needs to have a width defined (7*2em + 2*1em = 16em).
            draggable:false,
            close:true
        });
        calendar.render();
        dialog.render();

        // Using dialog.hide() instead of visible:false is a workaround for an IE6/7 container known issue with border-collapse:collapse.
        dialog.hide();

        calendar.renderEvent.subscribe(function() {
            // Tell Dialog it's contents have changed, Currently used by container for IE6/Safari2 to sync underlay size
            dialog.fireEvent("changeContent");
        });

        YAHOO.util.Event.on("show", "click", dialog.show, dialog, true);
    });


		var todayDate = new Date();		
		var endDate = todayDate.getMonth()+1 + "/" + todayDate.getDate() + "/" + todayDate.getFullYear();
		todayDate.setMonth(todayDate.getMonth() - 1);
		var startDate = todayDate.getMonth()+1 + "/" + todayDate.getDate() + "/" + todayDate.getFullYear();
		alert (startDate);
		alert (endDate);
</script>
</head>
<body class="yui-skin-sam" bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- User name is the input to proceed further...-->
<br><br><hr/>

<table width="500" border="0" cellspacing="2" cellpadding="10" align="center" valign=center>
<tr>
	<td colspan=3 align=right>Welcome <? print $_SESSION['username'] ?>, <a href=exit.php> Logout </a></td>
</tr>
<tr>
	<td colspan=3><b>Task Logs</b></td>
</tr>
<tr>
	<td>Select Company </td>
	<td><select id=companyName style="{width:275}" onChange=changeProjects();><option id=0>Select a Company</option>
	<?php
	$result = mysql_query('select * from companies');
	while($row = mysql_fetch_assoc($result))
	{
		echo '<option value='.$row['company_id'].'>'.$row['company_name'].'</option>';
	}
	
	?>
	<td></td>
	</select></td>
</tr>
<tr>
	<td>Select Project </td>
	<td><div id=projectList><select id=projectName disabled style="{width:275}" onChange=changeTask();><option id=0>Select a Project</option></select></div></td>
	<td><img id=projectImage src=ajaxOff.gif></td>
</tr>
<tr>
	<td>Select Task </td>
	<td><div id=taskList><select id=taskName disabled style="{width:275}"><option id=0>Select a Task</option></select></div></td>
	<td><img id=taskImage src=ajaxOff.gif></td>
</tr>
<tr>
	<td><input type=Button value="View Task Logs" onclick="YAHOO.newtask.popup.dlg.show()"></td>
	<td><input type=Button value="Submit a New Task Log"></td>
	<td><img id=submitImage src=ajaxOff.gif></td>
</tr>
</table>
<?php
}
include ('footer.php');
?>

<div class="box">
   <div class="datefield">
      <label for="date">Date: </label><input type="text" id="date" name="date" value="" /><button type="button" id="show" title="Show Calendar"><img src="calbtn.gif" width="18" height="18" alt="Calendar" ></button>
   </div>
   <div id="container">
      <div class="hd">.:| Task Log |:.</div>
      <div class="bd">
         <div id="cal">
				<form method=post action=saveTask.php>
				<table border="0" cellspacing="2" cellpadding="2" align="center" valign=center>
				<tr><td colspan=2><b>New Task Log / Entry</b></td></tr>
				<tr><td>Date</td> <td><input type=text size=12 id=taskDate> <button type="button" id="show" title="Show Calendar"><img src="calbtn.gif" width="18" height="18" alt="Calendar" ></td></tr>
				<tr><td>Hours Worked</td><td><select id=hours><option value=0>0</option><option value=1>1</option><option value=2>2</option><option value=3>3</option><option value=4>4</option><option value=5>5</option><option value=6>6</option><option value=7>7</option><option value=8>8</option></option><option value=9>9</option><option value=10>10</option><option value=11>11</option><option value=12>12</option></select></td></tr>
				<tr><td>Summary</td><td><input type=text size=25 id=title></td></tr>
				<tr><td>Description</td><td><textarea id=desc rows=5 cols=25></textarea></td></tr>
				</table>
				</form>
			</div>
      </div>
   </div>
</div>
	
</body>
</html>
Return current item: TimeSheet4dotProject