<?php if (intval(Tools::G('delete')) > 0) { $object = new Coupon(intval(Tools::getRequest('delete'))); if (Validate::isLoadedObject($object)) { $object->delete(); } if (is_array($object->_errors) and count($object->_errors) > 0) { $errors = $object->_errors; } else { UIAdminAlerts::conf('优惠码已删除'); } } elseif (Tools::isSubmit('subDelete')) { $select_cat = Tools::getRequest('categoryBox'); $coupon = new Coupon(); if ($coupon->deleteSelection($select_cat)) { UIAdminAlerts::conf('优惠码已删除'); } } elseif (intval(Tools::getRequest('toggleStatus')) > 0) { $object = new Coupon(intval(Tools::getRequest('toggleStatus'))); if (Validate::isLoadedObject($object)) { $object->toggleStatus(); } if (is_array($object->_errors) and count($object->_errors) > 0) { $errors = $object->_errors; } else { UIAdminAlerts::conf('优惠码已更新'); } } $table = new UIAdminTable('coupon', 'Coupon', 'id_coupon'); $table->header = array(array('sort' => false, 'isCheckAll' => 'itemsBox[]'), array('name' => 'id_coupon', 'title' => 'ID', 'width' => '80px', 'filter' => 'string'), array('name' => 'id_user', 'title' => '状态码', 'filter' => 'string'), array('name' => 'off', 'title' => '状态信息', 'filter' => 'string'), array('name' => 'amount', 'title' => '状态信息', 'filter' => 'string'), array('name' => 'active', 'title' => '状态信息', 'filter' => 'string'), array('name' => 'add_date', 'title' => '状态信息', 'filter' => 'string'), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('edit', 'delete')));