예제 #1
0
<?php

if (Tools::G('delete') > 0) {
    $object = new CMSComment(Tools::G('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::P('categoryBox');
    $cmscomment = new CMSComment();
    if ($cmscomment->deleteSelection($select_cat)) {
        UIAdminAlerts::conf('评论已删除');
    }
} elseif (Tools::isSubmit('subActiveON') or Tools::isSubmit('subActiveOFF')) {
    $select_cat = Tools::P('itemBox');
    $action = Tools::isSubmit('subActiveON') ? 1 : 0;
    $object = new CMSComment();
    if (is_array($select_cat)) {
        if ($object->statusSelection($select_cat, $action)) {
            UIAdminAlerts::conf('文章已更新');
        }
    }
}
$table = new UIAdminTable('cms_comment', 'CMSComment', 'id_cms_comment');
$table->header = array(array('sort' => false, 'isCheckAll' => 'itemBox[]'), array('name' => 'id_cms_comment', 'title' => 'ID', 'edit' => false, 'filter' => 'string'), array('name' => 'name', 'title' => '访客', 'edit' => false, 'filter' => 'string'), array('name' => 'email', 'title' => '邮箱', 'edit' => false, 'filter' => 'string'), array('name' => 'active', 'title' => '状态', 'edit' => false, 'filter' => 'bool'), array('name' => 'comment', 'title' => '内容', 'edit' => false), array('name' => 'add_date', 'title' => '时间', 'edit' => false), array('sort' => false, 'title' => '操作', 'class' => 'text-right', 'isAction' => array('delete')));
$filter = $table->initFilter();