<?php

/* ========================================================================
 * $Id: linkscategorys.php 1408 2020-06-27 16:03:08Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onez.cn
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
# linkscategorys
#请求数据
if($MODE=='$post'){
  $action=onez()->gp('action');
  if($action=='data'){
    $action=onez()->gp('ac');

    if($action=='del'){
      $id=(int)onez()->gp('id');
      $G['this']->data()->open('links.categorys')->delete("id='$id'");
      return $this->ok('删除成功','reload');
    }
    $data=array();
    $data['title']='分类管理';

    $data['btns'][]=array(
      'name'=>'添加分类',
      'href'=>'./edit.php',
      'args'=>'width=560&height=400&title=添加分类',
    );
    
    $datatable=$this->load('datatable');
    


    
    $datatable->set('edit',array(
      'event'=>array(
        'option'=>array(
          'width'=>560,
          'height'=>400,
        ),
      ),
    ));
    $datatable->set('del','1');
    $datatable->set('fields','id');

    $datatable->add('名称','name');
    $datatable->add('优先级','step');
    $datatable->output($data,array(
      'table'=>'links.categorys',

      'where'=>"1 order by step desc,id",
      '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>