<?php
if(!defined('InEmpireCMS'))
{
exit();
}
?>
<?php
$public_diyr['pagetitle']='会员中心';
$url="<a href=../../../>首页</a>&nbsp;>&nbsp;<a href=../cp/>会员中心</a>";
require(ECMS_PATH.'e/template/incfile/header.php');
?>
<div class="app-content-body ">
<div class="bg-light lter b-b wrapper-md">
<h1 class="m-n font-thin h3">会员中心</h1>

<small class="text-muted">欢迎你 <?=$user[username]?>
(<?=$level_r[$r[groupid]][groupname]?>)
<!--班级<?=$ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tmsn]))?>-->
<?php

if($tmgetgroupid==3){echo $ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tcompany]));echo $ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tgrade]))."年级";echo $ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tmsn]))."班";}elseif($tmgetgroupid==1){echo $ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[company]));echo $ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[grade]))."年级";echo $ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[msn]))."班";}

?>


</small>

</div>
<div class="wrapper-md">
<div class="row">
<div class="col-md-12">
<div class="row row-sm text-center">
<div class="col-lg-3 col-md-6">
<a class="block panel padder-v item">
<div class="h1 text-info font-thin h1"><?=$level_r[$r[groupid]][groupname]?></div>
<span class="text-muted text-xs">当前用户组</span>
</a>
</div>
<div class="col-lg-3 col-md-6">
<a class="block panel padder-v bg-primary item" href="<?=$public_r['newsurl']?>e/member/my/">
<span class="text-white font-thin h1 block"><?=$r[money]?>元</span>
<span class="text-muted text-xs">余额</span>
</a>
</div>
<div class="col-lg-3 col-md-6">
<a class="block panel padder-v bg-info item" href="<?=$public_r['newsurl']?>e/member/my/">
<span class="text-white font-thin h1 block"><?=$r[userfen]?>
点</span>
<span class="text-muted text-xs">点数</span>
</a>
</div>
<div class="col-lg-3 col-md-6">
<a class="block panel padder-v item" href="<?=$public_r['newsurl']?>e/ShopSys/ListDd/">
<div class="font-thin h1">我的订单</div>
<span class="text-muted text-xs">充值</span>
</a>
</div>
</div>
</div>
</div>

<div class="row">
<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-list fa-fw"></i>

<?php if($tmgetgroupid==3){echo"学生练习";}elseif($tmgetgroupid==1){echo"我的练习";} ?>

</h3>
</div>
<div class="panel-body">

<div style=' overflow-y:auto; height:1000px;' class="list-group">
<!--8个公告循环开始 -->




<?php
//以下是应用程序,取出教师任课班级tmsn数组并处理,学生所在班级msn,匹配后查询出老师所教授班级和学生
if($tmgetgroupid==3){
$sql=$empire->query( "select a.userid,a.username,b.userid,b.msn,b.grade,b.company,b.tgrade,b.tcompany,b.truename,b.tmsn,c.userid,c.username,c.classid,c.id,c.zongfen,c.saytime,d.id,d.classid,d.title,d.titleurl from {$dbtbpre}enewsmember as a,{$dbtbpre}enewsmemberadd as b ,{$dbtbpre}enewspl_1 as c ,{$dbtbpre}ecms_news as d where a.userid=b.userid&&a.userid=c.userid &&a.checked=1&&c.id=d.id && a.groupid=1 order by b.msn asc,d.newstime desc,a.username desc "); //将会员表和自定义字段会员表连表查询吃userid相同且班级字段msn=1的会员列出

?>

<table style="width:100%;text-align:center; overflow-y:auto; height:100px;" border="1px doted black">
<tr style="text-align:center">
<th style="text-align:center">练习题</th>
<th style="text-align:center">班级</th>
<th style="text-align:center">学生</th>
<th style="text-align:center">得分</th>
<th style="text-align:center">练习时间</th>
</tr>

<?php

$tcompany=$ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tcompany]));
$tgrade=$ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tgrade]));
$tmsn=$ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tmsn]));
$tclass=explode("|",$tmsn);

while ( $r = $empire ->fetch( $sql )){


//echo $ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tcompany]));
//echo $ecmsfirstpost==1?"":htmlspecialchars(stripSlashes($addr[tmsn])); //打印出当前用户的tmsn教师任课班级数据 以1|4|形式出现

if($tcompany==$r[company]&&$tgrade==$r[grade]&&in_array($r[msn], $tclass) ){ //判断学生班级号存在与当前教师用户所教授班级的数组tclas中
//echo $r[company];
//echo $r[username]."--";
//echo $r[title]."--得分";
//echo $r[zongfen]."--答题时间";
//echo date('Y-m-d',$r[saytime])."</br>";


?>

<tr>
<td><?= $r[title] ?></td>
<td><?= $r [msn] ?></td>
<td><?= $r [username] ?></td>
<td><?= $r[zongfen] ?></td>
<td><?= date('m-d',$r[saytime]) ?></td>

</tr>


<?php


};
}
?>

</table>
<?php
}elseif($tmgetgroupid==1){
$sql=$empire->query("select A.id,A.saytime,A.zongfen,A.mistakes,A.jiexi,B.Exnum,B.title,B.titleurl from {$dbtbpre}enewspl_1 as A, {$dbtbpre}ecms_news as B where A.id=B.id && A.userid=$user[userid] order by A.saytime desc limit 10"); //查询评论
while($r=$empire->fetch($sql)) //循环获取查询记录
{
echo "
<li style=' overflow-y:auto; height:100px;line-height:31px;text-indent:10px;border-top:1px solid #eee;font-size:16px;'><a target=_blank href=".$r['titleurl']."> ".$r['title']." <br/>

&nbsp;&nbsp;&nbsp;&nbsp; 共: ".$r['Exnum']." 题,你得到了: ".$r['zongfen']." 分<br/>
&nbsp;&nbsp;&nbsp;&nbsp; 错题:".$r['mistakes']."&nbsp;&nbsp;&nbsp;&nbsp;<br/>
&nbsp;&nbsp;&nbsp;&nbsp; 答题时间: ".date('Y-m-d',$r[saytime])." </a></li>";
}
}
?>

<!--8个公告循环结束-->
</div>
</div>
</div>
</div>


<div class="col-lg-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-list fa-fw"></i> 最新练习</h3>
</div>
<div class="panel-body">
<div class="list-group">
<!--8个文章循环开始 -->

<?php

$infosql=$empire->query("select * from phome_ecms_news order by newstime desc limit 10");
while($info=$empire->fetch($infosql)){
echo"<li style=' list-style-type:none; height:100px;line-height:31px;text-indent:10px;border-top:1px solid #eee;font-size:16px;'><a target=_blank href='"."$info[titleurl]"."'> "."$info[title]"."  <br/> &nbsp;&nbsp;&nbsp;&nbsp; 共: "."$info[Exnum]"." 题,&nbsp;&nbsp;&nbsp;&nbsp; 更新时间:".date('Y-m-d',$info[newstime])."</a></li>";

};


?>

<!--8个文章循环结束-->

</div>

</div>
</div>
</div>

</div>
<!-- /.row -->

</div>



</div>



<?php
require(ECMS_PATH.'e/template/incfile/footer.php');
?>