course
3 years ago
course-add-edd-product-metabox.php
3 years ago
course-add-product-metabox.php
3 years ago
course-additional-data.php
3 years ago
course-contents.php
3 years ago
course-level-metabox.php
3 years ago
course-topics.php
3 years ago
instructors-metabox.php
3 years ago
lesson-attachments-metabox.php
3 years ago
lesson-metabox.php
3 years ago
product-selection.php
3 years ago
settings-tabs.php
3 years ago
user-profile-fields.php
2 years ago
video-metabox.php
3 years ago
settings-tabs.php
214 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Settings meta box template |
| 4 | * |
| 5 | * @package Tutor\Views |
| 6 | * @subpackage Tutor\MetaBox |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 1.0.0 |
| 10 | */ |
| 11 | |
| 12 | $args = $this->args; |
| 13 | |
| 14 | ?> |
| 15 | |
| 16 | <div id="tutor-metabox-course-settings-tabs" class="tutor-course-settings-tabs"> |
| 17 | <div class="course-settings-tabs-container"> |
| 18 | <div class="settings-tabs-navs-wrap"> |
| 19 | <ul class="settings-tabs-navs"> |
| 20 | <?php |
| 21 | $i = 0; |
| 22 | foreach ( $args as $key => $arg ) { |
| 23 | $i++; |
| 24 | |
| 25 | $active = 1 === $i ? 'active' : ''; |
| 26 | |
| 27 | $label = tutor_utils()->array_get( 'label', $arg ); |
| 28 | $icon_class = tutor_utils()->array_get( 'icon_class', $arg ); |
| 29 | $url = add_query_arg( array( 'settings_tab' => $key ) ); |
| 30 | |
| 31 | $icon = ''; |
| 32 | if ( $icon_class ) { |
| 33 | $icon = $icon_class; |
| 34 | } |
| 35 | ?> |
| 36 | <li class="<?php echo esc_attr( $active ); ?>"> |
| 37 | <a href="<?php echo esc_url( $url ); ?>" data-target="#settings-tab-<?php echo esc_attr( $key ); ?>"> |
| 38 | <i class="<?php echo esc_attr( $icon ); ?>"></i> <?php echo esc_html( $label ); ?> |
| 39 | </a> |
| 40 | </li> |
| 41 | <?php |
| 42 | } |
| 43 | ?> |
| 44 | </ul> |
| 45 | </div> |
| 46 | |
| 47 | <div class="settings-tabs-container"> |
| 48 | <?php |
| 49 | |
| 50 | $i = 0; |
| 51 | |
| 52 | foreach ( $args as $key => $tab ) { |
| 53 | $i++; |
| 54 | |
| 55 | $label = tutor_utils()->array_get( 'label', $tab ); |
| 56 | $callback = tutor_utils()->array_get( 'callback', $tab ); |
| 57 | $fields = tutor_utils()->array_get( 'fields', $tab ); |
| 58 | |
| 59 | // Set first tab as active. |
| 60 | $active = 1 === $i ? 'active' : ''; |
| 61 | $display = 1 === $i ? 'block' : 'none'; |
| 62 | ?> |
| 63 | |
| 64 | <div id="settings-tab-<?php echo esc_attr( $key ); ?>" class="settings-tab-wrap <?php echo esc_attr( $active ); ?>" style="display: <?php echo esc_attr( $display ); ?>;"> |
| 65 | <?php |
| 66 | do_action( 'tutor_course/settings_tab_content/before', $key, $tab ); |
| 67 | do_action( "tutor_course/settings_tab_content/before/{$key}", $tab ); |
| 68 | |
| 69 | |
| 70 | if ( tutor_utils()->count( $fields ) ) { |
| 71 | foreach ( $fields as $field_key => $field ) { |
| 72 | $type = tutor_utils()->array_get( 'type', $field ); |
| 73 | $value = tutor_utils()->array_get( 'value', $field ); |
| 74 | |
| 75 | if ( 'line_break' == $type ) { |
| 76 | echo '<hr class="tutor-mb-32"/>'; |
| 77 | continue; |
| 78 | } |
| 79 | ?> |
| 80 | <div class="tutor-row tutor-mb-32 <?php if( 'Content Drip Type' === $field['label'] ): echo esc_attr( 'content-drip-options-wrapper' ); endif; ?>"> |
| 81 | <?php |
| 82 | $second_class = 'tutor-col-12'; |
| 83 | $_vertical = isset( $field['is_vertical'] ) ? $field['is_vertical'] : false; |
| 84 | |
| 85 | if ( ! empty( $field['label'] ) ) { |
| 86 | $second_class = 'tutor-col-12 ' . ( $_vertical ? '' : 'tutor-col-md-7' ); |
| 87 | ?> |
| 88 | <div class="tutor-col-12 <?php echo esc_attr( $_vertical ? '' : 'tutor-col-md-5' ); ?>"> |
| 89 | <label class="tutor-course-setting-label"> |
| 90 | <?php echo esc_html( $field['label'] ); ?> |
| 91 | </label> |
| 92 | <?php if ( isset( $field['desc'] ) && 'Content Drip Type' === $field['label'] ) { ?> |
| 93 | <p class="tutor-form-feedback"> |
| 94 | <?php echo esc_html( $field['desc'] ); ?> |
| 95 | </p> |
| 96 | <?php } ?> |
| 97 | </div> |
| 98 | <?php |
| 99 | } |
| 100 | ?> |
| 101 | <div class="<?php echo esc_attr( $second_class ); ?>"> |
| 102 | <?php |
| 103 | switch ( $field['type'] ) { |
| 104 | case 'number': |
| 105 | echo '<input class="tutor-form-control" type="number" name="' . esc_attr( $field_key ) . '" value="' . esc_attr( $value ) . '" min="0">'; |
| 106 | break; |
| 107 | |
| 108 | case 'radio': |
| 109 | foreach ( $field['options'] as $value => $label ) { |
| 110 | $id_string = 'course_setting_radio_' . ( ! empty( $field['id'] ) ? $field['id'] : $value ); |
| 111 | ?> |
| 112 | <div class="tutor-my-20 tutor-align-center"> |
| 113 | <div class="tutor-form-check"> |
| 114 | <input type="radio" id="<?php echo esc_attr( $id_string ); ?>" class="tutor-form-check-input tutor-flex-shrink-0" name="<?php echo esc_attr( $field_key ); ?>" value="<?php echo esc_attr( $value ); ?>" <?php echo $value == $field['value'] ? 'checked="checked"' : ''; ?>/> |
| 115 | <label for="<?php echo esc_attr( $id_string ); ?>" class="tutor-fs-7 tutor-fw-medium tutor-fs-6"> |
| 116 | <?php echo esc_attr( $label ); ?> |
| 117 | </label> |
| 118 | </div> |
| 119 | </div> |
| 120 | <?php |
| 121 | } |
| 122 | break; |
| 123 | |
| 124 | case 'checkbox': |
| 125 | case 'toggle_switch': |
| 126 | foreach ( $field['options'] as $option ) { |
| 127 | $fragment = ( ! empty( $field['id'] ) ? $field['id'] : $field['type'] . '_' . $field_key ); |
| 128 | $id_string = 'course_setting_' . $fragment; |
| 129 | |
| 130 | if ( $field['type'] == 'checkbox' ) { |
| 131 | ?> |
| 132 | <div class="tutor-form-check tutor-mb-12"> |
| 133 | <input id="<?php echo esc_attr( $id_string ); ?>" type="checkbox" class="tutor-form-check-input" value="<?php echo isset( $option['value'] ) ? esc_attr( $option['value'] ) : ''; ?>" name="<?php echo esc_attr( $field_key ); ?>" <?php echo $option['checked'] ? 'checked="checked"' : ''; ?>/> |
| 134 | <label for="<?php echo esc_attr( $id_string ); ?>" class="tutor-fs-7 tutor-fw-medium"> |
| 135 | <?php echo esc_html( $option['label_title'] ); ?> |
| 136 | <?php |
| 137 | if ( ! empty( $option['hint'] ) ) { |
| 138 | echo '<span class="tutor-d-block tutor-fs-7">' . esc_html( $option['hint'] ) . '</span>'; |
| 139 | } |
| 140 | ?> |
| 141 | </label> |
| 142 | </div> |
| 143 | <?php |
| 144 | } elseif ( 'toggle_switch' == $field['type'] ) { |
| 145 | ?> |
| 146 | <label class="tutor-form-toggle"> |
| 147 | <input id="<?php echo esc_attr( $id_string ); ?>" type="checkbox" class="tutor-form-toggle-input" name="<?php echo esc_attr( $field_key ); ?>" <?php echo $option['checked'] ? 'checked="checked"' : ''; ?>/> |
| 148 | <span class="tutor-form-toggle-control"></span> <?php echo isset( $option['label_title'] ) ? esc_attr( $option['label_title'] ) : ''; ?> |
| 149 | </label> |
| 150 | <?php |
| 151 | |
| 152 | if ( ! empty( $option['hint'] ) ) { |
| 153 | ?> |
| 154 | <div class="tutor-fs-7 tutor-has-icon tutor-color-muted tutor-d-flex tutor-mt-12"> |
| 155 | <i class="tutor-icon-circle-info-o tutor-mt-4 tutor-mr-8"></i> |
| 156 | <?php echo esc_html( $option['hint'] ); ?> |
| 157 | </div> |
| 158 | <?php |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | break; |
| 163 | |
| 164 | case 'select': |
| 165 | ?> |
| 166 | <select class="tutor-form-select" name="<?php echo esc_attr( $field_key ); ?>" class="tutor_select2"> |
| 167 | <?php |
| 168 | if ( ! empty( $field['options'] ) ) { |
| 169 | foreach ( $field['options'] as $option_key => $option ) { |
| 170 | ?> |
| 171 | <option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $field['value'], $option_key ); ?> > |
| 172 | <?php echo esc_html( $option ); ?> |
| 173 | </option> |
| 174 | <?php |
| 175 | } |
| 176 | } |
| 177 | ?> |
| 178 | </select> |
| 179 | <?php |
| 180 | break; |
| 181 | } |
| 182 | |
| 183 | if ( isset( $field['desc'] ) && 'Content Drip Type' !== $field['label'] ) { |
| 184 | ?> |
| 185 | <div class="tutor-fs-7 tutor-has-icon tutor-color-muted tutor-d-flex tutor-mt-12"> |
| 186 | <i class="tutor-icon-circle-info-o tutor-mt-4 tutor-mr-8"></i> |
| 187 | <?php echo esc_html( $field['desc'] ); ?> |
| 188 | </div> |
| 189 | <?php |
| 190 | } |
| 191 | ?> |
| 192 | </div> |
| 193 | </div> |
| 194 | <?php |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Handling Callback |
| 200 | */ |
| 201 | if ( $callback && is_callable( $callback ) ) { |
| 202 | call_user_func( $callback, $key, $tab ); |
| 203 | } |
| 204 | |
| 205 | do_action( 'tutor_course/settings_tab_content/after', $key, $tab ); |
| 206 | do_action( "tutor_course/settings_tab_content/after/{$key}", $tab ); |
| 207 | |
| 208 | echo '</div>'; |
| 209 | } |
| 210 | ?> |
| 211 | </div> |
| 212 | </div> |
| 213 | </div> |
| 214 |