Exemple #1
0
    header('location: voir_adherent.php');
    die;
} else {
    if (!$login->isAdmin()) {
        header('location: gestion_adherents.php');
        die;
    }
}
if (isset($_POST['cancel'])) {
    header('location: gestion_titres.php');
    die;
}
if (isset($_POST['id']) && !isset($_GET['id'])) {
    $_GET['id'] = $_POST['id'];
}
$title = new Title((int) $_GET['id']);
if (isset($_POST['id'])) {
    $title->short = $_POST['short_label'];
    $title->long = $_POST['long_label'];
    $res = $title->store($zdb);
    if (!$res) {
        $error_detected[] = preg_replace('(%s)', $title->short, _T("Title '%s' has not been modified!"));
    } else {
        $success_detected[] = preg_replace('(%s)', $title->short, _T("Title '%s' has been successfully modified."));
        $session['success_detected'] = serialize($success_detected);
        header('location: gestion_titres.php');
        die;
    }
}
$tpl->assign('page_title', _T("Edit title"));
$tpl->assign('title', $title);
Exemple #2
0
                $success_detected[] = str_replace('%name', $title->short, _T("Title '%name' has been successfully deleted."));
            } else {
                $error_detected[] = str_replace('%name', $title->short, _T("An error occured removing title '%name' :("));
            }
        } catch (\Exception $e) {
            if ($e->getCode() == 23000) {
                $error_detected[] = _T("That title is still in use, you cannot delete it!");
            } else {
                $error_detected[] = $e->getMessage();
            }
        }
    }
}
if (isset($_POST['new']) && $_POST['new'] == '1') {
    //add new title
    $title = new Title();
    $title->short = $_POST['short_label'];
    $title->long = $_POST['long_label'];
    $res = $title->store($zdb);
    if (!$res) {
        $error_detected[] = preg_replace('(%s)', $title->short, _T("Title '%s' has not been added!"));
    } else {
        $success_detected[] = preg_replace('(%s)', $title->short, _T("Title '%s' has been successfully added."));
    }
}
$titles = Titles::getList($zdb);
$tpl->assign('page_title', _T("Titles management"));
$tpl->assign('titles_list', $titles);
//$tpl->assign('require_dialog', true);
$tpl->assign('error_detected', $error_detected);
$tpl->assign('success_detected', $success_detected);