} }); $app->post('/app/create', function () use($app, $twig, $assets, $MongoUser) { $_user = array('_id' => uniqid(), 'email' => $app->request()->post('email'), 'password' => $app->request()->post('password')); $new_user = $MongoUser->save($_user); if ($new_user) { // redirect to login page $dataArray = array('user' => $new_user, 'message' => "User created sucessfully"); //$response = json_encode($dataArray); //echo $response; if (!isset($_SESSION)) { session_start(); } $cookie_data = json_encode($new_user, true); $_SESSION['app_id'] = $cookie_data; $app->redirect('/app'); } else { $app->halt(401, "User sign up fail."); } }); /* $app->get('/app/create', function() use ($app, $twig, $assets) { // so here I need to call the API. echo "hi"; }); */ // this is used as my default function $app->notFound(function () use($app, $twig, $assets) { $data = array('user' => 'testuser', 'test' => 'hahahahha', 'static_url' => $assets); echo $twig->render('views/404.php', $data); });
$formResult = $formController->parse($entityBody); $formResult->setLogger($log); //form has updated mappings for each question $candidate = new Stratum\Model\Candidate(); $candidate->setLogger($log); $log->debug("parsed input data"); $candidateController = new Stratum\Controller\CandidateController(); $candidateController->setLogger($log); $candidate = $candidateController->populate($candidate, $formResult); $log->debug("Candidate submitted with name " . $candidate->getName()); $controller = new Stratum\Controller\BullhornController(); $controller->setLogger($log); $controller->submit($candidate); }); $app->get('/launch', function () use($app) { $app->redirect('http://northcreek.ca/stratum/launch.html'); }); $app->get('/launchForm', function (Request $request, Response $response) use($log) { // this is all the happy path assuming everything is set up properly from the Bullhorn side //load the id from the request $id = $request->getAttribute('entityid'); //set up the controllers and their loggers $wcontroller = new \Stratum\Controller\WorldappController(); $bcontroller = new \Stratum\Controller\BullhornController(); $bcontroller->setLogger($log); $wcontroller->setLogger($log); //find the correct form $form = $wcontroller->find_form_by_name('Registration Form - Stratum International'); //load the candidate data from Bullhorn $candidate = new Stratum\Model\Candidate(); $candidate->set("id", $id);