Preview: manage_task.php
Size: 40.82 KB
/home/jambtst2015/public_html/giraffeng.com/admin/manage_task.php
<?php include("includes/head.php"); ?>
<?php include("includes/header.php"); ?>
<script>
function removeFile(list, value, separator) {
//separator = separator || ",";
//alert(list);
//alert(value);
//alert(separator);
var values = list.split(separator);
//alert(values);
for(var i = 0 ; i < values.length ; i++) {
if(values[i] == value) {
values.splice(i, 1);
return values.join(separator);
}
}
//alert(list);
return list;
}
$(document).ready(function(){
$('.s_type').on('change', function() {
// alert(1);
var val = this.checked ? this.value : this.value;
var prevch = $("#staff_type_h").val();
var prevunch = $("#staff_type_h_u").val();
//alert(val);
//alert(this.checked);
if(this.checked==true){
//alert(prevunch.indexOf(','));
if (prevunch.indexOf(',') >= -1){
var removeValue = removeFile(prevunch,val,',');
$("#staff_type_h_u").val(removeValue);
if(prevch==''){
$("#staff_type_h").val(val);
} else{
var multicat = $("#staff_type_h").val(prevch+','+val);
}
}
}else{
//alert(prevch.indexOf(','));
if (prevch.indexOf(',') >= -1){
var removeValue = removeFile(prevch,val,',');
$("#staff_type_h").val(removeValue);
if(prevunch==''){
$("#staff_type_h_u").val(val);
} else{
var multicat = $("#staff_type_h_u").val(prevunch+','+val);
}
}
else{
var removeValue = '';
}
// $("#cathid").val(removeValue);
}
//alert(finalval);
});
$('.v_type').on('change', function() {
// alert(1);
var val = this.checked ? this.value : this.value;
var prevch = $("#visa_type_h").val();
var prevunch = $("#visa_type_h_u").val();
//alert(val);
//alert(this.checked);
if(this.checked==true){
//alert(prevunch.indexOf(','));
if (prevunch.indexOf(',') >= -1){
var removeValue = removeFile(prevunch,val,',');
$("#visa_type_h_u").val(removeValue);
if(prevch==''){
$("#visa_type_h").val(val);
} else{
var multicat = $("#visa_type_h").val(prevch+','+val);
}
}
}else{
//alert(prevch.indexOf(','));
if (prevch.indexOf(',') >= -1){
var removeValue = removeFile(prevch,val,',');
$("#visa_type_h").val(removeValue);
if(prevunch==''){
$("#visa_type_h_u").val(val);
} else{
var multicat = $("#visa_type_h_u").val(prevunch+','+val);
}
}
else{
var removeValue = '';
}
// $("#cathid").val(removeValue);
}
//alert(finalval);
});
});
</script>
<?php
///////////////Add Events///////////////////////////////////////////////
if($_REQUEST['add']=="ADD" && count($_POST)>0 && $_REQUEST['id']=='' && $_REQUEST['action']!="edit")
{
$sql_query=mysql_query("SELECT * FROM `sat_task` WHERE department='".mysql_real_escape_string($_REQUEST['department'])."' AND task='".mysql_real_escape_string($_REQUEST['task'])."' AND main_activity_id='".mysql_real_escape_string($_REQUEST['main_activity_id'])."' AND user_id='".mysql_real_escape_string($_REQUEST['user_initial'])."'");
$sql_num=mysql_num_rows($sql_query);
if($sql_num>0){
$msg = 4;
header("location:manage_task.php?msg=$msg");
}else{
if(!empty($_REQUEST['staff_type'])){
$sep='';$staff_type='';
foreach($_REQUEST['staff_type'] as $staffType){
$staff_type = $staff_type.$sep.$staffType;
$sep=',';
}
}
if(!empty($_REQUEST['visa_type'])){
$sep='';$visa_type='';
foreach($_REQUEST['visa_type'] as $visaType){
$visa_type = $visa_type.$sep.$visaType;
$sep=',';
}
}
mysql_query("insert into sat_task set department='".mysql_real_escape_string($_REQUEST['department'])."', task='".mysql_real_escape_string($_REQUEST['task'])."', main_activity_id='".mysql_real_escape_string($_REQUEST['main_activity_id'])."', user_id='".mysql_real_escape_string($_REQUEST['user_initial'])."', task_status='".mysql_real_escape_string($_REQUEST['status'])."',staff_type='".mysql_real_escape_string($staff_type)."', visa_type='".mysql_real_escape_string($visa_type)."', post_date=now()");
$msg = 1;
header("location:manage_task.php?msg=$msg");
}
}
/////////////End Add//////////////////////////////////////////////
///////////////////////////Edit Events////////////////////////////
if($_REQUEST['edit']=="EDIT" && count($_POST)>0 && $_REQUEST['id']!='' && $_REQUEST['action']=="edit")
{
if(!empty($_REQUEST['staff_type'])){
$sep='';$staff_type='';
foreach($_REQUEST['staff_type'] as $staffType){
$staff_type = $staff_type.$sep.$staffType;
$sep=',';
}
}
if(!empty($_REQUEST['visa_type'])){
$sep='';$visa_type='';
foreach($_REQUEST['visa_type'] as $visaType){
$visa_type = $visa_type.$sep.$visaType;
$sep=',';
}
}
//echo "update sat_task set department='".mysql_real_escape_string($_REQUEST['department'])."', task='".mysql_real_escape_string($_REQUEST['task'])."', main_activity_id='".mysql_real_escape_string($_REQUEST['main_activity_id'])."', user_id='".mysql_real_escape_string($_REQUEST['user_initial'])."', task_status='".mysql_real_escape_string($_REQUEST['status'])."' where task_id=".$_REQUEST['id']."";
//exit;
mysql_query("update sat_task set department='".mysql_real_escape_string($_REQUEST['department'])."', task='".mysql_real_escape_string($_REQUEST['task'])."', main_activity_id='".mysql_real_escape_string($_REQUEST['main_activity_id'])."', user_id='".mysql_real_escape_string($_REQUEST['user_initial'])."', task_status='".mysql_real_escape_string($_REQUEST['status'])."' , staff_type='".mysql_real_escape_string($staff_type)."', visa_type='".mysql_real_escape_string($visa_type)."' where task_id=".$_REQUEST['id']."");
$msg = 2;
header("location:manage_task.php?msg=$msg&search_market=".$_REQUEST['search_market']."&page=".$_REQUEST['page_hide']."");
}
///////////////////////////End edit events////////////////////////
///////////////////////////For Edit////////////////////////////////////////////////
$array_product_details="";
if($_REQUEST['action']=="edit" && $_REQUEST['id']!='' && !$_REQUEST['edit'])
{
$array_product_details=mysql_fetch_array(mysql_query("select * from sat_task where task_id=".$_REQUEST['id'].""));
//$_REQUEST['productname']=$array_product_details['exhibit'];
//$_REQUEST['market']=$array_product_details['category_id'];
}
//////////////////////End for edit///////////////////////////////////////////
///////////////////For Delete//////////////////////////////////////////////
if($_REQUEST['delete']=="del" && $_REQUEST['delete_id']!='')
{
//echo $_REQUEST['page'];
//exit("yes");
mysql_query("delete from sat_task where task_id=".$_REQUEST['delete_id']."");
mysql_query("delete from sat_staff_task where task_id=".$_REQUEST['delete_id']."");
$msg = 3;
header("location:manage_task.php?msg=$msg&search_market=".$_REQUEST['search_market']."&page=".$_REQUEST['page']."");
}
///////////////////////End for delete//////////////////////////////////
if(!$_REQUEST['page'])
{
$_SESSION['srchstr']="";
$_SESSION['srchkey']="";
}
?>
<script type="text/javascript" language="javascript">
function validate()
{
if(document.frmproduct.market.value=='')
{
alert("Please enter category");
document.frmproduct.market.focus();
return false;
}
if(document.frmproduct.productname.value=='')
{
alert("Please enter exhibit name");
document.frmproduct.productname.focus();
return false;
}
return true();
}
</script>
<?php
$msg=$_REQUEST['msg'];
if($msg == 1){
$msg = '<font color="#009933">Task added successfully</font>';
}
if($msg == 2){
$msg = '<font color="#009933">Task updated successfully</font>';
}
if($msg == 3){
$msg = "Task deleted successfully";
}
if($msg == 4){
$msg = "Task already exsists under this department, activity and user initial";
}
?>
<script>
jQuery.noConflict();
(function($) {jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#formID").validationEngine();
});})(jQuery);
function open_src(val){
if(val==''){
$('#div_add_task').toggle("slow");
}
else{
$('#div_src_req').toggle("slow");
}
}
function open_src_src(val){
if(val==''){
$('#div_src').toggle("slow");
}
else{
$('#div_src').toggle("slow");
}
}
$(document).ready(function(){
setTimeout(function(){
$(".mydiv").fadeOut("slow", function () {
$(".mydiv").remove("slow");
});
}, 4000);
});
</script>
<div class="container_bottom_section">
<?php if($_REQUEST['msg']=='3'){ ?>
<p class="mydiv" style="color:#F00; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;"><?php echo $msg; ?></p>
<?php } ?>
<?php if($_REQUEST['msg']=='1'){ ?>
<p class="mydiv" style="color:#090; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;"><?php echo $msg; ?></p>
<?php } ?>
<?php if($_REQUEST['msg']=='2'){ ?>
<p class="mydiv" style="color:#090; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;"><?php echo $msg; ?></p>
<?php } ?>
<?php if($_REQUEST['msg']=='4'){ ?>
<p class="mydiv" style="color:#F00; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;"><?php echo $msg; ?></p>
<?php } ?>
<!--<a href="javascript:window.history.back();" class="require" style="margin-right:5px; margin-bottom:5px;">Back</a>-->
<?php if($_REQUEST['action']=="" && $_REQUEST['id']==''){ ?>
<a href="javascript:open_src_src('');" class="require" style="margin-right:5px; margin-bottom:5px;">Search</a>
<a href="javascript:open_src('');" class="require" style="margin-right:5px; margin-bottom:5px;">Add Task</a>
<?php } ?>
<div class="clear"></div>
<!--search-->
<div style="padding:5px; <?php if($_REQUEST['submit2']=='') { ?>display:none;<?php } ?> border:1px solid #C4C4C4; margin-bottom:10px;" id="div_src">
<div class="require_add">
<h3 style="font-family:Arial, Helvetica, sans-serif; font-size:18px; float:left; color:#2597C9; padding-bottom:5px;">Search By</h3>
<div class="clear"></div>
</div>
<form name="myfrm" action="" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_search">
<tr>
<td colspan="14" height="10"></td>
</tr>
<tr>
<td width="10%" height="25" valign="top" class="require_table_search">Department:</td>
<td colspan="4" align="left" valign="top">
<select id="department" name="department" class="validate[required] textfield">
<option value="">-- Select --</option>
<option value="Recruitment" <?php if($_REQUEST['department']=='Recruitment') { ?>selected="selected"<?php } ?>>Recruitment</option>
<option value="Sales & Marketing" <?php if($_REQUEST['department']=='Sales & Marketing') { ?>selected="selected"<?php } ?>>Sales & Marketing</option>
<option value="Human Resources" <?php if($_REQUEST['department']=='Human Resources') { ?>selected="selected"<?php } ?>>Human Resources</option>
<option value="Accounts & Control" <?php if($_REQUEST['department']=='Accounts & Control') { ?>selected="selected"<?php } ?>>Accounts & Control</option>
<option value="Operations" <?php if($_REQUEST['department']=='Operations') { ?>selected="selected"<?php } ?>>Operations</option>
<option value="Immigration" <?php if($_REQUEST['department']=='Immigration') { ?>selected="selected"<?php } ?>>Immigration</option>
<option value="IT" <?php if($_REQUEST['department']=='IT') { ?>selected="selected"<?php } ?>>IT</option>
</select>
</td>
<td width="3%"> </td>
<td width="13%" valign="top" class="require_table_search">Activity:</td>
<td align="left" valign="top"><select id="main_activity_id" name="main_activity_id" class="validate[required] textfield">
<option value="">-- Select --</option>
<?php
$sql_product=sprintf("select * from sat_main_activity where 1 order by main_activity_id");
$query_product=mysql_query($sql_product);
while($array_product=mysql_fetch_array($query_product)){
?>
<option value="<?php echo $array_product['main_activity_id']; ?>" <?php if($_REQUEST['main_activity_id']==$array_product['main_activity_id']) echo "selected"; ?>>
<?php echo $array_product['main_activity']?>
</option>
<?php
}
?>
</select></td>
<td width="2%"> </td>
<td width="14%" valign="top" class="require_table_search">Task:</td>
<td colspan="4" align="left" valign="top"><input name="task" size="25" type="text" class="validate[required] textfield" value="<?php echo $_REQUEST['task']?>" /></td>
</tr>
<tr>
<td height="25" valign="top" class="require_table_search">User Initial:</td>
<td colspan="4" align="left" valign="top">
<select id="user_initial" name="user_initial" class="validate[required] textfield">
<option value="">-- Select --</option>
<?php
$sql_product=sprintf("select * from sat_users where status='Active' order by user_initial");
$query_product=mysql_query($sql_product);
while($array_product=mysql_fetch_array($query_product)){
?>
<option value="<?php echo $array_product['user_id']; ?>" <?php if($_REQUEST['user_initial']==$array_product['user_id']) echo "selected"; ?>>
<?php echo $array_product['user_initial']?>
</option>
<?php
}
?>
</select>
</td>
<td> </td>
<td valign="top" class="require_table_search">Status:</td>
<td align="left" valign="top"><select name="status" class="selectfield require_select">
<option value="">-- Select --</option>
<option value="Active" <?php if($_REQUEST['status']=='Active') { ?>selected="selected"<?php } ?>>Active</option>
<option value="Inactive" <?php if($_REQUEST['status']=='Inactive') { ?>selected="selected"<?php } ?>>Inactive</option>
</select></td>
<td> </td>
<td valign="top" class="require_table_search">Sort Order:</td>
<td colspan="4" align="left" valign="top"><select name="order" class="selectfield require_select">
<option value="">-- Select --</option>
<option value="asc" <?php if($_REQUEST['order']=="asc"){?> selected="selected" <?php }?>>Ascending</option>
<option value="desc" <?php if($_REQUEST['order']=="desc"){?> selected="selected" <?php }?>>Descending</option>
</select></td>
</tr>
<tr>
<td height="25" valign="top" class="require_table_search">Staff Type:</td>
<td colspan="4" align="left" valign="top" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;">
<?php if(isset($_REQUEST['staff_type_h'])){ $sType = explode(',',$_REQUEST['staff_type_h']); }else{ $sType=array(); } ?>
<input type="checkbox" name="staff_type[]" id="staff_type1" value="W2" <?php if(in_array("W2", $sType)) { ?> checked="checked"<?php } ?> class="s_type" /> W2
<input type="checkbox" name="staff_type[]" id="staff_type2" value="Non W2" <?php if(in_array('Non W2', $sType)) { ?> checked="checked"<?php } ?> class="s_type" /> Non W2
<input type="hidden" name="staff_type_h" value="<?php echo $_REQUEST['staff_type_h'];?>" id="staff_type_h" />
<input type="hidden" value="" id="staff_type_h_u" />
</td>
<td> </td>
<td valign="top" class="require_table_search">Visa Type:</td>
<td align="left" valign="top" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;">
<?php if(isset($_REQUEST['visa_type_h'])){ $vType = explode(',',$_REQUEST['visa_type_h']); }else{ $vType=array(); } ?>
<input type="checkbox" name="visa_type[]" id="visa_type1" value="H1B" <?php if(in_array('H1B', $vType)) { ?> checked="checked"<?php } ?> class="v_type" /> H1B
<input type="checkbox" name="visa_type[]" id="visa_type2" value="Non H1B" <?php if(in_array('Non H1B', $vType)) { ?> checked="checked"<?php } ?> class="v_type" /> Non H1B
<input type="hidden" name="visa_type_h" value="<?php echo $_REQUEST['visa_type_h'];?>" id="visa_type_h" />
<input type="hidden" value="" id="visa_type_h_u" />
</td>
<td> </td>
<td valign="top" class="require_table_search"> </td>
<td width="38" align="left" valign="top"> </td>
<td width="38" align="left" valign="top"> </td>
<td width="39" align="left" valign="top"> </td>
<td width="107" align="left" valign="top"> </td>
</tr>
<tr>
<td colspan="14" height="10"></td>
</tr>
<tr>
<td> </td>
<td width="43"> </td>
<td width="40"> </td>
<td width="41"> </td>
<td width="158"> </td>
<td> </td>
<td align="right"><span style="float:left;">
<input name="submit2" type="submit" value="Search" class="submit" style="margin-top:0px;" />
</span>
</td>
<td>
<span style="float:left;">
<a href="manage_task.php" style="text-decoration:none;">
<input name="submit3" type="button" value="Show All" class="submit" style="margin-top:0px;" />
</a>
</span> </td>
<td> </td>
<td> </td>
<td colspan="4"> </td>
</tr>
</table>
</form>
</div>
<!--search-->
<!--content-->
<div>
<form name="frmproduct" id="formID" action="manage_task.php" method="post">
<input type="hidden" name="id" value="<?php echo $_REQUEST['id']?>" />
<input type="hidden" name="action" value="<?php echo $_REQUEST['action']?>" />
<input type="hidden" name="page_hide" value="<?php echo $_REQUEST['page']?>" />
<input type="hidden" name="search_market" value="<?php echo $_REQUEST['search_market']?>" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php /*?><tr>
<td style="padding-left:20px; padding-top:15px;"> </td>
</tr><?php */?>
<tr>
<td width="86%" align="center">
<div id="div_add_task" style="display:<?php if($_REQUEST['action']=="edit" && $_REQUEST['id']!='' && !$_REQUEST['edit']){ ?>block<?php }else{ ?>none<?php } ?>;">
<table width="531" height="161" border="0" cellpadding="0" cellspacing="0" align="center" style="border:1px solid #CCCCCC;">
<tr>
<td align="center" valign="middle" colspan="5" class="head_text" >
<?php if($_REQUEST['action']=="edit" && $_REQUEST['id']!='' && !$_REQUEST['edit']){ ?>Edit<?php }else{ ?>Add<?php } ?> Task
</td>
</tr>
<tr class="smalltext">
<td height="10" colspan="5" align="left" valign="middle" class="enquiery"></td>
</tr>
<tr class="smalltext">
<td height="28" colspan="5" align="left" valign="middle" class="enquiery"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="smalltext">
<td width="110" align="left" valign="middle" class="enquiery"> </td>
<td width="153" height="28" align="left" valign="middle" class="head_text2">Department<font color="#FF0000">*</font></td>
<td width="25" align="left" valign="middle" class="enquiery">:</td>
<td width="170" align="left" valign="middle">
<select id="department" name="department" class="validate[required] textfield">
<option value="">-- Select --</option>
<option value="Recruitment" <?php if($array_product_details['department']=='Recruitment') { ?>selected="selected"<?php } ?>>Recruitment</option>
<option value="Sales & Marketing" <?php if($array_product_details['department']=='Sales & Marketing') { ?>selected="selected"<?php } ?>>Sales & Marketing</option>
<option value="Human Resources" <?php if($array_product_details['department']=='Human Resources') { ?>selected="selected"<?php } ?>>Human Resources</option>
<option value="Accounts & Control" <?php if($array_product_details['department']=='Accounts & Control') { ?>selected="selected"<?php } ?>>Accounts & Control</option>
<option value="Operations" <?php if($array_product_details['department']=='Operations') { ?>selected="selected"<?php } ?>>Operations</option>
<option value="Immigration" <?php if($array_product_details['department']=='Immigration') { ?>selected="selected"<?php } ?>>Immigration</option>
<option value="IT" <?php if($array_product_details['department']=='IT') { ?>selected="selected"<?php } ?>>IT</option>
</select>
</td>
<td width="71"> </td>
</tr>
<tr class="smalltext">
<td align="left" valign="middle" class="enquiery"> </td>
<td height="38" align="left" valign="middle" class="head_text2" style="padding:3px;">Activity<font color="#FF0000">*</font></td>
<td align="left" valign="middle" class="enquiery">:</td>
<td align="left" valign="middle">
<select id="main_activity_id" name="main_activity_id" class="validate[required] textfield">
<option value="">-- Select --</option>
<?php
$sql_product=sprintf("select * from sat_main_activity where 1 order by main_activity");
$query_product=mysql_query($sql_product);
while($array_product=mysql_fetch_array($query_product)){
?>
<option value="<?php echo $array_product['main_activity_id']; ?>" <?php if($array_product_details['main_activity_id']==$array_product['main_activity_id']) echo "selected"; ?>>
<?php echo $array_product['main_activity']?>
</option>
<?php
}
?>
</select>
</td>
<td> </td>
</tr>
<tr class="smalltext">
<td align="left" valign="middle" class="enquiery"> </td>
<td height="38" align="left" valign="middle" class="head_text2" style="padding:3px;">Task<font color="#FF0000">*</font></td>
<td align="left" valign="middle" class="enquiery">:</td>
<td align="left" valign="middle"><input name="task" size="25" type="text" class="validate[required] textfield" value="<?php echo $array_product_details['task']?>" /></td>
<td> </td>
</tr>
<tr class="smalltext">
<td align="left" valign="middle" class="enquiery"> </td>
<td height="38" align="left" valign="middle" class="head_text2" style="padding:3px;">User Initial<font color="#FF0000">*</font></td>
<td align="left" valign="middle" class="enquiery">:</td>
<td align="left" valign="middle">
<select id="user_initial" name="user_initial" class="validate[required] textfield">
<option value="">-- Select --</option>
<?php
$sql_product=sprintf("select * from sat_users where status='Active' order by user_initial");
$query_product=mysql_query($sql_product);
while($array_product=mysql_fetch_array($query_product)){
?>
<option value="<?php echo $array_product['user_id']; ?>" <?php if($array_product_details['user_id']==$array_product['user_id']) echo "selected"; ?>>
<?php echo $array_product['user_initial']?>
</option>
<?php
}
?>
</select>
</td>
<td> </td>
</tr>
<tr class="smalltext">
<td align="left" valign="middle" class="enquiery"> </td>
<td height="38" align="left" valign="middle" class="head_text2" style="padding:3px;">Status<font color="#FF0000">*</font></td>
<td align="left" valign="middle" class="enquiery">:</td>
<td align="left" valign="middle">
<select name="status" id="status" class="selectfield require_select">
<option value="Active" <?php if($array_product_details['task_status']=='Active') { ?>selected="selected"<?php } ?>>Active</option>
<option value="Inactive" <?php if($array_product_details['task_status']=='Inactive') { ?>selected="selected"<?php } ?>>Inactive</option>
</select>
</td>
<td> </td>
</tr>
<tr class="smalltext">
<td align="left" valign="middle" class="enquiery"> </td>
<td height="38" align="left" valign="middle" class="head_text2" style="padding:3px;">Staff Type</td>
<td align="left" valign="middle" class="enquiery">:</td>
<td align="left" valign="middle" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;">
<?php
if($array_product_details['staff_type']!=''){
$sType = explode(',',$array_product_details['staff_type']);
}else{
$sType= array();
}
?>
<input type="checkbox" name="staff_type[]" id="staff_type1" value="W2" <?php if(in_array("W2", $sType)) { ?> checked="checked"<?php } ?> /> W2
<input type="checkbox" name="staff_type[]" id="staff_type2" value="Non W2" <?php if(in_array('Non W2', $sType)) { ?> checked="checked"<?php } ?> /> Non W2
<?php /*?><select name="staff_type" id="staff_type" class=" validate[required] selectfield require_select">
<option value="">-- Select --</option>
<option value="H1B" <?php if($array_product_details['staff_type']=='H1B') { ?>selected="selected"<?php } ?>>H1B</option>
<option value="W2" <?php if($array_product_details['staff_type']=='W2') { ?>selected="selected"<?php } ?>>W2</option>
</select><?php */?>
</td>
<td> </td>
</tr>
<tr class="smalltext">
<td align="left" valign="middle" class="enquiery"> </td>
<td height="38" align="left" valign="middle" class="head_text2" style="padding:3px;">Visa Type</td>
<td align="left" valign="middle" class="enquiery">:</td>
<td align="left" valign="middle" style="font-family:Arial, Helvetica, sans-serif; font-size:13px;">
<?php
if($array_product_details['visa_type']!=''){
$vType = explode(',',$array_product_details['visa_type']);
}else{
$vType= array();
}
?>
<input type="checkbox" name="visa_type[]" id="visa_type1" value="H1B" <?php if(in_array('H1B', $vType)) { ?> checked="checked"<?php } ?> /> H1B
<input type="checkbox" name="visa_type[]" id="visa_type2" value="Non H1B" <?php if(in_array('Non H1B', $vType)) { ?> checked="checked"<?php } ?> /> Non H1B
<?php /*?><select name="staff_type" id="staff_type" class=" validate[required] selectfield require_select">
<option value="">-- Select --</option>
<option value="H1B" <?php if($array_product_details['staff_type']=='H1B') { ?>selected="selected"<?php } ?>>H1B</option>
<option value="W2" <?php if($array_product_details['staff_type']=='W2') { ?>selected="selected"<?php } ?>>W2</option>
</select><?php */?>
</td>
<td> </td>
</tr>
<tr>
<td align="left" valign="middle" class="enquiery"> </td>
<td height="30" align="left" valign="middle" class="enquiery"> </td>
<td align="left" valign="middle" class="enquiery"></td>
<td colspan="2" valign="middle" class="button" aign="left">
<? if($_REQUEST['action']=="edit")
{
?>
<input type="submit" name="edit" class="newadd" value="EDIT" border="0" style="margin:0px;" onclick="return validate();" />
<input type="button" name="back" id="back" class="newadd" value="Cancel" style=" margin-bottom:10px;" onclick="document.location.href='manage_task.php';" />
<?
}
else
{
?>
<input type="submit" name="add" class="newadd" value="ADD" border="0" style="margin:0px;" onclick="return validate();" />
<input type="button" name="back" id="back" class="newadd" value="Cancel" style=" margin-bottom:10px;" onclick="document.location.href='manage_task.php';" />
<?
}
?> </td>
</tr>
<tr class="smalltext">
<td height="10" colspan="5" align="left" valign="middle" class="enquiery"></td>
</tr>
</table></td>
</tr>
</table>
</div>
</td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<?php /*?><tr>
<td width="86%" height="128" align="center"><table width="531" height="129" border="0" cellpadding="0" cellspacing="0" align="center" style="border:1px solid #CCCCCC;">
<tr>
<td align="center" valign="middle" class="head_text" colspan="5">Sort by Exhibit Category</td>
</tr>
<tr class="smalltext">
<td height="28" colspan="5" align="left" valign="middle" class="enquiery"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="smalltext">
<td width="111" align="left" valign="middle" class="enquiery"> </td>
<td width="153" height="32" align="left" valign="middle" class="head_text2">Select Exhibit Category </td>
<td width="24" align="left" valign="middle" class="enquiery">:</td>
<td width="170" align="left" valign="middle"><select name="search_market" class="selectfield">
<option value="">--Select --</option>
<? $sql_product=sprintf("select * from sat_task_category where 1 order by category");
$query_product=mysql_query($sql_product);
while($array_product=mysql_fetch_array($query_product))
{
?>
<option value="<?=$array_product['id']?>" <? if($_REQUEST['search_market']==$array_product['id']) echo "selected"; ?>>
<?=$array_product['category']?>
</option>
<?
}
?>
</select></td>
<td width="71"> </td>
</tr>
<tr>
<td align="left" valign="middle" class="enquiery"> </td>
<td height="31" align="left" valign="middle" class="enquiery"> </td>
<td align="left" valign="middle" class="enquiery"></td>
<td align="left" valign="middle" class="button"><input type="submit" name="go" class="newadd" value="GO" border="0" style="margin:0px;" /></td>
<td> </td>
</tr>
<tr class="smalltext">
<td height="10" colspan="5" align="left" valign="middle" class="enquiery"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr><?php */?>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top" class="smalltext">
<table width="100%" height="99" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" style="border-collapse:collapse;">
<tr class="smalltexthead" bgcolor="#C4E1FF">
<td width="4%" height="22" align="center" class="head_text">No</td>
<td width="10%" align="center" class="head_text">Department</td>
<td width="24%" align="center" class="head_text">Task</td>
<td width="8%" align="center" class="head_text">Staff Type</td>
<td width="8%" align="center" class="head_text">Visa Type</td>
<td width="14%" align="center" class="head_text">Activity</td>
<td width="10%" align="center" class="head_text">User Initial</td>
<td width="9%" align="center" class="head_text">Status</td>
<td width="13%" align="center" class="head_text">E / D</td>
</tr>
<?php
$no_data=mysql_num_rows(mysql_query("select * from sat_task"));
$query_res="select * from sat_task where task_id!=''";
if($_REQUEST['department']!=''){
$query_res.=" and department='".$_REQUEST['department']."'";
}
if($_REQUEST['main_activity_id']!=''){
$query_res.=" and main_activity_id='".$_REQUEST['main_activity_id']."'";
}
if($_REQUEST['task']!=''){
$query_res.=" and task like '%".$_REQUEST['task']."%'";
}
if($_REQUEST['user_initial']!=''){
$query_res.=" and user_id='".$_REQUEST['user_initial']."'";
}
/*if($_REQUEST['staff_type']!=''){
$query_res.=" and staff_type='".$_REQUEST['staff_type']."'";
}
if($_REQUEST['visa_type']!=''){
$query_res.=" and visa_type='".$_REQUEST['visa_type']."'";
}*/
if($_REQUEST['staff_type_h']!=''){
$query_res.=" and staff_type REGEXP '".$_REQUEST['staff_type_h']."'";
}
if($_REQUEST['visa_type_h']!=''){
$query_res.=" and visa_type REGEXP '".$_REQUEST['visa_type_h']."'";
}
if($_REQUEST['status']!=''){
$query_res.=" and task_status='".$_REQUEST['status']."'";
}
if($_REQUEST['order']=="asc"){
$oredr = $_REQUEST['order'];
}
if($_REQUEST['order']=="desc"){
$oredr = $_REQUEST['order'];
}
if($_REQUEST['order']==""){
$oredr = 'desc';
}
//$query_res.=" order by main_activity_id ".$oredr.",task";
$query_res.=" order by task_id ".$oredr;
$sel_product=mysql_query($query_res);
//////////////////////start pagination/////////////////////////
$page=$_REQUEST['page'];
if($_REQUEST['page']==""){
$page = 1;
}
if($_REQUEST['submit2']!='' && $page!=1){
$page = $page;
}
//echo $page;
$max_results = 10;
$prev = ($page - 1);
$next = ($page + 1);
$from = (($page * $max_results) - $max_results);
$total_results = mysql_num_rows($sel_product);
$total_pages = ceil($total_results / $max_results);
$pagination = '';
if($page > 1)
{
$pagination .= "<a href=\"manage_task.php?page=$prev&department=".$_REQUEST['department']."&main_activity_id=".$_REQUEST['main_activity_id']."&task=".$_REQUEST['task']."&user_initial=".$_REQUEST['user_initial']."&status=".$_REQUEST['status']."&staff_type_h=".$_REQUEST['staff_type_h']."&visa_type_h=".$_REQUEST['visa_type_h']."&order=".$_REQUEST['order']."&submit2=".$_REQUEST['submit2']."\" class=\"more_link_pagination_prev\">Previous</a>";
$pagination.=" ";
}
for($i = 1; $i <=$total_pages; $i++)
{
if(($page) == $i)
{
$pagination .= $i;
$pagination.=' ';
}
else
{
$pagination .= "<a href=\"manage_task.php?page=$i&department=".$_REQUEST['department']."&main_activity_id=".$_REQUEST['main_activity_id']."&task=".$_REQUEST['task']."&user_initial=".$_REQUEST['user_initial']."&status=".$_REQUEST['status']."&staff_type_h=".$_REQUEST['staff_type_h']."&visa_type_h=".$_REQUEST['visa_type_h']."&order=".$_REQUEST['order']."&submit2=".$_REQUEST['submit2']."\" class=\"more_link_pagination\">$i</a>";
$pagination.=' ';
}
}
if($page < $total_pages)
{
$pagination .= "<a href=\"manage_task.php?page=$next&department=".$_REQUEST['department']."&main_activity_id=".$_REQUEST['main_activity_id']."&task=".$_REQUEST['task']."&user_initial=".$_REQUEST['user_initial']."&status=".$_REQUEST['status']."&staff_type_h=".$_REQUEST['staff_type_h']."&visa_type_h=".$_REQUEST['visa_type_h']."&order=".$_REQUEST['order']."&submit2=".$_REQUEST['submit2']."\" class=\"more_link_pagination_prev\">Next</a>";
$pagination.=" ";
}
$query_res.=" limit $from,$max_results";
//echo $query_res;
$query_products=mysql_query($query_res);
////////////////////////////////End pagination////////////////////////////////////
if(mysql_num_rows($query_products)>0)
{
$inc=1;
while($array_products=mysql_fetch_array($query_products))
{
if($inc%2==0)
{
?>
<tr bgcolor="#eeeeee" class="newtxt">
<?
}
if($_REQUEST['page']!="")
{
$j=($_REQUEST['page']-1)*10;
}
?>
<td height="30" align="center" valign="middle" class="head_text2"><?php echo $a=($j+$inc); ?></td>
<? //$productName=mysql_fetch_array(mysql_query("select * from sat_task_category where id ='".$array_products['category_id']."'")); ?>
<td align="center" valign="middle" class="head_text2"><?php echo $array_products['department']; ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo $array_products['task']; ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo nullCheck($array_products['staff_type']); ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo nullCheck($array_products['visa_type']); ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo check_null_value('main_activity','sat_main_activity','main_activity_id',$array_products['main_activity_id']); ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo check_null_value('user_initial','sat_users','user_id',$array_products['user_id']); ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo $array_products['task_status']?></td>
<td align="center" class="head_text2" valign="middle"><a href="manage_task.php?action=edit&id=<?php echo $array_products['task_id'];?>&search_market=<?=$_REQUEST['search_market']?>&page=<?=$_REQUEST['page']?>"><img src="images/1304761512_pen.png" alt="Edit" title="Edit" border="0" /></a> <a href="manage_task.php?delete=del&delete_id=<?php echo $array_products['task_id'];?>&search_market=<?=$_REQUEST['search_market']?>&page=<?=$_REQUEST['page']?>" onClick="return confirm('Are you sure you want to delete this task?');"><img src="images/1304761651_DeleteRed.png" alt="Delete" title="Delete" border="0" /></a> </td>
</tr>
<?php
$inc++;}
}
else{
?>
<tr class="smalltexthead">
<td height="20" colspan="9" align="center" style="color:#666; font-weight:bold; font-family:Verdana, Geneva, sans-serif; font-size:13px;">Sorry, no result found.</td>
</tr>
<?php
}
?>
</table></td>
</tr>
<tr>
<td align="center" valign="top"> </td>
</tr>
<tr>
<td height="20" colspan="10" align="center" valign="middle" bgcolor="#B2CEFC" class="head_text"><?=$pagination;?></td>
</tr>
</table></td></tr></table>
</form>
</div>
<!--content-->
<div class="clear"></div>
</div>
<?php include("includes/footer.php"); ?>
Directory Contents
Dirs: 17 × Files: 180