<?php
/**
 * 金戈企业建站系统：管理后台所需要的HTML信息，比如表单之类的
 *
 *
 * @name 
 * @author 烟鬼 QQ:460874 Email:460874@qq.com
 * @version 0.1  $id  roothtml.php
 * @copyright Copyright (c) 2007 - 2008 烟鬼
 */

//conter.php页的HTML页头，因为TOP LEFT只有一页所以就不添加了
function rootheader()
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<link href="css/isadmin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
}

//conter.php页的页脚
function rootfooter()
{
?>
</body>
</html>
<?php
}

//基本设置的表单，如果有内容就进入更新状态.没有就添加
function display_shezhi_form($shezhi = '')
{
	$edit = is_array($shezhi);
?>
		<form method='post'
        action="<?php echo $edit?'center.php?action=up':'center.php?action=in';?>">
  		<table border=0>
  		
  		<tr>
		<td>网站名称:</td>
    	<td><input type='text' name='title' 
		value="<?php echo $edit?$shezhi['w_title']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>版权信息:</td>
		<td><input type='text' name='cop' 
		value="<?php echo $edit?$shezhi['w_cop']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>管理员QQ:</td>
		<td><input type='text' name='qq' maxlength="12"
		value="<?php echo $edit?$shezhi['w_qq']:''; ?>"> 必须为数字长度小于15位</td>
		</tr>
		
		<tr>
		<td>ICP备案:</td>
		<td><input type='text' name='icp' 
		value="<?php echo $edit?$shezhi['w_icp']:'未申请请勿修改'; ?>"></td>
		</tr>
		
		<tr>
		<td>ICP链接:</td>
		<td><input type='text' name='icpurl' 
		value="<?php echo $edit?$shezhi['w_icpurl']:'未申请请勿修改'; ?>"></td>
		</tr>
		
		<tr>
		<td>管理员Email:</td>
		<td><input type='text' name='mail' 
		value="<?php echo $edit?$shezhi['w_mail']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>网站关键字:</td>
		<td><input type='text' name='keywords' 
		value="<?php echo $edit?$shezhi['w_keywords']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>网站介绍:</td>
		<td><input type='text' name='description' 
		value="<?php echo $edit?$shezhi['w_description']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>邮政编码:</td>
		<td><input type='text' name='yb' maxlength="6"
		value="<?php echo $edit?$shezhi['w_yb']:''; ?>"> 必须为数字长度等于6位</td>
		</tr>
		
		<tr>
		<td>公司电话:</td>
		<td><input type='text' name='tel' 
		value="<?php echo $edit?$shezhi['w_tel']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>公司传真:</td>
		<td><input type='text' name='cstel' 
		value="<?php echo $edit?$shezhi['w_cstel']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>公司地址:</td>
		<td><input type='text' name='dz' 
		value="<?php echo $edit?$shezhi['w_dz']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>每页显示新闻:</td>
		<td><input type='text' name='news' maxlength="5"
		value="<?php echo $edit?$shezhi['w_news']:''; ?>">企业新闻每页显示条数*必须为数字</td>
		</tr>
		
		<tr>
		<td>每页显示产品:</td>
		<td><input type='text' name='chanpin' maxlength="5"
		value="<?php echo $edit?$shezhi['w_chanpin']:''; ?>">产品展示每页显示条数*必须为数字</td>
		</tr>
		
		<tr>
		<td>每页显示留言:</td>
		<td><input type='text' name='lyb' maxlength="5"
		value="<?php echo $edit?$shezhi['w_lyb']:''; ?>">每页显示留言数*必须为数字</td>
		</tr>
		
		<tr>
		<td>每页显示荣誉:</td>
		<td><input type='text' name='ry' maxlength="5"
		value="<?php echo $edit?$shezhi['w_ry']:''; ?>">每页显示企业荣誉数*必须为数字</td>
		</tr>
		
		<tr>
		<td>每页显示风采:</td>
		<td><input type='text' name='fc' maxlength="5"
		value="<?php echo $edit?$shezhi['w_fc']:''; ?>">企业风采每页显示条数*必须为数字</td>
		</tr>
		
		<tr>
		<td>每页显示招聘:</td>
		<td><input type='text' name='job' maxlength="5"
		value="<?php echo $edit?$shezhi['w_job']:''; ?>">企业招聘每页显示条数*必须为数字</td>
		</tr>
		
		<tr>
		<td>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?>基本设置">
		</td>
		</tr>
		</table>
		</form>
<?php
}

