<?php
/**
 * 金戈企业建站系统：企业招聘管理页面
 *
 *
 * @name 
 * @author 烟鬼 QQ:460874 Email:460874@qq.com
 * @version 0.1  $id  rootzp.php
 * @copyright Copyright (c) 2007 - 2008 烟鬼
 */
session_start();
require('../config.php');
require('rootfun/roothtml.php');
require('rootfun/rootfun.php');

//判断是否是管理员，该函数在myfun.php 中定义
if(!check_root())
	{
		echo '<meta http-equiv="Refresh" content="0; url=../error.php?error=nono" >';
		exit;
	}

//插入页头
rootheader();
?>
<div id="rootmain">
<?php
$action = $_GET['action'];

//招聘管理
if ($action == 'rootzp') 
{
     sejob();
}

//添加招聘
if ($action == 'rootinzp') 
{
     display_job_form();
}

//编辑招聘信息
if ($action == 'endjob') 
{
     $jid = trim($_GET['jid']);
     $endjob = endjob($jid);
     if ($endjob) 
     {
          display_job_form($endjob);
     }
     else 
     {
     	echo '没有招聘信息....--<a href='.$_SERVER['HTTP_REFERER'].'>返 回</a>';
          exit;
     }
}

//删除指定的招聘信息
if ($action == 'deljob') 
{
     $del = $_POST['del_me'];
     if (count($del) > 0) 
     {
          foreach ($del as $nid)
          {
          	if (deljob($nid)) 
          	     echo '删除成功....';
          	else 
          		echo '删除失败...';
          }
     }
     else 
     {
     	echo '您还没有选择需要删除的新闻';
     }
}

//更新招聘信息
if ($action == 'upjob') 
{
     $title = my_yz($_POST['title']);
     $xueli = my_yz($_POST['xueli']);
     $didian = my_yz($_POST['didian']);
     $gztime = my_yz($_POST['gztime']);
     $jobren = my_yz($_POST['jobren']);
     $waiyu = my_yz($_POST['waiyu']);
     $lianxi = my_yz($_POST['lianxi']);
     $jid = trim($_POST['jid']);
     $miaosu = htmlspecialchars($_POST['miaosu']);
     if (!get_magic_quotes_gpc()) 
		{
		     $miaosu = addslashes($miaosu);
		}
	
	//
	if (upjob($title,$xueli,$didian,$gztime,$jobren,$waiyu,$lianxi,$miaosu,$jid)) 
	{
	     echo '更新成功--<a href='.$_SERVER['HTTP_REFERER'].'>返 回</a>';
	}
	else 
	{
		echo '更新失败--<a href='.$_SERVER['HTTP_REFERER'].'>返 回</a>';
	}
}

//添加招聘信息
if ($action == 'injob') 
{
     $title = my_yz($_POST['title']);
     $xueli = my_yz($_POST['xueli']);
     $didian = my_yz($_POST['didian']);
     $gztime = my_yz($_POST['gztime']);
     $jobren = my_yz($_POST['jobren']);
     $waiyu = my_yz($_POST['waiyu']);
     $lianxi = my_yz($_POST['lianxi']);
     $miaosu = htmlspecialchars($_POST['miaosu']);
     if (!get_magic_quotes_gpc()) 
		{
		     $miaosu = addslashes($miaosu);
		}
	
	//
	if (injob($title,$xueli,$didian,$gztime,$jobren,$waiyu,$lianxi,$miaosu)) 
	{
	     echo '已经添加招聘信息--<a href='.$_SERVER['HTTP_REFERER'].'>返 回</a>';
	}
	else 
	{
		echo '添加失败--<a href='.$_SERVER['HTTP_REFERER'].'>返 回</a>';
	}
}
?>
</div>
<?php
//插入页脚
rootfooter();
?>