Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/mentanet/
Upload File :
Current File : /var/www/cesa.co.za/mentanet/milestones_backup.php

<?php
include("inc_functions.php");

if (!isset($_SESSION["StudentID"]) || empty($_SESSION["StudentID"])) header("Location: http://www.cesa.co.za/mentanet/login.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MentaNet</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<!--[if IE 5]>
<style type="text/css"> 
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
</head>

<body class="twoColFixLtHdr">

<div id="container">
<?php include("inc_header.php"); ?>
<?php include("inc_sidebar.php"); ?>
  <div id="mainContent">
    <h1>Milestones</h1>
<?php
$MilestoneNum=1;
$sql="SELECT * FROM CCMStudentProgress WHERE CCMStudentID=".$_SESSION["StudentID"];
$rec=mysql_query($sql);
if ($row=mysql_fetch_assoc($rec)) $MilestoneNum=$row["CCMMilestoneNum"];
mysql_free_result($rec);
?>
    <p>You are currently on: <strong>Milestone <?php echo $MilestoneNum; ?></strong></p>
    <p>As a <strong><?php echo $_SESSION["UserTypeDesc"]; ?></strong>, you need to complete the following tasks:</p>
    <ul>
<?php
$sql="SELECT * FROM CCMMilestoneSteps WHERE UserType='".$_SESSION["UserType"]."' AND MilestoneNum=".$MilestoneNum." ORDER BY StepOrder";
$rec=mysql_query($sql);
while ($row=mysql_fetch_assoc($rec)) {
?>
<li><?php echo $row["StepDesc"]; ?><br />
	<?php 
$sql="SELECT * FROM CCMMilestones WHERE CCMStudentID='".$_SESSION["StudentID"]."' AND MilestoneNum=".$MilestoneNum." AND StepType='".$row["InputFieldStepName"]."' ORDER BY DateUpdated DESC";
$rec2=mysql_query($sql);
if ($row2=mysql_fetch_assoc($rec2)) {
	echo "<i style='color:red'>Completed on ".date("Y-m-d", strtotime($row2["DateUpdated"]))."</i><br>";
}
?>
        <br />
      </li>
<?php
}
?>
    </ul>
    <p><strong><br />
      <br />
    Update your task completion below:</strong></p>
<?php
	if (isset($_POST["go"])) {
?>
<p style='color:red'><b>Thank you for updating your tasks.</b></p>
<?php
		if ($_POST["go"]==1) {
			if ($_SESSION["UserType"]=="C") {			
				$uploaddir = '../ccmadmin/milestones/';
				$uploadfilename1="";
				if (isset($_FILES['wptp'])) {
					$uploadfilename1 = strtolower(str_replace(array("'","\"","(",")","#"," "), "_", basename(stripslashes($_FILES['wptp']['name']))));
					$uploadfile1 = $uploaddir . $uploadfilename1;
					$ifilenum=1;
					while (file_exists($uploadfile1) && !empty($uploadfilename1)) {
						$uploadfile1 = $uploaddir . $ifilenum."_".$uploadfilename1;
						$ifilenum++;
					}
					move_uploaded_file($_FILES['wptp']['tmp_name'], $uploadfile1);
				}
				if (isset($_POST["regnum"]) && !empty($_POST["regnum"])) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Registration number', '".$_POST["regnum"]."')";
					mysql_query($sql);
				}
				if (isset($_POST["candidacy"]) && !empty($_POST["candidacy"])) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Candidacy agreement signed', 'Yes')";
//					echo $sql;
					mysql_query($sql);
				}
				if (isset($_POST["guide_intro"]) && ($_POST["guide_intro"]=="y")) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Read guidelines - Introduction', 'Yes')";
					mysql_query($sql);
				}
				if (isset($_POST["guide_wptp"]) && ($_POST["guide_wptp"]=="y")) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Read guidelines - WPTP', 'Yes')";
					mysql_query($sql);
				}
				if (isset($_FILES["wptp"]) && !empty($uploadfile1)) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData, StepFile) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'WPTP', 'WPTP Uploaded', '".str_replace('../ccmadmin/milestones/', '', $uploadfile1)."')";
