← All changes
|
includes/templates/class-template-leave-request.php
+91
-89
1.6.8
→
1.3.9
View file →
| @@ -1,89 +1,91 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Blank form template | |
| 5 | - */ | |
| 6 | -class WeForms_Template_Leave_Request extends WeForms_Form_Template { | |
| 7 | - | |
| 8 | - public function __construct() { | |
| 9 | - parent::__construct(); | |
| 10 | - | |
| 11 | - $this->enabled = true; | |
| 12 | - $this->title = __( 'Request for Leave', 'weforms' ); | |
| 13 | - $this->description = __( 'Get an instant leave request from your employees with this easy to fill-out a request form and get details without any conflicts.', 'weforms' ); | |
| 14 | - $this->image = WEFORMS_ASSET_URI . '/images/form-template/leave_request.png'; | |
| 15 | - $this->category = 'employment'; | |
| 16 | - } | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * Get the form fields | |
| 20 | - * | |
| 21 | - * @return array | |
| 22 | - */ | |
| 23 | - public function get_form_fields() { | |
| 24 | - $all_fields = $this->get_available_fields(); | |
| 25 | - | |
| 26 | - $form_fields = [ | |
| 27 | - array_merge( $all_fields['name_field']->get_field_props(), [ | |
| 28 | - 'requied' => 'yes', | |
| 29 | - 'label' => __( 'Name', 'weforms' ), | |
| 30 | - 'format' => 'first-last', | |
| 31 | - 'name' => 'format', | |
| 32 | - ] ), | |
| 33 | - | |
| 34 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 35 | - 'requied' => 'yes', | |
| 36 | - 'label' => __( 'Employee ID', 'weforms' ), | |
| 37 | - 'name' => 'employee_id', | |
| 38 | - ] ), | |
| 39 | - | |
| 40 | - array_merge( $all_fields['numeric_text_field']->get_field_props(), [ | |
| 41 | - 'required' => 'yes', | |
| 42 | - 'label' => __( 'Phone Number', 'weforms' ), | |
| 43 | - 'name' => 'phone_number', | |
| 44 | - ] ), | |
| 45 | - | |
| 46 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 47 | - 'label' => __( 'Position', 'weforms' ), | |
| 48 | - 'name' => 'position', | |
| 49 | - ] ), | |
| 50 | - | |
| 51 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 52 | - 'required' => 'yes', | |
| 53 | - 'label' => __( 'Manager', 'weforms' ), | |
| 54 | - 'name' => 'manager', | |
| 55 | - ] ), | |
| 56 | - | |
| 57 | - array_merge( $all_fields['date_field']->get_field_props(), [ | |
| 58 | - 'required' => 'yes', | |
| 59 | - 'label' => __( 'Leave Start', 'weforms' ), | |
| 60 | - 'name' => 'leave_start', | |
| 61 | - ] ), | |
| 62 | - | |
| 63 | - array_merge( $all_fields['date_field']->get_field_props(), [ | |
| 64 | - 'required' => 'yes', | |
| 65 | - 'label' => __( 'Leave End', 'weforms' ), | |
| 66 | - 'name' => 'leave_end', | |
| 67 | - ] ), | |
| 68 | - | |
| 69 | - array_merge( $all_fields['radio_field']->get_field_props(), [ | |
| 70 | - 'required' => 'yes', | |
| 71 | - 'label' => __( 'Leave Type', 'weforms' ), | |
| 72 | - 'name' => 'leave_type', | |
| 73 | - 'options' => [ | |
| 74 | - 'vacation' => 'Vacation', | |
| 75 | - 'sick' => 'Sick', | |
| 76 | - 'quitting' => 'Quitting', | |
| 77 | - 'other' => 'Other', | |
| 78 | - ], | |
| 79 | - ] ), | |
| 80 | - | |
| 81 | - array_merge( $all_fields['textarea_field']->get_field_props(), [ | |
| 82 | - 'label' => __( 'Comments', 'weforms' ), | |
| 83 | - 'name' => 'comment', | |
| 84 | - ] ), | |
| 85 | - ]; | |
| 86 | - | |
| 87 | - return $form_fields; | |
| 88 | - } | |
| 89 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Blank form template | |
| 5 | + */ | |
| 6 | +class WeForms_Template_Leave_Request extends WeForms_Form_Template { | |
| 7 | + | |
| 8 | + public function __construct() { | |
| 9 | + parent::__construct(); | |
| 10 | + | |
| 11 | + $this->enabled = true; | |
| 12 | + $this->title = __( 'Request for Leave', 'weforms' ); | |
| 13 | + $this->description = __( 'Get an instant leave request from your employees with this easy to fill-out a request form and get details without any conflicts.', 'weforms' ); | |
| 14 | + $this->image = WEFORMS_ASSET_URI . '/images/form-template/leave_request.png'; | |
| 15 | + $this->category = 'employment'; | |
| 16 | + } | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * Get the form fields | |
| 20 | + * | |
| 21 | + * @return array | |
| 22 | + */ | |
| 23 | + public function get_form_fields() { | |
| 24 | + $all_fields = $this->get_available_fields(); | |
| 25 | + | |
| 26 | + $form_fields = array( | |
| 27 | + | |
| 28 | + array_merge($all_fields['name_field']->get_field_props(), array( | |
| 29 | + 'requied' => 'yes', | |
| 30 | + 'label' => __('Name', 'weforms'), | |
| 31 | + 'format' => 'first-last', | |
| 32 | + 'name' => 'format', | |
| 33 | + )), | |
| 34 | + | |
| 35 | + array_merge($all_fields['numeric_text_field']->get_field_props(), array( | |
| 36 | + 'requied' => 'yes', | |
| 37 | + 'label' => __('Employee ID', 'weforms'), | |
| 38 | + 'name' => 'employee_id', | |
| 39 | + )), | |
| 40 | + | |
| 41 | + array_merge($all_fields['numeric_text_field']->get_field_props(), array( | |
| 42 | + 'required' => 'yes', | |
| 43 | + 'label' => __('Phone Number', 'weforms'), | |
| 44 | + 'name' => 'phone_number', | |
| 45 | + )), | |
| 46 | + | |
| 47 | + array_merge($all_fields['text_field']->get_field_props(), array( | |
| 48 | + 'label' => __('Position', 'weforms'), | |
| 49 | + 'name' => 'position', | |
| 50 | + )), | |
| 51 | + | |
| 52 | + array_merge($all_fields['text_field']->get_field_props(), array( | |
| 53 | + 'required' => 'yes', | |
| 54 | + 'label' => __('Manager', 'weforms'), | |
| 55 | + 'name' => 'manager', | |
| 56 | + )), | |
| 57 | + | |
| 58 | + array_merge($all_fields['date_field']->get_field_props(), array( | |
| 59 | + 'required' => 'yes', | |
| 60 | + 'label' => __('Leave Start', 'weforms'), | |
| 61 | + 'name' => 'leave_start', | |
| 62 | + )), | |
| 63 | + | |
| 64 | + array_merge($all_fields['date_field']->get_field_props(), array( | |
| 65 | + 'required' => 'yes', | |
| 66 | + 'label' => __('Leave End', 'weforms'), | |
| 67 | + 'name' => 'leave_end', | |
| 68 | + )), | |
| 69 | + | |
| 70 | + array_merge($all_fields['radio_field']->get_field_props(), array( | |
| 71 | + 'required' => 'yes', | |
| 72 | + 'label' => __('Leave Type', 'weforms'), | |
| 73 | + 'name' => 'leave_type', | |
| 74 | + 'options' => array( | |
| 75 | + 'vacation' => 'Vacation', | |
| 76 | + 'sick' => 'Sick', | |
| 77 | + 'quitting' => 'Quitting', | |
| 78 | + 'other' => 'Other', | |
| 79 | + ), | |
| 80 | + )), | |
| 81 | + | |
| 82 | + array_merge($all_fields['textarea_field']->get_field_props(), array( | |
| 83 | + 'label' => __('Comments', 'weforms'), | |
| 84 | + 'name' => 'comment', | |
| 85 | + )), | |
| 86 | + ); | |
| 87 | + | |
| 88 | + return $form_fields; | |
| 89 | + } | |
| 90 | + | |
| 91 | +} | |