if (count($records) == 0) { $action = 'welcome'; } break; case 'show': $rec = DateRecord::findById('DateRecord', $_REQUEST['id']); break; case 'new': $rec = new DateRecord(); $nextAction = "create"; $action = 'edit'; break; case 'create': $rec = new DateRecord($_REQUEST); $rec->data['uid'] = $user; if ($rec->save()) { updateJDateProfile(false); postAddedFeed($rec); actionRedirect('index', 'flash=insert&insertedId=' . $rec->data['id']); } else { $action = 'edit'; $nextAction = 'create'; } break; case 'edit': $rec = DateRecord::findById('DateRecord', $_REQUEST['id']); $nextAction = "update"; if (!$rec) { $action = 'show'; } break;