//					echo $sql;
					mysql_query($sql);
				}
			} elseif ($_SESSION["UserType"]=="M") {			
				if (isset($_POST["regnum"]) && !empty($_POST["regnum"])) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Registration number', '".$_POST["regnum"]."')";
					mysql_query($sql);
				}
				if (isset($_POST["guide_intro"]) && ($_POST["guide_intro"]=="y")) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Read guidelines - Introduction', 'Yes')";
					mysql_query($sql);
				}
				if (isset($_POST["commit"]) && ($_POST["commit"]=="y")) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Commitment signed', 'Yes')";
					mysql_query($sql);
				}
				if (isset($_POST["guide_wptp"]) && ($_POST["guide_wptp"]=="y")) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Read guidelines - WPTP', 'Yes')";
					mysql_query($sql);
				}
				if (isset($_POST["wptp"]) && ($_POST["wptp"]=="y")) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'WPTP', 'WPTP Signed')";
					mysql_query($sql);
				}
			} elseif ($_SESSION["UserType"]=="E") {	
				$uploaddir = '../ccmadmin/milestones/';
				$uploadfilename1="";
				if (isset($_FILES['candufile'])) {
					$uploadfilename1 = strtolower(str_replace(array("'","\"","(",")","#"," "), "_", basename(stripslashes($_FILES['candufile']['name']))));
					$uploadfile1 = $uploaddir . $uploadfilename1;
					$ifilenum=1;
					while (file_exists($uploadfile1) && !empty($uploadfilename1)) {
						$uploadfile1 = $uploaddir . $ifilenum."_".$uploadfilename1;
						$ifilenum++;
					}
					move_uploaded_file($_FILES['candufile']['tmp_name'], $uploadfile1);
				}
				if (isset($_FILES['invoice'])) {
					$uploadfilename2 = strtolower(str_replace(array("'","\"","(",")","#"," "), "_", basename(stripslashes($_FILES['invoice']['name']))));
					$uploadfile2 = $uploaddir . $uploadfilename2;
					$ifilenum=1;
					while (file_exists($uploadfile2) && !empty($uploadfilename2)) {
						$uploadfile2 = $uploaddir . $ifilenum."_".$uploadfilename2;
						$ifilenum++;
					}
					move_uploaded_file($_FILES['invoice']['tmp_name'], $uploadfile2);
				}
				if (isset($_FILES["candufile"]) && !empty($uploadfile1)) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData, StepFile) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Candidacy Agreement', 'Candidacy Agreement Uploaded', '".str_replace('../ccmadmin/milestones/', '', $uploadfile1)."')";
//					echo $sql;
					mysql_query($sql);
				}
				if (isset($_POST["acnum"]) && !empty($_POST["acnum"])) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Bank Account', '".$_POST["acnum"]."')";
//					echo $sql;
					mysql_query($sql);
					
					$sUpdateSql="";
					if (!empty($_POST["acname"])) {
						$sUpdateSql.="AccountName='".addslashes(stripslashes($_POST["acname"]))."', ";
					}
					if (!empty($_POST["bank"])) {
						$sUpdateSql.="BankName='".addslashes(stripslashes($_POST["bank"]))."', ";
					}
					if (!empty($_POST["branch"])) {
						$sUpdateSql.="BranchName='".addslashes(stripslashes($_POST["branch"]))."', ";
					}
					if (!empty($_POST["acnum"])) {
						$sUpdateSql.="AccountNum='".addslashes(stripslashes($_POST["acnum"]))."', ";
					}
					if (!empty($sUpdateSql)) {
						mysql_query("UPDATE CCMEmployers SET ".trim($sUpdateSql,", ")." WHERE CCMEmployerID=".$_SESSION["StudentID"]);
					}
				}
				if (isset($_POST["candu"]) && !empty($_POST["candu"])) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Commitment signed', '".$_POST["candunum"]."')";
