Preview: empnotes.php
Size: 16.62 KB
/home/jambtst2015/public_html/giraffeng.com/admin/empnotes.php
<?php include("includes/head.php"); ?>
<?php include("includes/header.php"); ?>
<?php
///////////////Add Events///////////////////////////////////////////////
if(isset($_POST) && count($_POST)>0 && $_REQUEST['id']=='' && $_REQUEST['action']!="edit")
{
$userid=mysql_real_escape_string($_REQUEST['userid']);
$notes_history=mysql_real_escape_string($_REQUEST['notes_history']);
$reminder_date=change_dateformat($_REQUEST['reminder_date']);
$reminder_email=mysql_real_escape_string($_REQUEST['reminder_email']);
mysql_query("insert into sat_notes_history set staff_id='".$userid."', notes_history='".$notes_history."', add_date=now(), added_user='".$_SESSION['sat_login_id']."'");
$msg = 1;
header("location:empnotes.php?msg=$msg&userid=$userid");
}
/////////////End Add//////////////////////////////////////////////
///////////////////////////Edit Events////////////////////////////
if($_REQUEST['edit']=="EDIT" && count($_POST)>0 && $_REQUEST['id']!='' && $_REQUEST['action']=="edit")
{
$userid=mysql_real_escape_string($_REQUEST['userid']);
$notes_history=mysql_real_escape_string($_REQUEST['notes_history']);
$reminder_date=change_dateformat($_REQUEST['reminder_date']);
$reminder_email=mysql_real_escape_string($_REQUEST['reminder_email']);
mysql_query("update sat_notes_history set staff_id='".$userid."', notes_history='".$notes_history."', added_user='".$_SESSION['sat_login_id']."' where id=".$_REQUEST['id']."");
$msg = 2;
header("location:empnotes.php?msg=$msg&page=".$_REQUEST['page_hide']."&userid=$userid");
}
///////////////////////////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_notes_history where id=".$_REQUEST['id'].""));
$_REQUEST['categoryname']=$array_product_details['category'];
}
//////////////////////End for edit///////////////////////////////////////////
///////////////////For Delete//////////////////////////////////////////////
if($_REQUEST['delete']=="del" && $_REQUEST['delete_id']!='')
{
$userid=mysql_real_escape_string($_REQUEST['userid']);
mysql_query("delete from sat_notes_history where id=".$_REQUEST['delete_id']."");
$msg = 3;
header("location:empnotes.php?msg=$msg&page=".$_REQUEST['page_hide']."&userid=$userid");
}
///////////////////////End for delete//////////////////////////////////
if(!$_REQUEST['page'])
{
$_SESSION['srchstr']="";
$_SESSION['srchkey']="";
}
?>
<script>
/*jQuery.noConflict();
(function($) {jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#formID").validationEngine();
});})(jQuery);*/
function formSub(){
document.frmproduct.submit();
return true;
}
jQuery.noConflict();
(function($) {jQuery(document).ready(function(){
// binds form submission and fields to the validation engine
jQuery("#formID").validationEngine('attach', {
onValidationComplete: function(form, status){
//alert("The form status is: " +status+", it will never submit");
if(status == true){
$('input[type="submit"]').attr('disabled','disabled');
return formSub();
}
}
});
});})(jQuery);
</script>
<script type="text/javascript" language="javascript">
function validate()
{
if(document.frmproduct.categoryname.value=='')
{
alert("Please enter exhibit category name");
document.frmproduct.categoryname.focus();
return false;
}
return true();
}
function open_src(val){
if(val==''){
$('#div_add_task').toggle("slow");
}
else{
$('#div_src_req').toggle("slow");
}
}
$(document).ready(function(){
setTimeout(function(){
$(".mydiv").fadeOut("slow", function () {
$(".mydiv").remove("slow");
});
}, 4000);
});
</script>
<?php
$msg=$_REQUEST['msg'];
if($msg == 1){
$msg = "Notes added successfully";
}
if($msg == 2){
$msg = "Notes updated successfully";
}
if($msg == 3){
$msg = "Notes deleted successfully";
}
if($msg == 4){
$msg = "Notes already exsists";
}
?>
<div class="container_bottom_section">
<a href="employee.php" class="require" style="margin-right:5px; margin-bottom:5px;">Back</a>
<a href="javascript:open_src('');" class="require" style="margin-right:5px; margin-bottom:5px;">Add Note</a>
<div class="clear"></div>
<form name="frmproduct" id="formID" action="empnotes.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']?>" />
<input type="hidden" name="userid" value="<?php echo $_REQUEST['userid']?>" />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php if($msg!='')
{?>
<tr>
<td height="30" colspan="4" align="center" style="color:#093; font-size: 13px; font-weight: bold; padding: 0 0 5px; font-family:Arial,Helvetica,sans-serif"><p class="mydiv" style="color:#090; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;"><?php echo $msg;?></p></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" height="10" class="head_text" >Add Staff Note of <?php echo check_null_value('firstname','sat_staff','staff_id',$_REQUEST['userid']); ?></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="64" align="left" valign="top" class="enquiery"></td>
<td width="95" height="10" align="left" valign="top" class="head_text2" style="padding:3px;"></td>
<td width="16" align="left" valign="top" class="enquiery"></td>
<td width="290" align="left" valign="top"></td>
<td width="64" valign="top"></td>
</tr>
<tr class="smalltext">
<td width="64" align="left" valign="top" class="enquiery"> </td>
<td width="95" height="22" align="left" valign="top" class="head_text3" style="padding:3px;"><font color="#FF0000">*</font>Write Note </td>
<td width="16" align="left" valign="top" class="enquiery">:</td>
<td width="290" align="left" valign="top"><textarea name="notes_history" id="notes_history" class="validate[required] textarea" style="width:290px; border:1px solid #7F9DB9 !important; height:80px;"><?php echo $array_product_details['notes_history']; ?></textarea></td>
<td width="64" valign="top"> </td>
</tr>
<?php /*?><tr class="smalltext">
<td width="129" align="left" valign="top" class="enquiery"> </td>
<td width="128" height="22" align="left" valign="top" class="head_text3" style="padding:3px; text-align:left;">Reminder Date </td>
<td width="34" align="left" valign="top" class="enquiery">:</td>
<td width="170" align="left" valign="top">
<input name="reminder_date" id="reminder_date" type="text" class="datepicker textfield require_field" value="<?php echo change_dateformat_reverse($array_product_details['reminder_date']); ?>" />
<script>
$(function() {
$( "#reminder_date" ).datepicker({
dateFormat:"<?php echo $dateFormat; ?>"
});
});
</script>
</td>
<td width="70" valign="top"> </td>
</tr>
<tr class="smalltext">
<td width="129" align="left" valign="top" class="enquiery"> </td>
<td width="128" height="22" align="left" valign="top" class="head_text3" style="padding:3px;">Reminder Email </td>
<td width="34" align="left" valign="top" class="enquiery">:</td>
<td width="170" align="left" valign="top"><input name="reminder_email" id="reminder_email" type="text" class="validate[custom[email]] textfield require_field" value="<?php echo $array_product_details['reminder_email']?>" /></td>
<td width="70" valign="top"> </td>
</tr><?php */?>
<tr>
<td align="left" valign="top" class="enquiery"> </td>
<td height="30" align="left" valign="top" class="enquiery"> </td>
<td align="left" valign="top" class="enquiery"></td>
<td aign="left" valign="top" class="button">
<? if($_REQUEST['action']=="edit")
{
?>
<input type="submit" name="edit" class="newadd" value="EDIT" border="0" style="margin:0px;" />
<input type="button" name="back" id="back" class="newadd" value="Cancel" style=" margin-bottom:10px;" onclick="document.location.href='empnotes.php?userid=<?php echo $_REQUEST['userid']; ?>';" />
<?
}
else
{
?>
<input type="submit" name="add" class="newadd" value="ADD" border="0" style="margin:0px;" />
<input type="button" name="back" id="back" class="newadd" value="Cancel" style=" margin-bottom:10px;" onclick="document.location.href='empnotes.php?userid=<?php echo $_REQUEST['userid']; ?>';" />
<?
}
?> </td>
<td valign="top"> </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">
</table></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top" class="smalltext">
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" style="border-collapse:collapse;">
<tr class="smalltexthead">
<td width="4%" height="22" align="center" class="head_text">No</td>
<td width="11%" align="center" class="head_text">Staff Name</td>
<td width="10%" align="center" class="head_text">Added Date</td>
<td width="10%" align="center" class="head_text">Added By User</td>
<?php /*?><td width="11%" align="center" class="head_text">Reminder Date</td>
<td width="14%" align="center" class="head_text">Reminder Email</td><?php */?>
<td width="29%" align="center" class="head_text">Notes</td>
<td width="11%" align="center" class="head_text">E / D</td>
</tr>
<?php
$query_res="select * from sat_notes_history where staff_id='".$_REQUEST['userid']."'";
if($_REQUEST['search_market']!='')
{
$query_res.=" and market_type='".$_REQUEST['search_market']."'";
}
$query_res.=" order by id desc";
//echo $query_res;
$sel_product=mysql_query($query_res);
//////////////////////start pagination/////////////////////////
$page=$_REQUEST['page'];
if($_REQUEST['page']=="")
{
$page = 1;
}
$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=\"empnotes.php?page=$prev&search_market=".$_REQUEST['search_market']."\" 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=\"empnotes.php?page=$i&search_market=".$_REQUEST['search_market']."\" class=\"more_link_pagination\">$i</a>";
$pagination.=' ';
}
}
if($page < $total_pages)
{
$pagination .= "<a href=\"empnotes.php?page=$next&search_market=".$_REQUEST['search_market']."\" 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 align="center" valign="middle" class="head_text2"><?php echo $a=($j+$inc); ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo check_null_value('firstname','sat_staff','staff_id',stripslashes($array_products['staff_id'])); ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo change_dateformat_reverse($array_products['add_date']); ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo check_null_value('user_initial','sat_users','user_id',stripslashes($array_products['added_user']))?></td>
<?php /*?><td align="center" valign="middle" class="head_text2"><?php echo change_dateformat_reverse($array_products['reminder_date']); ?></td>
<td align="center" valign="middle" class="head_text2"><?php echo $array_products['reminder_email']?></td><?php */?>
<td align="center" valign="middle" class="head_text2"><?php echo $array_products['notes_history']?></td>
<td align="center" valign="middle" class="head_text2"><a href="empnotes.php?action=edit&id=<?php echo $array_products['id'];?>&userid=<?php echo $array_products['staff_id'];?>&page=<?=$_REQUEST['page']?>"><img src="images/1304761512_pen.png" alt="Edit" title="Edit" border="0" /></a> <a href="empnotes.php?delete=del&delete_id=<?php echo $array_products['id'];?>&page=<?=$_REQUEST['page']?>&userid=<?php echo $array_products['staff_id'];?>" onClick="return confirm('Are you sure?');"><img src="images/1304761651_DeleteRed.png" alt="Delete" title="Delete" border="0" /></a> </td>
</tr>
<?php
$inc++;}
}
else{
?>
<tr>
<td height="20" colspan="10" align="center" valign="middle" class="head_text" style="background-color:#FFF; color:#333;">No Records 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>
<?php include("includes/footer.php"); ?>
Directory Contents
Dirs: 17 × Files: 180