示例#1
0
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once 'guestclass.inc.php';
include_once 'guestcategoryclass.inc.php';
$guest = new Guest();
$gcategory = new GuestCategory();
$smarty->assign("tpl_title", "Gast bearbeiten/anlegen");
$smarty->assign('tpl_nav', 'gast');
$smarty->assign('tpl_subnav', 'cat');
$smarty->assign('tpl_type', 'editgast');
if ($request->GetVar('guestid', 'get') !== $request->undefined) {
    $guestid = $request->GetVar('guestid', 'get');
} elseif ($request->GetVar('frm_gastid', 'post') !== $request->undefined) {
    $guestid = $request->GetVar('frm_gastid', 'post');
} else {
    // noch kein Gast angelegt
    header("Location: " . $wwwroot . "editgast.php");
    exit;
}
if ($request->GetVar('frm_changeAction', 'post') == 'add') {
    $gcategory->subscribe($request->GetVar('frm_gastid', 'post'), $request->GetVar('frm_catid', 'post'));
} else {
    if ($request->GetVar('frm_changeAction', 'post') == 'del') {
        $gcategory->unsubscribe($request->GetVar('frm_gastid', 'post'), $request->GetVar('frm_catid', 'post'));
    }
}
// Load data
$smarty->assign('tpl_category', $gcategory->getallwithstatus($guestid));
$smarty->assign('tpl_gast', $guest->getGuest($guestid));
$smarty->assign('tpl_cat', $cat);
$smarty->display('editcat.tpl');