/home/mip/public_html_/old-website/apply_online_training.php
<?
require_once("func_proc.php");
do_header("Apply Online: Trainings/Seminars");
do_menu();
if ($table=="web_training") {
	$personal_table = "web_personal";
	$table2 = "web_doc_library"; 
}else { 
	$personal_table = "personal";
	$table2 = "doc_library";
}

if ($table=="web_training") $table = "web_training"; else $table = "training";
$phpself = basename($PHP_SELF);

?>
<link href="apply.css" rel="stylesheet" type="text/css">
<table width="585" border="0" cellpadding="0" cellspacing="0">     
<tr>
	<td width="585" height="170" align="right" valign="top">
		<table width="100%" height="159" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="585" height="170" valign="top" style="padding-left:25px; padding-right:20px; padding-top:0px">
			<div style="padding-top:3px; background-color:#FFFFFF" align="left" class="applyonline"><font size=2 color=maroon><b>Apply Online</b></font>&nbsp;</div>
				<!-- start -->
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="jobs1">
				<tr>
					<td style="padding-top:10px;" align="center" class="style3">
					<? if($table=='training') { ?><a href="apply_online.php?applicant_id=<?=$applicant_id?>&table=personal&action=check_again">Personal</a> | <a href="apply_online_education.php?applicant_id=<?=$applicant_id?>&table=education&action=check">Education</a> | <a href="apply_online_employment.php?applicant_id=<?=$applicant_id?>&table=employment&action=check">Work Experience</a> | <a href="apply_online_training.php?applicant_id=<?=$applicant_id?>&table=training&action=check"><?=($phpself=="apply_online_training.php")? "<font color='#000000'>" : ""?>Trainings/Seminars</font> </a> | <a href="apply_online_doc.php?applicant_id=<?=$applicant_id?>&table=doc_library&action=check">Document Attachment</a>
					<? if(getWEcount("employment",$applicant_id) > '0' && getEDcount("education",$applicant_id) > '0') { ?>
					| <a href="jobs.php"> Logout </a>
					<? } else { ?>
					| <a href="#" onClick="return alertme();"> Logout </a>
					<? } } else {?>
					<a href="apply_online.php?applicant_id=<?=$applicant_id?>&table=web_personal&action=check">Personal</a> | <a href="apply_online_education.php?applicant_id=<?=$applicant_id?>&table=web_education&action=check">Education</a> | <a href="apply_online_employment.php?applicant_id=<?=$applicant_id?>&table=web_employment&action=check">Work Experience</a> | <a href="apply_online_training.php?applicant_id=<?=$applicant_id?>&table=web_training&action=check"><?=($phpself=="apply_online_training.php")? "<font color='#000000'>" : ""?>Trainings/Seminars</font>  </a> | <a href="apply_online_doc.php?applicant_id=<?=$applicant_id?>&table=web_doc_library&action=check">Document Attachment</a>
					<? if(getWEcount("web_employment",$applicant_id) > '0' && getEDcount("web_education",$applicant_id) > '0') { ?>
					| <a href="thankyou_apply.php?applicant_id=<?=$applicant_id?>&table=<?=$table?>"> Finish Application </a>
					<? } else { ?>
					| <a href="#" onClick="return alertme();"> Finish Application </a>
					<? } } ?>
				</td></tr>
				<tr><td>
				<?
				$personal = getdata_one("*",$personal_table,"applicant_id",$applicant_id); 
				$position_name = getname($personal['position_id1'],"positions","position_id"); 
	
				$formname="thisonly";
				$inputname= array("center","title");
				$displayname= array("Training Center","Title");
				JS_CheckRequired($formname,$inputname,$displayname,"","");		
	
				$training = getdata("select * from $table where applicant_id='$applicant_id' order by date desc");										 	  
				$num_training = count($training);
										 
				if($training_id){
					$training1 = getdata("select * from $table where training_id = '$training_id' and applicant_id='$applicant_id'");
					echo "<form method=post action='sqlupdate.php?what=web_training&training_id=$training_id' name='$formname' onsubmit='return CheckRequired()'>";
				} else{
					 echo "<form method=post action='sqladd.php?what=web_training' name='$formname' onsubmit='return CheckRequired()'>";
				}
				echo "<input type='hidden' name='applicant_id' value='$applicant_id'>";
				?>
					<table width=100% border="0" cellpadding="4" cellspacing="4">
					<tr align="left">
						<td>
							<table width=100% border=0>
							<tr>
								<td align=right colspan="2">Step <b><font color="#0099FF">4</font></b> of 5</td>
							</tr>
							<tr>
								<td align="left" valign="bottom"><b>Position-</b> <?=$position_name?></td>
								<td align="right"><a href="<?=$pic_dir.$personal[picture]?>" rel="lightbox" title="<?=$personal[applicant_id]?>"><? if ($personal[picture]){echo resize_pic1(60,60,$pic_dir.$personal[picture],"","","","1");}?></a></td>
							</tr>
							<tr>
							<td colspan="2"><font size=2 color="#0099FF"><b>Trainings/Seminars Attended</b></font> - <?=$personal[fname]." ".$personal[mname]." ".$personal[lname]?></td>
							</tr>
							</table>
						</td>
					</tr>
					<?if ($training){?>
					<tr><td valign=top>
						<table cellpadding="5" cellspacing="1" width="100%">									
						<tr>						
							<td align="left" class="report1"></td>					
							<td width=26% align="left" class="report1"><b>Training Center</b></td>
							<td width=20% align="left" class="report1"><b>Title</b></td>
							<td class="report1" align=left width=14%><b>Date</b></td>
							<td width=30% align="left" class="report1"><b>Remarks</b></td>
							<td class="report1" align=left width=10%><b>Action</b></td>
						</tr>
						<?for ($i=1; $i<=$num_training; $i++){?>
						<tr>						
							<td align="left" class="report"><?=$i?>.</td>
							<td align="left" class="report"><?=$training[$i][center]?></td>
							<td align="left" class="report"><?=$training[$i][title]?></td>
							<td align="left" class="report"><?=dateformat($training[$i][date])?></td>
							<td align="left" class="report"><?=addbreaks($training[$i][remarks])?></td>
							<td class="data" align=center>	
							<a href="<?=$PHP_SELF?>?what=training_edit&training_id=<?=$training[$i][training_id]?>&applicant_id=<?=$applicant_id?>&table=<?=$table?>">Edit</a> 
							<a href="sqldelete.php?what=web_training&training_id=<?=$training[$i][training_id]?>&applicant_id=<?=$applicant_id?>&table=<?=$table?>" onclick="return confirm('Are you sure you want to delete this?')">Delete</a></td>
						</tr>			
						<?}?>
						</table>
					</td></tr>
					<?}?>			
					<tr><td valign="top" align=center>
						<table border="0" cellpadding="4" cellspacing="4">				  					   			
						<tr>
							<input type="hidden" name="applicant_id" value="<?=$applicant_id?>">
							<input type="hidden" name="table" value="<?=$table?>">
							<td align="left"><b>Training Center <span style="color:#FF0000;"> * </span></b></td>
							<td align="left"><input type=text size=50 name=center value="<?=$training1[1][center]?>"></td>
						</tr>				 				
						<tr>
							<td align="left"><b>Title <span style="color:#FF0000;"> * </span></b></td>     				
							<td align="left"><input type=text size=50 name=title value="<?=$training1[1][title]?>"></td>
						</tr>				 
						<tr>				 												
							<td align="left"><b>Date</b></td>
							<td align="left">
							<?list ($year, $month, $day) = split ('[-]', $training1[1][date]);?>          
							<?echo dateselect("month","month","$month",0,0);?> 
							<?echo dateselect("day","day","$day",0,0);?>
							<?echo dateselect("year","year","$year",20,0);?></td>
						</tr>
						<tr>
							<td align="left" valign=top><b>Remarks</b>	</td>
							<td align="left">		
							<textarea rows=5 cols=50 name=remarks><?=$training1[1]["remarks"]?></textarea>
							</td>										 
						</tr>
						<tr>
							<?if ($training_id) $sval = "Save"; else $sval= "Add"; ?>   				 
							<td colspan=2  align=center><input type=submit value="  <?=$sval?>  " name="user" class="button">
							</form>
							<form method="post" action="apply_online_doc.php?table=<?=$table2?>">
							<input type="hidden" name="applicant_id" value="<?=$applicant_id?>">
							<input type="submit" value="Continue to Step 5 >>">
							</form>
							</td>
						</tr>				
						</table>
					</td></tr>
					</table>				
					</td>
				</tr>                 
				</table>
				<!-- end -->			
            </td>
        </tr>
        </table>
	</td>
</tr>
</table>
<?
do_footer(); 
if($msg) echo "<script>alert('$msg')</script>";
?>