Working on new forms
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Dec 2014 13:33:57 +0000 (08:33 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Dec 2014 13:33:57 +0000 (08:33 -0500)
Form1 done
Form2 done
Form3 done
Form4 started

controllers/admin.php
controllers/front.php
css/admin-print-application.css
css/admin-view-application.css
models/forms/settings.php
models/forms/settings2.php
models/forms/settings3.php [new file with mode: 0644]
models/forms/settings4.php [new file with mode: 0644]
views/admin/form_1.php
views/front/form_1.php
views/front/jobDetail.php

index ecb8d9f..0dabf7d 100644 (file)
@@ -87,7 +87,7 @@ class glm_employment_admin
             ORDER BY form_part";
             $formData = $this->wpdb->get_results($sql, ARRAY_A);
             foreach ($formData as $form) {
-                $forms[] = unserialize($formData[0]['form_data']);
+                $forms[] = unserialize($form['form_data']);
             }
         }
         echo '<div class="wrap">';
index 519e260..3a76951 100644 (file)
@@ -67,24 +67,25 @@ class glm_employment_front
 
     public function show_apply_form()
     {
-        $applyOnline = (isset($_REQUEST[self::FORM_VAR]))
-            ? filter_var($_REQUEST[self::FORM_VAR], FILTER_VALIDATE_INT)
+//        echo '<pre>'.print_r($_REQUEST, true).'</pre>';
+        $formPart = (isset($_REQUEST['form_part']))
+            ? filter_var($_REQUEST['form_part'], FILTER_VALIDATE_INT)
             : false;
         // form Action
         $formAction = '';
-//        $formPart = $applyOnline;
-        switch ($applyOnline) {
-        case 1:
+        switch ($formPart) {
+        default:
             unset($_SESSION['glmJobsApplication'], $_SESSION['glmJobsAppForm']);
             include $this->pluginDirName . 'models/forms/settings.php';
-            $formPart = 2;
+            $formPart = 1;
             include $this->pluginDirName . 'views/front/form_1.php';
             break;
-        case 2:
+
+        case 1:
             if ($this->formSubmitted) {
                 include $this->pluginDirName . 'models/forms/settings.php';
-                $this->form_process(1, $form);
-                $appId = filter_var($_REQUEST['appId'], FILTER_VALIDATE_INT);
+                $this->form_process($form, 1);
+                $this->appId = $appId = filter_var($_REQUEST['appId'], FILTER_VALIDATE_INT);
                 if (!$appId) {
                     // insert new application and form data
                     if ($this->fname) {
@@ -99,7 +100,8 @@ class glm_employment_front
                 if ($this->errorCount > 0) {
                     include $this->pluginDirName . 'views/front/form_1.php';
                 } else {
-                    $formPart = 3;
+                    // next form part
+                    $formPart = 2;
                     $appId = $this->appId;
                     include $this->pluginDirName . 'models/forms/settings2.php';
                     include $this->pluginDirName . 'views/front/form_1.php';
@@ -108,17 +110,43 @@ class glm_employment_front
                 wp_die('An Error!:(');
             }
             break;
-        case 3:
+
+        case 2:
             if ($this->formSubmitted) {
                 include $this->pluginDirName . 'models/forms/settings2.php';
-                $this->form_process(1, $form);
-                $appId = filter_var($_REQUEST['appId'], FILTER_VALIDATE_INT);
+                $this->form_process($form, 2);
+
+                $this->appId = $appId = filter_var($_REQUEST['appId'], FILTER_VALIDATE_INT);
 
                 if ($this->errorCount > 0) {
                     include $this->pluginDirName . 'views/front/form_1.php';
                 } else {
-                    $formPart = 4;
+                    $this->store_form_data($form, 2);
+                    // next form part
+                    $formPart = 3;
                     include $this->pluginDirName . 'models/forms/settings3.php';
+//                    echo '<pre>'.print_r($form, true).'</pre>';
+                    include $this->pluginDirName . 'views/front/form_1.php';
+                }
+            } else {
+                wp_die('An Error!:(');
+            }
+            break;
+        case 3:
+            if ($this->formSubmitted) {
+                include $this->pluginDirName . 'models/forms/settings3.php';
+                $this->form_process($form, 3);
+
+                $this->appId = $appId = filter_var($_REQUEST['appId'], FILTER_VALIDATE_INT);
+
+                if ($this->errorCount > 0) {
+                    include $this->pluginDirName . 'views/front/form_1.php';
+                } else {
+                    $this->store_form_data($form, 3);
+                    // next form part
+                    $formPart = 3;
+                    include $this->pluginDirName . 'models/forms/settings4.php';
+//                    echo '<pre>'.print_r($form, true).'</pre>';
                     include $this->pluginDirName . 'views/front/form_1.php';
                 }
             } else {
@@ -131,7 +159,9 @@ class glm_employment_front
 
     public function store_application_data($form)
     {
-        if ($this->appId = filter_var($_SESSION['glmJobsApplication'], FILTER_VALIDATE_INT)) {
+        if ($this->appId = filter_var($_REQUEST['appId'], FILTER_VALIDATE_INT)) {
+            return;
+        } else if ($this->appId = filter_var($_SESSION['glmJobsApplication'], FILTER_VALIDATE_INT)) {
             return;
         }
         $this->wpdb->insert(
@@ -155,18 +185,13 @@ class glm_employment_front
 
     public function store_form_data($form, $form_part)
     {
-        if (   $this->formId = filter_var($_SESSION['glmJobsAppForm']['id'], FILTER_VALIDATE_INT)
-            && $form_part = $_SESSION['glmJobsAppForm']['part']
-        ) {
-            return;
-        }
         // check if there's one stored first
         $sql = "
         SELECT id
           FROM {$this->formTable}
          WHERE application = {$this->appId}
            AND form_part = {$form_part}";
-        $formData = $this->wpdb->get_row($sql);
+        $formData = $this->wpdb->get_row($sql, ARRAY_A);
         if ($formData) {
             $this->wpdb->replace(
                 $this->formTable,
@@ -210,41 +235,50 @@ class glm_employment_front
         );
     }
 
-    public function form_process($part, &$form)
+    public function form_process(&$form, $part)
     {
         $this->clean_post();
         switch($part) {
         case 1:
             include $this->pluginDirName . 'models/forms/settings.php';
-            foreach ($form as $rowKey => $row) {
-                if ($row['type'] != 'header') {
-                    foreach ($row as $fieldKey => $field) {
-                        $form[$rowKey][$fieldKey]['value']
-                            = filter_var($_REQUEST[$field['name']], FILTER_SANITIZE_STRING);
-                        if (in_array($field['name'], array('fname', 'lname', 'mname'))) {
-                            $this->$field['name'] = $form[$rowKey][$fieldKey]['value'];
-                        }
-                        if (   $field['type'] == 'checkbox'
-                            && isset($field['opts'])
-                            && !empty($field['opts'])
-                        ) {
-                            foreach ($field['opts'] as $opKey => $option) {
-                                if (isset($_POST[$option['name']])) {
-                                    $form[$rowKey][$fieldKey]['opts'][$opKey]['checked'] = true;
-                                }
+            break;
+        case 2:
+            include $this->pluginDirName . 'models/forms/settings2.php';
+            break;
+        case 3:
+            include $this->pluginDirName . 'models/forms/settings3.php';
+            break;
+        }
+        foreach ($form as $rowKey => $row) {
+            if ($row['type'] != 'header') {
+                foreach ($row as $fieldKey => $field) {
+                    if (!isset($field['name'])) {
+                        continue;
+                    }
+                    $form[$rowKey][$fieldKey]['value']
+                        = filter_var($_REQUEST[$field['name']], FILTER_SANITIZE_STRING);
+                    if (in_array($field['name'], array('fname', 'lname', 'mname'))) {
+                        $this->$field['name'] = $form[$rowKey][$fieldKey]['value'];
+                    }
+                    if (   $field['type'] == 'checkbox'
+                        && isset($field['opts'])
+                        && !empty($field['opts'])
+                    ) {
+                        foreach ($field['opts'] as $opKey => $option) {
+                            if (isset($_POST[$option['name']])) {
+                                $form[$rowKey][$fieldKey]['opts'][$opKey]['checked'] = true;
                             }
                         }
-                        if (   isset($field['req'])
-                            && $field['req'] == true
-                            && $_POST[$field['name']] == ''
-                        ) {
-                            $form[$rowKey][$fieldKey]['error'] = $field['label'] . ' is required!';
-                            ++$this->errorCount;
-                        }
+                    }
+                    if (   isset($field['req'])
+                        && $field['req'] == true
+                        && $_POST[$field['name']] == ''
+                    ) {
+                        $form[$rowKey][$fieldKey]['error'] = $field['label'] . ' is required!';
+                        ++$this->errorCount;
                     }
                 }
             }
-            break;
         }
     }
 
@@ -258,7 +292,7 @@ class glm_employment_front
     public function show_job($job_id)
     {
         global $wpdb, $wp;
-        $job = get_post($job_id);
+        $job    = get_post($job_id);
         $custom = get_post_custom($job->ID);
         $job->glm_jobs_startdate = $custom['glm_jobs_startdate'][0];
         $job->glm_jobs_enddate   = $custom['glm_jobs_enddate'][0];
@@ -273,7 +307,7 @@ class glm_employment_front
             home_url($wp->request));
         $applyOnlineHref         = $current_url
                 . ((strpos($current_url, '?')) ? '&' : '?')
-                . self::FORM_VAR . "=1";
+                . self::FORM_VAR . "=1&job=" . $job->ID;
         include $this->pluginDirName . 'views/front/jobDetail.php';
         return;
     }
index c81f03e..5dd923d 100644 (file)
@@ -34,7 +34,7 @@
     font-size: 13px;
 }
 #wpcontent {
-    margin-left: 0;
+    margin-left: 20px;
     padding-left: 0;
     margin-top: 0;
 }
index dd8f7d6..b4d31b0 100644 (file)
@@ -1,15 +1,27 @@
 #appForm {
-    width: 700px;
-    max-width: 700px;
+    width: 750px;
+    max-width: 750px;
     background-color: #fff;
 }
 #appForm span {
     font-size: 13px;
 }
-
-div.row {
-    border:1px solid black;
+#appForm > div.row {
+    max-width: 700px;
+}
+#appForm div.row * div.row {
     border-collapse: collapse;
+    border:1px solid black;
+    /*display:block;*/
+    width: 100%;
+}
+div.row > div.row {
+    /*border-collapse: collapse;*/
     display:table-row;
+    width: 100%;
+    max-width: 500px;
 }
-div.row > div {display:table-cell;padding:2px;}
+div.row > div {
+    display:table-cell;
+    padding:2px;
+}
\ No newline at end of file
index 5ab039e..88c13ad 100644 (file)
@@ -3,70 +3,70 @@ $fname = [
     'type'  => 'text',
     'name'  => 'fname',
     'label' => 'First Name',
-    'large' => 5,
+    'grid' => 5,
     'req'   => true
 ];
 $lname = [
     'type'  => 'text',
     'name'  => 'lname',
     'label' => 'Last Name',
-    'large' => 5
+    'grid' => 5
 ];
 $mname = [
     'type'  => 'text',
     'name'  => 'mname',
     'label' => 'Middle Name',
-    'large' => 2
+    'grid' => 2
 ];
 $street = [
     'type'  => 'text',
     'name'  => 'street',
     'label' => 'Street',
-    'large' => 3
+    'grid' => 3
 ];
 $city = [
     'type'  => 'text',
     'name'  => 'city',
     'label' => 'City',
-    'large' => 3
+    'grid' => 3
 ];
 $state = [
     'type'  => 'text',
     'name'  => 'state',
     'label' => 'State',
-    'large' => 3
+    'grid' => 3
 ];
 $zip = [
     'type'  => 'text',
     'name'  => 'zip',
     'label' => 'ZIP',
-    'large' => 3
+    'grid' => 3
 ];
 
 $phone = [
     'type'  => 'tel',
     'name'  => 'phone',
     'label' => 'Phone',
-    'large' => 4
+    'grid' => 4
 ];
 $altPhone = [
     'type'  => 'tel',
     'name'  => 'alt_phone',
     'label' => 'Alternate Phone',
-    'large' => 4
+    'grid' => 4
 ];
 $email = [
     'type'  => 'email',
     'name'  => 'email',
     'label' => 'Email',
-    'large' => 4,
+    'grid' => 4,
     'req'   => true
 ];
 $over_18 = [
     'type'  => 'radio',
     'name'  => 'over_18',
     'label' => 'Are you 18 years or older?',
-    'large' => 4,
+    'grid' => 4,
     'req'   => true,
     'opts'  => [[
         'name' => 'over_18_yes',
@@ -81,7 +81,7 @@ $us_citizen = [
     'type'  => 'radio',
     'name'  => 'us_citizen',
     'label' => 'Are you an U.S. citizen?',
-    'large' => 4,
+    'grid' => 4,
     'req'   => true,
     'opts'  => [[
         'name' => 'us_citizen_yes',
@@ -96,7 +96,7 @@ $us_auth = [
     'type'  => 'radio',
     'name'  => 'us_auth',
     'label' => 'Are you authorized to work in the United States?',
-    'large' => 4,
+    'grid' => 4,
     'req'   => true,
     'opts'  => [[
         'name' => 'us_auth_yes',
@@ -111,7 +111,7 @@ $employed_before = [
     'type'  => 'radio',
     'name'  => 'employed_before',
     'label' => 'Have you been previously employed here?',
-    'large' => 6,
+    'grid' => 6,
     'req'   => true,
     'opts'  => [[
         'name' => 'employed_before_yes',
@@ -126,19 +126,19 @@ $employed_before_dates = [
     'type'  => 'text',
     'name'  => 'employed_before_dates',
     'label' => 'If yes, date(s)',
-    'large' => 6
+    'grid' => 6
 ];
 $supervisor = [
     'type'  => 'text',
     'name'  => 'supervisor',
     'label' => 'Supervisor Name(s)',
-    'large' => 12
+    'grid' => 12
 ];
 $applied_before = [
     'type'  => 'radio',
     'name'  => 'applied_before',
     'label' => 'Have you ever applied to this Company before?',
-    'large' => 6,
+    'grid' => 6,
     'req'   => true,
     'opts'  => [[
         'name' => 'applied_before_yes',
@@ -153,31 +153,31 @@ $applied_before_dates = [
     'type'  => 'text',
     'name'  => 'applied_before_dates',
     'label' => 'Where?',
-    'large' => 6
+    'grid' => 6
 ];
 $applied_before_under_what_name = [
     'type'  => 'text',
     'name'  => 'applied_before_under_what_name',
     'label' => 'Under what name?',
-    'large' => 6
+    'grid' => 6
 ];
 $applied_before_when = [
     'type'  => 'text',
     'name'  => 'applied_before_when',
     'label' => 'When?',
-    'large' => 6
+    'grid' => 6
 ];
 $list_any_friends = [
     'type'  => 'text',
     'name'  => 'list_any_friends',
     'label' => 'List any friends or relatives working here',
-    'large' => 12
+    'grid' => 12
 ];
 $have_drivers_license = [
     'type'  => 'radio',
     'name'  => 'have_drivers_license',
     'label' => 'DO YOU HAVE A DRIVER\'S LICENSE?',
-    'large' => 6,
+    'grid' => 6,
     'req'   => true,
     'opts'  => [[
         'name' => 'have_drivers_license_yes',
@@ -192,25 +192,25 @@ $means_of_travel = [
     'type'  => 'text',
     'name'  => 'means_of_travel',
     'label' => 'What is your means of transportation to work?',
-    'large' => 6
+    'grid' => 6
 ];
 $drivers_license = [
     'type'  => 'text',
     'name'  => 'drivers_license',
     'label' => 'Driver\'/s License Number',
-    'large' => 6
+    'grid' => 6
 ];
 $license_state = [
     'type'  => 'text',
     'name'  => 'license_state',
     'label' => 'State of issue',
-    'large' => 6
+    'grid' => 6
 ];
 $license_type = [
     'type'  => 'radio',
     'name'  => 'license_type',
     'label' => 'Drivers License',
-    'large' => 6,
+    'grid' => 6,
     'req'   => true,
     'opts'  => [[
         'name' => 'license_type_operator',
@@ -229,13 +229,13 @@ $license_exp_date = [
     'type'  => 'text',
     'name'  => 'license_exp_date',
     'label' => 'Expiration date',
-    'large' => 6
+    'grid' => 6
 ];
 $had_accident_in_past_three_years = [
     'type'  => 'radio',
     'name'  => 'had_accident_in_past_three_years',
     'label' => 'Have you had any accidents during the past three years?',
-    'large' => 8,
+    'grid' => 8,
     'req'   => true,
     'opts'  => [[
         'name' => 'had_accident_in_past_three_years_yes',
@@ -250,13 +250,13 @@ $had_accident_in_past_three_years_how_many = [
     'type'  => 'text',
     'name'  => 'had_accident_in_past_three_years_how_many',
     'label' => 'How Many',
-    'large' => 4
+    'grid' => 4
 ];
 $had_violations_in_past_three_years = [
     'type'  => 'radio',
     'name'  => 'had_violations_in_past_three_years',
     'label' => 'Have you had any moving violations during the past three years?',
-    'large' => 8,
+    'grid' => 8,
     'req'   => true,
     'opts'  => [[
         'name' => 'had_violations_in_past_three_years_yes',
@@ -271,25 +271,30 @@ $had_violations_in_past_three_years_how_many = [
     'type'  => 'text',
     'name'  => 'had_violations_in_past_three_years_how_many',
     'label' => 'How Many',
-    'large' => 4
+    'grid' => 4
 ];
+if ($jobId = filter_var($_REQUEST['job'], FILTER_VALIDATE_INT)) {
+    $jobData  = get_post($jobId);
+    $jobTitle = $jobData->post_title;
+}
 $position_applied_for = [
     'type'  => 'text',
     'name'  => 'position_applied_for',
     'label' => 'Position Applied For',
-    'large' => 6
+    'grid'  => 6,
+    'value' => $jobTitle
 ];
 $date_available_for_work = [
     'type'  => 'text',
     'name'  => 'date_available_for_work',
     'label' => 'Date Available to Work',
-    'large' => 6
+    'grid' => 6
 ];
 $type_of_employment = [
     'type'  => 'checkbox',
     'name'  => 'type_of_employment',
     'label' => 'Type of Employment',
-    'large' => 6,
+    'grid' => 6,
     'req'   => false,
     'opts'  => [[
         'name' => 'type_of_employment_fulltime',
@@ -305,13 +310,13 @@ $salary_desired = [
     'type'  => 'text',
     'name'  => 'salary_desired',
     'label' => 'Salary Desired',
-    'large' => 6
+    'grid' => 6
 ];
 $location_preference = [
     'type'  => 'checkbox',
     'name'  => 'location_preference',
     'label' => 'Location Preference',
-    'large' => 6,
+    'grid' => 6,
     'req'   => false,
     'opts'  => [[
         'name' => 'location_preference_petoskey',
@@ -331,7 +336,7 @@ $do_you_have_building_exp = [
     'type'  => 'radio',
     'name'  => 'do_you_have_building_exp',
     'label' => 'Do you have experience in the building industry?',
-    'large' => 6,
+    'grid' => 6,
     'req'   => true,
     'opts'  => [[
         'name' => 'do_you_have_building_exp_yes',
@@ -347,7 +352,7 @@ $special_training = [
     'name'  => 'special_training',
     'label' => 'Do you have any special training, skills, certifications, qualifications,'
     . ' or other experiences that relate to the position(s) applied for?',
-    'large' => 12
+    'grid' => 12
 ];
 $form = [
     ['type' => 'header', 'label' => 'Personal Information'],
index afae00e..b366864 100644 (file)
@@ -3,44 +3,81 @@ $date_of_birth = [
     'type'  => 'text',
     'name'  => 'date_of_birth',
     'label' => 'Date of Birth',
-    'large' => 12,
+    'grid' => 2,
+    'req'   => true
+];
+$date_of_birth_explain = [
+    'type'  => 'static',
+    'value' => '<div class="static">The U.S. Department of Transportation requires that driver '
+    . 'applicants state their date of birth &sect;391.21(b)(2).</div>',
+    'grid' => 10
+];
+$stateHdr = [
+    'type'  => 'static',
+    'label' => 'State',
+    'grid' => 1,
+    'req'   => true
+];
+$licenseHdr = [
+    'type'  => 'static',
+    'label' => 'License No.',
+    'grid' => 4,
+    'req'   => true
+];
+$classHdr = [
+    'type'  => 'static',
+    'label' => 'Class',
+    'grid' => 1,
+    'req'   => true
+];
+$endorsementHdr = [
+    'type'  => 'static',
+    'label' => 'Endorsement(s)',
+    'grid' => 4,
+    'req'   => true
+];
+$exp_dateHdr = [
+    'type'  => 'static',
+    'label' => 'Expiration Date',
+    'grid' => 2,
     'req'   => true
 ];
 for ($i = 1; $i <= 4; ++$i) {
+    $licenseReq = ($i == 1) ? true: false;
     ${'state'.$i} = [
         'type'  => 'text',
         'name'  => 'state' . $i,
-        'label' => 'State',
-        'large' => 1,
-        'req'   => true
+        'label' => '', //'State',
+        'grid' => 1,
+        'req'   => $licenseReq
     ];
     ${'license'.$i} = [
         'type'  => 'text',
         'name'  => 'license' . $i,
-        'label' => 'License No.',
-        'large' => 4,
-        'req'   => true
+        'label' => '', //'License No.',
+        'grid' => 4,
+        'req'   => $licenseReq
     ];
     ${'class'.$i} = [
         'type'  => 'text',
         'name'  => 'class' . $i,
-        'label' => 'Class',
-        'large' => 1,
-        'req'   => true
+        'label' => '', //'Class',
+        'grid' => 1,
+        'req'   => $licenseReq
     ];
     ${'endorsement'.$i} = [
         'type'  => 'text',
         'name'  => 'endorsement' . $i,
-        'label' => 'Endorsement(s)',
-        'large' => 4,
-        'req'   => true
+        'label' => '', //'Endorsement(s)',
+        'grid' => 4,
+        'req'   => $licenseReq
     ];
     ${'exp_date'.$i} = [
         'type'  => 'text',
         'name'  => 'exp_date' . $i,
-        'label' => 'Expiration Date',
-        'large' => 2,
-        'req'   => true
+        'label' => '', //'Expiration Date',
+        'grid' => 2,
+        'req'   => $licenseReq
     ];
 }
 $denied_license = [
@@ -48,7 +85,7 @@ $denied_license = [
     'name'  => 'denied_license',
     'label' => 'A. Have you ever been denied a license, permit or privilege to'
     . 'operate a motor wehicle?',
-    'large' => 4,
+    'grid' => 4,
     'req'   => true,
     'opts'  => [[
         'name'  => 'denied_license_yes',
@@ -63,7 +100,7 @@ $suspended_license = [
     'type'  => 'radio',
     'name'  => 'suspended_license',
     'label' => 'B. Has any license, permit or privilege ever been suspended or revoked?',
-    'large' => 4,
+    'grid' => 4,
     'req'   => true,
     'opts'  => [[
         'name'  => 'suspended_license_yes',
@@ -79,7 +116,7 @@ $disqualified_license = [
     'name'  => 'disqualified_license',
     'label' => 'C. Have you ever been disquelified for violations of the Federal'
     . 'Mortor Carrier Safety Regulations?',
-    'large' => 4,
+    'grid' => 4,
     'req'   => true,
     'opts'  => [[
         'name'  => 'disqualified_license_yes',
@@ -94,7 +131,7 @@ $details_of_license = [
     'type'  => 'textarea',
     'name'  => 'details_of_license',
     'label' => 'If you answered "yes" to A, B, C, give details',
-    'large' => 12
+    'grid' => 12
 ];
 $titles = [
     1 => 'Straight Truck',
@@ -102,53 +139,211 @@ $titles = [
     'Twin Trailers - LCV\'s',
     'Other'
 ];
+$eq_classHdr = [
+    'type'  => 'static',
+    'label' => 'Class of Equipment',
+    'grid' => 3,
+    'req'   => false
+];
+$eq_typeHdr = [
+    'type'  => 'static',
+    'label' => 'Type of Equipment (Van, Tank, Flat, etc.)',
+    'grid' => 4,
+    'req'   => false
+];
+$eq_dates_fromHdr = [
+    'type'  => 'static',
+    'label' => 'From',
+    'grid' => 1,
+    'req'   => false
+];
+$eq_dates_toHdr = [
+    'type'  => 'static',
+    'label' => 'To',
+    'grid' => 1,
+    'req'   => false
+];
+$eq_approx_milesHdr = [
+    'type'  => 'static',
+    'label' => 'Approximate total Miles',
+    'grid' => 3,
+    'req'   => false
+];
 for ($i = 1; $i <= 4; ++$i) {
     ${'eq_class'.$i} = [
         'type'  => 'static',
-        'value' => $titles[$i],
-        'large' => 3
+        'label' => '', //'Class of Equipment',
+        'value' => '<div class="static">'.$titles[$i].'</div>',
+        'grid' => 3
     ];
     ${'eq_type'.$i} = [
         'type'  => 'text',
-        'name'  => 'type' . $i,
-        'label' => 'Type of Equipment (Van, Tank, Flat, etc.)',
-        'large' => 4,
-        'req'   => true
+        'name'  => 'eq_type' . $i,
+        'label' => '', //'Type of Equipment (Van, Tank, Flat, etc.)',
+        'grid' => 4,
+        'req'   => false
     ];
     ${'eq_dates_from'.$i} = [
         'type'  => 'text',
-        'name'  => 'dates_from' . $i,
-        'label' => 'From',
-        'large' => 1,
-        'req'   => true
+        'name'  => 'eq_dates_from' . $i,
+        'label' => '', //'From',
+        'grid' => 1,
+        'req'   => false
     ];
     ${'eq_dates_to'.$i} = [
         'type'  => 'text',
-        'name'  => 'dates_to' . $i,
-        'label' => 'To',
-        'large' => 1,
-        'req'   => true
+        'name'  => 'eq_dates_to' . $i,
+        'label' => '', //'To',
+        'grid' => 1,
+        'req'   => false
     ];
     ${'eq_approx_miles'.$i} = [
         'type'  => 'text',
-        'name'  => 'exp_date' . $i,
-        'label' => 'Approximate total Miles',
-        'large' => 3,
-        'req'   => true
+        'name'  => 'eq_approx_miles' . $i,
+        'label' => '', //'Approximate total Miles',
+        'grid' => 3,
+        'req'   => false
+    ];
+}
+$last_5_years_states = [
+    'type'  => 'textarea',
+    'name'  => 'last_5_years_states',
+    'label' => 'List states operated in during last five years:',
+    'grid' => 12
+];
+$special_drivers_training = [
+    'type'  => 'textarea',
+    'name'  => 'last_5_years_states',
+    'label' => 'List special courses or training that will help you as a driver:',
+    'grid' => 12
+];
+$driving_awards = [
+    'type'  => 'textarea',
+    'name'  => 'last_5_years_states',
+    'label' => 'List driving awards held and who awards were presented by:',
+    'grid' => 12
+];
+
+$accident_review_dates = [
+    'type'  => 'static',
+    'label' => 'Dates<br><br>',
+    'grid' => 3
+];
+$accident_review_nature = [
+    'type'  => 'static',
+    'label' => 'Nature of Accident (Head-on, Rear-End, Overturn, etc.)',
+    'grid' => 3
+];
+$accident_review_fatalities = [
+    'type'  => 'static',
+    'label' => 'Fatalities<br><br>',
+    'grid' => 3
+];
+$accident_review_injuries = [
+    'type'  => 'static',
+    'label' => 'Injuries<br><br>',
+    'grid' => 3
+];
+for ($i = 1; $i <= 3; ++$i) {
+    ${'accident_review_dates'.$i} = [
+        'type'  => 'text',
+        'name'  => 'accident_review_dates'.$i,
+        'label' => '',
+        'grid' => 3
+    ];
+    ${'accident_review_nature'.$i} = [
+        'type'  => 'text',
+        'name'  => 'accident_review_nature'.$i,
+        'label' => '',
+        'grid' => 3
+    ];
+    ${'accident_review_fatalities'.$i} = [
+        'type'  => 'text',
+        'name'  => 'accident_review_fatalities'.$i,
+        'label' => '',
+        'grid' => 3
+    ];
+    ${'accident_review_injuries'.$i} = [
+        'type'  => 'text',
+        'name'  => 'accident_review_injuries'.$i,
+        'label' => '',
+        'grid' => 3
+    ];
+}
+$traffic_convictions_locations = [
+    'type'  => 'static',
+    'label' => 'Location',
+    'grid' => 3
+];
+$traffic_convictions_date = [
+    'type'  => 'static',
+    'label' => 'Date',
+    'grid' => 3
+];
+$traffic_convictions_charge = [
+    'type'  => 'static',
+    'label' => 'Charge',
+    'grid' => 3
+];
+$traffic_convictions_penalty = [
+    'type'  => 'static',
+    'label' => 'Penalty',
+    'grid' => 3
+];
+for ($i = 1; $i <= 3; ++$i) {
+    ${'traffic_convictions_locations'.$i} = [
+        'type'  => 'text',
+        'name'  => 'traffic_convictions_locations'.$i,
+        'label' => '',
+        'grid' => 3
+    ];
+    ${'traffic_convictions_date'.$i} = [
+        'type'  => 'text',
+        'name'  => 'traffic_convictions_date'.$i,
+        'label' => '',
+        'grid' => 3
+    ];
+    ${'traffic_convictions_charge'.$i} = [
+        'type'  => 'text',
+        'name'  => 'traffic_convictions_charge'.$i,
+        'label' => '',
+        'grid' => 3
+    ];
+    ${'traffic_convictions_penalty'.$i} = [
+        'type'  => 'text',
+        'name'  => 'traffic_convictions_penalty'.$i,
+        'label' => '',
+        'grid' => 3
     ];
 }
 $form = [
     ['type' => 'header', 'label' => 'Driver Experience and Qualification'],
-    [$date_of_birth],
+    [$date_of_birth, $date_of_birth_explain],
     ['type' => 'header', 'label' => 'Drivers Licenses held in past 3 years must be shown'],
+    [$stateHdr, $licenseHdr, $classHdr, $endorsementHdr, $exp_dateHdr],
     [$state1, $license1, $class1, $endorsement1, $exp_date1],
     [$state2, $license2, $class2, $endorsement2, $exp_date2],
     [$state3, $license3, $class3, $endorsement3, $exp_date3],
     [$state4, $license4, $class4, $endorsement4, $exp_date4],
     [$denied_license, $suspended_license, $disqualified_license],
     [$details_of_license],
+    ['type' => 'header', 'label' => 'Driving Experience'],
+    [$eq_classHdr, $eq_typeHdr, $eq_dates_fromHdr, $eq_dates_toHdr, $eq_approx_milesHdr],
     [$eq_class1, $eq_type1, $eq_dates_from1, $eq_dates_to1, $eq_approx_miles1],
     [$eq_class2, $eq_type2, $eq_dates_from2, $eq_dates_to2, $eq_approx_miles2],
     [$eq_class3, $eq_type3, $eq_dates_from3, $eq_dates_to3, $eq_approx_miles3],
     [$eq_class4, $eq_type4, $eq_dates_from4, $eq_dates_to4, $eq_approx_miles4],
+    [$last_5_years_states],
+    [$special_drivers_training],
+    [$driving_awards],
+    ['type' => 'header', 'label' => 'Accident Review for past 3 years'],
+    [$accident_review_dates,$accident_review_nature, $accident_review_fatalities, $accident_review_injuries],
+    [$accident_review_dates1,$accident_review_nature1, $accident_review_fatalities1, $accident_review_injuries1],
+    [$accident_review_dates2,$accident_review_nature2, $accident_review_fatalities2, $accident_review_injuries2],
+    [$accident_review_dates3,$accident_review_nature3, $accident_review_fatalities3, $accident_review_injuries3],
+    ['type' => 'header', 'label' => 'Traffic Convictions and Forfeitures', 'subheader' => 'for the past 3 years other than parking violations'],
+    [$traffic_convictions_locations, $traffic_convictions_date, $traffic_convictions_charge, $traffic_convictions_penalty],
+    [$traffic_convictions_locations1, $traffic_convictions_date1, $traffic_convictions_charge1, $traffic_convictions_penalty1],
+    [$traffic_convictions_locations2, $traffic_convictions_date2, $traffic_convictions_charge2, $traffic_convictions_penalty2],
+    [$traffic_convictions_locations3, $traffic_convictions_date3, $traffic_convictions_charge3, $traffic_convictions_penalty3],
 ];
diff --git a/models/forms/settings3.php b/models/forms/settings3.php
new file mode 100644 (file)
index 0000000..48ebfb9
--- /dev/null
@@ -0,0 +1,278 @@
+<?php
+$topHeader = [
+    'type'      => 'header',
+    'label'     => 'Current and Former Employers',
+    'subheader' => '(List current or most cerent job first)',
+    'notes'     => '<b>Note to Driver Candidates:</b> The U.S. Department of '
+    . 'Transportation requires that driver applications show all employment for '
+    . 'the past three years. They must also show commercial driver employment '
+    . 'for the seven years immediately preceding this three year period. '
+    . '&sect;391.21(b)(10),(11). <b>All Applicants:</b> start with last, or current'
+    . ' position, and work back.'
+];
+$titles = array_combine(range(1, 4), range(1, 4));
+$employment_titleHdr = [
+    'type'  => 'static',
+    'label' => '&nbsp;',
+    'grid' => 1,
+    'req'   => false,
+    'rcoll' => true
+];
+$employment_datesHdr = [
+    'type'  => 'static',
+    'label' => 'Date Month/Year',
+    'grid' => 2
+];
+$employment_infoHdr = [
+    'type'  => 'static',
+    'label' => 'Employer Name, Address, and Telephone',
+    'grid' => 4
+];
+$employment_supervisorHdr = [
+    'type'  => 'static',
+    'label' => 'Supervisor',
+    'grid' => 1
+];
+$employment_salaryHdr = [
+    'type'  => 'static',
+    'label' => 'Salary',
+    'grid' => 1
+];
+$employment_positionHdr = [
+    'type'  => 'static',
+    'label' => 'Last Position Held & Work Performed',
+    'grid' => 2
+];
+$employment_reasonHdr = [
+    'type'  => 'static',
+    'label' => 'Reason for Leaving',
+    'grid' => 2
+];
+for ($i = 1; $i <= 4; ++$i) {
+    ${'employment_title'.$i} = [
+        'type'  => 'static',
+        'label' => '&nbsp;',
+        'value' => '<div class="static">'.$titles[$i].'</div>',
+        'grid' => 1,
+        'rcoll' => true
+    ];
+    ${'employment_title_sub'.$i} = [
+        'type'  => 'static',
+        'label' => '&nbsp;',
+        'value' => '',
+        'grid'  => 1,
+        'rcoll' => true
+    ];
+    ${'employment_dates_from'.$i} = [
+        'type'  => 'text',
+        'name'  => 'employment_dates_from'.$i,
+        'placeholder' => 'From:',
+        'grid' => 2
+    ];
+    ${'employment_dates_to'.$i} = [
+        'type'  => 'text',
+        'name'  => 'employment_dates_to'.$i,
+        'placeholder' => 'To:',
+        'grid' => 2
+    ];
+    ${'employment_info'.$i} = [
+        'type'  => 'text',
+        'name'  => 'employment_info'.$i,
+//        'placeholder' => '&nbsp;',
+        'grid' => 4
+    ];
+    ${'employment_supervisor'.$i} = [
+        'type'  => 'text',
+        'name'  => 'employment_supervisor'.$i,
+        'placeholder' => 'Supervisor',
+        'grid' => 4
+    ];
+    ${'employment_salary_start'.$i} = [
+        'type'  => 'text',
+        'name'  => 'employment_salary_start'.$i,
+        'placeholder' => 'Starting',
+        'grid' => 1
+    ];
+    ${'employment_salary_end'.$i} = [
+        'type'  => 'text',
+        'name'  => 'employment_salary_end'.$i,
+        'placeholder' => 'Ending',
+        'grid' => 1
+    ];
+    ${'employment_position'.$i} = [
+        'type'  => 'text',
+        'name'  => 'employment_position'.$i,
+//        'label' => '&nbsp;',
+        'grid' => 2
+    ];
+    ${'employment_position_sub'.$i} = [
+        'type'  => 'static',
+        'name'  => 'employment_position_sub'.$i,
+//        'label' => '&nbsp;',
+        'grid' => 2
+    ];
+    ${'employment_reason'.$i} = [
+        'type'  => 'text',
+        'name'  => 'employment_reason'.$i,
+//        'label' => '&nbsp;',
+        'grid' => 2
+    ];
+    ${'employment_reason_sub'.$i} = [
+        'type'  => 'static',
+        'name'  => 'employment_reason_sub'.$i,
+//        'label' => '&nbsp;',
+        'grid' => 2
+    ];
+}
+$may_we_contact = [
+    'type'  => 'radio',
+    'name'  => 'may_we_contact',
+    'label' => 'May we contact the employers listed?',
+    'grid' => 6,
+    'req'   => true,
+    'opts'  => [[
+        'name' => 'may_we_contact_yes',
+        'label' => 'Yes',
+        'value' => 1
+    ],[
+        'name' => 'may_we_contact_no',
+        'label' => 'No',
+        'value' => 0]]
+];
+$who_to_not_contact = [
+    'type'  => 'textarea',
+    'name'  => 'who_to_not_contact',
+    'label' => 'If no, which one(s) should we NOT contact?',
+    'grid' => 6,
+    'req'   => false
+];
+//
+$titles3 = [
+    1 => 'High School',
+    'College / University',
+    'Specialized Training',
+    'Business or trade school',
+    'other',
+    ''
+];
+$edu_titleHdr = [
+    'type'  => 'static',
+    'label' => '&nbsp;',
+    'grid' => 2,
+    'req'   => false,
+    'rcoll' => true
+];
+$edu_title2Hdr = $edu_titleHdr;
+$edu_title2Hdr['label'] = '&nbsp;';
+$edu_schoolHdr = [
+    'type'  => 'static',
+    'label' => 'Name and Location of School',
+    'grid' => 4,
+    'req'   => false
+];
+$edu_school2Hdr = $edu_schoolHdr;
+$edu_school2Hdr['label'] = '&nbsp;';
+$edu_yearsHdr = [
+    'type'  => 'static',
+    'label' => 'No. of Years Attended',
+    'grid' => 2,
+    'req'   => false
+];
+$edu_years2Hdr = $edu_yearsHdr;
+$edu_years2Hdr['label'] = '&nbsp;';
+$edu_gradHdr = [
+    'type'  => 'static',
+    'label' => 'Did you Graduate',
+    'grid' => 2,
+    'req'   => false
+];
+$edu_grad_degreeHdr = [
+    'type'  => 'static',
+    'label' => 'Degree',
+    'grid' => 1,
+    'req'   => false
+];
+$edu_grad_certificateHdr = [
+    'type'  => 'static',
+    'label' => 'Certificate',
+    'grid' => 1,
+    'req'   => false
+];
+$edu_subjectHdr = [
+    'type'  => 'static',
+    'label' => 'Subject/Major',
+    'grid' => 2,
+    'req'   => false
+];
+$edu_subject2Hdr = $edu_subjectHdr;
+$edu_subject2Hdr['label'] = '&nbsp;';
+for ($i = 1; $i <= 6; ++$i) {
+    ${'edu_title'.$i} = [
+        'type'  => 'static',
+        'label' => '',
+        'value' => '<div class="static">'.$titles3[$i].'</div>',
+        'grid' => 2,
+        'rcoll' => true
+    ];
+    ${'edu_school'.$i} = [
+        'type'  => 'text',
+        'name'  => 'edu_years' . $i,
+        'label' => '',
+        'grid' => 4,
+        'req'   => false
+    ];
+    ${'edu_years'.$i} = [
+        'type'  => 'text',
+        'name'  => 'edu_years' . $i,
+        'label' => '',
+        'grid' => 2,
+        'req'   => false
+    ];
+    ${'edu_grad_degree'.$i} = [
+        'type'  => 'text',
+        'name'  => 'edu_grad_degree' . $i,
+        'label' => '',
+        'grid' => 1,
+        'req'   => false
+    ];
+    ${'edu_grad_certificate'.$i} = [
+        'type'  => 'text',
+        'name'  => 'edu_grad_certificate' . $i,
+        'label' => '',
+        'grid' => 1,
+        'req'   => false
+    ];
+    ${'edu_subject'.$i} = [
+        'type'  => 'text',
+        'name'  => 'edu_subject' . $i,
+        'label' => '',
+        'grid' => 2,
+        'req'   => false
+    ];
+}
+$form = [
+    $topHeader,
+    [$employment_titleHdr, $employment_datesHdr, $employment_infoHdr, $employment_salaryHdr, $employment_positionHdr, $employment_reasonHdr],
+
+    [$employment_title1, $employment_dates_from1,  $employment_info1, $employment_salary_start1,  $employment_position1, $employment_reason1],
+    [$employment_title_sub1, $employment_dates_to1, $employment_supervisor1, $employment_salary_end1,$employment_position_sub1, $employment_reason_sub1],
+
+    [$employment_title2, $employment_dates_from2,  $employment_info2, $employment_salary_start2,  $employment_position2, $employment_reason2],
+    [$employment_title_sub2, $employment_dates_to2, $employment_supervisor2, $employment_salary_end2,$employment_position_sub2, $employment_reason_sub2],
+
+    [$employment_title3, $employment_dates_from3,  $employment_info3, $employment_salary_start3,  $employment_position3, $employment_reason3],
+    [$employment_title_sub3, $employment_dates_to3, $employment_supervisor3, $employment_salary_end3,$employment_position_sub3, $employment_reason_sub3],
+
+    [$employment_title4, $employment_dates_from4,  $employment_info4, $employment_salary_start4,  $employment_position4, $employment_reason4],
+    [$employment_title_sub4, $employment_dates_to4, $employment_supervisor4, $employment_salary_end4,$employment_position_sub4, $employment_reason_sub4],
+
+    [$may_we_contact, $who_to_not_contact],
+    [$edu_titleHdr, $edu_schoolHdr, $edu_yearsHdr, $edu_gradHdr, $edu_subjectHdr],
+    [$edu_title2Hdr, $edu_school2Hdr, $edu_years2Hdr, $edu_grad_degreeHdr, $edu_grad_certificateHdr, $edu_subject2Hdr],
+    [$edu_title1, $edu_school1, $edu_years1, $edu_grad_degree1, $edu_grad_certificate1, $edu_subject1],
+    [$edu_title2, $edu_school2, $edu_years2, $edu_grad_degree2, $edu_grad_certificate2, $edu_subject2],
+    [$edu_title3, $edu_school3, $edu_years3, $edu_grad_degree3, $edu_grad_certificate3, $edu_subject3],
+    [$edu_title4, $edu_school4, $edu_years4, $edu_grad_degree4, $edu_grad_certificate4, $edu_subject4],
+    [$edu_title5, $edu_school5, $edu_years5, $edu_grad_degree5, $edu_grad_certificate5, $edu_subject5],
+    [$edu_title6, $edu_school6, $edu_years6, $edu_grad_degree6, $edu_grad_certificate6, $edu_subject6],
+];
diff --git a/models/forms/settings4.php b/models/forms/settings4.php
new file mode 100644 (file)
index 0000000..3356b37
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+$military_experience = [
+    'type'  => 'radio',
+    'name'  => 'military_experience',
+    'label' => 'Have you had any experience in the Armed Forces of the United States or in a State National Guard?',
+    'grid' => 6,
+    'req'   => true,
+    'opts'  => [[
+        'name' => 'military_experience_yes',
+        'label' => 'Yes',
+        'value' => 1
+    ],[
+        'name' => 'military_experience_no',
+        'label' => 'No',
+        'value' => 0]]
+];
+$military_branch = [
+    'type'  => 'text',
+    'name'  => 'military_branch',
+    'label' => 'If yes, what branch?',
+    'grid' => 6,
+    'req'   => false
+];
+$military_date_entered = [
+    'type'  => 'text',
+    'name'  => 'military_date_entered',
+    'label' => 'Date Entered?',
+    'grid' => 6,
+    'req'   => false
+];
+$form = [
+    ['type' => 'header', 'label' => 'page 4'],
+    [$military_experience, $military_branch]
+];
index a589240..a9ac962 100644 (file)
@@ -7,7 +7,7 @@
         <?php else:?>
             <div class="row">
                 <?php foreach($row as $field) :?>
-                <div class="large-<?php echo $field['large'];?> small-12  columns">
+                <div class="large-<?php echo $field['grid'];?> small-12  columns">
                     <label<?php if ($field['req']):?> class="error"<?php endif;?>>
                         <?php echo $field['label'];?>
                     </label>
@@ -16,6 +16,8 @@
                     <?php case 'tel':?>
                     <?php case 'email':?>
                     <?php case 'textarea':?>
+                    <?php case 'static': ?>
+                        <?php if ($field['placeholder']) {echo '<span><b>'.$field['placeholder'].'</b></span>';}?>
                         <span><?php echo $field['value'];?></span>
                     <?php break;?>
                     <?php case 'radio':?>
index fba491b..856fb84 100644 (file)
@@ -1,24 +1,38 @@
+<style>
+    div.static {
+        text-align:left;
+        padding-top: 5px;
+    }
+</style>
 <div class="row">
     <div class="small-12 columns">
         <h1><?php echo $formTitle;?></h1>
         <form method="post" action="<?php echo $formAction;?>">
-            <input type="hidden" name="applyOnline" value="<?php echo $formPart;?>" />
+            <input type="hidden" name="<?php echo self::FORM_VAR;?>" value="1">
+            <input type="hidden" name="form_part" value="<?php echo $formPart;?>" />
             <?php if ($appId):?>
             <input type="hidden" name="appId" value="<?php echo $appId;?>">
             <?php endif;?>
             <?php foreach($form as $row):?>
             <?php if ($row['type'] == 'header') :?>
                 <h3><?php echo $row['label'];?></h3>
+                <?php if ($row['subheader']) {?>
+                    <h4 class="subheader"><?php echo $row['subheader'];?></h4>
+                <?php }?>
+                <?php if ($row['notes']) {?>
+                    <p><?php echo $row['notes'];?></p>
+                <?php }?>
             <?php else:?>
-                <div class="row">
+                <div class="row<?php echo ($row[0]['rcoll'])?' collapse':'';?>">
                     <?php foreach($row as $field) :?>
-                    <div class="small-12 large-<?php echo $field['large'];?> columns">
+                    <div class="small-<?php echo $field['grid'];?> columns">
                         <label<?php if ($field['req']):?> class="error"<?php endif;?>>
                             <?php echo $field['label'];?>
                         </label>
                             <?php switch($field['type']) :
                             case 'text':?>
                             <input
+                                <?php if ($field['placeholder']) {echo ' placeholder="'.$field['placeholder'].'"';}?>
                                 <?php if ($field['error']){echo 'class="error"';}?>
                                 <?php if ($field['req']){echo 'required';}?>
                                 <?php if ($field['pat']):?>
index 8825147..bb4d10f 100644 (file)
@@ -13,7 +13,6 @@
         </a>
         <?php endif;?>
     </div>
-
     <div><?php echo apply_filters('the_content', $job->post_content);?></div>
     <a href="<?php echo $applyOnlineHref;?>">Apply Online</a>
 </div>
\ No newline at end of file