[php]代码库
<?php
/**
*author:qds
*data:2011-7-28
*功能描述:后台页面的展示
*/
class Index {
/*
*frame框架调用所用。主页模板
*
* */
function index(){
$this->display();
}
/*
*frame框架头部调用所用。
*不显示debug调试模式
* */
function top(){
$GLOBALS["debug"]=0;
$this->display();
}
/*
*frame框架左侧调用所用 menu菜单。
*不显示debug调试模式
* */
function left(){
$GLOBALS["debug"]=0;
//($_SESSION);
switch ($_SESSION['user']['limit']){
case 1:
$this->display('index/adminleft');
break;
case 2:
$this->display('index/tealeft');
break;
case 3:
$this->display('index/stuleft');
break;
}
}
/*
*frame框架右侧侧调用所用 所有的显示部分都在此显示。
*$notice 为公告显示
*$randp 为奖惩信息的显示
* */
function right(){
//p($_SESSION);
//调用公告表 提取最新10条信息
$notice=D('notice');
$noticedate=$notice->order('addtime desc')->limit(10)->select();
$notic='<ul>';
foreach($noticedate as $v){
$notic.='<li>';
$notic.='['.substr($v['addtime'],0,10);
$notic.='] <a href="'.$GLOBALS['app'].'notice_manage/info/nid/'.$v['nid'].'">'.$v['title'].'</a>';
$notic.='</li>';
}
$notic.='</ul>';
//调用奖惩表 提取最新十条信息
$randp=D('randp');
$randpdate=$randp->order('rptime desc')->limit(10)->select();
$rpinfo='<ul>';
foreach($randpdate as $v){
$rpinfo.='<li>';
$rpinfo.='['.$v['rptime'];
switch($v['type']){
case 1:
$rpinfo.='] <a href="'.$GLOBALS['app'].'randp_manage/info/rpid/'.$v['rpid'].'/type/1">'.mb_substr($v['rpcontent'],0,20,"UTF8").'...</a>';
break;
case 2:
$rpinfo.='] <a href="'.$GLOBALS['app'].'randp_manage/info/rpid/'.$v['rpid'].'/type/2">'.mb_substr($v['rpcontent'],0,20,"UTF8").'...</a>';
break;
}
$rpinfo.='</li>';
}
$rpinfo.='</ul>';
//个人信息
$sex=$_SESSION['user']['ssex']?'男':'女';
switch($_SESSION['user']['limit']){
case 1:
$user = '<ul>';
$user .='<li>管理员:'.$_SESSION['user']['name'].'</li>';
$user .= '</ul>';
break;
case 2:
$ct = D('classtype');
$row = $ct->where(array('id'=>$_SESSION['user']['blg_series']))->find();
$user = '<ul>';
$user .='<li>老师:'.$_SESSION['user']['name'].'</li>';
$user .='<li>性别:'.$sex.'</li>';
$user .='<li>系别:'.$row['title'].'</li>';
$user .='<li>毕业院校:'.$_SESSION['user']['grad_school'].'</li>';
$user .='<li>籍贯:'.$_SESSION['user']['native'].'</li>';
$user .= '</ul>';
break;
case 3:
$ct = D('classtype');
$row = $ct->where(array($_SESSION['user']['series'],$_SESSION['user']['specialty'],$_SESSION['user']['class']))->select();
$user = '<ul>';
$user .='<li>学生:'.$_SESSION['user']['name'].'</li>';
$user .='<li>性别:'.$sex.'</li>';
$user .='<li>系别:'.$row['0']['title'].'</li>';
$user .='<li>专业:'.$row['1']['title'].'</li>';
$user .='<li>班级:'.$row['2']['title'].'</li>';
$user .= '</ul>';
break;
}
$this->assign('user',$user);
$this->assign('randp',$rpinfo);
$this->assign('notic',$notic);
$this->display();
}
}
[源代码打包下载]