好久没碰帝国cms了,这几天突发奇想,做个考试系统。
喜欢帝国cms是因为它的安全性和会员权限系统比较完善,用它做在线考试比较合适。
帝国的评论模块本身就是对文章、新闻内容的反馈,这里只要将文章或者新闻变成试卷,将评论模块变成学生考试信息提交模块就可以了。
1、添加自定义字段:首先是要在文章或者新闻模型中加入试卷标准答案自定义字段,如da1,这个很容易;然后在评论模块的自定义字段中加入学生答案字段。管理评论-》添加自定义字段,如d1t。
2、读取自定义字段:如何读取文章(试卷)中答案的自定义字段:
//专题
$title='';if($r['pubid']<0)
{
$ztr['ztid']=$r['classid'];
$titleurl=sys_ReturnBqZtname($ztr);
$title="<a href='$titleurl' target='_blank'>".$class_zr[$r['classid']]['ztname']."</a>";
$pagefunr=eReturnRewritePlUrl($r['classid'],0,'dozt',0,0,1);
$plurl=$pagefunr['pageurl'];
}
else//信息@从相应的文章表中调用信息
{
if($class_r[$r[classid]][tbname])
{
$index_r=$empire->fetch1("select checked from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_index where id='$r[id]' limit 1");
//返回表
$infotb=ReturnInfoMainTbname($class_r[$r[classid]][tbname],$index_r['checked']);
//构造查询=》
$infor=$empire->fetch1("select isurl,titleurl,classid,id,title,da1 from ".$infotb." where id='$r[id]' limit 1");//添加da1字段
$titleurl=sys_ReturnBqTitleLink($infor);$title="<a href='$titleurl' target='_blank'>".stripSlashes($infor[title])."</a>";
//增加调用da1变量
$da1=stripSlashes($infor[da1]);
}
$pagefunr=eReturnRewritePlUrl($r['classid'],$r['id'],'doinfo',0,0,1);
$plurl=$pagefunr['pageurl'];
}
?>
这样就可以调用文章(试卷)答案da1了;
读取、调用评论的自定义字段d1t:
elseif($show==3)//内容
{
$add.=$and."(saytext like '%".$keyboard."%')";
}
$search.="&keyboard=$keyboard&show=$show";
}
$totalquery="select count(*) as total from {$dbtbpre}enewspl_".$restb.$add;
//构造查询=》
$query="select plid,username,saytime,sayip,id,classid,checked,zcnum,fdnum,userid,isgood,saytext,d1t,
pubid,eipport from {$dbtbpre}enewspl_".$restb.$add; //增加取出答题答案的值d1t等//增加调用变量
$r['saytime']=date('Y-m-d H:i:s',$r['saytime']);
if($r[isgood])
{
$r[saytime]='<font color=red>'.$r[saytime].'</font>';
}
//替换表情
$saytext=RepPltextFace(stripSlashes($r['saytext']));
//增加答题答案字段变量
$d1t=RepPltextFace(stripSlashes($r['d1t']));
$d2t=RepPltextFace(stripSlashes($r['d2t']));
$d3t=RepPltextFace(stripSlashes($r['d3t']));
//调用
</td>
<!--以下添加答题答案-->
<td height="25" valign="top" οndblclick="window.open('<?=$plurl?>');">
<?=$d1t?>
<?=$d2t?>
<?=$d3t?>
3、分数统计
变量$totlescore=0;
if($da1==$d1t){
$totlescore=$totlescor+1;
}
echo $totlescore;
4、后续主观题判分方式,正在折腾中......有思路有i兴趣朋友加我qq:38197367,一起折腾2333333