Пример #1
0
}
// detect if a deleete operation has to be processed
$del = dPgetParam($_POST, 'del', 0);
if ($del) {
    // check if there are dependencies on this object (not relevant for test, left here for show-purposes)
    //	if (!$obj->canDelete( $msg )) {
    //		$AppUI->setMsg( $msg, UI_MSG_ERROR );
    //		$AppUI->redirect();
    //	}
    // see how easy it is to run database commands with the object oriented architecture !
    // simply delete a quote from db and have detailed error or success report
    if ($msg = $obj->delete()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        // message with error flag
        $AppUI->redirect();
    } else {
        $AppUI->setMsg("Test deleted", UI_MSG_ALERT);
        // message with success flag
        $AppUI->redirect("m=testing");
    }
} else {
    // simply store the added/edited quote in database via the store method of the test child class of the CDpObject provided ba the dPFramework
    // no sql command is necessary here! :-)
    if ($msg = $obj->store()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
    } else {
        $isNotNew = @$_POST['unittest_id'];
        $AppUI->setMsg($isNotNew ? 'Test updated' : 'Test inserted', UI_MSG_OK);
    }
    $AppUI->redirect();
}