/**
 * 所有单页栏目的表单函数，比如经理致辞、企业文化等等。这个函数需要3个参数
 * 第一个参数为原始值，既数据库中的值。如果该变量有值，这个函数会将表单引入
 * 更新状态，如果没有值，就进入添加状态。$in,$up当然一个是添加地址，一个是
 * 更新地址了
 */
function danye($info = '')
{
	$edit = is_array($info);
?>
		<form method='POST'
        action="<?php echo $edit?'center.php?action=iup':'center.php?action=iin';?>">
  		<table border=0>
  		
  		<tr>
  		<td>经理致辞:</td>
		<td><textarea name="jingli" cols="40" rows="6"><?php echo $edit?$info['d_jingli']:''; ?></textarea></td>
		</tr>
		
		<tr>
  		<td>企业文化:</td>
		<td><textarea name="wenhua" cols="40" rows="6"><?php echo $edit?$info['d_wenhua']:''; ?></textarea></td>
		</tr>
		
		<tr>
  		<td>发展目标:</td>
		<td><textarea name="mubiao" cols="40" rows="6"><?php echo $edit?$info['d_mubiao']:''; ?></textarea></td>
		</tr>
		
		<tr>
		<td>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?> 内容">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//添加新闻分类的表单函数
function nc_form()
{
?>
		<form method='POST'
        action="rootnews.php?action=innc">
  		<table border=0>
  		
  		<tr>
		<td>添加新闻分类:</td>
		<td><input type='text' name='innc' 
		value=""></td>
		</tr>
		
		<tr>
		<td>
		<input type='submit'
		value="添加分类">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//更新新闻分类的表单函数
function upnc($info)
{
?>
		<form method='POST'
        action="rootnews.php?action=inncs">
  		<table border=0>
  		
  		<tr>
		<td>编辑新闻分类:</td>
		<td><input type='text' name='upncs' 
		value="<?php echo $info['n_c_name'] ?>">
		<input type="hidden" name="upncid" value="<?php echo $info['n_c_id'] ?>" /></td>
		</tr>
		
		<tr>
		<td>
		<input type='submit'
		value="更新分类">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//新闻的表单，如果有内容就进入编辑状态，没有内容就进入添加状态。
function display_news_form($upnews = '')
{
	$edit = is_array($upnews);
?>
		<form method='post' width="800"
        action="<?php echo $edit?'rootnews.php?action=upnews':'rootnews.php?action=innews';?>">
  		<table border=0>
  		
  		<tr>
		<td>新闻标题:</td>
    	<td><input type='text' name='title' size="50"
		value="<?php echo $edit?stripslashes($upnews['n_n_title']):''; ?>"></td>
		</tr>
		
		<tr>
		<td>新闻来源:</td>
		<td><input type='text' name='cop' size="50"
		value="<?php echo $edit?stripslashes($upnews['n_n_newly']):'本站'; ?>"></td>
		</tr>
		
		<tr>
     	<td>文章分类:</td>
      	<td><select name='cid'>
      	<?php
        $c_array=root_all(new_class);
        if ($c_array) 
        {
        	$c_array = setarray($c_array);
        	foreach ($c_array as $thiscat)
        	{
        		echo '<option value="';
            	echo $thiscat['n_c_id'];
            	echo '"';
            	if ($edit && $thiscat['n_c_id'] == $upnews['n_n_cid'])
            	echo ' selected';
	            echo '>'; 
            	echo $thiscat['n_c_name'];
            	echo "\n"; 
        	}
        }
        else 
        {
  			echo '<select name="select">';
    		echo '<option  value="no" >没有分类</option>';
  			echo '</select>';
        }
        ?>
        </select>
        </td>
   		</tr>
   
		<tr>
		<td>新闻内容</td><td>
		<?php
		require("../fckeditor/fckeditor.php");
		//初始化FCKeditor的相关信息
		$FCKeditor=new FCKeditor("wztxt");        //创建FCKeditor对象的实例 
		$FCKeditor->BasePath="../fckeditor/";  //FCKeditor所在的位置，这里它的位置就是"FCKeditor/"; 
		$FCkeditor->ToolbarSet="Default";           //工具按钮设置 
		$FCKeditor->Width="100%";                   //设置它的宽度 
		$FCKeditor->Height="400";                 //设置它的高度 
		//$FCKeditor->Create();                  //在需要使用的地方插入
		if($edit)
     	{
     	$FCKeditor-> Value = stripslashes(nl2br($upnews['n_n_news']));
        $FCKeditor->Create();
    	}
    	else 
     	{
     	$FCKeditor->Create();
     	}
		?>
		</td>
		</td>
		</tr>
		
		<tr><td></td>
		<td>
		<?php
		if ($edit) 
		{
		    echo  '<input type="hidden" name="nid" value="'.$upnews['n_n_id'].'" />';
		}
		?>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?> 新闻">
		</td>
		</tr>
		</table>
		</form>	
<?php
}

//企业简介的表单，如果有内容进入编辑，没有内容则进入添加状态
function display_qyjj_form($qyjj = '')
{
	$edit = is_array($qyjj);
?>
		<form enctype="multipart/form-data" action="<?php echo $edit?'rootqyjj.php?action=upqyjj':'rootqyjj.php?action=inqyjj';?>" method=post>
  		<input type="hidden" name="MAX_FILE_SIZE" value="1000000">简介衬托图片：
  		<input name="userfile" type="file">*目前只支持JPG格式的图片
  		<br /><br />
  		<table border=0 width="450">
  		
		<?php
		require("../fckeditor/fckeditor.php");
		//初始化FCKeditor的相关信息
		$FCKeditor=new FCKeditor("qyjj");        //创建FCKeditor对象的实例 
		$FCKeditor->BasePath="../fckeditor/";  //FCKeditor所在的位置，这里它的位置就是"FCKeditor/"; 
		$FCkeditor->ToolbarSet="Default";           //工具按钮设置 
		$FCKeditor->Width="100%";                   //设置它的宽度 
		$FCKeditor->Height="400";                 //设置它的高度
		if($edit)
     	{
     	$FCKeditor-> Value = stripslashes(nl2br($qyjj['jj_nr']));
        $FCKeditor->Create();
    	}
    	else 
     	{
     	$FCKeditor->Create();
     	}
     	if ($edit) 
		{
		    echo  '<input type="hidden" name="nid" value="'.$qyjj['jj_id'].'" />';
		}
		?>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?> 简介">
		</table>
		</form>
<?php
}

//企业荣誉表单函数
function display_qyry_form($qyry = '')
{
	$edit = is_array($qyry);
?>
		<form enctype="multipart/form-data" action="<?php echo $edit?'rootry.php?action=upqyry':'rootry.php?action=inqyry';?>" method=post>
  		<input type="hidden" name="MAX_FILE_SIZE" value="1000000">企业荣誉图片：
  		<input name="userfile" type="file">*目前只支持JPG格式的图片
  		<br /><br />
  		<table border=0 width="450">
  		
  		<tr>
		<td>企业荣誉标题:</td>
		<td><input type='text' name='title' 
		value="<?php echo $edit?$qyry['ry_title']:''; ?>"></td>
		</tr>
		
		<tr>
  		<td>企业荣誉说明:</td>
		<td><textarea name="js" cols="40" rows="6"><?php echo $edit?$qyry['ry_js']:''; ?></textarea></td>
		</tr>
		
		<tr>
		<td>
		<?php
		if ($edit) 
		{
		     echo  '<input type="hidden" name="ryid" value="'.$qyry['ry_id'].'" />';
		}
		?>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?> 荣誉">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//企业荣誉表单函数
function display_qyfc_form($qyfc = '')
{
	$edit = is_array($qyfc);
?>
		<form enctype="multipart/form-data" action="<?php echo $edit?'rootfc.php?action=upqyfc':'rootfc.php?action=inqyfc';?>" method=post>
  		<input type="hidden" name="MAX_FILE_SIZE" value="1000000">企业风采图片：
  		<input name="userfile" type="file">*目前只支持JPG格式的图片
  		<br /><br />
  		<table border=0 width="450">
  		
  		<tr>
		<td>企业风采标题:</td>
		<td><input type='text' name='title' 
		value="<?php echo $edit?$qyfc['fc_title']:''; ?>"></td>
		</tr>
		
		<tr>
  		<td>企业风采说明:</td>
		<td><textarea name="sm" cols="40" rows="6"><?php echo $edit?$qyfc['fc_sm']:''; ?></textarea></td>
		</tr>
		
		<tr>
		<td>
		<?php
		if ($edit) 
		{
		     echo  '<input type="hidden" name="fcid" value="'.$qyfc['fc_id'].'" />';
		}
		?>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?> 风采">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//添加与编辑产品分类的表单函数
function cpclass_form($cpclass = '')
{
	$edit = is_array($cpclass);
?>
		<form method='POST'
        action="<?php echo $edit?'rootcp.php?action=upcpclass':'rootcp.php?action=incpclass' ?>">
  		<table border=0>
  		
  		<tr>
		<td><?php echo $edit?'更新':'添加'; ?>产品分类:</td>
		<td><input type='text' name='cpclass' 
		value="<?php echo $edit?$cpclass['cp_c_name']:'' ?>"></td>
		</tr>
		<?php
		if ($cpclass) 
		{
		     echo  '<input type="hidden" name="cid" value="'.$cpclass['cp_c_id'].'" />';
		}
		?>
		<tr>
		<td>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加' ?>产品分类">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//添加或编辑产品的表单
function display_chanpin_form($chanpin = '')
{
	$edit = is_array($chanpin);
?>
<form enctype="multipart/form-data" action="<?php echo $edit?'rootcp.php?action=upchanpin':'rootcp.php?action=incp';?>" method=post>
  		<input type="hidden" name="MAX_FILE_SIZE" value="1000000">产品图片：
  		<input name="userfile" type="file">*目前只支持JPG格式的图片
  		<br /><br />
  		<table border=0 width="450">
  		
  		<tr>
		<td>产品名称:</td>
		<td><input type='text' name='cpname' 
		value="<?php echo $edit?$chanpin['cp_name']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>产品型号:</td>
		<td><input type='text' name='cpxh' 
		value="<?php echo $edit?$chanpin['cp_xh']:''; ?>"></td>
		</tr>
		
		<tr>
     	<td>产品分类:</td>
      	<td><select name='cid'>
      	<?php
        $c_array=root_all(cp_class);
        if ($c_array) 
        {
        	$c_array = setarray($c_array);
        	foreach ($c_array as $thiscat)
        	{
        		echo '<option value="';
            	echo $thiscat['cp_c_id'];
            	echo '"';
            	if ($edit && $thiscat['cp_c_id'] == $chanpin['cp_c_id'])
            	echo ' selected';
	            echo '>'; 
            	echo $thiscat['cp_c_name'];
            	echo "\n"; 
        	}
        }
        else 
        {
  			echo '<select name="select">';
    		echo '<option  value="no" >没有分类</option>';
  			echo '</select>';
        }
        ?>
        </select>
        </td>
   		</tr>
   		
   		<tr>
     	<td>主页推荐:</td>
      	<td>
      	<select name='cpkz'>
      	<?php
      	if ($chanpin['cp_kz'] == 1) 
      	{
      	    echo  '<option value="yes">是</option>';
      	    echo  '<option value="no">否</option>';
      	}
      	else 
      	{
      		echo  '<option value="no">否</option>';
      		echo  '<option value="yes">是</option>';
      	}
    	?>
        </select>
        </td>
   		</tr>
   		
		<tr>
  		<td>产品说明:</td>
		<td><textarea name="sm" cols="40" rows="6"><?php echo $edit?$chanpin['cp_sm']:''; ?></textarea></td>
		</tr>
		
		<tr>
		<td>
		<?php
		if ($edit) 
		{
		     echo  '<input type="hidden" name="cpid" value="'.$chanpin['cp_id'].'" />';
		}
		?>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?> 产品">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//后台查看管理员留言的相关html信息
function mstbook($title,$time,$name,$ip,$email,$nr,$id)
{
?>
			<table width="480" border="0" cellspacing="0" cellpadding="0" id="table">
  			<tr>
    		<th colspan="2" scope="col" id="thead">
    		<input type=checkbox id="che" name="del_me[]" value="<?php echo $id ?>">
    		标题：<?php echo $title ?></th>
  			</tr>
  			<tr>
    		<td class="ttl">留言者：<?php echo $name ?></td>
    		<td class="ttl">留言时间：<?php echo $time ?></td>
  			</tr>
  			<tr>
   			<td class="ttl">留言者IP：<?php echo $ip ?></td>
    		<td class="ttl">留言者Email:<?php echo $email ?></td>
  			</tr>
  			<tr>
    		<td colspan="2" class="tbl">留言内容：<?php echo $nr ?><br /></td>
  			</tr>
			</table>
<?php
}

//留言本：回复与管理回复的表单
function hfb($info = '')
{
	$edit = is_array($info);
?>
		<form method='POST'
        action="<?php echo $edit?'rootbook.php?action=uphf':'rootbook.php?action=inhf';?>">
  		<table border=0>
  		
		<tr>
  		<td>回复内容:</td>
		<td><textarea name="hfnr" cols="40" rows="6"><?php echo $edit?$info['hf_nr']:''; ?></textarea></td>
		</tr>
		<?php
		if ($edit) 
		{
		     echo  '<input type="hidden" name="hfid" value="'.$info['hf_id'].'" />';
		}
		?>
		<tr>
		<td>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?> 回复">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//添加回复的表单
function hfbs($id)
{
?>
		<form method='POST'
        action="rootbook.php?action=inhf">
  		<table border=0>
  		
		<tr>
  		<td>回复内容:</td>
		<td><textarea name="hfnr" cols="40" rows="6"></textarea></td>
		</tr>
		<tr>
		<td>
		<input type="hidden" name="hfid" value="<?php echo $id ?>" />
		<input type='submit'
		value="回 复">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//添加或编辑招聘信息的表单
function display_job_form($job = '')
{
	$edit = is_array($job);
?>
		<form method='post'
        action="<?php echo $edit?'rootzp.php?action=upjob':'rootzp.php?action=injob';?>">
  		<table border=0>
  		
  		<tr>
		<td>招聘职位:</td>
    	<td><input type='text' name='title' 
		value="<?php echo $edit?$job['j_title']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>学历要求:</td>
		<td><input type='text' name='xueli' 
		value="<?php echo $edit?$job['j_xueli']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>工作地点:</td>
		<td><input type='text' name='didian' 
		value="<?php echo $edit?$job['j_didian']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>工作年限:</td>
		<td><input type='text' name='gztime' 
		value="<?php echo $edit?$job['j_gztime']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>招聘人数:</td>
		<td><input type='text' name='jobren' 
		value="<?php echo $edit?$job['j_jobren']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>外语水平:</td>
		<td><input type='text' name='waiyu' 
		value="<?php echo $edit?$job['j_waiyu']:''; ?>"></td>
		</tr>
		
		<tr>
		<td>联系人:</td>
		<td><input type='text' name='lianxi' 
		value="<?php echo $edit?$job['j_lianxi']:''; ?>"></td>
		</tr>
		
		<tr>
  		<td>职位描述:</td>
		<td><textarea name="miaosu" cols="30" rows="6"><?php echo $edit?$job['j_miaosu']:''; ?></textarea></td>
		</tr>
		<?php
		if ($edit) 
		{
		     echo  '<input type="hidden" name="jid" value="'.$job['j_id'].'" />';
		}
		?>
		<tr>
		<td>
		<input type='submit'
		value="<?php echo $edit?'更新':'添加'; ?> 招聘">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//修改管理员密码的表单
function display_rootpass_form()
{
?>
		<form method='post'
        action="rootmst.php?action=uppass">
  		<table border=0>
  		
  		<tr>
		<td>旧密码:</td>
    	<td><input type='password' name='opass'></td>
		</tr>
		
		<tr>
		<td>新密码:</td>
    	<td><input type='password' name='npass'></td>
		</tr>
		
		<tr>
		<td>确认新密码:</td>
    	<td><input type='password' name='npass2'></td>
		</tr>
		
		<tr>
		<td>
		<input type='submit'
		value="确 定">
		</td>
		</tr>
		</table>
		</form>
<?php
}

//添加管理员表单
function display_root_form()
{
?>
		<form method='post'
        action="rootmst.php?action=inroot">
  		<table border=0>
  		
  		<tr>
		<td>用户名:</td>
    	<td><input type='text' name='user'></td>
		</tr>
		
		<tr>
		<td>密码:</td>
    	<td><input type='password' name='npass'></td>
		</tr>
		
		<tr>
		<td>确认:</td>
    	<td><input type='password' name='npass2'></td>
		</tr>
		
		<tr>
		<td>
		<input type='submit'
		value="确 定">
		</td>
		</tr>
		</table>
		</form>
<?php
}
?>