<?php
echo ahead("企业会员列表");
?>
<script language="javascript" src="inc/admin.js"></script>
<script language="javascript" src="../js/sms.js"></script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <form action="company_searchlist.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">LOGO待审</a> | <a href="?operate=4">LOGO已审</a> | <a href="?operate=5">LOGO推荐</a> | <a href="?operate=6">已过期</a> | <a href="?operate=7">一周内到期</a> | <a href="?operate=8">30天内到期</a> | <a href="?operate=9">已过期一周</a> | <a href="?operate=10">已过期30天</a></td>
  </tr>
  <tr>
      <td height=25 class="pl20"><b>服务选项：</b><?php echo $grouplist;?></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="m_login" <?php if($segment=="m_login") echo "selected";?>>会员帐号</option>
            <option value="m_name" <?php if($segment=="m_name") echo "selected";?>>公司名称</option>
            <option value="m_email" <?php if($segment=="m_email") echo "selected";?>>邮箱地址</option>
            <option value="m_tel" <?php if($segment=="m_tel") echo "selected";?>>联系电话</option>
            <option value="m_mob" <?php if($segment=="m_mob") echo "selected";?>>手机号码</option>
          </select>
          <input name="Submit" type="submit" class="inputs" value="搜索">
     &nbsp;<a href="company_searchlist.php?do=reload">刷新账户状态</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.methods.islogin=function(value, element) {    
	var tel = /^[A-Za-z0-9_@.-]{4,20}$/;
	return tel.test(value);}
$.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: {islogin: true,remote: {url: "../register.php?do=check",type: "post",dataType: "json", data: {login: function() {return $("#login").val();}}}},
			pwd: {required: true,minlength: 4,maxlength: 20},
			repwd: {required: true,minlength: 4,maxlength: 20,equalTo: "#pwd"},
			email: {required: true,email: true,maxlength: 100,remote: {url: "../register.php?do=check",type: "post",dataType: "json", data: {email: function() {return $("#email").val();}}}},
			<?php }?>
			name: {required: true,maxlength: 100},
			trade: {required: true},
			city: {required: true},
			ecoclass: {required: true},
			founddate: {dateISO:true},
			fund: {digits: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},
			mobile: {digits:true,rangelength:[10,12]},
			chat: {digits:true},
			url: {url: true},
			address: {maxlength: 100},
			post: "iszipcode"
		},
		messages: {
			<?php if(!$id){?>
			login: {
				islogin:"用户名要求长度为4-20位(可用字母、数字、下划线;)",
				remote:"用户用已被占用，请重新输入"
			},
			pwd: "用户密码须4-20位之间，区分大小写",
			repwd: {
				required: "请再次输入密码",
				minlength: "用户密码须4-20位之间，区分大小写",
				equalTo: "两次输入密码必须一致"
			},
			email: {
				required: "E-mail地址为必填项",
				email: "请填写有效的E-mail地址",
				maxlength: "E-mail地址不得超出100个字符",
				remote: "E-mail已被占用，请重新输入"
			},
			<?php }?>
			name: '请正确填写公司名称',
			trade: '请公司所属行业!',
			city: '请选择您的所在地',
			ecoclass: '请选择公司性质!',
			founddate: '请输入有效的成立日期，格式如：2010-05-18',
			fund: '请输入正确的注册资金，必须为整数',
			introduce:'请输入公司介绍，10-8000个字符之间',
			contact: '请输入联系人姓名',
			tel: {required: "联系电话格式如：029-85460076",istel:"联系电话格式如：029-85460076",maxlength: "联系电话长度为100个字符以内"},
			fax: {istel:"传真格式如：029-85460076",maxlength: "联系电话长度为100个字符以内"},
			mobile: '请填写正确的手机或小灵通号码，以便接收短信通知',
			chat: 'QQ号码为数字，请正确填写',
			url: '请输入网址，格式如：<?php echo $cfg['siteurl'];?>',
			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" title="用户名要求长度为4-20位(可用字母、数字、下划线;)" size="30" class="txt" /></td>
  </tr>
  <tr>
    <td align="right"><span style="color:#F00">*</span> 密码：</td>
    <td><input name="pwd" type="password" id="pwd" title="用户密码须4-20位之间，区分大小写" size="30" class="txt"/></td>
  </tr>
  <tr>
    <td align="right">确认密码：</td>
    <td><input name="repwd" type="password" id="repwd" title="请再次输入密码" size="30" class="txt"/></td>
  </tr>
  <?php }?>
  <tr>
    <td width="100" align="right"><span style="color:#F00">*</span> 公司名称：</td>
    <td><input name="name" type="text" id="name" title="请正确填写公司名称，填写后不能修改" size="30" class="txt" value="<?php echo $name;?>" /></td>
  </tr>
  <tr>
     <td align="right">营业执照：</td>
     <td><input name="licence" type="text" id="licence" title="填写营业执照号或者组织机构代码证号" size="30" class="txt" value="<?php echo $licence;?>" /></td>
  </tr>
  <tr>
     <td align="right"><span style="color:#F00">*</span> 所属行业：</td>
