コード例 #1
0
ファイル: window2.php プロジェクト: gauravsaxena21/simantz
} 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
    case "edit":
        if ($o->fetchWindow($o->window_id)) {
            //create a new token for editing a form
            $token = $s->createToken($tokenlife, "CREATE_WDW");
            $o->getInputForm("edit", $o->window, $token);