Esempio n. 1
0
/**
* @desc Elimina la información de una sección
**/
function rd_delete_sections()
{
    global $xoopsModule;
    $id = rmc_server_var($_GET, 'id', 0);
    $id_sec = rmc_server_var($_GET, 'sec', 0);
    // Check if a Document id has been provided
    if ($id <= 0) {
        redirectMsg('resources.php', __('You have not specify a Document id', 'docs'), 1);
        die;
    }
    $res = new RDResource($id);
    if ($res->isNew()) {
        redirectMsg('The specified Document does not exists!', 'docs');
        die;
    }
    // Check if a section id has been provided
    if ($id_sec <= 0) {
        redirectMsg('./sections.php?id=' . $id, __('You have not specified a section ID to delete!', 'docs'), 1);
        die;
    }
    $sec = new RDSection($id_sec);
    if ($sec->isNew()) {
        redirectMsg('./sections.php?id=' . $id, __('Specified section does not exists!', 'docs'), 1);
        die;
    }
    if (!$sec->delete()) {
        redirectMsg('./sections.php?id=' . $id, __('Errors ocurred while trying to delete sections!', 'docs') . '<br />' . $sec->errors(), 1);
        die;
    } else {
        redirectMsg('./sections.php?id=' . $id, __('Sections deleted successfully!', 'docs'), 0);
    }
}