Beispiel #1
0
<?php

if (Tools::P('imageTypeSaveType') == 'add') {
    $image_type = new ImageType();
    $image_type->copyFromPost();
    if ($image_type->add() && Tools::P('reloadImages')) {
        $image_type->reloadImages();
    }
    if (is_array($image_type->_errors) and count($image_type->_errors) > 0) {
        $errors = $image_type->_errors;
    } else {
        $_GET['id'] = $image_type->id;
        UIAdminAlerts::conf('图片类型已添加');
    }
}
if (isset($_GET['id'])) {
    $id = (int) $_GET['id'];
    $obj = new ImageType($id);
}
if (Tools::P('imageTypeSaveType') == 'edit') {
    if (Validate::isLoadedObject($obj)) {
        $obj->copyFromPost();
        if ($obj->update() && Tools::P('reloadImages') == 1) {
            $obj->reloadImages();
        }
    }
    if (is_array($obj->_errors) and count($obj->_errors) > 0) {
        $errors = $obj->_errors;
    } else {
        UIAdminAlerts::conf('图片类型已更新');
    }