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.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / views / options / template / legal_consents.php
tutor / views / options / template Last commit date
common 3 months ago basic.php 1 year ago buddypress.php 3 years ago design.php 3 years ago google_classroom.php 3 years ago gradebook.php 3 years ago import_export.php 1 year ago legal_consents.php 1 month ago notifications.php 3 years ago status.php 3 years ago tab.php 1 year ago tutor_pages.php 1 year ago zoom.php 4 years ago
legal_consents.php
257 lines
1 <?php
2 /**
3 * Legal consents settings view.
4 *
5 * @package Tutor\Views
6 * @subpackage Tutor\Settings
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 4.0.0
10 */
11
12 use TUTOR\Icon;
13 use Tutor\Components\SvgIcon;
14 use Tutor\GDPR\Controllers\LegalConsent;
15
16 defined( 'ABSPATH' ) || exit;
17
18 $consents = LegalConsent::get_consents();
19
20 if ( empty( $consents ) ) {
21 $consents = $this->get( 'legal_consents', array() );
22 }
23
24 if ( ! is_array( $consents ) ) {
25 $consents = array();
26 }
27
28 if ( isset( $consents['enabled'] ) || isset( $consents['title'] ) ) {
29 $consents = array( $consents );
30 }
31
32 $display_options = LegalConsent::get_display_place_options();
33 $method_options = LegalConsent::get_consent_method_options();
34 $wp_pages = get_pages(
35 array(
36 'post_type' => 'page',
37 'post_status' => 'publish',
38 'sort_order' => 'ASC',
39 'sort_col' => 'post_title',
40 )
41 );
42 $default_consent = array(
43 'id' => 0,
44 'enabled' => 'off',
45 'title' => __( 'Consent Title', 'tutor' ),
46 'display_on' => array(),
47 'message' => __( 'By continuing, you agree to our Terms of Service and Privacy Policy.', 'tutor' ),
48 'method' => LegalConsent::METHOD_MANDATORY_CHECK,
49 'content_map' => array(),
50 );
51
52 $render_card = function ( array $consent, $index ) use ( $display_options, $method_options, $wp_pages ) {
53 $consent_id = $consent['id'] ?? 0;
54 $enabled = $consent['enabled'] ?? 'off';
55 $title = $consent['title'] ?? '';
56 $display_on = $consent['display_on'] ?? array();
57 $message = $consent['message'] ?? '';
58 $method = $consent['method'] ?? LegalConsent::METHOD_MANDATORY_CHECK;
59 $content_map = $consent['content_map'] ?? array();
60 $is_collapsed = 0 !== (int) $consent['id'];
61 ?>
62 <div class="tutor-legal-consent-card<?php echo $is_collapsed ? ' is-collapsed' : ''; ?>" data-consent-card data-consent-index="<?php echo esc_attr( $index ); ?>" data-consent-id="<?php echo esc_attr( $consent_id ); ?>">
63 <?php tutor_nonce_field(); ?>
64
65 <div class="tutor-legal-consent-card-header">
66 <div class="tutor-legal-consent-card-title tutor-fs-6">
67 <?php SvgIcon::make()->name( Icon::CONTRACT_OUTLINE )->size( 32 )->render(); ?>
68 <span data-consent-title><?php echo esc_html( $title ); ?></span>
69 </div>
70
71 <div class="tutor-legal-consent-header-actions">
72 <label class="tutor-form-toggle">
73 <input type="hidden" value="<?php echo esc_attr( $enabled ); ?>" data-consent-enabled-hidden>
74 <input type="checkbox" class="tutor-form-toggle-input" <?php checked( $enabled, 'on' ); ?> data-consent-enabled>
75 <span class="tutor-form-toggle-control"></span>
76 </label>
77
78 <button type="button" class="tutor-legal-consent-settings-toggle" data-consent-toggle aria-expanded="<?php echo $is_collapsed ? 'false' : 'true'; ?>" aria-label="<?php esc_attr_e( 'Consent settings', 'tutor' ); ?>" <?php disabled( 0 === (int) $consent_id ); ?>>
79 <i class="tutor-icon-slider-horizontal" aria-hidden="true"></i>
80 </button>
81 </div>
82 </div>
83
84 <div class="tutor-legal-consent-card-content" data-consent-content>
85 <div class="tutor-legal-consent-card-body">
86 <div class="tutor-option-field-row">
87 <div class="tutor-option-field-label">
88 <div class="tutor-fs-6 tutor-fw-medium" tutor-option-name><?php esc_html_e( 'Consent Title', 'tutor' ); ?></div>
89 <div class="tutor-fs-7 tutor-color-muted tutor-mt-8"><?php esc_html_e( 'Enter title (visible to admin only)', 'tutor' ); ?></div>
90 </div>
91 <div class="tutor-option-field-input">
92 <input
93 type="text"
94 class="tutor-form-control"
95 placeholder="<?php esc_attr_e( 'Consent Title', 'tutor' ); ?>"
96 value="<?php echo esc_attr( $title ); ?>"
97 data-consent-title-input
98 />
99 </div>
100 </div>
101
102 <div class="tutor-option-field-row">
103 <div class="tutor-option-field-label">
104 <div class="tutor-fs-6 tutor-fw-medium" tutor-option-name><?php esc_html_e( 'Display on', 'tutor' ); ?></div>
105 <div class="tutor-fs-7 tutor-color-muted tutor-mt-8"><?php esc_html_e( 'Where this consent appears', 'tutor' ); ?></div>
106 </div>
107 <div class="tutor-option-field-input">
108 <div class="tutor-legal-consent-checkbox-grid">
109 <?php foreach ( $display_options as $option_key => $option_label ) : ?>
110 <?php $input_id = 'legal_consents_display_on_' . $index . '_' . $option_key; ?>
111 <div class="tutor-form-check">
112 <input
113 type="checkbox"
114 id="<?php echo esc_attr( $input_id ); ?>"
115 value="<?php echo esc_attr( $option_key ); ?>"
116 class="tutor-form-check-input"
117 name="display_on[]"
118 <?php checked( isset( $display_on[ $option_key ] ) ); ?>
119 />
120 <label for="<?php echo esc_attr( $input_id ); ?>"><?php echo esc_html( $option_label ); ?></label>
121 </div>
122 <?php endforeach; ?>
123 </div>
124 </div>
125 </div>
126
127 <div class="tutor-option-field-row">
128 <div class="tutor-option-field-label">
129 <div class="tutor-fs-6 tutor-fw-medium" tutor-option-name><?php esc_html_e( 'Consent Message', 'tutor' ); ?></div>
130 <div class="tutor-fs-7 tutor-color-muted tutor-mt-8"><?php esc_html_e( 'Message shown to users', 'tutor' ); ?></div>
131 </div>
132 <div class="tutor-option-field-input" style="position: relative;">
133 <textarea
134 class="tutor-form-control"
135 rows="5"
136 placeholder="<?php esc_attr_e( 'By continuing, you agree to our Terms of Service and Privacy Policy.', 'tutor' ); ?>"
137 style="padding-right: 44px;"
138 name="consent_message"
139 ><?php echo esc_textarea( $message ); ?></textarea>
140
141 <div class="tutor-legal-consent-page-link-control">
142 <button type="button" class="tutor-iconic-btn tutor-legal-consent-page-link-trigger" data-page-dropdown-toggle aria-expanded="false" aria-label="<?php esc_attr_e( 'Add Page Link', 'tutor' ); ?>" title="<?php esc_attr_e( 'Add Page Link', 'tutor' ); ?>">
143 <i class="tutor-icon-plus-light" aria-hidden="true"></i>
144 </button>
145
146 <div class="tutor-option-dropdown tutor-legal-consent-page-dropdown" data-page-dropdown hidden>
147 <?php foreach ( $wp_pages as $page ) : ?>
148 <?php
149 $page_key = strtolower( preg_replace( '/[^a-z0-9]+/', '_', sanitize_title( $page->post_title ) ) );
150 ?>
151 <button type="button" class="tutor-legal-consent-page-dropdown-item<?php echo isset( $content_map[ $page_key ] ) ? ' is-selected' : ''; ?>" data-page-btn value="<?php echo esc_attr( $page->ID ); ?>" data-page-key="<?php echo esc_attr( $page_key ); ?>" <?php echo isset( $content_map[ $page_key ] ) ? 'disabled' : ''; ?>>
152 <?php echo esc_html( $page->post_title ); ?>
153 </button>
154 <?php endforeach; ?>
155 </div>
156 </div>
157 </div>
158 </div>
159
160 <div class="tutor-option-field-row">
161 <div class="tutor-option-field-label">
162 <div class="tutor-fs-6 tutor-fw-medium" tutor-option-name><?php esc_html_e( 'Consent Method', 'tutor' ); ?></div>
163 <div class="tutor-fs-7 tutor-color-muted tutor-mt-8"><?php esc_html_e( 'How users give consent', 'tutor' ); ?></div>
164 </div>
165 <div class="tutor-option-field-input">
166 <select class="tutor-form-select" name="consent_method">
167 <?php foreach ( $method_options as $option_key => $option_label ) : ?>
168 <option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $method, $option_key ); ?>><?php echo esc_html( $option_label ); ?></option>
169 <?php endforeach; ?>
170 </select>
171 </div>
172 </div>
173 </div>
174
175 <div class="tutor-legal-consent-card-footer">
176 <button type="button" class="tutor-btn tutor-btn-sm tutor-legal-consent-delete-btn" data-consent-delete>
177 <?php esc_html_e( 'Delete', 'tutor' ); ?>
178 </button>
179
180 <div class="tutor-legal-consent-card-footer-actions">
181 <button type="button" class="tutor-btn tutor-btn-sm tutor-btn-ghost" data-consent-cancel>
182 <?php esc_html_e( 'Discard', 'tutor' ); ?>
183 </button>
184
185 <button type="button" class="tutor-btn tutor-btn-sm tutor-btn-primary" data-consent-save>
186 <?php esc_html_e( 'Save Changes', 'tutor' ); ?>
187 </button>
188 </div>
189 </div>
190 </div>
191 </div>
192 <?php
193 };
194 ?>
195
196 <div class="tutor-option-main-title">
197 <div class="tutor-fs-4 tutor-fw-medium tutor-color-black" tutor-option-title><?php echo esc_html( $section['label'] ?? __( 'Legal Consents', 'tutor' ) ); ?></div>
198 </div>
199
200 <div class="tutor-legal-consents" data-legal-consents>
201 <div data-consent-empty-state<?php echo ! empty( $consents ) ? ' hidden' : ''; ?>>
202 <?php tutor_utils()->render_list_empty_state( array( 'title' => __( 'No legal consent yet.', 'tutor' ) ) ); ?>
203
204 <div class="tutor-legal-consents-empty-state-action">
205 <button type="button" class="tutor-btn tutor-btn-outline-primary" data-add-consent>
206 <i class="tutor-icon-plus-light tutor-mr-8" aria-hidden="true"></i>
207 <?php esc_html_e( 'New Consent', 'tutor' ); ?>
208 </button>
209 </div>
210 </div>
211
212 <div class="tutor-legal-consents-list" data-consent-list>
213 <?php foreach ( $consents as $index => $consent ) : ?>
214 <?php $render_card( $consent, $index ); ?>
215 <?php endforeach; ?>
216 </div>
217
218 <div class="tutor-legal-consents-footer" data-consent-footer<?php echo empty( $consents ) ? ' hidden' : ''; ?>>
219 <button type="button" class="tutor-btn tutor-btn-outline-primary" data-add-consent>
220 <i class="tutor-icon-plus-light tutor-mr-8" aria-hidden="true"></i>
221 <?php esc_html_e( 'New Consent', 'tutor' ); ?>
222 </button>
223 </div>
224
225 <template data-consent-template>
226 <?php $render_card( $default_consent, '__INDEX__' ); ?>
227 </template>
228 </div>
229
230 <div id="tutor-legal-consent-delete-modal" class="tutor-modal" role="dialog" aria-modal="true" aria-hidden="true">
231 <div class="tutor-modal-overlay"></div>
232 <div class="tutor-modal-window">
233 <div class="tutor-modal-content tutor-modal-content-white">
234 <button type="button" class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close aria-label="<?php esc_attr_e( 'Close', 'tutor' ); ?>">
235 <span class="tutor-icon-times" aria-hidden="true"></span>
236 </button>
237
238 <div class="tutor-modal-body tutor-text-center">
239 <div class="tutor-mt-48">
240 <img class="tutor-d-inline-block" src="<?php echo esc_url( tutor()->url ); ?>assets/images/icon-trash.svg" alt="" aria-hidden="true" />
241 </div>
242
243 <div class="tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mb-12"><?php esc_html_e( 'Delete Consent?', 'tutor' ); ?></div>
244 <div class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Are you sure you want to permanently delete this consent?', 'tutor' ); ?></div>
245 <div class="tutor-d-flex tutor-justify-center tutor-my-48">
246 <button type="button" class="tutor-btn tutor-btn-outline-primary" data-tutor-modal-close>
247 <?php esc_html_e( 'Cancel', 'tutor' ); ?>
248 </button>
249 <button type="button" class="tutor-btn tutor-btn-primary tutor-ml-20" id="tutor-legal-consent-confirm-delete">
250 <?php esc_html_e( 'Delete Consent', 'tutor' ); ?>
251 </button>
252 </div>
253 </div>
254 </div>
255 </div>
256 </div>
257