Пример #1
0
$o->organization_id = $_POST['organization_id'];
$o->table_name = $_POST['table_name'];
$o->uid = $_POST['uid'];
$o->datefrom = $_POST['datefrom'];
$o->dateto = $_POST['dateto'];
$o->activitytype = $_POST['activitytype'];
if ($o->organization_id == "") {
    $o->organization_id = $defaultorganization_id;
}
if ($uid == "") {
    $uid = 0;
}
$userid = $xoopsUser->getVar('uid');
$o->orgctrl = $ctrl->selectionOrg($userid, $o->organization_id);
$o->userctrl = $permission->selectAvailableSysUser($o->uid, 'Y');
$o->windowsctrl = $ctrl->getSelectWindows($o->table_name, "Y");
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 activitysummary name={$o->activitysummary_name}");
        if ($s->check(false, $token, "CREATE_STD")) {
            if ($o->insertActivitysummary()) {
                $latest_id = $o->getLatestActivitysummaryID();
                redirect_header("activitysummary.php?action=edit&activitysummary_id={$latest_id}", $pausetime, "Your data is saved, the new id={$latest_id}");
            } else {
                echo "Can't create activitysummary!";
            }
        } else {
            // if the token is not valid or the token is expired, it back to previous form with previous inputed data
            $token = $s->createToken(120, "CREATE_STD");