Ejemplo n.º 1
0
 public function view_platformShow()
 {
     if (!isset($_SESSION['userId'])) {
         header('Location:index.php?mod=login&act=index');
     }
     //调用action层, 获取列表数据
     $platformAct = new platformAct();
     /*******************分	页 start ***********************/
     $total = $platformAct->act_getPlatformListNum();
     //计算总条数
     $num = 50;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $platformActArr = $platformAct->act_platformManage(' order by id desc ' . $page->limit);
     //数据调用
     $this->tp_obj->set_var('username', $_SESSION['userName']);
     //用户信息
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $this->tp_obj->set_var("show_page", $show_page);
     /*******************分	页 end ***********************/
     //导航数据和头尾数据加载
     $navar = array('<a href="index.php?mod=platformManage&act=platformShow">平台管理</a>', '>', '平台列表');
     $this->tp_obj->set_var('module', '平台列表');
     $this->tp_obj->set_file('header', 'header.html');
     $this->tp_obj->set_file('footer', 'footer.html');
     $this->tp_obj->set_file('navdiv', 'transmanagernav.html');
     $this->tp_obj->parse('navdiv', 'navdiv');
     $this->tp_obj->parse('header', 'header');
     $this->tp_obj->parse('footer', 'footer');
     $this->tp_obj->parse('navar', $navar);
     $this->tp_obj->set_block('navdiv', 'navlist', 'llist');
     foreach ($navar as $nav) {
         $this->tp_obj->set_var('location', $nav);
         $this->tp_obj->parse('llist', 'navlist', TRUE);
     }
     $this->tp_obj->set_file('platformManage', 'platformManage.html');
     $this->tp_obj->set_block("platformManage", "list", "lists");
     //数据输出
     if (!empty($platformActArr)) {
         foreach ($platformActArr as $platformInfo) {
             $this->tp_obj->set_var('t_id', $platformInfo['id']);
             $this->tp_obj->set_var('platformNameCn', $platformInfo['platformNameCn']);
             $this->tp_obj->set_var('platformNameEn', $platformInfo['platformNameEn']);
             $this->tp_obj->set_var('createdTime', date("Y-m-d H:i:s", $platformInfo['createdTime']));
             $this->tp_obj->parse("lists", "list", true);
         }
     }
     $this->tp_obj->parse('buff', 'platformManage');
     $this->tp_obj->p('buff');
 }