Exemplo n.º 1
0
 /**
  * PAGE: index
  * This method handles what happens when you move to http://yourproject/form2/index
  */
 public function index()
 {
     ob_start();
     $goToConfirm = false;
     $formKey = __CLASS__ . '::index';
     if (IntelliForm::submitted(false)) {
         // form has been submitted
         // save the data in case they navigate away then come back to the page
         IntelliForm::save($formKey);
         try {
             $formValues = array();
             if ($this->checkFormValues($formValues)) {
                 $goToConfirm = true;
                 // delete the form data because we have finished with it
                 IntelliForm::clear($formKey);
             } else {
                 // form not submitted, restore a previous form
                 IntelliForm::restore($formKey);
             }
         } catch (Exception $ex) {
             IntelliForm::restore($formKey);
         }
     }
     $_logs = ob_get_contents();
     ob_end_clean();
     if ($goToConfirm) {
         $this->getRouter()->call('form2', 'confirm');
         return;
     }
     //Core::htmlize($_logs);
     // load views.
     $_pageTitle = 'DEMO FORM 2';
     require __DIR__ . '/../views/__templates/header.php';
     require __DIR__ . '/../views/form2/index.php';
     require __DIR__ . '/../views/__templates/footer.php';
 }