<td><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><select name="province" size="1" class="t100" id="province" onChange="changeProvince(this.form.province.options[this.selectedIndex].value,this.form,'')">
		<?php if($province!=''){?>
		<option value="<?php echo $province;?>"><?php echo $province;?></option>
		<?php }else{?><option value="">选择省</option><?php }?>
		</select>		
		<select name="capital" id="capital" class="t" onChange="changeCity(this.form.capital.options[this.form.capital.selectedIndex].value,this.form,'')">
		<?php if($capital!=''){?>
		<option value="<?php echo $capital;?>"><?php echo $capital;?></option>
		<?php }else{?><option value="">选择市</option><?php }?>
		</select>
		<select name="city" id="city" class="t">
		<?php if($city!=''){?>
		<option value="<?php echo $city;?>"><?php echo $city;?></option>
		<?php }else{?><option value="">选择区县</option><?php }?>
		</select></td>
  </tr>
  <tr>
    <td align="right"><span style="color:#F00">*</span> 公司性质：</td>
<td><select name="ecoclass" size=1 id="ecoclass">
                    <option value="">请选择公司性质</option>
                    <?php echo getother('ecoclass','e','e_id asc',$ecoclass,1);?>
                    </select></td>
  </tr>
    <tr>
        <td align="right">成立日期：</td>
      <td><input name="founddate" type="text" id="founddate" onClick="ShowCalendar(this.id)" onFocus="ShowCalendar(this.id)" size="10" value="<?php echo $founddate;?>"/></td>
      </tr>
  <tr>
    <td align="right">注册资金：</td>
    <td><input type="text" name="fund" size="6" maxlength="6" value="<?php echo $fund;?>"/>万人民币</td>
  </tr>
  <tr>
    <td align="right">员工人数：</td>
    <td><input type="radio" value="少于50人" name="workers"/ checked="checked" class="checkbox">少于50人
                    <input type="radio" value="50-200人" name="workers" <?php if($workers=='50-200人') echo ' checked';?> class="checkbox" />50-200人
                    <input type="radio" value="200-500人" name="workers" <?php if($workers=='200-500人') echo ' checked';?> class="checkbox" />200-500人
                    <input type="radio" value="500-1000人" name="workers" <?php if($workers=='500-1000人') echo ' checked';?> class="checkbox" />500-1000人
        <input type="radio" value="1000人以上" name="workers" <?php if($workers=='1000人以上') echo ' checked';?> class="checkbox" />1000人以上</td>
    </tr>
<tr>
          <td align="right"><span style="color:#F00">*</span> 公司简介：</td>
          <td><textarea name="introduce" cols="60" rows="8" id="introduce"><?php echo change_strbox($introduce);?></textarea></td>
      </tr>
        <tr>
          <td align="right">通讯地址：</td>
          <td><input name=address id="address" size="30" maxlength="100" value="<?php echo $address;?>" /></td>
      </tr>
        <tr>
          <td align="right">邮政编码：</td>
          <td><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><input name=contact id="contact" size="20" maxlength="25" value="<?php echo $contact;?>" /></td>
      </tr>
        <tr>
          <td align="right"><span style="color:#F00">*</span> 联系电话：</td>
          <td><input name=tel id="tel" size="30" maxlength="100" value="<?php echo $tel;?>" /></td>
      </tr>
        <tr>
          <td align="right">手机号码：</td>
          <td><input name=mobile id="mobile" size="20" maxlength="20" value="<?php echo $mobile;?>"></td>
      </tr>
      <tr>
          <td align="right"><span style="color:#F00">*</span> 电子邮件：</td>
          <td><input name="email" type="text" id="email" size="30" maxlength="100" value="<?php echo $email;?>" /></td>
      </tr>
        <tr>
          <td align="right">传&nbsp;&nbsp;&nbsp; 真：</td>
          <td><input name=fax id="fax" size="30" maxlength="100" value="<?php echo $fax;?>" /></td>
      </tr>
        <tr>
          <td align="right">QQ号码：</td>
          <td><input name=chat id="chat" size="20" maxlength="20" value="<?php echo $chat;?>" /></td>
      </tr>
        <tr>
          <td align="right">公司主页：</td>
          <td><input name=url id="url" size="30" maxlength="100" value="<?php echo $url;?>" /></td>
      </tr>
      <tr>
          <td align="right">&nbsp;</td>
          <td><input name="tb2" type="checkbox" value="1" checked="checked" class="checkbox" />
          同步更新所有招聘信息中的联系方式</td>
      </tr>
      <?php if(!$id){?>
      <tr>
          <td align="right">选择服务:</td>
          <td><?php echo getgroup(2,3);?></td>
      </tr>
      <?php }?>
  <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>
