Exemplo n.º 1
0
        $obj->copyFromPost();
        $obj->update();
    }
    if (is_array($obj->_errors) and count($obj->_errors) > 0) {
        $errors = $obj->_errors;
    } else {
        UIAdminAlerts::conf('已更新属性组');
    }
}
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
$breadcrumb->add(array('title' => '属性组', 'href' => 'index.php?rule=attribute_group'));
$breadcrumb->add(array('title' => '编辑', 'active' => true));
$bread = $breadcrumb->draw();
$btn_group = array(array('type' => 'a', 'title' => '返回', 'href' => 'index.php?rule=attribute_group', 'class' => 'btn-primary', 'icon' => 'level-up'), array('type' => 'button', 'title' => '保存', 'id' => 'save-attribute-group', 'class' => 'btn-success', 'icon' => 'saved'));
echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb');
?>
<script language="javascript">
	$("#save-attribute-group").click(function(){
		$("#attribute-group-form").submit();
	})
</script>
<?php 
$form = new UIAdminEditForm('post', 'index.php?rule=attribute_group_edit' . (isset($id) ? '&id=' . $id : ''), 'form-horizontal', 'attribute-group-form');
$attributeGroup = AttributeGroup::loadData();
$items = array(AttributeGroup::GROUP_TYPE_SELECT => '下单菜单', AttributeGroup::GROUP_TYPE_RADIO => '单选按钮', AttributeGroup::GROUP_TYPE_CHECKBOX => '复选框');
$form->items = array('name' => array('title' => '属性值', 'type' => 'text', 'value' => isset($obj) ? $obj->name : Tools::Q('name')), 'group_type' => array('title' => '类别', 'type' => 'radio', 'value' => isset($obj) ? $obj->group_type : Tools::Q('group_type'), 'items' => $items), 'saveAttributeGroup' => array('type' => 'hidden', 'value' => isset($id) ? 'edit' : 'add'));
echo UIViewBlock::area(array('title' => '编辑', 'body' => $form->draw()), 'panel');
Exemplo n.º 2
0
    $select_cat = Tools::P('itemsBox');
    $attributeGroup = new AttributeGroup();
    if ($attributeGroup->deleteMulti($select_cat)) {
        UIAdminAlerts::conf('商品特征已删除');
    }
}
/** 初始化表格 */
echo UIAdminDndTable::loadHead();
$table = new UIAdminDndTable('attribute_group', 'AttributeGroup', 'id_attribute_group');
$table->addAttribte('id', 'feature');
$table->header = array(array('sort' => false, 'isCheckAll' => 'itemsBox[]'), array('name' => 'id_attribute_group', 'title' => 'ID', 'filter' => 'string', 'rule' => 'attribute'), array('name' => 'name', 'title' => '名称', 'filter' => 'string', 'rule' => 'attribute'), array('name' => 'position', 'title' => '排序'), array('sort' => false, 'title' => '操作', 'width' => '120px', 'class' => 'text-right', 'isAction' => array('edit', '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;
$result = AttributeGroup::loadData($p, $limit, $orderBy, $orderWay, $filter);
/** 错误处理 */
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
/** 输出导航 */
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
$breadcrumb->add(array('title' => '属性', 'active' => true));
$bread = $breadcrumb->draw();
$btn_group = array(array('type' => 'a', 'title' => '新属性组', 'href' => 'index.php?rule=attribute_group_edit', 'class' => 'btn-success', 'icon' => 'plus'));
echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb');
/** 输出属性组 */
$btn_group = array(array('type' => 'button', 'title' => '删除选中', 'confirm' => '确定要删除选中项?', 'name' => 'delSelected', 'btn_type' => 'submit', 'class' => 'btn-danger'));
echo UIViewBlock::area(array('title' => '用户留言', 'table' => $table, 'result' => $result, 'limit' => $limit, 'btn_groups' => $btn_group), 'table');