//					echo $sql;
					mysql_query($sql);
				}
				if (isset($_POST["guide_intro"]) && ($_POST["guide_intro"]=="y")) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Read guidelines - Introduction', 'Yes')";
					mysql_query($sql);
				}
				if (isset($_FILES["invoice"]) && !empty($uploadfile2)) {
					$sql = "REPLACE INTO CCMMilestones (CCMStudentID, DateUpdated, MilestoneNum, StepType, StepData, StepFile) VALUES (".$_SESSION["StudentID"].", '".date("Y-m-d H:i:s")."', 1, 'Invoice', 'Invoice Uploaded', '".str_replace('../ccmadmin/milestones/', '', $uploadfile2)."')";
//					echo $sql;
					mysql_query($sql);
				}
			}
		}
	}
?>    
    <form action="milestones.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
    <input type="hidden" name="go" value="1" />
      <table width="543" border="0" cellspacing="0" cellpadding="5">
<?php
if ($_SESSION["UserType"]=="C") {
	if ($MilestoneNum==1) {
?>    
        <tr>
          <td width="170" valign="top"><strong>Candidate registration:</strong></td>
          <td width="353" valign="top">
            Registration number: 
          <input type="text" name="regnum" id="regnum" value="<?php echo $sRegNum; ?>" />
          </td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>Candidacy agreement:</strong></td>
          <td valign="top"><input name="candidacy" type="checkbox" id="candidacy" value="y"<?php echo $sCommit; ?> />
          Yes, I have signed it</td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>Guidelines read:</strong></td>
          <td valign="top"><input name="guide_intro" type="checkbox" id="guide_intro" value="y"<?php echo $sGuideIntro; ?> />
          <label for="guide_intro">Yes, I have read the Introduction to Programme </label></td>
        </tr>
        <tr>
          <td valign="top">&nbsp;</td>
          <td valign="top"><input name="guide_wptp" type="checkbox" id="guide_wptp" value="y"<?php echo $sGuideWPTP; ?> />
          <label for="guide_wptp">Yes, I have read the Requirements &amp; WPTP</label></td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>WPTP:</strong></td>
          <td valign="top">Download a <a href="Guideline 2 - Developing a WPTP.DOCX" target="_blank">workplace training plan</a><br />

            Upload your completed, signed WPTP here:
              <br />
              <input type="file" name="wptp" id="wptp" />
              <br />
            </td>
        </tr>
        <tr>
          <td colspan="2"><hr /></td>
        </tr>
<?php
	} else {
?>    
        <tr>
          <td width="170" valign="top"><strong>Meeting 1:</strong></td>
          <td width="353" valign="top">
            Date of meeting: 
          <input type="text" name="meet1date" id="meet1date" value="<?php echo ""; ?>" /><br>
          Proof of meeting:
          <input type="file" name="meet1proof" id="meet1proof" />
          </td>
        </tr>
        <tr>
          <td width="170" valign="top"><strong>Meeting 2:</strong></td>
          <td width="353" valign="top">
            Date of meeting: 
          <input type="text" name="meet2date" id="meet2date" value="<?php echo ""; ?>" /><br>
          Proof of meeting:
          <input type="file" name="meet2proof" id="meet2proof" />
          </td>
        </tr>
        <tr>
          <td width="170" valign="top"><strong>Meeting 3:</strong></td>
          <td width="353" valign="top">
            Date of meeting: 
          <input type="text" name="meet3date" id="meet3date" value="<?php echo ""; ?>" /><br>
          Proof of meeting:
          <input type="file" name="meet3proof" id="meet3proof" />
          </td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>Supplementary course:</strong></td>
          <td valign="top">Date of course: 
          <input type="text" name="coursedate" id="coursedate" value="<?php echo ""; ?>" /></td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>Guidelines read:</strong></td>
          <td valign="top"><input name="guide_intro" type="checkbox" id="guide_intro" value="y"<?php echo $sGuideIntro; ?> />
          <label for="guide_intro">Yes, I have read Guideline 3 </label></td>
        </tr>
        <tr>
          <td colspan="2"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>WPTP progress report:</strong></td>
          <td valign="top">
              <input type="file" name="wptp" id="wptp" />
            </td>
        </tr>
        <tr>
          <td colspan="2"><hr /></td>
        </tr>
<?php
	}
} elseif ($_SESSION["UserType"]=="M") {
?>    
        <tr>
          <td width="170" valign="top"><strong>Professional registration number:</strong></td>
          <td width="353" valign="top">
            Registration number: 
          <input type="text" name="regnum" id="regnum" value="<?php echo $sRegNum; ?>" />
          </td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>Commitment signed:</strong></td>
          <td valign="top"><input name="commit" type="checkbox" id="commit" value="y"<?php echo $sCommit; ?> />
          Yes</td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>Guidelines read:</strong></td>
          <td valign="top"><input name="guide_intro" type="checkbox" id="guide_intro" value="y"<?php echo $sGuideIntro; ?> />
          <label for="guide_intro">Yes, I have read the Introduction to Programme </label></td>
        </tr>
        <tr>
          <td valign="top">&nbsp;</td>
          <td valign="top"><input name="guide_wptp" type="checkbox" id="guide_wptp" value="y"<?php echo $sGuideWPTP; ?> />
          <label for="guide_wptp">Yes, I have read the Requirements &amp; WPTP</label></td>
        </tr>
        <tr>
          <td colspan="2"><hr /></td>
        </tr>
        <tr>
          <td><strong>WPTP:</strong></td>
          <td><input name="wptp" type="checkbox" id="wptp" value="y"<?php echo $sWPTP; ?> />
            Yes, I have participated in developing the WPTP and have signed it</td>
        </tr>
        <tr>
          <td colspan="2"><hr /></td>
        </tr>
<?php
} elseif ($_SESSION["UserType"]=="E") {
?>    
        <tr>
          <td valign="top"><strong>Candidacy Agreement:</strong></td>
          <td valign="top">            Upload the signed candidacy agreement here: <br />
            <input type="file" name="candufile" id="candufile" />
          <br /></td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>Bank Account:</strong></td>
          <td valign="top"><p>Account name:
          <?php
		  $sql="SELECT AccountName, BankName, BranchName, AccountNum FROM CCMEmployers WHERE CCMEmployerID=".$_SESSION["StudentID"];
		  $recBank=mysql_query($sql);
		  if ($rowBank=mysql_fetch_assoc($recBank)) {
			  $sACName=$rowBank["AccountName"];
			  $sBank=$rowBank["BankName"];
			  $sBranch=$rowBank["BranchName"];
			  $sACNum=$rowBank["AccountNum"];
		  }
		  ?>
              <input name="acname" type="text" id="acname" value="<?php echo $sACName; ?>" size="30" />
              <br />
              Bank:
<input name="bank" type="text" id="bank" value="<?php echo $sBank; ?>" size="40" />
            <br />
            Branch: 
            <input name="branch" type="text" id="branch" value="<?php echo $sBranch; ?>" size="40" />
            <br />
            
            Account number:
            <input name="acnum" type="text" id="acnum" value="<?php echo $sACNum; ?>" size="30" />
          </p></td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>C&amp;U signed:</strong></td>
          <td valign="top"><input name="candu" type="checkbox" id="candu" value="y"<?php echo $sCommit; ?> />
          Yes, C&amp;U number: 
            <input type="text" name="candunum" id="candunum" value="<?php echo $sCommitNum; ?>" />
          </td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><hr /></td>
        </tr>
        <tr>
          <td valign="top"><strong>Guidelines read:</strong></td>
          <td valign="top"><input name="guide_intro" type="checkbox" id="guide_intro" value="y"<?php echo $sGuideIntro; ?> />
          <label for="guide_intro">Yes, I have read the Introduction to Programme </label></td>
        </tr>
        <tr>
          <td colspan="2"><hr /></td>
        </tr>
        <tr>
          <td><strong>Invoice:</strong></td>
          <td><input type="file" name="invoice" id="invoice" /></td>
        </tr>
        <tr>
          <td colspan="2"><hr /></td>
        </tr>
<?php
}
?>
        <tr>
          <td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="Submit" /></td>
        </tr>
      </table>
    </form>
    <p>&nbsp;</p>
  </div>
<?php include("inc_footer.php"); ?>
<!-- end #container --></div>
</body>
</html>