<script language = "JavaScript" src="../js/getprovince.js"></script>
<script language = "JavaScript">
function changeProvince(selvalue,form,str){	
	if(str=='hukou'){
		form.hukoucapital.length=0; 
		form.hukoucity.length=0;
	}else{
		form.capital.length=0; 
		form.city.length=0;
	}
	var selvalue=selvalue;	  
	var j,d,mm,f=0;
    selvalues='';
	d=0;
	for(j=0;j<provArray.length;j++) {
        if(provArray[j][0]==selvalue&&f==0){selvalues=provArray[j][2];f=1;}
		if(provArray[j][1]==selvalues) {
			if (d==0){
			mm=provArray[j][2];
			}
			var newOption2=new Option(provArray[j][0],provArray[j][0]);
			if(str=='hukou'){
				document.getElementById('hukoucapital').options.add(newOption2);
			}else{
				document.getElementById('capital').options.add(newOption2);
			}
			d=d+1;	
		}		
		if(provArray[j][1]==mm) 
		{		
			var newOption3=new Option(provArray[j][0],provArray[j][0]);
			if(str=='hukou'){
				document.getElementById('hukoucity').options.add(newOption3);
			}else{
				document.getElementById('city').options.add(newOption3);
			}
		}			
	}
}
function changeCity(selvalue,form,str) { 
	if(str=='hukou'){form.hukoucity.length=0;}else{form.city.length=0;} 
	var selvalue=selvalue;
	var j,d,f=0;
    selvalues='';
	for(j=0;j<provArray.length;j++) 
	{
        if(provArray[j][0]==selvalue&&f==0){selvalues=provArray[j][2];f=1;}
        if(provArray[j][1]==selvalues) 
		{
			var newOption4=new Option(provArray[j][0],provArray[j][0]);
			if(str=='hukou'){
				document.getElementById('hukoucity').options.add(newOption4);
			}else{
				document.getElementById('city').options.add(newOption4);
			}
		}
	}
}
function selectprovince(str) { 
var j;
	for(j=0;j<provArray.length;j++) {
		if(provArray[j][1]==0) {
			var newOption4=new Option(provArray[j][0],provArray[j][0]);
            //alert(newOption4);
			if(str=='hukou'){
				document.getElementById('hukouprovince').options.add(newOption4);
			}else{
				document.getElementById('province').options.add(newOption4);
			}
		}
	}
}
selectprovince('');
</script>
<?php
}else{
?>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder mt6">
<form name="form2" action="company_searchlist.php" method="post">
<tr>
    <th colspan=9 height=25>企业会员列表（<a href="company_searchlist.php?segment=<?php echo $segment;?>&keyword=<?php echo $keyword;?>&operate=<?php echo $operate;?>&group=<?php echo $group;?>&order=1">最近注册</a> | <a href="company_searchlist.php?segment=<?php echo $segment;?>&keyword=<?php echo $keyword;?>&operate=<?php echo $operate;?>&group=<?php echo $group;?>&order=2">最近登陆</a> | <a href="company_searchlist.php?segment=<?php echo $segment;?>&keyword=<?php echo $keyword;?>&operate=<?php echo $operate;?>&group=<?php echo $group;?>&order=3">最近到期</a>）</th>
</tr>
<tr align="center"> 
    <td width="5%"><b>编号</b></td>
    <td width="20%"><b>会员名|状态|名称</b></td>
    <td width="18%"><b>登录|注册时间</b></td>
    <td width="8%"><b>标志|执照</b></td>
    <td width="11%"><b>联系方式</b></td>
    <td width="12%"><b>服务|余额|消费</b></td>
    <td width="9%"><b>登录|点击</b></td>
    <td width="3%"><input name="checkSelect" type="checkbox" class="checkbox" onClick="javascript: checkAll(this)" value="checkbox"></td>
</tr>
<?php 
echo $memberlist;
?>
<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="审核LOGO" title="审核LOGO图片">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(2);" value="撤消审核" title="撤消LOGO图片审核">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(3);" value="推荐LOGO" title="推荐LOGO图片">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(4);" value="撤消推荐" title="撤消LOGO图片推荐">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(5);" value="审核企业" title="审核企业">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(6);" value="撤消审核" title="撤销企业审核">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(7);" value="推荐名企" title="推荐企业">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(8);" value="撤消名企" title="撤销推荐">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(13);" value="刷新企业" title="刷新企业活动时间">
    <!--<input name="button" type="button" class="inputs" id="button" onClick="confirmX(11);" value="类型">-->
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(12);" value="邮件" title="发送邮件">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(9);" value="修改" title="修改企业信息">
    <input name="button" type="button" class="inputs" id="button" onClick="confirmX(10);" value="删除" title="删除企业信息">
</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("你确定要审核你所选择的LOGO吗？"))	
		{
			document.form2.action="company_searchlist.php?do=logo";
			document.form2.submit();		
		}
	}
	if(num==2)
	{
		if(confirm("你确定要撤销审核你所选择的LOGO吗？"))	
		{
			document.form2.action="company_searchlist.php?do=unlogo";
			document.form2.submit();		
		}
	}
	if(num==3)
	{
		if(confirm("你确定要推荐所选择的公司的LOGO吗？"))	
		{
			document.form2.action="company_searchlist.php?do=cancle";
			document.form2.submit();		
		}
	}
	if(num==4)
	{
		if(confirm("你确定要撤消推荐所选择的公司的LOGO吗？"))	
		{
			document.form2.action="company_searchlist.php?do=uncancle";
			document.form2.submit();		
		}
	}
	if(num==5)
	{
		if(confirm("你确定要审核你所选择的公司吗？"))	
		{
			document.form2.action="company_searchlist.php?do=audit";
			document.form2.submit();		
		}
	}
	if(num==6)
	{
		if(confirm("你确定要撤销审核你所选择的公司吗？"))	
		{
			document.form2.action="company_searchlist.php?do=unaudit";
			document.form2.submit();		
		}
	}
	if(num==7)
	{
		if(confirm("你确定要推荐你所选择的企业为名企吗？"))	
		{
			document.form2.action="company_searchlist.php?do=comm";
			document.form2.submit();		
		}
	}
	if(num==8)
	{
		if(confirm("你确定要撤销推荐你所选择的名企吗？"))	
		{
			document.form2.action="company_searchlist.php?do=uncomm";
			document.form2.submit();		
		}
	}
	if(num==9)
	{
		if(a==1){
			if(confirm("你确定要修改你所选择的公司资料吗？"))	
			{
				document.form2.action="company_searchlist.php?do=edit";
				document.form2.submit();		
			}
		}
		else{
		alert("同一时刻只能选择一个操作对象进行修改!")
		return false;
		}
	}
	if(num==10)
	{
		if(confirm("警告：此操作将会删除该公公司的信息及该公司发布的所有相关信息！\n是否继续本操作？"))	
		{
			document.form2.action="company_searchlist.php?do=del";
			document.form2.submit();		
		}
	}
	if(num==11)
	{
		if(confirm("你确定要修改你所选择的企业类型吗？"))	
		{
			document.form2.action="company_searchlist.php?do=settype";
			document.form2.submit();		
		}
	}
	if(num==12)
	{
		if(confirm("你确定要给选定的企业发送邮件吗？"))	
		{
			document.form2.action="company_searchlist.php?do=sendmail";
			document.form2.submit();		
		}
	}
	if(num==13)
	{
		if(confirm("你确定要刷新选定的企业吗？"))	
		{
			document.form2.action="company_searchlist.php?do=setactive";
			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();?>