public function job_application() { $form = new G2_TwigView('forms/job-application'); $form = new G2_FormMagic($form->get_render()); if ($form->is_posted() && $form->validate()) { $result = Package_Submissions::getInstance()->add('Job Application', $form->data()); return $form->thank_you('Thank you for your enquiry. We will get back to you shortly'); } return $form->parse(); }
function changes($args) { $id = array_shift($args); if (!is_numeric($id) || !($audit = R::load('audit', $id))) { $this->redirect(PACKAGE_URL); } $update_form = new G2_TwigView('forms/audit'); $update_form = new G2_FormMagic($update_form->get_render()); if ($update_form->is_posted() && $update_form->validate()) { foreach ($update_form->data() as $field => $data) { $audit->{$field} = $data; } R::store($audit); } $update_form->set_data($audit->export()); $view = new G2_TwigView('pages/changes'); $view->audit = current(Audit::deserialize([$audit])); $view->update_form = $update_form->parse(); $view->render(); }
public function job_application() { $contact_form = new G2_TwigView('forms/job-application'); $contact_form = new G2_FormMagic($contact_form->get_render()); return $contact_form->parse(); }
function login() { $this->template->set_template_file('templates/signup.twig'); $view = new G2_TwigView('pages/login'); $login_form = new G2_TwigView('forms/login'); $login_form = new G2_FormMagic($login_form->get_render()); G()->create_user_if_not_exist('admin', 'g2design123'); if ($login_form->is_posted() && $login_form->validate()) { $data = $login_form->data(); $username = $data['username']; $password = $data['password']; if ($user = G()->check_login($username, $password)) { G()->log_in_user($user); $this->redirect($this->get_package_uri() . 'index'); } else { $login_form->invalidate('username', 'Login Fails. Please check your details and try again'); } } $login_form = $login_form->parse(); $view->set('login_form', $login_form); $view->render(); }