<?php
echo ahead("招聘信息列表");
?>
<script language="javascript" src="inc/admin.js"></script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <form action="company_hirelist.php" method="post">
  <tr>
    <th height="25">企业招聘管理</th>
  </tr>
  <tr>
  <td height=25 class="pl20"><b>管理选项：</b><a href="company_searchlist.php">管理首页</a>&nbsp;|&nbsp;<a href="company_searchlist.php?do=add">企业添加</a>&nbsp;|&nbsp;<a href="company_hirelist.php?do=add">职位添加</a>&nbsp;|&nbsp;<a href="company_hirelist.php">职位管理</a>&nbsp;|&nbsp;<a href="company_searchhire.php">职位查询</a>&nbsp;|&nbsp;[<a href="javascript:location.reload()">刷新页面</a>]</td>
  </tr>
  <tr>
  <td height=25 class="pl20"><b>二级选项：</b><a href="?operate=0">待审职位</a> | <a href="?operate=1">已审职位</a> | <a href="?operate=2">已推荐职位</a> | <a href="?operate=3">已过期职位</a> | <a href="?operate=4">一周内到期</a> | <a href="?operate=5">30天内到期</a></td>
  </tr>
    <tr> 
      <td height=25 class="pl20"><b>职位搜索：</b> 
          <input name="keyword" type="text" id="keyword" value="<?php echo $keyword;?>" size="20">
          <select name="segment" size="1" id="segment">
            <option value="h_place" <?php if($segment=="h_place") echo "selected";?>>职位名称</option>
            <option value="h_comname" <?php if($segment=="h_comname") echo "selected";?>>公司名称</option>
          </select>
          <input name="Submit" type="submit" class="inputs" value="搜索">
     &nbsp;<a href="company_searchhire.php"><font color="#FF0000">[高级搜索]</font></a>&nbsp; <a href="company_hirelist.php?do=reload" title="更新过期推荐职位状态！">刷新</a> <a href="company_hirelist.php?do=clear" title="清理企业已删除，尚未彻底删除的无效职位！">清理</a></td>
    </tr>
    </form>
