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