帝國cms 會員中心2.0

<?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]))."班";}

 ?>
,您共登錄 <?php
$info=$empire->fetch1("select loginnum from phome_enewsmemberadd where userid=$user[userid]");
echo $info[loginnum];
?>次,每次登陸可獎勵2個積分。
 
</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>
 <script type="text/javascript">
            var pageSize = 22;    //每頁顯示的記錄條數
             var curPage=0;        //當前頁
             var lastPage;        //最後頁
             var direct=0;        //方向
            var len;            //總行數
            var page;            //總頁數
            var begin;
            var end;

               
            $(document).ready(function display(){  
                len =$("#mytable tr").length - 1;    // 求這個表的總行數,剔除第一行介紹
                page=len % pageSize==0 ? len/pageSize : Math.floor(len/pageSize)+1;//根據記錄條數,計算頁數
                // alert("page==="+page);
                curPage=1;    // 設置當前爲第一頁
                displayPage(1);//顯示第一頁

                document.getElementById("btn0").innerHTML="當前 " + curPage + "/" + page + " 頁   "    每頁;    // 顯示當前多少頁
                document.getElementById("sjzl").innerHTML="數據總量 " + len + "";         顯示數據量
                document.getElementById("pageSize").value = pageSize;

               

                $("#btn1").click(function firstPage(){    // 首頁
                    curPage=1;
                    direct = 0;
                    displayPage();
                });
                $("#btn2").click(function frontPage(){    // 上一頁
                    direct=-1;
                    displayPage();
                });
                $("#btn3").click(function nextPage(){    // 下一頁
                    direct=1;
                    displayPage();
                });
                $("#btn4").click(function lastPage(){    // 尾頁
                    curPage=page;
                    direct = 0;
                    displayPage();
                });
                $("#btn5").click(function changePage(){    // 轉頁
                    curPage=document.getElementById("changePage").value * 1;
                    if (!/^[1-9]\d*$/.test(curPage)) {
                        alert("請輸入正整數");
                        return ;
                    }
                    if (curPage > page) {
                        alert("超出數據頁面");
                        return ;
                    }
                    direct = 0;
                    displayPage();
                });

               
                $("#pageSizeSet").click(function setPageSize(){    // 設置每頁顯示多少條記錄
                    pageSize = document.getElementById("pageSize").value;    //每頁顯示的記錄條數
                    if (!/^[1-9]\d*$/.test(pageSize)) {
                        alert("請輸入正整數");
                        return ;
                    }
                    len =$("#mytable tr").length - 1;
                    page=len % pageSize==0 ? len/pageSize : Math.floor(len/pageSize)+1;//根據記錄條數,計算頁數
                    curPage=1;        //當前頁
                     direct=0;        //方向
                     firstPage();
                });
            });

            function displayPage(){
                if(curPage <=1 && direct==-1){
                    direct=0;
                    alert("已經是第一頁了");
                    return;
                } else if (curPage >= page && direct==1) {
                    direct=0;
                    alert("已經是最後一頁了");
                    return ;
                }

                lastPage = curPage;

                // 修復當len=1時,curPage計算得0的bug
                if (len > pageSize) {
                    curPage = ((curPage + direct + len) % len);
                } else {
                    curPage = 1;
                }

               
                document.getElementById("btn0").innerHTML="當前 " + curPage + "/" + page + " 頁    每頁 ";        // 顯示當前多少頁

                begin=(curPage-1)*pageSize + 1;// 起始記錄號
                end = begin + 1*pageSize - 1;    // 末尾記錄號

               
                if(end > len ) end=len;
                $("#mytable tr").hide();    // 首先,設置這行爲隱藏
                $("#mytable tr").each(function(i){    // 然後,通過條件判斷決定本行是否恢復顯示
                    if((i>=begin && i<=end) || i==0 )//顯示begin<=x<=end的記錄
                        $(this).show();
                });

             }
    </script>
<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:scroll; height:500px;' 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.mistakes,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  d.newstime desc,c.saytime desc ");    //將會員表和自定義字段會員表連表查詢喫userid相同且班級字段msn=1的會員列出

?>
<a id="btn0"></a>
<input id="pageSize" type="text" size="1" maxlength="2" value="getDefaultValue()"/><a> 條 </a> <a href="#" id="pageSizeSet">設置</a> 
<a id="sjzl"></a> 
<a  href="#" id="btn1">首頁</a>
<a  href="#" id="btn2">上一頁</a>
<a  href="#" id="btn3">下一頁</a>
<a  href="#" id="btn4">尾頁</a> 
<a>轉到 </a>
<input id="changePage" type="text" size="1" maxlength="4"/>
<a>頁 </a>
<a  href="#" id="btn5">跳轉</a>
<table    id="mytable" 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-H:m',$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']." 分,本次練習";
if($r['zongfen']/$r['Exnum']>=0.9){
echo "<span style='color:red;'><strong>優秀,太棒了!</strong></span>";
}else if($r['zongfen']/$r['Exnum']>=0.85&&$r['zongfen']/$r['Exnum']<0.9){
echo "<span style='color:red;'><strong>良好,錯題好好訂正。</strong></span>";
}else if($r['zongfen']/$r['Exnum']<=0.85&&$r['zongfen']/$r['Exnum']>0.6){
echo "<span style='color:red;'><strong>不太好,要認真訂正。</strong></span>";
}else if($r['zongfen']/$r['Exnum']<=0.6){
echo "<span style='color:red;'><strong>不合格,請訂正後再次練習!</strong></span>";
};
 echo"</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 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; ' 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.mistakes,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  d.newstime desc,c.saytime desc ");    //將會員表和自定義字段會員表連表查詢喫userid相同且班級字段msn=1的會員列出

?>

教師板塊

<?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>";
 
 
?>

   
 
<?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 "學生新板塊";
}
}
?>
 
<!--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 5");
  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 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個文章循環開始 -->
 
待開發板塊
 

 
<!--8個文章循環結束-->
 
</div>
 
</div>
</div>





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

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章