Exemplo n.º 1
0
/**
 * Training Delete
 */
function training_delete()
{
    // check training edit permission
    if (!api_checkPermission("module-diary", "training_del")) {
        api_die("trainingDenied");
    }
    // get objects
    $training = api_moduleDiary_training($_GET['idTraining']);
    if (!$training->id) {
        exit(header("location: module-diary_list.php?alert=trainingNotFound&alert_class=alert-error"));
    }
    // execute queries
    $GLOBALS['db']->execute("DELETE FROM `module-diary_trainings` WHERE `id`='" . $training->id . "'");
    // log event
    $log = api_log(API_LOG_WARNING, "module-diary", "trainingDeleted", "{logs_module-diary_trainingDeleted|" . $training->sport . "|" . $training->sort . "}", $training->id);
    // redirect
    $alert = "?alert=trainingDeleted&alert_class=alert-warning&idLog=" . $log->id;
    exit(header("location: module-diary_list.php" . $alert));
}
Exemplo n.º 2
0
    if ($_GET['resetFilters'] || $_GET['filtered'] != 1 && $_SESSION['filters'][api_baseName()]['filtered'] != 1) {
        //include("filters.inc.php");
    }
}
// list
$navigation->addTab(api_text("module-diary-nav-list"), "module-diary_list.php");
if (api_baseName() == "module-diary_list.php") {
    $navigation->addSubTab(api_text("module-diary-nav-export_list"), "module-diary_export_list.php");
}
// operations
if ($training->id) {
    $navigation->addTab(api_text("module-diary-nav-operations"), NULL, NULL, "active");
    $navigation->addSubTab(api_text("module-diary-nav-edit"), "module-diary_edit.php?idTraining=" . $training->id, NULL, NULL, api_checkPermission($module_name, "training_edit") ? TRUE : FALSE);
    $navigation->addSubTab(api_text("module-diary-nav-delete"), "submit.php?act=training_delete&idTraining=" . $training->id, NULL, NULL, api_checkPermission($module_name, "training_del") ? TRUE : FALSE, "_self", api_text("module-diary-nav-delete-confirm"));
    $navigation->addSubTab(api_text("module-diary-nav-export"), "module-diary_export.php?idTraining=" . $training->id);
} else {
    // add new, with check permission
    $navigation->addTab(api_text("module-diary-nav-add"), "module-diary_edit.php", NULL, NULL, api_checkPermission($module_name, "training_dit") ? TRUE : FALSE);
}
// show navigation menu
$navigation->render();
// check permissions before displaying module
if ($checkPermission == NULL) {
    content();
} else {
    if (api_checkPermission($module_name, $checkPermission, TRUE)) {
        content();
    }
}
// print footer
$html->footer();