<?php

/* ========================================================================
 * $Id: master.php 2011 2020-07-08 18:44:40Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# index
#请求数据
if($MODE=='$post'){
  $action=onez()->gp('action');
  if($action=='data'){
    $action=onez()->gp('ac');
    if($action=='del'){
      $id=(int)onez()->gp('id');
      $user=onez()->gp('user');
      $G['this']->userdb()->open('member')->delete("id='$id'$where");
      return $this->ok('删除成功','reload');
    }
    $siteId=onez()->gp('siteId');
    $data=array();
    $data['title']='管理员设置';
      $data['btns'][]=array(
        'name'=>'添加管理员',
        'href'=>'./edit.php',
        'args'=>'width=800&height=600&title=添加管理员&key1=admin',
      );
    $datatable=$this->load('datatable');
    $datatable->set('edit',array(
      'event'=>array(
        'action'=>'./edit.php?id=${id}',
        'option'=>array(
          'width'=>800,
          'height'=>600,
        ),
      ),
    ));
    $datatable->set('del','1');
    $datatable->set('fields','id');
    
    $datatable->add('用户编号','id');
    $datatable->add('显示昵称','nickname',array('function'=>function($rs){
      global $G;
      return '<img src="'.$G['this']->avatar($rs['id']).'" style="width:16px;height:16px;"> '.$G['this']->user($rs,'nickname');
    }));
    $datatable->add('账户类型','key1',array('options'=>onez('bs.app.shipments')->grades()));
    $datatable->add('注册方式','key5');
    $datatable->add('登录账号','key2');
    $datatable->add('注册时间','addtime',array('type'=>'time'));
    
    $datatable->output($data,array(
      'table'=>'member',
      'db'=>$G['this']->userdb(),
      'where'=>"key1='admin'$where order by id desc",
      'pagesize'=>20,
    ));
    $A['pagedata']=$data;
  }
  return;
}
$this->add(array(
  'type'=>'subheader',
  'name'=>'内容头部',
  'data'=>'pagedata',
));

?>
<div class="kt-container  kt-container--fluid  kt-grid__item kt-grid__item--fluid">
<?php 
$this->add(array(
  'type'=>'datatable',
  'name'=>'数据表',
  'data'=>'pagedata',
));
?>
</div>