Ejemplo n.º 1
0
 public function index()
 {
     $this->checklogin();
     //检查是否登录了
     $this->assign("admin", session("username"));
     //设置登录验证
     //$this->assign("lasttime",session("lasttime"));
     //$this->assign("username",session("username"));
     //$this->assign("count",session("count"));//显示登录次数
     $theme = C(readconf::get_theme());
     //获取主题名->对应的主题文件夹名
     $this->assign("theme", $theme);
     switch ($_SESSION["role"]) {
         case 1:
             $this->assign("menu", $this->menu());
             break;
         case 2:
             $this->assign("menu", $this->teachermenu());
             break;
         case 3:
             $this->assign("menu", $this->mastermenu());
             break;
         default:
             $this->assign("menu", $this->stumenu());
             break;
     }
     $theme = C(readconf::get_theme());
     //获取主题名->对应的主题文件夹名
     $this->assign("theme", $theme);
     $s = M("notice")->order('id desc')->limit(10)->select();
     $this->assign("notice_list", $s);
     $this->display();
 }
Ejemplo n.º 2
0
 public function showTable2($tbname, $condtion = "", $url, $tableHead, $filed, $titlename, $option, $which = "table")
 {
     require COMMONPATH . 'SubPages.class.php';
     $info = D($tbname);
     $infos = $info->where($condtion)->select();
     $pageCurrent = isset($_GET['p']) ? intval($_GET['p']) : 1;
     //上面只得到总数的信息
     $page_size = readconf::get_pagecount();
     //每页显示数量,从数据库设置中读取
     $nums = count($infos);
     //计算查询出来的数量//总条目数
     $sub_pages = readconf::get_subpages();
     //每次显示的页数,从数据库读取
     $offset = ($pageCurrent - 1) * $page_size;
     //数据分页的偏移位置
     if (!strpos($url, "?")) {
         $url = $url . "?";
     } else {
         $url = $url . "&";
     }
     $subPages = new SubPages($page_size, $nums, $pageCurrent, $sub_pages, $url . "p=", 1);
     $this->assign('pageinfo', $subPages->show_SubPages(2));
     //get_class_methods($this);获取当前方法名
     $showinfo = $info->field($filed)->where($condtion)->order("id desc")->limit("{$offset},{$page_size}")->select();
     //可以的自定义三个按钮
     $selfbutton1 = $option["self1"];
     if ($selfbutton1 != "") {
         $this->assign("selfbutton1", true);
         $this->assign("selftitle1", $selfbutton1["title"]);
         $this->assign("selfurl1", $selfbutton1["url"]);
         $this->assign("selfimg1", $selfbutton1["img"]);
     } else {
         $this->assign("selfbutton1", false);
     }
     $selfbutton2 = $option["self2"];
     if ($selfbutton2 != "") {
         $this->assign("selfbutton2", true);
         $this->assign("selftitle2", $selfbutton2["title"]);
         $this->assign("selfurl2", $selfbutton2["url"]);
         $this->assign("selfimg2", $selfbutton2["img"]);
     } else {
         $this->assign("selfbutton2", false);
     }
     $selfbutton3 = $option["self3"];
     if ($selfbutton3 != "") {
         $this->assign("selfbutton3", true);
         $this->assign("selftitle3", $selfbutton3["title"]);
         $this->assign("selfurl3", $selfbutton3["url"]);
         $this->assign("selfimg3", $selfbutton3["img"]);
     } else {
         $this->assign("selfbutton3", false);
     }
     $loanreturn = $option["loanreturn"];
     if ($loanreturn != "") {
         $this->assign("loanreturn", true);
     } else {
         $this->assign("loanreturn", false);
     }
     $lookgrade = $option["lookgrade"];
     if ($lookgrade != "") {
         $this->assign("lookgrade", true);
     } else {
         $this->assign("lookgrade", false);
     }
     $addgrade = $option["addgrade"];
     if ($addgrade != "") {
         $this->assign("addgrade", true);
     } else {
         $this->assign("addgrade", false);
     }
     $add = $option["add"];
     if ($add != "") {
         $this->assign("add", true);
     } else {
         $this->assign("add", false);
     }
     $agreeone = $option["return"];
     if ($agreeone != "") {
         $this->assign("okreturn", true);
     } else {
         $this->assign("okreturn", false);
     }
     $dl = $option["dl"];
     if ($dl != "") {
         $this->assign("okdwon", true);
     } else {
         $this->assign("okdwon", false);
     }
     $look = $option["look"];
     if ($look != "") {
         $this->assign("oklook", true);
     } else {
         $this->assign("oklook", false);
     }
     $editaction = $option["edit"];
     if ($editaction != "") {
         $this->assign("okedit", true);
     } else {
         $this->assign("okedit", false);
     }
     $delaction = $option["del"];
     if ($delaction != "") {
         $this->assign("okdel", true);
     } else {
         $this->assign("okdel", false);
     }
     $okaction = $option["ok"];
     if ($okaction != "") {
         $this->assign("okok", true);
     } else {
         $this->assign("okok", false);
     }
     $this->assign("title", $titlename);
     $this->assign("edit", $editaction);
     $this->assign("table", $tbname);
     //给删除操作提供表
     $this->assign("ok", $okaction);
     $this->assign("delete", $delaction);
     $this->assign("list", $tableHead);
     $this->assign("info", $showinfo);
     $this->display("Index:" . $which);
     //加上Index表示显示的是Index下的模板
 }