Exemple #1
0
$o->seqno = $_POST['seqno'];
$o->createdby = $xoopsUser->getVar('uid');
$o->updatedby = $xoopsUser->getVar('uid');
if ($isactive == "Y" or $isactive == "on") {
    $o->isactive = 'Y';
} else {
    $o->isactive = 'N';
}
switch ($action) {
    //When user submit new organization
    case "create":
        // if the token is exist and not yet expired
        $log->showLog(4, "Accessing create record event, with window name={$o->window_name}");
        if ($s->check(false, $token, "CREATE_WDW")) {
            if ($o->insertWindow()) {
                $latest_id = $o->getLatestWindowID();
                redirect_header("window.php?action=edit&window_id={$latest_id}", $pausetime, "Your data is saved, the new id={$latest_id}");
            } else {
                $token = $s->createToken($tokenlife, "CREATE_WDW");
                $o->getInputForm("new", -1, $token);
                $o->showWindowTable();
            }
        } else {
            // if the token is not valid or the token is expired, it back to previous form with previous inputed data
            $token = $s->createToken($tokenlife, "CREATE_WDW");
            $o->getInputForm("new", -1, $token);
            $o->showWindowTable();
        }
        break;
        //when user request to edit particular organization
    //when user request to edit particular organization