PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.6.9.2
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.6.9.2
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / inc / admin / views / tools / course / html-user-item.php

html-user-item.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.6.9.2, at inc/admin/views/tools/course/html-user-item.php

97 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @author ThimPress
4 * @package LearnPress/Admin/Views
5 * @version 3.0.0
6 */
7
8 defined( 'ABSPATH' ) or die();
9
10 ?>
11 <div id="learn-press-reset-user-item" class="card">
12 <h2><?php _e( 'Reset item progress for an user', 'learnpress' ); ?></h2>
13 <div class="description">
14 <?php _e( 'This action will reset progress of specific lesson or quiz.', 'learnpress' ); ?>
15 </div>
16 <table>
17 <tr>
18 <td><strong><?php _e( 'User ID or Email', 'learnpress' ); ?></strong></td>
19 <td><strong><?php _e( 'Item ID (ID of quiz or lesson)', 'learnpress' ); ?></strong></td>
20 </tr>
21 <tr>
22 <td><input type="text" v-model="user_id" @keyup="update($event)"></td>
23 <td><input type="text" v-model="item_id" @keyup="update($event)"></td>
24 </tr>
25 </table>
26 <p v-if="message">{{message}}</p>
27 <button class="button" @click="reset($event)"
28 :disabled="resetting || !isValid()"><?php _e( 'Reset', 'learnpress' ); ?></button>
29 </div>
30
31 <?php
32
33 // Translation
34 $localize = array(
35 'reset_course_users' => __( 'Are you sure to reset progress of this item?', 'learnpress' ),
36 );
37 ?>
38 <script>
39 window.$Vue = window.$Vue || Vue;
40
41 jQuery(function ($) {
42 var js_localize = <?php echo wp_json_encode( $localize ); ?>
43
44 new $Vue({
45 el: '#learn-press-reset-user-item',
46 data: {
47 user_id: '',
48 item_id: '',
49 resetting: false,
50 message: ''
51 },
52 watch: {},
53 created: function () {
54
55 },
56 mounted: function () {
57 $(this.$el).closest('form').on('submit', function () {
58 return false;
59 })
60 },
61 methods: {
62 reset: function (e) {
63 e.preventDefault();
64 if (!this.user_id || !this.item_id) {
65 return;
66 }
67 if (!confirm(js_localize.reset_course_users)) {
68 return;
69 }
70 var that = this;
71 this.resetting = true;
72 this.message = '';
73 $.ajax({
74 url: '',
75 data: {
76 'lp-ajax': 'rs-reset-user-item',
77 user_id: this.user_id,
78 item_id: this.item_id
79 },
80 success: function (response) {
81 that.resetting = false;
82 that.message = response;
83 }
84 })
85 },
86 update: function (e) {
87 e.preventDefault();
88 },
89 isValid: function () {
90 return this.user_id && this.item_id;
91 }
92 }
93 });
94 });
95
96 </script>
97