← All changes
|
includes/templates/class-template-employee-information.php
+252
-247
1.6.7
→
1.2.9
View file →
| @@ -1,247 +1,252 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Blank form template | |
| 5 | - */ | |
| 6 | -class WeForms_Template_Employee_Information extends WeForms_Form_Template { | |
| 7 | - | |
| 8 | - public function __construct() { | |
| 9 | - parent::__construct(); | |
| 10 | - | |
| 11 | - $this->enabled = class_exists( 'WeForms_Pro' ); | |
| 12 | - $this->title = __( 'Employee Information', 'weforms' ); | |
| 13 | - $this->description = __( 'Keep a record of your employee’s information with this form. This includes personal information, job information and emergency contact information sections.', 'weforms' ); | |
| 14 | - $this->category = 'default'; | |
| 15 | - $this->image = WEFORMS_ASSET_URI . '/images/form-template/employee_information.png'; | |
| 16 | - $this->category = 'employment'; | |
| 17 | - } | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * Get the form fields | |
| 21 | - * | |
| 22 | - * @return array | |
| 23 | - */ | |
| 24 | - public function get_form_fields() { | |
| 25 | - $all_fields = $this->get_available_fields(); | |
| 26 | - | |
| 27 | - $form_fields = [ | |
| 28 | - array_merge( $all_fields['step_start']->get_field_props(), [ | |
| 29 | - 'label' => __( 'Personal Information', 'weforms' ), | |
| 30 | - 'name' => 'personal_information', | |
| 31 | - 'step_start' => [ | |
| 32 | - 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 33 | - 'next_button_text' => __( 'Next', 'weforms' ), | |
| 34 | - ], | |
| 35 | - ] ), | |
| 36 | - | |
| 37 | - array_merge( $all_fields['name_field']->get_field_props(), [ | |
| 38 | - 'required' => 'yes', | |
| 39 | - 'format' => 'first-middle-last', | |
| 40 | - 'first_name' => [ | |
| 41 | - 'placeholder' => '', | |
| 42 | - 'default' => '', | |
| 43 | - 'sub' => __( 'First', 'weforms' ), | |
| 44 | - ], | |
| 45 | - | |
| 46 | - 'middle_name' => [ | |
| 47 | - 'placeholder' => '', | |
| 48 | - 'default' => '', | |
| 49 | - 'sub' => __( 'Middle', 'weforms' ), | |
| 50 | - ], | |
| 51 | - 'last_name' => [ | |
| 52 | - 'placeholder' => '', | |
| 53 | - 'default' => '', | |
| 54 | - 'sub' => __( 'Last', 'weforms' ), | |
| 55 | - ], | |
| 56 | - 'hide_subs' => false, | |
| 57 | - 'name' => 'format', | |
| 58 | - ] ), | |
| 59 | - | |
| 60 | - array_merge( $all_fields['address_field']->get_field_props(), [ | |
| 61 | - 'required' => 'yes', | |
| 62 | - 'label' => 'Address', | |
| 63 | - 'name' => 'address', | |
| 64 | - ] ), | |
| 65 | - | |
| 66 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 67 | - 'required' => 'yes', | |
| 68 | - 'label' => __( 'Phone Number', 'weforms' ), | |
| 69 | - 'name' => 'phone_number', | |
| 70 | - ] ), | |
| 71 | - | |
| 72 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 73 | - 'label' => __( 'Alt. Phone Number', 'weforms' ), | |
| 74 | - 'name' => 'alt_phone_number', | |
| 75 | - ] ), | |
| 76 | - | |
| 77 | - array_merge( $all_fields['email_address']->get_field_props(), [ | |
| 78 | - 'label' => __( 'Email Address', 'weforms' ), | |
| 79 | - 'name' => 'email_address', | |
| 80 | - ] ), | |
| 81 | - | |
| 82 | - array_merge( $all_fields['date_field']->get_field_props(), [ | |
| 83 | - 'label' => __( 'Birth Date', 'weforms' ), | |
| 84 | - 'name' => 'birth_date', | |
| 85 | - ] ), | |
| 86 | - | |
| 87 | - array_merge( $all_fields['dropdown_field']->get_field_props(), [ | |
| 88 | - 'label' => __( 'Marital Status', 'weforms' ), | |
| 89 | - 'name' => 'marital_status', | |
| 90 | - 'options' => [ | |
| 91 | - 'single' => __( 'Single', 'weforms' ), | |
| 92 | - 'married' => __( 'Married', 'weforms' ), | |
| 93 | - 'widowed' => __( 'Widowed', 'weforms' ), | |
| 94 | - 'divorced' => __( 'Divorced', 'weforms' ), | |
| 95 | - ], | |
| 96 | - | |
| 97 | - 'first' => ' ', | |
| 98 | - ] ), | |
| 99 | - | |
| 100 | - array_merge( $all_fields['name_field']->get_field_props(), [ | |
| 101 | - 'label' => __( 'Spouse\'s Name', 'weforms' ), | |
| 102 | - 'format' => 'first-last', | |
| 103 | - 'first_name' => [ | |
| 104 | - 'placeholder' => '', | |
| 105 | - 'default' => '', | |
| 106 | - 'sub' => __( 'First', 'weforms' ), | |
| 107 | - ], | |
| 108 | - 'last_name' => [ | |
| 109 | - 'placeholder' => '', | |
| 110 | - 'default' => '', | |
| 111 | - 'sub' => __( 'Last', 'weforms' ), | |
| 112 | - ], | |
| 113 | - 'hide_subs' => false, | |
| 114 | - 'name' => 'spause_name', | |
| 115 | - ] ), | |
| 116 | - | |
| 117 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 118 | - 'label' => __( 'Spouse\' s Work Phone', 'weforms' ), | |
| 119 | - 'name' => 'spouse_work_phone_number', | |
| 120 | - ] ), | |
| 121 | - | |
| 122 | - array_merge( $all_fields['step_start']->get_field_props(), [ | |
| 123 | - 'label' => __( 'Job Information', 'weforms' ), | |
| 124 | - 'name' => 'job_information', | |
| 125 | - 'step_start' => [ | |
| 126 | - 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 127 | - 'next_button_text' => __( 'Next', 'weforms' ), | |
| 128 | - ], | |
| 129 | - ] ), | |
| 130 | - | |
| 131 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 132 | - 'label' => __( 'Title', 'weforms' ), | |
| 133 | - 'name' => 'title', | |
| 134 | - ] ), | |
| 135 | - | |
| 136 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 137 | - 'label' => __( 'Employee ID', 'weforms' ), | |
| 138 | - 'name' => 'employee_id', | |
| 139 | - ] ), | |
| 140 | - | |
| 141 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 142 | - 'label' => __( 'Supervisor', 'weforms' ), | |
| 143 | - 'name' => 'supervisor', | |
| 144 | - ] ), | |
| 145 | - | |
| 146 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 147 | - 'label' => __( 'Department', 'weforms' ), | |
| 148 | - 'name' => 'department', | |
| 149 | - ] ), | |
| 150 | - | |
| 151 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 152 | - 'label' => __( 'Work Location', 'weforms' ), | |
| 153 | - 'name' => 'work_location', | |
| 154 | - ] ), | |
| 155 | - | |
| 156 | - array_merge( $all_fields['email_address']->get_field_props(), [ | |
| 157 | - 'label' => __( 'Email Address', 'weforms' ), | |
| 158 | - 'name' => 'work_email_address', | |
| 159 | - ] ), | |
| 160 | - | |
| 161 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 162 | - 'label' => __( 'Work Number', 'weforms' ), | |
| 163 | - 'name' => 'work_number', | |
| 164 | - ] ), | |
| 165 | - | |
| 166 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 167 | - 'label' => __( 'Cell Phone', 'weforms' ), | |
| 168 | - 'name' => 'cell_phone', | |
| 169 | - ] ), | |
| 170 | - | |
| 171 | - array_merge( $all_fields['date_field']->get_field_props(), [ | |
| 172 | - 'label' => __( 'Start Date', 'weforms' ), | |
| 173 | - 'name' => 'start_date', | |
| 174 | - ] ), | |
| 175 | - | |
| 176 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 177 | - 'label' => __( 'Salary', 'weforms' ), | |
| 178 | - 'name' => 'salary', | |
| 179 | - 'placeholder' => '$', | |
| 180 | - ] ), | |
| 181 | - | |
| 182 | - array_merge( $all_fields['step_start']->get_field_props(), [ | |
| 183 | - 'label' => __( 'Emergency Contact information', 'weforms' ), | |
| 184 | - 'name' => 'emergency_contact_information', | |
| 185 | - 'step_start' => [ | |
| 186 | - 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 187 | - 'next_button_text' => __( 'Next', 'weforms' ), | |
| 188 | - ], | |
| 189 | - ] ), | |
| 190 | - | |
| 191 | - array_merge( $all_fields['name_field']->get_field_props(), [ | |
| 192 | - 'format' => 'first-last', | |
| 193 | - 'first_name' => [ | |
| 194 | - 'placeholder' => '', | |
| 195 | - 'default' => '', | |
| 196 | - 'sub' => __( 'First', 'weforms' ), | |
| 197 | - ], | |
| 198 | - | |
| 199 | - 'last_name' => [ | |
| 200 | - 'placeholder' => '', | |
| 201 | - 'default' => '', | |
| 202 | - 'sub' => __( 'Last', 'weforms' ), | |
| 203 | - ], | |
| 204 | - 'hide_subs' => false, | |
| 205 | - 'name' => 'emargency_person_name', | |
| 206 | - ] ), | |
| 207 | - | |
| 208 | - array_merge( $all_fields['name_field']->get_field_props(), [ | |
| 209 | - 'label' => __( 'Address', 'weforms' ), | |
| 210 | - 'name' => 'emargency_address', | |
| 211 | - ] ), | |
| 212 | - | |
| 213 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 214 | - 'label' => 'Phone Number', | |
| 215 | - 'name' => 'ematgency_phone_number', | |
| 216 | - ] ), | |
| 217 | - | |
| 218 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 219 | - 'label' => 'Alt. Phone Number', | |
| 220 | - 'name' => 'alt_ematgency_phone_number', | |
| 221 | - ] ), | |
| 222 | - | |
| 223 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 224 | - 'label' => 'Relationship', | |
| 225 | - 'name' => 'relationship', | |
| 226 | - ] ), | |
| 227 | - ]; | |
| 228 | - | |
| 229 | - return $form_fields; | |
| 230 | - } | |
| 231 | - | |
| 232 | - /** | |
| 233 | - * Get the form settings | |
| 234 | - * | |
| 235 | - * @return array | |
| 236 | - */ | |
| 237 | - public function get_form_settings() { | |
| 238 | - $defaults = $this->get_default_settings(); | |
| 239 | - | |
| 240 | - return array_merge( $defaults, [ | |
| 241 | - 'submit_text' => __( 'Submit', 'weforms' ), | |
| 242 | - 'label_position' => 'above', | |
| 243 | - 'enable_multistep' => true, | |
| 244 | - 'multistep_progressbar_type' => 'step_by_step', | |
| 245 | - ] ); | |
| 246 | - } | |
| 247 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Blank form template | |
| 5 | + */ | |
| 6 | +class WeForms_Template_Employee_Information extends WeForms_Form_Template { | |
| 7 | + | |
| 8 | + public function __construct() { | |
| 9 | + parent::__construct(); | |
| 10 | + | |
| 11 | + $this->enabled = class_exists( 'WeForms_Pro' ); | |
| 12 | + $this->title = __( 'Employee Information', 'weforms' ); | |
| 13 | + $this->description = __( 'Keep a record of your employee’s information with this form. This includes personal information, job information and emergency contact information sections.', 'weforms' ); | |
| 14 | + $this->category = 'default'; | |
| 15 | + $this->image = WEFORMS_ASSET_URI . '/images/form-template/employee_information.png'; | |
| 16 | + $this->category = 'employment'; | |
| 17 | + | |
| 18 | + } | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * Get the form fields | |
| 22 | + * | |
| 23 | + * @return array | |
| 24 | + */ | |
| 25 | + public function get_form_fields() { | |
| 26 | + $all_fields = $this->get_available_fields(); | |
| 27 | + | |
| 28 | + $form_fields = array( | |
| 29 | + array_merge( $all_fields['step_start']->get_field_props(), array( | |
| 30 | + 'label' => __( 'Personal Information', 'weforms' ), | |
| 31 | + 'name' => 'personal_information', | |
| 32 | + 'step_start' => array( | |
| 33 | + 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 34 | + 'next_button_text' => __( 'Next', 'weforms' ) | |
| 35 | + ), | |
| 36 | + ) ), | |
| 37 | + | |
| 38 | + array_merge( $all_fields['name_field']->get_field_props(), array( | |
| 39 | + 'required' => 'yes', | |
| 40 | + 'format' => 'first-middle-last', | |
| 41 | + 'first_name' => array( | |
| 42 | + 'placeholder' => '', | |
| 43 | + 'default' => '', | |
| 44 | + 'sub' => __( 'First', 'weforms' ) | |
| 45 | + ), | |
| 46 | + | |
| 47 | + 'middle_name' => array( | |
| 48 | + 'placeholder' => '', | |
| 49 | + 'default' => '', | |
| 50 | + 'sub' => __( 'Middle', 'weforms' ) | |
| 51 | + ), | |
| 52 | + 'last_name' => array( | |
| 53 | + 'placeholder' => '', | |
| 54 | + 'default' => '', | |
| 55 | + 'sub' => __( 'Last', 'weforms' ) | |
| 56 | + ), | |
| 57 | + 'hide_subs' => false, | |
| 58 | + 'name' => 'format', | |
| 59 | + ) ), | |
| 60 | + | |
| 61 | + array_merge( $all_fields['address_field']->get_field_props(), array( | |
| 62 | + 'required' => 'yes', | |
| 63 | + 'label' => 'Address', | |
| 64 | + 'name' => 'address', | |
| 65 | + ) ), | |
| 66 | + | |
| 67 | + array_merge( $all_fields['numeric_text_field']->get_field_props(), array( | |
| 68 | + 'required' => 'yes', | |
| 69 | + 'label' => __( 'Phone Number', 'weforms' ), | |
| 70 | + 'name' => 'phone_number', | |
| 71 | + ) ), | |
| 72 | + | |
| 73 | + array_merge( $all_fields['numeric_text_field']->get_field_props(), array( | |
| 74 | + 'label' => __( 'Alt. Phone Number', 'weforms' ), | |
| 75 | + 'name' => 'alt_phone_number', | |
| 76 | + ) ), | |
| 77 | + | |
| 78 | + array_merge( $all_fields['email_address']->get_field_props(), array( | |
| 79 | + 'label' => __( 'Email Address', 'weforms' ), | |
| 80 | + 'name' => 'email_address', | |
| 81 | + ) ), | |
| 82 | + | |
| 83 | + array_merge( $all_fields['date_field']->get_field_props(), array( | |
| 84 | + 'label' => __( 'Birth Date', 'weforms' ), | |
| 85 | + 'name' => 'birth_date', | |
| 86 | + ) ), | |
| 87 | + | |
| 88 | + array_merge( $all_fields['dropdown_field']->get_field_props(), array( | |
| 89 | + 'label' => __( 'Marital Status', 'weforms' ), | |
| 90 | + 'name' => 'marital_status', | |
| 91 | + 'options' => array( | |
| 92 | + 'single' => __('Single', 'weforms'), | |
| 93 | + 'married' => __('Married', 'weforms'), | |
| 94 | + 'widowed' => __('Widowed', 'weforms'), | |
| 95 | + 'divorced' => __('Divorced', 'weforms'), | |
| 96 | + ), | |
| 97 | + | |
| 98 | + 'first' => ' ', | |
| 99 | + ) ), | |
| 100 | + | |
| 101 | + array_merge( $all_fields['name_field']->get_field_props(), array( | |
| 102 | + 'label' => __('Spouse\'s Name', 'weforms'), | |
| 103 | + 'format' => 'first-last', | |
| 104 | + 'first_name' => array( | |
| 105 | + 'placeholder' => '', | |
| 106 | + 'default' => '', | |
| 107 | + 'sub' => __( 'First', 'weforms' ) | |
| 108 | + ), | |
| 109 | + 'last_name' => array( | |
| 110 | + 'placeholder' => '', | |
| 111 | + 'default' => '', | |
| 112 | + 'sub' => __( 'Last', 'weforms' ) | |
| 113 | + ), | |
| 114 | + 'hide_subs' => false, | |
| 115 | + 'name' => 'spause_name', | |
| 116 | + ) ), | |
| 117 | + | |
| 118 | + array_merge( $all_fields['numeric_text_field']->get_field_props(), array( | |
| 119 | + 'label' => __( 'Spouse\' s Work Phone', 'weforms' ), | |
| 120 | + 'name' => 'spouse_work_phone_number', | |
| 121 | + ) ), | |
| 122 | + | |
| 123 | + array_merge( $all_fields['step_start']->get_field_props(), array( | |
| 124 | + 'label' => __( 'Job Information', 'weforms' ), | |
| 125 | + 'name' => 'job_information', | |
| 126 | + 'step_start' => array( | |
| 127 | + 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 128 | + 'next_button_text' => __( 'Next', 'weforms' ) | |
| 129 | + ), | |
| 130 | + ) ), | |
| 131 | + | |
| 132 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 133 | + 'label' => __( 'Title', 'weforms' ), | |
| 134 | + 'name' => 'title' | |
| 135 | + ) ), | |
| 136 | + | |
| 137 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 138 | + 'label' => __( 'Employee ID', 'weforms' ), | |
| 139 | + 'name' => 'employee_id' | |
| 140 | + ) ), | |
| 141 | + | |
| 142 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 143 | + 'label' => __( 'Supervisor', 'weforms' ), | |
| 144 | + 'name' => 'supervisor' | |
| 145 | + ) ), | |
| 146 | + | |
| 147 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 148 | + 'label' => __( 'Department', 'weforms' ), | |
| 149 | + 'name' => 'department' | |
| 150 | + ) ), | |
| 151 | + | |
| 152 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 153 | + 'label' => __( 'Work Location', 'weforms' ), | |
| 154 | + 'name' => 'work_location' | |
| 155 | + ) ), | |
| 156 | + | |
| 157 | + array_merge( $all_fields['email_address']->get_field_props(), array( | |
| 158 | + 'label' => __( 'Email Address', 'weforms' ), | |
| 159 | + 'name' => 'work_email_address' | |
| 160 | + ) ), | |
| 161 | + | |
| 162 | + array_merge( $all_fields['numeric_text_field']->get_field_props(), array( | |
| 163 | + 'label' => __( 'Work Number', 'weforms' ), | |
| 164 | + 'name' => 'work_number', | |
| 165 | + ) ), | |
| 166 | + | |
| 167 | + array_merge( $all_fields['numeric_text_field']->get_field_props(), array( | |
| 168 | + 'label' => __( 'Cell Phone', 'weforms' ), | |
| 169 | + 'name' => 'cell_phone', | |
| 170 | + ) ), | |
| 171 | + | |
| 172 | + array_merge( $all_fields['date_field']->get_field_props(), array( | |
| 173 | + 'label' => __( 'Start Date', 'weforms' ), | |
| 174 | + 'name' => 'start_date', | |
| 175 | + ) ), | |
| 176 | + | |
| 177 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 178 | + 'label' => __( 'Salary', 'weforms' ), | |
| 179 | + 'name' => 'salary', | |
| 180 | + 'placeholder' => '$' | |
| 181 | + ) ), | |
| 182 | + | |
| 183 | + array_merge( $all_fields['step_start']->get_field_props(), array( | |
| 184 | + 'label' => __( 'Emergency Contact information', 'weforms' ), | |
| 185 | + 'name' => 'emergency_contact_information', | |
| 186 | + 'step_start' => array( | |
| 187 | + 'prev_button_text' => __( 'Previous', 'weforms' ), | |
| 188 | + 'next_button_text' => __( 'Next', 'weforms' ) | |
| 189 | + ), | |
| 190 | + ) ), | |
| 191 | + | |
| 192 | + array_merge( $all_fields['name_field']->get_field_props(), array( | |
| 193 | + 'format' => 'first-last', | |
| 194 | + 'first_name' => array( | |
| 195 | + 'placeholder' => '', | |
| 196 | + 'default' => '', | |
| 197 | + 'sub' => __( 'First', 'weforms' ) | |
| 198 | + ), | |
| 199 | + | |
| 200 | + 'last_name' => array( | |
| 201 | + 'placeholder' => '', | |
| 202 | + 'default' => '', | |
| 203 | + 'sub' => __( 'Last', 'weforms' ) | |
| 204 | + ), | |
| 205 | + 'hide_subs' => false, | |
| 206 | + 'name' => 'emargency_person_name', | |
| 207 | + ) ), | |
| 208 | + | |
| 209 | + array_merge( $all_fields['name_field']->get_field_props(), array( | |
| 210 | + 'label' => __('Address', 'weforms'), | |
| 211 | + 'name' => 'emargency_address', | |
| 212 | + ) ), | |
| 213 | + | |
| 214 | + array_merge($all_fields['numeric_text_field']->get_field_props(), array( | |
| 215 | + 'label' => 'Phone Number', | |
| 216 | + 'name' => 'ematgency_phone_number', | |
| 217 | + )), | |
| 218 | + | |
| 219 | + array_merge($all_fields['numeric_text_field']->get_field_props(), array( | |
| 220 | + 'label' => 'Alt. Phone Number', | |
| 221 | + 'name' => 'alt_ematgency_phone_number', | |
| 222 | + )), | |
| 223 | + | |
| 224 | + array_merge($all_fields['text_field']->get_field_props(), array( | |
| 225 | + 'label' => 'Relationship', | |
| 226 | + 'name' => 'relationship', | |
| 227 | + )), | |
| 228 | + | |
| 229 | + ); | |
| 230 | + | |
| 231 | + return $form_fields; | |
| 232 | + } | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + /** | |
| 237 | + * Get the form settings | |
| 238 | + * | |
| 239 | + * @return array | |
| 240 | + */ | |
| 241 | + public function get_form_settings() { | |
| 242 | + $defaults = $this->get_default_settings(); | |
| 243 | + | |
| 244 | + return array_merge( $defaults, array( | |
| 245 | + 'submit_text' => __( 'Submit', 'weforms' ), | |
| 246 | + 'label_position' => 'above', | |
| 247 | + 'enable_multistep' => true, | |
| 248 | + 'multistep_progressbar_type' => 'step_by_step', | |
| 249 | + ) ); | |
| 250 | + } | |
| 251 | + | |
| 252 | +} | |