Example #1
0
} elseif (Tools::isSubmit('subDelete')) {
    $select_cat = Tools::getRequest('categoryBox');
    if (Validate::isLoadedObject($category) and is_array($select_cat)) {
        $category->deleteSelection($select_cat);
    }
    if (is_array($category->_errors) and count($category->_errors) > 0) {
        $errors = $category->_errors;
    } else {
        UIAdminAlerts::conf('分类已删除');
    }
} elseif (Tools::isSubmit('subActiveON') or Tools::isSubmit('subActiveOFF')) {
    $select_cat = Tools::getRequest('categoryBox');
    $action = Tools::isSubmit('subActiveON') ? 1 : 0;
    $object = new Category();
    if (is_array($select_cat)) {
        if ($object->statusSelection($select_cat, $action)) {
            UIAdminAlerts::conf('状态已更新');
        }
    }
}
echo UIAdminDndTable::loadHead();
$table = new UIAdminDndTable('category', 'Category', 'id_category');
$table->addAttribte('id', 'category');
$table->parent = 'id_parent';
$table->child = true;
$table->header = array(array('sort' => false, 'isCheckAll' => 'categoryBox[]'), array('name' => 'id_category', 'title' => 'ID', 'filter' => 'string', 'rule' => 'category'), array('name' => 'name', 'title' => '名称', 'filter' => 'string', 'rule' => 'category'), array('name' => 'active', 'title' => '状态', 'filter' => 'bool'), array('name' => 'position', 'title' => '排序'), array('name' => 'add_date', 'title' => '添加时间', 'rule' => 'category'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'view', 'delete')));
$filter = $table->initFilter();
$orderBy = isset($_GET['orderby']) ? Tools::G('orderby') : 'position';
$orderWay = isset($_GET['orderway']) ? Tools::G('orderway') : 'asc';
$limit = $cookie->getPost('pagination') ? $cookie->getPost('pagination') : '50';
$p = Tools::G('p') ? Tools::G('p') == 0 ? 1 : Tools::G('p') : 1;