</table>
<?php
if($do=="add"){
?>
<script src="../js/jquery-1.4.2.min.js" language="javascript"></script>
<script src="../js/jquery.validate.min.js" language="javascript"></script>
<script language="javascript" src="../js/calendar.js" type="text/javascript"></script>
<script type="text/javascript">
$.validator.addMethod("iszipcode", function(value, element) {    
	var tel = /^[0-9]{6}$/;
	return this.optional(element) || (tel.test(value));});
$.validator.methods.istel=function(value, element) {    
	var tel = /^[0-9\s+.-]+$/;
	return this.optional(element) || (tel.test(value));}
$.validator.methods.isbirth=function(value, element) {  
today = new Date(); 
var birtha=value;
var birthb=birtha.split("-");
if(today.getYear()-12<=birthb[0]){
	return false;
}else{
	return true;
}}
$().ready(function() {
	$("#addform").validate({
		success: function(label) {
			label.text("输入正确!").addClass("success");
		}, 
		rules: {
			<?php if(!$id){?>
			login: {required: true},
			email: {required: true,email: true,maxlength: 100},
			<?php }?>
			place: {required: true,maxlength: 50},
            //comname: {required: true,maxlength: 100},
			trade: {required: true},
			introduce:{required: true,minlength: 10,maxlength: 8000},
			contact: {required: true,maxlength: 100},
			tel: {required: true,istel:true,maxlength: 100},
			fax: {istel:true,maxlength: 100},
			address: {maxlength: 100},
			post: "iszipcode"
		},
		messages: {
			<?php if(!$id){?>
			login: "用户名要求长度为4-20位(可用字母、数字、下划线;)",
			email: {
				required: "E-mail地址为必填项",
				email: "请填写有效的E-mail地址",
				maxlength: "E-mail地址不得超出100个字符"
			},
			<?php }?>
			place: '请正确填写职位名称',
            //comname: '请正确填写公司名称',
			trade: '请公司所属行业!',
			introduce:'请输入职位描述，10-8000个字符之间',
			contact: '请输入联系人姓名',
			tel: {required: "联系电话格式如：029-85460076",istel:"联系电话格式如：029-85460076",maxlength: "联系电话长度为100个字符以内"},
			fax: {istel:"传真格式如：029-85460076",maxlength: "联系电话长度为100个字符以内"},
			address: '通讯地址长度为100个字符以内',
			post: "邮政编码为6位数字"
		}
	});
});
</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
<form name="addform" id="addform" action="?do=savedata" method="post">
<tr>
    <th height=25 colspan="2">添加招聘职位</th>
  </tr>
  <?php if(!$id){?>
  <tr> 
    <td width="100" align="right"><span style="color:#F00">*</span> 用户名：</td>
    <td><input name="login" type="text" id="login" size="30" class="txt" /></td>
  </tr>
  <?php }?>
  <tr>
    <td height="21" colspan="2">职位描述：</td>
    </tr>
    <tr>
    <td width="100" align="right"><input name="id" type="hidden" value="<?php echo $id;?>" /><span style="color:#F00">*</span> 招聘类别：</td>
      <td height="21"><input type="radio" value="1" name="type"  checked class="checkbox" />全职
            <input type="radio" value="2" name="type" <?php if($type==2) echo ' checked';?> class="checkbox" />兼职
            <input type="radio" value="3" name="type" <?php if($type==3) echo ' checked';?> class="checkbox" />全职、兼职均可</td>
    </tr>
     <tr>
    <td align="right"><span style="color:#F00">*</span> 招聘职位：</td>
      <td height="21"><input name="place" type="text" id="place" size="30" maxlength="50" value="<?php echo $place;?>" /></td>
    </tr>
    <tr>
    <td align="right">招聘部门：</td>
      <td height="21"><input type="text" name="dept" size="10" value="<?php echo $dept;?>" />
<select name="depttemp" size="1" onChange="dept.value=this.value" style="width: 120px">
  <option value="" selected="selected">选择现有部门</option>
  <?php
        $sql="select d_name from {$cfg['tb_pre']}dept where d_cmember='$username'";
        $query=$db->query($sql);
        while($row=$db->fetch_array($query)){
            echo "<option value=\"$row[d_name]\">$row[d_name]</option>\r\n";
        }
    ?>
</select>
&nbsp;如果您尚未添加部门，请直接在文本框中输入部门名称。</td>
    </tr>
    <tr>
    <td align="right"><span style="color:#F00">*</span> 所属行业：</td>
      <td height="21"><select name="trade" size=1 id="trade">
                <option value="">请选择行业</option>
                <?php echo getother('trade','t','t_order asc',$trade,1);?>
                </select></td>
    </tr>
    <tr>
    <td align="right"><span style="color:#F00">*</span> 岗位类别：</td>
      <td height="21"><input type="hidden" name="position" id="position" value="<?php echo hireposition($position,0,0,1);?>" ><input name="positions" type="text" onClick="JumpSearchLayer(1,'addform','position','positions');" value="<?php if($position){echo csysnames($position);}else{echo "选择岗位类别";}?>" size="60" readonly /></td>
    </tr>
    <tr>
    <td align="right" class="tdcolor"><span style="color:#F00">*</span> 工作地区：</td>
      <td height="21"><input name="workadd" type="hidden" id="workadd" value="<?php echo hireworkadd($workadd,0,0,1);?>" /><input name="workadds" type="text" onClick="JumpSearchLayer(5,'addform','workadd','workadds');" id="workadds"  value="<?php if($workadd){echo csysnames($workadd);}else{echo "选择工作地区";}?>" size="60" readonly /></td>
    </tr>
    <tr>
    <td align="right"><span style="color:#F00">*</span> 招聘人数：</td>
      <td height="21"><input name="number" id="number" size="6" maxlength="5" value="<?php echo $number;?>" />
  人 （注：0为若干人）</td>
    </tr>
    <tr">
    <td align="right"><span style="color:#F00">*</span> 月薪待遇：</td>
      <td height="21"><input name="pay" id="pay" size=10 value="<?php echo ahirepay($pay);?>">
            <select name="paytemp" onChange="pay.value=this.value">
                    <option value="" selected>请选择薪资范围</option>
                    <option value="800以下">800以下</option>
                    <option value="800～1000">800～1000</option>
                    <option value="1000～1200">1000～1200</option>
                    <option value="1200～1500">1200～1500</option>
                    <option value="1500～2000">1500～2000</option>
                    <option value="2000～2500">2000～2500</option>
                    <option value="2500～3000">2500～3000</option>
                    <option value="3000～4000">3000～4000</option>
                    <option value="4000～6000">4000～6000</option>
                    <option value="6000～9000">6000～9000</option>
                    <option value="9000～12000">9000～12000</option>
                    <option value="12000～15000">12000～15000</option>
                    <option value="15000～20000">15000～20000</option>
                    <option value="20000以上">20000以上</option>
              </select>
               元 （注：0表示面议，按新法规建议您输入固定值或者选择薪资范围。）</td>
    </tr>
    <tr>
    <td align="right"><span style="color:#F00">*</span> 截止日期：</td>
      <td height="21"><input type="text" name="enddate" value="<?php echo $enddate;?>" id="enddate" size="10" maxlength="10" onClick="ShowCalendar(this.id)" readonly /></td>
    </tr>
    <tr>
    <td align="right"><span style="color:#F00">*</span> 具体描述：</td>
      <td height="21"><textarea id="introduce" name="introduce" rows="10" cols="80"><?php echo change_strbox($introduce);?></textarea>
言简意赅地阐述职位具体要求。</td>
    </tr>
    <tr>
    <td height="21" colspan="2">对应聘者要求：</td>
    </tr>
    <tr>
    <td align="right">人才类型：</td>
      <td height="21"><input id="usergroup" type=radio checked value=0 name="usergroup">
  普通 <input id="usergroup" type=radio <?php if($usergroup==1) echo ' checked';?> value=1 name=usergroup>
  毕业生 
  <input id="usergroup" type=radio <?php if($usergroup==2) echo ' checked';?> value=2 name=usergroup>高级人才</td>
    </tr>
    <tr>
    <td align="right">专业要求：</td>
      <td height="21"><input type="hidden" name="profession" id="profession" value="<?php echo hireprofession($profession,0,0,1);?>" ><input name="professions" type="text" onClick="JumpSearchLayer(3,'addform','profession','professions');" value="<?php if($profession){echo csysnames($profession);}else{echo "选择专业要求";}?>" size="60" readonly /></td>
    </tr>
    <tr>
    <td align="right">学&nbsp; &nbsp;&nbsp;历：</td>
      <td height="21"><select name="edu">
      <option value="0" selected>不限</option>
        <?php echo getother('edu','e','e_id asc',$edu);?>
        </select> 或以上</td>
    </tr>
    <tr>
    <td align="right">工作经验：</td>
      <td height="21"><select name="experience" size=1 id="experience" style="font-size:12px; width:100px; font-family:宋体">
            <option value="-100" selected>不限</option>
            <option value="-1" <?php if($experience==-1) echo ' selected="selected"';?>>在读学生</option>
            <option value="0" <?php if($experience==0) echo ' selected="selected"';?>>毕业生</option>
            <?php
            for($i=1;$i<=10;$i++){
                echo "<option value=\"$i\" ";
                if($experience==$i) echo " selected";
                echo ">{$i}年</option>\r\n";
            }
            ?>
        </select> 或以上</td>
    </tr>
    <tr>
    <td align="right">性&nbsp;&nbsp;&nbsp;&nbsp;别：</td>
      <td height="21"><select name=sex size=1>
            <option value=0 selected>不限</option>
            <option value=1 <?php if($sex==1) echo ' selected="selected"';?>>男性</option>
            <option value=2 <?php if($sex==2) echo ' selected="selected"';?>>女性</option>
            </select></td>
    </tr>
    <tr>
    <td align="right">年&nbsp;&nbsp;&nbsp; 龄：</td>
      <td height="21"><select style="width:60px;" size=1 name="age1">
            <option value=0 selected>不限</option>
            <?php
            for($i=16;$i<=60;$i++){
                echo "<option value=\"$i\" ";
                if($age1==$i) echo " selected";
                echo ">{$i}岁</option>\r\n";
            }
            ?>
      </select>
      至
      <select style="width:60px;" size=1 name="age2">
            <option value=0 selected>不限</option>
            <?php
            for($i=16;$i<=60;$i++){
                echo "<option value=\"$i\" ";
                if($age2==$i) echo " selected";
                echo ">{$i}岁</option>\r\n";
            }
            ?>
      </select></td>
    </tr>
    <tr>
    <td height="21" colspan="2">单位联系方式：</td>
    </tr>
    <tr>
    <td align="right">通讯地址：</td>
      <td height="21"><input name="address" type="text" size="38" maxlength="50" value="<?php echo $address;?>" /></td>
    </tr>
    <tr>
    <td align="right">邮&nbsp;&nbsp;&nbsp; 编：</td>
      <td height="21"><input name="post" id="post" size="6" maxlength="6" value="<?php echo $post;?>" /></td>
    </tr>
    <tr>
    <td align="right"><span style="color:#F00">*</span> 联 系 人：</td>
      <td height="21"><input name="contact" id="contact" size="28" maxlength="25" value="<?php echo $contact;?>" /></td>
    </tr>
    <tr>
    <td align="right"><span style="color:#F00">*</span> 联系电话：</td>
      <td height="21"><input name="tel" type="text" id="tel" size="38" maxlength="100" value="<?php echo $tel;?>" />
<br />
<input id="telshowflag" type="checkbox" value="0" name="telshowflag" <?php if($telshowflag==0) echo ' checked';?> />
<font color="#000000">合则约见，谢绝来电（如果您不想告知求职者联系电话，请选择此项，系统将隐藏您的联系电话。）</font></td>
    </tr>
    <tr>
    <td align="right">传&nbsp;&nbsp;&nbsp; 真：</td>
      <td height="21"><input name="fax" type="text" id="fax" size="38" maxlength="100" value="<?php echo $fax;?>" /></td>
    </tr>
    <tr>
    <td align="right"><span style="color:#F00">*</span> 电子邮件：</td>
      <td height="21"><input maxlength="100" size="38" name="email" value="<?php echo $email;?>" />
  <br />
  <input name="emailshowflag" type="checkbox" id="emailshowflag" value=0 <?php if($emailshowflag==0) echo ' checked';?> />
<font color="#000000">屏蔽电子邮件 （求职者看不到电子邮箱地址，但仍能在线发送简历到该职位的电子邮箱，这样可以在不公开你邮箱地址的同时仍然可以进行招聘。）</font></td>
    </tr>
  <tr>
    <td height="30" colspan="2" align="center">
    <input type="hidden" name="id" value="<?php echo $id;?>">
    <input type="hidden" name="keyword" value="<?php echo $keyword;?>"> 
    <input type="hidden" name="segment" value="<?php echo $segment;?>">
    <input type="hidden" name="page" value="<?php echo $page;?>">
	<input name="Submit1" type="submit" class="inputs" id="Submit1" value="确认提交">　
      <input name="Submit2" type="reset" class="inputs" value="重新填写">
    
	</td>
  </tr>
</form></table>
<div id="bodyly" style="position:absolute;top:0px;FILTER: alpha(opacity=80);background-color:#333; z-index:0;left:0px;display:none;"></div>
<script language = "JavaScript" src="../js/getprovince.js"></script>
<script language = "JavaScript" src="../js/gettrade.js"></script>
<script language = "JavaScript" src="../js/getposition.js"></script>
<script language = "JavaScript" src="../js/getprofession.js"></script>
<script language="javascript" src="../js/jobjss.js"></script>
<?php
}else{
?>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder mt6">
<form name="form2" action="websys_channel.php" method="post">
<tr>
    <th colspan=9 height=25>招聘信息列表</th>
</tr>
<tr align="center"> 
  <td width="5%">编号</td>
  <td width="14%">招聘职位</td>
  <td width="18%">公司名称</td>
  <td width="12%">点击/申请/邀请</td>
  <td width="18%">发布时间</td>
  <td width="10%">截止日期</td>
  <td width="6%">状态</td>
  <td width="14%">会员/录入员</td>
  <td width="3%"><input name="checkSelect" type="checkbox" class="checkbox" onClick="javascript: checkAll(this)" value="checkbox"></td>
</tr>
<?php 
echo $hirelist;
?>
<tr><td height="25" align="right" colspan="9">
    <input type="hidden" name="members" value="">
    <input type="hidden" name="keyword" value="<?php echo $keyword;?>"> 
    <input type="hidden" name="segment" value="<?php echo $segment;?>">
    <input type="hidden" name="page" value="<?php echo $page;?>">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(1);" value="审核职位">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(2);" value="撤销审核">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(3);" value="推荐职位">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(4);" value="撤销推荐">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(7);" value="刷新职位">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(8);" value="重新发布">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(5);" value="修改">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(6);" value="删除">
</td></tr>
<tr>
<td height="25" align="center" colspan="9" class="tdpage"><?php echo $getpageinfo['pagecode'];?></td></tr>
</form>
</table>
<script language="javascript">
function confirmX(num)
{
	var ids = document.getElementsByName("member");
	var check=false;
	var allSel="";
	var a=0;
	if (ids != null) {
		for (i=0; i<ids.length; i++) 
		{
			var obj = ids[i];
			if (obj.checked==true)
			{
				if(allSel==""){
				allSel=obj.value;
				}else{
				allSel=allSel+","+obj.value;
				}
				document.form2.members.value = allSel;
				check=true;
				a+=1
				
			}
		}
		if(check==false){alert("请选择操作对象！");return false;}
	}
	if(num==1)
	{
		if(confirm("你确定要审核你所选择的职位吗？"))	
		{
			document.form2.action="company_hirelist.php?do=audit";
			document.form2.submit();		
		}
	}
	if(num==2)
	{
		if(confirm("你确定要撤销审核你所选择的职位吗？"))	
		{
			document.form2.action="company_hirelist.php?do=unaudit";
			document.form2.submit();		
		}
	}
	if(num==3)
	{
		if(confirm("你确定要推荐你所选择的职位吗？"))	
		{
			document.form2.action="company_hirelist.php?do=comm";
			document.form2.submit();		
		}
		
	}
	if(num==4)
	{
		if(confirm("你确定要撤销推荐你所选择的职位吗？"))	
		{
			document.form2.action="company_hirelist.php?do=uncomm";
			document.form2.submit();		
		}
	}
	if(num==5)
	{
		if(a==1){
		if(confirm("你确定要修改你所选择的职位吗？"))	
		{
			document.form2.action="company_hirelist.php?do=edit";
			document.form2.submit();		
		}
		}
		else
		{
		alert("同一时刻只能选择一个操作对象进行修改!")
		return false;
		}
	}
	if(num==6)
	{
		if(confirm("警告：此操作将会删除该职位！\n是否继续本操作？"))	
		{
			document.form2.action="company_hirelist.php?do=del";
			document.form2.submit();		
		}
	}
	if(num==7)
	{
		if(confirm("您确定要刷新选定的职位吗？"))	
		{
			document.form2.action="company_hirelist.php?do=refresh";
			document.form2.submit();		
		}
	}
	if(num==8)
	{
		if(confirm("您确定要重新发布选定的职位吗？"))	
		{
			document.form2.action="company_hirelist.php?do=republish";
			document.form2.submit();		
		}
	}
	return false;	
}
function checkAll(box1) {
    var ids = document.getElementsByName("member");
	if (ids != null) {
		for (i=0; i<ids.length; i++) {
			var obj = ids[i];
			obj.checked = box1.checked;
		}
	}
}
</script>
<?php } ?>
<?php echo acopy();?>