<?php if (Tools::Q('saveAttributeGroup') == 'add') { $attribute_group = new AttributeGroup(); $attribute_group->copyFromPost(); $attribute_group->add(); if (is_array($attribute_group->_errors) and count($attribute_group->_errors) > 0) { $errors = $attribute_group->_errors; } else { $_GET['id'] = $attribute_group->id; UIAdminAlerts::conf('已添加属性组'); } } if (isset($_GET['id'])) { $id = (int) Tools::G('id'); $obj = new AttributeGroup($id); } if (Tools::Q('saveAttributeGroup') == 'edit') { if (Validate::isLoadedObject($obj)) { $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); }