Version Description
(2021-12-22) = ~ Added: settings redirect when finish course. ~ Added: enqueue script by shortcode button purchase. ~ Fixed: error save value on the textarea format code HTML. ~ Fixed: error timezone is different UTC-0 will finish quiz soon. ~ Save info total items (quiz, question,...) of course when saving the course - improve performance. ~ Fixed: error change user Guest to another user on LP Order not save. ~ Fixed: Guest buy course with user exists. ~ Fixed: Guest buy course with create account. ~ Fixed: High CPU (many query) when user login view single course. ~ Fixed: No require enroll. ~ Changed: view course's user on the Backend to the profile's user. ~ Modified: submit quiz, get result course, quiz. ~ Fixed: query get orders on Profile page. ~ Fixed: query get orders by user (multiple user) on the Backend. ~ Modified: delete course will delete section, section_items, lp_user_items, user_itemmeta. ~ Saved: info total items of course when save course - to make call fast. ~ Rewrite: function count total items of the Course. ~ Fixed: get course id when click Get Passing Grade in Evaluate via results of the final quiz. ~ Fixed: count Unassigned questions. ~ Changed logic check "fill in blank" question: user answer right all fields will get point of question, one of answer wrong, the question is fail and get point
Release Info
Developer | ThimPress |
Plugin | LearnPress – WordPress LMS Plugin |
Version | 4.1.4.1 |
Comparing to | |
See all releases |
Code changes from version 4.1.4 to 4.1.4.1
- assets/css/learnpress.css +5 -41
- assets/js/dist/admin/editor/course.js +75 -75
- assets/js/dist/admin/editor/question.js +35 -35
- assets/js/dist/admin/editor/quiz.js +80 -80
- assets/js/dist/admin/pages/dashboard.js +5 -5
- assets/js/dist/admin/pages/setup.js +5 -5
- assets/js/dist/admin/pages/statistic.js +5 -5
- assets/js/dist/admin/pages/sync-data.js +5 -5
- assets/js/dist/admin/pages/themes-addons.js +10 -10
- assets/js/dist/admin/pages/tools.js +51 -51
- assets/js/dist/admin/pages/widgets.js +5 -5
- assets/js/dist/frontend/custom.js +5 -5
- assets/js/dist/frontend/lesson.js +5 -5
- assets/js/dist/frontend/lp-configs.js +5 -5
- assets/js/dist/frontend/modal.js +40 -40
- assets/js/dist/frontend/profile.js +15 -15
- assets/js/dist/frontend/question-types.js +59 -47
- assets/js/dist/frontend/question-types.min.js +1 -1
- assets/js/dist/frontend/quiz.js +381 -238
- assets/js/dist/frontend/quiz.min.js +1 -1
- assets/js/dist/frontend/single-course.js +31 -31
- assets/js/dist/frontend/single-curriculum.js +57 -57
- assets/js/dist/frontend/widgets.js +5 -5
- assets/js/dist/js/data-controls.js +5 -5
- assets/js/dist/utils.js +60 -60
- assets/js/frontend/profile.min.js +1 -1
- assets/src/apps/js/frontend/quiz.js +41 -0
- assets/src/apps/js/frontend/quiz/components/attempts/index.js +3 -3
- assets/src/apps/js/frontend/quiz/components/buttons/index.js +11 -7
- assets/src/apps/js/frontend/quiz/components/result/index.js +5 -4
- assets/src/apps/js/frontend/quiz/components/status/index.js +1 -1
- assets/src/apps/js/frontend/quiz/components/timer/index.js +10 -5
- assets/src/apps/js/frontend/quiz/store/actions.js +105 -14
- assets/src/apps/js/frontend/quiz/store/reducer.js +17 -4
- assets/src/apps/js/frontend/quiz/store/selectors.js +3 -11
- assets/src/css/test.css +0 -0
- assets/src/js/frontend/profile.js +1 -1
- inc/admin/class-lp-post-type-actions.php +14 -6
- inc/admin/lp-admin-functions.php +0 -20
- inc/admin/meta-box/class-lp-meta-box-helper.php +3 -0
- inc/admin/settings/class-lp-settings-advanced.php +7 -7
- inc/admin/settings/class-lp-settings-courses.php +14 -2
- inc/admin/views/meta-boxes/course/settings.php +3 -2
- inc/admin/views/meta-boxes/fields/text.php +6 -5
- inc/admin/views/meta-boxes/lp-meta-box-functions.php +65 -48
- inc/admin/views/user/course-progress.php +18 -18
- inc/admin/views/user/courses.php +21 -15
- inc/background-process/class-lp-background-single-course.php +63 -17
- inc/cache/class-lp-cache.php +32 -3
- inc/class-lp-ajax.php +8 -4
- inc/class-lp-assets.php +1 -1
- inc/class-lp-checkout.php +32 -4
- inc/class-lp-global.php +3 -0
- inc/class-lp-page-controller.php +12 -92
- inc/class-lp-repair-database.php +68 -50
- inc/course/abstract-course.php +82 -37
- inc/course/class-lp-course-item.php +0 -4
- inc/course/class-lp-course-no-required-enroll.php +135 -126
- inc/course/class-lp-course.php +119 -3
- inc/course/lp-course-functions.php +32 -21
- inc/curds/class-lp-course-curd.php +12 -6
- inc/curds/class-lp-section-curd.php +4 -2
- inc/curds/class-lp-user-curd.php +191 -176
- inc/custom-post-types/abstract.php +2 -2
- inc/custom-post-types/course.php +23 -6
- inc/custom-post-types/lesson.php +22 -37
- inc/custom-post-types/order.php +16 -12
- inc/custom-post-types/question.php +13 -28
- inc/custom-post-types/quiz.php +8 -13
- inc/databases/class-lp-course-db.php +82 -0
- inc/databases/class-lp-db.php +25 -4
- inc/databases/class-lp-question-db.php +4 -11
- inc/databases/class-lp-quiz-db.php +22 -0
- inc/databases/class-lp-section-db.php +87 -7
- inc/databases/class-lp-user-item-results-db.php +17 -17
- inc/databases/class-lp-user-items-db.php +238 -118
- inc/filters/class-lp-filter.php +4 -0
- inc/filters/class-lp-section-filter.php +32 -0
- inc/filters/class-lp-user-items-filter.php +4 -0
- inc/jwt/class-jwt-auth.php +4 -4
- inc/jwt/includes/class-jwt-public.php +8 -8
- inc/jwt/responsive.http +6 -12
- inc/jwt/rest-api/version1/class-lp-rest-courses-v1-controller.php +131 -24
- inc/jwt/rest-api/version1/class-lp-rest-lessons-v1-controller.php +8 -0
- inc/jwt/rest-api/version1/class-lp-rest-quiz-v1-controller.php +9 -1
- inc/jwt/rest-api/version1/class-lp-rest-users-v1-controller.php +40 -37
- inc/lp-constants.php +3 -1
- inc/lp-core-functions.php +31 -45
- inc/lp-deprecated.php +35 -35
- inc/lp-template-functions.php +1 -4
- inc/lp-template-hooks.php +8 -2
- inc/models/class-lp-course-extra-info-fast-query-model.php +6 -1
- inc/order/class-lp-order.php +12 -4
- inc/question/class-lp-question-fill-in-blanks.php +11 -10
- inc/question/class-lp-question.php +2 -2
- inc/quiz/class-lp-quiz.php +10 -9
- inc/rest-api/v1/admin/class-lp-admin-rest-course-controller.php +1 -1
- inc/rest-api/v1/frontend/class-lp-rest-lazy-load-controller.php +54 -35
- inc/rest-api/v1/frontend/class-lp-rest-users-controller.php +224 -110
- inc/shortcodes/class-lp-shortcode-button-course.php +1 -1
- inc/shortcodes/class-lp-shortcode-button-enroll.php +1 -1
- inc/shortcodes/class-lp-shortcode-button-purchase.php +6 -2
- inc/shortcodes/class-lp-shortcode-profile.php +3 -1
- inc/templates/class-lp-template-course.php +47 -28
- inc/templates/class-lp-template-profile.php +5 -5
- inc/user-item/class-lp-user-item-course.php +443 -125
- inc/user-item/class-lp-user-item-quiz.php +273 -54
- inc/user-item/class-lp-user-item.php +73 -47
- inc/user/abstract-lp-user.php +57 -24
- inc/user/class-lp-profile-tabs.php +2 -2
- inc/user/class-lp-profile.php +5 -3
- inc/user/class-lp-user-factory.php +4 -0
- inc/user/class-lp-user.php +82 -35
- inc/user/lp-user-functions.php +38 -24
- inc/widgets/course-progress.php +16 -13
- languages/learnpress.pot +2 -2
- learnpress.php +16 -12
- readme.txt +24 -2
- templates/checkout/order-received.php +8 -0
- templates/content-quiz/js.php +32 -28
- templates/profile/tabs.php +12 -2
- templates/profile/tabs/courses.php +6 -2
- templates/profile/tabs/courses/course-grid.php +1 -1
- templates/profile/tabs/courses/course-list.php +3 -3
- templates/profile/tabs/quizzes.php +33 -12
- templates/single-course/buttons/purchase.php +3 -3
- templates/single-course/content-item/popup-header.php +5 -14
- templates/single-course/meta/count.php +5 -0
- templates/single-course/section/item-meta.php +1 -1
- templates/single-course/sidebar/user-progress.php +39 -18
- templates/widgets/course-progress.php +3 -6
@@ -2196,6 +2196,9 @@ div.order-recover input[type=text] {
|
|
2196 |
.learn-press-profile-course__tab__inner > li {
|
2197 |
list-style: none;
|
2198 |
}
|
|
|
|
|
|
|
2199 |
.learn-press-profile-course__tab__inner a {
|
2200 |
display: inline-block;
|
2201 |
padding: 15px 30px;
|
@@ -2995,47 +2998,8 @@ body .lp-quiz-buttons .form-button-finish-course {
|
|
2995 |
font-size: inherit;
|
2996 |
}
|
2997 |
|
2998 |
-
.
|
2999 |
-
|
3000 |
-
}
|
3001 |
-
.learn-press-course-results-progress .items-progress,
|
3002 |
-
.learn-press-course-results-progress .course-progress {
|
3003 |
-
float: left;
|
3004 |
-
width: 46%;
|
3005 |
-
margin-right: 4%;
|
3006 |
-
margin-bottom: 30px;
|
3007 |
-
}
|
3008 |
-
.learn-press-course-results-progress .items-progress .items-progress__heading,
|
3009 |
-
.learn-press-course-results-progress .course-progress .items-progress__heading {
|
3010 |
-
margin-bottom: 10px;
|
3011 |
-
}
|
3012 |
-
.learn-press-course-results-progress .items-progress .lp-progress-bar,
|
3013 |
-
.learn-press-course-results-progress .course-progress .lp-progress-bar {
|
3014 |
-
overflow: hidden;
|
3015 |
-
position: relative;
|
3016 |
-
height: 10px;
|
3017 |
-
border-radius: 5px;
|
3018 |
-
}
|
3019 |
-
.learn-press-course-results-progress .items-progress .lp-progress-bar .lp-progress-value,
|
3020 |
-
.learn-press-course-results-progress .course-progress .lp-progress-bar .lp-progress-value {
|
3021 |
-
position: absolute;
|
3022 |
-
width: 100%;
|
3023 |
-
height: 10px;
|
3024 |
-
margin-left: -100%;
|
3025 |
-
border-radius: 5px;
|
3026 |
-
}
|
3027 |
-
.learn-press-course-results-progress .items-progress .lp-course-status .grade.failed,
|
3028 |
-
.learn-press-course-results-progress .course-progress .lp-course-status .grade.failed {
|
3029 |
-
background: #f00;
|
3030 |
-
}
|
3031 |
-
.learn-press-course-results-progress .items-progress .lp-course-status .grade.passed,
|
3032 |
-
.learn-press-course-results-progress .course-progress .lp-course-status .grade.passed {
|
3033 |
-
background: #3eadff;
|
3034 |
-
}
|
3035 |
-
.learn-press-course-results-progress::after {
|
3036 |
-
display: block;
|
3037 |
-
clear: both;
|
3038 |
-
content: "";
|
3039 |
}
|
3040 |
|
3041 |
#course-item-content-header,
|
2196 |
.learn-press-profile-course__tab__inner > li {
|
2197 |
list-style: none;
|
2198 |
}
|
2199 |
+
.learn-press-profile-course__tab__inner > li:hover {
|
2200 |
+
cursor: pointer;
|
2201 |
+
}
|
2202 |
.learn-press-profile-course__tab__inner a {
|
2203 |
display: inline-block;
|
2204 |
padding: 15px 30px;
|
2998 |
font-size: inherit;
|
2999 |
}
|
3000 |
|
3001 |
+
.course-progress .lp-progress-bar:hover {
|
3002 |
+
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3003 |
}
|
3004 |
|
3005 |
#course-item-content-header,
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
@@ -296,10 +296,10 @@ var CourseCurriculum = {
|
|
296 |
|
297 |
/***/ }),
|
298 |
|
299 |
-
/***/ "
|
300 |
-
|
301 |
-
!***
|
302 |
-
|
303 |
/*! exports provided: default */
|
304 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
305 |
|
@@ -355,10 +355,10 @@ var Course = {
|
|
355 |
|
356 |
/***/ }),
|
357 |
|
358 |
-
/***/ "
|
359 |
-
|
360 |
-
!***
|
361 |
-
|
362 |
/*! exports provided: default */
|
363 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
364 |
|
@@ -434,17 +434,17 @@ var ModalCourseItems = {
|
|
434 |
|
435 |
/***/ }),
|
436 |
|
437 |
-
/***/ "
|
438 |
-
|
439 |
-
!***
|
440 |
-
|
441 |
/*! no exports provided */
|
442 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
443 |
|
444 |
"use strict";
|
445 |
__webpack_require__.r(__webpack_exports__);
|
446 |
-
/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ "
|
447 |
-
/* harmony import */ var _store_course__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/course */ "
|
448 |
|
449 |
|
450 |
window.$Vue = window.$Vue || Vue;
|
@@ -472,10 +472,10 @@ $(document).ready(function () {
|
|
472 |
|
473 |
/***/ }),
|
474 |
|
475 |
-
/***/ "
|
476 |
-
|
477 |
-
!***
|
478 |
-
|
479 |
/*! exports provided: default */
|
480 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
481 |
|
@@ -511,10 +511,10 @@ var CourseCurriculum = {
|
|
511 |
|
512 |
/***/ }),
|
513 |
|
514 |
-
/***/ "
|
515 |
-
|
516 |
-
!***
|
517 |
-
|
518 |
/*! exports provided: default */
|
519 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
520 |
|
@@ -553,10 +553,10 @@ var Course = {
|
|
553 |
|
554 |
/***/ }),
|
555 |
|
556 |
-
/***/ "
|
557 |
-
|
558 |
-
!***
|
559 |
-
|
560 |
/*! exports provided: default */
|
561 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
562 |
|
@@ -596,10 +596,10 @@ var Getters = {
|
|
596 |
|
597 |
/***/ }),
|
598 |
|
599 |
-
/***/ "
|
600 |
-
|
601 |
-
!***
|
602 |
-
|
603 |
/*! exports provided: default */
|
604 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
605 |
|
@@ -666,10 +666,10 @@ function HTTP(options) {
|
|
666 |
|
667 |
/***/ }),
|
668 |
|
669 |
-
/***/ "
|
670 |
-
|
671 |
-
!***
|
672 |
-
|
673 |
/*! exports provided: default */
|
674 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
675 |
|
@@ -844,10 +844,10 @@ var CourseCurriculum = {
|
|
844 |
|
845 |
/***/ }),
|
846 |
|
847 |
-
/***/ "
|
848 |
-
|
849 |
-
!***
|
850 |
-
|
851 |
/*! exports provided: default */
|
852 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
853 |
|
@@ -874,10 +874,10 @@ var Course = {
|
|
874 |
|
875 |
/***/ }),
|
876 |
|
877 |
-
/***/ "
|
878 |
-
|
879 |
-
!***
|
880 |
-
|
881 |
/*! exports provided: default */
|
882 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
883 |
|
@@ -924,18 +924,18 @@ var Mutations = {
|
|
924 |
|
925 |
/***/ }),
|
926 |
|
927 |
-
/***/ "
|
928 |
-
|
929 |
-
!***
|
930 |
-
|
931 |
/*! exports provided: default */
|
932 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
933 |
|
934 |
"use strict";
|
935 |
__webpack_require__.r(__webpack_exports__);
|
936 |
-
/* harmony import */ var _actions_course_section__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../actions/course-section */ "
|
937 |
-
/* harmony import */ var _mutations_course_section__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/course-section */ "
|
938 |
-
/* harmony import */ var _getters_course_section__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getters/course-section */ "
|
939 |
|
940 |
|
941 |
|
@@ -963,21 +963,21 @@ var $ = window.jQuery;
|
|
963 |
|
964 |
/***/ }),
|
965 |
|
966 |
-
/***/ "
|
967 |
-
|
968 |
-
!***
|
969 |
-
|
970 |
/*! exports provided: default */
|
971 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
972 |
|
973 |
"use strict";
|
974 |
__webpack_require__.r(__webpack_exports__);
|
975 |
-
/* harmony import */ var _store_modal_course_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/modal-course-items */ "
|
976 |
-
/* harmony import */ var _store_course_section__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../store/course-section */ "
|
977 |
-
/* harmony import */ var _store_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../store/i18n */ "
|
978 |
-
/* harmony import */ var _getters_course__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../getters/course */ "
|
979 |
-
/* harmony import */ var _mutations_course__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../mutations/course */ "
|
980 |
-
/* harmony import */ var _actions_course__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../actions/course */ "
|
981 |
|
982 |
|
983 |
|
@@ -1008,10 +1008,10 @@ var Course = function Course(data) {
|
|
1008 |
|
1009 |
/***/ }),
|
1010 |
|
1011 |
-
/***/ "
|
1012 |
-
|
1013 |
-
!***
|
1014 |
-
|
1015 |
/*! exports provided: default */
|
1016 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1017 |
|
@@ -1037,18 +1037,18 @@ var i18n = function i18n(i18n) {
|
|
1037 |
|
1038 |
/***/ }),
|
1039 |
|
1040 |
-
/***/ "
|
1041 |
-
|
1042 |
-
!***
|
1043 |
-
|
1044 |
/*! exports provided: default */
|
1045 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1046 |
|
1047 |
"use strict";
|
1048 |
__webpack_require__.r(__webpack_exports__);
|
1049 |
-
/* harmony import */ var _getters_modal_course_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/modal-course-items */ "
|
1050 |
-
/* harmony import */ var _mutations_modal_course_items__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/modal-course-items */ "
|
1051 |
-
/* harmony import */ var _actions_modal_course_items__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/modal-course-items */ "
|
1052 |
|
1053 |
|
1054 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/editor/course.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/editor/actions/course-section.js":
|
90 |
+
/*!*******************************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/editor/actions/course-section.js ***!
|
92 |
+
\*******************************************************************/
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
296 |
|
297 |
/***/ }),
|
298 |
|
299 |
+
/***/ "./assets/src/apps/js/admin/editor/actions/course.js":
|
300 |
+
/*!***********************************************************!*\
|
301 |
+
!*** ./assets/src/apps/js/admin/editor/actions/course.js ***!
|
302 |
+
\***********************************************************/
|
303 |
/*! exports provided: default */
|
304 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
305 |
|
355 |
|
356 |
/***/ }),
|
357 |
|
358 |
+
/***/ "./assets/src/apps/js/admin/editor/actions/modal-course-items.js":
|
359 |
+
/*!***********************************************************************!*\
|
360 |
+
!*** ./assets/src/apps/js/admin/editor/actions/modal-course-items.js ***!
|
361 |
+
\***********************************************************************/
|
362 |
/*! exports provided: default */
|
363 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
364 |
|
434 |
|
435 |
/***/ }),
|
436 |
|
437 |
+
/***/ "./assets/src/apps/js/admin/editor/course.js":
|
438 |
+
/*!***************************************************!*\
|
439 |
+
!*** ./assets/src/apps/js/admin/editor/course.js ***!
|
440 |
+
\***************************************************/
|
441 |
/*! no exports provided */
|
442 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
443 |
|
444 |
"use strict";
|
445 |
__webpack_require__.r(__webpack_exports__);
|
446 |
+
/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ "./assets/src/apps/js/admin/editor/http.js");
|
447 |
+
/* harmony import */ var _store_course__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/course */ "./assets/src/apps/js/admin/editor/store/course.js");
|
448 |
|
449 |
|
450 |
window.$Vue = window.$Vue || Vue;
|
472 |
|
473 |
/***/ }),
|
474 |
|
475 |
+
/***/ "./assets/src/apps/js/admin/editor/getters/course-section.js":
|
476 |
+
/*!*******************************************************************!*\
|
477 |
+
!*** ./assets/src/apps/js/admin/editor/getters/course-section.js ***!
|
478 |
+
\*******************************************************************/
|
479 |
/*! exports provided: default */
|
480 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
481 |
|
511 |
|
512 |
/***/ }),
|
513 |
|
514 |
+
/***/ "./assets/src/apps/js/admin/editor/getters/course.js":
|
515 |
+
/*!***********************************************************!*\
|
516 |
+
!*** ./assets/src/apps/js/admin/editor/getters/course.js ***!
|
517 |
+
\***********************************************************/
|
518 |
/*! exports provided: default */
|
519 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
520 |
|
553 |
|
554 |
/***/ }),
|
555 |
|
556 |
+
/***/ "./assets/src/apps/js/admin/editor/getters/modal-course-items.js":
|
557 |
+
/*!***********************************************************************!*\
|
558 |
+
!*** ./assets/src/apps/js/admin/editor/getters/modal-course-items.js ***!
|
559 |
+
\***********************************************************************/
|
560 |
/*! exports provided: default */
|
561 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
562 |
|
596 |
|
597 |
/***/ }),
|
598 |
|
599 |
+
/***/ "./assets/src/apps/js/admin/editor/http.js":
|
600 |
+
/*!*************************************************!*\
|
601 |
+
!*** ./assets/src/apps/js/admin/editor/http.js ***!
|
602 |
+
\*************************************************/
|
603 |
/*! exports provided: default */
|
604 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
605 |
|
666 |
|
667 |
/***/ }),
|
668 |
|
669 |
+
/***/ "./assets/src/apps/js/admin/editor/mutations/course-section.js":
|
670 |
+
/*!*********************************************************************!*\
|
671 |
+
!*** ./assets/src/apps/js/admin/editor/mutations/course-section.js ***!
|
672 |
+
\*********************************************************************/
|
673 |
/*! exports provided: default */
|
674 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
675 |
|
844 |
|
845 |
/***/ }),
|
846 |
|
847 |
+
/***/ "./assets/src/apps/js/admin/editor/mutations/course.js":
|
848 |
+
/*!*************************************************************!*\
|
849 |
+
!*** ./assets/src/apps/js/admin/editor/mutations/course.js ***!
|
850 |
+
\*************************************************************/
|
851 |
/*! exports provided: default */
|
852 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
853 |
|
874 |
|
875 |
/***/ }),
|
876 |
|
877 |
+
/***/ "./assets/src/apps/js/admin/editor/mutations/modal-course-items.js":
|
878 |
+
/*!*************************************************************************!*\
|
879 |
+
!*** ./assets/src/apps/js/admin/editor/mutations/modal-course-items.js ***!
|
880 |
+
\*************************************************************************/
|
881 |
/*! exports provided: default */
|
882 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
883 |
|
924 |
|
925 |
/***/ }),
|
926 |
|
927 |
+
/***/ "./assets/src/apps/js/admin/editor/store/course-section.js":
|
928 |
+
/*!*****************************************************************!*\
|
929 |
+
!*** ./assets/src/apps/js/admin/editor/store/course-section.js ***!
|
930 |
+
\*****************************************************************/
|
931 |
/*! exports provided: default */
|
932 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
933 |
|
934 |
"use strict";
|
935 |
__webpack_require__.r(__webpack_exports__);
|
936 |
+
/* harmony import */ var _actions_course_section__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../actions/course-section */ "./assets/src/apps/js/admin/editor/actions/course-section.js");
|
937 |
+
/* harmony import */ var _mutations_course_section__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/course-section */ "./assets/src/apps/js/admin/editor/mutations/course-section.js");
|
938 |
+
/* harmony import */ var _getters_course_section__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getters/course-section */ "./assets/src/apps/js/admin/editor/getters/course-section.js");
|
939 |
|
940 |
|
941 |
|
963 |
|
964 |
/***/ }),
|
965 |
|
966 |
+
/***/ "./assets/src/apps/js/admin/editor/store/course.js":
|
967 |
+
/*!*********************************************************!*\
|
968 |
+
!*** ./assets/src/apps/js/admin/editor/store/course.js ***!
|
969 |
+
\*********************************************************/
|
970 |
/*! exports provided: default */
|
971 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
972 |
|
973 |
"use strict";
|
974 |
__webpack_require__.r(__webpack_exports__);
|
975 |
+
/* harmony import */ var _store_modal_course_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/modal-course-items */ "./assets/src/apps/js/admin/editor/store/modal-course-items.js");
|
976 |
+
/* harmony import */ var _store_course_section__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../store/course-section */ "./assets/src/apps/js/admin/editor/store/course-section.js");
|
977 |
+
/* harmony import */ var _store_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../store/i18n */ "./assets/src/apps/js/admin/editor/store/i18n.js");
|
978 |
+
/* harmony import */ var _getters_course__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../getters/course */ "./assets/src/apps/js/admin/editor/getters/course.js");
|
979 |
+
/* harmony import */ var _mutations_course__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../mutations/course */ "./assets/src/apps/js/admin/editor/mutations/course.js");
|
980 |
+
/* harmony import */ var _actions_course__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../actions/course */ "./assets/src/apps/js/admin/editor/actions/course.js");
|
981 |
|
982 |
|
983 |
|
1008 |
|
1009 |
/***/ }),
|
1010 |
|
1011 |
+
/***/ "./assets/src/apps/js/admin/editor/store/i18n.js":
|
1012 |
+
/*!*******************************************************!*\
|
1013 |
+
!*** ./assets/src/apps/js/admin/editor/store/i18n.js ***!
|
1014 |
+
\*******************************************************/
|
1015 |
/*! exports provided: default */
|
1016 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1017 |
|
1037 |
|
1038 |
/***/ }),
|
1039 |
|
1040 |
+
/***/ "./assets/src/apps/js/admin/editor/store/modal-course-items.js":
|
1041 |
+
/*!*********************************************************************!*\
|
1042 |
+
!*** ./assets/src/apps/js/admin/editor/store/modal-course-items.js ***!
|
1043 |
+
\*********************************************************************/
|
1044 |
/*! exports provided: default */
|
1045 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1046 |
|
1047 |
"use strict";
|
1048 |
__webpack_require__.r(__webpack_exports__);
|
1049 |
+
/* harmony import */ var _getters_modal_course_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/modal-course-items */ "./assets/src/apps/js/admin/editor/getters/modal-course-items.js");
|
1050 |
+
/* harmony import */ var _mutations_modal_course_items__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/modal-course-items */ "./assets/src/apps/js/admin/editor/mutations/modal-course-items.js");
|
1051 |
+
/* harmony import */ var _actions_modal_course_items__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/modal-course-items */ "./assets/src/apps/js/admin/editor/actions/modal-course-items.js");
|
1052 |
|
1053 |
|
1054 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
@@ -193,10 +193,10 @@ var Question = {
|
|
193 |
|
194 |
/***/ }),
|
195 |
|
196 |
-
/***/ "
|
197 |
-
|
198 |
-
!***
|
199 |
-
|
200 |
/*! no static exports found */
|
201 |
/***/ (function(module, exports) {
|
202 |
|
@@ -274,10 +274,10 @@ var Question = {
|
|
274 |
|
275 |
/***/ }),
|
276 |
|
277 |
-
/***/ "
|
278 |
-
|
279 |
-
!***
|
280 |
-
|
281 |
/*! exports provided: default */
|
282 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
283 |
|
@@ -343,10 +343,10 @@ var Question = {
|
|
343 |
|
344 |
/***/ }),
|
345 |
|
346 |
-
/***/ "
|
347 |
-
|
348 |
-
!***
|
349 |
-
|
350 |
/*! exports provided: default */
|
351 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
352 |
|
@@ -413,10 +413,10 @@ function HTTP(options) {
|
|
413 |
|
414 |
/***/ }),
|
415 |
|
416 |
-
/***/ "
|
417 |
-
|
418 |
-
!***
|
419 |
-
|
420 |
/*! exports provided: default */
|
421 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
422 |
|
@@ -461,18 +461,18 @@ var Question = {
|
|
461 |
|
462 |
/***/ }),
|
463 |
|
464 |
-
/***/ "
|
465 |
-
|
466 |
-
!***
|
467 |
-
|
468 |
/*! no exports provided */
|
469 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
470 |
|
471 |
"use strict";
|
472 |
__webpack_require__.r(__webpack_exports__);
|
473 |
-
/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ "
|
474 |
-
/* harmony import */ var _store_question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/question */ "
|
475 |
-
/* harmony import */ var _fill_in_blanks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fill-in-blanks */ "
|
476 |
/* harmony import */ var _fill_in_blanks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_fill_in_blanks__WEBPACK_IMPORTED_MODULE_2__);
|
477 |
|
478 |
|
@@ -504,18 +504,18 @@ $(document).ready(function () {
|
|
504 |
|
505 |
/***/ }),
|
506 |
|
507 |
-
/***/ "
|
508 |
-
|
509 |
-
!***
|
510 |
-
|
511 |
/*! exports provided: default */
|
512 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
513 |
|
514 |
"use strict";
|
515 |
__webpack_require__.r(__webpack_exports__);
|
516 |
-
/* harmony import */ var _getters_question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/question */ "
|
517 |
-
/* harmony import */ var _mutations_question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/question */ "
|
518 |
-
/* harmony import */ var _actions_question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/question */ "
|
519 |
|
520 |
|
521 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/editor/question.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/editor/actions/question.js":
|
90 |
+
/*!*************************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/editor/actions/question.js ***!
|
92 |
+
\*************************************************************/
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
193 |
|
194 |
/***/ }),
|
195 |
|
196 |
+
/***/ "./assets/src/apps/js/admin/editor/fill-in-blanks.js":
|
197 |
+
/*!***********************************************************!*\
|
198 |
+
!*** ./assets/src/apps/js/admin/editor/fill-in-blanks.js ***!
|
199 |
+
\***********************************************************/
|
200 |
/*! no static exports found */
|
201 |
/***/ (function(module, exports) {
|
202 |
|
274 |
|
275 |
/***/ }),
|
276 |
|
277 |
+
/***/ "./assets/src/apps/js/admin/editor/getters/question.js":
|
278 |
+
/*!*************************************************************!*\
|
279 |
+
!*** ./assets/src/apps/js/admin/editor/getters/question.js ***!
|
280 |
+
\*************************************************************/
|
281 |
/*! exports provided: default */
|
282 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
283 |
|
343 |
|
344 |
/***/ }),
|
345 |
|
346 |
+
/***/ "./assets/src/apps/js/admin/editor/http.js":
|
347 |
+
/*!*************************************************!*\
|
348 |
+
!*** ./assets/src/apps/js/admin/editor/http.js ***!
|
349 |
+
\*************************************************/
|
350 |
/*! exports provided: default */
|
351 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
352 |
|
413 |
|
414 |
/***/ }),
|
415 |
|
416 |
+
/***/ "./assets/src/apps/js/admin/editor/mutations/question.js":
|
417 |
+
/*!***************************************************************!*\
|
418 |
+
!*** ./assets/src/apps/js/admin/editor/mutations/question.js ***!
|
419 |
+
\***************************************************************/
|
420 |
/*! exports provided: default */
|
421 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
422 |
|
461 |
|
462 |
/***/ }),
|
463 |
|
464 |
+
/***/ "./assets/src/apps/js/admin/editor/question.js":
|
465 |
+
/*!*****************************************************!*\
|
466 |
+
!*** ./assets/src/apps/js/admin/editor/question.js ***!
|
467 |
+
\*****************************************************/
|
468 |
/*! no exports provided */
|
469 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
470 |
|
471 |
"use strict";
|
472 |
__webpack_require__.r(__webpack_exports__);
|
473 |
+
/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ "./assets/src/apps/js/admin/editor/http.js");
|
474 |
+
/* harmony import */ var _store_question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/question */ "./assets/src/apps/js/admin/editor/store/question.js");
|
475 |
+
/* harmony import */ var _fill_in_blanks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fill-in-blanks */ "./assets/src/apps/js/admin/editor/fill-in-blanks.js");
|
476 |
/* harmony import */ var _fill_in_blanks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_fill_in_blanks__WEBPACK_IMPORTED_MODULE_2__);
|
477 |
|
478 |
|
504 |
|
505 |
/***/ }),
|
506 |
|
507 |
+
/***/ "./assets/src/apps/js/admin/editor/store/question.js":
|
508 |
+
/*!***********************************************************!*\
|
509 |
+
!*** ./assets/src/apps/js/admin/editor/store/question.js ***!
|
510 |
+
\***********************************************************/
|
511 |
/*! exports provided: default */
|
512 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
513 |
|
514 |
"use strict";
|
515 |
__webpack_require__.r(__webpack_exports__);
|
516 |
+
/* harmony import */ var _getters_question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/question */ "./assets/src/apps/js/admin/editor/getters/question.js");
|
517 |
+
/* harmony import */ var _mutations_question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/question */ "./assets/src/apps/js/admin/editor/mutations/question.js");
|
518 |
+
/* harmony import */ var _actions_question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/question */ "./assets/src/apps/js/admin/editor/actions/question.js");
|
519 |
|
520 |
|
521 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
@@ -166,10 +166,10 @@ var ModalQuizItems = {
|
|
166 |
|
167 |
/***/ }),
|
168 |
|
169 |
-
/***/ "
|
170 |
-
|
171 |
-
!***
|
172 |
-
|
173 |
/*! exports provided: default */
|
174 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
175 |
|
@@ -461,10 +461,10 @@ var QuestionList = {
|
|
461 |
|
462 |
/***/ }),
|
463 |
|
464 |
-
/***/ "
|
465 |
-
|
466 |
-
!***
|
467 |
-
|
468 |
/*! exports provided: default */
|
469 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
470 |
|
@@ -502,10 +502,10 @@ var Quiz = {
|
|
502 |
|
503 |
/***/ }),
|
504 |
|
505 |
-
/***/ "
|
506 |
-
|
507 |
-
!***
|
508 |
-
|
509 |
/*! no static exports found */
|
510 |
/***/ (function(module, exports) {
|
511 |
|
@@ -583,10 +583,10 @@ var Quiz = {
|
|
583 |
|
584 |
/***/ }),
|
585 |
|
586 |
-
/***/ "
|
587 |
-
|
588 |
-
!***
|
589 |
-
|
590 |
/*! exports provided: default */
|
591 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
592 |
|
@@ -626,10 +626,10 @@ var ModalQuizItems = {
|
|
626 |
|
627 |
/***/ }),
|
628 |
|
629 |
-
/***/ "
|
630 |
-
|
631 |
-
!***
|
632 |
-
|
633 |
/*! exports provided: default */
|
634 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
635 |
|
@@ -680,10 +680,10 @@ var QuestionList = {
|
|
680 |
|
681 |
/***/ }),
|
682 |
|
683 |
-
/***/ "
|
684 |
-
|
685 |
-
!***
|
686 |
-
|
687 |
/*! exports provided: default */
|
688 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
689 |
|
@@ -719,10 +719,10 @@ var Quiz = {
|
|
719 |
|
720 |
/***/ }),
|
721 |
|
722 |
-
/***/ "
|
723 |
-
|
724 |
-
!***
|
725 |
-
|
726 |
/*! exports provided: default */
|
727 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
728 |
|
@@ -789,10 +789,10 @@ function HTTP(options) {
|
|
789 |
|
790 |
/***/ }),
|
791 |
|
792 |
-
/***/ "
|
793 |
-
|
794 |
-
!***
|
795 |
-
|
796 |
/*! exports provided: default */
|
797 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
798 |
|
@@ -839,10 +839,10 @@ var ModalQuizItems = {
|
|
839 |
|
840 |
/***/ }),
|
841 |
|
842 |
-
/***/ "
|
843 |
-
|
844 |
-
!***
|
845 |
-
|
846 |
/*! exports provided: default */
|
847 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
848 |
|
@@ -1026,10 +1026,10 @@ var QuestionList = {
|
|
1026 |
|
1027 |
/***/ }),
|
1028 |
|
1029 |
-
/***/ "
|
1030 |
-
|
1031 |
-
!***
|
1032 |
-
|
1033 |
/*! exports provided: default */
|
1034 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1035 |
|
@@ -1056,18 +1056,18 @@ var Quiz = {
|
|
1056 |
|
1057 |
/***/ }),
|
1058 |
|
1059 |
-
/***/ "
|
1060 |
-
|
1061 |
-
!***
|
1062 |
-
|
1063 |
/*! no exports provided */
|
1064 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1065 |
|
1066 |
"use strict";
|
1067 |
__webpack_require__.r(__webpack_exports__);
|
1068 |
-
/* harmony import */ var _store_quiz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./store/quiz */ "
|
1069 |
-
/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./http */ "
|
1070 |
-
/* harmony import */ var _fill_in_blanks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fill-in-blanks */ "
|
1071 |
/* harmony import */ var _fill_in_blanks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_fill_in_blanks__WEBPACK_IMPORTED_MODULE_2__);
|
1072 |
|
1073 |
|
@@ -1096,10 +1096,10 @@ window.jQuery(document).ready(function () {
|
|
1096 |
|
1097 |
/***/ }),
|
1098 |
|
1099 |
-
/***/ "
|
1100 |
-
|
1101 |
-
!***
|
1102 |
-
|
1103 |
/*! exports provided: default */
|
1104 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1105 |
|
@@ -1125,18 +1125,18 @@ var i18n = function i18n(i18n) {
|
|
1125 |
|
1126 |
/***/ }),
|
1127 |
|
1128 |
-
/***/ "
|
1129 |
-
|
1130 |
-
!***
|
1131 |
-
|
1132 |
/*! exports provided: default */
|
1133 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1134 |
|
1135 |
"use strict";
|
1136 |
__webpack_require__.r(__webpack_exports__);
|
1137 |
-
/* harmony import */ var _getters_modal_quiz_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/modal-quiz-items */ "
|
1138 |
-
/* harmony import */ var _mutations_modal_quiz_items__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/modal-quiz-items */ "
|
1139 |
-
/* harmony import */ var _actions_modal_quiz_items__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/modal-quiz-items */ "
|
1140 |
|
1141 |
|
1142 |
|
@@ -1161,18 +1161,18 @@ var Quiz = function Quiz(data) {
|
|
1161 |
|
1162 |
/***/ }),
|
1163 |
|
1164 |
-
/***/ "
|
1165 |
-
|
1166 |
-
!***
|
1167 |
-
|
1168 |
/*! exports provided: default */
|
1169 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1170 |
|
1171 |
"use strict";
|
1172 |
__webpack_require__.r(__webpack_exports__);
|
1173 |
-
/* harmony import */ var _getters_question_list__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/question-list */ "
|
1174 |
-
/* harmony import */ var _mutations_question_list__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/question-list */ "
|
1175 |
-
/* harmony import */ var _actions_question_list__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/question-list */ "
|
1176 |
|
1177 |
|
1178 |
|
@@ -1206,21 +1206,21 @@ var QuestionList = function QuestionList(data) {
|
|
1206 |
|
1207 |
/***/ }),
|
1208 |
|
1209 |
-
/***/ "
|
1210 |
-
|
1211 |
-
!***
|
1212 |
-
|
1213 |
/*! exports provided: default */
|
1214 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1215 |
|
1216 |
"use strict";
|
1217 |
__webpack_require__.r(__webpack_exports__);
|
1218 |
-
/* harmony import */ var _getters_quiz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/quiz */ "
|
1219 |
-
/* harmony import */ var _mutations_quiz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/quiz */ "
|
1220 |
-
/* harmony import */ var _actions_quiz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/quiz */ "
|
1221 |
-
/* harmony import */ var _store_modal_quiz_items__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../store/modal-quiz-items */ "
|
1222 |
-
/* harmony import */ var _store_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../store/i18n */ "
|
1223 |
-
/* harmony import */ var _store_question_list__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../store/question-list */ "
|
1224 |
|
1225 |
|
1226 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/editor/quiz.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/editor/actions/modal-quiz-items.js":
|
90 |
+
/*!*********************************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/editor/actions/modal-quiz-items.js ***!
|
92 |
+
\*********************************************************************/
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
166 |
|
167 |
/***/ }),
|
168 |
|
169 |
+
/***/ "./assets/src/apps/js/admin/editor/actions/question-list.js":
|
170 |
+
/*!******************************************************************!*\
|
171 |
+
!*** ./assets/src/apps/js/admin/editor/actions/question-list.js ***!
|
172 |
+
\******************************************************************/
|
173 |
/*! exports provided: default */
|
174 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
175 |
|
461 |
|
462 |
/***/ }),
|
463 |
|
464 |
+
/***/ "./assets/src/apps/js/admin/editor/actions/quiz.js":
|
465 |
+
/*!*********************************************************!*\
|
466 |
+
!*** ./assets/src/apps/js/admin/editor/actions/quiz.js ***!
|
467 |
+
\*********************************************************/
|
468 |
/*! exports provided: default */
|
469 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
470 |
|
502 |
|
503 |
/***/ }),
|
504 |
|
505 |
+
/***/ "./assets/src/apps/js/admin/editor/fill-in-blanks.js":
|
506 |
+
/*!***********************************************************!*\
|
507 |
+
!*** ./assets/src/apps/js/admin/editor/fill-in-blanks.js ***!
|
508 |
+
\***********************************************************/
|
509 |
/*! no static exports found */
|
510 |
/***/ (function(module, exports) {
|
511 |
|
583 |
|
584 |
/***/ }),
|
585 |
|
586 |
+
/***/ "./assets/src/apps/js/admin/editor/getters/modal-quiz-items.js":
|
587 |
+
/*!*********************************************************************!*\
|
588 |
+
!*** ./assets/src/apps/js/admin/editor/getters/modal-quiz-items.js ***!
|
589 |
+
\*********************************************************************/
|
590 |
/*! exports provided: default */
|
591 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
592 |
|
626 |
|
627 |
/***/ }),
|
628 |
|
629 |
+
/***/ "./assets/src/apps/js/admin/editor/getters/question-list.js":
|
630 |
+
/*!******************************************************************!*\
|
631 |
+
!*** ./assets/src/apps/js/admin/editor/getters/question-list.js ***!
|
632 |
+
\******************************************************************/
|
633 |
/*! exports provided: default */
|
634 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
635 |
|
680 |
|
681 |
/***/ }),
|
682 |
|
683 |
+
/***/ "./assets/src/apps/js/admin/editor/getters/quiz.js":
|
684 |
+
/*!*********************************************************!*\
|
685 |
+
!*** ./assets/src/apps/js/admin/editor/getters/quiz.js ***!
|
686 |
+
\*********************************************************/
|
687 |
/*! exports provided: default */
|
688 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
689 |
|
719 |
|
720 |
/***/ }),
|
721 |
|
722 |
+
/***/ "./assets/src/apps/js/admin/editor/http.js":
|
723 |
+
/*!*************************************************!*\
|
724 |
+
!*** ./assets/src/apps/js/admin/editor/http.js ***!
|
725 |
+
\*************************************************/
|
726 |
/*! exports provided: default */
|
727 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
728 |
|
789 |
|
790 |
/***/ }),
|
791 |
|
792 |
+
/***/ "./assets/src/apps/js/admin/editor/mutations/modal-quiz-items.js":
|
793 |
+
/*!***********************************************************************!*\
|
794 |
+
!*** ./assets/src/apps/js/admin/editor/mutations/modal-quiz-items.js ***!
|
795 |
+
\***********************************************************************/
|
796 |
/*! exports provided: default */
|
797 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
798 |
|
839 |
|
840 |
/***/ }),
|
841 |
|
842 |
+
/***/ "./assets/src/apps/js/admin/editor/mutations/question-list.js":
|
843 |
+
/*!********************************************************************!*\
|
844 |
+
!*** ./assets/src/apps/js/admin/editor/mutations/question-list.js ***!
|
845 |
+
\********************************************************************/
|
846 |
/*! exports provided: default */
|
847 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
848 |
|
1026 |
|
1027 |
/***/ }),
|
1028 |
|
1029 |
+
/***/ "./assets/src/apps/js/admin/editor/mutations/quiz.js":
|
1030 |
+
/*!***********************************************************!*\
|
1031 |
+
!*** ./assets/src/apps/js/admin/editor/mutations/quiz.js ***!
|
1032 |
+
\***********************************************************/
|
1033 |
/*! exports provided: default */
|
1034 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1035 |
|
1056 |
|
1057 |
/***/ }),
|
1058 |
|
1059 |
+
/***/ "./assets/src/apps/js/admin/editor/quiz.js":
|
1060 |
+
/*!*************************************************!*\
|
1061 |
+
!*** ./assets/src/apps/js/admin/editor/quiz.js ***!
|
1062 |
+
\*************************************************/
|
1063 |
/*! no exports provided */
|
1064 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1065 |
|
1066 |
"use strict";
|
1067 |
__webpack_require__.r(__webpack_exports__);
|
1068 |
+
/* harmony import */ var _store_quiz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./store/quiz */ "./assets/src/apps/js/admin/editor/store/quiz.js");
|
1069 |
+
/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./http */ "./assets/src/apps/js/admin/editor/http.js");
|
1070 |
+
/* harmony import */ var _fill_in_blanks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fill-in-blanks */ "./assets/src/apps/js/admin/editor/fill-in-blanks.js");
|
1071 |
/* harmony import */ var _fill_in_blanks__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_fill_in_blanks__WEBPACK_IMPORTED_MODULE_2__);
|
1072 |
|
1073 |
|
1096 |
|
1097 |
/***/ }),
|
1098 |
|
1099 |
+
/***/ "./assets/src/apps/js/admin/editor/store/i18n.js":
|
1100 |
+
/*!*******************************************************!*\
|
1101 |
+
!*** ./assets/src/apps/js/admin/editor/store/i18n.js ***!
|
1102 |
+
\*******************************************************/
|
1103 |
/*! exports provided: default */
|
1104 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1105 |
|
1125 |
|
1126 |
/***/ }),
|
1127 |
|
1128 |
+
/***/ "./assets/src/apps/js/admin/editor/store/modal-quiz-items.js":
|
1129 |
+
/*!*******************************************************************!*\
|
1130 |
+
!*** ./assets/src/apps/js/admin/editor/store/modal-quiz-items.js ***!
|
1131 |
+
\*******************************************************************/
|
1132 |
/*! exports provided: default */
|
1133 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1134 |
|
1135 |
"use strict";
|
1136 |
__webpack_require__.r(__webpack_exports__);
|
1137 |
+
/* harmony import */ var _getters_modal_quiz_items__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/modal-quiz-items */ "./assets/src/apps/js/admin/editor/getters/modal-quiz-items.js");
|
1138 |
+
/* harmony import */ var _mutations_modal_quiz_items__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/modal-quiz-items */ "./assets/src/apps/js/admin/editor/mutations/modal-quiz-items.js");
|
1139 |
+
/* harmony import */ var _actions_modal_quiz_items__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/modal-quiz-items */ "./assets/src/apps/js/admin/editor/actions/modal-quiz-items.js");
|
1140 |
|
1141 |
|
1142 |
|
1161 |
|
1162 |
/***/ }),
|
1163 |
|
1164 |
+
/***/ "./assets/src/apps/js/admin/editor/store/question-list.js":
|
1165 |
+
/*!****************************************************************!*\
|
1166 |
+
!*** ./assets/src/apps/js/admin/editor/store/question-list.js ***!
|
1167 |
+
\****************************************************************/
|
1168 |
/*! exports provided: default */
|
1169 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1170 |
|
1171 |
"use strict";
|
1172 |
__webpack_require__.r(__webpack_exports__);
|
1173 |
+
/* harmony import */ var _getters_question_list__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/question-list */ "./assets/src/apps/js/admin/editor/getters/question-list.js");
|
1174 |
+
/* harmony import */ var _mutations_question_list__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/question-list */ "./assets/src/apps/js/admin/editor/mutations/question-list.js");
|
1175 |
+
/* harmony import */ var _actions_question_list__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/question-list */ "./assets/src/apps/js/admin/editor/actions/question-list.js");
|
1176 |
|
1177 |
|
1178 |
|
1206 |
|
1207 |
/***/ }),
|
1208 |
|
1209 |
+
/***/ "./assets/src/apps/js/admin/editor/store/quiz.js":
|
1210 |
+
/*!*******************************************************!*\
|
1211 |
+
!*** ./assets/src/apps/js/admin/editor/store/quiz.js ***!
|
1212 |
+
\*******************************************************/
|
1213 |
/*! exports provided: default */
|
1214 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1215 |
|
1216 |
"use strict";
|
1217 |
__webpack_require__.r(__webpack_exports__);
|
1218 |
+
/* harmony import */ var _getters_quiz__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getters/quiz */ "./assets/src/apps/js/admin/editor/getters/quiz.js");
|
1219 |
+
/* harmony import */ var _mutations_quiz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutations/quiz */ "./assets/src/apps/js/admin/editor/mutations/quiz.js");
|
1220 |
+
/* harmony import */ var _actions_quiz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../actions/quiz */ "./assets/src/apps/js/admin/editor/actions/quiz.js");
|
1221 |
+
/* harmony import */ var _store_modal_quiz_items__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../store/modal-quiz-items */ "./assets/src/apps/js/admin/editor/store/modal-quiz-items.js");
|
1222 |
+
/* harmony import */ var _store_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../store/i18n */ "./assets/src/apps/js/admin/editor/store/i18n.js");
|
1223 |
+
/* harmony import */ var _store_question_list__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../store/question-list */ "./assets/src/apps/js/admin/editor/store/question-list.js");
|
1224 |
|
1225 |
|
1226 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/pages/dashboard.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/pages/dashboard.js":
|
90 |
+
/*!*****************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/pages/dashboard.js ***!
|
92 |
+
\*****************************************************/
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/pages/setup.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/pages/setup.js":
|
90 |
+
/*!*************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/pages/setup.js ***!
|
92 |
+
\*************************************************/
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/pages/statistic.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/pages/statistic.js":
|
90 |
+
/*!*****************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/pages/statistic.js ***!
|
92 |
+
\*****************************************************/
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/pages/sync-data.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/pages/sync-data.js":
|
90 |
+
/*!*****************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/pages/sync-data.js ***!
|
92 |
+
\*****************************************************/
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
@@ -154,16 +154,16 @@ var searchThemesAddons = function searchThemesAddons() {};
|
|
154 |
|
155 |
/***/ }),
|
156 |
|
157 |
-
/***/ "
|
158 |
-
|
159 |
-
!***
|
160 |
-
|
161 |
/*! no exports provided */
|
162 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
163 |
|
164 |
"use strict";
|
165 |
__webpack_require__.r(__webpack_exports__);
|
166 |
-
/* harmony import */ var _addons_search_lp_addons_themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addons/search-lp-addons-themes */ "
|
167 |
|
168 |
document.addEventListener('DOMContentLoaded', function (event) {
|
169 |
Object(_addons_search_lp_addons_themes__WEBPACK_IMPORTED_MODULE_0__["default"])();
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/pages/themes-addons.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/pages/addons/search-lp-addons-themes.js":
|
90 |
+
/*!**************************************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/pages/addons/search-lp-addons-themes.js ***!
|
92 |
+
\**************************************************************************/
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
154 |
|
155 |
/***/ }),
|
156 |
|
157 |
+
/***/ "./assets/src/apps/js/admin/pages/themes-addons.js":
|
158 |
+
/*!*********************************************************!*\
|
159 |
+
!*** ./assets/src/apps/js/admin/pages/themes-addons.js ***!
|
160 |
+
\*********************************************************/
|
161 |
/*! no exports provided */
|
162 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
163 |
|
164 |
"use strict";
|
165 |
__webpack_require__.r(__webpack_exports__);
|
166 |
+
/* harmony import */ var _addons_search_lp_addons_themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addons/search-lp-addons-themes */ "./assets/src/apps/js/admin/pages/addons/search-lp-addons-themes.js");
|
167 |
|
168 |
document.addEventListener('DOMContentLoaded', function (event) {
|
169 |
Object(_addons_search_lp_addons_themes__WEBPACK_IMPORTED_MODULE_0__["default"])();
|
@@ -81,25 +81,25 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! no exports provided */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
96 |
"use strict";
|
97 |
__webpack_require__.r(__webpack_exports__);
|
98 |
-
/* harmony import */ var _tools_database_upgrade__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/database/upgrade */ "
|
99 |
-
/* harmony import */ var _tools_database_create_indexs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tools/database/create_indexs */ "
|
100 |
-
/* harmony import */ var _tools_database_re_upgrade_db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tools/database/re-upgrade-db */ "
|
101 |
-
/* harmony import */ var _tools_database_clean_database__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tools/database/clean_database */ "
|
102 |
-
/* harmony import */ var _tools_reset_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./tools/reset-data */ "
|
103 |
|
104 |
|
105 |
|
@@ -219,17 +219,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
219 |
|
220 |
/***/ }),
|
221 |
|
222 |
-
/***/ "
|
223 |
-
|
224 |
-
!***
|
225 |
-
|
226 |
/*! exports provided: default */
|
227 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
228 |
|
229 |
"use strict";
|
230 |
__webpack_require__.r(__webpack_exports__);
|
231 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "
|
232 |
-
/* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "
|
233 |
|
234 |
|
235 |
|
@@ -366,17 +366,17 @@ var cleanDatabases = function cleanDatabases() {
|
|
366 |
|
367 |
/***/ }),
|
368 |
|
369 |
-
/***/ "
|
370 |
-
|
371 |
-
!***
|
372 |
-
|
373 |
/*! exports provided: default */
|
374 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
375 |
|
376 |
"use strict";
|
377 |
__webpack_require__.r(__webpack_exports__);
|
378 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "
|
379 |
-
/* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "
|
380 |
|
381 |
|
382 |
|
@@ -504,17 +504,17 @@ var createIndexes = function createIndexes() {
|
|
504 |
|
505 |
/***/ }),
|
506 |
|
507 |
-
/***/ "
|
508 |
-
|
509 |
-
!***
|
510 |
-
|
511 |
/*! exports provided: default */
|
512 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
513 |
|
514 |
"use strict";
|
515 |
__webpack_require__.r(__webpack_exports__);
|
516 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "
|
517 |
-
/* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "
|
518 |
|
519 |
|
520 |
|
@@ -569,17 +569,17 @@ var reUpgradeDB = function reUpgradeDB() {
|
|
569 |
|
570 |
/***/ }),
|
571 |
|
572 |
-
/***/ "
|
573 |
-
|
574 |
-
!***
|
575 |
-
|
576 |
/*! exports provided: default */
|
577 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
578 |
|
579 |
"use strict";
|
580 |
__webpack_require__.r(__webpack_exports__);
|
581 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "
|
582 |
-
/* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "
|
583 |
|
584 |
|
585 |
var $ = jQuery;
|
@@ -855,10 +855,10 @@ var getStepsUpgradeStatus = function getStepsUpgradeStatus() {
|
|
855 |
|
856 |
/***/ }),
|
857 |
|
858 |
-
/***/ "
|
859 |
-
|
860 |
-
!***
|
861 |
-
|
862 |
/*! exports provided: default */
|
863 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
864 |
|
@@ -1237,16 +1237,16 @@ var ResetCourse = function ResetCourse() {
|
|
1237 |
|
1238 |
/***/ }),
|
1239 |
|
1240 |
-
/***/ "
|
1241 |
-
|
1242 |
-
!***
|
1243 |
-
|
1244 |
/*! exports provided: default */
|
1245 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1246 |
|
1247 |
"use strict";
|
1248 |
__webpack_require__.r(__webpack_exports__);
|
1249 |
-
/* harmony import */ var _course__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./course */ "
|
1250 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
1251 |
|
1252 |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -1271,10 +1271,10 @@ var resetData = function resetData() {
|
|
1271 |
|
1272 |
/***/ }),
|
1273 |
|
1274 |
-
/***/ "
|
1275 |
-
|
1276 |
-
!***
|
1277 |
-
|
1278 |
/*! exports provided: default */
|
1279 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1280 |
|
@@ -1304,10 +1304,10 @@ var handleAjax = function handleAjax(url, params, functions) {
|
|
1304 |
|
1305 |
/***/ }),
|
1306 |
|
1307 |
-
/***/ "
|
1308 |
-
|
1309 |
-
!***
|
1310 |
-
|
1311 |
/*! exports provided: default */
|
1312 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1313 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/pages/tools.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/pages/tools.js":
|
90 |
+
/*!*************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/pages/tools.js ***!
|
92 |
+
\*************************************************/
|
93 |
/*! no exports provided */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
96 |
"use strict";
|
97 |
__webpack_require__.r(__webpack_exports__);
|
98 |
+
/* harmony import */ var _tools_database_upgrade__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tools/database/upgrade */ "./assets/src/apps/js/admin/pages/tools/database/upgrade.js");
|
99 |
+
/* harmony import */ var _tools_database_create_indexs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tools/database/create_indexs */ "./assets/src/apps/js/admin/pages/tools/database/create_indexs.js");
|
100 |
+
/* harmony import */ var _tools_database_re_upgrade_db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tools/database/re-upgrade-db */ "./assets/src/apps/js/admin/pages/tools/database/re-upgrade-db.js");
|
101 |
+
/* harmony import */ var _tools_database_clean_database__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tools/database/clean_database */ "./assets/src/apps/js/admin/pages/tools/database/clean_database.js");
|
102 |
+
/* harmony import */ var _tools_reset_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./tools/reset-data */ "./assets/src/apps/js/admin/pages/tools/reset-data/index.js");
|
103 |
|
104 |
|
105 |
|
219 |
|
220 |
/***/ }),
|
221 |
|
222 |
+
/***/ "./assets/src/apps/js/admin/pages/tools/database/clean_database.js":
|
223 |
+
/*!*************************************************************************!*\
|
224 |
+
!*** ./assets/src/apps/js/admin/pages/tools/database/clean_database.js ***!
|
225 |
+
\*************************************************************************/
|
226 |
/*! exports provided: default */
|
227 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
228 |
|
229 |
"use strict";
|
230 |
__webpack_require__.r(__webpack_exports__);
|
231 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
232 |
+
/* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "./assets/src/apps/js/utils/handle-ajax-api.js");
|
233 |
|
234 |
|
235 |
|
366 |
|
367 |
/***/ }),
|
368 |
|
369 |
+
/***/ "./assets/src/apps/js/admin/pages/tools/database/create_indexs.js":
|
370 |
+
/*!************************************************************************!*\
|
371 |
+
!*** ./assets/src/apps/js/admin/pages/tools/database/create_indexs.js ***!
|
372 |
+
\************************************************************************/
|
373 |
/*! exports provided: default */
|
374 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
375 |
|
376 |
"use strict";
|
377 |
__webpack_require__.r(__webpack_exports__);
|
378 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
379 |
+
/* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "./assets/src/apps/js/utils/handle-ajax-api.js");
|
380 |
|
381 |
|
382 |
|
504 |
|
505 |
/***/ }),
|
506 |
|
507 |
+
/***/ "./assets/src/apps/js/admin/pages/tools/database/re-upgrade-db.js":
|
508 |
+
/*!************************************************************************!*\
|
509 |
+
!*** ./assets/src/apps/js/admin/pages/tools/database/re-upgrade-db.js ***!
|
510 |
+
\************************************************************************/
|
511 |
/*! exports provided: default */
|
512 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
513 |
|
514 |
"use strict";
|
515 |
__webpack_require__.r(__webpack_exports__);
|
516 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
517 |
+
/* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "./assets/src/apps/js/utils/handle-ajax-api.js");
|
518 |
|
519 |
|
520 |
|
569 |
|
570 |
/***/ }),
|
571 |
|
572 |
+
/***/ "./assets/src/apps/js/admin/pages/tools/database/upgrade.js":
|
573 |
+
/*!******************************************************************!*\
|
574 |
+
!*** ./assets/src/apps/js/admin/pages/tools/database/upgrade.js ***!
|
575 |
+
\******************************************************************/
|
576 |
/*! exports provided: default */
|
577 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
578 |
|
579 |
"use strict";
|
580 |
__webpack_require__.r(__webpack_exports__);
|
581 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
582 |
+
/* harmony import */ var _utils_handle_ajax_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../../utils/handle-ajax-api */ "./assets/src/apps/js/utils/handle-ajax-api.js");
|
583 |
|
584 |
|
585 |
var $ = jQuery;
|
855 |
|
856 |
/***/ }),
|
857 |
|
858 |
+
/***/ "./assets/src/apps/js/admin/pages/tools/reset-data/course.js":
|
859 |
+
/*!*******************************************************************!*\
|
860 |
+
!*** ./assets/src/apps/js/admin/pages/tools/reset-data/course.js ***!
|
861 |
+
\*******************************************************************/
|
862 |
/*! exports provided: default */
|
863 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
864 |
|
1237 |
|
1238 |
/***/ }),
|
1239 |
|
1240 |
+
/***/ "./assets/src/apps/js/admin/pages/tools/reset-data/index.js":
|
1241 |
+
/*!******************************************************************!*\
|
1242 |
+
!*** ./assets/src/apps/js/admin/pages/tools/reset-data/index.js ***!
|
1243 |
+
\******************************************************************/
|
1244 |
/*! exports provided: default */
|
1245 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1246 |
|
1247 |
"use strict";
|
1248 |
__webpack_require__.r(__webpack_exports__);
|
1249 |
+
/* harmony import */ var _course__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./course */ "./assets/src/apps/js/admin/pages/tools/reset-data/course.js");
|
1250 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
1251 |
|
1252 |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
1271 |
|
1272 |
/***/ }),
|
1273 |
|
1274 |
+
/***/ "./assets/src/apps/js/utils/handle-ajax-api.js":
|
1275 |
+
/*!*****************************************************!*\
|
1276 |
+
!*** ./assets/src/apps/js/utils/handle-ajax-api.js ***!
|
1277 |
+
\*****************************************************/
|
1278 |
/*! exports provided: default */
|
1279 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1280 |
|
1304 |
|
1305 |
/***/ }),
|
1306 |
|
1307 |
+
/***/ "./assets/src/apps/js/utils/lp-modal-overlay.js":
|
1308 |
+
/*!******************************************************!*\
|
1309 |
+
!*** ./assets/src/apps/js/utils/lp-modal-overlay.js ***!
|
1310 |
+
\******************************************************/
|
1311 |
/*! exports provided: default */
|
1312 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1313 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/admin/pages/widgets.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/apps/js/admin/pages/widgets.js":
|
90 |
+
/*!***************************************************!*\
|
91 |
+
!*** ./assets/src/apps/js/admin/pages/widgets.js ***!
|
92 |
+
\***************************************************/
|
93 |
/*! no static exports found */
|
94 |
/***/ (function(module, exports) {
|
95 |
|
@@ -82,15 +82,15 @@ this["LP"] = this["LP"] || {}; this["LP"]["custom"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! no static exports found */
|
95 |
/***/ (function(module, exports) {
|
96 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/custom.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/custom.js":
|
91 |
+
/*!***********************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/custom.js ***!
|
93 |
+
\***********************************************/
|
94 |
/*! no static exports found */
|
95 |
/***/ (function(module, exports) {
|
96 |
|
@@ -82,15 +82,15 @@ this["LP"] = this["LP"] || {}; this["LP"]["lesson"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! no static exports found */
|
95 |
/***/ (function(module, exports) {
|
96 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/lesson.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/lesson.js":
|
91 |
+
/*!***********************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/lesson.js ***!
|
93 |
+
\***********************************************/
|
94 |
/*! no static exports found */
|
95 |
/***/ (function(module, exports) {
|
96 |
|
@@ -82,15 +82,15 @@ this["LP"] = this["LP"] || {}; this["LP"]["config"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! exports provided: classNames, isQuestionCorrect, questionBlocks, questionFooterButtons, questionTitleParts, questionChecker, quizStartBlocks */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/lp-configs.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/lp-configs.js":
|
91 |
+
/*!***************************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/lp-configs.js ***!
|
93 |
+
\***************************************************/
|
94 |
/*! exports provided: classNames, isQuestionCorrect, questionBlocks, questionFooterButtons, questionTitleParts, questionChecker, quizStartBlocks */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
@@ -82,36 +82,36 @@ this["LP"] = this["LP"] || {}; this["LP"]["modal"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! exports provided: default */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
-
/* harmony import */ var _modal_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal/index */ "
|
100 |
|
101 |
/* harmony default export */ __webpack_exports__["default"] = (_modal_index__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
102 |
|
103 |
/***/ }),
|
104 |
|
105 |
-
/***/ "
|
106 |
-
|
107 |
-
!***
|
108 |
-
|
109 |
/*! exports provided: default */
|
110 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
111 |
|
112 |
"use strict";
|
113 |
__webpack_require__.r(__webpack_exports__);
|
114 |
-
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./store */ "
|
115 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
116 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
117 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
@@ -178,10 +178,10 @@ var Modal = function Modal(_ref) {
|
|
178 |
|
179 |
/***/ }),
|
180 |
|
181 |
-
/***/ "
|
182 |
-
|
183 |
-
!***
|
184 |
-
|
185 |
/*! exports provided: show, hide, confirm */
|
186 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
187 |
|
@@ -211,10 +211,10 @@ function confirm(value) {
|
|
211 |
|
212 |
/***/ }),
|
213 |
|
214 |
-
/***/ "
|
215 |
-
|
216 |
-
!***
|
217 |
-
|
218 |
/*! exports provided: default */
|
219 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
220 |
|
@@ -222,10 +222,10 @@ function confirm(value) {
|
|
222 |
__webpack_require__.r(__webpack_exports__);
|
223 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
224 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
225 |
-
/* harmony import */ var _reducer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reducer */ "
|
226 |
-
/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "
|
227 |
-
/* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "
|
228 |
-
/* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "
|
229 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
230 |
|
231 |
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
@@ -249,16 +249,16 @@ Object(_middlewares__WEBPACK_IMPORTED_MODULE_4__["default"])(store);
|
|
249 |
|
250 |
/***/ }),
|
251 |
|
252 |
-
/***/ "
|
253 |
-
|
254 |
-
!***
|
255 |
-
|
256 |
/*! exports provided: default */
|
257 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
258 |
|
259 |
"use strict";
|
260 |
__webpack_require__.r(__webpack_exports__);
|
261 |
-
/* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! refx */ "
|
262 |
/* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(refx__WEBPACK_IMPORTED_MODULE_0__);
|
263 |
/**
|
264 |
* External dependencies
|
@@ -299,10 +299,10 @@ function applyMiddlewares(store) {
|
|
299 |
|
300 |
/***/ }),
|
301 |
|
302 |
-
/***/ "
|
303 |
-
|
304 |
-
!***
|
305 |
-
|
306 |
/*! exports provided: Modal, default */
|
307 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
308 |
|
@@ -350,10 +350,10 @@ var Modal = function Modal() {
|
|
350 |
|
351 |
/***/ }),
|
352 |
|
353 |
-
/***/ "
|
354 |
-
|
355 |
-
!***
|
356 |
-
|
357 |
/*! exports provided: isOpen, getMessage, confirm */
|
358 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
359 |
|
@@ -388,10 +388,10 @@ function confirm(state, message, cb) {
|
|
388 |
|
389 |
/***/ }),
|
390 |
|
391 |
-
/***/ "
|
392 |
-
|
393 |
-
!***
|
394 |
-
|
395 |
/*! no static exports found */
|
396 |
/***/ (function(module, exports, __webpack_require__) {
|
397 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/modal.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/modal.js":
|
91 |
+
/*!**********************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/modal.js ***!
|
93 |
+
\**********************************************/
|
94 |
/*! exports provided: default */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
+
/* harmony import */ var _modal_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal/index */ "./assets/src/apps/js/frontend/modal/index.js");
|
100 |
|
101 |
/* harmony default export */ __webpack_exports__["default"] = (_modal_index__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
102 |
|
103 |
/***/ }),
|
104 |
|
105 |
+
/***/ "./assets/src/apps/js/frontend/modal/index.js":
|
106 |
+
/*!****************************************************!*\
|
107 |
+
!*** ./assets/src/apps/js/frontend/modal/index.js ***!
|
108 |
+
\****************************************************/
|
109 |
/*! exports provided: default */
|
110 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
111 |
|
112 |
"use strict";
|
113 |
__webpack_require__.r(__webpack_exports__);
|
114 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./store */ "./assets/src/apps/js/frontend/modal/store/index.js");
|
115 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
116 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
117 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
178 |
|
179 |
/***/ }),
|
180 |
|
181 |
+
/***/ "./assets/src/apps/js/frontend/modal/store/actions.js":
|
182 |
+
/*!************************************************************!*\
|
183 |
+
!*** ./assets/src/apps/js/frontend/modal/store/actions.js ***!
|
184 |
+
\************************************************************/
|
185 |
/*! exports provided: show, hide, confirm */
|
186 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
187 |
|
211 |
|
212 |
/***/ }),
|
213 |
|
214 |
+
/***/ "./assets/src/apps/js/frontend/modal/store/index.js":
|
215 |
+
/*!**********************************************************!*\
|
216 |
+
!*** ./assets/src/apps/js/frontend/modal/store/index.js ***!
|
217 |
+
\**********************************************************/
|
218 |
/*! exports provided: default */
|
219 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
220 |
|
222 |
__webpack_require__.r(__webpack_exports__);
|
223 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
224 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
225 |
+
/* harmony import */ var _reducer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reducer */ "./assets/src/apps/js/frontend/modal/store/reducer.js");
|
226 |
+
/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "./assets/src/apps/js/frontend/modal/store/actions.js");
|
227 |
+
/* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "./assets/src/apps/js/frontend/modal/store/selectors.js");
|
228 |
+
/* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "./assets/src/apps/js/frontend/modal/store/middlewares.js");
|
229 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
230 |
|
231 |
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
249 |
|
250 |
/***/ }),
|
251 |
|
252 |
+
/***/ "./assets/src/apps/js/frontend/modal/store/middlewares.js":
|
253 |
+
/*!****************************************************************!*\
|
254 |
+
!*** ./assets/src/apps/js/frontend/modal/store/middlewares.js ***!
|
255 |
+
\****************************************************************/
|
256 |
/*! exports provided: default */
|
257 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
258 |
|
259 |
"use strict";
|
260 |
__webpack_require__.r(__webpack_exports__);
|
261 |
+
/* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! refx */ "./node_modules/refx/refx.js");
|
262 |
/* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(refx__WEBPACK_IMPORTED_MODULE_0__);
|
263 |
/**
|
264 |
* External dependencies
|
299 |
|
300 |
/***/ }),
|
301 |
|
302 |
+
/***/ "./assets/src/apps/js/frontend/modal/store/reducer.js":
|
303 |
+
/*!************************************************************!*\
|
304 |
+
!*** ./assets/src/apps/js/frontend/modal/store/reducer.js ***!
|
305 |
+
\************************************************************/
|
306 |
/*! exports provided: Modal, default */
|
307 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
308 |
|
350 |
|
351 |
/***/ }),
|
352 |
|
353 |
+
/***/ "./assets/src/apps/js/frontend/modal/store/selectors.js":
|
354 |
+
/*!**************************************************************!*\
|
355 |
+
!*** ./assets/src/apps/js/frontend/modal/store/selectors.js ***!
|
356 |
+
\**************************************************************/
|
357 |
/*! exports provided: isOpen, getMessage, confirm */
|
358 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
359 |
|
388 |
|
389 |
/***/ }),
|
390 |
|
391 |
+
/***/ "./node_modules/refx/refx.js":
|
392 |
+
/*!***********************************!*\
|
393 |
+
!*** ./node_modules/refx/refx.js ***!
|
394 |
+
\***********************************/
|
395 |
/*! no static exports found */
|
396 |
/***/ (function(module, exports, __webpack_require__) {
|
397 |
|
@@ -82,22 +82,22 @@ this["LP"] = this["LP"] || {}; this["LP"]["profile"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! no exports provided */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
-
/* harmony import */ var _profile_course_tab__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./profile/course-tab */ "
|
100 |
-
/* harmony import */ var _profile_statistic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./profile/statistic */ "
|
101 |
|
102 |
|
103 |
document.addEventListener('DOMContentLoaded', function (event) {
|
@@ -107,10 +107,10 @@ document.addEventListener('DOMContentLoaded', function (event) {
|
|
107 |
|
108 |
/***/ }),
|
109 |
|
110 |
-
/***/ "
|
111 |
-
|
112 |
-
!***
|
113 |
-
|
114 |
/*! exports provided: default */
|
115 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
116 |
|
@@ -342,10 +342,10 @@ var courseTab = function courseTab() {
|
|
342 |
|
343 |
/***/ }),
|
344 |
|
345 |
-
/***/ "
|
346 |
-
|
347 |
-
!***
|
348 |
-
|
349 |
/*! exports provided: default */
|
350 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
351 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/profile.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/profile.js":
|
91 |
+
/*!************************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/profile.js ***!
|
93 |
+
\************************************************/
|
94 |
/*! no exports provided */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
+
/* harmony import */ var _profile_course_tab__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./profile/course-tab */ "./assets/src/apps/js/frontend/profile/course-tab.js");
|
100 |
+
/* harmony import */ var _profile_statistic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./profile/statistic */ "./assets/src/apps/js/frontend/profile/statistic.js");
|
101 |
|
102 |
|
103 |
document.addEventListener('DOMContentLoaded', function (event) {
|
107 |
|
108 |
/***/ }),
|
109 |
|
110 |
+
/***/ "./assets/src/apps/js/frontend/profile/course-tab.js":
|
111 |
+
/*!***********************************************************!*\
|
112 |
+
!*** ./assets/src/apps/js/frontend/profile/course-tab.js ***!
|
113 |
+
\***********************************************************/
|
114 |
/*! exports provided: default */
|
115 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
116 |
|
342 |
|
343 |
/***/ }),
|
344 |
|
345 |
+
/***/ "./assets/src/apps/js/frontend/profile/statistic.js":
|
346 |
+
/*!**********************************************************!*\
|
347 |
+
!*** ./assets/src/apps/js/frontend/profile/statistic.js ***!
|
348 |
+
\**********************************************************/
|
349 |
/*! exports provided: default */
|
350 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
351 |
|
@@ -82,21 +82,21 @@ this["LP"] = this["LP"] || {}; this["LP"]["questionTypes"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! exports provided: QuestionBase, SingleChoice, MultipleChoices, TrueOrFalse, FillInBlanks, default */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
-
/* harmony import */ var _question_types_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question-types/index */ "
|
100 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionBase", function() { return _question_types_index__WEBPACK_IMPORTED_MODULE_0__["QuestionBase"]; });
|
101 |
|
102 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SingleChoice", function() { return _question_types_index__WEBPACK_IMPORTED_MODULE_0__["SingleChoice"]; });
|
@@ -113,28 +113,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
113 |
|
114 |
/***/ }),
|
115 |
|
116 |
-
/***/ "
|
117 |
-
|
118 |
-
!***
|
119 |
-
|
120 |
/*! exports provided: QuestionBase, SingleChoice, MultipleChoices, TrueOrFalse, FillInBlanks */
|
121 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
122 |
|
123 |
"use strict";
|
124 |
__webpack_require__.r(__webpack_exports__);
|
125 |
-
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question-base */ "
|
126 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionBase", function() { return _question_base__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
127 |
|
128 |
-
/* harmony import */ var _questions_single_choice__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questions/single-choice */ "
|
129 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SingleChoice", function() { return _questions_single_choice__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
130 |
|
131 |
-
/* harmony import */ var _questions_multiple_choices__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questions/multiple-choices */ "
|
132 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultipleChoices", function() { return _questions_multiple_choices__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
133 |
|
134 |
-
/* harmony import */ var _questions_true_or_false__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questions/true-or-false */ "
|
135 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TrueOrFalse", function() { return _questions_true_or_false__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
136 |
|
137 |
-
/* harmony import */ var _questions_fill_in_blanks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./questions/fill-in-blanks */ "
|
138 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FillInBlanks", function() { return _questions_fill_in_blanks__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
139 |
|
140 |
|
@@ -145,10 +145,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
145 |
|
146 |
/***/ }),
|
147 |
|
148 |
-
/***/ "
|
149 |
-
|
150 |
-
!***
|
151 |
-
|
152 |
/*! exports provided: default */
|
153 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
154 |
|
@@ -443,10 +443,10 @@ var QuestionBase = /*#__PURE__*/function (_Component) {
|
|
443 |
|
444 |
/***/ }),
|
445 |
|
446 |
-
/***/ "
|
447 |
-
|
448 |
-
!***
|
449 |
-
|
450 |
/*! exports provided: default */
|
451 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
452 |
|
@@ -454,7 +454,7 @@ var QuestionBase = /*#__PURE__*/function (_Component) {
|
|
454 |
__webpack_require__.r(__webpack_exports__);
|
455 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
456 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
|
457 |
-
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../question-base */ "
|
458 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
459 |
|
460 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -657,10 +657,10 @@ var QuestionFillInBlanks = /*#__PURE__*/function (_QuestionBase) {
|
|
657 |
|
658 |
/***/ }),
|
659 |
|
660 |
-
/***/ "
|
661 |
-
|
662 |
-
!***
|
663 |
-
|
664 |
/*! exports provided: default */
|
665 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
666 |
|
@@ -670,7 +670,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
670 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
671 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
672 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
673 |
-
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../question-base */ "
|
674 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
675 |
|
676 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -685,6 +685,10 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
685 |
|
686 |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
687 |
|
|
|
|
|
|
|
|
|
688 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
689 |
|
690 |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
@@ -774,23 +778,23 @@ var QuestionMultipleChoices = /*#__PURE__*/function (_QuestionBase) {
|
|
774 |
return _this;
|
775 |
}
|
776 |
|
777 |
-
return QuestionMultipleChoices;
|
778 |
}(_question_base__WEBPACK_IMPORTED_MODULE_2__["default"]);
|
779 |
|
780 |
/* harmony default export */ __webpack_exports__["default"] = (QuestionMultipleChoices);
|
781 |
|
782 |
/***/ }),
|
783 |
|
784 |
-
/***/ "
|
785 |
-
|
786 |
-
!***
|
787 |
-
|
788 |
/*! exports provided: default */
|
789 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
790 |
|
791 |
"use strict";
|
792 |
__webpack_require__.r(__webpack_exports__);
|
793 |
-
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../question-base */ "
|
794 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
795 |
|
796 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -805,6 +809,10 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
805 |
|
806 |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
807 |
|
|
|
|
|
|
|
|
|
808 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
809 |
|
810 |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
@@ -867,23 +875,23 @@ var QuestionSingleChoice = /*#__PURE__*/function (_QuestionBase) {
|
|
867 |
return _this;
|
868 |
}
|
869 |
|
870 |
-
return QuestionSingleChoice;
|
871 |
}(_question_base__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
872 |
|
873 |
/* harmony default export */ __webpack_exports__["default"] = (QuestionSingleChoice);
|
874 |
|
875 |
/***/ }),
|
876 |
|
877 |
-
/***/ "
|
878 |
-
|
879 |
-
!***
|
880 |
-
|
881 |
/*! exports provided: default */
|
882 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
883 |
|
884 |
"use strict";
|
885 |
__webpack_require__.r(__webpack_exports__);
|
886 |
-
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../question-base */ "
|
887 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
888 |
|
889 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -898,6 +906,10 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
898 |
|
899 |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
900 |
|
|
|
|
|
|
|
|
|
901 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
902 |
|
903 |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
@@ -959,17 +971,17 @@ var QuestionTrueOrFalse = /*#__PURE__*/function (_QuestionBase) {
|
|
959 |
return _this;
|
960 |
}
|
961 |
|
962 |
-
return QuestionTrueOrFalse;
|
963 |
}(_question_base__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
964 |
|
965 |
/* harmony default export */ __webpack_exports__["default"] = (QuestionTrueOrFalse);
|
966 |
|
967 |
/***/ }),
|
968 |
|
969 |
-
/***/ "
|
970 |
-
|
971 |
-
!***
|
972 |
-
|
973 |
/*! exports provided: QuestionBase, SingleChoice, MultipleChoices, TrueOrFalse, FillInBlanks, default */
|
974 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
975 |
|
@@ -983,7 +995,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
983 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
|
984 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
985 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
986 |
-
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components */ "
|
987 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionBase", function() { return _components__WEBPACK_IMPORTED_MODULE_4__["QuestionBase"]; });
|
988 |
|
989 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SingleChoice", function() { return _components__WEBPACK_IMPORTED_MODULE_4__["SingleChoice"]; });
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/question-types.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/question-types.js":
|
91 |
+
/*!*******************************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/question-types.js ***!
|
93 |
+
\*******************************************************/
|
94 |
/*! exports provided: QuestionBase, SingleChoice, MultipleChoices, TrueOrFalse, FillInBlanks, default */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
+
/* harmony import */ var _question_types_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question-types/index */ "./assets/src/apps/js/frontend/question-types/index.js");
|
100 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionBase", function() { return _question_types_index__WEBPACK_IMPORTED_MODULE_0__["QuestionBase"]; });
|
101 |
|
102 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SingleChoice", function() { return _question_types_index__WEBPACK_IMPORTED_MODULE_0__["SingleChoice"]; });
|
113 |
|
114 |
/***/ }),
|
115 |
|
116 |
+
/***/ "./assets/src/apps/js/frontend/question-types/components/index.js":
|
117 |
+
/*!************************************************************************!*\
|
118 |
+
!*** ./assets/src/apps/js/frontend/question-types/components/index.js ***!
|
119 |
+
\************************************************************************/
|
120 |
/*! exports provided: QuestionBase, SingleChoice, MultipleChoices, TrueOrFalse, FillInBlanks */
|
121 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
122 |
|
123 |
"use strict";
|
124 |
__webpack_require__.r(__webpack_exports__);
|
125 |
+
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question-base */ "./assets/src/apps/js/frontend/question-types/components/question-base/index.js");
|
126 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionBase", function() { return _question_base__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
127 |
|
128 |
+
/* harmony import */ var _questions_single_choice__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questions/single-choice */ "./assets/src/apps/js/frontend/question-types/components/questions/single-choice/index.js");
|
129 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SingleChoice", function() { return _questions_single_choice__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
130 |
|
131 |
+
/* harmony import */ var _questions_multiple_choices__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questions/multiple-choices */ "./assets/src/apps/js/frontend/question-types/components/questions/multiple-choices/index.js");
|
132 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultipleChoices", function() { return _questions_multiple_choices__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
133 |
|
134 |
+
/* harmony import */ var _questions_true_or_false__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questions/true-or-false */ "./assets/src/apps/js/frontend/question-types/components/questions/true-or-false/index.js");
|
135 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TrueOrFalse", function() { return _questions_true_or_false__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
136 |
|
137 |
+
/* harmony import */ var _questions_fill_in_blanks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./questions/fill-in-blanks */ "./assets/src/apps/js/frontend/question-types/components/questions/fill-in-blanks/index.js");
|
138 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FillInBlanks", function() { return _questions_fill_in_blanks__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
139 |
|
140 |
|
145 |
|
146 |
/***/ }),
|
147 |
|
148 |
+
/***/ "./assets/src/apps/js/frontend/question-types/components/question-base/index.js":
|
149 |
+
/*!**************************************************************************************!*\
|
150 |
+
!*** ./assets/src/apps/js/frontend/question-types/components/question-base/index.js ***!
|
151 |
+
\**************************************************************************************/
|
152 |
/*! exports provided: default */
|
153 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
154 |
|
443 |
|
444 |
/***/ }),
|
445 |
|
446 |
+
/***/ "./assets/src/apps/js/frontend/question-types/components/questions/fill-in-blanks/index.js":
|
447 |
+
/*!*************************************************************************************************!*\
|
448 |
+
!*** ./assets/src/apps/js/frontend/question-types/components/questions/fill-in-blanks/index.js ***!
|
449 |
+
\*************************************************************************************************/
|
450 |
/*! exports provided: default */
|
451 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
452 |
|
454 |
__webpack_require__.r(__webpack_exports__);
|
455 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
456 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
|
457 |
+
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../question-base */ "./assets/src/apps/js/frontend/question-types/components/question-base/index.js");
|
458 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
459 |
|
460 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
657 |
|
658 |
/***/ }),
|
659 |
|
660 |
+
/***/ "./assets/src/apps/js/frontend/question-types/components/questions/multiple-choices/index.js":
|
661 |
+
/*!***************************************************************************************************!*\
|
662 |
+
!*** ./assets/src/apps/js/frontend/question-types/components/questions/multiple-choices/index.js ***!
|
663 |
+
\***************************************************************************************************/
|
664 |
/*! exports provided: default */
|
665 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
666 |
|
670 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
671 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
672 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
673 |
+
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../question-base */ "./assets/src/apps/js/frontend/question-types/components/question-base/index.js");
|
674 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
675 |
|
676 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
685 |
|
686 |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
687 |
|
688 |
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
689 |
+
|
690 |
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
691 |
+
|
692 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
693 |
|
694 |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
778 |
return _this;
|
779 |
}
|
780 |
|
781 |
+
return _createClass(QuestionMultipleChoices);
|
782 |
}(_question_base__WEBPACK_IMPORTED_MODULE_2__["default"]);
|
783 |
|
784 |
/* harmony default export */ __webpack_exports__["default"] = (QuestionMultipleChoices);
|
785 |
|
786 |
/***/ }),
|
787 |
|
788 |
+
/***/ "./assets/src/apps/js/frontend/question-types/components/questions/single-choice/index.js":
|
789 |
+
/*!************************************************************************************************!*\
|
790 |
+
!*** ./assets/src/apps/js/frontend/question-types/components/questions/single-choice/index.js ***!
|
791 |
+
\************************************************************************************************/
|
792 |
/*! exports provided: default */
|
793 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
794 |
|
795 |
"use strict";
|
796 |
__webpack_require__.r(__webpack_exports__);
|
797 |
+
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../question-base */ "./assets/src/apps/js/frontend/question-types/components/question-base/index.js");
|
798 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
799 |
|
800 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
809 |
|
810 |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
811 |
|
812 |
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
813 |
+
|
814 |
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
815 |
+
|
816 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
817 |
|
818 |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
875 |
return _this;
|
876 |
}
|
877 |
|
878 |
+
return _createClass(QuestionSingleChoice);
|
879 |
}(_question_base__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
880 |
|
881 |
/* harmony default export */ __webpack_exports__["default"] = (QuestionSingleChoice);
|
882 |
|
883 |
/***/ }),
|
884 |
|
885 |
+
/***/ "./assets/src/apps/js/frontend/question-types/components/questions/true-or-false/index.js":
|
886 |
+
/*!************************************************************************************************!*\
|
887 |
+
!*** ./assets/src/apps/js/frontend/question-types/components/questions/true-or-false/index.js ***!
|
888 |
+
\************************************************************************************************/
|
889 |
/*! exports provided: default */
|
890 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
891 |
|
892 |
"use strict";
|
893 |
__webpack_require__.r(__webpack_exports__);
|
894 |
+
/* harmony import */ var _question_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../question-base */ "./assets/src/apps/js/frontend/question-types/components/question-base/index.js");
|
895 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
896 |
|
897 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
906 |
|
907 |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
908 |
|
909 |
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
910 |
+
|
911 |
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
912 |
+
|
913 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
914 |
|
915 |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
971 |
return _this;
|
972 |
}
|
973 |
|
974 |
+
return _createClass(QuestionTrueOrFalse);
|
975 |
}(_question_base__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
976 |
|
977 |
/* harmony default export */ __webpack_exports__["default"] = (QuestionTrueOrFalse);
|
978 |
|
979 |
/***/ }),
|
980 |
|
981 |
+
/***/ "./assets/src/apps/js/frontend/question-types/index.js":
|
982 |
+
/*!*************************************************************!*\
|
983 |
+
!*** ./assets/src/apps/js/frontend/question-types/index.js ***!
|
984 |
+
\*************************************************************/
|
985 |
/*! exports provided: QuestionBase, SingleChoice, MultipleChoices, TrueOrFalse, FillInBlanks, default */
|
986 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
987 |
|
995 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
|
996 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
997 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
998 |
+
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components */ "./assets/src/apps/js/frontend/question-types/components/index.js");
|
999 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionBase", function() { return _components__WEBPACK_IMPORTED_MODULE_4__["QuestionBase"]; });
|
1000 |
|
1001 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SingleChoice", function() { return _components__WEBPACK_IMPORTED_MODULE_4__["SingleChoice"]; });
|
@@ -1 +1 @@
|
|
1 |
-
this.LP=this.LP||{},this.LP.questionTypes=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},22:function(e,t,r){"use strict";r.r(t),r.d(t,"QuestionBase",(function(){return v})),r.d(t,"SingleChoice",(function(){return E})),r.d(t,"MultipleChoices",(function(){return U})),r.d(t,"TrueOrFalse",(function(){return Y})),r.d(t,"FillInBlanks",(function(){return fe}));var n=r(3),o=r(4),i=r(1),u=r(0);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(t){var o=b(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return p(this,r)}}function p(e,t){if(t&&("object"===c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var h=lodash,m=h.isArray,v=(h.get,h.set,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(c,e);var t,r,n,o=l(c);function c(e){var t;a(this,c),d(y(t=o.apply(this,arguments)),"prepare",(function(e,t){var r=e.question;return r&&r.id!==t.questionId?{options:t.self.parseOptions(r.options)}:null})),d(y(t),"setInputRef",(function(e,r){t.inputs||(t.inputs={}),t.inputs[r]=e})),d(y(t),"maybeShowCorrectAnswer",(function(){var e=t.props,r=e.status,n=e.isCheckedAnswer,o=e.showCorrectReview,i=e.isReviewing;return"completed"===r&&o||n&&!i})),d(y(t),"maybeDisabledOption",(function(e){var r=t.props,n=(r.answered,r.status);return r.isCheckedAnswer||"started"!==n})),d(y(t),"setAnswerChecked",(function(){return function(e){var r=t.props,n=r.updateUserQuestionAnswers,o=r.question;if("started"!==r.status)return Object(u.__)("LP Error: can not set answers","learnpress");var i=t.$wrap.find(".option-check"),c=[],a="multi_choice"!==o.type;i.each((function(e,t){if(t.checked&&(c.push(t.value),a))return!1})),n(o.id,a?c[0]:c)}})),d(y(t),"maybeCheckedAnswer",(function(e){var r=t.props.answered;return m(r)?!!r.find((function(t){return t==e})):e==r})),d(y(t),"getOptionType",(function(e,t){var r="radio";switch(e){case"multi_choice":r="checkbox"}return r})),d(y(t),"isDefaultType",(function(){return t.props.supportOptions})),d(y(t),"getWarningMessage",(function(){return React.createElement(React.Fragment,null,Object(u.__)("Render function should be overwritten from base.","learnpress"))})),d(y(t),"getOptionClass",(function(e){t.props.answered;return["answer-option"]})),d(y(t),"parseOptions",(function(e){return e&&(e=m(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=m(e)?e:JSON.parse(e)),e||[]})),d(y(t),"getOptions",(function(){return t.state.options||[]})),d(y(t),"isCorrect",(function(){var e,r,n,o=t.props.answered;if(!o)return!1;for(e=0,n=t.getOptions();e<n.length;e++)if("yes"===(r=n[e]).isTrue&&o==r.value)return!0;return!1})),d(y(t),"isChecked",(function(){var e=t.props.question;return Object(i.select)("learnpress/quiz").isCheckedAnswer(e.id)})),d(y(t),"getCorrectLabel",(function(){var e=t.props,r=(e.status,e.answered,e.question),n=(LP.config.isQuestionCorrect[r.type]||t.isCorrect).call(y(t));return t.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response"+(n?" correct":" incorrect")},React.createElement("span",{className:"label"},n?Object(u.__)("Correct","learnpress"):Object(u.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(u.__)("%d/%d point","learnpress"),n?r.point:0,r.point)))}));var r=e.question;return t.state={optionClass:["answer-option"],questionId:0,options:r?t.parseOptions(r.options):[],self:y(t)},e.$wrap&&(t.$wrap=e.$wrap),t}return t=c,n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.self.prepare(e,t)}}],(r=[{key:"componentDidMount",value:function(){var e=this.prepare(this.props,this.state);e&&this.setState(e)}},{key:"render",value:function(){var e=this,t=this.props,r=t.question,n=t.status;return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(r.id),className:"answer-options"},this.getOptions().map((function(t){var o="learn-press-answer-option-".concat(t.uid);return React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.uid)},React.createElement("input",{type:e.getOptionType(r.type,t),className:"option-check",name:"started"===n?"learn-press-question-".concat(r.id):"",id:o,ref:function(r){e.setInputRef(r,t.value)},onChange:e.setAnswerChecked(),disabled:e.maybeDisabledOption(t),checked:e.maybeCheckedAnswer(t.value),value:"started"===n?t.value:""}),React.createElement("label",{htmlFor:o,className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}}))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&s(t.prototype,r),n&&s(t,n),c}(n.Component));function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function j(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=A(e);if(t){var o=A(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return R(this,r)}}function R(e,t){if(t&&("object"===w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return P(e)}function P(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var E=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_(e,t)}(r,e);var t=S(r);function r(){var e;j(this,r);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return C(P(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var r=e.props.answered,n=O(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?r===t.value&&n.push("answered-correct"):r===t.value&&n.push("answered-wrong"))),n})),e}return r}(v);function T(e){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e){return function(e){if(Array.isArray(e))return x(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function q(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=N(e);if(t){var o=N(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return L(this,r)}}function L(e,t){if(t&&("object"===T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return M(e)}function M(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var F=lodash.isBoolean,U=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&I(e,t)}(r,e);var t=D(r);function r(){var e;q(this,r);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return B(M(e=t.call.apply(t,[this].concat(o))),"isCorrect",(function(){var t,r,n,o=e.props.answered;if(F(o)||!o)return!1;for(t=0,n=e.getOptions();t<n.length;t++)if("yes"===(r=n[t]).isTrue){if(-1===o.indexOf(r.value))return!1}else if(-1!==o.indexOf(r.value))return!1;return!0})),B(M(e),"getOptionClass",(function(t){var r=e.props.answered,n=k(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?-1!==r.indexOf(t.value)&&n.push("answered-correct"):-1!==r.indexOf(t.value)&&n.push("answered-wrong"))),n})),e}return r}(v);function $(e){return($="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Q(e){return function(e){if(Array.isArray(e))return J(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return J(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return J(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function W(e,t){return(W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=V(e);if(t){var o=V(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return G(this,r)}}function G(e,t){if(t&&("object"===$(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&W(e,t)}(r,e);var t=z(r);function r(){var e;H(this,r);for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return X(K(e=t.call.apply(t,[this].concat(o))),"getOptionClass",(function(t){var r=e.props.answered,n=Q(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?r===t.value&&n.push("answered-correct"):r===t.value&&n.push("answered-wrong"))),n})),e}return r}(v);function Z(e){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return te(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ne(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ae(e);if(t){var o=ae(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return ue(this,r)}}function ue(e,t){if(t&&("object"===Z(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ce(e)}function ce(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function se(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var fe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(i,e);var t,r,n,o=ie(i);function i(){var e;re(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return se(ce(e=o.call.apply(o,[this].concat(r))),"updateFibAnswer",(function(){var t=document.querySelectorAll(".lp-fib-input > input"),r=e.props.answered||{};ee(t).map((function(t){t.addEventListener("input",(function(n){e.setAnswered(r,t.dataset.id,n.target.value)})),t.addEventListener("paste",(function(n){e.setAnswered(r,t.dataset.id,n.target.value)}))}))})),se(ce(e),"setAnswered",(function(t,r,n){var o=e.props,i=o.updateUserQuestionAnswers,u=o.question;if("started"!==o.status)return"LP Error: can not set answers";var c=Object.assign(t,se({},r,n));i(u.id,c)})),se(ce(e),"getCorrectLabel",(function(){var t=e.props,r=t.question,n=t.mark,o=n||0;return n&&(Number.isInteger(n)||(o=n.toFixed(2))),e.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response correct"},React.createElement("span",{className:"label"},Object(u.__)("Points","learnpress")),React.createElement("span",{className:"point"},"".concat(o,"/").concat(r.point," ").concat(Object(u.__)("point","learnpress"))),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#00adff"}}),Object(u.__)("Correct","learnpress")),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#d85554"}}),Object(u.__)("Incorrect","learnpress")))})),se(ce(e),"convertInputField",(function(e){var t=e.title,r=null==e?void 0:e.answers;return e.ids.map((function(e,n){var o="{{FIB_"+e+"}}",i="",u=r?null==r?void 0:r[e]:void 0;if(u){var c,a;if(i+='<span class="lp-fib-answered '.concat(null!=u&&u.isCorrect?"correct":"fail",'">'),null==u||!u.isCorrect)i+='<span class="lp-fib-answered__answer">'.concat(null!==(a=null==u?void 0:u.answer)&&void 0!==a?a:"","</span> → ");i+='<span class="lp-fib-answered__fill">'.concat(null!==(c=null==u?void 0:u.correct)&&void 0!==c?c:"","</span>"),i+="</span>"}else i+='<div class="lp-fib-input" style="display: inline-block; width: auto;">',i+='<input type="text" data-id="'+e+'" value="" />',i+="</div>";t=t.replace(o,i)})),t})),e}return t=i,(r=[{key:"componentDidMount",value:function(){var e=this.props.answered;e&&ee(document.querySelectorAll(".lp-fib-input > input")).map((function(t){e[t.dataset.id]&&(t.value=e[t.dataset.id])})),this.updateFibAnswer()}},{key:"componentDidUpdate",value:function(e){e.answered||this.updateFibAnswer()}},{key:"render",value:function(){var e=this;return React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-fib-content"},this.getOptions().map((function(t){return React.createElement("div",{key:"blank-".concat(t.uid),dangerouslySetInnerHTML:{__html:e.convertInputField(t)||t.value}})}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&ne(t.prototype,r),n&&ne(t,n),i}(v);function le(e){return(le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function be(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function de(e,t){return(de=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function he(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=we(e);if(t){var o=we(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return me(this,r)}}function me(e,t){if(t&&("object"===le(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ve(e)}function ve(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ge=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&de(e,t)}(i,e);var t,r,n,o=he(i);function i(){var e;ye(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Oe(ve(e=o.call.apply(o,[this].concat(r))),"getQuestion",(function(){var t=e.props.question;return LP.Hook.applyFilters("question-types",{single_choice:LP.questionTypes.SingleChoice,multi_choice:LP.questionTypes.MultipleChoices,true_or_false:LP.questionTypes.TrueOrFalse,fill_in_blanks:LP.questionTypes.FillInBlanks})[t.type]})),e}return t=i,(r=[{key:"render",value:function(){var e=this.props,t=e.question,r=e.supportOptions,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(r),!0).forEach((function(t){Oe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},this.props);n.supportOptions=-1!==r.indexOf(t.type);var o=this.getQuestion()||function(){return React.createElement("div",{className:"question-types",dangerouslySetInnerHTML:{__html:Object(u.sprintf)(Object(u.__)("Question <code>%s</code> invalid!","learnpress"),t.type)}})};return React.createElement(React.Fragment,null,React.createElement(o,n))}}])&&be(t.prototype,r),n&&be(t,n),i}(n.Component),je=Object(o.compose)(Object(i.withSelect)((function(e,t){var r=t.question.id,n=e("learnpress/quiz"),o=n.getData,i=n.isCheckedAnswer;return{supportOptions:o("supportOptions"),isCheckedAnswer:i(r),keyPressed:o("keyPressed"),showCorrectReview:o("showCorrectReview"),isReviewing:"reviewing"===o("mode")}})),Object(i.withDispatch)((function(){return{}})))(ge);t.default=je},3:function(e,t){e.exports=window.wp.element},4:function(e,t){e.exports=window.wp.compose}});
|
1 |
+
this.LP=this.LP||{},this.LP.questionTypes=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}({0:function(e,t){e.exports=window.wp.i18n},1:function(e,t){e.exports=window.wp.data},22:function(e,t,r){"use strict";r.r(t),r.d(t,"QuestionBase",(function(){return h})),r.d(t,"SingleChoice",(function(){return T})),r.d(t,"MultipleChoices",(function(){return Q})),r.d(t,"TrueOrFalse",(function(){return te})),r.d(t,"FillInBlanks",(function(){return ye}));var n=r(3),o=r(4),i=r(1),u=r(0);function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(t){var o=b(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return p(this,r)}}function p(e,t){if(t&&("object"===c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var m=lodash,v=m.isArray,h=(m.get,m.set,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(c,e);var t,r,n,o=l(c);function c(e){var t;a(this,c),d(y(t=o.apply(this,arguments)),"prepare",(function(e,t){var r=e.question;return r&&r.id!==t.questionId?{options:t.self.parseOptions(r.options)}:null})),d(y(t),"setInputRef",(function(e,r){t.inputs||(t.inputs={}),t.inputs[r]=e})),d(y(t),"maybeShowCorrectAnswer",(function(){var e=t.props,r=e.status,n=e.isCheckedAnswer,o=e.showCorrectReview,i=e.isReviewing;return"completed"===r&&o||n&&!i})),d(y(t),"maybeDisabledOption",(function(e){var r=t.props,n=(r.answered,r.status);return r.isCheckedAnswer||"started"!==n})),d(y(t),"setAnswerChecked",(function(){return function(e){var r=t.props,n=r.updateUserQuestionAnswers,o=r.question;if("started"!==r.status)return Object(u.__)("LP Error: can not set answers","learnpress");var i=t.$wrap.find(".option-check"),c=[],a="multi_choice"!==o.type;i.each((function(e,t){if(t.checked&&(c.push(t.value),a))return!1})),n(o.id,a?c[0]:c)}})),d(y(t),"maybeCheckedAnswer",(function(e){var r=t.props.answered;return v(r)?!!r.find((function(t){return t==e})):e==r})),d(y(t),"getOptionType",(function(e,t){var r="radio";switch(e){case"multi_choice":r="checkbox"}return r})),d(y(t),"isDefaultType",(function(){return t.props.supportOptions})),d(y(t),"getWarningMessage",(function(){return React.createElement(React.Fragment,null,Object(u.__)("Render function should be overwritten from base.","learnpress"))})),d(y(t),"getOptionClass",(function(e){t.props.answered;return["answer-option"]})),d(y(t),"parseOptions",(function(e){return e&&(e=v(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=v(e)?e:JSON.parse(e)),e||[]})),d(y(t),"getOptions",(function(){return t.state.options||[]})),d(y(t),"isCorrect",(function(){var e,r,n,o=t.props.answered;if(!o)return!1;for(e=0,n=t.getOptions();e<n.length;e++)if("yes"===(r=n[e]).isTrue&&o==r.value)return!0;return!1})),d(y(t),"isChecked",(function(){var e=t.props.question;return Object(i.select)("learnpress/quiz").isCheckedAnswer(e.id)})),d(y(t),"getCorrectLabel",(function(){var e=t.props,r=(e.status,e.answered,e.question),n=(LP.config.isQuestionCorrect[r.type]||t.isCorrect).call(y(t));return t.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response"+(n?" correct":" incorrect")},React.createElement("span",{className:"label"},n?Object(u.__)("Correct","learnpress"):Object(u.__)("Incorrect","learnpress")),React.createElement("span",{className:"point"},sprintf(Object(u.__)("%d/%d point","learnpress"),n?r.point:0,r.point)))}));var r=e.question;return t.state={optionClass:["answer-option"],questionId:0,options:r?t.parseOptions(r.options):[],self:y(t)},e.$wrap&&(t.$wrap=e.$wrap),t}return t=c,n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.self.prepare(e,t)}}],(r=[{key:"componentDidMount",value:function(){var e=this.prepare(this.props,this.state);e&&this.setState(e)}},{key:"render",value:function(){var e=this,t=this.props,r=t.question,n=t.status;return React.createElement("div",{className:"question-answers"},this.isDefaultType()&&React.createElement("ul",{id:"answer-options-".concat(r.id),className:"answer-options"},this.getOptions().map((function(t){var o="learn-press-answer-option-".concat(t.uid);return React.createElement("li",{className:e.getOptionClass(t).join(" "),key:"answer-option-".concat(t.uid)},React.createElement("input",{type:e.getOptionType(r.type,t),className:"option-check",name:"started"===n?"learn-press-question-".concat(r.id):"",id:o,ref:function(r){e.setInputRef(r,t.value)},onChange:e.setAnswerChecked(),disabled:e.maybeDisabledOption(t),checked:e.maybeCheckedAnswer(t.value),value:"started"===n?t.value:""}),React.createElement("label",{htmlFor:o,className:"option-title",dangerouslySetInnerHTML:{__html:t.title||t.value}}))}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&s(t.prototype,r),n&&s(t,n),c}(n.Component));function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=C(e);if(t){var o=C(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return R(this,r)}}function R(e,t){if(t&&("object"===w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return A(e)}function A(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(i,e);var t,r,n,o=P(i);function i(){var e;_(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E(A(e=o.call.apply(o,[this].concat(r))),"getOptionClass",(function(t){var r=e.props.answered,n=O(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?r===t.value&&n.push("answered-correct"):r===t.value&&n.push("answered-wrong"))),n})),e}return t=i,r&&j(t.prototype,r),n&&j(t,n),t}(h);function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function x(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function I(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function D(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=F(e);if(t){var o=F(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return N(this,r)}}function N(e,t){if(t&&("object"===k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return B(e)}function B(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $=lodash.isBoolean,Q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(i,e);var t,r,n,o=M(i);function i(){var e;D(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return U(B(e=o.call.apply(o,[this].concat(r))),"isCorrect",(function(){var t,r,n,o=e.props.answered;if($(o)||!o)return!1;for(t=0,n=e.getOptions();t<n.length;t++)if("yes"===(r=n[t]).isTrue){if(-1===o.indexOf(r.value))return!1}else if(-1!==o.indexOf(r.value))return!1;return!0})),U(B(e),"getOptionClass",(function(t){var r=e.props.answered,n=x(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?-1!==r.indexOf(t.value)&&n.push("answered-correct"):-1!==r.indexOf(t.value)&&n.push("answered-wrong"))),n})),e}return t=i,r&&I(t.prototype,r),n&&I(t,n),t}(h);function J(e){return(J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e){return function(e){if(Array.isArray(e))return W(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return W(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function G(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Z(e);if(t){var o=Z(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return X(this,r)}}function X(e,t){if(t&&("object"===J(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Y(e)}function Y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ee(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var te=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(i,e);var t,r,n,o=V(i);function i(){var e;G(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return ee(Y(e=o.call.apply(o,[this].concat(r))),"getOptionClass",(function(t){var r=e.props.answered,n=H(e.state.optionClass);return e.maybeShowCorrectAnswer()&&("yes"===t.isTrue&&n.push("answer-correct"),r&&("yes"===t.isTrue?r===t.value&&n.push("answered-correct"):r===t.value&&n.push("answered-wrong"))),n})),e}return t=i,r&&z(t.prototype,r),n&&z(t,n),t}(h);function re(e){return(re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ne(e){return function(e){if(Array.isArray(e))return oe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return oe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oe(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ae(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=le(e);if(t){var o=le(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return se(this,r)}}function se(e,t){if(t&&("object"===re(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return fe(e)}function fe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function le(e){return(le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ye=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ce(e,t)}(i,e);var t,r,n,o=ae(i);function i(){var e;ie(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return pe(fe(e=o.call.apply(o,[this].concat(r))),"updateFibAnswer",(function(){var t=document.querySelectorAll(".lp-fib-input > input"),r=e.props.answered||{};ne(t).map((function(t){t.addEventListener("input",(function(n){e.setAnswered(r,t.dataset.id,n.target.value)})),t.addEventListener("paste",(function(n){e.setAnswered(r,t.dataset.id,n.target.value)}))}))})),pe(fe(e),"setAnswered",(function(t,r,n){var o=e.props,i=o.updateUserQuestionAnswers,u=o.question;if("started"!==o.status)return"LP Error: can not set answers";var c=Object.assign(t,pe({},r,n));i(u.id,c)})),pe(fe(e),"getCorrectLabel",(function(){var t=e.props,r=t.question,n=t.mark,o=n||0;return n&&(Number.isInteger(n)||(o=n.toFixed(2))),e.maybeShowCorrectAnswer()&&React.createElement("div",{className:"question-response correct"},React.createElement("span",{className:"label"},Object(u.__)("Points","learnpress")),React.createElement("span",{className:"point"},"".concat(o,"/").concat(r.point," ").concat(Object(u.__)("point","learnpress"))),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#00adff"}}),Object(u.__)("Correct","learnpress")),React.createElement("span",{className:"lp-fib-note"},React.createElement("span",{style:{background:"#d85554"}}),Object(u.__)("Incorrect","learnpress")))})),pe(fe(e),"convertInputField",(function(e){var t=e.title,r=null==e?void 0:e.answers;return e.ids.map((function(e,n){var o="{{FIB_"+e+"}}",i="",u=r?null==r?void 0:r[e]:void 0;if(u){var c,a;if(i+='<span class="lp-fib-answered '.concat(null!=u&&u.isCorrect?"correct":"fail",'">'),null==u||!u.isCorrect)i+='<span class="lp-fib-answered__answer">'.concat(null!==(a=null==u?void 0:u.answer)&&void 0!==a?a:"","</span> → ");i+='<span class="lp-fib-answered__fill">'.concat(null!==(c=null==u?void 0:u.correct)&&void 0!==c?c:"","</span>"),i+="</span>"}else i+='<div class="lp-fib-input" style="display: inline-block; width: auto;">',i+='<input type="text" data-id="'+e+'" value="" />',i+="</div>";t=t.replace(o,i)})),t})),e}return t=i,(r=[{key:"componentDidMount",value:function(){var e=this.props.answered;e&&ne(document.querySelectorAll(".lp-fib-input > input")).map((function(t){e[t.dataset.id]&&(t.value=e[t.dataset.id])})),this.updateFibAnswer()}},{key:"componentDidUpdate",value:function(e){e.answered||this.updateFibAnswer()}},{key:"render",value:function(){var e=this;return React.createElement(React.Fragment,null,React.createElement("div",{className:"lp-fib-content"},this.getOptions().map((function(t){return React.createElement("div",{key:"blank-".concat(t.uid),dangerouslySetInnerHTML:{__html:e.convertInputField(t)||t.value}})}))),!this.isDefaultType()&&this.getWarningMessage(),this.getCorrectLabel())}}])&&ue(t.prototype,r),n&&ue(t,n),i}(h);function be(e){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function he(e,t){return(he=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function we(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=je(e);if(t){var o=je(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Oe(this,r)}}function Oe(e,t){if(t&&("object"===be(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ge(e)}function ge(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function je(e){return(je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Se=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&he(e,t)}(i,e);var t,r,n,o=we(i);function i(){var e;me(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return _e(ge(e=o.call.apply(o,[this].concat(r))),"getQuestion",(function(){var t=e.props.question;return LP.Hook.applyFilters("question-types",{single_choice:LP.questionTypes.SingleChoice,multi_choice:LP.questionTypes.MultipleChoices,true_or_false:LP.questionTypes.TrueOrFalse,fill_in_blanks:LP.questionTypes.FillInBlanks})[t.type]})),e}return t=i,(r=[{key:"render",value:function(){var e=this.props,t=e.question,r=e.supportOptions,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach((function(t){_e(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},this.props);n.supportOptions=-1!==r.indexOf(t.type);var o=this.getQuestion()||function(){return React.createElement("div",{className:"question-types",dangerouslySetInnerHTML:{__html:Object(u.sprintf)(Object(u.__)("Question <code>%s</code> invalid!","learnpress"),t.type)}})};return React.createElement(React.Fragment,null,React.createElement(o,n))}}])&&ve(t.prototype,r),n&&ve(t,n),i}(n.Component),Pe=Object(o.compose)(Object(i.withSelect)((function(e,t){var r=t.question.id,n=e("learnpress/quiz"),o=n.getData,i=n.isCheckedAnswer;return{supportOptions:o("supportOptions"),isCheckedAnswer:i(r),keyPressed:o("keyPressed"),showCorrectReview:o("showCorrectReview"),isReviewing:"reviewing"===o("mode")}})),Object(i.withDispatch)((function(){return{}})))(Se);t.default=Pe},3:function(e,t){e.exports=window.wp.element},4:function(e,t){e.exports=window.wp.compose}});
|
@@ -82,23 +82,23 @@ this["LP"] = this["LP"] || {}; this["LP"]["quiz"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! exports provided: default, init */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; });
|
100 |
-
/* harmony import */ var _quiz_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./quiz/index */ "
|
101 |
-
/* harmony import */ var _single_curriculum_components_compatible__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./single-curriculum/components/compatible */ "
|
102 |
/* harmony import */ var _single_curriculum_components_compatible__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_single_curriculum_components_compatible__WEBPACK_IMPORTED_MODULE_1__);
|
103 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
104 |
|
@@ -118,6 +118,44 @@ var _LP = LP,
|
|
118 |
Modal = _LP.modal["default"];
|
119 |
/* harmony default export */ __webpack_exports__["default"] = (_quiz_index__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
120 |
var init = function init(elem, settings) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
wp.element.render( /*#__PURE__*/React.createElement(Modal, null, /*#__PURE__*/React.createElement(_quiz_index__WEBPACK_IMPORTED_MODULE_0__["default"], {
|
122 |
settings: settings
|
123 |
})), _toConsumableArray(document.querySelectorAll(elem))[0]);
|
@@ -126,10 +164,10 @@ var init = function init(elem, settings) {
|
|
126 |
|
127 |
/***/ }),
|
128 |
|
129 |
-
/***/ "
|
130 |
-
|
131 |
-
!***
|
132 |
-
|
133 |
/*! exports provided: default */
|
134 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
135 |
|
@@ -139,7 +177,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
139 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
140 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
141 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
142 |
-
/* harmony import */ var _duration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../duration */ "
|
143 |
|
144 |
|
145 |
|
@@ -158,7 +196,7 @@ var Attempts = function Attempts() {
|
|
158 |
className: "quiz-attempts__questions"
|
159 |
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Questions', 'learnpress')), /*#__PURE__*/React.createElement("th", {
|
160 |
className: "quiz-attempts__spend"
|
161 |
-
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Time
|
162 |
className: "quiz-attempts__marks"
|
163 |
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Marks', 'learnpress')), /*#__PURE__*/React.createElement("th", {
|
164 |
className: "quiz-attempts__grade"
|
@@ -166,15 +204,14 @@ var Attempts = function Attempts() {
|
|
166 |
className: "quiz-attempts__result"
|
167 |
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Result', 'learnpress')))), /*#__PURE__*/React.createElement("tbody", null, attempts.map(function (row, key) {
|
168 |
// Re-write value to attempts.timeSpend
|
169 |
-
if (lpQuizSettings.checkNorequizenroll == '1') {
|
170 |
-
var timespendStart = window.localStorage.getItem('quiz_start_' + lpQuizSettings.id),
|
171 |
-
timespendEnd = window.localStorage.getItem('quiz_end_' + lpQuizSettings.id);
|
172 |
-
|
173 |
-
if (timespendStart && timespendEnd) {
|
174 |
-
row.timeSpend = timeDifference(timespendStart, timespendEnd).duration;
|
175 |
-
}
|
176 |
-
}
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
return /*#__PURE__*/React.createElement("tr", {
|
179 |
key: "attempt-".concat(key)
|
180 |
}, /*#__PURE__*/React.createElement("td", {
|
@@ -250,16 +287,16 @@ function timeDifference(earlierDate, laterDate) {
|
|
250 |
|
251 |
/***/ }),
|
252 |
|
253 |
-
/***/ "
|
254 |
-
|
255 |
-
!***
|
256 |
-
|
257 |
/*! exports provided: default */
|
258 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
259 |
|
260 |
"use strict";
|
261 |
__webpack_require__.r(__webpack_exports__);
|
262 |
-
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ "
|
263 |
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
|
264 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
265 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
|
@@ -380,10 +417,10 @@ var ButtonCheck = /*#__PURE__*/function (_Component) {
|
|
380 |
|
381 |
/***/ }),
|
382 |
|
383 |
-
/***/ "
|
384 |
-
|
385 |
-
!***
|
386 |
-
|
387 |
/*! exports provided: default */
|
388 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
389 |
|
@@ -481,10 +518,10 @@ var ButtonHint = /*#__PURE__*/function (_Component) {
|
|
481 |
|
482 |
/***/ }),
|
483 |
|
484 |
-
/***/ "
|
485 |
-
|
486 |
-
!***
|
487 |
-
|
488 |
/*! exports provided: MaybeShowButton, default */
|
489 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
490 |
|
@@ -577,24 +614,22 @@ var Buttons = /*#__PURE__*/function (_Component) {
|
|
577 |
!isOpen() && btn && btn.removeAttribute('disabled');
|
578 |
return;
|
579 |
}
|
580 |
-
}
|
581 |
-
|
582 |
-
if (lpQuizSettings.checkNorequizenroll
|
583 |
-
|
584 |
-
|
585 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
|
587 |
-
var retakenNumber = window.localStorage.getItem('quiz_retake_' + lpQuizSettings.id);
|
588 |
-
|
589 |
-
if (retakenNumber >= 1) {
|
590 |
-
window.localStorage.setItem('quiz_retake_' + lpQuizSettings.id, parseInt(retakenNumber) + 1);
|
591 |
-
} else {
|
592 |
-
window.localStorage.setItem('quiz_retake_' + lpQuizSettings.id, 1);
|
593 |
-
} // Reset User Data
|
594 |
-
|
595 |
-
|
596 |
-
window.localStorage.removeItem('quiz_userdata_' + lpQuizSettings.id);
|
597 |
-
}
|
598 |
|
599 |
startQuiz();
|
600 |
});
|
@@ -929,8 +964,8 @@ var MaybeShowButton = Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__["co
|
|
929 |
data.question = getCurrentQuestion('object');
|
930 |
}
|
931 |
|
932 |
-
if (lpQuizSettings.checkNorequizenroll
|
933 |
-
var retakenCurrent = window.localStorage.getItem('
|
934 |
|
935 |
if (getData('retakeCount') > retakenCurrent) {
|
936 |
data.retakeNumber = getData('retakeCount') - retakenCurrent;
|
@@ -972,10 +1007,10 @@ var MaybeShowButton = Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__["co
|
|
972 |
|
973 |
/***/ }),
|
974 |
|
975 |
-
/***/ "
|
976 |
-
|
977 |
-
!***
|
978 |
-
|
979 |
/*! exports provided: default */
|
980 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
981 |
|
@@ -1005,10 +1040,10 @@ var Content = function Content() {
|
|
1005 |
|
1006 |
/***/ }),
|
1007 |
|
1008 |
-
/***/ "
|
1009 |
-
|
1010 |
-
!***
|
1011 |
-
|
1012 |
/*! exports provided: default */
|
1013 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1014 |
|
@@ -1039,40 +1074,40 @@ var formatDuration = function formatDuration(seconds) {
|
|
1039 |
|
1040 |
/***/ }),
|
1041 |
|
1042 |
-
/***/ "
|
1043 |
-
|
1044 |
-
!***
|
1045 |
-
|
1046 |
/*! exports provided: Title, Content, Meta, Buttons, Questions, Attempts, Timer, Result, Status */
|
1047 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1048 |
|
1049 |
"use strict";
|
1050 |
__webpack_require__.r(__webpack_exports__);
|
1051 |
-
/* harmony import */ var _title__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./title */ "
|
1052 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Title", function() { return _title__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
1053 |
|
1054 |
-
/* harmony import */ var _content__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./content */ "
|
1055 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Content", function() { return _content__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
1056 |
|
1057 |
-
/* harmony import */ var _meta__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./meta */ "
|
1058 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Meta", function() { return _meta__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
1059 |
|
1060 |
-
/* harmony import */ var _buttons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./buttons */ "
|
1061 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Buttons", function() { return _buttons__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
1062 |
|
1063 |
-
/* harmony import */ var _questions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./questions */ "
|
1064 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Questions", function() { return _questions__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
1065 |
|
1066 |
-
/* harmony import */ var _attempts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./attempts */ "
|
1067 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Attempts", function() { return _attempts__WEBPACK_IMPORTED_MODULE_5__["default"]; });
|
1068 |
|
1069 |
-
/* harmony import */ var _timer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./timer */ "
|
1070 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Timer", function() { return _timer__WEBPACK_IMPORTED_MODULE_6__["default"]; });
|
1071 |
|
1072 |
-
/* harmony import */ var _result__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./result */ "
|
1073 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Result", function() { return _result__WEBPACK_IMPORTED_MODULE_7__["default"]; });
|
1074 |
|
1075 |
-
/* harmony import */ var _status__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./status */ "
|
1076 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Status", function() { return _status__WEBPACK_IMPORTED_MODULE_8__["default"]; });
|
1077 |
|
1078 |
|
@@ -1087,10 +1122,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
1087 |
|
1088 |
/***/ }),
|
1089 |
|
1090 |
-
/***/ "
|
1091 |
-
|
1092 |
-
!***
|
1093 |
-
|
1094 |
/*! exports provided: default */
|
1095 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1096 |
|
@@ -1100,7 +1135,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
1100 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
1101 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
1102 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
1103 |
-
/* harmony import */ var _duration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../duration */ "
|
1104 |
/**
|
1105 |
* Quiz Meta.
|
1106 |
* Edit: Use React Hook.
|
@@ -1160,18 +1195,18 @@ var Meta = function Meta() {
|
|
1160 |
|
1161 |
/***/ }),
|
1162 |
|
1163 |
-
/***/ "
|
1164 |
-
|
1165 |
-
!***
|
1166 |
-
|
1167 |
/*! exports provided: default */
|
1168 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1169 |
|
1170 |
"use strict";
|
1171 |
__webpack_require__.r(__webpack_exports__);
|
1172 |
-
/* harmony import */ var _buttons_button_hint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../buttons/button-hint */ "
|
1173 |
-
/* harmony import */ var _buttons_button_check__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../buttons/button-check */ "
|
1174 |
-
/* harmony import */ var _buttons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../buttons */ "
|
1175 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
1176 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__);
|
1177 |
|
@@ -1208,10 +1243,10 @@ var Buttons = function Buttons(props) {
|
|
1208 |
|
1209 |
/***/ }),
|
1210 |
|
1211 |
-
/***/ "
|
1212 |
-
|
1213 |
-
!***
|
1214 |
-
|
1215 |
/*! exports provided: default */
|
1216 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1217 |
|
@@ -1225,7 +1260,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
1225 |
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__);
|
1226 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
1227 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
1228 |
-
/* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question */ "
|
1229 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
1230 |
|
1231 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
@@ -1435,10 +1470,10 @@ var Questions = /*#__PURE__*/function (_Component) {
|
|
1435 |
|
1436 |
/***/ }),
|
1437 |
|
1438 |
-
/***/ "
|
1439 |
-
|
1440 |
-
!***
|
1441 |
-
|
1442 |
/*! exports provided: default */
|
1443 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1444 |
|
@@ -1452,10 +1487,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
1452 |
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__);
|
1453 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
1454 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
1455 |
-
/* harmony import */ var _buttons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./buttons */ "
|
1456 |
-
/* harmony import */ var _buttons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../buttons */ "
|
1457 |
-
/* harmony import */ var _buttons_button_check__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../buttons/button-check */ "
|
1458 |
-
/* harmony import */ var _buttons_button_hint__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../buttons/button-hint */ "
|
1459 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
1460 |
|
1461 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
@@ -1732,10 +1767,10 @@ var Question = /*#__PURE__*/function (_Component) {
|
|
1732 |
|
1733 |
/***/ }),
|
1734 |
|
1735 |
-
/***/ "
|
1736 |
-
|
1737 |
-
!***
|
1738 |
-
|
1739 |
/*! exports provided: default */
|
1740 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1741 |
|
@@ -1747,7 +1782,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
1747 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
1748 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
1749 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
|
1750 |
-
/* harmony import */ var _single_curriculum_components_items_progress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../single-curriculum/components/items-progress */ "
|
1751 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
1752 |
|
1753 |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -1933,14 +1968,13 @@ var Result = function Result() {
|
|
1933 |
|
1934 |
var classNames = ['quiz-result', graduation]; //Re-write value to results.timeSpend
|
1935 |
|
1936 |
-
if (lpQuizSettings.checkNorequizenroll
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
}
|
1944 |
|
1945 |
return /*#__PURE__*/React.createElement("div", {
|
1946 |
className: classNames.join(' ')
|
@@ -1972,9 +2006,9 @@ var Result = function Result() {
|
|
1972 |
className: "result-statistic"
|
1973 |
}, /*#__PURE__*/React.createElement("li", {
|
1974 |
className: "result-statistic-field result-time-spend"
|
1975 |
-
}, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Time
|
1976 |
className: "result-statistic-field result-point"
|
1977 |
-
}, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('
|
1978 |
className: "result-statistic-field result-questions"
|
1979 |
}, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Questions', 'learnpress')), /*#__PURE__*/React.createElement("p", null, results.questionCount)), /*#__PURE__*/React.createElement("li", {
|
1980 |
className: "result-statistic-field result-questions-correct"
|
@@ -2044,10 +2078,10 @@ var Result = function Result() {
|
|
2044 |
|
2045 |
/***/ }),
|
2046 |
|
2047 |
-
/***/ "
|
2048 |
-
|
2049 |
-
!***
|
2050 |
-
|
2051 |
/*! exports provided: default */
|
2052 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2053 |
|
@@ -2057,7 +2091,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
2057 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
2058 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
2059 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
2060 |
-
/* harmony import */ var _timer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../timer */ "
|
2061 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
2062 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
2063 |
|
@@ -2187,17 +2221,17 @@ var Status = function Status() {
|
|
2187 |
className: "lp-button",
|
2188 |
id: "button-submit-quiz",
|
2189 |
onClick: submit
|
2190 |
-
}, !submitting ? Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Finish Quiz', 'learnpress') : Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Submitting...', 'learnpress'))),
|
2191 |
};
|
2192 |
|
2193 |
/* harmony default export */ __webpack_exports__["default"] = (Status);
|
2194 |
|
2195 |
/***/ }),
|
2196 |
|
2197 |
-
/***/ "
|
2198 |
-
|
2199 |
-
!***
|
2200 |
-
|
2201 |
/*! exports provided: default */
|
2202 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2203 |
|
@@ -2234,18 +2268,24 @@ var Timer = function Timer() {
|
|
2234 |
var _dispatch = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["dispatch"])('learnpress/quiz'),
|
2235 |
submitQuiz = _dispatch.submitQuiz;
|
2236 |
|
2237 |
-
var totalTime = getData('totalTime')
|
2238 |
-
var
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
|
|
2245 |
_useState2 = _slicedToArray(_useState, 2),
|
2246 |
seconds = _useState2[0],
|
2247 |
setSeconds = _useState2[1];
|
2248 |
|
|
|
|
|
|
|
|
|
|
|
2249 |
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
|
2250 |
var myInterval = setInterval(function () {
|
2251 |
var remainSeconds = seconds;
|
@@ -2253,6 +2293,8 @@ var Timer = function Timer() {
|
|
2253 |
|
2254 |
if (remainSeconds > 0) {
|
2255 |
setSeconds(remainSeconds);
|
|
|
|
|
2256 |
} else {
|
2257 |
clearInterval(myInterval);
|
2258 |
submitQuiz();
|
@@ -2261,7 +2303,7 @@ var Timer = function Timer() {
|
|
2261 |
return function () {
|
2262 |
return clearInterval(myInterval);
|
2263 |
};
|
2264 |
-
}, [seconds]);
|
2265 |
|
2266 |
var formatTime = function formatTime() {
|
2267 |
var separator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ':';
|
@@ -2287,17 +2329,21 @@ var Timer = function Timer() {
|
|
2287 |
className: "countdown"
|
2288 |
}, /*#__PURE__*/React.createElement("i", {
|
2289 |
className: "fas fa-stopwatch"
|
2290 |
-
}), /*#__PURE__*/React.createElement("span", null, formatTime())
|
|
|
|
|
|
|
|
|
2291 |
};
|
2292 |
|
2293 |
/* harmony default export */ __webpack_exports__["default"] = (Timer);
|
2294 |
|
2295 |
/***/ }),
|
2296 |
|
2297 |
-
/***/ "
|
2298 |
-
|
2299 |
-
!***
|
2300 |
-
|
2301 |
/*! exports provided: default */
|
2302 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2303 |
|
@@ -2311,10 +2357,10 @@ var Title = function Title() {
|
|
2311 |
|
2312 |
/***/ }),
|
2313 |
|
2314 |
-
/***/ "
|
2315 |
-
|
2316 |
-
!***
|
2317 |
-
|
2318 |
/*! exports provided: default */
|
2319 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2320 |
|
@@ -2326,8 +2372,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
2326 |
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_1__);
|
2327 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
2328 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
|
2329 |
-
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components */ "
|
2330 |
-
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./store */ "
|
2331 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
2332 |
|
2333 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
@@ -2448,10 +2494,10 @@ var Quiz = /*#__PURE__*/function (_Component) {
|
|
2448 |
|
2449 |
/***/ }),
|
2450 |
|
2451 |
-
/***/ "
|
2452 |
-
|
2453 |
-
!***
|
2454 |
-
|
2455 |
/*! exports provided: setQuizData, setCurrentQuestion, setCurrentPage, __requestBeforeStartQuiz, __requestStartQuizSuccess, startQuiz, __requestSubmitQuiz, __requestSubmitQuizSuccess, submitQuiz, updateUserQuestionAnswers, __requestShowHintSuccess, showHint, __requestCheckAnswerSuccess, checkAnswer, markQuestionRendered, setQuizMode, sendKey */
|
2456 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2457 |
|
@@ -2486,6 +2532,14 @@ var _marked = /*#__PURE__*/regeneratorRuntime.mark(submitQuiz),
|
|
2486 |
_marked2 = /*#__PURE__*/regeneratorRuntime.mark(showHint),
|
2487 |
_marked3 = /*#__PURE__*/regeneratorRuntime.mark(checkAnswer);
|
2488 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2489 |
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2490 |
|
2491 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
@@ -2529,10 +2583,10 @@ function setQuizData(key, data) {
|
|
2529 |
data = key;
|
2530 |
} // Save all data for no required enroll available
|
2531 |
|
|
|
|
|
|
|
2532 |
|
2533 |
-
if (lpQuizSettings.checkNorequizenroll == '1' && window.localStorage.getItem('quiz_userdata_' + lpQuizSettings.id) !== null) {
|
2534 |
-
data = JSON.parse(window.localStorage.getItem('quiz_userdata_' + lpQuizSettings.id));
|
2535 |
-
}
|
2536 |
|
2537 |
return {
|
2538 |
type: 'SET_QUIZ_DATA',
|
@@ -2578,7 +2632,7 @@ function __requestStartQuizSuccess(results, quizId, courseId, userId) {
|
|
2578 |
*/
|
2579 |
|
2580 |
var startQuiz = /*#__PURE__*/regeneratorRuntime.mark(function startQuiz() {
|
2581 |
-
var _wpSelect$getDefaultR, itemId, courseId, doStart, response;
|
2582 |
|
2583 |
return regeneratorRuntime.wrap(function startQuiz$(_context) {
|
2584 |
while (1) {
|
@@ -2607,11 +2661,39 @@ var startQuiz = /*#__PURE__*/regeneratorRuntime.mark(function startQuiz() {
|
|
2607 |
|
2608 |
case 6:
|
2609 |
response = _context.sent;
|
2610 |
-
|
2611 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2612 |
return _dispatch('learnpress/quiz', '__requestStartQuizSuccess', camelCaseDashObjectKeys(response), itemId, courseId);
|
2613 |
|
2614 |
-
case
|
2615 |
case "end":
|
2616 |
return _context.stop();
|
2617 |
}
|
@@ -2632,7 +2714,7 @@ function __requestSubmitQuizSuccess(results, quizId, courseId) {
|
|
2632 |
};
|
2633 |
}
|
2634 |
function submitQuiz() {
|
2635 |
-
var _wpSelect, getDefaultRestArgs, getQuestionsSelectedAnswers, _getDefaultRestArgs, itemId, courseId, doSubmit, answered, response;
|
2636 |
|
2637 |
return regeneratorRuntime.wrap(function submitQuiz$(_context2) {
|
2638 |
while (1) {
|
@@ -2651,42 +2733,69 @@ function submitQuiz() {
|
|
2651 |
|
2652 |
case 5:
|
2653 |
answered = getQuestionsSelectedAnswers();
|
2654 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2655 |
return Object(_learnpress_data_controls__WEBPACK_IMPORTED_MODULE_0__["apiFetch"])({
|
2656 |
path: 'lp/v1/users/submit-quiz',
|
2657 |
method: 'POST',
|
2658 |
data: {
|
2659 |
item_id: itemId,
|
2660 |
course_id: courseId,
|
2661 |
-
answered: answered
|
|
|
2662 |
}
|
2663 |
});
|
2664 |
|
2665 |
-
case
|
2666 |
response = _context2.sent;
|
2667 |
-
|
2668 |
-
if (lpQuizSettings.checkNorequizenroll == '1') {
|
2669 |
-
// Remove & set storage end_time
|
2670 |
-
window.localStorage.removeItem('quiz_end_' + lpQuizSettings.id);
|
2671 |
-
window.localStorage.setItem('quiz_end_' + lpQuizSettings.id, Date.now());
|
2672 |
-
}
|
2673 |
-
|
2674 |
response = Hook.applyFilters('request-submit-quiz-response', response, itemId, courseId);
|
2675 |
|
2676 |
-
if (!response.success) {
|
2677 |
-
_context2.next =
|
2678 |
break;
|
2679 |
}
|
2680 |
|
2681 |
-
|
2682 |
-
|
|
|
2683 |
|
2684 |
-
|
2685 |
-
|
2686 |
-
|
2687 |
-
|
|
|
|
|
|
|
|
|
2688 |
|
2689 |
-
|
|
|
|
|
|
|
|
|
2690 |
case "end":
|
2691 |
return _context2.stop();
|
2692 |
}
|
@@ -2731,7 +2840,7 @@ function __requestCheckAnswerSuccess(id, result) {
|
|
2731 |
}, result);
|
2732 |
}
|
2733 |
function checkAnswer(id) {
|
2734 |
-
var _wpSelect2, getDefaultRestArgs, getQuestionAnswered, _getDefaultRestArgs2, itemId, courseId, result;
|
2735 |
|
2736 |
return regeneratorRuntime.wrap(function checkAnswer$(_context4) {
|
2737 |
while (1) {
|
@@ -2753,10 +2862,43 @@ function checkAnswer(id) {
|
|
2753 |
|
2754 |
case 4:
|
2755 |
result = _context4.sent;
|
2756 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2757 |
return _dispatch('learnpress/quiz', '__requestCheckAnswerSuccess', id, camelCaseDashObjectKeys(result));
|
2758 |
|
2759 |
-
case
|
2760 |
case "end":
|
2761 |
return _context4.stop();
|
2762 |
}
|
@@ -2787,10 +2929,10 @@ function sendKey(keyPressed) {
|
|
2787 |
|
2788 |
/***/ }),
|
2789 |
|
2790 |
-
/***/ "
|
2791 |
-
|
2792 |
-
!***
|
2793 |
-
|
2794 |
/*! exports provided: default */
|
2795 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2796 |
|
@@ -2798,10 +2940,10 @@ function sendKey(keyPressed) {
|
|
2798 |
__webpack_require__.r(__webpack_exports__);
|
2799 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
2800 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
2801 |
-
/* harmony import */ var _reducer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reducer */ "
|
2802 |
-
/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "
|
2803 |
-
/* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "
|
2804 |
-
/* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "
|
2805 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
2806 |
|
2807 |
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
@@ -2825,16 +2967,16 @@ Object(_middlewares__WEBPACK_IMPORTED_MODULE_4__["default"])(store);
|
|
2825 |
|
2826 |
/***/ }),
|
2827 |
|
2828 |
-
/***/ "
|
2829 |
-
|
2830 |
-
!***
|
2831 |
-
|
2832 |
/*! exports provided: default */
|
2833 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2834 |
|
2835 |
"use strict";
|
2836 |
__webpack_require__.r(__webpack_exports__);
|
2837 |
-
/* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! refx */ "
|
2838 |
/* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(refx__WEBPACK_IMPORTED_MODULE_0__);
|
2839 |
/**
|
2840 |
* External dependencies
|
@@ -2880,10 +3022,10 @@ function applyMiddlewares(store) {
|
|
2880 |
|
2881 |
/***/ }),
|
2882 |
|
2883 |
-
/***/ "
|
2884 |
-
|
2885 |
-
!***
|
2886 |
-
|
2887 |
/*! exports provided: setItemStatus, userQuiz, blocks, default */
|
2888 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2889 |
|
@@ -3002,9 +3144,19 @@ var checkAnswer = function checkAnswer(state, action) {
|
|
3002 |
|
3003 |
return _objectSpread(_objectSpread({}, question), newArgs);
|
3004 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3005 |
return _objectSpread(_objectSpread({}, state), {}, {
|
3006 |
questions: _toConsumableArray(questions),
|
3007 |
-
answered:
|
3008 |
checkedQuestions: [].concat(_toConsumableArray(state.checkedQuestions), [action.questionId])
|
3009 |
});
|
3010 |
};
|
@@ -3155,10 +3307,10 @@ var blocks = flow(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__["combineReducers"
|
|
3155 |
|
3156 |
/***/ }),
|
3157 |
|
3158 |
-
/***/ "
|
3159 |
-
|
3160 |
-
!***
|
3161 |
-
|
3162 |
/*! exports provided: getQuestionOptions, getItemStatus, getProp, getQuizAttempts, getQuizAnswered, getQuestions, getData, getDefaultRestArgs, getQuestionAnswered, getQuestionMark, getCurrentQuestion, getQuestion, isCheckedAnswer, isCorrect, getQuestionsSelectedAnswers, getUserMark */
|
3163 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3164 |
|
@@ -3347,25 +3499,16 @@ var getQuestionsSelectedAnswers = function getQuestionsSelectedAnswers(state, qu
|
|
3347 |
for (var loopId in data) {
|
3348 |
if (!data.hasOwnProperty(loopId)) {
|
3349 |
continue;
|
3350 |
-
}
|
3351 |
|
3352 |
-
|
|
|
3353 |
// If specific a question then return it only.
|
3354 |
if (questionId && loopId === questionId) {
|
3355 |
return data[loopId].answered;
|
3356 |
}
|
3357 |
|
3358 |
returnData[loopId] = data[loopId].answered;
|
3359 |
-
} else {
|
3360 |
-
// Answer filled by user
|
3361 |
-
if (data[loopId].temp || data[loopId].blanks) {
|
3362 |
-
// If specific a question then return it only.
|
3363 |
-
if (questionId && loopId === questionId) {
|
3364 |
-
return data[loopId].answered;
|
3365 |
-
}
|
3366 |
-
|
3367 |
-
returnData[loopId] = data[loopId].answered;
|
3368 |
-
}
|
3369 |
}
|
3370 |
}
|
3371 |
|
@@ -3434,16 +3577,16 @@ function getUserMark(state) {
|
|
3434 |
|
3435 |
/***/ }),
|
3436 |
|
3437 |
-
/***/ "
|
3438 |
-
|
3439 |
-
!***
|
3440 |
-
|
3441 |
/*! exports provided: default */
|
3442 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3443 |
|
3444 |
"use strict";
|
3445 |
__webpack_require__.r(__webpack_exports__);
|
3446 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "
|
3447 |
var $ = jQuery;
|
3448 |
|
3449 |
var lpModalOverlayCompleteItem = {
|
@@ -3496,10 +3639,10 @@ var lpModalOverlayCompleteItem = {
|
|
3496 |
|
3497 |
/***/ }),
|
3498 |
|
3499 |
-
/***/ "
|
3500 |
-
|
3501 |
-
!***
|
3502 |
-
|
3503 |
/*! no static exports found */
|
3504 |
/***/ (function(module, exports) {
|
3505 |
|
@@ -3588,10 +3731,10 @@ LP.Hook.addAction('lp-question-compatible-builder', function () {
|
|
3588 |
|
3589 |
/***/ }),
|
3590 |
|
3591 |
-
/***/ "
|
3592 |
-
|
3593 |
-
!***
|
3594 |
-
|
3595 |
/*! exports provided: itemsProgress, getResponse */
|
3596 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3597 |
|
@@ -3601,7 +3744,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
3601 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getResponse", function() { return getResponse; });
|
3602 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
|
3603 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__);
|
3604 |
-
/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../show-lp-overlay-complete-item */ "
|
3605 |
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
3606 |
|
3607 |
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
@@ -3689,10 +3832,10 @@ var getResponse = /*#__PURE__*/function () {
|
|
3689 |
|
3690 |
/***/ }),
|
3691 |
|
3692 |
-
/***/ "
|
3693 |
-
|
3694 |
-
!***
|
3695 |
-
|
3696 |
/*! exports provided: default */
|
3697 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3698 |
|
@@ -3759,10 +3902,10 @@ var lpModalOverlay = {
|
|
3759 |
|
3760 |
/***/ }),
|
3761 |
|
3762 |
-
/***/ "
|
3763 |
-
|
3764 |
-
!***
|
3765 |
-
|
3766 |
/*! no static exports found */
|
3767 |
/***/ (function(module, exports, __webpack_require__) {
|
3768 |
|
@@ -3827,10 +3970,10 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
3827 |
|
3828 |
/***/ }),
|
3829 |
|
3830 |
-
/***/ "
|
3831 |
-
|
3832 |
-
!***
|
3833 |
-
|
3834 |
/*! no static exports found */
|
3835 |
/***/ (function(module, exports, __webpack_require__) {
|
3836 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/quiz.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/quiz.js":
|
91 |
+
/*!*********************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/quiz.js ***!
|
93 |
+
\*********************************************/
|
94 |
/*! exports provided: default, init */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; });
|
100 |
+
/* harmony import */ var _quiz_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./quiz/index */ "./assets/src/apps/js/frontend/quiz/index.js");
|
101 |
+
/* harmony import */ var _single_curriculum_components_compatible__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./single-curriculum/components/compatible */ "./assets/src/apps/js/frontend/single-curriculum/components/compatible.js");
|
102 |
/* harmony import */ var _single_curriculum_components_compatible__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_single_curriculum_components_compatible__WEBPACK_IMPORTED_MODULE_1__);
|
103 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
104 |
|
118 |
Modal = _LP.modal["default"];
|
119 |
/* harmony default export */ __webpack_exports__["default"] = (_quiz_index__WEBPACK_IMPORTED_MODULE_0__["default"]);
|
120 |
var init = function init(elem, settings) {
|
121 |
+
// For no require enroll
|
122 |
+
if (lpQuizSettings.checkNorequizenroll === 1) {
|
123 |
+
var keyQuizOff = 'quiz_off_' + lpQuizSettings.id;
|
124 |
+
var quizDataOffStr = window.localStorage.getItem(keyQuizOff);
|
125 |
+
|
126 |
+
if (null !== quizDataOffStr) {
|
127 |
+
var quizDataOff = JSON.parse(quizDataOffStr);
|
128 |
+
settings.status = quizDataOff.status;
|
129 |
+
|
130 |
+
if ('started' === quizDataOff.status) {
|
131 |
+
var now = Date.now();
|
132 |
+
settings.total_time = Math.floor((quizDataOff.endTime - now) / 1000);
|
133 |
+
} else if ('completed' === quizDataOff.status) {
|
134 |
+
settings.results = quizDataOff.results;
|
135 |
+
settings.answered = quizDataOff.results.answered;
|
136 |
+
settings.questions = quizDataOff.results.questions;
|
137 |
+
}
|
138 |
+
|
139 |
+
if (undefined !== quizDataOff.checked_questions) {
|
140 |
+
settings.checked_questions = quizDataOff.checked_questions;
|
141 |
+
}
|
142 |
+
|
143 |
+
if (undefined !== quizDataOff.question_options) {
|
144 |
+
//settings.checked_questions = quizDataOff.checked_questions;
|
145 |
+
for (var i in settings.questions) {
|
146 |
+
var question = settings.questions[i];
|
147 |
+
|
148 |
+
if (undefined !== quizDataOff.question_options[question.id]) {
|
149 |
+
question.options = quizDataOff.question_options[question.id];
|
150 |
+
}
|
151 |
+
|
152 |
+
settings.questions[i] = question;
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
} //console.log(settings);
|
157 |
+
|
158 |
+
|
159 |
wp.element.render( /*#__PURE__*/React.createElement(Modal, null, /*#__PURE__*/React.createElement(_quiz_index__WEBPACK_IMPORTED_MODULE_0__["default"], {
|
160 |
settings: settings
|
161 |
})), _toConsumableArray(document.querySelectorAll(elem))[0]);
|
164 |
|
165 |
/***/ }),
|
166 |
|
167 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/attempts/index.js":
|
168 |
+
/*!***********************************************************************!*\
|
169 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/attempts/index.js ***!
|
170 |
+
\***********************************************************************/
|
171 |
/*! exports provided: default */
|
172 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
173 |
|
177 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
178 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
179 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
180 |
+
/* harmony import */ var _duration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../duration */ "./assets/src/apps/js/frontend/quiz/components/duration/index.js");
|
181 |
|
182 |
|
183 |
|
196 |
className: "quiz-attempts__questions"
|
197 |
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Questions', 'learnpress')), /*#__PURE__*/React.createElement("th", {
|
198 |
className: "quiz-attempts__spend"
|
199 |
+
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Time spent', 'learnpress')), /*#__PURE__*/React.createElement("th", {
|
200 |
className: "quiz-attempts__marks"
|
201 |
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Marks', 'learnpress')), /*#__PURE__*/React.createElement("th", {
|
202 |
className: "quiz-attempts__grade"
|
204 |
className: "quiz-attempts__result"
|
205 |
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Result', 'learnpress')))), /*#__PURE__*/React.createElement("tbody", null, attempts.map(function (row, key) {
|
206 |
// Re-write value to attempts.timeSpend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
+
/*if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
209 |
+
const timespendStart = window.localStorage.getItem( 'quiz_start_' + lpQuizSettings.id ),
|
210 |
+
timespendEnd = window.localStorage.getItem( 'quiz_end_' + lpQuizSettings.id );
|
211 |
+
if ( timespendStart && timespendEnd ) {
|
212 |
+
row.timeSpend = timeDifference( timespendStart, timespendEnd ).duration;
|
213 |
+
}
|
214 |
+
}*/
|
215 |
return /*#__PURE__*/React.createElement("tr", {
|
216 |
key: "attempt-".concat(key)
|
217 |
}, /*#__PURE__*/React.createElement("td", {
|
287 |
|
288 |
/***/ }),
|
289 |
|
290 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/buttons/button-check.js":
|
291 |
+
/*!*****************************************************************************!*\
|
292 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/buttons/button-check.js ***!
|
293 |
+
\*****************************************************************************/
|
294 |
/*! exports provided: default */
|
295 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
296 |
|
297 |
"use strict";
|
298 |
__webpack_require__.r(__webpack_exports__);
|
299 |
+
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js");
|
300 |
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
|
301 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
302 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
|
417 |
|
418 |
/***/ }),
|
419 |
|
420 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/buttons/button-hint.js":
|
421 |
+
/*!****************************************************************************!*\
|
422 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/buttons/button-hint.js ***!
|
423 |
+
\****************************************************************************/
|
424 |
/*! exports provided: default */
|
425 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
426 |
|
518 |
|
519 |
/***/ }),
|
520 |
|
521 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/buttons/index.js":
|
522 |
+
/*!**********************************************************************!*\
|
523 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/buttons/index.js ***!
|
524 |
+
\**********************************************************************/
|
525 |
/*! exports provided: MaybeShowButton, default */
|
526 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
527 |
|
614 |
!isOpen() && btn && btn.removeAttribute('disabled');
|
615 |
return;
|
616 |
}
|
617 |
+
} // No require enroll
|
618 |
+
|
619 |
+
/*if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
620 |
+
// Reset data
|
621 |
+
window.localStorage.removeItem( 'quiz_start_' + lpQuizSettings.id );
|
622 |
+
window.localStorage.removeItem( 'quiz_userdata_' + lpQuizSettings.id );
|
623 |
+
window.localStorage.setItem( 'quiz_start_' + lpQuizSettings.id, Date.now() );
|
624 |
+
// Set retake to local.storage
|
625 |
+
const retakenNumber = window.localStorage.getItem( 'quiz_retake_' + lpQuizSettings.id );
|
626 |
+
if ( retakenNumber >= 1 ) {
|
627 |
+
window.localStorage.setItem( 'quiz_retake_' + lpQuizSettings.id, parseInt( retakenNumber ) + 1 );
|
628 |
+
} else {
|
629 |
+
window.localStorage.setItem( 'quiz_retake_' + lpQuizSettings.id, 1 );
|
630 |
+
}
|
631 |
+
}*/
|
632 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
633 |
|
634 |
startQuiz();
|
635 |
});
|
964 |
data.question = getCurrentQuestion('object');
|
965 |
}
|
966 |
|
967 |
+
if (lpQuizSettings.checkNorequizenroll === 1) {
|
968 |
+
var retakenCurrent = window.localStorage.getItem('quiz_off_retaken_' + lpQuizSettings.id);
|
969 |
|
970 |
if (getData('retakeCount') > retakenCurrent) {
|
971 |
data.retakeNumber = getData('retakeCount') - retakenCurrent;
|
1007 |
|
1008 |
/***/ }),
|
1009 |
|
1010 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/content/index.js":
|
1011 |
+
/*!**********************************************************************!*\
|
1012 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/content/index.js ***!
|
1013 |
+
\**********************************************************************/
|
1014 |
/*! exports provided: default */
|
1015 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1016 |
|
1040 |
|
1041 |
/***/ }),
|
1042 |
|
1043 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/duration/index.js":
|
1044 |
+
/*!***********************************************************************!*\
|
1045 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/duration/index.js ***!
|
1046 |
+
\***********************************************************************/
|
1047 |
/*! exports provided: default */
|
1048 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1049 |
|
1074 |
|
1075 |
/***/ }),
|
1076 |
|
1077 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/index.js":
|
1078 |
+
/*!**************************************************************!*\
|
1079 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/index.js ***!
|
1080 |
+
\**************************************************************/
|
1081 |
/*! exports provided: Title, Content, Meta, Buttons, Questions, Attempts, Timer, Result, Status */
|
1082 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1083 |
|
1084 |
"use strict";
|
1085 |
__webpack_require__.r(__webpack_exports__);
|
1086 |
+
/* harmony import */ var _title__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./title */ "./assets/src/apps/js/frontend/quiz/components/title/index.js");
|
1087 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Title", function() { return _title__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
1088 |
|
1089 |
+
/* harmony import */ var _content__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./content */ "./assets/src/apps/js/frontend/quiz/components/content/index.js");
|
1090 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Content", function() { return _content__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
1091 |
|
1092 |
+
/* harmony import */ var _meta__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./meta */ "./assets/src/apps/js/frontend/quiz/components/meta/index.js");
|
1093 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Meta", function() { return _meta__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
1094 |
|
1095 |
+
/* harmony import */ var _buttons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./buttons */ "./assets/src/apps/js/frontend/quiz/components/buttons/index.js");
|
1096 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Buttons", function() { return _buttons__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
1097 |
|
1098 |
+
/* harmony import */ var _questions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./questions */ "./assets/src/apps/js/frontend/quiz/components/questions/index.js");
|
1099 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Questions", function() { return _questions__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
1100 |
|
1101 |
+
/* harmony import */ var _attempts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./attempts */ "./assets/src/apps/js/frontend/quiz/components/attempts/index.js");
|
1102 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Attempts", function() { return _attempts__WEBPACK_IMPORTED_MODULE_5__["default"]; });
|
1103 |
|
1104 |
+
/* harmony import */ var _timer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./timer */ "./assets/src/apps/js/frontend/quiz/components/timer/index.js");
|
1105 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Timer", function() { return _timer__WEBPACK_IMPORTED_MODULE_6__["default"]; });
|
1106 |
|
1107 |
+
/* harmony import */ var _result__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./result */ "./assets/src/apps/js/frontend/quiz/components/result/index.js");
|
1108 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Result", function() { return _result__WEBPACK_IMPORTED_MODULE_7__["default"]; });
|
1109 |
|
1110 |
+
/* harmony import */ var _status__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./status */ "./assets/src/apps/js/frontend/quiz/components/status/index.js");
|
1111 |
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Status", function() { return _status__WEBPACK_IMPORTED_MODULE_8__["default"]; });
|
1112 |
|
1113 |
|
1122 |
|
1123 |
/***/ }),
|
1124 |
|
1125 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/meta/index.js":
|
1126 |
+
/*!*******************************************************************!*\
|
1127 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/meta/index.js ***!
|
1128 |
+
\*******************************************************************/
|
1129 |
/*! exports provided: default */
|
1130 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1131 |
|
1135 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
1136 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
1137 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
1138 |
+
/* harmony import */ var _duration__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../duration */ "./assets/src/apps/js/frontend/quiz/components/duration/index.js");
|
1139 |
/**
|
1140 |
* Quiz Meta.
|
1141 |
* Edit: Use React Hook.
|
1195 |
|
1196 |
/***/ }),
|
1197 |
|
1198 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/questions/buttons.js":
|
1199 |
+
/*!**************************************************************************!*\
|
1200 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/questions/buttons.js ***!
|
1201 |
+
\**************************************************************************/
|
1202 |
/*! exports provided: default */
|
1203 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1204 |
|
1205 |
"use strict";
|
1206 |
__webpack_require__.r(__webpack_exports__);
|
1207 |
+
/* harmony import */ var _buttons_button_hint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../buttons/button-hint */ "./assets/src/apps/js/frontend/quiz/components/buttons/button-hint.js");
|
1208 |
+
/* harmony import */ var _buttons_button_check__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../buttons/button-check */ "./assets/src/apps/js/frontend/quiz/components/buttons/button-check.js");
|
1209 |
+
/* harmony import */ var _buttons__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../buttons */ "./assets/src/apps/js/frontend/quiz/components/buttons/index.js");
|
1210 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
1211 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__);
|
1212 |
|
1243 |
|
1244 |
/***/ }),
|
1245 |
|
1246 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/questions/index.js":
|
1247 |
+
/*!************************************************************************!*\
|
1248 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/questions/index.js ***!
|
1249 |
+
\************************************************************************/
|
1250 |
/*! exports provided: default */
|
1251 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1252 |
|
1260 |
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__);
|
1261 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
1262 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
1263 |
+
/* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question */ "./assets/src/apps/js/frontend/quiz/components/questions/question.js");
|
1264 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
1265 |
|
1266 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1470 |
|
1471 |
/***/ }),
|
1472 |
|
1473 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/questions/question.js":
|
1474 |
+
/*!***************************************************************************!*\
|
1475 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/questions/question.js ***!
|
1476 |
+
\***************************************************************************/
|
1477 |
/*! exports provided: default */
|
1478 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1479 |
|
1487 |
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_2__);
|
1488 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
1489 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
1490 |
+
/* harmony import */ var _buttons__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./buttons */ "./assets/src/apps/js/frontend/quiz/components/questions/buttons.js");
|
1491 |
+
/* harmony import */ var _buttons__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../buttons */ "./assets/src/apps/js/frontend/quiz/components/buttons/index.js");
|
1492 |
+
/* harmony import */ var _buttons_button_check__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../buttons/button-check */ "./assets/src/apps/js/frontend/quiz/components/buttons/button-check.js");
|
1493 |
+
/* harmony import */ var _buttons_button_hint__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../buttons/button-hint */ "./assets/src/apps/js/frontend/quiz/components/buttons/button-hint.js");
|
1494 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
1495 |
|
1496 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
1767 |
|
1768 |
/***/ }),
|
1769 |
|
1770 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/result/index.js":
|
1771 |
+
/*!*********************************************************************!*\
|
1772 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/result/index.js ***!
|
1773 |
+
\*********************************************************************/
|
1774 |
/*! exports provided: default */
|
1775 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1776 |
|
1782 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
1783 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
1784 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
|
1785 |
+
/* harmony import */ var _single_curriculum_components_items_progress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../single-curriculum/components/items-progress */ "./assets/src/apps/js/frontend/single-curriculum/components/items-progress.js");
|
1786 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
1787 |
|
1788 |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
1968 |
|
1969 |
var classNames = ['quiz-result', graduation]; //Re-write value to results.timeSpend
|
1970 |
|
1971 |
+
/*if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
1972 |
+
const timespendStart = window.localStorage.getItem( 'quiz_start_' + QuizID ),
|
1973 |
+
timespendEnd = window.localStorage.getItem( 'quiz_end_' + QuizID );
|
1974 |
+
if ( timespendStart && timespendEnd ) {
|
1975 |
+
results.timeSpend = timeDifference( timespendStart, timespendEnd ).duration;
|
1976 |
+
}
|
1977 |
+
}*/
|
|
|
1978 |
|
1979 |
return /*#__PURE__*/React.createElement("div", {
|
1980 |
className: classNames.join(' ')
|
2006 |
className: "result-statistic"
|
2007 |
}, /*#__PURE__*/React.createElement("li", {
|
2008 |
className: "result-statistic-field result-time-spend"
|
2009 |
+
}, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Time spent', 'learnpress')), /*#__PURE__*/React.createElement("p", null, results.timeSpend)), /*#__PURE__*/React.createElement("li", {
|
2010 |
className: "result-statistic-field result-point"
|
2011 |
+
}, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Points', 'learnpress')), /*#__PURE__*/React.createElement("p", null, results.userMark, " / ", results.mark)), /*#__PURE__*/React.createElement("li", {
|
2012 |
className: "result-statistic-field result-questions"
|
2013 |
}, /*#__PURE__*/React.createElement("span", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Questions', 'learnpress')), /*#__PURE__*/React.createElement("p", null, results.questionCount)), /*#__PURE__*/React.createElement("li", {
|
2014 |
className: "result-statistic-field result-questions-correct"
|
2078 |
|
2079 |
/***/ }),
|
2080 |
|
2081 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/status/index.js":
|
2082 |
+
/*!*********************************************************************!*\
|
2083 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/status/index.js ***!
|
2084 |
+
\*********************************************************************/
|
2085 |
/*! exports provided: default */
|
2086 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2087 |
|
2091 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
2092 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
2093 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
2094 |
+
/* harmony import */ var _timer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../timer */ "./assets/src/apps/js/frontend/quiz/components/timer/index.js");
|
2095 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
2096 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
2097 |
|
2221 |
className: "lp-button",
|
2222 |
id: "button-submit-quiz",
|
2223 |
onClick: submit
|
2224 |
+
}, !submitting ? Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Finish Quiz', 'learnpress') : Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Submitting...', 'learnpress'))), duration && /*#__PURE__*/React.createElement(_timer__WEBPACK_IMPORTED_MODULE_2__["default"], null))));
|
2225 |
};
|
2226 |
|
2227 |
/* harmony default export */ __webpack_exports__["default"] = (Status);
|
2228 |
|
2229 |
/***/ }),
|
2230 |
|
2231 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/timer/index.js":
|
2232 |
+
/*!********************************************************************!*\
|
2233 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/timer/index.js ***!
|
2234 |
+
\********************************************************************/
|
2235 |
/*! exports provided: default */
|
2236 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2237 |
|
2268 |
var _dispatch = Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["dispatch"])('learnpress/quiz'),
|
2269 |
submitQuiz = _dispatch.submitQuiz;
|
2270 |
|
2271 |
+
var totalTime = getData('totalTime');
|
2272 |
+
var durationTime = getData('duration');
|
2273 |
+
/* const endTime = getData( 'endTime' );
|
2274 |
+
const d1 = new Date( endTime.replace( /-/g, '/' ) );
|
2275 |
+
const d2 = new Date();
|
2276 |
+
const tz = new Date().getTimezoneOffset();
|
2277 |
+
const t = parseInt( ( d1.getTime() / 1000 ) - ( ( d2.getTime() / 1000 ) + ( tz * 60 ) ) );*/
|
2278 |
+
|
2279 |
+
var _useState = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])(totalTime),
|
2280 |
_useState2 = _slicedToArray(_useState, 2),
|
2281 |
seconds = _useState2[0],
|
2282 |
setSeconds = _useState2[1];
|
2283 |
|
2284 |
+
var _useState3 = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])(0),
|
2285 |
+
_useState4 = _slicedToArray(_useState3, 2),
|
2286 |
+
timeSpend = _useState4[0],
|
2287 |
+
setTimeSpend = _useState4[1];
|
2288 |
+
|
2289 |
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
|
2290 |
var myInterval = setInterval(function () {
|
2291 |
var remainSeconds = seconds;
|
2293 |
|
2294 |
if (remainSeconds > 0) {
|
2295 |
setSeconds(remainSeconds);
|
2296 |
+
timeSpend++;
|
2297 |
+
setTimeSpend(durationTime - remainSeconds);
|
2298 |
} else {
|
2299 |
clearInterval(myInterval);
|
2300 |
submitQuiz();
|
2303 |
return function () {
|
2304 |
return clearInterval(myInterval);
|
2305 |
};
|
2306 |
+
}, [seconds, timeSpend]);
|
2307 |
|
2308 |
var formatTime = function formatTime() {
|
2309 |
var separator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ':';
|
2329 |
className: "countdown"
|
2330 |
}, /*#__PURE__*/React.createElement("i", {
|
2331 |
className: "fas fa-stopwatch"
|
2332 |
+
}), /*#__PURE__*/React.createElement("span", null, formatTime()), /*#__PURE__*/React.createElement("input", {
|
2333 |
+
type: "hidden",
|
2334 |
+
name: "lp-quiz-time-spend",
|
2335 |
+
value: timeSpend
|
2336 |
+
}));
|
2337 |
};
|
2338 |
|
2339 |
/* harmony default export */ __webpack_exports__["default"] = (Timer);
|
2340 |
|
2341 |
/***/ }),
|
2342 |
|
2343 |
+
/***/ "./assets/src/apps/js/frontend/quiz/components/title/index.js":
|
2344 |
+
/*!********************************************************************!*\
|
2345 |
+
!*** ./assets/src/apps/js/frontend/quiz/components/title/index.js ***!
|
2346 |
+
\********************************************************************/
|
2347 |
/*! exports provided: default */
|
2348 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2349 |
|
2357 |
|
2358 |
/***/ }),
|
2359 |
|
2360 |
+
/***/ "./assets/src/apps/js/frontend/quiz/index.js":
|
2361 |
+
/*!***************************************************!*\
|
2362 |
+
!*** ./assets/src/apps/js/frontend/quiz/index.js ***!
|
2363 |
+
\***************************************************/
|
2364 |
/*! exports provided: default */
|
2365 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2366 |
|
2372 |
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_1__);
|
2373 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
2374 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
|
2375 |
+
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components */ "./assets/src/apps/js/frontend/quiz/components/index.js");
|
2376 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./store */ "./assets/src/apps/js/frontend/quiz/store/index.js");
|
2377 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
2378 |
|
2379 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2494 |
|
2495 |
/***/ }),
|
2496 |
|
2497 |
+
/***/ "./assets/src/apps/js/frontend/quiz/store/actions.js":
|
2498 |
+
/*!***********************************************************!*\
|
2499 |
+
!*** ./assets/src/apps/js/frontend/quiz/store/actions.js ***!
|
2500 |
+
\***********************************************************/
|
2501 |
/*! exports provided: setQuizData, setCurrentQuestion, setCurrentPage, __requestBeforeStartQuiz, __requestStartQuizSuccess, startQuiz, __requestSubmitQuiz, __requestSubmitQuizSuccess, submitQuiz, updateUserQuestionAnswers, __requestShowHintSuccess, showHint, __requestCheckAnswerSuccess, checkAnswer, markQuestionRendered, setQuizMode, sendKey */
|
2502 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2503 |
|
2532 |
_marked2 = /*#__PURE__*/regeneratorRuntime.mark(showHint),
|
2533 |
_marked3 = /*#__PURE__*/regeneratorRuntime.mark(checkAnswer);
|
2534 |
|
2535 |
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2536 |
+
|
2537 |
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
2538 |
+
|
2539 |
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
2540 |
+
|
2541 |
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
2542 |
+
|
2543 |
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2544 |
|
2545 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2583 |
data = key;
|
2584 |
} // Save all data for no required enroll available
|
2585 |
|
2586 |
+
/*if ( lpQuizSettings.checkNorequizenroll === 1 && window.localStorage.getItem( 'quiz_userdata_' + lpQuizSettings.id ) !== null ) {
|
2587 |
+
data = JSON.parse( window.localStorage.getItem( 'quiz_userdata_' + lpQuizSettings.id ) );
|
2588 |
+
}*/
|
2589 |
|
|
|
|
|
|
|
2590 |
|
2591 |
return {
|
2592 |
type: 'SET_QUIZ_DATA',
|
2632 |
*/
|
2633 |
|
2634 |
var startQuiz = /*#__PURE__*/regeneratorRuntime.mark(function startQuiz() {
|
2635 |
+
var _wpSelect$getDefaultR, itemId, courseId, doStart, response, keyQuizOff, quizDataOff, keyQuizOffRetaken, quizOffRetaken;
|
2636 |
|
2637 |
return regeneratorRuntime.wrap(function startQuiz$(_context) {
|
2638 |
while (1) {
|
2661 |
|
2662 |
case 6:
|
2663 |
response = _context.sent;
|
2664 |
+
|
2665 |
+
if (!(response.status !== 'error')) {
|
2666 |
+
_context.next = 12;
|
2667 |
+
break;
|
2668 |
+
}
|
2669 |
+
|
2670 |
+
response = Hook.applyFilters('request-start-quiz-response', response, itemId, courseId); // No require enroll
|
2671 |
+
|
2672 |
+
if (lpQuizSettings.checkNorequizenroll === 1) {
|
2673 |
+
keyQuizOff = 'quiz_off_' + lpQuizSettings.id;
|
2674 |
+
window.localStorage.removeItem(keyQuizOff);
|
2675 |
+
quizDataOff = {
|
2676 |
+
endTime: Date.now() + response.results.duration * 1000,
|
2677 |
+
status: response.results.status
|
2678 |
+
};
|
2679 |
+
window.localStorage.setItem(keyQuizOff, JSON.stringify(quizDataOff)); // Set Retake quiz
|
2680 |
+
|
2681 |
+
keyQuizOffRetaken = 'quiz_off_retaken_' + lpQuizSettings.id;
|
2682 |
+
quizOffRetaken = window.localStorage.getItem(keyQuizOffRetaken);
|
2683 |
+
|
2684 |
+
if (null === quizOffRetaken) {
|
2685 |
+
quizOffRetaken = 0;
|
2686 |
+
} else {
|
2687 |
+
quizOffRetaken++;
|
2688 |
+
}
|
2689 |
+
|
2690 |
+
window.localStorage.setItem(keyQuizOffRetaken, quizOffRetaken); // End
|
2691 |
+
}
|
2692 |
+
|
2693 |
+
_context.next = 12;
|
2694 |
return _dispatch('learnpress/quiz', '__requestStartQuizSuccess', camelCaseDashObjectKeys(response), itemId, courseId);
|
2695 |
|
2696 |
+
case 12:
|
2697 |
case "end":
|
2698 |
return _context.stop();
|
2699 |
}
|
2714 |
};
|
2715 |
}
|
2716 |
function submitQuiz() {
|
2717 |
+
var _wpSelect, getDefaultRestArgs, getQuestionsSelectedAnswers, _getDefaultRestArgs, itemId, courseId, doSubmit, answered, keyAnswer, answerDataStr, data, _i, _Object$entries, _Object$entries$_i, k, v, timeSpend, elTimeSpend, response, keyQuizOff, quizDataOffStr, quizDataOff;
|
2718 |
|
2719 |
return regeneratorRuntime.wrap(function submitQuiz$(_context2) {
|
2720 |
while (1) {
|
2733 |
|
2734 |
case 5:
|
2735 |
answered = getQuestionsSelectedAnswers();
|
2736 |
+
|
2737 |
+
if (lpQuizSettings.checkNorequizenroll === 1) {
|
2738 |
+
keyAnswer = "LP_Quiz_".concat(itemId, "_Answered");
|
2739 |
+
answerDataStr = localStorage.getItem(keyAnswer);
|
2740 |
+
|
2741 |
+
if (null !== answerDataStr) {
|
2742 |
+
data = JSON.parse(answerDataStr);
|
2743 |
+
|
2744 |
+
for (_i = 0, _Object$entries = Object.entries(data); _i < _Object$entries.length; _i++) {
|
2745 |
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), k = _Object$entries$_i[0], v = _Object$entries$_i[1];
|
2746 |
+
answered[k] = v.answered;
|
2747 |
+
}
|
2748 |
+
}
|
2749 |
+
} // Get time spend did quiz - tungnx
|
2750 |
+
|
2751 |
+
|
2752 |
+
timeSpend = 0;
|
2753 |
+
elTimeSpend = document.querySelector('input[name=lp-quiz-time-spend]');
|
2754 |
+
|
2755 |
+
if (elTimeSpend) {
|
2756 |
+
timeSpend = elTimeSpend.value;
|
2757 |
+
} // End
|
2758 |
+
|
2759 |
+
|
2760 |
+
_context2.next = 12;
|
2761 |
return Object(_learnpress_data_controls__WEBPACK_IMPORTED_MODULE_0__["apiFetch"])({
|
2762 |
path: 'lp/v1/users/submit-quiz',
|
2763 |
method: 'POST',
|
2764 |
data: {
|
2765 |
item_id: itemId,
|
2766 |
course_id: courseId,
|
2767 |
+
answered: answered,
|
2768 |
+
time_spend: timeSpend
|
2769 |
}
|
2770 |
});
|
2771 |
|
2772 |
+
case 12:
|
2773 |
response = _context2.sent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2774 |
response = Hook.applyFilters('request-submit-quiz-response', response, itemId, courseId);
|
2775 |
|
2776 |
+
if (!(response.status === 'success')) {
|
2777 |
+
_context2.next = 18;
|
2778 |
break;
|
2779 |
}
|
2780 |
|
2781 |
+
if (lpQuizSettings.checkNorequizenroll === 1) {
|
2782 |
+
keyQuizOff = 'quiz_off_' + lpQuizSettings.id;
|
2783 |
+
quizDataOffStr = window.localStorage.getItem(keyQuizOff);
|
2784 |
|
2785 |
+
if (null !== quizDataOffStr) {
|
2786 |
+
quizDataOff = JSON.parse(quizDataOffStr);
|
2787 |
+
quizDataOff.status = response.results.status;
|
2788 |
+
quizDataOff.results = response.results.results;
|
2789 |
+
window.localStorage.setItem(keyQuizOff, JSON.stringify(quizDataOff));
|
2790 |
+
window.localStorage.removeItem('LP_Quiz_' + lpQuizSettings.id + '_Answered');
|
2791 |
+
}
|
2792 |
+
} //console.log( response.results );
|
2793 |
|
2794 |
+
|
2795 |
+
_context2.next = 18;
|
2796 |
+
return _dispatch('learnpress/quiz', '__requestSubmitQuizSuccess', camelCaseDashObjectKeys(response.results), itemId, courseId);
|
2797 |
+
|
2798 |
+
case 18:
|
2799 |
case "end":
|
2800 |
return _context2.stop();
|
2801 |
}
|
2840 |
}, result);
|
2841 |
}
|
2842 |
function checkAnswer(id) {
|
2843 |
+
var _wpSelect2, getDefaultRestArgs, getQuestionAnswered, _getDefaultRestArgs2, itemId, courseId, result, keyQuizOff, quizDataOffStr, quizDataOff, questionOptions;
|
2844 |
|
2845 |
return regeneratorRuntime.wrap(function checkAnswer$(_context4) {
|
2846 |
while (1) {
|
2862 |
|
2863 |
case 4:
|
2864 |
result = _context4.sent;
|
2865 |
+
|
2866 |
+
if (!(result.status === 'success')) {
|
2867 |
+
_context4.next = 9;
|
2868 |
+
break;
|
2869 |
+
}
|
2870 |
+
|
2871 |
+
// No require enroll
|
2872 |
+
if (lpQuizSettings.checkNorequizenroll === 1) {
|
2873 |
+
keyQuizOff = 'quiz_off_' + lpQuizSettings.id;
|
2874 |
+
quizDataOffStr = window.localStorage.getItem(keyQuizOff);
|
2875 |
+
|
2876 |
+
if (null !== quizDataOffStr) {
|
2877 |
+
quizDataOff = JSON.parse(quizDataOffStr);
|
2878 |
+
questionOptions = result.options;
|
2879 |
+
|
2880 |
+
if (undefined === quizDataOff.checked_questions) {
|
2881 |
+
quizDataOff.checked_questions = [];
|
2882 |
+
quizDataOff.checked_questions.push(id);
|
2883 |
+
} else if (-1 === quizDataOff.checked_questions.indexOf(id)) {
|
2884 |
+
quizDataOff.checked_questions.push(id);
|
2885 |
+
}
|
2886 |
+
|
2887 |
+
if (undefined === quizDataOff.question_options) {
|
2888 |
+
quizDataOff.question_options = {};
|
2889 |
+
quizDataOff.question_options[id] = questionOptions;
|
2890 |
+
} else if (undefined === quizDataOff.question_options[id]) {
|
2891 |
+
quizDataOff.question_options[id] = questionOptions;
|
2892 |
+
}
|
2893 |
+
|
2894 |
+
window.localStorage.setItem(keyQuizOff, JSON.stringify(quizDataOff)); //console.log( quizDataOff );
|
2895 |
+
}
|
2896 |
+
}
|
2897 |
+
|
2898 |
+
_context4.next = 9;
|
2899 |
return _dispatch('learnpress/quiz', '__requestCheckAnswerSuccess', id, camelCaseDashObjectKeys(result));
|
2900 |
|
2901 |
+
case 9:
|
2902 |
case "end":
|
2903 |
return _context4.stop();
|
2904 |
}
|
2929 |
|
2930 |
/***/ }),
|
2931 |
|
2932 |
+
/***/ "./assets/src/apps/js/frontend/quiz/store/index.js":
|
2933 |
+
/*!*********************************************************!*\
|
2934 |
+
!*** ./assets/src/apps/js/frontend/quiz/store/index.js ***!
|
2935 |
+
\*********************************************************/
|
2936 |
/*! exports provided: default */
|
2937 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2938 |
|
2940 |
__webpack_require__.r(__webpack_exports__);
|
2941 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
2942 |
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
2943 |
+
/* harmony import */ var _reducer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reducer */ "./assets/src/apps/js/frontend/quiz/store/reducer.js");
|
2944 |
+
/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "./assets/src/apps/js/frontend/quiz/store/actions.js");
|
2945 |
+
/* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "./assets/src/apps/js/frontend/quiz/store/selectors.js");
|
2946 |
+
/* harmony import */ var _middlewares__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares */ "./assets/src/apps/js/frontend/quiz/store/middlewares.js");
|
2947 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
2948 |
|
2949 |
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
2967 |
|
2968 |
/***/ }),
|
2969 |
|
2970 |
+
/***/ "./assets/src/apps/js/frontend/quiz/store/middlewares.js":
|
2971 |
+
/*!***************************************************************!*\
|
2972 |
+
!*** ./assets/src/apps/js/frontend/quiz/store/middlewares.js ***!
|
2973 |
+
\***************************************************************/
|
2974 |
/*! exports provided: default */
|
2975 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2976 |
|
2977 |
"use strict";
|
2978 |
__webpack_require__.r(__webpack_exports__);
|
2979 |
+
/* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! refx */ "./node_modules/refx/refx.js");
|
2980 |
/* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(refx__WEBPACK_IMPORTED_MODULE_0__);
|
2981 |
/**
|
2982 |
* External dependencies
|
3022 |
|
3023 |
/***/ }),
|
3024 |
|
3025 |
+
/***/ "./assets/src/apps/js/frontend/quiz/store/reducer.js":
|
3026 |
+
/*!***********************************************************!*\
|
3027 |
+
!*** ./assets/src/apps/js/frontend/quiz/store/reducer.js ***!
|
3028 |
+
\***********************************************************/
|
3029 |
/*! exports provided: setItemStatus, userQuiz, blocks, default */
|
3030 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3031 |
|
3144 |
|
3145 |
return _objectSpread(_objectSpread({}, question), newArgs);
|
3146 |
});
|
3147 |
+
|
3148 |
+
var answered = _objectSpread(_objectSpread({}, state.answered), {}, _defineProperty({}, action.questionId, action.result));
|
3149 |
+
|
3150 |
+
var newAnswered = localStorage.getItem("LP_Quiz_".concat(state.id, "_Answered"));
|
3151 |
+
|
3152 |
+
if (newAnswered) {
|
3153 |
+
newAnswered = _objectSpread(_objectSpread({}, JSON.parse(newAnswered)), answered);
|
3154 |
+
localStorage.setItem("LP_Quiz_".concat(state.id, "_Answered"), JSON.stringify(newAnswered));
|
3155 |
+
}
|
3156 |
+
|
3157 |
return _objectSpread(_objectSpread({}, state), {}, {
|
3158 |
questions: _toConsumableArray(questions),
|
3159 |
+
answered: answered,
|
3160 |
checkedQuestions: [].concat(_toConsumableArray(state.checkedQuestions), [action.questionId])
|
3161 |
});
|
3162 |
};
|
3307 |
|
3308 |
/***/ }),
|
3309 |
|
3310 |
+
/***/ "./assets/src/apps/js/frontend/quiz/store/selectors.js":
|
3311 |
+
/*!*************************************************************!*\
|
3312 |
+
!*** ./assets/src/apps/js/frontend/quiz/store/selectors.js ***!
|
3313 |
+
\*************************************************************/
|
3314 |
/*! exports provided: getQuestionOptions, getItemStatus, getProp, getQuizAttempts, getQuizAnswered, getQuestions, getData, getDefaultRestArgs, getQuestionAnswered, getQuestionMark, getCurrentQuestion, getQuestion, isCheckedAnswer, isCorrect, getQuestionsSelectedAnswers, getUserMark */
|
3315 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3316 |
|
3499 |
for (var loopId in data) {
|
3500 |
if (!data.hasOwnProperty(loopId)) {
|
3501 |
continue;
|
3502 |
+
} // Answer filled by user
|
3503 |
|
3504 |
+
|
3505 |
+
if (data[loopId].temp || data[loopId].blanks) {
|
3506 |
// If specific a question then return it only.
|
3507 |
if (questionId && loopId === questionId) {
|
3508 |
return data[loopId].answered;
|
3509 |
}
|
3510 |
|
3511 |
returnData[loopId] = data[loopId].answered;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3512 |
}
|
3513 |
}
|
3514 |
|
3577 |
|
3578 |
/***/ }),
|
3579 |
|
3580 |
+
/***/ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js":
|
3581 |
+
/*!**********************************************************************!*\
|
3582 |
+
!*** ./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js ***!
|
3583 |
+
\**********************************************************************/
|
3584 |
/*! exports provided: default */
|
3585 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3586 |
|
3587 |
"use strict";
|
3588 |
__webpack_require__.r(__webpack_exports__);
|
3589 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
3590 |
var $ = jQuery;
|
3591 |
|
3592 |
var lpModalOverlayCompleteItem = {
|
3639 |
|
3640 |
/***/ }),
|
3641 |
|
3642 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/compatible.js":
|
3643 |
+
/*!********************************************************************************!*\
|
3644 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/compatible.js ***!
|
3645 |
+
\********************************************************************************/
|
3646 |
/*! no static exports found */
|
3647 |
/***/ (function(module, exports) {
|
3648 |
|
3731 |
|
3732 |
/***/ }),
|
3733 |
|
3734 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/items-progress.js":
|
3735 |
+
/*!************************************************************************************!*\
|
3736 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/items-progress.js ***!
|
3737 |
+
\************************************************************************************/
|
3738 |
/*! exports provided: itemsProgress, getResponse */
|
3739 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3740 |
|
3744 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getResponse", function() { return getResponse; });
|
3745 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
|
3746 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__);
|
3747 |
+
/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../show-lp-overlay-complete-item */ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
|
3748 |
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
3749 |
|
3750 |
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
3832 |
|
3833 |
/***/ }),
|
3834 |
|
3835 |
+
/***/ "./assets/src/apps/js/utils/lp-modal-overlay.js":
|
3836 |
+
/*!******************************************************!*\
|
3837 |
+
!*** ./assets/src/apps/js/utils/lp-modal-overlay.js ***!
|
3838 |
+
\******************************************************/
|
3839 |
/*! exports provided: default */
|
3840 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3841 |
|
3902 |
|
3903 |
/***/ }),
|
3904 |
|
3905 |
+
/***/ "./node_modules/classnames/index.js":
|
3906 |
+
/*!******************************************!*\
|
3907 |
+
!*** ./node_modules/classnames/index.js ***!
|
3908 |
+
\******************************************/
|
3909 |
/*! no static exports found */
|
3910 |
/***/ (function(module, exports, __webpack_require__) {
|
3911 |
|
3970 |
|
3971 |
/***/ }),
|
3972 |
|
3973 |
+
/***/ "./node_modules/refx/refx.js":
|
3974 |
+
/*!***********************************!*\
|
3975 |
+
!*** ./node_modules/refx/refx.js ***!
|
3976 |
+
\***********************************/
|
3977 |
/*! no static exports found */
|
3978 |
/***/ (function(module, exports, __webpack_require__) {
|
3979 |
|
@@ -3,4 +3,4 @@ this.LP=this.LP||{},this.LP.quiz=function(e){var t={};function n(r){if(t[r])retu
|
|
3 |
Copyright (c) 2018 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
-
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return Rn}));var r={};n.r(r),n.d(r,"setQuizData",(function(){return wt})),n.d(r,"setCurrentQuestion",(function(){return Ot})),n.d(r,"setCurrentPage",(function(){return _t})),n.d(r,"__requestBeforeStartQuiz",(function(){return St})),n.d(r,"__requestStartQuizSuccess",(function(){return qt})),n.d(r,"startQuiz",(function(){return jt})),n.d(r,"__requestSubmitQuiz",(function(){return Rt})),n.d(r,"__requestSubmitQuizSuccess",(function(){return Et})),n.d(r,"submitQuiz",(function(){return Pt})),n.d(r,"updateUserQuestionAnswers",(function(){return zt})),n.d(r,"__requestShowHintSuccess",(function(){return kt})),n.d(r,"showHint",(function(){return Qt})),n.d(r,"__requestCheckAnswerSuccess",(function(){return It})),n.d(r,"checkAnswer",(function(){return At})),n.d(r,"markQuestionRendered",(function(){return Ct})),n.d(r,"setQuizMode",(function(){return Nt})),n.d(r,"sendKey",(function(){return Tt}));var o={};n.r(o),n.d(o,"getQuestionOptions",(function(){return Lt})),n.d(o,"getItemStatus",(function(){return Ut})),n.d(o,"getProp",(function(){return Ht})),n.d(o,"getQuizAttempts",(function(){return Ft})),n.d(o,"getQuizAnswered",(function(){return Bt})),n.d(o,"getQuestions",(function(){return Jt})),n.d(o,"getData",(function(){return Gt})),n.d(o,"getDefaultRestArgs",(function(){return Kt})),n.d(o,"getQuestionAnswered",(function(){return Wt})),n.d(o,"getQuestionMark",(function(){return $t})),n.d(o,"getCurrentQuestion",(function(){return Zt})),n.d(o,"getQuestion",(function(){return Yt})),n.d(o,"isCheckedAnswer",(function(){return Vt})),n.d(o,"isCorrect",(function(){return Xt})),n.d(o,"getQuestionsSelectedAnswers",(function(){return en})),n.d(o,"getUserMark",(function(){return tn}));var i=n(3),a=n(4),u=n(1),s=function(){var e=Object(u.select)("learnpress/quiz").getData("content");return React.createElement("div",{className:"quiz-content",dangerouslySetInnerHTML:{__html:e}})},c=n(0),l=function(e){var t;if(e>86400)t=(e-e%86400)/86400,e%=86400;else if(86400==e)return"24:00";var n=new Date(1e3*e).toUTCString().match(/\d{2}:\d{2}:\d{2}/)[0].split(":");return t&&(n[0]=parseInt(n[0])+24*t),n.join(":")},f=LP.Hook,p=function(){var e=function(e){return Object(u.select)("learnpress/quiz").getData(e)},t=f.applyFilters("quiz-meta-fields",{duration:{title:Object(c.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:Object(c.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:Object(c.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&React.createElement(React.Fragment,null,React.createElement("ul",{className:"quiz-intro"},Object.values(t).map((function(e,t){var n=e.name||t;return React.createElement("li",{key:"quiz-intro-field-".concat(t),className:"quiz-intro-item quiz-intro-item--".concat(n)},React.createElement("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=S(e);if(t){var o=S(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return O(this,n)}}function O(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var j=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(i,e);var t,n,r,o=w(i);function i(){var e;h(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return q(_(e=o.call.apply(o,[this].concat(n))),"startQuiz",(function(t){t&&t.preventDefault();var n=document.querySelector(".lp-button.start");n&&n.setAttribute("disabled","disabled");var r=e.props,o=r.startQuiz;if("completed"===r.status){var i=Object(u.select)("learnpress/modal"),a=i.confirm,s=i.isOpen;if("no"===a(Object(c.__)("Are you sure you want to retake quiz?","learnpress"),e.startQuiz))return void(!s()&&n&&n.removeAttribute("disabled"))}if("1"==lpQuizSettings.checkNorequizenroll){window.localStorage.removeItem("quiz_start_"+lpQuizSettings.id),window.localStorage.setItem("quiz_start_"+lpQuizSettings.id,Date.now());var l=window.localStorage.getItem("quiz_retake_"+lpQuizSettings.id);l>=1?window.localStorage.setItem("quiz_retake_"+lpQuizSettings.id,parseInt(l)+1):window.localStorage.setItem("quiz_retake_"+lpQuizSettings.id,1),window.localStorage.removeItem("quiz_userdata_"+lpQuizSettings.id)}o()})),q(_(e),"nav",(function(t){return function(n){var r=e.props,o=r.questionNav,i=r.currentPage,a=r.numPages,u=r.setCurrentPage;switch(t){case"prev":i>1?i-=1:i="infinity"===o?a:1;break;default:i<a?i+=1:i="infinity"===o?1:a}u(i)}})),q(_(e),"moveTo",(function(t){return function(n){n.preventDefault();var r=e.props,o=r.numPages,i=r.setCurrentPage;t<1||t>o||i(t)}})),q(_(e),"isLast",(function(){var t=e.props;return t.currentPage===t.numPages})),q(_(e),"isFirst",(function(){return 1===e.props.currentPage})),q(_(e),"submit",(function(){var t=e.props.submitQuiz;"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),e.submit)&&t()})),q(_(e),"setQuizMode",(function(t){return function(){(0,e.props.setQuizMode)(t)}})),q(_(e),"isReviewing",(function(){return e.props.isReviewing})),e}return t=i,(n=[{key:"pageNumbers",value:function(e){var t=this,n=this.props,r=n.numPages,o=n.currentPage;if(r<2)return"";(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){q(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({numPages:r,currentPage:o,midSize:1,endSize:1,prevNext:!0},e||{})).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);var i=m(Array(r).keys()),a=!1;return React.createElement("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&React.createElement("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},Object(c.__)("Prev","learnpress")),i.map((function(n){return(n+=1)===e.currentPage?(a=!0,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers current"},n)):n<=e.endSize||e.currentPage&&n>=e.currentPage-e.midSize&&n<=e.currentPage+e.midSize||n>e.numPages-e.endSize?(a=!0,React.createElement("button",{key:"page-number-".concat(n),className:"page-numbers",onClick:t.moveTo(n)},n)):a?(a=!1,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers dots"},"…")):""})),e.prevNext&&!this.isLast()&&React.createElement("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},Object(c.__)("Next","learnpress")))}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.questionNav,r=e.isReviewing,o=e.showReview,i=e.numPages,a=(e.question,e.questionsPerPage,e.canRetry),u=e.retakeNumber,s=["quiz-buttons"];("started"===t||r)&&s.push("align-center"),"questionNav"===n&&s.push("infinity"),this.isFirst()&&s.push("is-first"),this.isLast()&&s.push("is-last");var l=document.querySelector("#popup-sidebar"),f=document.querySelector("#learn-press-quiz-app"),p="";p="started"===t||r?{marginLeft:l&&l.offsetWidth/2,width:f&&f.offsetWidth}:null;var d=" fixed";return"no"==lpQuizSettings.navigationPosition&&(d=" nav-center"),React.createElement(React.Fragment,null,React.createElement("div",{className:s.join(" ")},React.createElement("div",{className:"button-left"+("started"===t||r?d:""),style:p},("completed"===t&&a||-1!==["","viewed"].indexOf(t))&&!r&&React.createElement("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===t?"".concat(Object(c.__)("Retake","learnpress")).concat(u?" (".concat(u,")"):""):Object(c.__)("Start","learnpress")),("started"===t||r)&&i>1&&React.createElement(React.Fragment,null,React.createElement("div",{className:"questions-pagination"},this.pageNumbers()))),React.createElement("div",{className:"button-right"},"started"===t&&React.createElement(React.Fragment,null,("infinity"===n||this.isLast())&&!r&&React.createElement("button",{className:"lp-button submit-quiz",onClick:this.submit},Object(c.__)("Finish Quiz","learnpress"))),r&&o&&React.createElement("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},Object(c.__)("Result","learnpress")),"completed"===t&&o&&!r&&React.createElement("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},Object(c.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&React.createElement("div",{className:"learn-press-message error"},this.props.message))}}])&&g(t.prototype,n),r&&g(t,r),i}(i.Component),R=Object(a.compose)(Object(u.withSelect)((function(e){var t=e("learnpress/quiz").getData;return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((function(e){var t=e.showCheck,n=e.checkedQuestions,r=e.hintedQuestions,o=e.question,i=e.status,a=e.type,u=e.Button;if("started"!==i)return!1;var s=React.createElement(u,{question:o});switch(a){case"hint":return r?!!o.hasHint&&(-1===r.indexOf(o.id)&&s):s;case"check":return!!t&&(n?-1===n.indexOf(o.id)&&s:s)}})),E=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getData,r=t.getCurrentQuestion,o={id:n("id"),status:n("status"),questionIds:n("questionIds"),questionNav:n("questionNav"),isReviewing:n("reviewQuestions")&&"reviewing"===n("mode"),showReview:n("reviewQuestions"),showCheck:n("instantCheck"),checkedQuestions:n("checkedQuestions"),hintedQuestions:n("hintedQuestions"),numPages:n("numPages"),pages:n("pages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage"),pageNumbers:n("pageNumbers"),keyPressed:n("keyPressed"),canRetry:n("retakeCount")>0&&n("retaken")<n("retakeCount"),retakeNumber:n("retakeCount")>0&&n("retaken")<n("retakeCount")?n("retakeCount")-n("retaken"):null,message:n("messageResponse")||!1,success:void 0===n("successResponse")||n("successResponse")};if(1===o.questionsPerPage&&(o.question=r("object")),"1"==lpQuizSettings.checkNorequizenroll){var i=window.localStorage.getItem("quiz_retake_"+lpQuizSettings.id);n("retakeCount")>i?(o.retakeNumber=n("retakeCount")-i,o.canRetry=!0):o.canRetry=!1}return o})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz"),r=n.startQuiz,o=n.setCurrentQuestion,i=n.submitQuiz,a=n.setQuizMode,u=n.showHint,s=n.checkAnswer;return{startQuiz:r,setCurrentQuestion:o,setQuizMode:a,setCurrentPage:n.setCurrentPage,submitQuiz:function(e){i(e)},showHint:function(e){u(e)},checkAnswer:function(e){s(e)}}}))])(j);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Q(e,t){return(Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=N(e);if(t){var o=N(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return A(this,n)}}function A(e,t){if(t&&("object"===P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return C(e)}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Q(e,t)}(i,e);var t,n,r,o=I(i);function i(){var e;z(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return T(C(e=o.call.apply(o,[this].concat(n))),"showHint",(function(){var t=e.props,n=t.showHint,r=t.question;n(r.id,!r.showHint)})),e}return t=i,(n=[{key:"render",value:function(){return this.props.question.hint?React.createElement("button",{className:"btn-show-hint",onClick:this.showHint},React.createElement("span",null,Object(c.__)("Hint","learnpress"))):""}}])&&k(t.prototype,n),r&&k(t,r),i}(i.Component),D=Object(a.compose)(Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").showHint;return{showHint:function(e,t){n(e,t)}}})))(x),M=n(13),L=n.n(M);function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function J(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=W(e);if(t){var o=W(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return G(this,n)}}function G(e,t){if(t&&("object"===U(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(i,e);var t,n,r,o=J(i);function i(){var e;return H(this,i),$(K(e=o.apply(this,arguments)),"checkAnswer",(function(){var t=e.props,n=t.checkAnswer,r=t.question;t.answered&&(n(r.id),e.setState({loading:!0}))})),e.state={loading:!1},e}return t=i,(n=[{key:"render",value:function(){var e=this.props.answered;return React.createElement(React.Fragment,null,React.createElement("button",{className:L()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},React.createElement("span",{className:"instant-check__icon"}),Object(c.__)("Check answer","learnpress"),!e&&React.createElement("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:Object(c.__)("You need to answer the question before check answer.","learnpress")}})))}}])&&F(t.prototype,n),r&&F(t,r),i}(i.Component),Y=Object(a.compose)(Object(u.withSelect)((function(e,t){var n=t.question.id;return{answered:(0,e("learnpress/quiz").getQuestionAnswered)(n)}})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").checkAnswer;return{checkAnswer:function(e){n(e)}}})))(Z),V=function(e){var t=e.question,n={"instant-check":function(){return React.createElement(R,{type:"check",Button:Y,question:t})},hint:function(){return React.createElement(R,{type:"hint",Button:D,question:t})}};return React.createElement(React.Fragment,null,LP.config.questionFooterButtons().map((function(e){return React.createElement(i.Fragment,{key:"button-".concat(e)},n[e]&&n[e]())})))};function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ae(this,n)}}function ae(e,t){if(t&&("object"===X(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ue(e)}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=window.jQuery,fe=lodash,pe=(fe.uniqueId,fe.isArray),de=(fe.isNumber,fe.bind,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(a,e);var t,n,r,o=ie(a);function a(){var e;return ne(this,a),ce(ue(e=o.apply(this,arguments)),"setRef",(function(t){e.$wrap=le(t)})),ce(ue(e),"parseOptions",(function(e){return e&&(e=pe(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=pe(e)?e:JSON.parse(e)),e||[]})),ce(ue(e),"getWrapperClass",(function(){var t=e.props,n=t.question,r=(t.answered,["question","question-"+n.type]),o=e.parseOptions(n.options);return o.length&&void 0!==o[0].isTrue&&r.push("question-answered"),r})),ce(ue(e),"getEditLink",(function(){var t=e.props,n=t.question,r=t.editPermalink;return r?r.replace(/post=(.*[0-9])/,"post=".concat(n.id)):""})),ce(ue(e),"editPermalink",(function(e){return Object(c.sprintf)('<a href="%s">%s</a>',e,Object(c.__)("Edit","learnpress"))})),e.state={time:null,showHint:!1},e.$wrap=null,e}return t=a,(n=[{key:"componentDidMount",value:function(e){var t=this.props,n=t.question,r=t.isCurrent,o=t.markQuestionRendered;return r&&o(n.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),"undefined"!=typeof MathJax&&MathJax.Hub.Queue(["Typeset",MathJax.Hub]),e}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.isShow,o=t.isShowIndex,a=(t.isShowHint,t.status),u=LP.questionTypes.default,s=this.getEditLink();s&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",s);var l={index:function(){return o?React.createElement("span",{className:"question-index"},o,"."):""},title:function(){return React.createElement("span",{dangerouslySetInnerHTML:{__html:n.title}})},hint:function(){return React.createElement(D,{question:n})},"edit-permalink":function(){return s&&React.createElement("span",{dangerouslySetInnerHTML:{__html:e.editPermalink(s)},className:"edit-link"})}},f={title:function(){return React.createElement("h4",{className:"question-title"},LP.config.questionTitleParts().map((function(e){return React.createElement(i.Fragment,{key:"title-part-".concat(e)},l[e]&&l[e]())})))},content:function(){return React.createElement("div",{className:"question-content",dangerouslySetInnerHTML:{__html:n.content}})},"answer-options":function(){return e.$wrap&&React.createElement(u,te(te({},e.props),{},{$wrap:e.$wrap}))},explanation:function(){return n.explanation&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-explanation-content"},React.createElement("strong",{className:"explanation-title"},Object(c.__)("Explanation","learnpress"),":"),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.explanation}})))},hint:function(){return n.hint&&!n.explanation&&n.showHint&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-hint-content"},React.createElement("strong",{className:"hint-title"},Object(c.__)("Hint","learnpress"),":"),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.hint}})))},buttons:function(){return"started"===a&&React.createElement(V,{question:n})}},p=LP.config.questionBlocks();return React.createElement(React.Fragment,null,React.createElement("div",{className:this.getWrapperClass().join(" "),style:{display:r?"":"none"},"data-id":n.id,ref:this.setRef},p.map((function(e){return React.createElement(i.Fragment,{key:"block-".concat(e)},f[e]?f[e]():"")}))))}}])&&re(t.prototype,n),r&&re(t,r),a}(i.Component)),me=Object(a.compose)([Object(u.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.getQuestionAnswered,a=r.getQuestionMark;return{status:o("status"),questions:o("question"),answered:i(n),questionsRendered:o("questionsRendered"),editPermalink:o("editPermalink"),numPages:o("numPages"),mark:a(n)||""}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz"),n=t.updateUserQuestionAnswers;return{markQuestionRendered:t.markQuestionRendered,updateUserQuestionAnswers:n}}))])(de);function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return(ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return we(this,n)}}function we(e,t){if(t&&("object"===ye(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Oe(e)}function Oe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ge(e,t)}(i,e);var t,n,r,o=ve(i);function i(e){var t;return be(this,i),Se(Oe(t=o.apply(this,arguments)),"startQuiz",(function(e){e.preventDefault(),(0,t.props.startQuiz)()})),Se(Oe(t),"isInVisibleRange",(function(e,n){var r=t.props,o=r.currentPage,i=r.questionsPerPage;return o===Math.ceil(n/i)})),Se(Oe(t),"nav",(function(e){var n=t.props.sendKey;switch(e.keyCode){case 37:return n("left");case 38:return;case 39:return n("right");case 40:return;default:e.keyCode>=49&&e.keyCode<=57&&n(e.keyCode-48)}})),t.needToTop=!1,t.state={isReviewing:null,currentPage:0,self:Oe(t)},t}return t=i,r=[{key:"getDerivedStateFromProps",value:function(e,t){for(var n=["isReviewing","currentPage"],r={},o=0;o<n.length;o++)e[n[o]]!==t[n[o]]&&(r[n[o]]=e[n[o]]);return Object.values(r).length?(t.self.needToTop=!0,r):null}}],(n=[{key:"componentDidUpdate",value:function(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}},{key:"render",value:function(){var e=this,t=this.props,n=t.status,r=t.currentQuestion,o=t.questions,i=t.questionsRendered,a=t.isReviewing,u=t.questionsPerPage,s=!0;return"completed"!==n||a||(s=!1),React.createElement(React.Fragment,null,React.createElement("div",{tabIndex:100,onKeyUp:this.nav},React.createElement("div",{className:"quiz-questions",style:{display:s?"":"none"}},o.map((function(t,n){var o=!u&&r===t.id,a=i&&-1!==i.indexOf(t.id),s=e.isInVisibleRange(t.id,n+1);return a||!a||s?React.createElement(me,{key:"loop-question-".concat(t.id),isCurrent:o,isShow:s,isShowIndex:!!u&&n+1,questionsPerPage:u,question:t}):""})))))}}])&&he(t.prototype,n),r&&he(t,r),i}(i.Component),je=Object(a.compose)(Object(u.withSelect)((function(e,t,n){var r=e("learnpress/quiz"),o=r.getData,i=r.getQuestions;return{status:o("status"),currentQuestion:o("currentQuestion"),questions:i(),questionsRendered:o("questionsRendered"),isReviewing:"reviewing"===o("mode"),numPages:o("numPages"),currentPage:o("currentPage"),questionsPerPage:o("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{startQuiz:t.startQuiz,sendKey:t.sendKey}})))(qe);var Re=function(){var e=Object(u.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&React.createElement(React.Fragment,null,React.createElement("div",{className:"quiz-attempts"},React.createElement("h4",{className:"attempts-heading"},Object(c.__)("Last Attempted","learnpress")),t&&React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"quiz-attempts__questions"},Object(c.__)("Questions","learnpress")),React.createElement("th",{className:"quiz-attempts__spend"},Object(c.__)("Time spend","learnpress")),React.createElement("th",{className:"quiz-attempts__marks"},Object(c.__)("Marks","learnpress")),React.createElement("th",{className:"quiz-attempts__grade"},Object(c.__)("Passing grade","learnpress")),React.createElement("th",{className:"quiz-attempts__result"},Object(c.__)("Result","learnpress")))),React.createElement("tbody",null,e.map((function(e,t){if("1"==lpQuizSettings.checkNorequizenroll){var n=window.localStorage.getItem("quiz_start_"+lpQuizSettings.id),r=window.localStorage.getItem("quiz_end_"+lpQuizSettings.id);n&&r&&(e.timeSpend=function(e,t){var n=new Object,r=t-e;n.days=Math.floor(r/1e3/60/60/24),r-=1e3*n.days*60*60*24,n.hours=Math.floor(r/1e3/60/60),r-=1e3*n.hours*60*60,n.minutes=Math.floor(r/1e3/60),r-=1e3*n.minutes*60,n.seconds=Math.floor(r/1e3);var o="00";n.days>0&&(o=String(n.days));1==o.length&&(o="0"+o);var i="00";n.minutes>0&&(i=String(n.minutes));1==i.length&&(i="0"+i);var a="00";n.seconds>0&&(a=String(n.seconds));1==a.length&&(a="0"+a);var u=o+":"+i+":"+a;return n.duration=u,n}(n,r).duration)}return React.createElement("tr",{key:"attempt-".concat(t)},React.createElement("td",{className:"quiz-attempts__questions"},"".concat(e.questionCorrect," / ").concat(e.questionCount)),React.createElement("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),React.createElement("td",{className:"quiz-attempts__marks"},"".concat(e.userMark," / ").concat(e.mark)),React.createElement("td",{className:"quiz-attempts__grade"},e.passingGrade||"-"),React.createElement("td",{className:"quiz-attempts__result"},"".concat(parseFloat(e.result).toFixed(2),"%")," ",React.createElement("span",null,e.graduationText)))}))))))};function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ze=function(){var e=Object(u.select)("learnpress/quiz").getData,t=Object(u.dispatch)("learnpress/quiz").submitQuiz,n=e("totalTime")?e("totalTime"):e("duration"),r=e("endTime"),o=new Date(r.replace(/-/g,"/")),a=new Date,s=(new Date).getTimezoneOffset(),c=parseInt(o.getTime()/1e3-(a.getTime()/1e3+60*s)),l=Ee(Object(i.useState)(c>0?c:0),2),f=l[0],p=l[1];Object(i.useEffect)((function(){var e=setInterval((function(){var n=f;(n-=1)>0?p(n):(clearInterval(e),t())}),1e3);return function(){return clearInterval(e)}}),[f]);return React.createElement("div",{className:"countdown"},React.createElement("i",{className:"fas fa-stopwatch"}),React.createElement("span",null,function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":",r=[];return n<3600?(r.push((f-f%60)/60),r.push(f%60)):n&&(r.push((f-f%3600)/3600),e=f%3600,r.push((e-e%60)/60),r.push(e%60)),r.map((function(e){return e<10?"0".concat(e):e})).join(t)}()))},ke=n(9);function Qe(e){return function(e){if(Array.isArray(e))return Ce(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ae(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ie(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||Ae(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(e,t){if(e){if("string"==typeof e)return Ce(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,t):void 0}}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ne=lodash.debounce,Te=function(){var e=Ie(Object(i.useState)(0),2),t=e[0],n=e[1],r=Ie(Object(i.useState)(!1),2),o=r[0],a=r[1],s=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("id")}),[]),l=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("results")}),[]),f=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("passingGrade")}),[]),p=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("submitting")}),[]);Object(i.useEffect)((function(){m();var e="";if(e=l.graduation?l.graduation:l.result>=v.replace(/[^0-9\.]+/g,"")?"passed":"failed"){var t=document.querySelector(".course-curriculum .course-item.course-item-".concat(s));t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}var n=Qe(document.querySelectorAll("#popup-header .items-progress"))[0];if(n){var r=n.querySelector(".items-completed");if(r){parseInt(r.textContent);var o=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");r.textContent=parseInt(o.length)}}}),[l]),Object(i.useEffect)((function(){void 0!==p&&d()}),[p]);var d=function(){var e=document.querySelectorAll(".popup-header__inner");e.length>0&&0===e[0].querySelectorAll("form.form-button-finish-course").length&&Object(ke.a)(e[0])},m=function(){n(0),a(!1),jQuery.easing._customEasing=function(e,t,n,r,o){return r*Math.sqrt(1-(t=t/o-1)*t)+n},Ne((function(){var e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:l.result},{duration:1500,step:function(e,t){n(e)},done:function(){a(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),Ne((function(){jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),l.result>0?1e3:10)()},y=t;Number.isInteger(t)||(y=parseFloat(t).toFixed(2));var b=190*Math.PI,h=b-y/100*b,g={strokeDasharray:"".concat(b," ").concat(b),strokeDashoffset:h},v=l.passingGrade||f,w="";w=l.graduation?l.graduation:y>=v.replace(/[^0-9\.]+/g,"")?"passed":"failed";var O="";O=l.graduationText?l.graduationText:"passed"===w?Object(c.__)("Passed","learnpress"):Object(c.__)("Failed","learnpress");var _=["quiz-result",w];if("1"==lpQuizSettings.checkNorequizenroll){var S=window.localStorage.getItem("quiz_start_"+s),q=window.localStorage.getItem("quiz_end_"+s);S&&q&&(l.timeSpend=function(e,t){var n=new Object,r=t-e;n.days=Math.floor(r/1e3/60/60/24),r-=1e3*n.days*60*60*24,n.hours=Math.floor(r/1e3/60/60),r-=1e3*n.hours*60*60,n.minutes=Math.floor(r/1e3/60),r-=1e3*n.minutes*60,n.seconds=Math.floor(r/1e3);var o="00";n.days>0&&(o=String(n.days));1==o.length&&(o="0"+o);var i="00";n.minutes>0&&(i=String(n.minutes));1==i.length&&(i="0"+i);var a="00";n.seconds>0&&(a=String(n.seconds));1==a.length&&(a="0"+a);var u=o+":"+i+":"+a;return n.duration=u,n}(S,q).duration)}return React.createElement("div",{className:_.join(" ")},React.createElement("h3",{className:"result-heading"},Object(c.__)("Your Result","learnpress")),React.createElement("div",{id:"quizResultGrade",className:"result-grade"},React.createElement("svg",{className:"circle-progress-bar",width:200,height:200},React.createElement("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:g,fill:"transparent",r:95,cx:100,cy:100})),React.createElement("span",{className:"result-achieved"},"".concat(y,"%")),React.createElement("span",{className:"result-require"},v||"-")),o&&React.createElement("p",{className:"result-message"},O),React.createElement("ul",{className:"result-statistic"},React.createElement("li",{className:"result-statistic-field result-time-spend"},React.createElement("span",null,Object(c.__)("Time spend","learnpress")),React.createElement("p",null,l.timeSpend)),React.createElement("li",{className:"result-statistic-field result-point"},React.createElement("span",null,Object(c.__)("Point","learnpress")),React.createElement("p",null,l.userMark," / ",l.mark)),React.createElement("li",{className:"result-statistic-field result-questions"},React.createElement("span",null,Object(c.__)("Questions","learnpress")),React.createElement("p",null,l.questionCount)),React.createElement("li",{className:"result-statistic-field result-questions-correct"},React.createElement("span",null,Object(c.__)("Correct","learnpress")),React.createElement("p",null,l.questionCorrect)),React.createElement("li",{className:"result-statistic-field result-questions-wrong"},React.createElement("span",null,Object(c.__)("Wrong","learnpress")),React.createElement("p",null,l.questionWrong)),React.createElement("li",{className:"result-statistic-field result-questions-skipped"},React.createElement("span",null,Object(c.__)("Skipped","learnpress")),React.createElement("p",null,l.questionEmpty))))},xe=jQuery,De=lodash.debounce,Me=function(){var e=Object(u.dispatch)("learnpress/quiz").submitQuiz;Object(i.useEffect)((function(){var e=xe("#popup-content");if(e.length){var t=e.find(".content-item-scrollable:eq(1)"),n=e.find(".content-item-wrap"),r=e.find(".quiz-status"),o=r.offset().top-92,i=!1,a="-"+n.css("margin-left");xe(window).on("resize.refresh-quiz-stauts-bar",De((function(){a="-"+n.css("margin-left"),r.css({"margin-left":a,"margin-right":a})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(function(){if(t.scrollTop()>=o){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}}),[]);var t=Object(u.select)("learnpress/quiz"),n=t.getData,r=t.getUserMark,o=n("currentPage"),a=n("questionsPerPage"),s=n("questionIds").length,l=n("submitting"),f=n("totalTime"),p=n("duration"),d=r(),m=["quiz-status"],y=(o-1)*a+1,b=y+a-1,h="";return b=Math.min(b,s),l&&m.push("submitting"),h=b<s?a>1?Object(c.sprintf)(Object(c.__)("Question <span>%d to %d of %d</span>","learnpress"),y,b,s):Object(c.sprintf)(Object(c.__)("Question <span>%d of %d</span>","learnpress"),y,s):Object(c.sprintf)(Object(c.__)("Question <span>%d to %d</span>","learnpress"),y,b),React.createElement("div",{className:m.join(" ")},React.createElement("div",null,React.createElement("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:h}}),React.createElement("div",{className:"current-point"},Object(c.sprintf)(Object(c.__)("Earned Point: %s","learnpress"),d)),React.createElement("div",null,React.createElement("div",{className:"submit-quiz"},React.createElement("button",{className:"lp-button",id:"button-submit-quiz",onClick:function t(){"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),t)&&e()}},l?Object(c.__)("Submitting...","learnpress"):Object(c.__)("Finish Quiz","learnpress"))),f&&p&&React.createElement(ze,null))))};function Le(e){return function(e){if(Array.isArray(e))return Ue(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ue(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?He(Object(n),!0).forEach((function(t){Be(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):He(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Je=lodash,Ge=(Je.omit,Je.flow),Ke=Je.isArray,We=Je.chunk,$e=(LP.camelCaseDashObjectKeys,LP.localStorage),Ze=$e.get,Ye=$e.set,Ve={},Xe=function(e,t){var n=e.answered,r=e.id,o=Fe(Fe({},n[t.questionId]||{}),{},{answered:t.answers,temp:!0});return r&&localStorage.setItem("LP_Quiz_".concat(r,"_Answered"),JSON.stringify(Fe(Fe({},e.answered),{},Be({},t.questionId,o)))),Fe(Fe({},e),{},{answered:Fe(Fe({},e.answered),{},Be({},t.questionId,o))})},et=function(e,t){var n=e.questionsRendered;return Ke(n)?(n.push(t.questionId),Fe(Fe({},e),{},{questionsRendered:Le(n)})):Fe(Fe({},e),{},{questionsRendered:[t.questionId]})},tt=function(e,t){return t.currentPage&&Ye("Q".concat(e.id,".currentPage"),t.currentPage),Fe(Fe({},e),t)},nt=function(e,t){var n=e.questions.map((function(e){return e.id==t.questionId?Fe(Fe({},e),{},{showHint:t.showHint}):e}));return Fe(Fe({},e),{},{questions:Le(n)})},rt=function(e,t){var n=e.questions.map((function(e){if(e.id!==t.questionId)return e;var n={explanation:t.explanation};return t.options&&(n.options=t.options),Fe(Fe({},e),n)}));return Fe(Fe({},e),{},{questions:Le(n),answered:Fe(Fe({},e.answered),{},Be({},t.questionId,t.result)),checkedQuestions:[].concat(Le(e.checkedQuestions),[t.questionId])})},ot=function(e,t){localStorage.removeItem("LP_Quiz_".concat(e.id,"_Answered"));var n=e.questions.map((function(n){var r={};return e.reviewQuestions&&(t.results.questions[n.id].explanation&&(r.explanation=t.results.questions[n.id].explanation),t.results.questions[n.id].options&&(r.options=t.results.questions[n.id].options)),Fe(Fe({},n),r)}));return tt(e,Fe(Fe({submitting:!1,currentPage:1},t.results),{},{questions:Le(n)}))},it=function(e,t){var n=void 0!==t.results.success&&t.results.success,r=t.results.message||!1;return tt(e,Fe(Fe({checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1},t.results.results),{},{successResponse:n,messageResponse:r}))},at=Ge(u.combineReducers,(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}))({a:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1};return e},b:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2};return e}}),ut=Object(u.combineReducers)({blocks:at,userQuiz:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);var n=We(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=n.length,t.data.pages=n,Fe(Fe(Fe({},e),t.data),{},{currentPage:Ze("Q".concat(t.data.id,".currentPage"))||t.data.currentPage});case"SUBMIT_QUIZ":return Fe(Fe({},e),{},{submitting:!0});case"START_QUIZ":case"START_QUIZ_SUCCESS":return it(e,t);case"SET_CURRENT_QUESTION":return Ye("Q".concat(e.id,".currentQuestion"),t.questionId),Fe(Fe({},e),{},{currentQuestion:t.questionId});case"SET_CURRENT_PAGE":return Ye("Q".concat(e.id,".currentPage"),t.currentPage),Fe(Fe({},e),{},{currentPage:t.currentPage});case"SUBMIT_QUIZ_SUCCESS":return ot(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?Xe(e,t):e;case"MARK_QUESTION_RENDERED":return et(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?tt(e,{mode:t.mode}):Fe(Fe({},e),{},{mode:t.mode});case"SET_QUESTION_HINT":return nt(e,t);case"CHECK_ANSWER":return rt(e,t);case"SEND_KEY":return Fe(Fe({},e),{},{keyPressed:t.keyPressed})}return e}}),st=n(10);function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var lt=regeneratorRuntime.mark(Pt),ft=regeneratorRuntime.mark(Qt),pt=regeneratorRuntime.mark(At);function dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(e){return function(e){if(Array.isArray(e))return yt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yt(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bt(){var e=[].slice.call(arguments,2),t=Object(u.dispatch)(arguments[0]),n=arguments[1];t[n].apply(t,mt(e))}var ht=LP,gt=ht.camelCaseDashObjectKeys,vt=ht.Hook;function wt(e,t){return t="string"==typeof e?dt({},e,t):e,"1"==lpQuizSettings.checkNorequizenroll&&null!==window.localStorage.getItem("quiz_userdata_"+lpQuizSettings.id)&&(t=JSON.parse(window.localStorage.getItem("quiz_userdata_"+lpQuizSettings.id))),{type:"SET_QUIZ_DATA",data:gt(t)}}function Ot(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function _t(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function St(e,t,n){return{type:"BEFORE_START_QUIZ"}}function qt(e,t,n,r){return vt.doAction("quiz-started",e,t,n,r),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:n,userId:r,results:e}}var jt=regeneratorRuntime.mark((function e(){var t,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Object(u.select)("learnpress/quiz").getDefaultRestArgs(),n=t.itemId,r=t.courseId,!0===vt.applyFilters("before-start-quiz",!0,n,r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Object(st.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:n,course_id:r}});case 6:return o=e.sent,o=vt.applyFilters("request-start-quiz-response",o,n,r),e.next=10,bt("learnpress/quiz","__requestStartQuizSuccess",gt(o),n,r);case 10:case"end":return e.stop()}}),e)}));function Rt(){return{type:"SUBMIT_QUIZ"}}function Et(e,t,n){return vt.doAction("quiz-submitted",e,t,n),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function Pt(){var e,t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=Object(u.select)("learnpress/quiz"),t=e.getDefaultRestArgs,n=e.getQuestionsSelectedAnswers,r=t(),o=r.itemId,i=r.courseId,!0===vt.applyFilters("before-submit-quiz",!0)){c.next=5;break}return c.abrupt("return");case 5:return a=n(),c.next=8,Object(st.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:o,course_id:i,answered:a}});case 8:if(s=c.sent,"1"==lpQuizSettings.checkNorequizenroll&&(window.localStorage.removeItem("quiz_end_"+lpQuizSettings.id),window.localStorage.setItem("quiz_end_"+lpQuizSettings.id,Date.now())),!(s=vt.applyFilters("request-submit-quiz-response",s,o,i)).success){c.next=14;break}return c.next=14,bt("learnpress/quiz","__requestSubmitQuizSuccess",gt(s.results),o,i);case 14:"1"==lpQuizSettings.checkNorequizenroll&&localStorage.setItem("quiz_userdata_"+lpQuizSettings.id,JSON.stringify(Object(u.select)("learnpress/quiz").getData()));case 15:case"end":return c.stop()}}),lt)}function zt(e,t,n){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function kt(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function Qt(e,t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,bt("learnpress/quiz","__requestShowHintSuccess",e,t);case 2:case"end":return n.stop()}}),ft)}function It(e,t){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){dt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"CHECK_ANSWER",questionId:e},t)}function At(e){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return t=Object(u.select)("learnpress/quiz"),n=t.getDefaultRestArgs,r=t.getQuestionAnswered,o=n(),i=o.itemId,a=o.courseId,c.next=4,Object(st.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:i,course_id:a,question_id:e,answered:r(e)||""}});case 4:return s=c.sent,c.next=7,bt("learnpress/quiz","__requestCheckAnswerSuccess",e,gt(s));case 7:case"end":return c.stop()}}),pt)}function Ct(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Nt(e){return{type:"SET_QUIZ_MODE",mode:e}}function Tt(e){return setTimeout((function(){bt("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}var xt=lodash,Dt=xt.get,Mt=xt.isArray,Lt=function(e,t){console.time("parseOptions");var n=Yt(e,t).options;return n=Mt(n)?n:JSON.parse(CryptoJS.AES.decrypt(n.data,n.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),n=Mt(n)?n:JSON.parse(n),console.timeEnd("parseOptions"),n};function Ut(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.status"):""}function Ht(e,t,n){return e[t]||n}function Ft(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.attempts"):[]}function Bt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Dt(n,"userSettings.answered",{}):{}}function Jt(e){var t=e.userQuiz,n=Dt(t,"questions");return n?Object.values(n):[]}function Gt(e,t){var n=e.userQuiz;return t?Dt(n,t):n}function Kt(e){var t=e.userQuiz;return{itemId:t.id,courseId:t.courseId}}function Wt(e,t){var n=e.userQuiz;return Dt(n,"answered.".concat(t,".answered"))||void 0}function $t(e,t){var n=e.userQuiz;return Dt(n,"answered.".concat(t,".mark"))||void 0}function Zt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=Dt(e,"userQuiz.questionsPerPage")||1;if(n>1)return!1;var r=Dt(e,"userQuiz.currentPage")||1;return Dt(e,"object"===t?"userQuiz.questions[".concat(r-1,"]"):"userQuiz.questionIds[".concat(r-1,"]"))}var Yt=function(e,t){e.userQuiz;return Object(u.select)("learnpress/quiz").getQuestions().find((function(e){return e.id==t}))};function Vt(e,t){return-1!==(Dt(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function Xt(e,t){}var en=function(e,t){var n=Dt(e,"userQuiz.answered"),r={};for(var o in n)if(n.hasOwnProperty(o))if("1"==lpQuizSettings.checknorequizenroll){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}else if(n[o].temp||n[o].blanks){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}return r};function tn(e){var t=e.userQuiz||{},n=t.answered,r=t.negativeMarking,o=t.questions,i=t.checkedQuestions,a=0,u=function(e){if(!n.hasOwnProperty(e))return s=e,"continue";e=parseInt(e);var t,u=n[e],c=u.questionMark?u.questionMark:(t=o.find((function(t){return s=e,t.id===e})),s=e,t?t.point:0);i.indexOf(e);if(u.temp)return s=e,"continue";r?u.answered&&(a=u.correct?a+u.mark:a-c):u.answered&&u.correct&&(a+=u.mark),s=e};for(var s in n)u(s);return a>0?a:0}var nn=n(7),rn=n.n(nn),on={ENROLL_COURSE_X:function(e,t){}};var an=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=rn()(on)(n)(e.dispatch),e.dispatch=t,e};function un(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var cn=LP.dataControls.controls,ln=Object(u.registerStore)("learnpress/quiz",{reducer:ut,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?un(Object(n),!0).forEach((function(t){sn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):un(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},cn)});an(ln);function fn(e){return(fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function mn(e,t){return(mn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=gn(e);if(t){var o=gn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return bn(this,n)}}function bn(e,t){if(t&&("object"===fn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return hn(e)}function hn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gn(e){return(gn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wn=lodash.chunk,On=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&mn(e,t)}(i,e);var t,n,r,o=yn(i);function i(e){var t;return pn(this,i),vn(hn(t=o.apply(this,arguments)),"startQuiz",(function(e){t.props.startQuiz()})),t.state={currentPage:1,numPages:0,pages:[]},t}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.settings,n=e.setQuizData,r=t.question_ids,o=t.questions_per_page,i=wn(r,o);t.currentPage=1,t.numPages=i.length,t.pages=i;var a=!!t.id&&localStorage.getItem("LP_Quiz_".concat(t.id,"_Answered"));a&&(t.answered=JSON.parse(a)),n(t)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.isReviewing,r=-1!==["","completed","viewed"].indexOf(t)||!t,o=-1!==["","viewed",void 0].indexOf(t)||!t;return void 0!==t&&React.createElement(React.Fragment,null,React.createElement("div",null,!n&&"completed"===t&&React.createElement(Te,null),!n&&o&&React.createElement(p,null),!n&&o&&React.createElement(s,null),"started"===t&&React.createElement(Me,null),(-1!==["completed","started"].indexOf(t)||n)&&React.createElement(je,null),React.createElement(E,null),r&&!n&&React.createElement(Re,null)))}}])&&dn(t.prototype,n),r&&dn(t,r),i}(i.Component),_n=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getQuestions,r=t.getData;return{questions:n(),status:r("status"),store:r(),answered:r("answered"),isReviewing:"reviewing"===r("mode"),questionIds:r("questionIds"),checkCount:r("instantCheck"),questionsPerPage:r("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{setQuizData:t.setQuizData,startQuiz:t.startQuiz}}))])(On);n(11);function Sn(e){return function(e){if(Array.isArray(e))return qn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return qn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var jn=LP.modal.default,Rn=(t.default=_n,function(e,t){wp.element.render(React.createElement(jn,null,React.createElement(_n,{settings:t})),Sn(document.querySelectorAll(e))[0]),LP.Hook.doAction("lp-quiz-compatible-builder")})}]);
|
3 |
Copyright (c) 2018 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return Pn}));var r={};n.r(r),n.d(r,"setQuizData",(function(){return Ot})),n.d(r,"setCurrentQuestion",(function(){return St})),n.d(r,"setCurrentPage",(function(){return qt})),n.d(r,"__requestBeforeStartQuiz",(function(){return jt})),n.d(r,"__requestStartQuizSuccess",(function(){return Rt})),n.d(r,"startQuiz",(function(){return Et})),n.d(r,"__requestSubmitQuiz",(function(){return Pt})),n.d(r,"__requestSubmitQuizSuccess",(function(){return kt})),n.d(r,"submitQuiz",(function(){return zt})),n.d(r,"updateUserQuestionAnswers",(function(){return Qt})),n.d(r,"__requestShowHintSuccess",(function(){return At})),n.d(r,"showHint",(function(){return It})),n.d(r,"__requestCheckAnswerSuccess",(function(){return Nt})),n.d(r,"checkAnswer",(function(){return Ct})),n.d(r,"markQuestionRendered",(function(){return Tt})),n.d(r,"setQuizMode",(function(){return xt})),n.d(r,"sendKey",(function(){return Dt}));var o={};n.r(o),n.d(o,"getQuestionOptions",(function(){return Ht})),n.d(o,"getItemStatus",(function(){return Ft})),n.d(o,"getProp",(function(){return Bt})),n.d(o,"getQuizAttempts",(function(){return Jt})),n.d(o,"getQuizAnswered",(function(){return Gt})),n.d(o,"getQuestions",(function(){return Kt})),n.d(o,"getData",(function(){return Wt})),n.d(o,"getDefaultRestArgs",(function(){return $t})),n.d(o,"getQuestionAnswered",(function(){return Zt})),n.d(o,"getQuestionMark",(function(){return Yt})),n.d(o,"getCurrentQuestion",(function(){return Vt})),n.d(o,"getQuestion",(function(){return Xt})),n.d(o,"isCheckedAnswer",(function(){return en})),n.d(o,"isCorrect",(function(){return tn})),n.d(o,"getQuestionsSelectedAnswers",(function(){return nn})),n.d(o,"getUserMark",(function(){return rn}));var i=n(3),a=n(4),u=n(1),s=function(){var e=Object(u.select)("learnpress/quiz").getData("content");return React.createElement("div",{className:"quiz-content",dangerouslySetInnerHTML:{__html:e}})},c=n(0),l=function(e){var t;if(e>86400)t=(e-e%86400)/86400,e%=86400;else if(86400==e)return"24:00";var n=new Date(1e3*e).toUTCString().match(/\d{2}:\d{2}:\d{2}/)[0].split(":");return t&&(n[0]=parseInt(n[0])+24*t),n.join(":")},f=LP.Hook,p=function(){var e=function(e){return Object(u.select)("learnpress/quiz").getData(e)},t=f.applyFilters("quiz-meta-fields",{duration:{title:Object(c.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:Object(c.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:Object(c.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&React.createElement(React.Fragment,null,React.createElement("ul",{className:"quiz-intro"},Object.values(t).map((function(e,t){var n=e.name||t;return React.createElement("li",{key:"quiz-intro-field-".concat(t),className:"quiz-intro-item quiz-intro-item--".concat(n)},React.createElement("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=S(e);if(t){var o=S(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return _(this,n)}}function _(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var j=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(i,e);var t,n,r,o=w(i);function i(){var e;h(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return q(O(e=o.call.apply(o,[this].concat(n))),"startQuiz",(function(t){t&&t.preventDefault();var n=document.querySelector(".lp-button.start");n&&n.setAttribute("disabled","disabled");var r=e.props,o=r.startQuiz;if("completed"===r.status){var i=Object(u.select)("learnpress/modal"),a=i.confirm,s=i.isOpen;if("no"===a(Object(c.__)("Are you sure you want to retake quiz?","learnpress"),e.startQuiz))return void(!s()&&n&&n.removeAttribute("disabled"))}o()})),q(O(e),"nav",(function(t){return function(n){var r=e.props,o=r.questionNav,i=r.currentPage,a=r.numPages,u=r.setCurrentPage;switch(t){case"prev":i>1?i-=1:i="infinity"===o?a:1;break;default:i<a?i+=1:i="infinity"===o?1:a}u(i)}})),q(O(e),"moveTo",(function(t){return function(n){n.preventDefault();var r=e.props,o=r.numPages,i=r.setCurrentPage;t<1||t>o||i(t)}})),q(O(e),"isLast",(function(){var t=e.props;return t.currentPage===t.numPages})),q(O(e),"isFirst",(function(){return 1===e.props.currentPage})),q(O(e),"submit",(function(){var t=e.props.submitQuiz;"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),e.submit)&&t()})),q(O(e),"setQuizMode",(function(t){return function(){(0,e.props.setQuizMode)(t)}})),q(O(e),"isReviewing",(function(){return e.props.isReviewing})),e}return t=i,(n=[{key:"pageNumbers",value:function(e){var t=this,n=this.props,r=n.numPages,o=n.currentPage;if(r<2)return"";(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){q(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({numPages:r,currentPage:o,midSize:1,endSize:1,prevNext:!0},e||{})).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);var i=m(Array(r).keys()),a=!1;return React.createElement("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&React.createElement("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},Object(c.__)("Prev","learnpress")),i.map((function(n){return(n+=1)===e.currentPage?(a=!0,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers current"},n)):n<=e.endSize||e.currentPage&&n>=e.currentPage-e.midSize&&n<=e.currentPage+e.midSize||n>e.numPages-e.endSize?(a=!0,React.createElement("button",{key:"page-number-".concat(n),className:"page-numbers",onClick:t.moveTo(n)},n)):a?(a=!1,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers dots"},"…")):""})),e.prevNext&&!this.isLast()&&React.createElement("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},Object(c.__)("Next","learnpress")))}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.questionNav,r=e.isReviewing,o=e.showReview,i=e.numPages,a=(e.question,e.questionsPerPage,e.canRetry),u=e.retakeNumber,s=["quiz-buttons"];("started"===t||r)&&s.push("align-center"),"questionNav"===n&&s.push("infinity"),this.isFirst()&&s.push("is-first"),this.isLast()&&s.push("is-last");var l=document.querySelector("#popup-sidebar"),f=document.querySelector("#learn-press-quiz-app"),p="";p="started"===t||r?{marginLeft:l&&l.offsetWidth/2,width:f&&f.offsetWidth}:null;var d=" fixed";return"no"==lpQuizSettings.navigationPosition&&(d=" nav-center"),React.createElement(React.Fragment,null,React.createElement("div",{className:s.join(" ")},React.createElement("div",{className:"button-left"+("started"===t||r?d:""),style:p},("completed"===t&&a||-1!==["","viewed"].indexOf(t))&&!r&&React.createElement("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===t?"".concat(Object(c.__)("Retake","learnpress")).concat(u?" (".concat(u,")"):""):Object(c.__)("Start","learnpress")),("started"===t||r)&&i>1&&React.createElement(React.Fragment,null,React.createElement("div",{className:"questions-pagination"},this.pageNumbers()))),React.createElement("div",{className:"button-right"},"started"===t&&React.createElement(React.Fragment,null,("infinity"===n||this.isLast())&&!r&&React.createElement("button",{className:"lp-button submit-quiz",onClick:this.submit},Object(c.__)("Finish Quiz","learnpress"))),r&&o&&React.createElement("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},Object(c.__)("Result","learnpress")),"completed"===t&&o&&!r&&React.createElement("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},Object(c.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&React.createElement("div",{className:"learn-press-message error"},this.props.message))}}])&&v(t.prototype,n),r&&v(t,r),i}(i.Component),R=Object(a.compose)(Object(u.withSelect)((function(e){var t=e("learnpress/quiz").getData;return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((function(e){var t=e.showCheck,n=e.checkedQuestions,r=e.hintedQuestions,o=e.question,i=e.status,a=e.type,u=e.Button;if("started"!==i)return!1;var s=React.createElement(u,{question:o});switch(a){case"hint":return r?!!o.hasHint&&(-1===r.indexOf(o.id)&&s):s;case"check":return!!t&&(n?-1===n.indexOf(o.id)&&s:s)}})),E=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getData,r=t.getCurrentQuestion,o={id:n("id"),status:n("status"),questionIds:n("questionIds"),questionNav:n("questionNav"),isReviewing:n("reviewQuestions")&&"reviewing"===n("mode"),showReview:n("reviewQuestions"),showCheck:n("instantCheck"),checkedQuestions:n("checkedQuestions"),hintedQuestions:n("hintedQuestions"),numPages:n("numPages"),pages:n("pages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage"),pageNumbers:n("pageNumbers"),keyPressed:n("keyPressed"),canRetry:n("retakeCount")>0&&n("retaken")<n("retakeCount"),retakeNumber:n("retakeCount")>0&&n("retaken")<n("retakeCount")?n("retakeCount")-n("retaken"):null,message:n("messageResponse")||!1,success:void 0===n("successResponse")||n("successResponse")};if(1===o.questionsPerPage&&(o.question=r("object")),1===lpQuizSettings.checkNorequizenroll){var i=window.localStorage.getItem("quiz_off_retaken_"+lpQuizSettings.id);n("retakeCount")>i?(o.retakeNumber=n("retakeCount")-i,o.canRetry=!0):o.canRetry=!1}return o})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz"),r=n.startQuiz,o=n.setCurrentQuestion,i=n.submitQuiz,a=n.setQuizMode,u=n.showHint,s=n.checkAnswer;return{startQuiz:r,setCurrentQuestion:o,setQuizMode:a,setCurrentPage:n.setCurrentPage,submitQuiz:function(e){i(e)},showHint:function(e){u(e)},checkAnswer:function(e){s(e)}}}))])(j);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Q(e,t){return(Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=C(e);if(t){var o=C(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){if(t&&("object"===P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return N(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Q(e,t)}(i,e);var t,n,r,o=A(i);function i(){var e;k(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return T(N(e=o.call.apply(o,[this].concat(n))),"showHint",(function(){var t=e.props,n=t.showHint,r=t.question;n(r.id,!r.showHint)})),e}return t=i,(n=[{key:"render",value:function(){return this.props.question.hint?React.createElement("button",{className:"btn-show-hint",onClick:this.showHint},React.createElement("span",null,Object(c.__)("Hint","learnpress"))):""}}])&&z(t.prototype,n),r&&z(t,r),i}(i.Component),D=Object(a.compose)(Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").showHint;return{showHint:function(e,t){n(e,t)}}})))(x),M=n(13),L=n.n(M);function U(e){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function J(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=W(e);if(t){var o=W(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return G(this,n)}}function G(e,t){if(t&&("object"===U(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(i,e);var t,n,r,o=J(i);function i(){var e;return H(this,i),$(K(e=o.apply(this,arguments)),"checkAnswer",(function(){var t=e.props,n=t.checkAnswer,r=t.question;t.answered&&(n(r.id),e.setState({loading:!0}))})),e.state={loading:!1},e}return t=i,(n=[{key:"render",value:function(){var e=this.props.answered;return React.createElement(React.Fragment,null,React.createElement("button",{className:L()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},React.createElement("span",{className:"instant-check__icon"}),Object(c.__)("Check answer","learnpress"),!e&&React.createElement("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:Object(c.__)("You need to answer the question before check answer.","learnpress")}})))}}])&&F(t.prototype,n),r&&F(t,r),i}(i.Component),Y=Object(a.compose)(Object(u.withSelect)((function(e,t){var n=t.question.id;return{answered:(0,e("learnpress/quiz").getQuestionAnswered)(n)}})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").checkAnswer;return{checkAnswer:function(e){n(e)}}})))(Z),V=function(e){var t=e.question,n={"instant-check":function(){return React.createElement(R,{type:"check",Button:Y,question:t})},hint:function(){return React.createElement(R,{type:"hint",Button:D,question:t})}};return React.createElement(React.Fragment,null,LP.config.questionFooterButtons().map((function(e){return React.createElement(i.Fragment,{key:"button-".concat(e)},n[e]&&n[e]())})))};function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ae(this,n)}}function ae(e,t){if(t&&("object"===X(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ue(e)}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=window.jQuery,fe=lodash,pe=(fe.uniqueId,fe.isArray),de=(fe.isNumber,fe.bind,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(a,e);var t,n,r,o=ie(a);function a(){var e;return ne(this,a),ce(ue(e=o.apply(this,arguments)),"setRef",(function(t){e.$wrap=le(t)})),ce(ue(e),"parseOptions",(function(e){return e&&(e=pe(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=pe(e)?e:JSON.parse(e)),e||[]})),ce(ue(e),"getWrapperClass",(function(){var t=e.props,n=t.question,r=(t.answered,["question","question-"+n.type]),o=e.parseOptions(n.options);return o.length&&void 0!==o[0].isTrue&&r.push("question-answered"),r})),ce(ue(e),"getEditLink",(function(){var t=e.props,n=t.question,r=t.editPermalink;return r?r.replace(/post=(.*[0-9])/,"post=".concat(n.id)):""})),ce(ue(e),"editPermalink",(function(e){return Object(c.sprintf)('<a href="%s">%s</a>',e,Object(c.__)("Edit","learnpress"))})),e.state={time:null,showHint:!1},e.$wrap=null,e}return t=a,(n=[{key:"componentDidMount",value:function(e){var t=this.props,n=t.question,r=t.isCurrent,o=t.markQuestionRendered;return r&&o(n.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),"undefined"!=typeof MathJax&&MathJax.Hub.Queue(["Typeset",MathJax.Hub]),e}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.isShow,o=t.isShowIndex,a=(t.isShowHint,t.status),u=LP.questionTypes.default,s=this.getEditLink();s&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",s);var l={index:function(){return o?React.createElement("span",{className:"question-index"},o,"."):""},title:function(){return React.createElement("span",{dangerouslySetInnerHTML:{__html:n.title}})},hint:function(){return React.createElement(D,{question:n})},"edit-permalink":function(){return s&&React.createElement("span",{dangerouslySetInnerHTML:{__html:e.editPermalink(s)},className:"edit-link"})}},f={title:function(){return React.createElement("h4",{className:"question-title"},LP.config.questionTitleParts().map((function(e){return React.createElement(i.Fragment,{key:"title-part-".concat(e)},l[e]&&l[e]())})))},content:function(){return React.createElement("div",{className:"question-content",dangerouslySetInnerHTML:{__html:n.content}})},"answer-options":function(){return e.$wrap&&React.createElement(u,te(te({},e.props),{},{$wrap:e.$wrap}))},explanation:function(){return n.explanation&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-explanation-content"},React.createElement("strong",{className:"explanation-title"},Object(c.__)("Explanation","learnpress"),":"),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.explanation}})))},hint:function(){return n.hint&&!n.explanation&&n.showHint&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-hint-content"},React.createElement("strong",{className:"hint-title"},Object(c.__)("Hint","learnpress"),":"),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.hint}})))},buttons:function(){return"started"===a&&React.createElement(V,{question:n})}},p=LP.config.questionBlocks();return React.createElement(React.Fragment,null,React.createElement("div",{className:this.getWrapperClass().join(" "),style:{display:r?"":"none"},"data-id":n.id,ref:this.setRef},p.map((function(e){return React.createElement(i.Fragment,{key:"block-".concat(e)},f[e]?f[e]():"")}))))}}])&&re(t.prototype,n),r&&re(t,r),a}(i.Component)),me=Object(a.compose)([Object(u.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.getQuestionAnswered,a=r.getQuestionMark;return{status:o("status"),questions:o("question"),answered:i(n),questionsRendered:o("questionsRendered"),editPermalink:o("editPermalink"),numPages:o("numPages"),mark:a(n)||""}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz"),n=t.updateUserQuestionAnswers;return{markQuestionRendered:t.markQuestionRendered,updateUserQuestionAnswers:n}}))])(de);function ye(e){return(ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Oe(e);if(t){var o=Oe(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return we(this,n)}}function we(e,t){if(t&&("object"===ye(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _e(e)}function _e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oe(e){return(Oe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Se(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ve(e,t)}(i,e);var t,n,r,o=ge(i);function i(e){var t;return be(this,i),Se(_e(t=o.apply(this,arguments)),"startQuiz",(function(e){e.preventDefault(),(0,t.props.startQuiz)()})),Se(_e(t),"isInVisibleRange",(function(e,n){var r=t.props,o=r.currentPage,i=r.questionsPerPage;return o===Math.ceil(n/i)})),Se(_e(t),"nav",(function(e){var n=t.props.sendKey;switch(e.keyCode){case 37:return n("left");case 38:return;case 39:return n("right");case 40:return;default:e.keyCode>=49&&e.keyCode<=57&&n(e.keyCode-48)}})),t.needToTop=!1,t.state={isReviewing:null,currentPage:0,self:_e(t)},t}return t=i,r=[{key:"getDerivedStateFromProps",value:function(e,t){for(var n=["isReviewing","currentPage"],r={},o=0;o<n.length;o++)e[n[o]]!==t[n[o]]&&(r[n[o]]=e[n[o]]);return Object.values(r).length?(t.self.needToTop=!0,r):null}}],(n=[{key:"componentDidUpdate",value:function(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}},{key:"render",value:function(){var e=this,t=this.props,n=t.status,r=t.currentQuestion,o=t.questions,i=t.questionsRendered,a=t.isReviewing,u=t.questionsPerPage,s=!0;return"completed"!==n||a||(s=!1),React.createElement(React.Fragment,null,React.createElement("div",{tabIndex:100,onKeyUp:this.nav},React.createElement("div",{className:"quiz-questions",style:{display:s?"":"none"}},o.map((function(t,n){var o=!u&&r===t.id,a=i&&-1!==i.indexOf(t.id),s=e.isInVisibleRange(t.id,n+1);return a||!a||s?React.createElement(me,{key:"loop-question-".concat(t.id),isCurrent:o,isShow:s,isShowIndex:!!u&&n+1,questionsPerPage:u,question:t}):""})))))}}])&&he(t.prototype,n),r&&he(t,r),i}(i.Component),je=Object(a.compose)(Object(u.withSelect)((function(e,t,n){var r=e("learnpress/quiz"),o=r.getData,i=r.getQuestions;return{status:o("status"),currentQuestion:o("currentQuestion"),questions:i(),questionsRendered:o("questionsRendered"),isReviewing:"reviewing"===o("mode"),numPages:o("numPages"),currentPage:o("currentPage"),questionsPerPage:o("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{startQuiz:t.startQuiz,sendKey:t.sendKey}})))(qe);var Re=function(){var e=Object(u.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&React.createElement(React.Fragment,null,React.createElement("div",{className:"quiz-attempts"},React.createElement("h4",{className:"attempts-heading"},Object(c.__)("Last Attempted","learnpress")),t&&React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"quiz-attempts__questions"},Object(c.__)("Questions","learnpress")),React.createElement("th",{className:"quiz-attempts__spend"},Object(c.__)("Time spent","learnpress")),React.createElement("th",{className:"quiz-attempts__marks"},Object(c.__)("Marks","learnpress")),React.createElement("th",{className:"quiz-attempts__grade"},Object(c.__)("Passing grade","learnpress")),React.createElement("th",{className:"quiz-attempts__result"},Object(c.__)("Result","learnpress")))),React.createElement("tbody",null,e.map((function(e,t){return React.createElement("tr",{key:"attempt-".concat(t)},React.createElement("td",{className:"quiz-attempts__questions"},"".concat(e.questionCorrect," / ").concat(e.questionCount)),React.createElement("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),React.createElement("td",{className:"quiz-attempts__marks"},"".concat(e.userMark," / ").concat(e.mark)),React.createElement("td",{className:"quiz-attempts__grade"},e.passingGrade||"-"),React.createElement("td",{className:"quiz-attempts__result"},"".concat(parseFloat(e.result).toFixed(2),"%")," ",React.createElement("span",null,e.graduationText)))}))))))};function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ke=function(){var e=Object(u.select)("learnpress/quiz").getData,t=Object(u.dispatch)("learnpress/quiz").submitQuiz,n=e("totalTime"),r=e("duration"),o=Ee(Object(i.useState)(n),2),a=o[0],s=o[1],c=Ee(Object(i.useState)(0),2),l=c[0],f=c[1];Object(i.useEffect)((function(){var e=setInterval((function(){var n=a;(n-=1)>0?(s(n),l++,f(r-n)):(clearInterval(e),t())}),1e3);return function(){return clearInterval(e)}}),[a,l]);return React.createElement("div",{className:"countdown"},React.createElement("i",{className:"fas fa-stopwatch"}),React.createElement("span",null,function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":",r=[];return n<3600?(r.push((a-a%60)/60),r.push(a%60)):n&&(r.push((a-a%3600)/3600),e=a%3600,r.push((e-e%60)/60),r.push(e%60)),r.map((function(e){return e<10?"0".concat(e):e})).join(t)}()),React.createElement("input",{type:"hidden",name:"lp-quiz-time-spend",value:l}))},ze=n(9);function Qe(e){return function(e){if(Array.isArray(e))return Ne(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ie(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||Ie(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ie(e,t){if(e){if("string"==typeof e)return Ne(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ne(e,t):void 0}}function Ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ce=lodash.debounce,Te=function(){var e=Ae(Object(i.useState)(0),2),t=e[0],n=e[1],r=Ae(Object(i.useState)(!1),2),o=r[0],a=r[1],s=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("id")}),[]),l=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("results")}),[]),f=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("passingGrade")}),[]),p=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("submitting")}),[]);Object(i.useEffect)((function(){m();var e="";if(e=l.graduation?l.graduation:l.result>=g.replace(/[^0-9\.]+/g,"")?"passed":"failed"){var t=document.querySelector(".course-curriculum .course-item.course-item-".concat(s));t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}var n=Qe(document.querySelectorAll("#popup-header .items-progress"))[0];if(n){var r=n.querySelector(".items-completed");if(r){parseInt(r.textContent);var o=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");r.textContent=parseInt(o.length)}}}),[l]),Object(i.useEffect)((function(){void 0!==p&&d()}),[p]);var d=function(){var e=document.querySelectorAll(".popup-header__inner");e.length>0&&0===e[0].querySelectorAll("form.form-button-finish-course").length&&Object(ze.a)(e[0])},m=function(){n(0),a(!1),jQuery.easing._customEasing=function(e,t,n,r,o){return r*Math.sqrt(1-(t=t/o-1)*t)+n},Ce((function(){var e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:l.result},{duration:1500,step:function(e,t){n(e)},done:function(){a(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),Ce((function(){jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),l.result>0?1e3:10)()},y=t;Number.isInteger(t)||(y=parseFloat(t).toFixed(2));var b=190*Math.PI,h=b-y/100*b,v={strokeDasharray:"".concat(b," ").concat(b),strokeDashoffset:h},g=l.passingGrade||f,w="";w=l.graduation?l.graduation:y>=g.replace(/[^0-9\.]+/g,"")?"passed":"failed";var _="";_=l.graduationText?l.graduationText:"passed"===w?Object(c.__)("Passed","learnpress"):Object(c.__)("Failed","learnpress");var O=["quiz-result",w];return React.createElement("div",{className:O.join(" ")},React.createElement("h3",{className:"result-heading"},Object(c.__)("Your Result","learnpress")),React.createElement("div",{id:"quizResultGrade",className:"result-grade"},React.createElement("svg",{className:"circle-progress-bar",width:200,height:200},React.createElement("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:v,fill:"transparent",r:95,cx:100,cy:100})),React.createElement("span",{className:"result-achieved"},"".concat(y,"%")),React.createElement("span",{className:"result-require"},g||"-")),o&&React.createElement("p",{className:"result-message"},_),React.createElement("ul",{className:"result-statistic"},React.createElement("li",{className:"result-statistic-field result-time-spend"},React.createElement("span",null,Object(c.__)("Time spent","learnpress")),React.createElement("p",null,l.timeSpend)),React.createElement("li",{className:"result-statistic-field result-point"},React.createElement("span",null,Object(c.__)("Points","learnpress")),React.createElement("p",null,l.userMark," / ",l.mark)),React.createElement("li",{className:"result-statistic-field result-questions"},React.createElement("span",null,Object(c.__)("Questions","learnpress")),React.createElement("p",null,l.questionCount)),React.createElement("li",{className:"result-statistic-field result-questions-correct"},React.createElement("span",null,Object(c.__)("Correct","learnpress")),React.createElement("p",null,l.questionCorrect)),React.createElement("li",{className:"result-statistic-field result-questions-wrong"},React.createElement("span",null,Object(c.__)("Wrong","learnpress")),React.createElement("p",null,l.questionWrong)),React.createElement("li",{className:"result-statistic-field result-questions-skipped"},React.createElement("span",null,Object(c.__)("Skipped","learnpress")),React.createElement("p",null,l.questionEmpty))))},xe=jQuery,De=lodash.debounce,Me=function(){var e=Object(u.dispatch)("learnpress/quiz").submitQuiz;Object(i.useEffect)((function(){var e=xe("#popup-content");if(e.length){var t=e.find(".content-item-scrollable:eq(1)"),n=e.find(".content-item-wrap"),r=e.find(".quiz-status"),o=r.offset().top-92,i=!1,a="-"+n.css("margin-left");xe(window).on("resize.refresh-quiz-stauts-bar",De((function(){a="-"+n.css("margin-left"),r.css({"margin-left":a,"margin-right":a})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(function(){if(t.scrollTop()>=o){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}}),[]);var t=Object(u.select)("learnpress/quiz"),n=t.getData,r=t.getUserMark,o=n("currentPage"),a=n("questionsPerPage"),s=n("questionIds").length,l=n("submitting"),f=(n("totalTime"),n("duration")),p=r(),d=["quiz-status"],m=(o-1)*a+1,y=m+a-1,b="";return y=Math.min(y,s),l&&d.push("submitting"),b=y<s?a>1?Object(c.sprintf)(Object(c.__)("Question <span>%d to %d of %d</span>","learnpress"),m,y,s):Object(c.sprintf)(Object(c.__)("Question <span>%d of %d</span>","learnpress"),m,s):Object(c.sprintf)(Object(c.__)("Question <span>%d to %d</span>","learnpress"),m,y),React.createElement("div",{className:d.join(" ")},React.createElement("div",null,React.createElement("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:b}}),React.createElement("div",{className:"current-point"},Object(c.sprintf)(Object(c.__)("Earned Point: %s","learnpress"),p)),React.createElement("div",null,React.createElement("div",{className:"submit-quiz"},React.createElement("button",{className:"lp-button",id:"button-submit-quiz",onClick:function t(){"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),t)&&e()}},l?Object(c.__)("Submitting...","learnpress"):Object(c.__)("Finish Quiz","learnpress"))),f&&React.createElement(ke,null))))};function Le(e){return function(e){if(Array.isArray(e))return Ue(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ue(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?He(Object(n),!0).forEach((function(t){Be(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):He(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Be(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Je=lodash,Ge=(Je.omit,Je.flow),Ke=Je.isArray,We=Je.chunk,$e=(LP.camelCaseDashObjectKeys,LP.localStorage),Ze=$e.get,Ye=$e.set,Ve={},Xe=function(e,t){var n=e.answered,r=e.id,o=Fe(Fe({},n[t.questionId]||{}),{},{answered:t.answers,temp:!0});return r&&localStorage.setItem("LP_Quiz_".concat(r,"_Answered"),JSON.stringify(Fe(Fe({},e.answered),{},Be({},t.questionId,o)))),Fe(Fe({},e),{},{answered:Fe(Fe({},e.answered),{},Be({},t.questionId,o))})},et=function(e,t){var n=e.questionsRendered;return Ke(n)?(n.push(t.questionId),Fe(Fe({},e),{},{questionsRendered:Le(n)})):Fe(Fe({},e),{},{questionsRendered:[t.questionId]})},tt=function(e,t){return t.currentPage&&Ye("Q".concat(e.id,".currentPage"),t.currentPage),Fe(Fe({},e),t)},nt=function(e,t){var n=e.questions.map((function(e){return e.id==t.questionId?Fe(Fe({},e),{},{showHint:t.showHint}):e}));return Fe(Fe({},e),{},{questions:Le(n)})},rt=function(e,t){var n=e.questions.map((function(e){if(e.id!==t.questionId)return e;var n={explanation:t.explanation};return t.options&&(n.options=t.options),Fe(Fe({},e),n)})),r=Fe(Fe({},e.answered),{},Be({},t.questionId,t.result)),o=localStorage.getItem("LP_Quiz_".concat(e.id,"_Answered"));return o&&(o=Fe(Fe({},JSON.parse(o)),r),localStorage.setItem("LP_Quiz_".concat(e.id,"_Answered"),JSON.stringify(o))),Fe(Fe({},e),{},{questions:Le(n),answered:r,checkedQuestions:[].concat(Le(e.checkedQuestions),[t.questionId])})},ot=function(e,t){localStorage.removeItem("LP_Quiz_".concat(e.id,"_Answered"));var n=e.questions.map((function(n){var r={};return e.reviewQuestions&&(t.results.questions[n.id].explanation&&(r.explanation=t.results.questions[n.id].explanation),t.results.questions[n.id].options&&(r.options=t.results.questions[n.id].options)),Fe(Fe({},n),r)}));return tt(e,Fe(Fe({submitting:!1,currentPage:1},t.results),{},{questions:Le(n)}))},it=function(e,t){var n=void 0!==t.results.success&&t.results.success,r=t.results.message||!1;return tt(e,Fe(Fe({checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1},t.results.results),{},{successResponse:n,messageResponse:r}))},at=Ge(u.combineReducers,(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}))({a:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1};return e},b:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2};return e}}),ut=Object(u.combineReducers)({blocks:at,userQuiz:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);var n=We(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=n.length,t.data.pages=n,Fe(Fe(Fe({},e),t.data),{},{currentPage:Ze("Q".concat(t.data.id,".currentPage"))||t.data.currentPage});case"SUBMIT_QUIZ":return Fe(Fe({},e),{},{submitting:!0});case"START_QUIZ":case"START_QUIZ_SUCCESS":return it(e,t);case"SET_CURRENT_QUESTION":return Ye("Q".concat(e.id,".currentQuestion"),t.questionId),Fe(Fe({},e),{},{currentQuestion:t.questionId});case"SET_CURRENT_PAGE":return Ye("Q".concat(e.id,".currentPage"),t.currentPage),Fe(Fe({},e),{},{currentPage:t.currentPage});case"SUBMIT_QUIZ_SUCCESS":return ot(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?Xe(e,t):e;case"MARK_QUESTION_RENDERED":return et(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?tt(e,{mode:t.mode}):Fe(Fe({},e),{},{mode:t.mode});case"SET_QUESTION_HINT":return nt(e,t);case"CHECK_ANSWER":return rt(e,t);case"SEND_KEY":return Fe(Fe({},e),{},{keyPressed:t.keyPressed})}return e}}),st=n(10);function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var lt=regeneratorRuntime.mark(zt),ft=regeneratorRuntime.mark(It),pt=regeneratorRuntime.mark(Ct);function dt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){u=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw o}}return i}(e,t)||bt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yt(e){return function(e){if(Array.isArray(e))return ht(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||bt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bt(e,t){if(e){if("string"==typeof e)return ht(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ht(e,t):void 0}}function ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vt(){var e=[].slice.call(arguments,2),t=Object(u.dispatch)(arguments[0]),n=arguments[1];t[n].apply(t,yt(e))}var gt=LP,wt=gt.camelCaseDashObjectKeys,_t=gt.Hook;function Ot(e,t){return t="string"==typeof e?mt({},e,t):e,{type:"SET_QUIZ_DATA",data:wt(t)}}function St(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function qt(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function jt(e,t,n){return{type:"BEFORE_START_QUIZ"}}function Rt(e,t,n,r){return _t.doAction("quiz-started",e,t,n,r),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:n,userId:r,results:e}}var Et=regeneratorRuntime.mark((function e(){var t,n,r,o,i,a,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Object(u.select)("learnpress/quiz").getDefaultRestArgs(),n=t.itemId,r=t.courseId,!0===_t.applyFilters("before-start-quiz",!0,n,r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Object(st.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:n,course_id:r}});case 6:if("error"===(o=e.sent).status){e.next=12;break}return o=_t.applyFilters("request-start-quiz-response",o,n,r),1===lpQuizSettings.checkNorequizenroll&&(i="quiz_off_"+lpQuizSettings.id,window.localStorage.removeItem(i),a={endTime:Date.now()+1e3*o.results.duration,status:o.results.status},window.localStorage.setItem(i,JSON.stringify(a)),s="quiz_off_retaken_"+lpQuizSettings.id,null===(c=window.localStorage.getItem(s))?c=0:c++,window.localStorage.setItem(s,c)),e.next=12,vt("learnpress/quiz","__requestStartQuizSuccess",wt(o),n,r);case 12:case"end":return e.stop()}}),e)}));function Pt(){return{type:"SUBMIT_QUIZ"}}function kt(e,t,n){return _t.doAction("quiz-submitted",e,t,n),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function zt(){var e,t,n,r,o,i,a,s,c,l,f,p,d,m,y,b,h,v,g,w,_;return regeneratorRuntime.wrap((function(O){for(;;)switch(O.prev=O.next){case 0:if(e=Object(u.select)("learnpress/quiz"),t=e.getDefaultRestArgs,n=e.getQuestionsSelectedAnswers,r=t(),o=r.itemId,i=r.courseId,!0===_t.applyFilters("before-submit-quiz",!0)){O.next=5;break}return O.abrupt("return");case 5:if(a=n(),1===lpQuizSettings.checkNorequizenroll&&(s="LP_Quiz_".concat(o,"_Answered"),null!==(c=localStorage.getItem(s))))for(l=JSON.parse(c),f=0,p=Object.entries(l);f<p.length;f++)d=dt(p[f],2),m=d[0],y=d[1],a[m]=y.answered;return b=0,(h=document.querySelector("input[name=lp-quiz-time-spend]"))&&(b=h.value),O.next=12,Object(st.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:o,course_id:i,answered:a,time_spend:b}});case 12:if(v=O.sent,"success"!==(v=_t.applyFilters("request-submit-quiz-response",v,o,i)).status){O.next=18;break}return 1===lpQuizSettings.checkNorequizenroll&&(g="quiz_off_"+lpQuizSettings.id,null!==(w=window.localStorage.getItem(g))&&((_=JSON.parse(w)).status=v.results.status,_.results=v.results.results,window.localStorage.setItem(g,JSON.stringify(_)),window.localStorage.removeItem("LP_Quiz_"+lpQuizSettings.id+"_Answered"))),O.next=18,vt("learnpress/quiz","__requestSubmitQuizSuccess",wt(v.results),o,i);case 18:case"end":return O.stop()}}),lt)}function Qt(e,t,n){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function At(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function It(e,t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,vt("learnpress/quiz","__requestShowHintSuccess",e,t);case 2:case"end":return n.stop()}}),ft)}function Nt(e,t){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){mt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"CHECK_ANSWER",questionId:e},t)}function Ct(e){var t,n,r,o,i,a,s,c,l,f,p;return regeneratorRuntime.wrap((function(d){for(;;)switch(d.prev=d.next){case 0:return t=Object(u.select)("learnpress/quiz"),n=t.getDefaultRestArgs,r=t.getQuestionAnswered,o=n(),i=o.itemId,a=o.courseId,d.next=4,Object(st.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:i,course_id:a,question_id:e,answered:r(e)||""}});case 4:if("success"!==(s=d.sent).status){d.next=9;break}return 1===lpQuizSettings.checkNorequizenroll&&(c="quiz_off_"+lpQuizSettings.id,null!==(l=window.localStorage.getItem(c))&&(f=JSON.parse(l),p=s.options,void 0===f.checked_questions?(f.checked_questions=[],f.checked_questions.push(e)):-1===f.checked_questions.indexOf(e)&&f.checked_questions.push(e),void 0===f.question_options?(f.question_options={},f.question_options[e]=p):void 0===f.question_options[e]&&(f.question_options[e]=p),window.localStorage.setItem(c,JSON.stringify(f)))),d.next=9,vt("learnpress/quiz","__requestCheckAnswerSuccess",e,wt(s));case 9:case"end":return d.stop()}}),pt)}function Tt(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function xt(e){return{type:"SET_QUIZ_MODE",mode:e}}function Dt(e){return setTimeout((function(){vt("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}var Mt=lodash,Lt=Mt.get,Ut=Mt.isArray,Ht=function(e,t){console.time("parseOptions");var n=Xt(e,t).options;return n=Ut(n)?n:JSON.parse(CryptoJS.AES.decrypt(n.data,n.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),n=Ut(n)?n:JSON.parse(n),console.timeEnd("parseOptions"),n};function Ft(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Lt(n,"userSettings.status"):""}function Bt(e,t,n){return e[t]||n}function Jt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Lt(n,"userSettings.attempts"):[]}function Gt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?Lt(n,"userSettings.answered",{}):{}}function Kt(e){var t=e.userQuiz,n=Lt(t,"questions");return n?Object.values(n):[]}function Wt(e,t){var n=e.userQuiz;return t?Lt(n,t):n}function $t(e){var t=e.userQuiz;return{itemId:t.id,courseId:t.courseId}}function Zt(e,t){var n=e.userQuiz;return Lt(n,"answered.".concat(t,".answered"))||void 0}function Yt(e,t){var n=e.userQuiz;return Lt(n,"answered.".concat(t,".mark"))||void 0}function Vt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=Lt(e,"userQuiz.questionsPerPage")||1;if(n>1)return!1;var r=Lt(e,"userQuiz.currentPage")||1;return Lt(e,"object"===t?"userQuiz.questions[".concat(r-1,"]"):"userQuiz.questionIds[".concat(r-1,"]"))}var Xt=function(e,t){e.userQuiz;return Object(u.select)("learnpress/quiz").getQuestions().find((function(e){return e.id==t}))};function en(e,t){return-1!==(Lt(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function tn(e,t){}var nn=function(e,t){var n=Lt(e,"userQuiz.answered"),r={};for(var o in n)if(n.hasOwnProperty(o))if("1"==lpQuizSettings.checknorequizenroll){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}else if(n[o].temp||n[o].blanks){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}return r};function rn(e){var t=e.userQuiz||{},n=t.answered,r=t.negativeMarking,o=t.questions,i=t.checkedQuestions,a=0,u=function(e){if(!n.hasOwnProperty(e))return s=e,"continue";e=parseInt(e);var t,u=n[e],c=u.questionMark?u.questionMark:(t=o.find((function(t){return s=e,t.id===e})),s=e,t?t.point:0);i.indexOf(e);if(u.temp)return s=e,"continue";r?u.answered&&(a=u.correct?a+u.mark:a-c):u.answered&&u.correct&&(a+=u.mark),s=e};for(var s in n)u(s);return a>0?a:0}var on=n(7),an=n.n(on),un={ENROLL_COURSE_X:function(e,t){}};var sn=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=an()(un)(n)(e.dispatch),e.dispatch=t,e};function cn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ln(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var fn=LP.dataControls.controls,pn=Object(u.registerStore)("learnpress/quiz",{reducer:ut,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cn(Object(n),!0).forEach((function(t){ln(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},fn)});sn(pn);function dn(e){return(dn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bn(e,t){return(bn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function hn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=wn(e);if(t){var o=wn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return vn(this,n)}}function vn(e,t){if(t&&("object"===dn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return gn(e)}function gn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wn(e){return(wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var On=lodash.chunk,Sn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bn(e,t)}(i,e);var t,n,r,o=hn(i);function i(e){var t;return mn(this,i),_n(gn(t=o.apply(this,arguments)),"startQuiz",(function(e){t.props.startQuiz()})),t.state={currentPage:1,numPages:0,pages:[]},t}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.settings,n=e.setQuizData,r=t.question_ids,o=t.questions_per_page,i=On(r,o);t.currentPage=1,t.numPages=i.length,t.pages=i;var a=!!t.id&&localStorage.getItem("LP_Quiz_".concat(t.id,"_Answered"));a&&(t.answered=JSON.parse(a)),n(t)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.isReviewing,r=-1!==["","completed","viewed"].indexOf(t)||!t,o=-1!==["","viewed",void 0].indexOf(t)||!t;return void 0!==t&&React.createElement(React.Fragment,null,React.createElement("div",null,!n&&"completed"===t&&React.createElement(Te,null),!n&&o&&React.createElement(p,null),!n&&o&&React.createElement(s,null),"started"===t&&React.createElement(Me,null),(-1!==["completed","started"].indexOf(t)||n)&&React.createElement(je,null),React.createElement(E,null),r&&!n&&React.createElement(Re,null)))}}])&&yn(t.prototype,n),r&&yn(t,r),i}(i.Component),qn=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getQuestions,r=t.getData;return{questions:n(),status:r("status"),store:r(),answered:r("answered"),isReviewing:"reviewing"===r("mode"),questionIds:r("questionIds"),checkCount:r("instantCheck"),questionsPerPage:r("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{setQuizData:t.setQuizData,startQuiz:t.startQuiz}}))])(Sn);n(11);function jn(e){return function(e){if(Array.isArray(e))return Rn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Rn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var En=LP.modal.default,Pn=(t.default=qn,function(e,t){if(1===lpQuizSettings.checkNorequizenroll){var n="quiz_off_"+lpQuizSettings.id,r=window.localStorage.getItem(n);if(null!==r){var o=JSON.parse(r);if(t.status=o.status,"started"===o.status){var i=Date.now();t.total_time=Math.floor((o.endTime-i)/1e3)}else"completed"===o.status&&(t.results=o.results,t.answered=o.results.answered,t.questions=o.results.questions);if(void 0!==o.checked_questions&&(t.checked_questions=o.checked_questions),void 0!==o.question_options)for(var a in t.questions){var u=t.questions[a];void 0!==o.question_options[u.id]&&(u.options=o.question_options[u.id]),t.questions[a]=u}}}wp.element.render(React.createElement(En,null,React.createElement(qn,{settings:t})),jn(document.querySelectorAll(e))[0]),LP.Hook.doAction("lp-quiz-compatible-builder")})}]);
|
@@ -82,21 +82,21 @@ this["LP"] = this["LP"] || {}; this["LP"]["singleCourse"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! exports provided: default */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "
|
100 |
var $ = jQuery;
|
101 |
|
102 |
var lpModalOverlayCompleteItem = {
|
@@ -149,10 +149,10 @@ var lpModalOverlayCompleteItem = {
|
|
149 |
|
150 |
/***/ }),
|
151 |
|
152 |
-
/***/ "
|
153 |
-
|
154 |
-
!***
|
155 |
-
|
156 |
/*! exports provided: default, init, initCourseTabs, initCourseSidebar, enrollCourse */
|
157 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
158 |
|
@@ -162,11 +162,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
162 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initCourseTabs", function() { return initCourseTabs; });
|
163 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initCourseSidebar", function() { return initCourseSidebar; });
|
164 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enrollCourse", function() { return enrollCourse; });
|
165 |
-
/* harmony import */ var _single_course_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./single-course/index */ "
|
166 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
|
167 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__);
|
168 |
-
/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "
|
169 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "
|
170 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
171 |
|
172 |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -729,10 +729,10 @@ $(window).on('load', function () {
|
|
729 |
|
730 |
/***/ }),
|
731 |
|
732 |
-
/***/ "
|
733 |
-
|
734 |
-
!***
|
735 |
-
|
736 |
/*! exports provided: default */
|
737 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
738 |
|
@@ -742,9 +742,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
742 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
743 |
/* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @learnpress/quiz */ "@learnpress/quiz");
|
744 |
/* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_learnpress_quiz__WEBPACK_IMPORTED_MODULE_1__);
|
745 |
-
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store */ "
|
746 |
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_store__WEBPACK_IMPORTED_MODULE_2__);
|
747 |
-
/* harmony import */ var _single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../single-curriculum/components/sidebar */ "
|
748 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
749 |
|
750 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
@@ -805,10 +805,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
805 |
|
806 |
/***/ }),
|
807 |
|
808 |
-
/***/ "
|
809 |
-
|
810 |
-
!***
|
811 |
-
|
812 |
/*! no static exports found */
|
813 |
/***/ (function(module, exports) {
|
814 |
|
@@ -818,10 +818,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
818 |
|
819 |
/***/ }),
|
820 |
|
821 |
-
/***/ "
|
822 |
-
|
823 |
-
!***
|
824 |
-
|
825 |
/*! exports provided: Sidebar */
|
826 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
827 |
|
@@ -909,10 +909,10 @@ var Sidebar = function Sidebar() {
|
|
909 |
|
910 |
/***/ }),
|
911 |
|
912 |
-
/***/ "
|
913 |
-
|
914 |
-
!***
|
915 |
-
|
916 |
/*! exports provided: default */
|
917 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
918 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/single-course.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js":
|
91 |
+
/*!**********************************************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js ***!
|
93 |
+
\**********************************************************************/
|
94 |
/*! exports provided: default */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
100 |
var $ = jQuery;
|
101 |
|
102 |
var lpModalOverlayCompleteItem = {
|
149 |
|
150 |
/***/ }),
|
151 |
|
152 |
+
/***/ "./assets/src/apps/js/frontend/single-course.js":
|
153 |
+
/*!******************************************************!*\
|
154 |
+
!*** ./assets/src/apps/js/frontend/single-course.js ***!
|
155 |
+
\******************************************************/
|
156 |
/*! exports provided: default, init, initCourseTabs, initCourseSidebar, enrollCourse */
|
157 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
158 |
|
162 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initCourseTabs", function() { return initCourseTabs; });
|
163 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initCourseSidebar", function() { return initCourseSidebar; });
|
164 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enrollCourse", function() { return enrollCourse; });
|
165 |
+
/* harmony import */ var _single_course_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./single-course/index */ "./assets/src/apps/js/frontend/single-course/index.js");
|
166 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
|
167 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__);
|
168 |
+
/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
|
169 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
170 |
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
171 |
|
172 |
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
729 |
|
730 |
/***/ }),
|
731 |
|
732 |
+
/***/ "./assets/src/apps/js/frontend/single-course/index.js":
|
733 |
+
/*!************************************************************!*\
|
734 |
+
!*** ./assets/src/apps/js/frontend/single-course/index.js ***!
|
735 |
+
\************************************************************/
|
736 |
/*! exports provided: default */
|
737 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
738 |
|
742 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
743 |
/* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @learnpress/quiz */ "@learnpress/quiz");
|
744 |
/* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_learnpress_quiz__WEBPACK_IMPORTED_MODULE_1__);
|
745 |
+
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store */ "./assets/src/apps/js/frontend/single-course/store/index.js");
|
746 |
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_store__WEBPACK_IMPORTED_MODULE_2__);
|
747 |
+
/* harmony import */ var _single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../single-curriculum/components/sidebar */ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js");
|
748 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
749 |
|
750 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
805 |
|
806 |
/***/ }),
|
807 |
|
808 |
+
/***/ "./assets/src/apps/js/frontend/single-course/store/index.js":
|
809 |
+
/*!******************************************************************!*\
|
810 |
+
!*** ./assets/src/apps/js/frontend/single-course/store/index.js ***!
|
811 |
+
\******************************************************************/
|
812 |
/*! no static exports found */
|
813 |
/***/ (function(module, exports) {
|
814 |
|
818 |
|
819 |
/***/ }),
|
820 |
|
821 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js":
|
822 |
+
/*!*****************************************************************************!*\
|
823 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js ***!
|
824 |
+
\*****************************************************************************/
|
825 |
/*! exports provided: Sidebar */
|
826 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
827 |
|
909 |
|
910 |
/***/ }),
|
911 |
|
912 |
+
/***/ "./assets/src/apps/js/utils/lp-modal-overlay.js":
|
913 |
+
/*!******************************************************!*\
|
914 |
+
!*** ./assets/src/apps/js/utils/lp-modal-overlay.js ***!
|
915 |
+
\******************************************************/
|
916 |
/*! exports provided: default */
|
917 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
918 |
|
@@ -82,21 +82,21 @@ this["LP"] = this["LP"] || {}; this["LP"]["singleCurriculum"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! exports provided: default */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "
|
100 |
var $ = jQuery;
|
101 |
|
102 |
var lpModalOverlayCompleteItem = {
|
@@ -149,19 +149,19 @@ var lpModalOverlayCompleteItem = {
|
|
149 |
|
150 |
/***/ }),
|
151 |
|
152 |
-
/***/ "
|
153 |
-
|
154 |
-
!***
|
155 |
-
|
156 |
/*! exports provided: default, init */
|
157 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
158 |
|
159 |
"use strict";
|
160 |
__webpack_require__.r(__webpack_exports__);
|
161 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; });
|
162 |
-
/* harmony import */ var _single_curriculum_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./single-curriculum/index */ "
|
163 |
-
/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "
|
164 |
-
/* harmony import */ var _single_curriculum_scrolltoitem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./single-curriculum/scrolltoitem */ "
|
165 |
var $ = jQuery;
|
166 |
|
167 |
|
@@ -178,10 +178,10 @@ document.addEventListener('DOMContentLoaded', function (event) {
|
|
178 |
|
179 |
/***/ }),
|
180 |
|
181 |
-
/***/ "
|
182 |
-
|
183 |
-
!***
|
184 |
-
|
185 |
/*! exports provided: commentForm */
|
186 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
187 |
|
@@ -236,10 +236,10 @@ var commentForm = function commentForm() {
|
|
236 |
|
237 |
/***/ }),
|
238 |
|
239 |
-
/***/ "
|
240 |
-
|
241 |
-
!***
|
242 |
-
|
243 |
/*! no static exports found */
|
244 |
/***/ (function(module, exports) {
|
245 |
|
@@ -328,10 +328,10 @@ LP.Hook.addAction('lp-question-compatible-builder', function () {
|
|
328 |
|
329 |
/***/ }),
|
330 |
|
331 |
-
/***/ "
|
332 |
-
|
333 |
-
!***
|
334 |
-
|
335 |
/*! exports provided: itemsProgress, getResponse */
|
336 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
337 |
|
@@ -341,7 +341,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
341 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getResponse", function() { return getResponse; });
|
342 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
|
343 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__);
|
344 |
-
/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../show-lp-overlay-complete-item */ "
|
345 |
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
346 |
|
347 |
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
@@ -429,10 +429,10 @@ var getResponse = /*#__PURE__*/function () {
|
|
429 |
|
430 |
/***/ }),
|
431 |
|
432 |
-
/***/ "
|
433 |
-
|
434 |
-
!***
|
435 |
-
|
436 |
/*! exports provided: progressBar */
|
437 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
438 |
|
@@ -456,10 +456,10 @@ var progressBar = function progressBar() {
|
|
456 |
|
457 |
/***/ }),
|
458 |
|
459 |
-
/***/ "
|
460 |
-
|
461 |
-
!***
|
462 |
-
|
463 |
/*! exports provided: searchCourseContent */
|
464 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
465 |
|
@@ -547,10 +547,10 @@ var searchCourseContent = function searchCourseContent() {
|
|
547 |
|
548 |
/***/ }),
|
549 |
|
550 |
-
/***/ "
|
551 |
-
|
552 |
-
!***
|
553 |
-
|
554 |
/*! exports provided: Sidebar */
|
555 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
556 |
|
@@ -638,10 +638,10 @@ var Sidebar = function Sidebar() {
|
|
638 |
|
639 |
/***/ }),
|
640 |
|
641 |
-
/***/ "
|
642 |
-
|
643 |
-
!***
|
644 |
-
|
645 |
/*! exports provided: default */
|
646 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
647 |
|
@@ -649,12 +649,12 @@ var Sidebar = function Sidebar() {
|
|
649 |
__webpack_require__.r(__webpack_exports__);
|
650 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
651 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
652 |
-
/* harmony import */ var _components_search__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/search */ "
|
653 |
-
/* harmony import */ var _components_sidebar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/sidebar */ "
|
654 |
-
/* harmony import */ var _components_progress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/progress */ "
|
655 |
-
/* harmony import */ var _components_comment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/comment */ "
|
656 |
-
/* harmony import */ var _components_items_progress__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/items-progress */ "
|
657 |
-
/* harmony import */ var _components_compatible__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/compatible */ "
|
658 |
/* harmony import */ var _components_compatible__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_components_compatible__WEBPACK_IMPORTED_MODULE_6__);
|
659 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
660 |
|
@@ -740,16 +740,16 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
740 |
|
741 |
/***/ }),
|
742 |
|
743 |
-
/***/ "
|
744 |
-
|
745 |
-
!***
|
746 |
-
|
747 |
/*! exports provided: default */
|
748 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
749 |
|
750 |
"use strict";
|
751 |
__webpack_require__.r(__webpack_exports__);
|
752 |
-
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/lp-modal-overlay */ "
|
753 |
|
754 |
var $ = jQuery;
|
755 |
var scrollToItemCurrent = {
|
@@ -795,10 +795,10 @@ var scrollToItemCurrent = {
|
|
795 |
|
796 |
/***/ }),
|
797 |
|
798 |
-
/***/ "
|
799 |
-
|
800 |
-
!***
|
801 |
-
|
802 |
/*! exports provided: default */
|
803 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
804 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/single-curriculum.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js":
|
91 |
+
/*!**********************************************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js ***!
|
93 |
+
\**********************************************************************/
|
94 |
/*! exports provided: default */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
97 |
"use strict";
|
98 |
__webpack_require__.r(__webpack_exports__);
|
99 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
100 |
var $ = jQuery;
|
101 |
|
102 |
var lpModalOverlayCompleteItem = {
|
149 |
|
150 |
/***/ }),
|
151 |
|
152 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum.js":
|
153 |
+
/*!**********************************************************!*\
|
154 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum.js ***!
|
155 |
+
\**********************************************************/
|
156 |
/*! exports provided: default, init */
|
157 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
158 |
|
159 |
"use strict";
|
160 |
__webpack_require__.r(__webpack_exports__);
|
161 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; });
|
162 |
+
/* harmony import */ var _single_curriculum_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./single-curriculum/index */ "./assets/src/apps/js/frontend/single-curriculum/index.js");
|
163 |
+
/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
|
164 |
+
/* harmony import */ var _single_curriculum_scrolltoitem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./single-curriculum/scrolltoitem */ "./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js");
|
165 |
var $ = jQuery;
|
166 |
|
167 |
|
178 |
|
179 |
/***/ }),
|
180 |
|
181 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/comment.js":
|
182 |
+
/*!*****************************************************************************!*\
|
183 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/comment.js ***!
|
184 |
+
\*****************************************************************************/
|
185 |
/*! exports provided: commentForm */
|
186 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
187 |
|
236 |
|
237 |
/***/ }),
|
238 |
|
239 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/compatible.js":
|
240 |
+
/*!********************************************************************************!*\
|
241 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/compatible.js ***!
|
242 |
+
\********************************************************************************/
|
243 |
/*! no static exports found */
|
244 |
/***/ (function(module, exports) {
|
245 |
|
328 |
|
329 |
/***/ }),
|
330 |
|
331 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/items-progress.js":
|
332 |
+
/*!************************************************************************************!*\
|
333 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/items-progress.js ***!
|
334 |
+
\************************************************************************************/
|
335 |
/*! exports provided: itemsProgress, getResponse */
|
336 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
337 |
|
341 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getResponse", function() { return getResponse; });
|
342 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
|
343 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__);
|
344 |
+
/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../show-lp-overlay-complete-item */ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
|
345 |
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
346 |
|
347 |
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
429 |
|
430 |
/***/ }),
|
431 |
|
432 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/progress.js":
|
433 |
+
/*!******************************************************************************!*\
|
434 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/progress.js ***!
|
435 |
+
\******************************************************************************/
|
436 |
/*! exports provided: progressBar */
|
437 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
438 |
|
456 |
|
457 |
/***/ }),
|
458 |
|
459 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/search.js":
|
460 |
+
/*!****************************************************************************!*\
|
461 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/search.js ***!
|
462 |
+
\****************************************************************************/
|
463 |
/*! exports provided: searchCourseContent */
|
464 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
465 |
|
547 |
|
548 |
/***/ }),
|
549 |
|
550 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js":
|
551 |
+
/*!*****************************************************************************!*\
|
552 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js ***!
|
553 |
+
\*****************************************************************************/
|
554 |
/*! exports provided: Sidebar */
|
555 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
556 |
|
638 |
|
639 |
/***/ }),
|
640 |
|
641 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/index.js":
|
642 |
+
/*!****************************************************************!*\
|
643 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/index.js ***!
|
644 |
+
\****************************************************************/
|
645 |
/*! exports provided: default */
|
646 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
647 |
|
649 |
__webpack_require__.r(__webpack_exports__);
|
650 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
651 |
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
652 |
+
/* harmony import */ var _components_search__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/search */ "./assets/src/apps/js/frontend/single-curriculum/components/search.js");
|
653 |
+
/* harmony import */ var _components_sidebar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/sidebar */ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js");
|
654 |
+
/* harmony import */ var _components_progress__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/progress */ "./assets/src/apps/js/frontend/single-curriculum/components/progress.js");
|
655 |
+
/* harmony import */ var _components_comment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/comment */ "./assets/src/apps/js/frontend/single-curriculum/components/comment.js");
|
656 |
+
/* harmony import */ var _components_items_progress__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/items-progress */ "./assets/src/apps/js/frontend/single-curriculum/components/items-progress.js");
|
657 |
+
/* harmony import */ var _components_compatible__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/compatible */ "./assets/src/apps/js/frontend/single-curriculum/components/compatible.js");
|
658 |
/* harmony import */ var _components_compatible__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_components_compatible__WEBPACK_IMPORTED_MODULE_6__);
|
659 |
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
660 |
|
740 |
|
741 |
/***/ }),
|
742 |
|
743 |
+
/***/ "./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js":
|
744 |
+
/*!***********************************************************************!*\
|
745 |
+
!*** ./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js ***!
|
746 |
+
\***********************************************************************/
|
747 |
/*! exports provided: default */
|
748 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
749 |
|
750 |
"use strict";
|
751 |
__webpack_require__.r(__webpack_exports__);
|
752 |
+
/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js");
|
753 |
|
754 |
var $ = jQuery;
|
755 |
var scrollToItemCurrent = {
|
795 |
|
796 |
/***/ }),
|
797 |
|
798 |
+
/***/ "./assets/src/apps/js/utils/lp-modal-overlay.js":
|
799 |
+
/*!******************************************************!*\
|
800 |
+
!*** ./assets/src/apps/js/utils/lp-modal-overlay.js ***!
|
801 |
+
\******************************************************/
|
802 |
/*! exports provided: default */
|
803 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
804 |
|
@@ -82,15 +82,15 @@ this["LP"] = this["LP"] || {}; this["LP"]["widgets"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! no exports provided */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/frontend/widgets.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/frontend/widgets.js":
|
91 |
+
/*!************************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/frontend/widgets.js ***!
|
93 |
+
\************************************************/
|
94 |
/*! no exports provided */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
@@ -82,15 +82,15 @@ this["LP"] = this["LP"] || {}; this["LP"]["dataControls"] =
|
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
-
/***/ "
|
91 |
-
|
92 |
-
!***
|
93 |
-
|
94 |
/*! exports provided: apiFetch, select, dispatch, controls */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
82 |
/******/
|
83 |
/******/
|
84 |
/******/ // Load entry module and return exports
|
85 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/apps/js/data-controls.js");
|
86 |
/******/ })
|
87 |
/************************************************************************/
|
88 |
/******/ ({
|
89 |
|
90 |
+
/***/ "./assets/src/apps/js/data-controls.js":
|
91 |
+
/*!*********************************************!*\
|
92 |
+
!*** ./assets/src/apps/js/data-controls.js ***!
|
93 |
+
\*********************************************/
|
94 |
/*! exports provided: apiFetch, select, dispatch, controls */
|
95 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
96 |
|
@@ -81,15 +81,15 @@
|
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
-
/******/ return __webpack_require__(__webpack_require__.s = "
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
-
/***/ "
|
90 |
-
|
91 |
-
!***
|
92 |
-
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
@@ -157,10 +157,10 @@ var Cookies = {
|
|
157 |
|
158 |
/***/ }),
|
159 |
|
160 |
-
/***/ "
|
161 |
-
|
162 |
-
!***
|
163 |
-
|
164 |
/*! exports provided: default */
|
165 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
166 |
|
@@ -276,10 +276,10 @@ var Event_Callback = function Event_Callback(self) {
|
|
276 |
|
277 |
/***/ }),
|
278 |
|
279 |
-
/***/ "
|
280 |
-
|
281 |
-
!***
|
282 |
-
|
283 |
/*! exports provided: default */
|
284 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
285 |
|
@@ -298,10 +298,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
298 |
|
299 |
/***/ }),
|
300 |
|
301 |
-
/***/ "
|
302 |
-
|
303 |
-
!***
|
304 |
-
|
305 |
/*! exports provided: default */
|
306 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
307 |
|
@@ -346,10 +346,10 @@ var exp;
|
|
346 |
|
347 |
/***/ }),
|
348 |
|
349 |
-
/***/ "
|
350 |
-
|
351 |
-
!***
|
352 |
-
|
353 |
/*! exports provided: default */
|
354 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
355 |
|
@@ -449,10 +449,10 @@ var Hook = {
|
|
449 |
|
450 |
/***/ }),
|
451 |
|
452 |
-
/***/ "
|
453 |
-
|
454 |
-
!***
|
455 |
-
|
456 |
/*! exports provided: default */
|
457 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
458 |
|
@@ -485,27 +485,27 @@ var IframeSubmit = function IframeSubmit(form) {
|
|
485 |
|
486 |
/***/ }),
|
487 |
|
488 |
-
/***/ "
|
489 |
-
|
490 |
-
!***
|
491 |
-
|
492 |
/*! exports provided: default */
|
493 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
494 |
|
495 |
"use strict";
|
496 |
__webpack_require__.r(__webpack_exports__);
|
497 |
-
/* harmony import */ var _extend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extend */ "
|
498 |
-
/* harmony import */ var _fn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fn */ "
|
499 |
-
/* harmony import */ var _quick_tip__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./quick-tip */ "
|
500 |
/* harmony import */ var _quick_tip__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_quick_tip__WEBPACK_IMPORTED_MODULE_2__);
|
501 |
-
/* harmony import */ var _message_box__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message-box */ "
|
502 |
-
/* harmony import */ var _event_callback__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./event-callback */ "
|
503 |
-
/* harmony import */ var _hook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hook */ "
|
504 |
-
/* harmony import */ var _cookies__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cookies */ "
|
505 |
-
/* harmony import */ var _local_storage__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./local-storage */ "
|
506 |
-
/* harmony import */ var _jquery_plugins__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./jquery.plugins */ "
|
507 |
-
/* harmony import */ var _iframe_submit__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./iframe-submit */ "
|
508 |
-
/* harmony import */ var _show_password__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./show-password */ "
|
509 |
/* harmony import */ var _show_password__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_show_password__WEBPACK_IMPORTED_MODULE_10__);
|
510 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
511 |
|
@@ -1122,10 +1122,10 @@ Object(_extend__WEBPACK_IMPORTED_MODULE_0__["default"])(_objectSpread({
|
|
1122 |
|
1123 |
/***/ }),
|
1124 |
|
1125 |
-
/***/ "
|
1126 |
-
|
1127 |
-
!***
|
1128 |
-
|
1129 |
/*! exports provided: default */
|
1130 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1131 |
|
@@ -1357,10 +1357,10 @@ $.fn.progress = progress;
|
|
1357 |
|
1358 |
/***/ }),
|
1359 |
|
1360 |
-
/***/ "
|
1361 |
-
|
1362 |
-
!***
|
1363 |
-
|
1364 |
/*! exports provided: default */
|
1365 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1366 |
|
@@ -1407,10 +1407,10 @@ var _localStorage = {
|
|
1407 |
|
1408 |
/***/ }),
|
1409 |
|
1410 |
-
/***/ "
|
1411 |
-
|
1412 |
-
!***
|
1413 |
-
|
1414 |
/*! exports provided: default */
|
1415 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1416 |
|
@@ -1686,10 +1686,10 @@ var MessageBox = {
|
|
1686 |
|
1687 |
/***/ }),
|
1688 |
|
1689 |
-
/***/ "
|
1690 |
-
|
1691 |
-
!***
|
1692 |
-
|
1693 |
/*! no static exports found */
|
1694 |
/***/ (function(module, exports) {
|
1695 |
|
@@ -1823,10 +1823,10 @@ var MessageBox = {
|
|
1823 |
|
1824 |
/***/ }),
|
1825 |
|
1826 |
-
/***/ "
|
1827 |
-
|
1828 |
-
!***
|
1829 |
-
|
1830 |
/*! no static exports found */
|
1831 |
/***/ (function(module, exports) {
|
1832 |
|
81 |
/******/
|
82 |
/******/
|
83 |
/******/ // Load entry module and return exports
|
84 |
+
/******/ return __webpack_require__(__webpack_require__.s = "./assets/src/js/utils/index.js");
|
85 |
/******/ })
|
86 |
/************************************************************************/
|
87 |
/******/ ({
|
88 |
|
89 |
+
/***/ "./assets/src/js/utils/cookies.js":
|
90 |
+
/*!****************************************!*\
|
91 |
+
!*** ./assets/src/js/utils/cookies.js ***!
|
92 |
+
\****************************************/
|
93 |
/*! exports provided: default */
|
94 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
95 |
|
157 |
|
158 |
/***/ }),
|
159 |
|
160 |
+
/***/ "./assets/src/js/utils/event-callback.js":
|
161 |
+
/*!***********************************************!*\
|
162 |
+
!*** ./assets/src/js/utils/event-callback.js ***!
|
163 |
+
\***********************************************/
|
164 |
/*! exports provided: default */
|
165 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
166 |
|
276 |
|
277 |
/***/ }),
|
278 |
|
279 |
+
/***/ "./assets/src/js/utils/extend.js":
|
280 |
+
/*!***************************************!*\
|
281 |
+
!*** ./assets/src/js/utils/extend.js ***!
|
282 |
+
\***************************************/
|
283 |
/*! exports provided: default */
|
284 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
285 |
|
298 |
|
299 |
/***/ }),
|
300 |
|
301 |
+
/***/ "./assets/src/js/utils/fn.js":
|
302 |
+
/*!***********************************!*\
|
303 |
+
!*** ./assets/src/js/utils/fn.js ***!
|
304 |
+
\***********************************/
|
305 |
/*! exports provided: default */
|
306 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
307 |
|
346 |
|
347 |
/***/ }),
|
348 |
|
349 |
+
/***/ "./assets/src/js/utils/hook.js":
|
350 |
+
/*!*************************************!*\
|
351 |
+
!*** ./assets/src/js/utils/hook.js ***!
|
352 |
+
\*************************************/
|
353 |
/*! exports provided: default */
|
354 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
355 |
|
449 |
|
450 |
/***/ }),
|
451 |
|
452 |
+
/***/ "./assets/src/js/utils/iframe-submit.js":
|
453 |
+
/*!**********************************************!*\
|
454 |
+
!*** ./assets/src/js/utils/iframe-submit.js ***!
|
455 |
+
\**********************************************/
|
456 |
/*! exports provided: default */
|
457 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
458 |
|
485 |
|
486 |
/***/ }),
|
487 |
|
488 |
+
/***/ "./assets/src/js/utils/index.js":
|
489 |
+
/*!**************************************!*\
|
490 |
+
!*** ./assets/src/js/utils/index.js ***!
|
491 |
+
\**************************************/
|
492 |
/*! exports provided: default */
|
493 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
494 |
|
495 |
"use strict";
|
496 |
__webpack_require__.r(__webpack_exports__);
|
497 |
+
/* harmony import */ var _extend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extend */ "./assets/src/js/utils/extend.js");
|
498 |
+
/* harmony import */ var _fn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fn */ "./assets/src/js/utils/fn.js");
|
499 |
+
/* harmony import */ var _quick_tip__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./quick-tip */ "./assets/src/js/utils/quick-tip.js");
|
500 |
/* harmony import */ var _quick_tip__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_quick_tip__WEBPACK_IMPORTED_MODULE_2__);
|
501 |
+
/* harmony import */ var _message_box__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./message-box */ "./assets/src/js/utils/message-box.js");
|
502 |
+
/* harmony import */ var _event_callback__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./event-callback */ "./assets/src/js/utils/event-callback.js");
|
503 |
+
/* harmony import */ var _hook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hook */ "./assets/src/js/utils/hook.js");
|
504 |
+
/* harmony import */ var _cookies__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./cookies */ "./assets/src/js/utils/cookies.js");
|
505 |
+
/* harmony import */ var _local_storage__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./local-storage */ "./assets/src/js/utils/local-storage.js");
|
506 |
+
/* harmony import */ var _jquery_plugins__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./jquery.plugins */ "./assets/src/js/utils/jquery.plugins.js");
|
507 |
+
/* harmony import */ var _iframe_submit__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./iframe-submit */ "./assets/src/js/utils/iframe-submit.js");
|
508 |
+
/* harmony import */ var _show_password__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./show-password */ "./assets/src/js/utils/show-password.js");
|
509 |
/* harmony import */ var _show_password__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_show_password__WEBPACK_IMPORTED_MODULE_10__);
|
510 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
511 |
|
1122 |
|
1123 |
/***/ }),
|
1124 |
|
1125 |
+
/***/ "./assets/src/js/utils/jquery.plugins.js":
|
1126 |
+
/*!***********************************************!*\
|
1127 |
+
!*** ./assets/src/js/utils/jquery.plugins.js ***!
|
1128 |
+
\***********************************************/
|
1129 |
/*! exports provided: default */
|
1130 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1131 |
|
1357 |
|
1358 |
/***/ }),
|
1359 |
|
1360 |
+
/***/ "./assets/src/js/utils/local-storage.js":
|
1361 |
+
/*!**********************************************!*\
|
1362 |
+
!*** ./assets/src/js/utils/local-storage.js ***!
|
1363 |
+
\**********************************************/
|
1364 |
/*! exports provided: default */
|
1365 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1366 |
|
1407 |
|
1408 |
/***/ }),
|
1409 |
|
1410 |
+
/***/ "./assets/src/js/utils/message-box.js":
|
1411 |
+
/*!********************************************!*\
|
1412 |
+
!*** ./assets/src/js/utils/message-box.js ***!
|
1413 |
+
\********************************************/
|
1414 |
/*! exports provided: default */
|
1415 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
1416 |
|
1686 |
|
1687 |
/***/ }),
|
1688 |
|
1689 |
+
/***/ "./assets/src/js/utils/quick-tip.js":
|
1690 |
+
/*!******************************************!*\
|
1691 |
+
!*** ./assets/src/js/utils/quick-tip.js ***!
|
1692 |
+
\******************************************/
|
1693 |
/*! no static exports found */
|
1694 |
/***/ (function(module, exports) {
|
1695 |
|
1823 |
|
1824 |
/***/ }),
|
1825 |
|
1826 |
+
/***/ "./assets/src/js/utils/show-password.js":
|
1827 |
+
/*!**********************************************!*\
|
1828 |
+
!*** ./assets/src/js/utils/show-password.js ***!
|
1829 |
+
\**********************************************/
|
1830 |
/*! no static exports found */
|
1831 |
/***/ (function(module, exports) {
|
1832 |
|
@@ -1 +1 @@
|
|
1 |
-
!function(e){"use strict";const t=function(e){this.view=new t.View({model:new t.Model(e)})};t.View=Backbone.View.extend({events:{"click #lp-remove-upload-photo":"_removePhoto","click #lp-upload-photo":"_upload","click .lp-cancel-upload":"_cancel","click .lp-save-upload":"_save"},el:"#lp-user-edit-avatar",uploader:null,initialize(){_.bindAll(this,"filesAdded","uploadProgress","uploadError","fileUploaded","crop"),this._getUploader()},_save(t){t.preventDefault();const a=this;e.ajax({url:"?lp-ajax=save-uploaded-user-avatar",data:this.$(".lp-avatar-crop-image").serializeJSON(),type:"post",success(t){(t=LP.parseJSON(t)).success&&(a.$(".lp-avatar-crop-image").remove(),e(".lp-user-profile-avatar").html(t.avatar),a.$().attr("data-custom","yes"),a.$(".profile-picture").toggleClass("profile-avatar-current").filter(".profile-avatar-current").html(t.avatar))}})},$(t){return t?e(this.$el).find(t):e(this.$el)},_removePhoto(t){t.preventDefault(),confirm("Are you sure?")&&(this.$().removeAttr("data-custom"),this.$(".profile-picture").toggleClass("profile-avatar-current"),this.$("#submit").prop("disabled",!1),e(".lp-user-profile-avatar").html(this.$(".profile-avatar-current").find("img").clone()))},_upload(e){e.preventDefault()},_cancel(e){e.preventDefault(),this.$crop&&this.$crop.remove(),this.$(".lp-avatar-preview").removeClass("croping")},filesAdded(e,t){e.files.splice(0,e.files.length-1),this.$(".lp-avatar-preview").addClass("uploading"),this.$(".lp-avatar-upload-progress-value").width(0),this.uploader.start()},uploadProgress(e,t){this.$(".lp-avatar-upload-progress-value").css("width",t.percent+"%")},uploadError(e,t){this.$(".lp-avatar-preview").addClass("upload-error").removeClass("uploading"),this.$(".lp-avatar-upload-error").html(t)},fileUploaded(t,a,i){this.$(".lp-avatar-preview").removeClass("upload-error").removeClass("uploading");const r=this,s=LP.parseJSON(i.response);s.url&&(this.avatar=s.url,e("<img/>").attr("src",s.url).load(
|
1 |
+
!function(e){"use strict";const t=function(e){this.view=new t.View({model:new t.Model(e)})};t.View=Backbone.View.extend({events:{"click #lp-remove-upload-photo":"_removePhoto","click #lp-upload-photo":"_upload","click .lp-cancel-upload":"_cancel","click .lp-save-upload":"_save"},el:"#lp-user-edit-avatar",uploader:null,initialize(){_.bindAll(this,"filesAdded","uploadProgress","uploadError","fileUploaded","crop"),this._getUploader()},_save(t){t.preventDefault();const a=this;e.ajax({url:"?lp-ajax=save-uploaded-user-avatar",data:this.$(".lp-avatar-crop-image").serializeJSON(),type:"post",success(t){(t=LP.parseJSON(t)).success&&(a.$(".lp-avatar-crop-image").remove(),e(".lp-user-profile-avatar").html(t.avatar),a.$().attr("data-custom","yes"),a.$(".profile-picture").toggleClass("profile-avatar-current").filter(".profile-avatar-current").html(t.avatar))}})},$(t){return t?e(this.$el).find(t):e(this.$el)},_removePhoto(t){t.preventDefault(),confirm("Are you sure?")&&(this.$().removeAttr("data-custom"),this.$(".profile-picture").toggleClass("profile-avatar-current"),this.$("#submit").prop("disabled",!1),e(".lp-user-profile-avatar").html(this.$(".profile-avatar-current").find("img").clone()))},_upload(e){e.preventDefault()},_cancel(e){e.preventDefault(),this.$crop&&this.$crop.remove(),this.$(".lp-avatar-preview").removeClass("croping")},filesAdded(e,t){e.files.splice(0,e.files.length-1),this.$(".lp-avatar-preview").addClass("uploading"),this.$(".lp-avatar-upload-progress-value").width(0),this.uploader.start()},uploadProgress(e,t){this.$(".lp-avatar-upload-progress-value").css("width",t.percent+"%")},uploadError(e,t){this.$(".lp-avatar-preview").addClass("upload-error").removeClass("uploading"),this.$(".lp-avatar-upload-error").html(t)},fileUploaded(t,a,i){this.$(".lp-avatar-preview").removeClass("upload-error").removeClass("uploading");const r=this,s=LP.parseJSON(i.response);s.url&&(this.avatar=s.url,e("<img/>").attr("src",s.url).on("load",(function(){r.model.set(e.extend(s,{width:this.width,height:this.height})),r.crop()})))},crop(){this.model.set("r",Math.random()),new t.Crop(this),this.$("#submit").prop("disabled",!1)},_getUploader(){return this.uploader||(this.uploader=new plupload.Uploader({runtimes:"html5,flash,silverlight,html4",browse_button:"lp-upload-photo",container:e("#lp-user-edit-avatar").get(0),url:("undefined"!=typeof lpGlobalSettings?lpGlobalSettings.ajax:"").addQueryVar("action","learnpress_upload-user-avatar"),filters:{max_file_size:"10mb",mime_types:[{title:"Image",extensions:"png,jpg,bmp,gif"}]},file_data_name:"lp-upload-avatar",init:{PostInit(){},FilesAdded:this.filesAdded,UploadProgress:this.uploadProgress,FileUploaded:this.fileUploaded,Error:this.uploadError}}),this.uploader.init()),this.uploader}}),t.Model=Backbone.Model.extend({}),t.Crop=function(t){const a=this,i=t.model.toJSON(),r=e(LP.template("tmpl-crop-user-avatar")(i));r.appendTo(t.$("#profile-avatar-uploader")),t.$crop=r;let s=r.find("img"),o=0,l=0,d=0,n=0,p=0,h=0;this.initCrop=function(){i.viewWidth/i.viewHeight>=i.width/i.height?(o=i.viewWidth,l=i.height*i.viewWidth/i.width,d=0,n=-(l-i.viewHeight)/2):(l=i.viewHeight,o=i.width*i.viewHeight/i.height,n=0,d=-(o-i.viewWidth)/2),p=o,h=l,s.draggable({drag(t,a){a.position.left>0&&(a.position.left=0),a.position.top>0&&(a.position.top=0);const r=i.viewWidth-p,s=i.viewHeight-h;r>a.position.left&&(a.position.left=r),s>a.position.top&&(a.position.top=s),e(document.body).addClass("profile-dragging")},stop(r,o){d=parseInt(s.css("left")),n=parseInt(s.css("top")),t=(Math.abs(d)+i.viewWidth/2)/p,c=(Math.abs(n)+i.viewHeight/2)/h,a.update({width:p,height:h,top:n,left:d}),e(document.body).removeClass("profile-dragging")}});var t=(Math.abs(d)+i.viewWidth/2)/o,c=(Math.abs(n)+i.viewHeight/2)/l;r.find(".lp-zoom > div").slider({create(){a.update({width:o,height:l,top:n,left:d})},slide(r,s){p=o+s.value/100*i.width*2,h=l+s.value/100*i.height*2;let u=i.viewWidth/2-p*t,f=i.viewHeight/2-h*c;u>0&&(u=0),f>0&&(f=0);const v=parseInt(i.viewWidth-p),g=parseInt(i.viewHeight-h);v>u&&(u=d=v),g>f&&(f=n=g),a.update({width:p,height:h,top:f,left:u}),e(document.body).addClass("profile-resizing"),console.log(s.value,i)},stop(){e(document.body).removeClass("profile-resizing")}})},this.update=function(t){s.css({width:t.width,height:t.height,top:t.top,left:t.left});const a=t.width/i.width,o=parseInt(Math.abs(t.left/a)),l=parseInt(Math.abs(t.top/a)),d=o+parseInt(i.viewWidth/a),n=l+parseInt(i.viewHeight/a),p=e.extend(t,{width:i.viewWidth,height:i.viewHeight,r:a,points:[o,l,d,n].join(",")});r.find('input[name^="lp-user-avatar-crop"]').each((function(){const t=e(this),a=t.data("name");"name"!=a&&void 0!==p[a]&&t.val(p[a])}))},this.initCrop()},e(document).on("submit","#learn-press-form-login",(function(t){const a=e(this),i=a.serialize();return a.find(".learn-press-error, .learn-press-notice, .learn-press-message").fadeOut(),a.find("input").attr("disabled",!0),LP.doAjax({data:{"lp-ajax":"login",data:i},success(t,i){LP.showMessages(t.message,a,"LOGIN_ERROR"),"error"==t.result&&(a.find("input").attr("disabled",!1),e('#learn-press-form-login input[type="text"]').trigger("focus")),t.redirect&&LP.reload(t.redirect)},error(){LP.showMessages("",a,"LOGIN_ERROR"),a.find("input").attr("disabled",!1),e('#learn-press-form-login input[type="text"]').trigger("focus")}}),!1})),e(document).on("click",".table-orders .cancel-order",(function(t){t.preventDefault();const a=e(this).attr("href");return LP.alert(learn_press_js_localize.confirm_cancel_order,(function(e){e&&(window.location.href=a)})),!1})),e(document).ready((function(){let i=e("#lp-user-profile-form form"),r=i.serialize(),s=null,o=i.find("#lp-profile-edit-password-form");function l(){i.find("#submit").prop("disabled",!(i.serialize()!=r))}0==o.length?i.on("keyup change","input, textarea, select",(function(){s&&clearTimeout(s),s=setTimeout(l,300)})):o.on("change keyup","input",(function(t){e(t.target).attr("name");const a=i.find("#pass0"),r=i.find("#pass1"),s=i.find("#pass2"),o=!((r.val()||s.val())&&r.val()!=s.val());i.find("#lp-password-not-match").toggleClass("hide-if-js",o),i.find("#submit").prop("disabled",!(o&&a.val()&&r.val()&&s.val()))}));const d={};"undefined"!=typeof lpProfileUserSettings&&(d.viewWidth=parseInt(lpProfileUserSettings.avatar_size.width),d.viewHeight=parseInt(lpProfileUserSettings.avatar_size.height)),new t(d),a.recoverOrder()})).on("click",".btn-load-more-courses",(function(t){const a=e(this);let i=a.data("paged")||1;const r=a.data("pages")||1,s=a.data("container"),o=e("#"+s);let l=a.data("url");if(i++,a.data("paged",i).prop("disabled",!0).removeClass("btn-ajax-off").addClass("btn-ajax-on"),l)l=l.addQueryVar("current_page",i);else{const e=window.location.href.split("?");l=e[0].match(/\/([0-9]+)\//)?e[0].replace(/\/([0-9]+)\//,i):e[0]+i,e[1]&&(l+="?"+e[1])}e.ajax({url:l,data:a.data("args"),success(t){o.append(e(t).find("#"+s).children()),i>=r?a.remove():a.prop("disabled",!1).removeClass("btn-ajax-on").addClass("btn-ajax-off")}})}));const a={recoverOrder(t){const a=e(".order-recover"),i=a.find(".button-recover-order");a.find('input[name="order-key"]');i.on("click",()=>{a.find(".learn-press-message").remove(),e(".profile-recover-order").find(".learn-press-message").remove(),e.post({url:"",data:a.serializeJSON(),beforeSend(){i.addClass("loading").attr("disabled","disabled")},success(t){if((t=LP.parseJSON(t)).message){const i=e('<div class="learn-press-message icon"><i class="fa"></i> '+t.message+"</div>");"error"==t.result&&i.addClass("error"),a.before(i)}t.redirect&&(window.location.href=t.redirect),i.removeClass("loading").removeAttr("disabled","")},error(){i.removeClass("loading").removeAttr("disabled","")}})})}}}(jQuery);
|
@@ -6,6 +6,47 @@ const { modal: { default: Modal } } = LP;
|
|
6 |
export default Quiz;
|
7 |
|
8 |
export const init = ( elem, settings ) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
wp.element.render(
|
10 |
<Modal><Quiz settings={ settings } /></Modal>,
|
11 |
[ ...document.querySelectorAll( elem ) ][ 0 ]
|
6 |
export default Quiz;
|
7 |
|
8 |
export const init = ( elem, settings ) => {
|
9 |
+
// For no require enroll
|
10 |
+
if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
11 |
+
const keyQuizOff = 'quiz_off_' + lpQuizSettings.id;
|
12 |
+
const quizDataOffStr = window.localStorage.getItem( keyQuizOff );
|
13 |
+
|
14 |
+
if ( null !== quizDataOffStr ) {
|
15 |
+
const quizDataOff = JSON.parse( quizDataOffStr );
|
16 |
+
settings.status = quizDataOff.status;
|
17 |
+
|
18 |
+
if ( 'started' === quizDataOff.status ) {
|
19 |
+
const now = Date.now();
|
20 |
+
|
21 |
+
settings.total_time = Math.floor(( quizDataOff.endTime - now ) / 1000);
|
22 |
+
} else if ( 'completed' === quizDataOff.status ) {
|
23 |
+
settings.results = quizDataOff.results;
|
24 |
+
settings.answered = quizDataOff.results.answered;
|
25 |
+
settings.questions = quizDataOff.results.questions;
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( undefined !== quizDataOff.checked_questions ) {
|
29 |
+
settings.checked_questions = quizDataOff.checked_questions;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( undefined !== quizDataOff.question_options ) {
|
33 |
+
//settings.checked_questions = quizDataOff.checked_questions;
|
34 |
+
|
35 |
+
for ( const i in settings.questions ) {
|
36 |
+
let question = settings.questions[ i ];
|
37 |
+
|
38 |
+
if ( undefined !== quizDataOff.question_options[ question.id ] ) {
|
39 |
+
question.options = quizDataOff.question_options[ question.id ];
|
40 |
+
}
|
41 |
+
|
42 |
+
settings.questions[ i ] = question;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
//console.log(settings);
|
49 |
+
|
50 |
wp.element.render(
|
51 |
<Modal><Quiz settings={ settings } /></Modal>,
|
52 |
[ ...document.querySelectorAll( elem ) ][ 0 ]
|
@@ -19,7 +19,7 @@ const Attempts = () => {
|
|
19 |
<thead>
|
20 |
<tr>
|
21 |
<th className="quiz-attempts__questions">{ __( 'Questions', 'learnpress' ) }</th>
|
22 |
-
<th className="quiz-attempts__spend">{ __( 'Time
|
23 |
<th className="quiz-attempts__marks">{ __( 'Marks', 'learnpress' ) }</th>
|
24 |
<th className="quiz-attempts__grade">{ __( 'Passing grade', 'learnpress' ) }</th>
|
25 |
<th className="quiz-attempts__result">{ __( 'Result', 'learnpress' ) }</th>
|
@@ -28,13 +28,13 @@ const Attempts = () => {
|
|
28 |
<tbody>
|
29 |
{ attempts.map( ( row, key ) => {
|
30 |
// Re-write value to attempts.timeSpend
|
31 |
-
if ( lpQuizSettings.checkNorequizenroll
|
32 |
const timespendStart = window.localStorage.getItem( 'quiz_start_' + lpQuizSettings.id ),
|
33 |
timespendEnd = window.localStorage.getItem( 'quiz_end_' + lpQuizSettings.id );
|
34 |
if ( timespendStart && timespendEnd ) {
|
35 |
row.timeSpend = timeDifference( timespendStart, timespendEnd ).duration;
|
36 |
}
|
37 |
-
}
|
38 |
return (
|
39 |
<tr key={ `attempt-${ key }` }>
|
40 |
<td className="quiz-attempts__questions">{ `${ row.questionCorrect } / ${ row.questionCount }` }</td>
|
19 |
<thead>
|
20 |
<tr>
|
21 |
<th className="quiz-attempts__questions">{ __( 'Questions', 'learnpress' ) }</th>
|
22 |
+
<th className="quiz-attempts__spend">{ __( 'Time spent', 'learnpress' ) }</th>
|
23 |
<th className="quiz-attempts__marks">{ __( 'Marks', 'learnpress' ) }</th>
|
24 |
<th className="quiz-attempts__grade">{ __( 'Passing grade', 'learnpress' ) }</th>
|
25 |
<th className="quiz-attempts__result">{ __( 'Result', 'learnpress' ) }</th>
|
28 |
<tbody>
|
29 |
{ attempts.map( ( row, key ) => {
|
30 |
// Re-write value to attempts.timeSpend
|
31 |
+
/*if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
32 |
const timespendStart = window.localStorage.getItem( 'quiz_start_' + lpQuizSettings.id ),
|
33 |
timespendEnd = window.localStorage.getItem( 'quiz_end_' + lpQuizSettings.id );
|
34 |
if ( timespendStart && timespendEnd ) {
|
35 |
row.timeSpend = timeDifference( timespendStart, timespendEnd ).duration;
|
36 |
}
|
37 |
+
}*/
|
38 |
return (
|
39 |
<tr key={ `attempt-${ key }` }>
|
40 |
<td className="quiz-attempts__questions">{ `${ row.questionCorrect } / ${ row.questionCount }` }</td>
|
@@ -18,10 +18,14 @@ class Buttons extends Component {
|
|
18 |
return;
|
19 |
}
|
20 |
}
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
window.localStorage.removeItem( 'quiz_start_' + lpQuizSettings.id );
|
|
|
24 |
window.localStorage.setItem( 'quiz_start_' + lpQuizSettings.id, Date.now() );
|
|
|
25 |
// Set retake to local.storage
|
26 |
const retakenNumber = window.localStorage.getItem( 'quiz_retake_' + lpQuizSettings.id );
|
27 |
if ( retakenNumber >= 1 ) {
|
@@ -29,9 +33,8 @@ class Buttons extends Component {
|
|
29 |
} else {
|
30 |
window.localStorage.setItem( 'quiz_retake_' + lpQuizSettings.id, 1 );
|
31 |
}
|
32 |
-
|
33 |
-
|
34 |
-
}
|
35 |
startQuiz();
|
36 |
};
|
37 |
|
@@ -411,8 +414,9 @@ export default compose( [
|
|
411 |
data.question = getCurrentQuestion( 'object' );
|
412 |
}
|
413 |
|
414 |
-
if ( lpQuizSettings.checkNorequizenroll
|
415 |
-
const retakenCurrent = window.localStorage.getItem( '
|
|
|
416 |
if ( getData( 'retakeCount' ) > retakenCurrent ) {
|
417 |
data.retakeNumber = getData( 'retakeCount' ) - retakenCurrent;
|
418 |
data.canRetry = true;
|
18 |
return;
|
19 |
}
|
20 |
}
|
21 |
+
|
22 |
+
// No require enroll
|
23 |
+
/*if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
24 |
+
// Reset data
|
25 |
window.localStorage.removeItem( 'quiz_start_' + lpQuizSettings.id );
|
26 |
+
window.localStorage.removeItem( 'quiz_userdata_' + lpQuizSettings.id );
|
27 |
window.localStorage.setItem( 'quiz_start_' + lpQuizSettings.id, Date.now() );
|
28 |
+
|
29 |
// Set retake to local.storage
|
30 |
const retakenNumber = window.localStorage.getItem( 'quiz_retake_' + lpQuizSettings.id );
|
31 |
if ( retakenNumber >= 1 ) {
|
33 |
} else {
|
34 |
window.localStorage.setItem( 'quiz_retake_' + lpQuizSettings.id, 1 );
|
35 |
}
|
36 |
+
}*/
|
37 |
+
|
|
|
38 |
startQuiz();
|
39 |
};
|
40 |
|
414 |
data.question = getCurrentQuestion( 'object' );
|
415 |
}
|
416 |
|
417 |
+
if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
418 |
+
const retakenCurrent = window.localStorage.getItem( 'quiz_off_retaken_' + lpQuizSettings.id );
|
419 |
+
|
420 |
if ( getData( 'retakeCount' ) > retakenCurrent ) {
|
421 |
data.retakeNumber = getData( 'retakeCount' ) - retakenCurrent;
|
422 |
data.canRetry = true;
|
@@ -160,14 +160,15 @@ const Result = () => {
|
|
160 |
}
|
161 |
|
162 |
const classNames = [ 'quiz-result', graduation ];
|
|
|
163 |
//Re-write value to results.timeSpend
|
164 |
-
if ( lpQuizSettings.checkNorequizenroll
|
165 |
const timespendStart = window.localStorage.getItem( 'quiz_start_' + QuizID ),
|
166 |
timespendEnd = window.localStorage.getItem( 'quiz_end_' + QuizID );
|
167 |
if ( timespendStart && timespendEnd ) {
|
168 |
results.timeSpend = timeDifference( timespendStart, timespendEnd ).duration;
|
169 |
}
|
170 |
-
}
|
171 |
return (
|
172 |
<div className={ classNames.join( ' ' ) }>
|
173 |
<h3 className="result-heading">{ __( 'Your Result', 'learnpress' ) }</h3>
|
@@ -188,11 +189,11 @@ const Result = () => {
|
|
188 |
|
189 |
<ul className="result-statistic">
|
190 |
<li className="result-statistic-field result-time-spend">
|
191 |
-
<span>{ __( 'Time
|
192 |
<p>{ results.timeSpend }</p>
|
193 |
</li>
|
194 |
<li className="result-statistic-field result-point">
|
195 |
-
<span>{ __( '
|
196 |
<p>{ results.userMark } / { results.mark }</p>
|
197 |
</li>
|
198 |
<li className="result-statistic-field result-questions">
|
160 |
}
|
161 |
|
162 |
const classNames = [ 'quiz-result', graduation ];
|
163 |
+
|
164 |
//Re-write value to results.timeSpend
|
165 |
+
/*if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
166 |
const timespendStart = window.localStorage.getItem( 'quiz_start_' + QuizID ),
|
167 |
timespendEnd = window.localStorage.getItem( 'quiz_end_' + QuizID );
|
168 |
if ( timespendStart && timespendEnd ) {
|
169 |
results.timeSpend = timeDifference( timespendStart, timespendEnd ).duration;
|
170 |
}
|
171 |
+
}*/
|
172 |
return (
|
173 |
<div className={ classNames.join( ' ' ) }>
|
174 |
<h3 className="result-heading">{ __( 'Your Result', 'learnpress' ) }</h3>
|
189 |
|
190 |
<ul className="result-statistic">
|
191 |
<li className="result-statistic-field result-time-spend">
|
192 |
+
<span>{ __( 'Time spent', 'learnpress' ) }</span>
|
193 |
<p>{ results.timeSpend }</p>
|
194 |
</li>
|
195 |
<li className="result-statistic-field result-point">
|
196 |
+
<span>{ __( 'Points', 'learnpress' ) }</span>
|
197 |
<p>{ results.userMark } / { results.mark }</p>
|
198 |
</li>
|
199 |
<li className="result-statistic-field result-questions">
|
@@ -130,7 +130,7 @@ const Status = () => {
|
|
130 |
</button>
|
131 |
</div>
|
132 |
|
133 |
-
{
|
134 |
</div>
|
135 |
</div>
|
136 |
</div>
|
130 |
</button>
|
131 |
</div>
|
132 |
|
133 |
+
{ duration && <Timer /> }
|
134 |
</div>
|
135 |
</div>
|
136 |
</div>
|
@@ -10,15 +10,17 @@ const Timer = () => {
|
|
10 |
const { getData } = select( 'learnpress/quiz' );
|
11 |
const { submitQuiz } = dispatch( 'learnpress/quiz' );
|
12 |
|
13 |
-
const totalTime = getData( 'totalTime' )
|
14 |
-
const
|
|
|
15 |
|
16 |
const d1 = new Date( endTime.replace( /-/g, '/' ) );
|
17 |
const d2 = new Date();
|
18 |
const tz = new Date().getTimezoneOffset();
|
19 |
-
const t = parseInt( ( d1.getTime() / 1000 ) - ( ( d2.getTime() / 1000 ) + ( tz * 60 ) ) )
|
20 |
|
21 |
-
const [ seconds, setSeconds ] = useState(
|
|
|
22 |
|
23 |
useEffect( () => {
|
24 |
const myInterval = setInterval( () => {
|
@@ -27,6 +29,8 @@ const Timer = () => {
|
|
27 |
|
28 |
if ( remainSeconds > 0 ) {
|
29 |
setSeconds( remainSeconds );
|
|
|
|
|
30 |
} else {
|
31 |
clearInterval( myInterval );
|
32 |
submitQuiz();
|
@@ -34,7 +38,7 @@ const Timer = () => {
|
|
34 |
}, 1000 );
|
35 |
|
36 |
return () => clearInterval( myInterval );
|
37 |
-
}, [ seconds ] );
|
38 |
|
39 |
const formatTime = ( separator = ':' ) => {
|
40 |
const t = [];
|
@@ -59,6 +63,7 @@ const Timer = () => {
|
|
59 |
<div className="countdown">
|
60 |
<i className="fas fa-stopwatch"></i>
|
61 |
<span>{ formatTime() }</span>
|
|
|
62 |
</div>
|
63 |
);
|
64 |
};
|
10 |
const { getData } = select( 'learnpress/quiz' );
|
11 |
const { submitQuiz } = dispatch( 'learnpress/quiz' );
|
12 |
|
13 |
+
const totalTime = getData( 'totalTime' );
|
14 |
+
const durationTime = getData( 'duration' );
|
15 |
+
/* const endTime = getData( 'endTime' );
|
16 |
|
17 |
const d1 = new Date( endTime.replace( /-/g, '/' ) );
|
18 |
const d2 = new Date();
|
19 |
const tz = new Date().getTimezoneOffset();
|
20 |
+
const t = parseInt( ( d1.getTime() / 1000 ) - ( ( d2.getTime() / 1000 ) + ( tz * 60 ) ) );*/
|
21 |
|
22 |
+
const [ seconds, setSeconds ] = useState( totalTime );
|
23 |
+
let [ timeSpend, setTimeSpend ] = useState( 0 );
|
24 |
|
25 |
useEffect( () => {
|
26 |
const myInterval = setInterval( () => {
|
29 |
|
30 |
if ( remainSeconds > 0 ) {
|
31 |
setSeconds( remainSeconds );
|
32 |
+
timeSpend++;
|
33 |
+
setTimeSpend( durationTime - remainSeconds );
|
34 |
} else {
|
35 |
clearInterval( myInterval );
|
36 |
submitQuiz();
|
38 |
}, 1000 );
|
39 |
|
40 |
return () => clearInterval( myInterval );
|
41 |
+
}, [ seconds, timeSpend ] );
|
42 |
|
43 |
const formatTime = ( separator = ':' ) => {
|
44 |
const t = [];
|
63 |
<div className="countdown">
|
64 |
<i className="fas fa-stopwatch"></i>
|
65 |
<span>{ formatTime() }</span>
|
66 |
+
<input type="hidden" name="lp-quiz-time-spend" value={ timeSpend } />
|
67 |
</div>
|
68 |
);
|
69 |
};
|
@@ -23,10 +23,11 @@ export function setQuizData( key, data ) {
|
|
23 |
} else {
|
24 |
data = key;
|
25 |
}
|
|
|
26 |
// Save all data for no required enroll available
|
27 |
-
if ( lpQuizSettings.checkNorequizenroll
|
28 |
data = JSON.parse( window.localStorage.getItem( 'quiz_userdata_' + lpQuizSettings.id ) );
|
29 |
-
}
|
30 |
|
31 |
return {
|
32 |
type: 'SET_QUIZ_DATA',
|
@@ -92,9 +93,33 @@ const startQuiz = function*() {
|
|
92 |
},
|
93 |
} );
|
94 |
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
};
|
99 |
|
100 |
export { startQuiz };
|
@@ -132,6 +157,29 @@ export function* submitQuiz() {
|
|
132 |
}
|
133 |
|
134 |
const answered = getQuestionsSelectedAnswers();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
let response = yield apiFetch( {
|
136 |
path: 'lp/v1/users/submit-quiz',
|
137 |
method: 'POST',
|
@@ -139,24 +187,35 @@ export function* submitQuiz() {
|
|
139 |
item_id: itemId,
|
140 |
course_id: courseId,
|
141 |
answered,
|
|
|
142 |
},
|
143 |
} );
|
144 |
|
145 |
-
if ( lpQuizSettings.checkNorequizenroll == '1' ) {
|
146 |
-
// Remove & set storage end_time
|
147 |
-
window.localStorage.removeItem( 'quiz_end_' + lpQuizSettings.id );
|
148 |
-
window.localStorage.setItem( 'quiz_end_' + lpQuizSettings.id, Date.now() );
|
149 |
-
}
|
150 |
-
|
151 |
response = Hook.applyFilters( 'request-submit-quiz-response', response, itemId, courseId );
|
152 |
|
153 |
-
if ( response.success ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
yield _dispatch( 'learnpress/quiz', '__requestSubmitQuizSuccess', camelCaseDashObjectKeys( response.results ), itemId, courseId );
|
155 |
}
|
156 |
|
157 |
-
if ( lpQuizSettings.checkNorequizenroll == '1' ) {
|
158 |
localStorage.setItem( 'quiz_userdata_' + lpQuizSettings.id, JSON.stringify( wpSelect( 'learnpress/quiz' ).getData() ) );
|
159 |
-
}
|
160 |
}
|
161 |
|
162 |
export function updateUserQuestionAnswers( questionId, answers, quizId, courseId = 0, userId = 0 ) {
|
@@ -209,7 +268,39 @@ export function* checkAnswer( id ) {
|
|
209 |
},
|
210 |
} );
|
211 |
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
}
|
214 |
|
215 |
export function markQuestionRendered( questionId ) {
|
23 |
} else {
|
24 |
data = key;
|
25 |
}
|
26 |
+
|
27 |
// Save all data for no required enroll available
|
28 |
+
/*if ( lpQuizSettings.checkNorequizenroll === 1 && window.localStorage.getItem( 'quiz_userdata_' + lpQuizSettings.id ) !== null ) {
|
29 |
data = JSON.parse( window.localStorage.getItem( 'quiz_userdata_' + lpQuizSettings.id ) );
|
30 |
+
}*/
|
31 |
|
32 |
return {
|
33 |
type: 'SET_QUIZ_DATA',
|
93 |
},
|
94 |
} );
|
95 |
|
96 |
+
if ( response.status !== 'error' ) {
|
97 |
+
response = Hook.applyFilters( 'request-start-quiz-response', response, itemId, courseId );
|
98 |
+
|
99 |
+
// No require enroll
|
100 |
+
if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
101 |
+
const keyQuizOff = 'quiz_off_' + lpQuizSettings.id;
|
102 |
+
window.localStorage.removeItem( keyQuizOff );
|
103 |
+
const quizDataOff = { endTime: ( Date.now() + response.results.duration * 1000 ), status: response.results.status };
|
104 |
+
|
105 |
+
window.localStorage.setItem( keyQuizOff, JSON.stringify( quizDataOff ) );
|
106 |
|
107 |
+
// Set Retake quiz
|
108 |
+
const keyQuizOffRetaken = 'quiz_off_retaken_' + lpQuizSettings.id;
|
109 |
+
let quizOffRetaken = window.localStorage.getItem( keyQuizOffRetaken );
|
110 |
+
|
111 |
+
if ( null === quizOffRetaken ) {
|
112 |
+
quizOffRetaken = 0;
|
113 |
+
} else {
|
114 |
+
quizOffRetaken++;
|
115 |
+
}
|
116 |
+
|
117 |
+
window.localStorage.setItem( keyQuizOffRetaken, quizOffRetaken );
|
118 |
+
// End
|
119 |
+
}
|
120 |
+
|
121 |
+
yield _dispatch( 'learnpress/quiz', '__requestStartQuizSuccess', camelCaseDashObjectKeys( response ), itemId, courseId );
|
122 |
+
}
|
123 |
};
|
124 |
|
125 |
export { startQuiz };
|
157 |
}
|
158 |
|
159 |
const answered = getQuestionsSelectedAnswers();
|
160 |
+
|
161 |
+
if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
162 |
+
const keyAnswer = `LP_Quiz_${ itemId }_Answered`;
|
163 |
+
const answerDataStr = localStorage.getItem( keyAnswer );
|
164 |
+
|
165 |
+
if ( null !== answerDataStr ) {
|
166 |
+
const data = JSON.parse( answerDataStr );
|
167 |
+
|
168 |
+
for ( const [ k, v ] of Object.entries( data ) ) {
|
169 |
+
answered[ k ] = v.answered;
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
// Get time spend did quiz - tungnx
|
175 |
+
let timeSpend = 0;
|
176 |
+
const elTimeSpend = document.querySelector( 'input[name=lp-quiz-time-spend]' );
|
177 |
+
|
178 |
+
if ( elTimeSpend ) {
|
179 |
+
timeSpend = elTimeSpend.value;
|
180 |
+
}
|
181 |
+
// End
|
182 |
+
|
183 |
let response = yield apiFetch( {
|
184 |
path: 'lp/v1/users/submit-quiz',
|
185 |
method: 'POST',
|
187 |
item_id: itemId,
|
188 |
course_id: courseId,
|
189 |
answered,
|
190 |
+
time_spend: timeSpend,
|
191 |
},
|
192 |
} );
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
response = Hook.applyFilters( 'request-submit-quiz-response', response, itemId, courseId );
|
195 |
|
196 |
+
if ( response.status === 'success' ) {
|
197 |
+
if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
198 |
+
const keyQuizOff = 'quiz_off_' + lpQuizSettings.id;
|
199 |
+
const quizDataOffStr = window.localStorage.getItem( keyQuizOff );
|
200 |
+
if ( null !== quizDataOffStr ) {
|
201 |
+
const quizDataOff = JSON.parse( quizDataOffStr );
|
202 |
+
|
203 |
+
quizDataOff.status = response.results.status;
|
204 |
+
quizDataOff.results = response.results.results;
|
205 |
+
|
206 |
+
window.localStorage.setItem( keyQuizOff, JSON.stringify( quizDataOff ) );
|
207 |
+
window.localStorage.removeItem( 'LP_Quiz_' + lpQuizSettings.id + '_Answered' );
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
//console.log( response.results );
|
212 |
+
|
213 |
yield _dispatch( 'learnpress/quiz', '__requestSubmitQuizSuccess', camelCaseDashObjectKeys( response.results ), itemId, courseId );
|
214 |
}
|
215 |
|
216 |
+
/*if ( lpQuizSettings.checkNorequizenroll == '1' ) {
|
217 |
localStorage.setItem( 'quiz_userdata_' + lpQuizSettings.id, JSON.stringify( wpSelect( 'learnpress/quiz' ).getData() ) );
|
218 |
+
}*/
|
219 |
}
|
220 |
|
221 |
export function updateUserQuestionAnswers( questionId, answers, quizId, courseId = 0, userId = 0 ) {
|
268 |
},
|
269 |
} );
|
270 |
|
271 |
+
if ( result.status === 'success' ) {
|
272 |
+
// No require enroll
|
273 |
+
if ( lpQuizSettings.checkNorequizenroll === 1 ) {
|
274 |
+
const keyQuizOff = 'quiz_off_' + lpQuizSettings.id;
|
275 |
+
const quizDataOffStr = window.localStorage.getItem( keyQuizOff );
|
276 |
+
|
277 |
+
if ( null !== quizDataOffStr ) {
|
278 |
+
const quizDataOff = JSON.parse( quizDataOffStr );
|
279 |
+
|
280 |
+
const questionOptions = result.options;
|
281 |
+
|
282 |
+
if ( undefined === quizDataOff.checked_questions ) {
|
283 |
+
quizDataOff.checked_questions = [];
|
284 |
+
quizDataOff.checked_questions.push( id );
|
285 |
+
} else if ( -1 === quizDataOff.checked_questions.indexOf( id ) ) {
|
286 |
+
quizDataOff.checked_questions.push( id );
|
287 |
+
}
|
288 |
+
|
289 |
+
if ( undefined === quizDataOff.question_options ) {
|
290 |
+
quizDataOff.question_options = {};
|
291 |
+
quizDataOff.question_options[ id ] = questionOptions;
|
292 |
+
} else if ( undefined === quizDataOff.question_options[ id ] ) {
|
293 |
+
quizDataOff.question_options[ id ] = questionOptions;
|
294 |
+
}
|
295 |
+
|
296 |
+
window.localStorage.setItem( keyQuizOff, JSON.stringify( quizDataOff ) );
|
297 |
+
|
298 |
+
//console.log( quizDataOff );
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
yield _dispatch( 'learnpress/quiz', '__requestCheckAnswerSuccess', id, camelCaseDashObjectKeys( result ) );
|
303 |
+
}
|
304 |
}
|
305 |
|
306 |
export function markQuestionRendered( questionId ) {
|
@@ -98,13 +98,26 @@ const checkAnswer = ( state, action ) => {
|
|
98 |
return { ...question, ...newArgs };
|
99 |
} );
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
return {
|
102 |
...state,
|
103 |
questions: [ ...questions ],
|
104 |
-
answered:
|
105 |
-
...state.answered,
|
106 |
-
[ action.questionId ]: action.result,
|
107 |
-
},
|
108 |
checkedQuestions: [ ...state.checkedQuestions, action.questionId ],
|
109 |
};
|
110 |
};
|
98 |
return { ...question, ...newArgs };
|
99 |
} );
|
100 |
|
101 |
+
const answered = {
|
102 |
+
...state.answered,
|
103 |
+
[ action.questionId ]: action.result,
|
104 |
+
};
|
105 |
+
|
106 |
+
let newAnswered = localStorage.getItem( `LP_Quiz_${ state.id }_Answered` );
|
107 |
+
|
108 |
+
if ( newAnswered ) {
|
109 |
+
newAnswered = {
|
110 |
+
...JSON.parse( newAnswered ),
|
111 |
+
...answered,
|
112 |
+
}
|
113 |
+
|
114 |
+
localStorage.setItem( `LP_Quiz_${ state.id }_Answered`, JSON.stringify( newAnswered ) );
|
115 |
+
}
|
116 |
+
|
117 |
return {
|
118 |
...state,
|
119 |
questions: [ ...questions ],
|
120 |
+
answered: answered,
|
|
|
|
|
|
|
121 |
checkedQuestions: [ ...state.checkedQuestions, action.questionId ],
|
122 |
};
|
123 |
};
|
@@ -175,22 +175,14 @@ const getQuestionsSelectedAnswers = function( state, questionId ) {
|
|
175 |
continue;
|
176 |
}
|
177 |
|
178 |
-
|
|
|
179 |
// If specific a question then return it only.
|
180 |
if ( questionId && loopId === questionId ) {
|
181 |
return data[ loopId ].answered;
|
182 |
}
|
|
|
183 |
returnData[ loopId ] = data[ loopId ].answered;
|
184 |
-
} else {
|
185 |
-
// Answer filled by user
|
186 |
-
if ( ( data[ loopId ].temp || data[ loopId ].blanks ) ) {
|
187 |
-
// If specific a question then return it only.
|
188 |
-
if ( questionId && loopId === questionId ) {
|
189 |
-
return data[ loopId ].answered;
|
190 |
-
}
|
191 |
-
|
192 |
-
returnData[ loopId ] = data[ loopId ].answered;
|
193 |
-
}
|
194 |
}
|
195 |
}
|
196 |
|
175 |
continue;
|
176 |
}
|
177 |
|
178 |
+
// Answer filled by user
|
179 |
+
if ( ( data[ loopId ].temp || data[ loopId ].blanks ) ) {
|
180 |
// If specific a question then return it only.
|
181 |
if ( questionId && loopId === questionId ) {
|
182 |
return data[ loopId ].answered;
|
183 |
}
|
184 |
+
|
185 |
returnData[ loopId ] = data[ loopId ].answered;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
}
|
188 |
|
File without changes
|
@@ -89,7 +89,7 @@
|
|
89 |
this.avatar = response.url;
|
90 |
$( '<img/>' )
|
91 |
.attr( 'src', response.url )
|
92 |
-
.
|
93 |
that.model.set( $.extend( response, {
|
94 |
width: this.width,
|
95 |
height: this.height,
|
89 |
this.avatar = response.url;
|
90 |
$( '<img/>' )
|
91 |
.attr( 'src', response.url )
|
92 |
+
.on( 'load', function() {
|
93 |
that.model.set( $.extend( response, {
|
94 |
width: this.width,
|
95 |
height: this.height,
|
@@ -21,14 +21,14 @@ class LP_Post_Type_Actions {
|
|
21 |
* LP_Post_Type_Actions constructor.
|
22 |
*/
|
23 |
protected function __construct() {
|
24 |
-
add_action( 'save_post', array( $this, 'save_post' ) );
|
25 |
add_action( 'learn-press/added-item-to-section', array( $this, 'added_item_to_section' ), 10, 3 );
|
26 |
add_action( 'learn-press/removed-item-from-section', array( $this, 'removed_item_from_section' ), 10, 2 );
|
27 |
|
28 |
add_filter( 'pre_trash_post', array( $this, 'pre_trash_post' ), 10, 2 );
|
29 |
add_filter( 'trashed_post', array( $this, 'trashed_post' ), 1000, 1 );
|
30 |
|
31 |
-
add_filter( 'transition_post_status', array( $this, 'transition_post_status' ), 1000, 3 );
|
32 |
}
|
33 |
|
34 |
public function __get( $key ) {
|
@@ -120,7 +120,11 @@ class LP_Post_Type_Actions {
|
|
120 |
}
|
121 |
}
|
122 |
|
123 |
-
|
|
|
|
|
|
|
|
|
124 |
if ( $this->is_course( $post ) ) {
|
125 |
|
126 |
} elseif ( $this->is_course_item( $post ) ) {
|
@@ -133,7 +137,7 @@ class LP_Post_Type_Actions {
|
|
133 |
}
|
134 |
}
|
135 |
}
|
136 |
-
}
|
137 |
|
138 |
public function added_item_to_section( $item, $section_id, $course_id ) {
|
139 |
do_action( 'learn-press/added-course-item', $item['id'], $course_id );
|
@@ -143,7 +147,11 @@ class LP_Post_Type_Actions {
|
|
143 |
do_action( 'learn-press/removed-course-item', $course_id );
|
144 |
}
|
145 |
|
146 |
-
|
|
|
|
|
|
|
|
|
147 |
$post_type = get_post_type( $post_id );
|
148 |
|
149 |
if ( LP_COURSE_CPT === $post_type ) {
|
@@ -151,7 +159,7 @@ class LP_Post_Type_Actions {
|
|
151 |
} elseif ( learn_press_is_support_course_item_type( $post_type ) ) {
|
152 |
$this->add( 'update-post', $post_id );
|
153 |
}
|
154 |
-
}
|
155 |
|
156 |
public function is_course( $post ) {
|
157 |
if ( is_numeric( $post ) ) {
|
21 |
* LP_Post_Type_Actions constructor.
|
22 |
*/
|
23 |
protected function __construct() {
|
24 |
+
//add_action( 'save_post', array( $this, 'save_post' ) );
|
25 |
add_action( 'learn-press/added-item-to-section', array( $this, 'added_item_to_section' ), 10, 3 );
|
26 |
add_action( 'learn-press/removed-item-from-section', array( $this, 'removed_item_from_section' ), 10, 2 );
|
27 |
|
28 |
add_filter( 'pre_trash_post', array( $this, 'pre_trash_post' ), 10, 2 );
|
29 |
add_filter( 'trashed_post', array( $this, 'trashed_post' ), 1000, 1 );
|
30 |
|
31 |
+
//add_filter( 'transition_post_status', array( $this, 'transition_post_status' ), 1000, 3 );
|
32 |
}
|
33 |
|
34 |
public function __get( $key ) {
|
120 |
}
|
121 |
}
|
122 |
|
123 |
+
/**
|
124 |
+
* @editor tungnx
|
125 |
+
* @modify 4.1.4.1 - comment - not use
|
126 |
+
*/
|
127 |
+
/*public function transition_post_status( $old, $new, $post ) {
|
128 |
if ( $this->is_course( $post ) ) {
|
129 |
|
130 |
} elseif ( $this->is_course_item( $post ) ) {
|
137 |
}
|
138 |
}
|
139 |
}
|
140 |
+
}*/
|
141 |
|
142 |
public function added_item_to_section( $item, $section_id, $course_id ) {
|
143 |
do_action( 'learn-press/added-course-item', $item['id'], $course_id );
|
147 |
do_action( 'learn-press/removed-course-item', $course_id );
|
148 |
}
|
149 |
|
150 |
+
/**
|
151 |
+
* @editor tungnx
|
152 |
+
* @modify 4.1.4.1 comment - not use
|
153 |
+
*/
|
154 |
+
/*public function save_post( $post_id ) {
|
155 |
$post_type = get_post_type( $post_id );
|
156 |
|
157 |
if ( LP_COURSE_CPT === $post_type ) {
|
159 |
} elseif ( learn_press_is_support_course_item_type( $post_type ) ) {
|
160 |
$this->add( 'update-post', $post_id );
|
161 |
}
|
162 |
+
}*/
|
163 |
|
164 |
public function is_course( $post ) {
|
165 |
if ( is_numeric( $post ) ) {
|
@@ -2624,24 +2624,4 @@ function learn_press_get_orders_status_chart_data() {
|
|
2624 |
return $data;
|
2625 |
}
|
2626 |
|
2627 |
-
function learn_press_option_course_evaluation_method( $method ) {
|
2628 |
-
global $post;
|
2629 |
-
|
2630 |
-
$evaluation_by = get_post_meta( $post->ID, '_lp_course_result_quiz', true );
|
2631 |
-
switch ( $method ) {
|
2632 |
-
case 'evaluate_quiz':
|
2633 |
-
?>
|
2634 |
-
<p id="course_evaluation_method_quiz_options">
|
2635 |
-
<input type="checkbox" id="lp-course-result-evaluate-final-quiz" name="_lp_course_result_quiz"
|
2636 |
-
value="final_quiz" <?php checked( $evaluation_by === 'final_quiz' ); ?> />
|
2637 |
-
<label for="lp-course-result-evaluate-final-quiz">
|
2638 |
-
<?php _e( 'Only check <strong><em>the final quiz</em></strong> result', 'learnpress' ); ?>
|
2639 |
-
</label>
|
2640 |
-
</p>
|
2641 |
-
<?php
|
2642 |
-
}
|
2643 |
-
}
|
2644 |
-
|
2645 |
-
add_action( 'learn-press/option-course-evaluation-method', 'learn_press_option_course_evaluation_method' );
|
2646 |
-
|
2647 |
require_once 'class-lp-post-type-actions.php';
|
2624 |
return $data;
|
2625 |
}
|
2626 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2627 |
require_once 'class-lp-post-type-actions.php';
|
@@ -206,6 +206,9 @@ if ( ! class_exists( 'LP_Meta_Box_Helper' ) ) {
|
|
206 |
$value = ! empty( $raw_value ) ? $raw_value : array();
|
207 |
$value = LP_Helper::sanitize_params_submitted( $value, 'html' );
|
208 |
break;
|
|
|
|
|
|
|
209 |
default:
|
210 |
$value = LP_Helper::sanitize_params_submitted( $raw_value );
|
211 |
break;
|
206 |
$value = ! empty( $raw_value ) ? $raw_value : array();
|
207 |
$value = LP_Helper::sanitize_params_submitted( $value, 'html' );
|
208 |
break;
|
209 |
+
case 'url':
|
210 |
+
$value = ! empty( $raw_value ) ? esc_url( $raw_value ) : '';
|
211 |
+
break;
|
212 |
default:
|
213 |
$value = LP_Helper::sanitize_params_submitted( $raw_value );
|
214 |
break;
|
@@ -92,13 +92,13 @@ class LP_Settings_Advanced extends LP_Abstract_Settings_Page {
|
|
92 |
'type' => 'checkbox',
|
93 |
'desc' => esc_html__( 'Enable debug mode for developer.', 'learnpress' ),
|
94 |
),
|
95 |
-
array(
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
),
|
102 |
array(
|
103 |
'title' => esc_html__( 'Hard Cache', 'learnpress' ),
|
104 |
'id' => 'enable_hard_cache',
|
92 |
'type' => 'checkbox',
|
93 |
'desc' => esc_html__( 'Enable debug mode for developer.', 'learnpress' ),
|
94 |
),
|
95 |
+
// array(
|
96 |
+
// 'title' => esc_html__( 'Enable Jwt Rest API', 'learnpress' ),
|
97 |
+
// 'id' => 'enable_jwt_rest_api',
|
98 |
+
// 'default' => 'no',
|
99 |
+
// 'type' => 'checkbox',
|
100 |
+
// 'desc' => esc_html__( 'Enable Rest API build for app, mobile...etc.', 'learnpress' ),
|
101 |
+
// ),
|
102 |
array(
|
103 |
'title' => esc_html__( 'Hard Cache', 'learnpress' ),
|
104 |
'id' => 'enable_hard_cache',
|
@@ -56,8 +56,12 @@ class LP_Settings_Courses extends LP_Abstract_Settings_Page {
|
|
56 |
* @return array
|
57 |
*/
|
58 |
public function get_settings( $section = null, $tab = null ) {
|
59 |
-
|
60 |
-
$
|
|
|
|
|
|
|
|
|
61 |
|
62 |
$settings = apply_filters(
|
63 |
'learn-press/courses-settings-fields',
|
@@ -115,6 +119,14 @@ class LP_Settings_Courses extends LP_Abstract_Settings_Page {
|
|
115 |
'default' => array( 500, 300, 'yes' ),
|
116 |
'type' => 'image-dimensions',
|
117 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
array(
|
119 |
'type' => 'sectionend',
|
120 |
),
|
56 |
* @return array
|
57 |
*/
|
58 |
public function get_settings( $section = null, $tab = null ) {
|
59 |
+
$generate_course_thumbnail = get_option( 'learn_press_generate_course_thumbnail' ) ?? 'no';
|
60 |
+
$des_option_redirect_finish_course = wp_sprintf(
|
61 |
+
'%s<br>%s',
|
62 |
+
esc_html__( 'The site will be redirected to the URL added after clicking finish course button.', 'learnpress' ),
|
63 |
+
esc_html__( 'Set blank, the site will be redirected to the single course page', 'learnpress' )
|
64 |
+
);
|
65 |
|
66 |
$settings = apply_filters(
|
67 |
'learn-press/courses-settings-fields',
|
119 |
'default' => array( 500, 300, 'yes' ),
|
120 |
'type' => 'image-dimensions',
|
121 |
),
|
122 |
+
array(
|
123 |
+
'title' => esc_html__( 'Redirect when finish course', 'learnpress' ),
|
124 |
+
'id' => 'course_finish_redirect',
|
125 |
+
'default' => '',
|
126 |
+
'type' => 'url',
|
127 |
+
'placeholder' => 'https://learnpress.com/',
|
128 |
+
'desc' => $des_option_redirect_finish_course,
|
129 |
+
),
|
130 |
array(
|
131 |
'type' => 'sectionend',
|
132 |
),
|
@@ -351,10 +351,11 @@ class LP_Meta_Box_Course extends LP_Meta_Box {
|
|
351 |
esc_html__( 'The condition that must be achieved to finish the course.', 'learnpress' ),
|
352 |
'80',
|
353 |
array(
|
354 |
-
'
|
355 |
'custom_attributes' => array(
|
356 |
'min' => '0',
|
357 |
'step' => '1',
|
|
|
358 |
),
|
359 |
'style' => 'width: 60px;',
|
360 |
)
|
@@ -448,7 +449,7 @@ class LP_Meta_Box_Course extends LP_Meta_Box {
|
|
448 |
}
|
449 |
}
|
450 |
|
451 |
-
do_action( 'lp_course_data_setting_tab_content' );
|
452 |
?>
|
453 |
</div>
|
454 |
</div>
|
351 |
esc_html__( 'The condition that must be achieved to finish the course.', 'learnpress' ),
|
352 |
'80',
|
353 |
array(
|
354 |
+
'type_input' => 'number',
|
355 |
'custom_attributes' => array(
|
356 |
'min' => '0',
|
357 |
'step' => '1',
|
358 |
+
'max' => '100',
|
359 |
),
|
360 |
'style' => 'width: 60px;',
|
361 |
)
|
449 |
}
|
450 |
}
|
451 |
|
452 |
+
do_action( 'lp_course_data_setting_tab_content', $post );
|
453 |
?>
|
454 |
</div>
|
455 |
</div>
|
@@ -33,11 +33,12 @@ class LP_Meta_Box_Text_Field extends LP_Meta_Box_Field {
|
|
33 |
$style = ! empty( $extra['style'] ) ? 'style="' . esc_attr( $extra['style'] ) . '"' : '';
|
34 |
$wrapper_class = ! empty( $extra['wrapper_class'] ) ? esc_attr( $extra['wrapper_class'] ) : '';
|
35 |
|
36 |
-
$
|
37 |
-
$
|
38 |
-
$value
|
39 |
-
$
|
40 |
-
$
|
|
|
41 |
|
42 |
// Custom attribute handling
|
43 |
$custom_attributes = array();
|
33 |
$style = ! empty( $extra['style'] ) ? 'style="' . esc_attr( $extra['style'] ) . '"' : '';
|
34 |
$wrapper_class = ! empty( $extra['wrapper_class'] ) ? esc_attr( $extra['wrapper_class'] ) : '';
|
35 |
|
36 |
+
$meta_exists = LP_Database::getInstance()->check_key_postmeta_exists( $thepostid, $this->id );
|
37 |
+
$meta = get_post_meta( $thepostid, $this->id, true );
|
38 |
+
$value = $meta_exists ? $meta : ( $this->default ?? '' );
|
39 |
+
$value = esc_attr( $extra['value'] ?? $value );
|
40 |
+
$type_input = $extra['type_input'] ?? 'text';
|
41 |
+
$desc_tip = $extra['desc_tip'] ?? '';
|
42 |
|
43 |
// Custom attribute handling
|
44 |
$custom_attributes = array();
|
@@ -8,18 +8,19 @@ function lp_meta_box_text_input_field( $field ) {
|
|
8 |
global $thepostid, $post;
|
9 |
|
10 |
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
|
11 |
-
$field['placeholder'] = $field['placeholder'] ?? '';
|
12 |
-
$
|
13 |
-
$
|
14 |
-
$wrapper_class =
|
15 |
|
16 |
/**
|
17 |
* If you want to set default value for input text
|
18 |
* You must us hook default_{$meta_type}_metadata | Read more get_metadata_default() function
|
19 |
*/
|
20 |
-
$
|
21 |
-
$
|
22 |
-
$
|
|
|
23 |
$field['type_input'] = esc_attr( $field['type_input'] ?? 'text' );
|
24 |
$field['desc_tip'] = esc_attr( $field['desc_tip'] ?? '' );
|
25 |
|
@@ -32,14 +33,20 @@ function lp_meta_box_text_input_field( $field ) {
|
|
32 |
}
|
33 |
}
|
34 |
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
' '
|
40 |
-
$
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
|
|
|
43 |
if ( ! empty( $field['description'] ) ) {
|
44 |
echo '<p class="description">';
|
45 |
echo '<span>' . wp_kses_post( $field['description'] ) . '</span>';
|
@@ -49,7 +56,9 @@ function lp_meta_box_text_input_field( $field ) {
|
|
49 |
}
|
50 |
echo '</p>';
|
51 |
}
|
52 |
-
|
|
|
|
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -61,20 +70,14 @@ function lp_meta_box_textarea_field( $field ) {
|
|
61 |
global $thepostid, $post;
|
62 |
|
63 |
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
|
|
|
64 |
$field['placeholder'] = esc_attr( $field['placeholder'] ?? '' );
|
65 |
$field['class'] = esc_attr( $field['class'] ?? 'short' );
|
66 |
$field['style'] = esc_attr( $field['style'] ?? '' );
|
67 |
-
$field['
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
) && isset( $field['default'] ) ) ? $field['default'] : get_post_meta(
|
72 |
-
$thepostid,
|
73 |
-
$field['id'],
|
74 |
-
true
|
75 |
-
);
|
76 |
-
$field['value'] = esc_attr( $field['value'] ?? $field['default'] );
|
77 |
-
$field['desc_tip'] = esc_attr( $field['desc_tip'] ?? false );
|
78 |
$field['name'] = esc_attr( $field['name'] ?? $field['id'] );
|
79 |
|
80 |
// Custom attribute handling
|
@@ -85,14 +88,18 @@ function lp_meta_box_textarea_field( $field ) {
|
|
85 |
}
|
86 |
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
echo '<textarea class="' . esc_attr( $field['class'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . esc_attr( $field['name'] ) . '" id="' . esc_attr( $field['id'] ) . '" placeholder="' . esc_attr( $field['placeholder'] ) . '" rows="5" ' . implode(
|
92 |
-
' ',
|
93 |
-
$custom_attributes
|
94 |
-
) . '>' . esc_textarea( $field['value'] ) . '</textarea> ';
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
if ( ! empty( $field['description'] ) ) {
|
97 |
echo '<span class="description">' . wp_kses_post( $field['description'] ) . '</span>';
|
98 |
|
@@ -100,8 +107,9 @@ function lp_meta_box_textarea_field( $field ) {
|
|
100 |
learn_press_quick_tip( $field['desc_tip'] );
|
101 |
}
|
102 |
}
|
103 |
-
|
104 |
-
|
|
|
105 |
}
|
106 |
|
107 |
/**
|
@@ -112,12 +120,12 @@ function lp_meta_box_textarea_field( $field ) {
|
|
112 |
function lp_meta_box_checkbox_field( $field ) {
|
113 |
global $thepostid, $post;
|
114 |
|
115 |
-
$thepostid
|
116 |
-
$
|
117 |
-
$
|
118 |
-
$
|
119 |
-
$
|
120 |
-
$name
|
121 |
|
122 |
$value_db = get_post_meta( $thepostid, $field['id'], true );
|
123 |
|
@@ -134,14 +142,22 @@ function lp_meta_box_checkbox_field( $field ) {
|
|
134 |
}
|
135 |
}
|
136 |
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
|
|
|
|
144 |
|
|
|
|
|
|
|
145 |
if ( ! empty( $field['description'] ) ) {
|
146 |
echo '<span class="description">' . wp_kses_post( $field['description'] ) . '</span>';
|
147 |
|
@@ -149,8 +165,9 @@ function lp_meta_box_checkbox_field( $field ) {
|
|
149 |
learn_press_quick_tip( $field['desc_tip'] );
|
150 |
}
|
151 |
}
|
152 |
-
|
153 |
-
|
|
|
154 |
}
|
155 |
|
156 |
/**
|
8 |
global $thepostid, $post;
|
9 |
|
10 |
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
|
11 |
+
$field['placeholder'] = esc_attr( $field['placeholder'] ?? '' );
|
12 |
+
$field['class'] = esc_attr( $field['class'] ?? '' );
|
13 |
+
$field['style'] = esc_attr( $field['style'] ?? '' );
|
14 |
+
$wrapper_class = esc_attr( $field['wrapper_class'] ?? '' );
|
15 |
|
16 |
/**
|
17 |
* If you want to set default value for input text
|
18 |
* You must us hook default_{$meta_type}_metadata | Read more get_metadata_default() function
|
19 |
*/
|
20 |
+
$value_exists = LP_Database::getInstance()->check_key_postmeta_exists( $thepostid, $field['id'] );
|
21 |
+
$value = get_post_meta( $thepostid, $field['id'], true );
|
22 |
+
$field['value'] = $value_exists ? $value : ( $field['default'] ?? '' );
|
23 |
+
$field['id'] = esc_attr( $field['id'] ?? '' );
|
24 |
$field['type_input'] = esc_attr( $field['type_input'] ?? 'text' );
|
25 |
$field['desc_tip'] = esc_attr( $field['desc_tip'] ?? '' );
|
26 |
|
33 |
}
|
34 |
}
|
35 |
|
36 |
+
$custom_attributes_str = implode( ' ', $custom_attributes );
|
37 |
+
?>
|
38 |
|
39 |
+
<div class="form-field <?php echo $field['id'] . '_field ' . $wrapper_class; ?>">
|
40 |
+
<label for="<?php echo $field['id']; ?>"><?php echo wp_kses_post( $field['label'] ); ?></label>
|
41 |
+
<input type="<?php echo $field['type_input']; ?>"
|
42 |
+
class="<?php echo $field['class']; ?>"
|
43 |
+
style="<?php echo $field['style']; ?>"
|
44 |
+
name="<?php echo $field['id']; ?>"
|
45 |
+
id="<?php echo $field['id']; ?>"
|
46 |
+
value="<?php echo $field['value']; ?>"
|
47 |
+
placeholder="<?php echo $field['placeholder']; ?>" <?php echo $custom_attributes_str; ?> />
|
48 |
|
49 |
+
<?php
|
50 |
if ( ! empty( $field['description'] ) ) {
|
51 |
echo '<p class="description">';
|
52 |
echo '<span>' . wp_kses_post( $field['description'] ) . '</span>';
|
56 |
}
|
57 |
echo '</p>';
|
58 |
}
|
59 |
+
?>
|
60 |
+
</div>
|
61 |
+
<?php
|
62 |
}
|
63 |
|
64 |
/**
|
70 |
global $thepostid, $post;
|
71 |
|
72 |
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
|
73 |
+
$field['id'] = esc_attr( $field['id'] ?? '' );
|
74 |
$field['placeholder'] = esc_attr( $field['placeholder'] ?? '' );
|
75 |
$field['class'] = esc_attr( $field['class'] ?? 'short' );
|
76 |
$field['style'] = esc_attr( $field['style'] ?? '' );
|
77 |
+
$value_exists = LP_Database::getInstance()->check_key_postmeta_exists( $thepostid, $field['id'] );
|
78 |
+
$value = get_post_meta( $thepostid, $field['id'], true );
|
79 |
+
$field['value'] = esc_textarea( $value_exists ? $value : ( $field['default'] ?? '' ) );
|
80 |
+
$field['desc_tip'] = esc_attr( $field['desc_tip'] ?? '' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
$field['name'] = esc_attr( $field['name'] ?? $field['id'] );
|
82 |
|
83 |
// Custom attribute handling
|
88 |
}
|
89 |
}
|
90 |
|
91 |
+
$custom_attributes_str = implode( ' ', $custom_attributes );
|
92 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
+
<p class="form-field <?php echo $field['id'] . '_field '; ?>">
|
95 |
+
<label for="<?php echo $field['id']; ?>>"><?php echo wp_kses_post( $field['label'] ); ?></label>
|
96 |
+
<textarea class="<?php echo $field['class']; ?>"
|
97 |
+
style="<?php echo $field['style']; ?>"
|
98 |
+
name="<?php echo $field['name']; ?>"
|
99 |
+
id="<?php $field['id']; ?>"
|
100 |
+
placeholder="<?php echo $field['placeholder']; ?>"
|
101 |
+
rows="5" <?php echo $custom_attributes_str; ?>><?php echo $field['value']; ?></textarea>
|
102 |
+
<?php
|
103 |
if ( ! empty( $field['description'] ) ) {
|
104 |
echo '<span class="description">' . wp_kses_post( $field['description'] ) . '</span>';
|
105 |
|
107 |
learn_press_quick_tip( $field['desc_tip'] );
|
108 |
}
|
109 |
}
|
110 |
+
?>
|
111 |
+
</p>
|
112 |
+
<?php
|
113 |
}
|
114 |
|
115 |
/**
|
120 |
function lp_meta_box_checkbox_field( $field ) {
|
121 |
global $thepostid, $post;
|
122 |
|
123 |
+
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
|
124 |
+
$field['id'] = esc_attr( $field['id'] ?? '' );
|
125 |
+
$field['class'] = esc_attr( $field['class'] ?? '' );
|
126 |
+
$field['style'] = esc_attr( $field['style'] ?? '' );
|
127 |
+
$wrapper_class = esc_attr( $field['wrapper_class'] ?? '' );
|
128 |
+
$name = ! empty( $field['name'] ) ? esc_attr( $field['name'] ) : esc_attr( $field['id'] );
|
129 |
|
130 |
$value_db = get_post_meta( $thepostid, $field['id'], true );
|
131 |
|
142 |
}
|
143 |
}
|
144 |
|
145 |
+
$custom_attributes_str = implode( ' ', $custom_attributes );
|
146 |
+
?>
|
147 |
+
|
148 |
+
<div class="form-field <?php echo $field['id'] . '_field'; ?>" <?php echo $wrapper_class; ?>>
|
149 |
+
<label for="<?php echo $field['id']; ?>"><?php echo wp_kses_post( $field['label'] ); ?></label>
|
150 |
|
151 |
+
<input type="checkbox"
|
152 |
+
class="<?php echo $field['class']; ?>"
|
153 |
+
style="<?php echo $field['style']; ?>"
|
154 |
+
name="<?php echo $name; ?>"
|
155 |
+
id="<?php echo $field['id']; ?>"
|
156 |
+
<?php echo $checked; ?>
|
157 |
|
158 |
+
<?php echo $custom_attributes_str; ?> />
|
159 |
+
|
160 |
+
<?php
|
161 |
if ( ! empty( $field['description'] ) ) {
|
162 |
echo '<span class="description">' . wp_kses_post( $field['description'] ) . '</span>';
|
163 |
|
165 |
learn_press_quick_tip( $field['desc_tip'] );
|
166 |
}
|
167 |
}
|
168 |
+
?>
|
169 |
+
</div>
|
170 |
+
<?php
|
171 |
}
|
172 |
|
173 |
/**
|
@@ -1,7 +1,21 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
$passing_condition = $course->get_passing_condition();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
?>
|
6 |
|
7 |
<div class="course-results-progress">
|
@@ -13,14 +27,7 @@ $passing_condition = $course->get_passing_condition();
|
|
13 |
<h4 class="lp-course-progress-heading"><?php echo esc_html__( 'Items completed:', 'learnpress' ); ?></h4>
|
14 |
<?php endif; ?>
|
15 |
|
16 |
-
<span class="number"><?php printf( __( '%1$d of %2$d items', 'learnpress' ), $
|
17 |
-
|
18 |
-
<div class="learn-press-progress lp-course-progress">
|
19 |
-
<div class="progress-bg lp-progress-bar">
|
20 |
-
<div class="progress-active lp-progress-value" style="left: <?php echo $course_results['count_items'] ? absint( $course_results['completed_items'] / $course_results['count_items'] * 100 ) : 0; ?>%;">
|
21 |
-
</div>
|
22 |
-
</div>
|
23 |
-
</div>
|
24 |
</div>
|
25 |
|
26 |
<div class="course-progress lp-progress-row">
|
@@ -35,7 +42,7 @@ $passing_condition = $course->get_passing_condition();
|
|
35 |
|
36 |
<div class="lp-course-status">
|
37 |
<span class="number">
|
38 |
-
<?php echo round( $
|
39 |
<span class="percentage-sign">%</span>
|
40 |
</span>
|
41 |
|
@@ -46,12 +53,5 @@ $passing_condition = $course->get_passing_condition();
|
|
46 |
</span>
|
47 |
<?php endif; ?>
|
48 |
</div>
|
49 |
-
|
50 |
-
<div class="learn-press-progress lp-course-progress <?php echo $course_data->is_passed() ? ' passed' : ''; ?>" data-value="<?php echo $course_results['result']; ?>" data-passing-condition="<?php echo $passing_condition; ?>">
|
51 |
-
<div class="progress-bg lp-progress-bar">
|
52 |
-
<div class="progress-active lp-progress-value" style="left: <?php echo esc_attr( $course_results['result'] ); ?>%;"></div>
|
53 |
-
</div>
|
54 |
-
<div class="lp-passing-conditional" data-content="<?php printf( esc_html__( 'Passing condition: %s%%', 'learnpress' ), $passing_condition ); ?>" style="left: <?php echo esc_attr( $passing_condition ); ?>%;"></div>
|
55 |
-
</div>
|
56 |
</div>
|
57 |
</div>
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* @author Thimpress
|
4 |
+
* @version 1.0.1
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! isset( $user ) || ! isset( $course ) || ! isset( $course_result ) || ! isset( $course_data ) ) {
|
8 |
+
return;
|
9 |
+
}
|
10 |
+
|
11 |
$passing_condition = $course->get_passing_condition();
|
12 |
+
/*$completed_percent = 0;
|
13 |
+
|
14 |
+
if ( isset( $course_result['count_items'] ) && isset( $course_result['completed_items'] )
|
15 |
+
&& $course_result['count_items'] > 0 ) {
|
16 |
+
$completed_percent = round( $course_result['completed_items'] * 100 / $course_result['count_items'], 2 );
|
17 |
+
}*/
|
18 |
+
|
19 |
?>
|
20 |
|
21 |
<div class="course-results-progress">
|
27 |
<h4 class="lp-course-progress-heading"><?php echo esc_html__( 'Items completed:', 'learnpress' ); ?></h4>
|
28 |
<?php endif; ?>
|
29 |
|
30 |
+
<span class="number"><?php printf( __( '%1$d of %2$d items', 'learnpress' ), $course_result['completed_items'] ?? 0, $course->count_items() ); ?></span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</div>
|
32 |
|
33 |
<div class="course-progress lp-progress-row">
|
42 |
|
43 |
<div class="lp-course-status">
|
44 |
<span class="number">
|
45 |
+
<?php echo round( $course_result['result'], 2 ); ?>
|
46 |
<span class="percentage-sign">%</span>
|
47 |
</span>
|
48 |
|
53 |
</span>
|
54 |
<?php endif; ?>
|
55 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
</div>
|
57 |
</div>
|
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package LearnPress/Views
|
7 |
-
* @version 4.0.
|
8 |
*/
|
9 |
|
10 |
defined( 'ABSPATH' ) || die;
|
@@ -13,9 +13,15 @@ if ( ! isset( $user_id ) ) {
|
|
13 |
return;
|
14 |
}
|
15 |
|
16 |
-
$profile
|
17 |
-
$user
|
18 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
?>
|
20 |
|
21 |
<div class="lp-admin-profile-courses">
|
@@ -41,12 +47,15 @@ $query = $profile->query_courses( 'purchased' );
|
|
41 |
<tbody>
|
42 |
<?php foreach ( $course_ids as $course_id ) : ?>
|
43 |
<?php
|
44 |
-
$course_id
|
45 |
-
$course
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$
|
|
|
|
|
|
|
50 |
?>
|
51 |
|
52 |
<tr>
|
@@ -84,11 +93,8 @@ $query = $profile->query_courses( 'purchased' );
|
|
84 |
$label_class[] = 'warning';
|
85 |
}
|
86 |
break;
|
87 |
-
case 'enrolled':
|
88 |
-
$icon = '<i class="far fa-check-circle"></i>';
|
89 |
-
$label_class[] = 'warning';
|
90 |
-
break;
|
91 |
case 'in-progress':
|
|
|
92 |
$icon = '<i class="far fa-check-circle"></i>';
|
93 |
$label_class[] = 'warning';
|
94 |
break;
|
@@ -107,7 +113,7 @@ $query = $profile->query_courses( 'purchased' );
|
|
107 |
</td>
|
108 |
|
109 |
<td class="manage-column column-results">
|
110 |
-
<?php learn_press_admin_view( 'user/course-progress', compact( 'user', 'course' ) ); ?>
|
111 |
</td>
|
112 |
</tr>
|
113 |
<?php endforeach; ?>
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package LearnPress/Views
|
7 |
+
* @version 4.0.1
|
8 |
*/
|
9 |
|
10 |
defined( 'ABSPATH' ) || die;
|
13 |
return;
|
14 |
}
|
15 |
|
16 |
+
$profile = LP_Profile::instance( $user_id );
|
17 |
+
$user = $profile->get_user();
|
18 |
+
$slug_profile_courses = LP()->settings()->get( 'profile_endpoints.courses', 'courses' );
|
19 |
+
$link_user_profile = add_query_arg( [ 'tab' => 'enrolled' ], learn_press_user_profile_link( $user_id ) . $slug_profile_courses );
|
20 |
+
echo wp_sprintf( '<p><b>%s</b> <a href="%s" target="_blank">%s</a></p>', __( 'Course list of user enrolled', 'learnpress' ), $link_user_profile, __( 'View', 'learnpress' ) );
|
21 |
+
|
22 |
+
return;
|
23 |
+
|
24 |
+
$query = $profile->query_courses( 'purchased' );
|
25 |
?>
|
26 |
|
27 |
<div class="lp-admin-profile-courses">
|
47 |
<tbody>
|
48 |
<?php foreach ( $course_ids as $course_id ) : ?>
|
49 |
<?php
|
50 |
+
$course_id = absint( $course_id->get_id() );
|
51 |
+
$course = learn_press_get_course( $course_id );
|
52 |
+
if ( ! $course ) {
|
53 |
+
continue;
|
54 |
+
}
|
55 |
+
$course_data = $user->get_course_data( $course_id );
|
56 |
+
$course_result = $course_data->get_result();
|
57 |
+
$status = $course_result['status'];
|
58 |
+
$grade = $course_data->get_graduation_text();
|
59 |
?>
|
60 |
|
61 |
<tr>
|
93 |
$label_class[] = 'warning';
|
94 |
}
|
95 |
break;
|
|
|
|
|
|
|
|
|
96 |
case 'in-progress':
|
97 |
+
case 'enrolled':
|
98 |
$icon = '<i class="far fa-check-circle"></i>';
|
99 |
$label_class[] = 'warning';
|
100 |
break;
|
113 |
</td>
|
114 |
|
115 |
<td class="manage-column column-results">
|
116 |
+
<?php learn_press_admin_view( 'user/course-progress', compact( 'user', 'course', 'course_result' ) ); ?>
|
117 |
</td>
|
118 |
</tr>
|
119 |
<?php endforeach; ?>
|
@@ -40,7 +40,11 @@ if ( ! class_exists( 'LP_Background_Single_Course' ) ) {
|
|
40 |
|
41 |
$course_id = (int) $_POST['course_id'];
|
42 |
|
43 |
-
$this->lp_course =
|
|
|
|
|
|
|
|
|
44 |
|
45 |
switch ( LP_Helper::sanitize_params_submitted( $_POST['handle_name'] ) ) {
|
46 |
case 'save_post':
|
@@ -63,17 +67,67 @@ if ( ! class_exists( 'LP_Background_Single_Course' ) ) {
|
|
63 |
$lp_course_db = $this->lp_course_db;
|
64 |
$lp_course = $this->lp_course;
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
-
// Check user is Instructor and enable review post of Instructor
|
77 |
$user = learn_press_get_current_user();
|
78 |
$required_review = LP_Settings::get_option( 'required_review', 'yes' ) === 'yes';
|
79 |
|
@@ -87,14 +141,6 @@ if ( ! class_exists( 'LP_Background_Single_Course' ) ) {
|
|
87 |
);
|
88 |
}
|
89 |
// End
|
90 |
-
|
91 |
-
// Clear cache
|
92 |
-
$lp_course_cache = LP_Course_Cache::instance();
|
93 |
-
$key_cache_arr = [];
|
94 |
-
foreach ( $key_cache_arr as $key_cache ) {
|
95 |
-
$lp_course_cache->clear( $key_cache );
|
96 |
-
}
|
97 |
-
// End
|
98 |
}
|
99 |
|
100 |
/**
|
40 |
|
41 |
$course_id = (int) $_POST['course_id'];
|
42 |
|
43 |
+
$this->lp_course = learn_press_get_course( $course_id );
|
44 |
+
|
45 |
+
if ( empty( $this->lp_course ) ) {
|
46 |
+
return;
|
47 |
+
}
|
48 |
|
49 |
switch ( LP_Helper::sanitize_params_submitted( $_POST['handle_name'] ) ) {
|
50 |
case 'save_post':
|
67 |
$lp_course_db = $this->lp_course_db;
|
68 |
$lp_course = $this->lp_course;
|
69 |
|
70 |
+
$this->save_extra_info();
|
71 |
+
|
72 |
+
$this->review_post_author();
|
73 |
+
|
74 |
+
// Clear cache
|
75 |
+
$lp_course_cache = LP_Course_Cache::instance();
|
76 |
+
$key_cache_arr = [];
|
77 |
+
foreach ( $key_cache_arr as $key_cache ) {
|
78 |
+
$lp_course_cache->clear( $key_cache );
|
79 |
+
}
|
80 |
+
// End
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Save Extra info of course
|
85 |
+
*
|
86 |
+
* @author tungnx
|
87 |
+
* @since 4.1.4.1
|
88 |
+
* @version 1.0.0
|
89 |
+
*/
|
90 |
+
protected function save_extra_info() {
|
91 |
+
$lp_course_db = $this->lp_course_db;
|
92 |
+
$lp_course = $this->lp_course;
|
93 |
+
$lp_course_cache = LP_Course_Cache::instance();
|
94 |
+
$course_id = $lp_course->get_id();
|
95 |
|
96 |
+
try {
|
97 |
+
$extra_info = $this->lp_course->get_info_extra_for_fast_query();
|
98 |
+
|
99 |
+
// Get and set first item id
|
100 |
+
// Clean cache
|
101 |
+
$key_cache_first_item_id = "$course_id/first_item_id";
|
102 |
+
$lp_course_cache->clear( $key_cache_first_item_id );
|
103 |
+
$first_item_id = $lp_course_db->get_first_item_id( $lp_course->get_id() );
|
104 |
+
$extra_info->first_item_id = $first_item_id;
|
105 |
+
|
106 |
+
// Get and set total items courses
|
107 |
+
// Clean cache
|
108 |
+
$key_cache_total_items = "$course_id/total_items";
|
109 |
+
$lp_course_cache->clear( $key_cache_total_items );
|
110 |
+
$total_items = $lp_course_db->get_total_items( $lp_course->get_id() );
|
111 |
+
$extra_info->total_items = $total_items;
|
112 |
+
|
113 |
+
// Save post meta
|
114 |
+
$lp_course->set_info_extra_for_fast_query( $extra_info );
|
115 |
+
// End set first item id
|
116 |
+
} catch ( Throwable $e ) {
|
117 |
+
error_log( $e->getMessage() );
|
118 |
+
}
|
119 |
+
}
|
120 |
|
121 |
+
/**
|
122 |
+
* Check user is Instructor and enable review post of Instructor
|
123 |
+
*
|
124 |
+
* @author tungnx
|
125 |
+
* @since 4.1.4.1
|
126 |
+
* @version 1.0.0
|
127 |
+
*/
|
128 |
+
protected function review_post_author() {
|
129 |
+
$lp_course = $this->lp_course;
|
130 |
|
|
|
131 |
$user = learn_press_get_current_user();
|
132 |
$required_review = LP_Settings::get_option( 'required_review', 'yes' ) === 'yes';
|
133 |
|
141 |
);
|
142 |
}
|
143 |
// End
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
}
|
145 |
|
146 |
/**
|
@@ -5,7 +5,7 @@
|
|
5 |
*
|
6 |
* @author tungnx
|
7 |
* @since 4.0.8
|
8 |
-
* @version 1.0.
|
9 |
*/
|
10 |
defined( 'ABSPATH' ) || exit();
|
11 |
|
@@ -50,8 +50,8 @@ class LP_Cache {
|
|
50 |
* $expire = -1 is get default expire time on one day(DAY_IN_SECONDS)
|
51 |
*
|
52 |
* @param string $key
|
53 |
-
* @param mixed
|
54 |
-
* @param int
|
55 |
*/
|
56 |
public function set_cache( string $key, $data, int $expire = -1 ) {
|
57 |
if ( -1 === $expire ) {
|
@@ -70,6 +70,35 @@ class LP_Cache {
|
|
70 |
return wp_cache_get( $key, $this->key_group );
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
/**
|
74 |
* Clear cache by key
|
75 |
*
|
5 |
*
|
6 |
* @author tungnx
|
7 |
* @since 4.0.8
|
8 |
+
* @version 1.0.2
|
9 |
*/
|
10 |
defined( 'ABSPATH' ) || exit();
|
11 |
|
50 |
* $expire = -1 is get default expire time on one day(DAY_IN_SECONDS)
|
51 |
*
|
52 |
* @param string $key
|
53 |
+
* @param mixed $data
|
54 |
+
* @param int $expire
|
55 |
*/
|
56 |
public function set_cache( string $key, $data, int $expire = -1 ) {
|
57 |
if ( -1 === $expire ) {
|
70 |
return wp_cache_get( $key, $this->key_group );
|
71 |
}
|
72 |
|
73 |
+
/**
|
74 |
+
* Set value for first load page on one process
|
75 |
+
* Apply for query call same
|
76 |
+
*
|
77 |
+
* @param string $type
|
78 |
+
* @param string $key
|
79 |
+
* @param $val mixed
|
80 |
+
*
|
81 |
+
* @author tungnx
|
82 |
+
* @version 1.0.0
|
83 |
+
* @sicne 4.1.4.1
|
84 |
+
* @return false|mixed|string
|
85 |
+
*/
|
86 |
+
public static function cache_load_first( string $type = 'get', string $key = '', $val = '' ) {
|
87 |
+
static $first_set_value = array();
|
88 |
+
|
89 |
+
if ( 'get' === $type ) {
|
90 |
+
if ( ! array_key_exists( $key, $first_set_value ) ) {
|
91 |
+
return false;
|
92 |
+
} else {
|
93 |
+
return $first_set_value[ $key ];
|
94 |
+
}
|
95 |
+
} elseif ( 'set' === $type ) {
|
96 |
+
$first_set_value[ $key ] = $val;
|
97 |
+
|
98 |
+
return $first_set_value[ $key ];
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
/**
|
103 |
* Clear cache by key
|
104 |
*
|
@@ -15,7 +15,7 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
|
|
15 |
'checkout:nopriv',
|
16 |
'complete-lesson',
|
17 |
'finish-course', // finish_course.
|
18 |
-
//'retake-course', // retake_course.
|
19 |
'external-link:nopriv',
|
20 |
'save-uploaded-user-avatar',
|
21 |
'load-more-courses',
|
@@ -254,11 +254,14 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
|
|
254 |
wp_die( __( 'Access denied!', 'learnpress' ) );
|
255 |
}
|
256 |
|
257 |
-
$finished
|
|
|
|
|
|
|
258 |
$response = array(
|
259 |
'redirect' => apply_filters(
|
260 |
'learn-press/finish-course-redirect',
|
261 |
-
|
262 |
$course_id
|
263 |
),
|
264 |
);
|
@@ -340,7 +343,8 @@ if ( ! class_exists( 'LP_AJAX' ) ) {
|
|
340 |
*
|
341 |
* @TODO move this function to API
|
342 |
*/
|
343 |
-
/*
|
|
|
344 |
$security = LP_Request::get_string( 'retake-course-nonce' );
|
345 |
$course_id = LP_Request::get_int( 'retake-course' );
|
346 |
$user = learn_press_get_current_user();
|
15 |
'checkout:nopriv',
|
16 |
'complete-lesson',
|
17 |
'finish-course', // finish_course.
|
18 |
+
// 'retake-course', // retake_course.
|
19 |
'external-link:nopriv',
|
20 |
'save-uploaded-user-avatar',
|
21 |
'load-more-courses',
|
254 |
wp_die( __( 'Access denied!', 'learnpress' ) );
|
255 |
}
|
256 |
|
257 |
+
$finished = $user->finish_course( $course_id );
|
258 |
+
$lp_redirect = LP_Settings::get_option( 'course_finish_redirect' );
|
259 |
+
$redirect = ! empty( $lp_redirect ) ? $lp_redirect : get_the_permalink( $course_id );
|
260 |
+
|
261 |
$response = array(
|
262 |
'redirect' => apply_filters(
|
263 |
'learn-press/finish-course-redirect',
|
264 |
+
$redirect,
|
265 |
$course_id
|
266 |
),
|
267 |
);
|
343 |
*
|
344 |
* @TODO move this function to API
|
345 |
*/
|
346 |
+
/*
|
347 |
+
public static function retake_course() {
|
348 |
$security = LP_Request::get_string( 'retake-course-nonce' );
|
349 |
$course_id = LP_Request::get_int( 'retake-course' );
|
350 |
$user = learn_press_get_current_user();
|
@@ -95,7 +95,7 @@ class LP_Assets extends LP_Abstract_Assets {
|
|
95 |
'redirecting' => esc_html__( 'Redirecting', 'learnpress' ),
|
96 |
'avatar_size' => learn_press_get_avatar_thumb_size(),
|
97 |
),
|
98 |
-
'lp-course' => learn_press_single_course_args(),
|
99 |
'lp-quiz' => learn_press_single_quiz_args(),
|
100 |
];
|
101 |
|
95 |
'redirecting' => esc_html__( 'Redirecting', 'learnpress' ),
|
96 |
'avatar_size' => learn_press_get_avatar_thumb_size(),
|
97 |
),
|
98 |
+
//'lp-course' => learn_press_single_course_args(),
|
99 |
'lp-quiz' => learn_press_single_quiz_args(),
|
100 |
];
|
101 |
|
@@ -92,7 +92,7 @@ class LP_Checkout {
|
|
92 |
public function __construct() {
|
93 |
add_filter( 'learn-press/validate-checkout-field', array( $this, 'validate_fields' ), 10, 3 );
|
94 |
add_filter( 'learn-press/validate-checkout-fields', array( $this, 'check_validate_fields' ), 10, 3 );
|
95 |
-
add_filter( 'learn-press/payment-successful-result', array( $this, 'process_customer' ), 10, 2 );
|
96 |
|
97 |
$this->_checkout_email = LP()->session->get( 'checkout-email' );
|
98 |
}
|
@@ -104,8 +104,10 @@ class LP_Checkout {
|
|
104 |
* @param int $order_id
|
105 |
*
|
106 |
* @return mixed
|
|
|
|
|
107 |
*/
|
108 |
-
public function process_customer( $result, $order_id ) {
|
109 |
try {
|
110 |
if ( ! $this->is_enable_guest_checkout() ) {
|
111 |
throw new Exception( '' );
|
@@ -147,7 +149,7 @@ class LP_Checkout {
|
|
147 |
}
|
148 |
|
149 |
return $result;
|
150 |
-
}
|
151 |
|
152 |
/**
|
153 |
* @return int|WP_Error
|
@@ -376,10 +378,36 @@ class LP_Checkout {
|
|
376 |
do_action( 'learn-press/checkout/new-order', $order_id );
|
377 |
}
|
378 |
|
|
|
379 |
if ( is_user_logged_in() ) {
|
380 |
$user_id = get_current_user_id();
|
381 |
} else {
|
382 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
}
|
384 |
|
385 |
$order->set_customer_note( $this->order_comment );
|
92 |
public function __construct() {
|
93 |
add_filter( 'learn-press/validate-checkout-field', array( $this, 'validate_fields' ), 10, 3 );
|
94 |
add_filter( 'learn-press/validate-checkout-fields', array( $this, 'check_validate_fields' ), 10, 3 );
|
95 |
+
//add_filter( 'learn-press/payment-successful-result', array( $this, 'process_customer' ), 10, 2 );
|
96 |
|
97 |
$this->_checkout_email = LP()->session->get( 'checkout-email' );
|
98 |
}
|
104 |
* @param int $order_id
|
105 |
*
|
106 |
* @return mixed
|
107 |
+
* @editor tungnx
|
108 |
+
* @modify 4.1.4 - merge to function create_order
|
109 |
*/
|
110 |
+
/*public function process_customer( $result, $order_id ) {
|
111 |
try {
|
112 |
if ( ! $this->is_enable_guest_checkout() ) {
|
113 |
throw new Exception( '' );
|
149 |
}
|
150 |
|
151 |
return $result;
|
152 |
+
}*/
|
153 |
|
154 |
/**
|
155 |
* @return int|WP_Error
|
378 |
do_action( 'learn-press/checkout/new-order', $order_id );
|
379 |
}
|
380 |
|
381 |
+
$user_id = 0;
|
382 |
if ( is_user_logged_in() ) {
|
383 |
$user_id = get_current_user_id();
|
384 |
} else {
|
385 |
+
$checkout_option = isset( $_POST['checkout-email-option'] ) ? LP_Helper::sanitize_params_submitted( $_POST['checkout-email-option'] ) : '';
|
386 |
+
|
387 |
+
// Create new user if buy with Guest and tick "Create new Account"
|
388 |
+
if ( $checkout_option === 'new-account' ) {
|
389 |
+
if ( $this->checkout_email_exists() ) {
|
390 |
+
throw new Exception( 'NEW ACCOUNT EMAIL IS EXISTED', 0 );
|
391 |
+
}
|
392 |
+
|
393 |
+
$order->set_meta( '_create_account', 'yes' );
|
394 |
+
|
395 |
+
$user_id = $this->_create_account();
|
396 |
+
|
397 |
+
if ( ! is_wp_error( $user_id ) ) {
|
398 |
+
wp_new_user_notification( $user_id, null, apply_filters( 'learn-press/email-create-new-user-when-checkout', 'user' ) );
|
399 |
+
}
|
400 |
+
} else { // Set user id for Order if buy with Guest and email exists on the user
|
401 |
+
$user = get_user_by( 'email', $this->get_checkout_email() );
|
402 |
+
|
403 |
+
if ( $order->is_guest() && $user ) {
|
404 |
+
$user_id = $user->ID;
|
405 |
+
}
|
406 |
+
}
|
407 |
+
|
408 |
+
if ( $user_id ) {
|
409 |
+
$order->set_user_id( $user_id );
|
410 |
+
}
|
411 |
}
|
412 |
|
413 |
$order->set_customer_note( $this->order_comment );
|
@@ -121,6 +121,9 @@ class LP_Global {
|
|
121 |
* @return LP_User|LP_User_Guest|false
|
122 |
*/
|
123 |
public static function user() {
|
|
|
|
|
|
|
124 |
global $lp_user;
|
125 |
|
126 |
return $lp_user;
|
121 |
* @return LP_User|LP_User_Guest|false
|
122 |
*/
|
123 |
public static function user() {
|
124 |
+
/**
|
125 |
+
* @see learn_press_setup_user
|
126 |
+
*/
|
127 |
global $lp_user;
|
128 |
|
129 |
return $lp_user;
|
@@ -244,11 +244,15 @@ class LP_Page_Controller {
|
|
244 |
* @var WP_Query $wp_query
|
245 |
* @var LP_Course $lp_course
|
246 |
* @var LP_Course_Item|LP_Quiz|LP_Lesson $lp_course_item
|
247 |
-
* @var LP_Question $lp_quiz_question
|
248 |
*/
|
249 |
-
global $wp, $wp_query, $lp_course, $lp_course_item
|
250 |
|
251 |
-
if ( LP_COURSE_CPT !==
|
|
|
|
|
|
|
|
|
|
|
252 |
return $post;
|
253 |
}
|
254 |
|
@@ -256,34 +260,28 @@ class LP_Page_Controller {
|
|
256 |
$GLOBALS['preview_course'] = $post->ID;
|
257 |
}
|
258 |
|
259 |
-
if ( !
|
260 |
return $post;
|
261 |
-
}
|
262 |
|
263 |
-
|
264 |
-
$vars
|
265 |
|
266 |
if ( empty( $vars['course-item'] ) ) {
|
267 |
-
return false;
|
268 |
-
}
|
269 |
-
|
270 |
-
if ( ! $wp_query->is_main_query() ) {
|
271 |
return $post;
|
272 |
}
|
273 |
|
274 |
-
if ( $wp_query->
|
275 |
return $post;
|
276 |
}
|
277 |
|
278 |
try {
|
279 |
-
|
280 |
// If item name is set in query vars
|
281 |
if ( ! is_numeric( $vars['course-item'] ) ) {
|
282 |
$item_type = $vars['item-type'];
|
283 |
$post_item = learn_press_get_post_by_name( $vars['course-item'], $item_type );
|
284 |
} else {
|
285 |
$post_item = get_post( absint( $vars['course-item'] ) );
|
286 |
-
$item_type = $post->post_type;
|
287 |
}
|
288 |
|
289 |
if ( ! $post_item ) {
|
@@ -296,85 +294,7 @@ class LP_Page_Controller {
|
|
296 |
return $post;
|
297 |
}
|
298 |
|
299 |
-
$user = learn_press_get_current_user();
|
300 |
-
|
301 |
-
/**
|
302 |
-
* @editor tungnx
|
303 |
-
* @reason not use
|
304 |
-
* @deprecated 3.2.7.5
|
305 |
-
*/
|
306 |
-
/*
|
307 |
-
if ( false === $user->can_view_item( $lp_course_item->get_id() ) && ! $user->get_item_url( $lp_course_item->get_id() ) ) {
|
308 |
-
if ( false !== ( $redirect = apply_filters( 'learn-press/redirect-forbidden-access-item-url', $lp_course->get_permalink() ) ) ) {
|
309 |
-
wp_redirect( $redirect );
|
310 |
-
exit();
|
311 |
-
}
|
312 |
-
}*/
|
313 |
-
|
314 |
$lp_course->set_viewing_item( $lp_course_item );
|
315 |
-
|
316 |
-
// If item viewing is a QUIZ and have a question...
|
317 |
-
if ( LP_QUIZ_CPT === $item_type ) {
|
318 |
-
/*
|
319 |
-
$question = false;
|
320 |
-
|
321 |
-
// If has question in request but it seems the question does not exists
|
322 |
-
$question = learn_press_get_post_by_name( $vars['question'], LP_QUESTION_CPT );
|
323 |
-
if ( ! empty( $vars['question'] ) && ! $question ) {
|
324 |
-
$this->set_404( true );
|
325 |
-
throw new Exception( '404' );
|
326 |
-
}
|
327 |
-
|
328 |
-
// If we are requesting to a question but current quiz does not contain it
|
329 |
-
if ( $question && ! $lp_course_item->has_question( $question->ID ) ) {
|
330 |
-
$this->set_404( true );
|
331 |
-
throw new Exception( '404' );
|
332 |
-
}
|
333 |
-
|
334 |
-
$quiz_data = $user->get_quiz_data( $post_item->ID, $lp_course->get_id() );
|
335 |
-
$redirect = false;
|
336 |
-
$quiz_status = $quiz_data ? $quiz_data->get_status() : false;*/
|
337 |
-
|
338 |
-
// if ( $quiz_status == 'started' ) {
|
339 |
-
// $current_question = 0;
|
340 |
-
// if ( empty( $vars['question'] ) ) {
|
341 |
-
// $current_question = learn_press_get_user_item_meta( $quiz_data->get_user_item_id(), '_current_question', true );
|
342 |
-
// } elseif ( $question ) {
|
343 |
-
// $current_question = $question->ID;
|
344 |
-
// }
|
345 |
-
//
|
346 |
-
// if ( $current_question && ! $lp_course_item->has_question( $current_question ) ) {
|
347 |
-
// $this->set_404( true );
|
348 |
-
// throw new Exception( '404' );
|
349 |
-
// }
|
350 |
-
//
|
351 |
-
// if ( ! $current_question ) {
|
352 |
-
// $current_question = $lp_course_item->get_question_at( 0 );
|
353 |
-
// learn_press_update_user_item_meta( $quiz_data->get_user_item_id(), '_current_question', $current_question );
|
354 |
-
// }
|
355 |
-
//
|
356 |
-
// if ( ! $question && $current_question ) {
|
357 |
-
// $redirect = $lp_course_item->get_question_link( $current_question );
|
358 |
-
// }
|
359 |
-
// } elseif ( $quiz_status === 'completed' ) {
|
360 |
-
// $current_question = $question ? $question->ID : null;
|
361 |
-
// } elseif ( $quiz_status !== 'completed' ) {
|
362 |
-
// if ( $question ) {
|
363 |
-
// $this->set_404( true );
|
364 |
-
// throw new Exception( '404' );
|
365 |
-
// }
|
366 |
-
// }
|
367 |
-
//
|
368 |
-
// if ( isset( $current_question ) && $current_question ) {
|
369 |
-
// $lp_quiz_question = learn_press_get_question( $current_question );
|
370 |
-
// }
|
371 |
-
|
372 |
-
// if ( $redirect ) {
|
373 |
-
// var_dump($redirect);
|
374 |
-
// wp_redirect( $redirect );
|
375 |
-
// exit();
|
376 |
-
// }
|
377 |
-
}
|
378 |
} catch ( Exception $ex ) {
|
379 |
learn_press_add_message( $ex->getMessage(), 'error' );
|
380 |
}
|
244 |
* @var WP_Query $wp_query
|
245 |
* @var LP_Course $lp_course
|
246 |
* @var LP_Course_Item|LP_Quiz|LP_Lesson $lp_course_item
|
|
|
247 |
*/
|
248 |
+
global $wp, $wp_query, $lp_course, $lp_course_item;
|
249 |
|
250 |
+
if ( LP_COURSE_CPT !== $post->post_type ) {
|
251 |
+
return $post;
|
252 |
+
}
|
253 |
+
|
254 |
+
$course = learn_press_get_course( $post->ID );
|
255 |
+
if ( ! $course ) {
|
256 |
return $post;
|
257 |
}
|
258 |
|
260 |
$GLOBALS['preview_course'] = $post->ID;
|
261 |
}
|
262 |
|
263 |
+
/*if ( ! array_key_exists( $post->ID, $courses ) ) {
|
264 |
return $post;
|
265 |
+
}*/
|
266 |
|
267 |
+
//$courses[ $post->ID ] = true;
|
268 |
+
$vars = $wp->query_vars;
|
269 |
|
270 |
if ( empty( $vars['course-item'] ) ) {
|
|
|
|
|
|
|
|
|
271 |
return $post;
|
272 |
}
|
273 |
|
274 |
+
if ( ! $wp_query->is_main_query() ) {
|
275 |
return $post;
|
276 |
}
|
277 |
|
278 |
try {
|
|
|
279 |
// If item name is set in query vars
|
280 |
if ( ! is_numeric( $vars['course-item'] ) ) {
|
281 |
$item_type = $vars['item-type'];
|
282 |
$post_item = learn_press_get_post_by_name( $vars['course-item'], $item_type );
|
283 |
} else {
|
284 |
$post_item = get_post( absint( $vars['course-item'] ) );
|
|
|
285 |
}
|
286 |
|
287 |
if ( ! $post_item ) {
|
294 |
return $post;
|
295 |
}
|
296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
$lp_course->set_viewing_item( $lp_course_item );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
} catch ( Exception $ex ) {
|
299 |
learn_press_add_message( $ex->getMessage(), 'error' );
|
300 |
}
|
@@ -26,14 +26,14 @@ class LP_Repair_Database {
|
|
26 |
* @access protected
|
27 |
*/
|
28 |
protected function __construct() {
|
29 |
-
add_action( 'save_post', array( $this, 'save_post' ), 0 );
|
30 |
// add_action( 'deleted_post', array( $this, 'save_post' ), 0 );
|
31 |
// add_action( 'learn-press/added-item-to-section', array( $this, 'added_item_to_section' ), 5000, 3 );
|
32 |
// add_action( 'learn-press/removed-item-from-section', array( $this, 'removed_item_from_course' ), 5000, 2 );
|
33 |
-
add_action( 'learn-press/save-course', array( $this, 'save_course' ), 5000, 1 );
|
34 |
-
add_action( 'learn-press/added-course-item', array( $this, 'added_course_item' ), 10, 2 );
|
35 |
-
add_action( 'learn-press/removed-course-item', array( $this, 'removed_course_item' ), 10 );
|
36 |
-
add_action( 'learn-press/transition-course-item-status', array( $this, 'transition_course_item_status' ), 10, 4 );
|
37 |
|
38 |
//add_action( 'before_delete_post', array( $this, 'before_delete_post' ) );
|
39 |
// add_action( 'deleted_post', array( $this, 'deleted_post' ) );
|
@@ -502,36 +502,52 @@ class LP_Repair_Database {
|
|
502 |
return true;
|
503 |
}*/
|
504 |
|
505 |
-
|
|
|
|
|
|
|
|
|
506 |
$this->sync_course_data( $course_id );
|
507 |
-
}
|
508 |
|
509 |
-
|
|
|
|
|
|
|
|
|
510 |
$this->sync_course_data( $course_id );
|
511 |
-
}
|
512 |
|
513 |
/**
|
514 |
* @param int $item_id
|
515 |
* @param int $course_id
|
|
|
|
|
516 |
*/
|
517 |
-
public function added_course_item( $item_id, $course_id ) {
|
518 |
$this->sync_course_data( $course_id );
|
519 |
-
}
|
520 |
|
521 |
/**
|
522 |
* @param int $item_id
|
523 |
* @param int $course_id
|
|
|
|
|
524 |
*/
|
525 |
-
public function removed_item_from_course( $item_id, $course_id ) {
|
526 |
$this->sync_course_data( $course_id );
|
527 |
-
}
|
528 |
|
529 |
-
|
|
|
|
|
|
|
|
|
530 |
if ( $old === $new ) {
|
531 |
return;
|
532 |
}
|
533 |
$this->sync_course_data( $course_id );
|
534 |
-
}
|
535 |
|
536 |
/**
|
537 |
* @editor tungnx
|
@@ -601,40 +617,42 @@ class LP_Repair_Database {
|
|
601 |
|
602 |
/**
|
603 |
* @param int $post_id
|
|
|
|
|
604 |
*/
|
605 |
-
public function save_post( $post_id ) {
|
606 |
-
global $wpdb;
|
607 |
-
$post_type = get_post_type( $post_id );
|
608 |
-
$course_curd = new LP_Course_CURD();
|
609 |
-
|
610 |
-
switch ( $post_type ) {
|
611 |
-
/*case LP_ORDER_CPT:
|
612 |
-
$order = learn_press_get_order( $post_id );
|
613 |
-
if ( $order ) {
|
614 |
-
$user_ids = $order->get_users();
|
615 |
-
$course_ids = $order->get_item_ids();
|
616 |
-
|
617 |
-
//$this->sync_course_orders( $course_ids );
|
618 |
-
//$this->sync_user_orders( $user_ids );
|
619 |
-
}
|
620 |
-
|
621 |
-
break;*/
|
622 |
-
case LP_COURSE_CPT: //Todo: tungnx should review code to rewrite
|
623 |
-
default:
|
624 |
-
// Course is support type of this item?
|
625 |
-
if ( learn_press_is_support_course_item_type( $post_type ) ) {
|
626 |
-
|
627 |
-
// Find it course
|
628 |
-
$course_ids = $course_curd->get_course_by_item( $post_id );
|
629 |
-
} else {
|
630 |
-
$course_ids = array( $post_id );
|
631 |
-
}
|
632 |
-
|
633 |
-
foreach ( $course_ids as $course_id ) {
|
634 |
-
$this->sync_course_data( $course_id );
|
635 |
-
}
|
636 |
-
}
|
637 |
-
}
|
638 |
|
639 |
/**
|
640 |
* Sync course data when saving post.
|
@@ -644,7 +662,7 @@ class LP_Repair_Database {
|
|
644 |
* @version 3.1.1
|
645 |
* @since 3.1.0
|
646 |
*/
|
647 |
-
public function sync_course_data( int $course_id ) {
|
648 |
$user_curd = new LP_User_CURD();
|
649 |
$course_curd = new LP_Course_CURD();
|
650 |
|
@@ -655,7 +673,7 @@ class LP_Repair_Database {
|
|
655 |
}
|
656 |
|
657 |
update_post_meta( $course_id, 'count_items', $count_items );
|
658 |
-
}
|
659 |
|
660 |
/**
|
661 |
* Sync all
|
26 |
* @access protected
|
27 |
*/
|
28 |
protected function __construct() {
|
29 |
+
//add_action( 'save_post', array( $this, 'save_post' ), 0 );
|
30 |
// add_action( 'deleted_post', array( $this, 'save_post' ), 0 );
|
31 |
// add_action( 'learn-press/added-item-to-section', array( $this, 'added_item_to_section' ), 5000, 3 );
|
32 |
// add_action( 'learn-press/removed-item-from-section', array( $this, 'removed_item_from_course' ), 5000, 2 );
|
33 |
+
//add_action( 'learn-press/save-course', array( $this, 'save_course' ), 5000, 1 );
|
34 |
+
//add_action( 'learn-press/added-course-item', array( $this, 'added_course_item' ), 10, 2 );
|
35 |
+
//add_action( 'learn-press/removed-course-item', array( $this, 'removed_course_item' ), 10 );
|
36 |
+
//add_action( 'learn-press/transition-course-item-status', array( $this, 'transition_course_item_status' ), 10, 4 );
|
37 |
|
38 |
//add_action( 'before_delete_post', array( $this, 'before_delete_post' ) );
|
39 |
// add_action( 'deleted_post', array( $this, 'deleted_post' ) );
|
502 |
return true;
|
503 |
}*/
|
504 |
|
505 |
+
/**
|
506 |
+
* @editor tungnx
|
507 |
+
* @modify 4.1.4.1 - comment - not use
|
508 |
+
*/
|
509 |
+
/*public function save_course( $course_id ) {
|
510 |
$this->sync_course_data( $course_id );
|
511 |
+
}*/
|
512 |
|
513 |
+
/**
|
514 |
+
* @editor tungnx
|
515 |
+
* @modify 4.1.4.1 - comment - not use
|
516 |
+
*/
|
517 |
+
/*public function removed_course_item( $course_id ) {
|
518 |
$this->sync_course_data( $course_id );
|
519 |
+
}*/
|
520 |
|
521 |
/**
|
522 |
* @param int $item_id
|
523 |
* @param int $course_id
|
524 |
+
* @editor tungnx
|
525 |
+
* @modify 4.1.4.1 - comment - not use
|
526 |
*/
|
527 |
+
/*public function added_course_item( $item_id, $course_id ) {
|
528 |
$this->sync_course_data( $course_id );
|
529 |
+
}*/
|
530 |
|
531 |
/**
|
532 |
* @param int $item_id
|
533 |
* @param int $course_id
|
534 |
+
* @editor tungnx
|
535 |
+
* @modify 4.1.4.1 - comment - not use
|
536 |
*/
|
537 |
+
/*public function removed_item_from_course( $item_id, $course_id ) {
|
538 |
$this->sync_course_data( $course_id );
|
539 |
+
}*/
|
540 |
|
541 |
+
/**
|
542 |
+
* @editor tungnx
|
543 |
+
* @modify 4.1.4.1 - comment - not use
|
544 |
+
*/
|
545 |
+
/*public function transition_course_item_status( $item_id, $course_id, $old, $new ) {
|
546 |
if ( $old === $new ) {
|
547 |
return;
|
548 |
}
|
549 |
$this->sync_course_data( $course_id );
|
550 |
+
}*/
|
551 |
|
552 |
/**
|
553 |
* @editor tungnx
|
617 |
|
618 |
/**
|
619 |
* @param int $post_id
|
620 |
+
* @editor tungnx
|
621 |
+
* @modify 4.1.4.1 - comment - not use
|
622 |
*/
|
623 |
+
// public function save_post( $post_id ) {
|
624 |
+
// global $wpdb;
|
625 |
+
// $post_type = get_post_type( $post_id );
|
626 |
+
// $course_curd = new LP_Course_CURD();
|
627 |
+
//
|
628 |
+
// switch ( $post_type ) {
|
629 |
+
// /*case LP_ORDER_CPT:
|
630 |
+
// $order = learn_press_get_order( $post_id );
|
631 |
+
// if ( $order ) {
|
632 |
+
// $user_ids = $order->get_users();
|
633 |
+
// $course_ids = $order->get_item_ids();
|
634 |
+
//
|
635 |
+
// //$this->sync_course_orders( $course_ids );
|
636 |
+
// //$this->sync_user_orders( $user_ids );
|
637 |
+
// }
|
638 |
+
//
|
639 |
+
// break;*/
|
640 |
+
// case LP_COURSE_CPT: //Todo: tungnx should review code to rewrite
|
641 |
+
// default:
|
642 |
+
// // Course is support type of this item?
|
643 |
+
// if ( learn_press_is_support_course_item_type( $post_type ) ) {
|
644 |
+
//
|
645 |
+
// // Find it course
|
646 |
+
// $course_ids = $course_curd->get_course_by_item( $post_id );
|
647 |
+
// } else {
|
648 |
+
// $course_ids = array( $post_id );
|
649 |
+
// }
|
650 |
+
//
|
651 |
+
// foreach ( $course_ids as $course_id ) {
|
652 |
+
// $this->sync_course_data( $course_id );
|
653 |
+
// }
|
654 |
+
// }
|
655 |
+
// }
|
656 |
|
657 |
/**
|
658 |
* Sync course data when saving post.
|
662 |
* @version 3.1.1
|
663 |
* @since 3.1.0
|
664 |
*/
|
665 |
+
/*public function sync_course_data( int $course_id ) {
|
666 |
$user_curd = new LP_User_CURD();
|
667 |
$course_curd = new LP_Course_CURD();
|
668 |
|
673 |
}
|
674 |
|
675 |
update_post_meta( $course_id, 'count_items', $count_items );
|
676 |
+
}*/
|
677 |
|
678 |
/**
|
679 |
* Sync all
|
@@ -56,7 +56,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
56 |
'students' => 0,
|
57 |
'retake_count' => 0,
|
58 |
'featured' => '',
|
59 |
-
'block_lesson_content' => '',
|
60 |
'course_result' => '',
|
61 |
'passing_conditional' => '',
|
62 |
'external_link' => '',
|
@@ -152,7 +152,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
152 |
'fake_students' => get_post_meta( $id, '_lp_students', true ),
|
153 |
'retake_count' => get_post_meta( $id, '_lp_retake_count', true ),
|
154 |
'featured' => get_post_meta( $id, '_lp_featured', true ),
|
155 |
-
'block_lesson_content' => get_post_meta( $id, '_lp_block_lesson_content', true ),
|
156 |
'course_result' => get_post_meta( $id, '_lp_course_result', true ),
|
157 |
'passing_condition' => get_post_meta( $id, '_lp_passing_condition', true ),
|
158 |
'final_quiz' => get_post_meta( $id, '_lp_final_quiz', true ),
|
@@ -395,15 +395,17 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
395 |
* Check if this course is required enroll or not.
|
396 |
*
|
397 |
* @param mixed
|
398 |
-
*
|
|
|
399 |
* @return bool
|
|
|
400 |
*/
|
401 |
-
public function is_no_required_enroll() {
|
402 |
$return = false;
|
403 |
if ( $this->get_data( 'no_required_enroll', 'no' ) == 'yes' && ! is_user_logged_in() ) {
|
404 |
$return = true;
|
405 |
}
|
406 |
-
return apply_filters( 'learn-press/course
|
407 |
}
|
408 |
|
409 |
/**
|
@@ -443,6 +445,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
443 |
*
|
444 |
* @return array
|
445 |
* @since 3.0.0
|
|
|
446 |
*/
|
447 |
public function get_items( $type = '', $preview = true ) {
|
448 |
$this->load();
|
@@ -1389,7 +1392,11 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1389 |
|
1390 |
}
|
1391 |
|
1392 |
-
|
|
|
|
|
|
|
|
|
1393 |
$items = $this->get_curriculum_items();
|
1394 |
$result = 0;
|
1395 |
|
@@ -1399,9 +1406,13 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1399 |
}
|
1400 |
|
1401 |
return apply_filters( 'learn_press_course_results_by_items', $result, $this->get_id(), $user_id );
|
1402 |
-
}
|
1403 |
|
1404 |
-
|
|
|
|
|
|
|
|
|
1405 |
$lessons = $this->get_items( LP_LESSON_CPT );
|
1406 |
$result = 0;
|
1407 |
|
@@ -1411,7 +1422,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1411 |
}
|
1412 |
|
1413 |
return apply_filters( 'learn_press_course_results_by_items', $result, $this->get_id(), $user_id );
|
1414 |
-
}
|
1415 |
|
1416 |
/**
|
1417 |
* Get achieved point of all quizzes per total points of all quizzes
|
@@ -1460,7 +1471,11 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1460 |
);
|
1461 |
}*/
|
1462 |
|
1463 |
-
|
|
|
|
|
|
|
|
|
1464 |
if ( ! $user_id ) {
|
1465 |
$user_id = get_current_user_id();
|
1466 |
}
|
@@ -1472,9 +1487,13 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1472 |
$user_id,
|
1473 |
$this->get_id()
|
1474 |
);
|
1475 |
-
}
|
1476 |
|
1477 |
-
|
|
|
|
|
|
|
|
|
1478 |
$quizzes = $this->get_items( LP_QUIZ_CPT );
|
1479 |
$user = learn_press_get_user( $user_id );
|
1480 |
$results = array();
|
@@ -1512,11 +1531,15 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1512 |
$this->get_id(),
|
1513 |
$user_id
|
1514 |
);
|
1515 |
-
}
|
1516 |
|
1517 |
-
|
|
|
|
|
|
|
|
|
1518 |
return $this->get_evaluation_results_method() == $thing;
|
1519 |
-
}
|
1520 |
|
1521 |
/**
|
1522 |
* Get number of lessons user has completed
|
@@ -1525,8 +1548,10 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1525 |
* @param bool $force
|
1526 |
*
|
1527 |
* @return int|mixed|null|void
|
|
|
|
|
1528 |
*/
|
1529 |
-
public function get_completed_lessons( $user_id, $force = false ) {
|
1530 |
$key = $user_id . '-' . $this->get_id();
|
1531 |
|
1532 |
$completed_lessons = LP_Cache::get_completed_lessons( false, array() );
|
@@ -1566,7 +1591,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1566 |
$this->get_id(),
|
1567 |
$user_id
|
1568 |
);
|
1569 |
-
}
|
1570 |
|
1571 |
|
1572 |
/**
|
@@ -1577,8 +1602,10 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1577 |
* @param string $type
|
1578 |
*
|
1579 |
* @return int|bool
|
|
|
|
|
1580 |
*/
|
1581 |
-
public function get_completed_items( $user_id = 0, $force = false, $type = '' ) {
|
1582 |
if ( ! $user_id ) {
|
1583 |
$user_id = get_current_user_id();
|
1584 |
}
|
@@ -1587,15 +1614,17 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1587 |
$items = $user ? $user->get_completed_items( $this->get_id() ) : false;
|
1588 |
|
1589 |
return apply_filters( 'learn-press/user-completed-items', $items, $user_id, $this->get_id() );
|
1590 |
-
}
|
1591 |
|
1592 |
/**
|
1593 |
* @param int $user_id
|
1594 |
* @param bool $force
|
1595 |
*
|
1596 |
* @return mixed
|
|
|
|
|
1597 |
*/
|
1598 |
-
public function count_completed_items( $user_id = 0, $force = false, $type = '' ) {
|
1599 |
$items = $this->get_completed_items( $user_id, $force, $type );
|
1600 |
$count = 0;
|
1601 |
|
@@ -1604,7 +1633,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1604 |
}
|
1605 |
|
1606 |
return apply_filters( 'learn_press_count_user_completed_items', $count, $this->get_id(), $user_id );
|
1607 |
-
}
|
1608 |
|
1609 |
/**
|
1610 |
* Count all items in a course.
|
@@ -1613,8 +1642,10 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1613 |
* @param bool $include_preview - Optional. False to exclude if item is preview
|
1614 |
*
|
1615 |
* @return int
|
|
|
|
|
1616 |
*/
|
1617 |
-
public function count_items( $type = '', $include_preview = true ) {
|
1618 |
global $wpdb;
|
1619 |
|
1620 |
$item_types = learn_press_get_course_item_types();
|
@@ -1663,14 +1694,16 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1663 |
}
|
1664 |
|
1665 |
return apply_filters( 'learn-press/count-items', $count_items, $type, $include_preview, $this->get_id() );
|
1666 |
-
}
|
1667 |
|
1668 |
/**
|
1669 |
* Count all items are 'Preview' in a course.
|
1670 |
*
|
1671 |
* @return int
|
|
|
|
|
1672 |
*/
|
1673 |
-
public function count_preview_items() {
|
1674 |
$count_preview = $this->get_preview_items();
|
1675 |
|
1676 |
if ( false === $count_preview ) {
|
@@ -1693,7 +1726,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1693 |
}
|
1694 |
|
1695 |
return apply_filters( 'learn-press/count-preview-items', $count_preview, $this->get_id() );
|
1696 |
-
}
|
1697 |
|
1698 |
public function get_preview_items() {
|
1699 |
return LP_Object_Cache::get( 'course-' . $this->get_id(), 'learn-press/course-preview-items' );
|
@@ -1724,10 +1757,12 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1724 |
* Return TRUE if option to block course's items after course is exceeded turn on.
|
1725 |
*
|
1726 |
* @return bool
|
|
|
|
|
1727 |
*/
|
1728 |
-
public function is_block_item_content() {
|
1729 |
return $this->get_data( 'block_lesson_content' ) === 'yes';
|
1730 |
-
}
|
1731 |
|
1732 |
/**
|
1733 |
* Calculate results of course by final quiz
|
@@ -1736,15 +1771,21 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1736 |
* @param boolean $force
|
1737 |
*
|
1738 |
* @return mixed|null
|
|
|
|
|
1739 |
*/
|
1740 |
-
public function _evaluate_course_by_quiz( $user_id, $force = false ) {
|
1741 |
$user = learn_press_get_user( $user_id );
|
1742 |
$user_course = $user->get_course_data( $this->get_id() );
|
1743 |
|
1744 |
return $user_course ? $user_course->get_results( '' ) : 0;
|
1745 |
-
}
|
1746 |
|
1747 |
-
|
|
|
|
|
|
|
|
|
1748 |
$user = learn_press_get_user( $user_id );
|
1749 |
$results = $user->get_quiz_results( $quiz_id, $this->get_id() );
|
1750 |
|
@@ -1762,7 +1803,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1762 |
}
|
1763 |
|
1764 |
return $result;
|
1765 |
-
}
|
1766 |
|
1767 |
|
1768 |
/**
|
@@ -1850,8 +1891,10 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1850 |
* @param mixed
|
1851 |
*
|
1852 |
* @return mixed
|
|
|
|
|
1853 |
*/
|
1854 |
-
public function get_user_expired_time( $user_id = 0, $args = array() ) {
|
1855 |
if ( ! $user_id ) {
|
1856 |
$user_id = get_current_user_id();
|
1857 |
}
|
@@ -1868,7 +1911,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1868 |
}
|
1869 |
|
1870 |
return apply_filters( 'learn_press_user_course_expired_time', $expired, $user_id, $this->get_id() );
|
1871 |
-
}
|
1872 |
|
1873 |
/**
|
1874 |
* Checks if this course has expired
|
@@ -1878,7 +1921,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1878 |
*
|
1879 |
* @return mixed
|
1880 |
*/
|
1881 |
-
public function is_expired( $user_id = 0, $args = array() ) {
|
1882 |
settype( $args, 'array' );
|
1883 |
|
1884 |
if ( ! $user_id ) {
|
@@ -1888,7 +1931,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
1888 |
$expired = $this->get_user_expired_time( $user_id, $args );
|
1889 |
|
1890 |
return apply_filters( 'learn_press_user_course_expired', $expired !== false ? ( $expired - current_time( 'timestamp' ) ) : false );
|
1891 |
-
}
|
1892 |
|
1893 |
/**
|
1894 |
* Output params for single course page
|
@@ -2046,8 +2089,10 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
2046 |
*
|
2047 |
* @return string
|
2048 |
* @since 3.x.x
|
|
|
|
|
2049 |
*/
|
2050 |
-
public function get_evaluation_results_method() {
|
2051 |
if ( empty( $this->_data['evaluation_results'] ) ) {
|
2052 |
$all_methods = learn_press_course_evaluation_methods( 'keys' );
|
2053 |
$method = get_post_meta( $this->get_id(), '_lp_course_result', true );
|
@@ -2072,7 +2117,7 @@ if ( ! function_exists( 'LP_Abstract_Course' ) ) {
|
|
2072 |
$this->get_id(),
|
2073 |
$this
|
2074 |
);
|
2075 |
-
}
|
2076 |
|
2077 |
public function is_featured() {
|
2078 |
return apply_filters(
|
56 |
'students' => 0,
|
57 |
'retake_count' => 0,
|
58 |
'featured' => '',
|
59 |
+
//'block_lesson_content' => '',
|
60 |
'course_result' => '',
|
61 |
'passing_conditional' => '',
|
62 |
'external_link' => '',
|
152 |
'fake_students' => get_post_meta( $id, '_lp_students', true ),
|
153 |
'retake_count' => get_post_meta( $id, '_lp_retake_count', true ),
|
154 |
'featured' => get_post_meta( $id, '_lp_featured', true ),
|
155 |
+
//'block_lesson_content' => get_post_meta( $id, '_lp_block_lesson_content', true ),
|
156 |
'course_result' => get_post_meta( $id, '_lp_course_result', true ),
|
157 |
'passing_condition' => get_post_meta( $id, '_lp_passing_condition', true ),
|
158 |
'final_quiz' => get_post_meta( $id, '_lp_final_quiz', true ),
|
395 |
* Check if this course is required enroll or not.
|
396 |
*
|
397 |
* @param mixed
|
398 |
+
* @author hungkv
|
399 |
+
* @since 4.0.5
|
400 |
* @return bool
|
401 |
+
* @version 1.0.0
|
402 |
*/
|
403 |
+
public function is_no_required_enroll(): bool {
|
404 |
$return = false;
|
405 |
if ( $this->get_data( 'no_required_enroll', 'no' ) == 'yes' && ! is_user_logged_in() ) {
|
406 |
$return = true;
|
407 |
}
|
408 |
+
return apply_filters( 'learn-press/course/require-enrollment', $return, $this->get_id() );
|
409 |
}
|
410 |
|
411 |
/**
|
445 |
*
|
446 |
* @return array
|
447 |
* @since 3.0.0
|
448 |
+
* Todo: tungnx - should review and rewrite
|
449 |
*/
|
450 |
public function get_items( $type = '', $preview = true ) {
|
451 |
$this->load();
|
1392 |
|
1393 |
}
|
1394 |
|
1395 |
+
/**
|
1396 |
+
* @editor tungnx
|
1397 |
+
* @modify 4.1.4.1 comment - not use
|
1398 |
+
*/
|
1399 |
+
/*protected function _evaluate_course_by_items( $user_id = 0, $force = false, $type = '' ) {
|
1400 |
$items = $this->get_curriculum_items();
|
1401 |
$result = 0;
|
1402 |
|
1406 |
}
|
1407 |
|
1408 |
return apply_filters( 'learn_press_course_results_by_items', $result, $this->get_id(), $user_id );
|
1409 |
+
}*/
|
1410 |
|
1411 |
+
/**
|
1412 |
+
* @editor tungnx
|
1413 |
+
* @modify 4.1.4.1 comment - not use
|
1414 |
+
*/
|
1415 |
+
/*protected function _evaluate_course_by_lessons( $user_id = 0, $force = false, $type = '' ) {
|
1416 |
$lessons = $this->get_items( LP_LESSON_CPT );
|
1417 |
$result = 0;
|
1418 |
|
1422 |
}
|
1423 |
|
1424 |
return apply_filters( 'learn_press_course_results_by_items', $result, $this->get_id(), $user_id );
|
1425 |
+
}*/
|
1426 |
|
1427 |
/**
|
1428 |
* Get achieved point of all quizzes per total points of all quizzes
|
1471 |
);
|
1472 |
}*/
|
1473 |
|
1474 |
+
/**
|
1475 |
+
* @editor tungnx
|
1476 |
+
* @deprecated 4.1.4.1 comment - not use
|
1477 |
+
*/
|
1478 |
+
/*public function enable_evaluate_item( $item_id, $user_id = 0 ) {
|
1479 |
if ( ! $user_id ) {
|
1480 |
$user_id = get_current_user_id();
|
1481 |
}
|
1487 |
$user_id,
|
1488 |
$this->get_id()
|
1489 |
);
|
1490 |
+
}*/
|
1491 |
|
1492 |
+
/**
|
1493 |
+
* @editor tungnx
|
1494 |
+
* @modify 4.1.4.1 comment - not use
|
1495 |
+
*/
|
1496 |
+
/*public function _evaluate_course_by_passed_quizzes_results( $user_id, $force = false ) {
|
1497 |
$quizzes = $this->get_items( LP_QUIZ_CPT );
|
1498 |
$user = learn_press_get_user( $user_id );
|
1499 |
$results = array();
|
1531 |
$this->get_id(),
|
1532 |
$user_id
|
1533 |
);
|
1534 |
+
}*/
|
1535 |
|
1536 |
+
/**
|
1537 |
+
* @editor tungnx
|
1538 |
+
* @modify 4.1.4.1 comment - not use
|
1539 |
+
*/
|
1540 |
+
/*public function is_evaluation( $thing ) {
|
1541 |
return $this->get_evaluation_results_method() == $thing;
|
1542 |
+
}*/
|
1543 |
|
1544 |
/**
|
1545 |
* Get number of lessons user has completed
|
1548 |
* @param bool $force
|
1549 |
*
|
1550 |
* @return int|mixed|null|void
|
1551 |
+
* @editor tungnx
|
1552 |
+
* @modify 4.1.4.1 - comment - not use
|
1553 |
*/
|
1554 |
+
/*public function get_completed_lessons( $user_id, $force = false ) {
|
1555 |
$key = $user_id . '-' . $this->get_id();
|
1556 |
|
1557 |
$completed_lessons = LP_Cache::get_completed_lessons( false, array() );
|
1591 |
$this->get_id(),
|
1592 |
$user_id
|
1593 |
);
|
1594 |
+
}*/
|
1595 |
|
1596 |
|
1597 |
/**
|
1602 |
* @param string $type
|
1603 |
*
|
1604 |
* @return int|bool
|
1605 |
+
* @editor tungnx
|
1606 |
+
* @modify 4.1.4.1 - comment - not use
|
1607 |
*/
|
1608 |
+
/*public function get_completed_items( $user_id = 0, $force = false, $type = '' ) {
|
1609 |
if ( ! $user_id ) {
|
1610 |
$user_id = get_current_user_id();
|
1611 |
}
|
1614 |
$items = $user ? $user->get_completed_items( $this->get_id() ) : false;
|
1615 |
|
1616 |
return apply_filters( 'learn-press/user-completed-items', $items, $user_id, $this->get_id() );
|
1617 |
+
}*/
|
1618 |
|
1619 |
/**
|
1620 |
* @param int $user_id
|
1621 |
* @param bool $force
|
1622 |
*
|
1623 |
* @return mixed
|
1624 |
+
* @editor tungnx
|
1625 |
+
* @modify 4.1.4.1 - comment - not use
|
1626 |
*/
|
1627 |
+
/*public function count_completed_items( $user_id = 0, $force = false, $type = '' ) {
|
1628 |
$items = $this->get_completed_items( $user_id, $force, $type );
|
1629 |
$count = 0;
|
1630 |
|
1633 |
}
|
1634 |
|
1635 |
return apply_filters( 'learn_press_count_user_completed_items', $count, $this->get_id(), $user_id );
|
1636 |
+
}*/
|
1637 |
|
1638 |
/**
|
1639 |
* Count all items in a course.
|
1642 |
* @param bool $include_preview - Optional. False to exclude if item is preview
|
1643 |
*
|
1644 |
* @return int
|
1645 |
+
* @editor tungnx
|
1646 |
+
* @modify 4.1.4.1 - comment - not use
|
1647 |
*/
|
1648 |
+
/*public function count_items( $type = '', $include_preview = true ) {
|
1649 |
global $wpdb;
|
1650 |
|
1651 |
$item_types = learn_press_get_course_item_types();
|
1694 |
}
|
1695 |
|
1696 |
return apply_filters( 'learn-press/count-items', $count_items, $type, $include_preview, $this->get_id() );
|
1697 |
+
}*/
|
1698 |
|
1699 |
/**
|
1700 |
* Count all items are 'Preview' in a course.
|
1701 |
*
|
1702 |
* @return int
|
1703 |
+
* @editor tungnx
|
1704 |
+
* @deprecated 4.1.4.1 - comment - not use
|
1705 |
*/
|
1706 |
+
/*public function count_preview_items() {
|
1707 |
$count_preview = $this->get_preview_items();
|
1708 |
|
1709 |
if ( false === $count_preview ) {
|
1726 |
}
|
1727 |
|
1728 |
return apply_filters( 'learn-press/count-preview-items', $count_preview, $this->get_id() );
|
1729 |
+
}*/
|
1730 |
|
1731 |
public function get_preview_items() {
|
1732 |
return LP_Object_Cache::get( 'course-' . $this->get_id(), 'learn-press/course-preview-items' );
|
1757 |
* Return TRUE if option to block course's items after course is exceeded turn on.
|
1758 |
*
|
1759 |
* @return bool
|
1760 |
+
* @editor tungnx
|
1761 |
+
* @deprecated 4.1.4.1
|
1762 |
*/
|
1763 |
+
/*public function is_block_item_content() {
|
1764 |
return $this->get_data( 'block_lesson_content' ) === 'yes';
|
1765 |
+
}*/
|
1766 |
|
1767 |
/**
|
1768 |
* Calculate results of course by final quiz
|
1771 |
* @param boolean $force
|
1772 |
*
|
1773 |
* @return mixed|null
|
1774 |
+
* @editor tungnx
|
1775 |
+
* @deprecated 4.1.4.1 - comment - not use
|
1776 |
*/
|
1777 |
+
/*public function _evaluate_course_by_quiz( $user_id, $force = false ) {
|
1778 |
$user = learn_press_get_user( $user_id );
|
1779 |
$user_course = $user->get_course_data( $this->get_id() );
|
1780 |
|
1781 |
return $user_course ? $user_course->get_results( '' ) : 0;
|
1782 |
+
}*/
|
1783 |
|
1784 |
+
/**
|
1785 |
+
* @editor tungnx
|
1786 |
+
* @deprecated 4.1.4.1 - comment - not use
|
1787 |
+
*/
|
1788 |
+
/*public function evaluate_quiz( $quiz_id, $user_id, $force = false ) {
|
1789 |
$user = learn_press_get_user( $user_id );
|
1790 |
$results = $user->get_quiz_results( $quiz_id, $this->get_id() );
|
1791 |
|
1803 |
}
|
1804 |
|
1805 |
return $result;
|
1806 |
+
}*/
|
1807 |
|
1808 |
|
1809 |
/**
|
1891 |
* @param mixed
|
1892 |
*
|
1893 |
* @return mixed
|
1894 |
+
* @editor tungnx
|
1895 |
+
* @deprecated 4.1.4.1
|
1896 |
*/
|
1897 |
+
/*public function get_user_expired_time( $user_id = 0, $args = array() ) {
|
1898 |
if ( ! $user_id ) {
|
1899 |
$user_id = get_current_user_id();
|
1900 |
}
|
1911 |
}
|
1912 |
|
1913 |
return apply_filters( 'learn_press_user_course_expired_time', $expired, $user_id, $this->get_id() );
|
1914 |
+
}*/
|
1915 |
|
1916 |
/**
|
1917 |
* Checks if this course has expired
|
1921 |
*
|
1922 |
* @return mixed
|
1923 |
*/
|
1924 |
+
/*public function is_expired( $user_id = 0, $args = array() ) {
|
1925 |
settype( $args, 'array' );
|
1926 |
|
1927 |
if ( ! $user_id ) {
|
1931 |
$expired = $this->get_user_expired_time( $user_id, $args );
|
1932 |
|
1933 |
return apply_filters( 'learn_press_user_course_expired', $expired !== false ? ( $expired - current_time( 'timestamp' ) ) : false );
|
1934 |
+
}*/
|
1935 |
|
1936 |
/**
|
1937 |
* Output params for single course page
|
2089 |
*
|
2090 |
* @return string
|
2091 |
* @since 3.x.x
|
2092 |
+
* @editor tungnx
|
2093 |
+
* @modify 4.1.4.1 - comment - not use
|
2094 |
*/
|
2095 |
+
/*public function get_evaluation_results_method() {
|
2096 |
if ( empty( $this->_data['evaluation_results'] ) ) {
|
2097 |
$all_methods = learn_press_course_evaluation_methods( 'keys' );
|
2098 |
$method = get_post_meta( $this->get_id(), '_lp_course_result', true );
|
2117 |
$this->get_id(),
|
2118 |
$this
|
2119 |
);
|
2120 |
+
}*/
|
2121 |
|
2122 |
public function is_featured() {
|
2123 |
return apply_filters(
|
@@ -156,10 +156,6 @@ if ( ! class_exists( 'LP_Course_Item' ) ) {
|
|
156 |
* @return array
|
157 |
*/
|
158 |
public function get_class( $more = '', $user_id = 0 ) {
|
159 |
-
/**
|
160 |
-
* @var LP_Course_Item $lp_course_item
|
161 |
-
*/
|
162 |
-
global $lp_course_item;
|
163 |
$course_id = get_the_ID();
|
164 |
|
165 |
if ( empty( $GLOBALS['get_class'] ) ) {
|
156 |
* @return array
|
157 |
*/
|
158 |
public function get_class( $more = '', $user_id = 0 ) {
|
|
|
|
|
|
|
|
|
159 |
$course_id = get_the_ID();
|
160 |
|
161 |
if ( empty( $GLOBALS['get_class'] ) ) {
|
@@ -5,48 +5,33 @@
|
|
5 |
*
|
6 |
* @author ThimPress
|
7 |
* @package LearnPress/Classes
|
8 |
-
* @version 4.0.
|
9 |
*/
|
10 |
defined( 'ABSPATH' ) || exit();
|
11 |
if ( ! class_exists( 'LP_Course' ) ) {
|
12 |
class LP_Course_No_Required_Enroll {
|
|
|
|
|
13 |
/**
|
14 |
* LP_Course_No_Required_Enroll constructor.
|
15 |
-
*/
|
16 |
-
public function __construct() {}
|
17 |
-
/**
|
18 |
-
* @param string $prop
|
19 |
-
* @param false $force
|
20 |
-
* @param int $quiz_id
|
21 |
-
* @param null $answered
|
22 |
-
* @param int $course_id
|
23 |
*
|
24 |
-
* @
|
|
|
25 |
*/
|
26 |
-
public function
|
27 |
-
|
28 |
-
$result = $this->guest_calculate_results_quiz( $quiz_id, $answered, $course_id );
|
29 |
-
$result['user_item_id'] = '';
|
30 |
-
$result['interval'] = array();
|
31 |
-
$result['graduation'] = '';
|
32 |
-
$result['graduationText'] = '';
|
33 |
-
return $prop ? $result[ $prop ] : $result;
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
-
*
|
38 |
-
*
|
39 |
-
* @param $
|
|
|
40 |
*
|
41 |
* @return array
|
42 |
*/
|
43 |
-
public function
|
44 |
-
$
|
45 |
-
$course = learn_press_get_course( $course_id );
|
46 |
-
$last_results = array();
|
47 |
-
|
48 |
-
$questions = array_fill_keys( $quiz->get_question_ids(), array() );
|
49 |
-
$result = array(
|
50 |
'questions' => array(),
|
51 |
'mark' => $quiz->get_mark(),
|
52 |
'user_mark' => 0,
|
@@ -55,61 +40,94 @@ if ( ! class_exists( 'LP_Course' ) ) {
|
|
55 |
'question_answered' => 0,
|
56 |
'question_wrong' => 0,
|
57 |
'question_correct' => 0,
|
58 |
-
'status' =>
|
59 |
'result' => 0,
|
60 |
'time_spend' => 0,
|
61 |
'passing_grade' => $quiz->get_passing_grade(),
|
|
|
|
|
62 |
);
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
} else {
|
72 |
-
|
73 |
-
|
74 |
-
// If answered is empty consider user has skipped question
|
75 |
-
if ( ! $answer ) {
|
76 |
-
if ( $quiz->get_negative_marking() && $quiz->get_minus_skip_questions() ) {
|
77 |
-
$result['user_mark'] -= $negative_marking;
|
78 |
-
}
|
79 |
-
$result['question_empty'] ++;
|
80 |
-
} else {
|
81 |
-
if ( $quiz->get_negative_marking() ) {
|
82 |
-
$result['user_mark'] -= $negative_marking;
|
83 |
-
}
|
84 |
-
$result['question_wrong'] ++;
|
85 |
}
|
86 |
-
|
87 |
-
$result['questions'][ $question_id ] = apply_filters( 'learn-press/question-results-data', $last_checked ? array_merge( $last_checked, $check ) : $check, $question_id, $quiz->get_id() );
|
88 |
|
89 |
-
|
90 |
-
$result['
|
91 |
}
|
92 |
-
}
|
|
|
|
|
|
|
|
|
93 |
|
94 |
-
|
|
|
|
|
95 |
|
96 |
-
$
|
97 |
-
$
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
-
|
|
|
|
|
101 |
|
102 |
-
|
|
|
|
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
'user_item_id' => '',
|
110 |
-
)
|
111 |
-
);
|
112 |
}
|
|
|
113 |
return $result;
|
114 |
}
|
115 |
|
@@ -123,7 +141,7 @@ if ( ! class_exists( 'LP_Course' ) ) {
|
|
123 |
$quiz = learn_press_get_quiz( $quiz_id );
|
124 |
$question_ids = $quiz->get_question_ids();
|
125 |
foreach ( $question_ids as $question_id ) {
|
126 |
-
$question
|
127 |
$result[ $question_id ] = array(
|
128 |
'correct' => $question->show_correct_answers(),
|
129 |
'mark' => $question->get_mark(),
|
@@ -140,7 +158,7 @@ if ( ! class_exists( 'LP_Course' ) ) {
|
|
140 |
*
|
141 |
* @return array
|
142 |
*/
|
143 |
-
public function guest_quiz_get_attempts( $quiz_id, $answered, $course_id ) {
|
144 |
$conclude = $this->guest_calculate_results_quiz( $quiz_id, $answered, $course_id );
|
145 |
// object initialization
|
146 |
$result_obj = new StdClass();
|
@@ -159,7 +177,7 @@ if ( ! class_exists( 'LP_Course' ) ) {
|
|
159 |
$result = array();
|
160 |
$result[] = $result_obj;
|
161 |
return $result;
|
162 |
-
}
|
163 |
|
164 |
/**
|
165 |
* @param $question_id
|
@@ -176,65 +194,56 @@ if ( ! class_exists( 'LP_Course' ) ) {
|
|
176 |
}
|
177 |
return $checked;
|
178 |
}
|
179 |
-
|
180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
$response = array(
|
182 |
-
'
|
183 |
-
'message' =>
|
184 |
);
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
$
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
$
|
204 |
-
|
205 |
-
|
206 |
-
'instant_check' => $show_check,
|
207 |
-
'quiz_status' => $status,
|
208 |
-
'checked_questions' => $checked_questions,
|
209 |
-
'hinted_questions' => $hinted_questions,
|
210 |
-
'answered' => $answered,
|
211 |
-
'show_correct_review' => $show_correct_review,
|
212 |
-
)
|
213 |
-
);
|
214 |
-
|
215 |
-
$results = array(
|
216 |
-
'question_ids' => $question_ids,
|
217 |
-
'questions' => $questions,
|
218 |
-
);
|
219 |
-
|
220 |
-
// Error get_start_time when ajax call.
|
221 |
-
if ( isset( $total_time ) ) {
|
222 |
-
$expiration = '';
|
223 |
-
$results['total_time'] = '';
|
224 |
-
$results['end_time'] = '';
|
225 |
-
}
|
226 |
-
|
227 |
-
$results['duration'] = $duration ? $duration->get() : false;
|
228 |
-
$results['answered'] = '';
|
229 |
-
$results['status'] = 'started';
|
230 |
-
$results['results'] = '';
|
231 |
-
$results['retaken'] = absint( $quiz->get_retake_count() );
|
232 |
|
233 |
-
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
-
$response['results'] = $results;
|
237 |
-
}
|
238 |
return $response;
|
239 |
}
|
240 |
}
|
5 |
*
|
6 |
* @author ThimPress
|
7 |
* @package LearnPress/Classes
|
8 |
+
* @version 4.0.9
|
9 |
*/
|
10 |
defined( 'ABSPATH' ) || exit();
|
11 |
if ( ! class_exists( 'LP_Course' ) ) {
|
12 |
class LP_Course_No_Required_Enroll {
|
13 |
+
public $_course;
|
14 |
+
|
15 |
/**
|
16 |
* LP_Course_No_Required_Enroll constructor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
*
|
18 |
+
* @editor tungnx
|
19 |
+
* @modify 4.1.4.1
|
20 |
*/
|
21 |
+
public function __construct( LP_Course $course ) {
|
22 |
+
$this->_course = $course;
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
+
* Get result do quiz
|
27 |
+
*
|
28 |
+
* @param $quiz
|
29 |
+
* @param null $answered
|
30 |
*
|
31 |
* @return array
|
32 |
*/
|
33 |
+
public function get_result_quiz( $quiz, $answered = null ): array {
|
34 |
+
$result = array(
|
|
|
|
|
|
|
|
|
|
|
35 |
'questions' => array(),
|
36 |
'mark' => $quiz->get_mark(),
|
37 |
'user_mark' => 0,
|
40 |
'question_answered' => 0,
|
41 |
'question_wrong' => 0,
|
42 |
'question_correct' => 0,
|
43 |
+
'status' => LP_ITEM_COMPLETED,
|
44 |
'result' => 0,
|
45 |
'time_spend' => 0,
|
46 |
'passing_grade' => $quiz->get_passing_grade(),
|
47 |
+
'answered' => array(),
|
48 |
+
'pass' => 0,
|
49 |
);
|
50 |
+
|
51 |
+
$question_ids = $quiz->get_questions();
|
52 |
+
$result['question_count'] = count( $question_ids );
|
53 |
+
|
54 |
+
$questions = learn_press_rest_prepare_user_questions( $question_ids );
|
55 |
+
|
56 |
+
foreach ( $questions as $key => $question_info ) {
|
57 |
+
$question_id = $question_info['id'];
|
58 |
+
//$question = learn_press_get_question( $question_id );
|
59 |
+
$question = $question_info['object'];
|
60 |
+
|
61 |
+
if ( ! $question ) {
|
62 |
+
continue;
|
63 |
+
}
|
64 |
+
|
65 |
+
$point = floatval( $question->get_mark() );
|
66 |
+
|
67 |
+
//if ( ! array_key_exists( 'instant_check', $answered ) || array_key_exists( $question_id, $answered ) ) {
|
68 |
+
$result['questions'][ $question_id ] = $question_info;
|
69 |
+
$result['answered'][ $question_id ] = [];
|
70 |
+
$result['answered'][ $question_id ]['answered'] = $answered[ $question_id ] ?? '';
|
71 |
+
|
72 |
+
//}
|
73 |
+
|
74 |
+
if ( isset( $answered[ $question_id ] ) ) { // User's answer
|
75 |
+
$result['question_answered']++;
|
76 |
+
|
77 |
+
$check = $question->check( $answered[ $question_id ] );
|
78 |
+
if ( $check['correct'] ) {
|
79 |
+
$result['question_correct']++;
|
80 |
+
$result['user_mark'] += $point;
|
81 |
+
|
82 |
+
$result['answered'][ $question_id ]['correct'] = true;
|
83 |
+
$result['answered'][ $question_id ]['mark'] = $point;
|
84 |
} else {
|
85 |
+
if ( $quiz->get_negative_marking() ) {
|
86 |
+
$result['user_mark'] -= $point;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
+
$result['question_wrong']++;
|
|
|
89 |
|
90 |
+
$result['answered'][ $question_id ]['correct'] = false;
|
91 |
+
$result['answered'][ $question_id ]['mark'] = 0;
|
92 |
}
|
93 |
+
} elseif ( ! array_key_exists( 'instant_check', $answered ) ) { // User skip question
|
94 |
+
if ( $quiz->get_negative_marking() && $quiz->get_minus_skip_questions() ) {
|
95 |
+
$result['user_mark'] -= $point;
|
96 |
+
}
|
97 |
+
$result['question_empty']++;
|
98 |
|
99 |
+
$result['answered'][ $question_id ]['correct'] = false;
|
100 |
+
$result['answered'][ $question_id ]['mark'] = 0;
|
101 |
+
}
|
102 |
|
103 |
+
$can_review_quiz = get_post_meta( $quiz->get_id(), '_lp_review', true ) === 'yes';
|
104 |
+
if ( $can_review_quiz && ! array_key_exists( 'instant_check', $answered ) ) {
|
105 |
+
$result['questions'][ $question_id ]['explanation'] = $question->get_explanation();
|
106 |
+
$result['questions'][ $question_id ]['options'] = learn_press_get_question_options_for_js(
|
107 |
+
$question,
|
108 |
+
array(
|
109 |
+
'include_is_true' => get_post_meta( $quiz->get_id(), '_lp_show_correct_review', true ) === 'yes',
|
110 |
+
'answer' => $answered[ $question_id ] ?? '',
|
111 |
+
)
|
112 |
+
);
|
113 |
+
}
|
114 |
+
}
|
115 |
|
116 |
+
if ( $result['user_mark'] < 0 ) {
|
117 |
+
$result['user_mark'] = 0;
|
118 |
+
}
|
119 |
|
120 |
+
if ( $result['user_mark'] > 0 && $result['mark'] > 0 ) {
|
121 |
+
$result['result'] = round( $result['user_mark'] * 100 / $result['mark'], 2, PHP_ROUND_HALF_DOWN );
|
122 |
+
}
|
123 |
|
124 |
+
$passing_grade = $quiz->get_data( 'passing_grade', 0 );
|
125 |
+
if ( $result['result'] >= $passing_grade ) {
|
126 |
+
$result['pass'] = 1;
|
127 |
+
} else {
|
128 |
+
$result['pass'] = 0;
|
|
|
|
|
|
|
129 |
}
|
130 |
+
|
131 |
return $result;
|
132 |
}
|
133 |
|
141 |
$quiz = learn_press_get_quiz( $quiz_id );
|
142 |
$question_ids = $quiz->get_question_ids();
|
143 |
foreach ( $question_ids as $question_id ) {
|
144 |
+
$question = learn_press_get_question( $question_id );
|
145 |
$result[ $question_id ] = array(
|
146 |
'correct' => $question->show_correct_answers(),
|
147 |
'mark' => $question->get_mark(),
|
158 |
*
|
159 |
* @return array
|
160 |
*/
|
161 |
+
/*public function guest_quiz_get_attempts( $quiz_id, $answered, $course_id ) {
|
162 |
$conclude = $this->guest_calculate_results_quiz( $quiz_id, $answered, $course_id );
|
163 |
// object initialization
|
164 |
$result_obj = new StdClass();
|
177 |
$result = array();
|
178 |
$result[] = $result_obj;
|
179 |
return $result;
|
180 |
+
}*/
|
181 |
|
182 |
/**
|
183 |
* @param $question_id
|
194 |
}
|
195 |
return $checked;
|
196 |
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Start quiz
|
200 |
+
*
|
201 |
+
* @param LP_Quiz $quiz
|
202 |
+
*
|
203 |
+
* @return array
|
204 |
+
* @throws Exception
|
205 |
+
* @editor tungnx
|
206 |
+
* @modify 4.1.4.1
|
207 |
+
*/
|
208 |
+
public function guest_start_quiz( LP_Quiz $quiz ): array {
|
209 |
$response = array(
|
210 |
+
'status' => 'error',
|
211 |
+
'message' => '',
|
212 |
);
|
213 |
|
214 |
+
$show_check = $quiz->get_instant_check();
|
215 |
+
$duration = $quiz->get_duration();
|
216 |
+
$show_correct_review = $quiz->get_show_correct_review();
|
217 |
+
$question_ids = $quiz->get_question_ids();
|
218 |
+
$status = LP_ITEM_STARTED;
|
219 |
+
$checked_questions = [];
|
220 |
+
$hinted_questions = [];
|
221 |
+
$time_remaining = $duration->get();
|
222 |
+
|
223 |
+
$questions = learn_press_rest_prepare_user_questions(
|
224 |
+
$question_ids,
|
225 |
+
array(
|
226 |
+
'instant_check' => $show_check,
|
227 |
+
'quiz_status' => $status,
|
228 |
+
'checked_questions' => $checked_questions,
|
229 |
+
'hinted_questions' => $hinted_questions,
|
230 |
+
'answered' => [],
|
231 |
+
'show_correct_review' => $show_correct_review,
|
232 |
+
)
|
233 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
+
$response['status'] = 'success';
|
236 |
+
$results['question_ids'] = $question_ids;
|
237 |
+
$results['questions'] = $questions;
|
238 |
+
$results['total_time'] = $time_remaining;
|
239 |
+
$results['duration'] = $duration->get();
|
240 |
+
$results['status'] = $status; // Must be started
|
241 |
+
$results['retaken'] = 0;
|
242 |
+
$results['attempts'] = [];
|
243 |
+
$results['user_item_id'] = 0;
|
244 |
+
$results['answered'] = [];
|
245 |
+
$response['results'] = $results;
|
246 |
|
|
|
|
|
247 |
return $response;
|
248 |
}
|
249 |
}
|
@@ -75,7 +75,7 @@ if ( ! class_exists( 'LP_Course' ) ) {
|
|
75 |
'students' => 0,
|
76 |
'retake_count' => 0,
|
77 |
'featured' => 'no',
|
78 |
-
'block_lesson_content' => 'no',
|
79 |
'external_link_buy_course' => '',
|
80 |
'course_result' => 'evaluate_lesson',
|
81 |
'passing_condition' => 80,
|
@@ -94,11 +94,10 @@ if ( ! class_exists( 'LP_Course' ) ) {
|
|
94 |
* Get LP Course.
|
95 |
*
|
96 |
* @param int $course_id
|
97 |
-
* @param array $args
|
98 |
*
|
99 |
* @return mixed|bool|LP_Course
|
100 |
*/
|
101 |
-
public static function get_course( $course_id = 0 ) {
|
102 |
if ( isset( LP_Global::$courses[ $course_id ] ) ) {
|
103 |
return LP_Global::$courses[ $course_id ];
|
104 |
}
|
@@ -370,5 +369,122 @@ if ( ! class_exists( 'LP_Course' ) ) {
|
|
370 |
error_log( $e->getMessage() );
|
371 |
}
|
372 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
}
|
374 |
}
|
75 |
'students' => 0,
|
76 |
'retake_count' => 0,
|
77 |
'featured' => 'no',
|
78 |
+
//'block_lesson_content' => 'no',
|
79 |
'external_link_buy_course' => '',
|
80 |
'course_result' => 'evaluate_lesson',
|
81 |
'passing_condition' => 80,
|
94 |
* Get LP Course.
|
95 |
*
|
96 |
* @param int $course_id
|
|
|
97 |
*
|
98 |
* @return mixed|bool|LP_Course
|
99 |
*/
|
100 |
+
public static function get_course( int $course_id = 0 ) {
|
101 |
if ( isset( LP_Global::$courses[ $course_id ] ) ) {
|
102 |
return LP_Global::$courses[ $course_id ];
|
103 |
}
|
369 |
error_log( $e->getMessage() );
|
370 |
}
|
371 |
}
|
372 |
+
|
373 |
+
/**
|
374 |
+
* Get info total items of Course
|
375 |
+
*
|
376 |
+
* @param string $type
|
377 |
+
* @param bool $include_preview
|
378 |
+
* @author tungnx
|
379 |
+
* @since 4.1.4.1
|
380 |
+
* @version 1.0.0
|
381 |
+
* @return int
|
382 |
+
*/
|
383 |
+
public function count_items( string $type = '', bool $include_preview = true ): int {
|
384 |
+
// Get cache
|
385 |
+
$lp_course_cache = LP_Course_Cache::instance();
|
386 |
+
$key_cache = $this->get_id() . '/total_items';
|
387 |
+
$total_items = $lp_course_cache->get_cache( $key_cache );
|
388 |
+
$count_items = 0;
|
389 |
+
|
390 |
+
if ( ! $total_items ) {
|
391 |
+
$extra_info = $this->get_info_extra_for_fast_query();
|
392 |
+
|
393 |
+
if ( ! $extra_info->total_items ) {
|
394 |
+
$total_items = LP_Course_DB::getInstance()->get_total_items( $this->get_id() );
|
395 |
+
$extra_info->total_items = $total_items;
|
396 |
+
|
397 |
+
// Save post meta
|
398 |
+
$this->set_info_extra_for_fast_query( $extra_info );
|
399 |
+
} else {
|
400 |
+
$total_items = $extra_info->total_items;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
|
404 |
+
if ( ! empty( $total_items ) ) {
|
405 |
+
if ( ! empty( $type ) ) {
|
406 |
+
$count_items = $total_items->{$type};
|
407 |
+
} else {
|
408 |
+
$count_items = $total_items->count_items;
|
409 |
+
}
|
410 |
+
}
|
411 |
+
|
412 |
+
return apply_filters( 'learn-press/course/count-items', intval( $count_items ), $this->get_id() );
|
413 |
+
}
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Delete relate data when delete course
|
417 |
+
*
|
418 |
+
* @since 4.1.4.1
|
419 |
+
* @author tungnx
|
420 |
+
* @version 1.0.0
|
421 |
+
*/
|
422 |
+
public function delete_relate_data_when_delete_course() {
|
423 |
+
$lp_section_db = LP_Section_DB::getInstance();
|
424 |
+
$lp_user_items_db = LP_User_Items_DB::getInstance();
|
425 |
+
|
426 |
+
try {
|
427 |
+
// Check valid user
|
428 |
+
if ( ! current_user_can( 'administrator' ) && $this->get_author( 'id' ) !== get_current_user_id() ) {
|
429 |
+
return;
|
430 |
+
}
|
431 |
+
|
432 |
+
$section_ids = $lp_section_db->get_section_ids_by_course( $this->get_id() );
|
433 |
+
|
434 |
+
$filter = new LP_Section_Filter();
|
435 |
+
$filter->section_ids = $section_ids;
|
436 |
+
$filter->author_id_course = $this->get_id();
|
437 |
+
|
438 |
+
// Delete section
|
439 |
+
$lp_section_db->delete_section( $filter );
|
440 |
+
// Delete section items
|
441 |
+
$lp_section_db->delete_section_items( $filter );
|
442 |
+
|
443 |
+
$filter_user_items = new LP_User_Items_Filter();
|
444 |
+
$filter_user_items->item_id = $this->get_id();
|
445 |
+
$user_course_ids = $lp_user_items_db->get_user_items_by_course( $filter_user_items );
|
446 |
+
|
447 |
+
$this->delete_user_item_and_result( $user_course_ids );
|
448 |
+
} catch ( Throwable $e ) {
|
449 |
+
error_log( __FUNCTION__ . ':' . $e->getMessage() );
|
450 |
+
}
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Delete user_items, user_itemmeta, user_item_results
|
455 |
+
* WHERE IN user_item_ids
|
456 |
+
*
|
457 |
+
* @param array $user_course_ids
|
458 |
+
*/
|
459 |
+
public function delete_user_item_and_result( array $user_course_ids ) {
|
460 |
+
$lp_user_items_db = LP_User_Items_DB::getInstance();
|
461 |
+
$lp_user_item_results = LP_User_Items_Result_DB::instance();
|
462 |
+
|
463 |
+
try {
|
464 |
+
if ( empty( $user_course_ids ) ) {
|
465 |
+
return;
|
466 |
+
}
|
467 |
+
|
468 |
+
// Get user_item_ids has parent in $user_course_ids
|
469 |
+
$filter = new LP_User_Items_Filter();
|
470 |
+
$filter->user_item_ids = $user_course_ids;
|
471 |
+
$user_item_ids = $lp_user_items_db->get_item_ids_of_user_course( $filter );
|
472 |
+
|
473 |
+
$user_item_ids_concat = array_merge( $user_course_ids, $user_item_ids );
|
474 |
+
|
475 |
+
// Delete on tb lp_user_items
|
476 |
+
$filter_delete = new LP_User_Items_Filter();
|
477 |
+
$filter_delete->user_item_ids = $user_item_ids_concat;
|
478 |
+
$lp_user_items_db->remove_user_item_ids( $filter_delete );
|
479 |
+
|
480 |
+
// Delete user_itemmeta
|
481 |
+
$lp_user_items_db->remove_user_itemmeta( $filter_delete );
|
482 |
+
|
483 |
+
// Delete user_item_results
|
484 |
+
$lp_user_item_results->remove_user_item_results( $filter_delete );
|
485 |
+
} catch ( Throwable $e ) {
|
486 |
+
error_log( __FUNCTION__ . ':' . $e->getMessage() );
|
487 |
+
}
|
488 |
+
}
|
489 |
}
|
490 |
}
|
@@ -11,25 +11,28 @@ defined( 'ABSPATH' ) || exit();
|
|
11 |
|
12 |
/**
|
13 |
* @param int $the_course
|
14 |
-
* @param array|string $args
|
15 |
*
|
16 |
-
* @return LP_Course|mixed
|
17 |
*/
|
18 |
-
function learn_press_get_course( $the_course = 0 ) {
|
19 |
if ( 0 === $the_course ) {
|
20 |
-
$the_course = get_the_ID();
|
21 |
}
|
22 |
|
23 |
return LP_Course::get_course( $the_course );
|
24 |
}
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
27 |
if ( false !== ( $courses = LP_Object_Cache::get( 'object', 'learn-press/courses' ) ) ) {
|
28 |
return ! empty( $courses[ $id ] ) ? $courses[ $id ] : false;
|
29 |
}
|
30 |
|
31 |
return false;
|
32 |
-
}
|
33 |
|
34 |
/**
|
35 |
* Create nonce for course action.
|
@@ -945,11 +948,11 @@ if ( ! function_exists( 'learn_press_course_item_type_link' ) ) {
|
|
945 |
/*function learn_press_get_item_course( $item_id ) {
|
946 |
global $wpdb;
|
947 |
$query = $wpdb->prepare( "
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
|
954 |
return (int) $wpdb->get_var( $query );
|
955 |
}*/
|
@@ -1054,29 +1057,37 @@ function learn_press_mark_user_just_logged_in() {
|
|
1054 |
|
1055 |
add_action( 'wp_login', 'learn_press_mark_user_just_logged_in' );
|
1056 |
|
1057 |
-
function learn_press_translate_course_result_required( $course
|
1058 |
if ( ! $course ) {
|
1059 |
-
|
1060 |
}
|
1061 |
|
1062 |
-
|
1063 |
-
$passing_condition = $course->get_passing_condition();
|
1064 |
-
}
|
1065 |
|
1066 |
-
|
|
|
1067 |
case 'evaluate_lesson':
|
1068 |
-
$label = esc_html__( '
|
1069 |
break;
|
1070 |
case 'evaluate_quiz':
|
1071 |
-
$label = esc_html__( '
|
1072 |
break;
|
1073 |
case 'evaluate_final_quiz':
|
1074 |
$label = esc_html__( 'Final Quiz', 'learnpress' );
|
1075 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
1076 |
default:
|
1077 |
-
$label = '';
|
1078 |
break;
|
1079 |
}
|
1080 |
|
1081 |
-
return apply_filters(
|
|
|
|
|
|
|
1082 |
}
|
11 |
|
12 |
/**
|
13 |
* @param int $the_course
|
|
|
14 |
*
|
15 |
+
* @return bool|LP_Course|mixed
|
16 |
*/
|
17 |
+
function learn_press_get_course( int $the_course = 0 ) {
|
18 |
if ( 0 === $the_course ) {
|
19 |
+
$the_course = get_the_ID() ? get_the_ID() : 0;
|
20 |
}
|
21 |
|
22 |
return LP_Course::get_course( $the_course );
|
23 |
}
|
24 |
|
25 |
+
/**
|
26 |
+
* @editor tungnx
|
27 |
+
* @modify 4.1.4.1 - comment - not use
|
28 |
+
*/
|
29 |
+
/*function learn_press_get_course_by_id( $id ) {
|
30 |
if ( false !== ( $courses = LP_Object_Cache::get( 'object', 'learn-press/courses' ) ) ) {
|
31 |
return ! empty( $courses[ $id ] ) ? $courses[ $id ] : false;
|
32 |
}
|
33 |
|
34 |
return false;
|
35 |
+
}*/
|
36 |
|
37 |
/**
|
38 |
* Create nonce for course action.
|
948 |
/*function learn_press_get_item_course( $item_id ) {
|
949 |
global $wpdb;
|
950 |
$query = $wpdb->prepare( "
|
951 |
+
SELECT section_course_id
|
952 |
+
FROM {$wpdb->learnpress_sections} s
|
953 |
+
INNER JOIN {$wpdb->learnpress_section_items} si ON si.section_id = s.section_id
|
954 |
+
WHERE si.item_id = %d
|
955 |
+
", $item_id );
|
956 |
|
957 |
return (int) $wpdb->get_var( $query );
|
958 |
}*/
|
1057 |
|
1058 |
add_action( 'wp_login', 'learn_press_mark_user_just_logged_in' );
|
1059 |
|
1060 |
+
function learn_press_translate_course_result_required( $course ) {
|
1061 |
if ( ! $course ) {
|
1062 |
+
return '';
|
1063 |
}
|
1064 |
|
1065 |
+
$passing_condition = $course->get_passing_condition();
|
|
|
|
|
1066 |
|
1067 |
+
$evaluate_type = $course->get_data( 'course_result', 'evaluate_lesson' );
|
1068 |
+
switch ( $evaluate_type ) {
|
1069 |
case 'evaluate_lesson':
|
1070 |
+
$label = esc_html__( 'lessons completed per total number of lessons.', 'learnpress' );
|
1071 |
break;
|
1072 |
case 'evaluate_quiz':
|
1073 |
+
$label = esc_html__( 'quizzes passed per total number of quizzes.', 'learnpress' );
|
1074 |
break;
|
1075 |
case 'evaluate_final_quiz':
|
1076 |
$label = esc_html__( 'Final Quiz', 'learnpress' );
|
1077 |
break;
|
1078 |
+
case 'evaluate_questions':
|
1079 |
+
$label = esc_html__( 'correct answers per total number of questions.', 'learnpress' );
|
1080 |
+
break;
|
1081 |
+
case 'evaluate_mark':
|
1082 |
+
$label = esc_html__( 'score achieved per total score of the questions.', 'learnpress' );
|
1083 |
+
break;
|
1084 |
default:
|
1085 |
+
$label = apply_filters( 'learnpress/message/evaluate/' . $evaluate_type, $evaluate_type );
|
1086 |
break;
|
1087 |
}
|
1088 |
|
1089 |
+
return apply_filters(
|
1090 |
+
'learnpress/message/evaluate',
|
1091 |
+
wp_sprintf( '%1$s %2$s %3$s', __( 'Require', 'learnpress' ), $passing_condition . '%', $label )
|
1092 |
+
);
|
1093 |
}
|
@@ -84,12 +84,14 @@ if ( ! class_exists( 'LP_Course_CURD' ) ) {
|
|
84 |
* @param object $course_id
|
85 |
*
|
86 |
* @since 3.0.0
|
|
|
|
|
87 |
*/
|
88 |
public function delete( &$course_id ) {
|
89 |
// section curd
|
90 |
-
$curd = new LP_Section_CURD( $course_id );
|
91 |
// clear course items
|
92 |
-
$curd->clear();
|
93 |
}
|
94 |
|
95 |
/**
|
@@ -449,8 +451,10 @@ if ( ! class_exists( 'LP_Course_CURD' ) ) {
|
|
449 |
*
|
450 |
* @return array
|
451 |
* @since 3.1.0
|
|
|
|
|
452 |
*/
|
453 |
-
public function count_items( $course_id, $context = 'view' ) {
|
454 |
global $wpdb;
|
455 |
$params = array( $course_id );
|
456 |
$sql = "
|
@@ -476,7 +480,7 @@ if ( ! class_exists( 'LP_Course_CURD' ) ) {
|
|
476 |
}
|
477 |
|
478 |
return $stats_object;
|
479 |
-
}
|
480 |
|
481 |
/**
|
482 |
* Read sections of a bundle of courses by ids
|
@@ -590,8 +594,10 @@ if ( ! class_exists( 'LP_Course_CURD' ) ) {
|
|
590 |
* Remove all course data from database, includes section and course's items
|
591 |
*
|
592 |
* @param $course_id
|
|
|
|
|
593 |
*/
|
594 |
-
public function remove_course( $course_id ) {
|
595 |
global $wpdb;
|
596 |
|
597 |
$section_ids = $wpdb->get_col(
|
@@ -622,7 +628,7 @@ if ( ! class_exists( 'LP_Course_CURD' ) ) {
|
|
622 |
);
|
623 |
$wpdb->query( $query );
|
624 |
learn_press_reset_auto_increment( 'learnpress_sections' );
|
625 |
-
}
|
626 |
|
627 |
/**
|
628 |
* Get recent courses.
|
84 |
* @param object $course_id
|
85 |
*
|
86 |
* @since 3.0.0
|
87 |
+
* @editor tungnx
|
88 |
+
* @modify 4.1.4.1
|
89 |
*/
|
90 |
public function delete( &$course_id ) {
|
91 |
// section curd
|
92 |
+
// $curd = new LP_Section_CURD( $course_id );
|
93 |
// clear course items
|
94 |
+
// $curd->clear();
|
95 |
}
|
96 |
|
97 |
/**
|
451 |
*
|
452 |
* @return array
|
453 |
* @since 3.1.0
|
454 |
+
* @editor tungnx
|
455 |
+
* @modify 4.1.4.1 - comment - not use
|
456 |
*/
|
457 |
+
/*public function count_items( $course_id, $context = 'view' ) {
|
458 |
global $wpdb;
|
459 |
$params = array( $course_id );
|
460 |
$sql = "
|
480 |
}
|
481 |
|
482 |
return $stats_object;
|
483 |
+
}*/
|
484 |
|
485 |
/**
|
486 |
* Read sections of a bundle of courses by ids
|
594 |
* Remove all course data from database, includes section and course's items
|
595 |
*
|
596 |
* @param $course_id
|
597 |
+
* @editor tungnx
|
598 |
+
* @modify 4.1.4.1 - comment - not use
|
599 |
*/
|
600 |
+
/*public function remove_course( $course_id ) {
|
601 |
global $wpdb;
|
602 |
|
603 |
$section_ids = $wpdb->get_col(
|
628 |
);
|
629 |
$wpdb->query( $query );
|
630 |
learn_press_reset_auto_increment( 'learnpress_sections' );
|
631 |
+
}*/
|
632 |
|
633 |
/**
|
634 |
* Get recent courses.
|
@@ -130,8 +130,10 @@ class LP_Section_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
|
|
130 |
*
|
131 |
* @return bool
|
132 |
* @since 3.0.0
|
|
|
|
|
133 |
*/
|
134 |
-
public function clear() {
|
135 |
|
136 |
$sections_ids = LP_Object_Cache::get( 'course-' . $this->course_id, 'learn-press/course-sections-ids' );
|
137 |
|
@@ -158,7 +160,7 @@ class LP_Section_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
|
|
158 |
LP_Course_Utils::set_cache_db_sections( $this->course_id, false );
|
159 |
|
160 |
return true;
|
161 |
-
}
|
162 |
|
163 |
/**
|
164 |
* Load data from database.
|
130 |
*
|
131 |
* @return bool
|
132 |
* @since 3.0.0
|
133 |
+
* @editor tungnx
|
134 |
+
* @modify 4.1.4.1 - comment - not use
|
135 |
*/
|
136 |
+
/*public function clear() {
|
137 |
|
138 |
$sections_ids = LP_Object_Cache::get( 'course-' . $this->course_id, 'learn-press/course-sections-ids' );
|
139 |
|
160 |
LP_Course_Utils::set_cache_db_sections( $this->course_id, false );
|
161 |
|
162 |
return true;
|
163 |
+
}*/
|
164 |
|
165 |
/**
|
166 |
* Load data from database.
|
@@ -351,16 +351,18 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
|
|
351 |
$orders = array();
|
352 |
$post_status_in = learn_press_get_order_statuses( true, true );
|
353 |
$post_status_in_format = array_fill( 0, sizeof( $post_status_in ), '%s' );
|
|
|
354 |
|
355 |
// Get order by user
|
356 |
$sql_orders = $wpdb->prepare(
|
357 |
"
|
358 |
SELECT p.*
|
359 |
FROM {$wpdb->posts} p
|
360 |
-
INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND meta_key = %s AND meta_value = %d
|
361 |
-
|
362 |
'_user_id',
|
363 |
-
$user_id
|
|
|
364 |
);
|
365 |
|
366 |
/**
|
@@ -472,161 +474,161 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
|
|
472 |
* @editor tungnx
|
473 |
* @modify 4.1.4 - comment - not use
|
474 |
*/
|
475 |
-
//
|
476 |
-
//
|
477 |
-
//
|
478 |
-
//
|
479 |
-
//
|
480 |
-
//
|
481 |
-
//
|
482 |
-
//
|
483 |
-
//
|
484 |
-
//
|
485 |
-
//
|
486 |
-
//
|
487 |
-
//
|
488 |
-
//
|
489 |
-
//
|
490 |
-
//
|
491 |
-
//
|
492 |
-
//
|
493 |
-
//
|
494 |
-
//
|
495 |
-
//
|
496 |
-
//
|
497 |
-
//
|
498 |
-
//
|
499 |
-
//
|
500 |
-
//
|
501 |
-
//
|
502 |
-
//
|
503 |
-
//
|
504 |
-
//
|
505 |
-
//
|
506 |
-
//
|
507 |
-
//
|
508 |
-
//
|
509 |
-
//
|
510 |
-
//
|
511 |
-
//
|
512 |
-
//
|
513 |
-
//
|
514 |
-
//
|
515 |
-
//
|
516 |
-
//
|
517 |
-
//
|
518 |
-
//
|
519 |
-
//
|
520 |
-
//
|
521 |
-
//
|
522 |
-
//
|
523 |
-
//
|
524 |
-
//
|
525 |
-
//
|
526 |
-
//
|
527 |
-
//
|
528 |
-
//
|
529 |
-
//
|
530 |
-
//
|
531 |
-
//
|
532 |
-
//
|
533 |
-
//
|
534 |
-
//
|
535 |
-
//
|
536 |
-
//
|
537 |
-
//
|
538 |
-
//
|
539 |
-
//
|
540 |
-
//
|
541 |
-
//
|
542 |
-
//
|
543 |
-
//
|
544 |
-
//
|
545 |
-
//
|
546 |
-
//
|
547 |
-
//
|
548 |
-
//
|
549 |
-
//
|
550 |
-
//
|
551 |
-
//
|
552 |
-
//
|
553 |
-
//
|
554 |
-
//
|
555 |
-
//
|
556 |
-
//
|
557 |
-
//
|
558 |
-
//
|
559 |
-
//
|
560 |
-
//
|
561 |
-
//
|
562 |
-
//
|
563 |
-
//
|
564 |
-
//
|
565 |
-
//
|
566 |
-
//
|
567 |
-
//
|
568 |
-
//
|
569 |
-
//
|
570 |
-
//
|
571 |
-
//
|
572 |
-
//
|
573 |
-
//
|
574 |
-
//
|
575 |
-
//
|
576 |
-
//
|
577 |
-
//
|
578 |
-
//
|
579 |
-
//
|
580 |
-
//
|
581 |
-
//
|
582 |
-
//
|
583 |
-
//
|
584 |
-
//
|
585 |
-
//
|
586 |
-
//
|
587 |
-
//
|
588 |
-
//
|
589 |
-
//
|
590 |
-
//
|
591 |
-
//
|
592 |
-
//
|
593 |
-
//
|
594 |
-
//
|
595 |
-
//
|
596 |
-
//
|
597 |
-
//
|
598 |
-
//
|
599 |
-
//
|
600 |
-
//
|
601 |
-
//
|
602 |
-
////
|
603 |
-
////
|
604 |
-
//
|
605 |
-
//
|
606 |
-
//
|
607 |
-
//
|
608 |
-
//
|
609 |
-
//
|
610 |
-
//
|
611 |
-
//
|
612 |
-
//
|
613 |
-
//
|
614 |
-
//
|
615 |
-
//
|
616 |
-
//
|
617 |
-
//
|
618 |
-
//
|
619 |
-
//
|
620 |
-
//
|
621 |
-
//
|
622 |
-
//
|
623 |
-
//
|
624 |
-
//
|
625 |
-
//
|
626 |
-
//
|
627 |
-
//
|
628 |
-
//
|
629 |
-
//
|
630 |
|
631 |
protected function _group_orders( &$orders ) {
|
632 |
$groups = array();
|
@@ -1904,10 +1906,13 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
|
|
1904 |
$query_args = $course_ids;
|
1905 |
$query_args[] = $user_id;
|
1906 |
|
1907 |
-
$select = 'SELECT
|
1908 |
$from = "FROM {$wpdb->learnpress_user_items} ui";
|
1909 |
-
$join =
|
1910 |
-
$where
|
|
|
|
|
|
|
1911 |
$having = 'HAVING 1';
|
1912 |
$orderby = 'ORDER BY item_id, user_item_id DESC';
|
1913 |
|
@@ -1977,21 +1982,31 @@ class LP_User_CURD extends LP_Object_Data_CURD implements LP_Interface_CURD {
|
|
1977 |
|
1978 |
list( $select, $from, $join, $where, $having, $orderby ) = array_values( $query_parts );
|
1979 |
|
1980 |
-
$sql = "
|
1981 |
-
SELECT
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1995 |
|
1996 |
$items = $wpdb->get_results( $sql, ARRAY_A );
|
1997 |
|
351 |
$orders = array();
|
352 |
$post_status_in = learn_press_get_order_statuses( true, true );
|
353 |
$post_status_in_format = array_fill( 0, sizeof( $post_status_in ), '%s' );
|
354 |
+
$user_id_str = $wpdb->prepare( '%"%d"%', $user_id );
|
355 |
|
356 |
// Get order by user
|
357 |
$sql_orders = $wpdb->prepare(
|
358 |
"
|
359 |
SELECT p.*
|
360 |
FROM {$wpdb->posts} p
|
361 |
+
INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND meta_key = %s AND (meta_value = %d OR meta_value like '%s')
|
362 |
+
",
|
363 |
'_user_id',
|
364 |
+
$user_id,
|
365 |
+
$user_id_str
|
366 |
);
|
367 |
|
368 |
/**
|
474 |
* @editor tungnx
|
475 |
* @modify 4.1.4 - comment - not use
|
476 |
*/
|
477 |
+
// public function read_orders( $user_id, $args = array() ) {
|
478 |
+
// $user = learn_press_get_user( $user_id );
|
479 |
+
//
|
480 |
+
// if ( ! $user_id || ! $user ) {
|
481 |
+
// return false;
|
482 |
+
// }
|
483 |
+
//
|
484 |
+
// $cache_key = false;
|
485 |
+
//
|
486 |
+
// if ( $args ) {
|
487 |
+
// $args = wp_parse_args(
|
488 |
+
// $args,
|
489 |
+
// array(
|
490 |
+
// 'group_by_order' => false,
|
491 |
+
// 'status' => '',
|
492 |
+
// )
|
493 |
+
// );
|
494 |
+
//
|
495 |
+
// ksort( $args );
|
496 |
+
// $cache_key = md5( serialize( $args ) );
|
497 |
+
//
|
498 |
+
// /**
|
499 |
+
// * Get orders from cache by args
|
500 |
+
// */
|
501 |
+
// $orders = LP_Object_Cache::get( "user-{$user_id}-" . $cache_key, 'learn-press/user-orders' );
|
502 |
+
//
|
503 |
+
// if ( false !== $orders ) {
|
504 |
+
// return $orders;
|
505 |
+
// }
|
506 |
+
// }
|
507 |
+
//
|
508 |
+
// $orders = LP_Object_Cache::get( 'user-' . $user_id, 'learn-press/user-orders' );
|
509 |
+
//
|
510 |
+
// if ( false === $orders ) {
|
511 |
+
// global $wpdb;
|
512 |
+
//
|
513 |
+
// $orders = array();
|
514 |
+
// $post_status_in = learn_press_get_order_statuses( true, true );
|
515 |
+
// $post_status_in_format = array_fill( 0, sizeof( $post_status_in ), '%s' );
|
516 |
+
//
|
517 |
+
// // Get order by user
|
518 |
+
// $sql_orders = $wpdb->prepare(
|
519 |
+
// "
|
520 |
+
// SELECT ID, post_title, post_name, post_status, post_type, post_parent, post_date
|
521 |
+
// FROM {$wpdb->posts} p
|
522 |
+
// INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND meta_key = %s AND meta_value = %d
|
523 |
+
// ",
|
524 |
+
// '_user_id',
|
525 |
+
// $user_id
|
526 |
+
// );
|
527 |
+
//
|
528 |
+
// /**
|
529 |
+
// * Get order checked out by Guest but with the email of the user are getting
|
530 |
+
// */
|
531 |
+
// $sql_guest_orders = $wpdb->prepare(
|
532 |
+
// "
|
533 |
+
// SELECT ID, post_title, post_name, post_status, post_type, post_parent, post_date
|
534 |
+
// FROM {$wpdb->posts} p
|
535 |
+
// INNER JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id AND meta_key = %s AND meta_value = %s
|
536 |
+
// LEFT JOIN {$wpdb->postmeta} pmu ON p.ID = pmu.post_id AND pmu.meta_key = %s AND pmu.meta_value IS NULL
|
537 |
+
// ",
|
538 |
+
// '_checkout_email',
|
539 |
+
// $user->get_email(),
|
540 |
+
// '_user_id'
|
541 |
+
// );
|
542 |
+
//
|
543 |
+
// /**
|
544 |
+
// * The rest
|
545 |
+
// */
|
546 |
+
// $sql_rest = $wpdb->prepare(
|
547 |
+
// '
|
548 |
+
// HAVING p.post_type = %s
|
549 |
+
// AND p.post_status IN(' . join( ',', $post_status_in_format ) . ')
|
550 |
+
// ORDER BY ID DESC
|
551 |
+
// ',
|
552 |
+
// array_merge(
|
553 |
+
// array(
|
554 |
+
// LP_ORDER_CPT,
|
555 |
+
// ),
|
556 |
+
// $post_status_in
|
557 |
+
// )
|
558 |
+
// );
|
559 |
+
//
|
560 |
+
// $sql = $sql_orders . ' UNION ' . $sql_guest_orders . $sql_rest;
|
561 |
+
//
|
562 |
+
// $order_posts = $wpdb->get_results( $sql );
|
563 |
+
//
|
564 |
+
// if ( $order_posts ) {
|
565 |
+
// $order_ids = array();
|
566 |
+
// foreach ( $order_posts as $order_post ) {
|
567 |
+
//
|
568 |
+
// // Put post into cache to user later ... maybe.
|
569 |
+
// $_post = sanitize_post( $order_post, 'raw' );
|
570 |
+
// wp_cache_add( $_post->ID, $_post, 'posts' );
|
571 |
+
//
|
572 |
+
// $order_ids[] = $_post->ID;
|
573 |
+
// }
|
574 |
+
//
|
575 |
+
// $order_ids_format = array_fill( 0, sizeof( $order_ids ), '%d' );
|
576 |
+
// $query = $wpdb->prepare(
|
577 |
+
// "
|
578 |
+
// SELECT meta_value as course_id, order_id
|
579 |
+
// FROM {$wpdb->learnpress_order_items} oi
|
580 |
+
// INNER JOIN {$wpdb->learnpress_order_itemmeta} oim ON oi.order_item_id = oim.learnpress_order_item_id AND oim.meta_key = %s
|
581 |
+
// WHERE oi.order_id IN (" . join( ',', $order_ids_format ) . ')
|
582 |
+
// ORDER BY FIELD(order_id, ' . join( ',', $order_ids_format ) . ')
|
583 |
+
// ',
|
584 |
+
// array_merge( array( '_course_id' ), $order_ids, $order_ids )
|
585 |
+
// );
|
586 |
+
//
|
587 |
+
// if ( $results = $wpdb->get_results( $query ) ) {
|
588 |
+
// foreach ( $results as $result ) {
|
589 |
+
// if ( empty( $orders[ $result->course_id ] ) ) {
|
590 |
+
// $orders[ $result->course_id ] = array();
|
591 |
+
// }
|
592 |
+
// $orders[ $result->course_id ][] = $result->order_id;
|
593 |
+
// }
|
594 |
+
// }
|
595 |
+
// }
|
596 |
+
// // Store to cache
|
597 |
+
// LP_Object_Cache::set( 'user-' . $user_id, $orders, 'learn-press/user-orders' );
|
598 |
+
// }
|
599 |
+
//
|
600 |
+
// if ( $orders ) {
|
601 |
+
//
|
602 |
+
// /*** TEST CACHE */
|
603 |
+
// $all_orders = call_user_func_array( 'array_merge', $orders );
|
604 |
+
//// $curd = new LP_Object_Data_CURD();
|
605 |
+
//// $curd->read_meta_by_ids( $all_orders, 'post' );
|
606 |
+
//
|
607 |
+
// if ( array_key_exists( 'status', $args ) && $args['status'] ) {
|
608 |
+
// LP_Helper::sanitize_order_status( $args['status'] );
|
609 |
+
//
|
610 |
+
// $statuses = (array) $args['status'];
|
611 |
+
// foreach ( $orders as $course_id => $order_ids ) {
|
612 |
+
// $orders[ $course_id ] = array();
|
613 |
+
// foreach ( $order_ids as $order_id ) {
|
614 |
+
// if ( in_array( get_post_status( $order_id ), $statuses ) ) {
|
615 |
+
// $orders[ $course_id ][] = $order_id;
|
616 |
+
// }
|
617 |
+
// }
|
618 |
+
// }
|
619 |
+
// }
|
620 |
+
//
|
621 |
+
// if ( array_key_exists( 'group_by_order', $args ) && $args['group_by_order'] ) {
|
622 |
+
// $this->_group_orders( $orders );
|
623 |
+
// }
|
624 |
+
// }
|
625 |
+
//
|
626 |
+
// if ( $cache_key ) {
|
627 |
+
// LP_Object_Cache::set( "user-{$user_id}-" . $cache_key, $orders, 'learn-press/user-orders' );
|
628 |
+
// }
|
629 |
+
//
|
630 |
+
// return $orders;
|
631 |
+
// }
|
632 |
|
633 |
protected function _group_orders( &$orders ) {
|
634 |
$groups = array();
|
1906 |
$query_args = $course_ids;
|
1907 |
$query_args[] = $user_id;
|
1908 |
|
1909 |
+
$select = 'SELECT * ';
|
1910 |
$from = "FROM {$wpdb->learnpress_user_items} ui";
|
1911 |
+
$join = '';
|
1912 |
+
$where = 'WHERE 1=1 ';
|
1913 |
+
$where .= $wpdb->prepare( 'AND user_id = %d ', $user_id );
|
1914 |
+
$where .= $wpdb->prepare( 'AND item_type = %s ', LP_QUIZ_CPT );
|
1915 |
+
$where .= $wpdb->prepare( 'AND status IN (%s, %s) ', LP_ITEM_COMPLETED, LP_ITEM_STARTED );
|
1916 |
$having = 'HAVING 1';
|
1917 |
$orderby = 'ORDER BY item_id, user_item_id DESC';
|
1918 |
|
1982 |
|
1983 |
list( $select, $from, $join, $where, $having, $orderby ) = array_values( $query_parts );
|
1984 |
|
1985 |
+
$sql = $wpdb->prepare("
|
1986 |
+
SELECT * FROM (
|
1987 |
+
SELECT *
|
1988 |
+
FROM
|
1989 |
+
(
|
1990 |
+
{$select}
|
1991 |
+
{$from}
|
1992 |
+
{$join}
|
1993 |
+
{$where}
|
1994 |
+
ORDER BY user_item_id DESC
|
1995 |
+
) AS G_Item
|
1996 |
+
GROUP BY G_Item.item_id
|
1997 |
+
) AS G_User_Item
|
1998 |
+
ORDER BY G_User_Item.user_item_id DESC
|
1999 |
+
LIMIT %d, %d
|
2000 |
+
", $offset, $limit);
|
2001 |
+
|
2002 |
+
$sql = "SELECT DISTINCT item_id, MAX(user_item_id) as user_item_id , user_id, item_type, start_time, end_time, status, graduation, parent_id
|
2003 |
+
FROM $wpdb->learnpress_user_items
|
2004 |
+
WHERE user_id = $user_id
|
2005 |
+
AND item_type = 'lp_quiz'
|
2006 |
+
AND status IN ('completed', 'started')
|
2007 |
+
GROUP BY item_id
|
2008 |
+
ORDER BY MAX(user_item_id) DESC";
|
2009 |
+
|
2010 |
|
2011 |
$items = $wpdb->get_results( $sql, ARRAY_A );
|
2012 |
|
@@ -553,7 +553,7 @@ abstract class LP_Abstract_Post_Type {
|
|
553 |
return $join;
|
554 |
}
|
555 |
|
556 |
-
|
557 |
if ( ! $this->_check_post() ) {
|
558 |
return $where;
|
559 |
}
|
@@ -747,7 +747,7 @@ abstract class LP_Abstract_Post_Type {
|
|
747 |
}
|
748 |
|
749 |
public function columns_content( $column, $post_id = 0 ) {
|
750 |
-
|
751 |
}
|
752 |
|
753 |
/**
|
553 |
return $join;
|
554 |
}
|
555 |
|
556 |
+
final function _posts_where_paged( $where ) {
|
557 |
if ( ! $this->_check_post() ) {
|
558 |
return $where;
|
559 |
}
|
747 |
}
|
748 |
|
749 |
public function columns_content( $column, $post_id = 0 ) {
|
750 |
+
// Implement from child
|
751 |
}
|
752 |
|
753 |
/**
|
@@ -248,9 +248,13 @@ if ( ! class_exists( 'LP_Course_Post_Type' ) ) {
|
|
248 |
*/
|
249 |
public function before_delete( int $post_id ) {
|
250 |
// course curd
|
251 |
-
|
252 |
-
|
253 |
-
$
|
|
|
|
|
|
|
|
|
254 |
}
|
255 |
|
256 |
/**
|
@@ -580,9 +584,22 @@ if ( ! class_exists( 'LP_Course_Post_Type' ) ) {
|
|
580 |
$html_items = array();
|
581 |
$post_types = get_post_types( null, 'objects' );
|
582 |
|
583 |
-
$stats_objects = $curd->count_items( $post_id, 'edit' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
-
if ( $stats_objects ) {
|
586 |
foreach ( $stats_objects as $type => $count ) {
|
587 |
if ( ! $count || ! isset( $post_types[ $type ] ) ) {
|
588 |
continue;
|
@@ -593,7 +610,7 @@ if ( ! class_exists( 'LP_Course_Post_Type' ) ) {
|
|
593 |
$plural_name = strtolower( $post_type_object->label );
|
594 |
$html_items[] = sprintf( _n( '<strong>%d</strong> ' . $singular_name, '<strong>%d</strong> ' . $plural_name, $count, 'learnpress' ), $count );
|
595 |
}
|
596 |
-
}
|
597 |
|
598 |
$html_items = apply_filters( 'learn-press/course-count-items', $html_items );
|
599 |
|
248 |
*/
|
249 |
public function before_delete( int $post_id ) {
|
250 |
// course curd
|
251 |
+
//$curd = new LP_Course_CURD();
|
252 |
+
//$curd->remove_course( $post_id );
|
253 |
+
$course = learn_press_get_course( $post_id );
|
254 |
+
if ( ! $course ) {
|
255 |
+
return;
|
256 |
+
}
|
257 |
+
$course->delete_relate_data_when_delete_course();
|
258 |
}
|
259 |
|
260 |
/**
|
584 |
$html_items = array();
|
585 |
$post_types = get_post_types( null, 'objects' );
|
586 |
|
587 |
+
// $stats_objects = $curd->count_items( $post_id, 'edit' );
|
588 |
+
|
589 |
+
foreach ( learn_press_get_course_item_types() as $item_type ) {
|
590 |
+
$count_item = $course->count_items( $item_type );
|
591 |
+
|
592 |
+
if ( ! $count_item ) {
|
593 |
+
continue;
|
594 |
+
}
|
595 |
+
|
596 |
+
$post_type_object = $post_types[ $item_type ];
|
597 |
+
$singular_name = $post_type_object->labels->singular_name;
|
598 |
+
$plural_name = $post_type_object->label;
|
599 |
+
$html_items[] = sprintf( _n( '<strong>%d</strong> ' . $singular_name, '<strong>%d</strong> ' . $plural_name, $count_item, 'learnpress' ), $count_item );
|
600 |
+
}
|
601 |
|
602 |
+
/*if ( $stats_objects ) {
|
603 |
foreach ( $stats_objects as $type => $count ) {
|
604 |
if ( ! $count || ! isset( $post_types[ $type ] ) ) {
|
605 |
continue;
|
610 |
$plural_name = strtolower( $post_type_object->label );
|
611 |
$html_items[] = sprintf( _n( '<strong>%d</strong> ' . $singular_name, '<strong>%d</strong> ' . $plural_name, $count, 'learnpress' ), $count );
|
612 |
}
|
613 |
+
}*/
|
614 |
|
615 |
$html_items = apply_filters( 'learn-press/course-count-items', $html_items );
|
616 |
|
@@ -103,58 +103,43 @@ if ( ! class_exists( 'LP_Lesson_Post_Type' ) ) {
|
|
103 |
*
|
104 |
* @param array $views
|
105 |
*
|
106 |
-
* @return
|
107 |
* @since 3.0.0
|
108 |
-
*
|
|
|
109 |
*/
|
110 |
-
public function views_pages( $views ) {
|
111 |
-
$
|
112 |
-
|
113 |
-
if (
|
114 |
-
$views['
|
115 |
-
'<a href="%s" class="
|
116 |
-
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&unassigned=yes' ),
|
117 |
-
$unassigned_text
|
118 |
-
);
|
119 |
-
} else {
|
120 |
-
$views['lesson-unassigned'] = sprintf(
|
121 |
-
'<a href="%s">%s</a>',
|
122 |
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&unassigned=yes' ),
|
123 |
-
$
|
|
|
|
|
124 |
);
|
125 |
}
|
126 |
|
127 |
$total_preview_items = LP_Lesson_DB::getInstance()->get_total_preview_items();
|
128 |
-
|
129 |
-
|
130 |
-
if ( 'yes' === LP_Request::get( 'preview' ) ) {
|
131 |
$views['lesson-preview'] = sprintf(
|
132 |
-
'<a href="%s" class="
|
133 |
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&preview=yes' ),
|
134 |
-
$
|
135 |
-
|
136 |
-
|
137 |
-
$views['lesson-preview'] = sprintf(
|
138 |
-
'<a href="%s">%s</a>',
|
139 |
-
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&preview=yes' ),
|
140 |
-
$preview_text
|
141 |
);
|
142 |
}
|
143 |
|
144 |
$total_no_preview_items = LP_Lesson_DB::getInstance()->get_total_no_preview_items( $total_preview_items );
|
145 |
-
|
146 |
-
|
147 |
-
if ( 'no' === LP_Request::get( 'preview' ) ) {
|
148 |
-
$views['lesson-no-preview'] = sprintf(
|
149 |
-
'<a href="%s" class="current">%s</a>',
|
150 |
-
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&preview=no' ),
|
151 |
-
$no_preview_text
|
152 |
-
);
|
153 |
-
} else {
|
154 |
$views['lesson-no-preview'] = sprintf(
|
155 |
-
'<a href="%s">%s</a>',
|
156 |
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&preview=no' ),
|
157 |
-
$
|
|
|
|
|
158 |
);
|
159 |
}
|
160 |
|
103 |
*
|
104 |
* @param array $views
|
105 |
*
|
106 |
+
* @return array
|
107 |
* @since 3.0.0
|
108 |
+
* @editor tungnx
|
109 |
+
* @modify 4.1.4.1
|
110 |
*/
|
111 |
+
public function views_pages( array $views ): array {
|
112 |
+
$count_unassigned_lesson = LP_Course_DB::getInstance()->get_total_item_unassigned( LP_LESSON_CPT );
|
113 |
+
|
114 |
+
if ( $count_unassigned_lesson > 0 ) {
|
115 |
+
$views['unassigned'] = sprintf(
|
116 |
+
'<a href="%s" class="%s">%s <span class="count">(%d)</span></a>',
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&unassigned=yes' ),
|
118 |
+
isset( $_GET['unassigned'] ) ? 'current' : '',
|
119 |
+
__( 'Unassigned', 'learnpress' ),
|
120 |
+
$count_unassigned_lesson
|
121 |
);
|
122 |
}
|
123 |
|
124 |
$total_preview_items = LP_Lesson_DB::getInstance()->get_total_preview_items();
|
125 |
+
if ( $total_preview_items > 0 ) {
|
|
|
|
|
126 |
$views['lesson-preview'] = sprintf(
|
127 |
+
'<a href="%s" class="%s">%s <span class="count">(%d)</span></a>',
|
128 |
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&preview=yes' ),
|
129 |
+
isset( $_GET['preview'] ) && $_GET['preview'] === 'yes' ? 'current' : '',
|
130 |
+
__( 'Preview', 'learnpress' ),
|
131 |
+
$total_preview_items
|
|
|
|
|
|
|
|
|
132 |
);
|
133 |
}
|
134 |
|
135 |
$total_no_preview_items = LP_Lesson_DB::getInstance()->get_total_no_preview_items( $total_preview_items );
|
136 |
+
if ( $total_no_preview_items > 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
$views['lesson-no-preview'] = sprintf(
|
138 |
+
'<a href="%s" class="%s">%s <span class="count">(%d)</span></a>',
|
139 |
admin_url( 'edit.php?post_type=' . LP_LESSON_CPT . '&preview=no' ),
|
140 |
+
isset( $_GET['preview'] ) && $_GET['preview'] === 'no' ? 'current' : '',
|
141 |
+
__( 'No Preview', 'learnpress' ),
|
142 |
+
$total_no_preview_items
|
143 |
);
|
144 |
}
|
145 |
|
@@ -340,8 +340,11 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
|
|
340 |
|
341 |
$created_via = $order->get_created_via();
|
342 |
if ( empty( $created_via ) ) {
|
343 |
-
$user_id = learn_press_get_request( 'order-customer' );
|
344 |
$order->set_created_via( 'manual' );
|
|
|
|
|
|
|
|
|
345 |
$order->set_user_id( $user_id );
|
346 |
}
|
347 |
|
@@ -366,7 +369,7 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
|
|
366 |
<script type="text/javascript">
|
367 |
jQuery(function ($) {
|
368 |
$('#post-search-input').prop('placeholder',
|
369 |
-
'<?php esc_attr_e( 'Order number,
|
370 |
})
|
371 |
</script>
|
372 |
<?php
|
@@ -401,8 +404,9 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
|
|
401 |
# filter by user id
|
402 |
preg_match( "#{$wpdb->posts}\.post_author IN\s*\((\d+)\)#", $where, $matches );
|
403 |
if ( ! empty( $matches ) && isset( $matches[1] ) ) {
|
404 |
-
$author_id
|
405 |
-
$
|
|
|
406 |
|
407 |
$sql = " {$wpdb->posts}.ID IN ( SELECT
|
408 |
IF( p.post_parent >0, p.post_parent, p.ID)
|
@@ -410,14 +414,11 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
|
|
410 |
{$wpdb->posts} AS p
|
411 |
INNER JOIN
|
412 |
{$wpdb->postmeta} m ON p.ID = m.post_id and p.post_type = %s
|
413 |
-
AND m.meta_key = %s
|
414 |
-
|
415 |
-
|
416 |
-
WHERE
|
417 |
-
p.post_type = 'lp_order'
|
418 |
-
AND u.ID = %d ) ";
|
419 |
|
420 |
-
$sql = $wpdb->prepare( $sql, array( LP_ORDER_CPT, '_user_id', $author_id ) );
|
421 |
$where = str_replace( $matches[0], $sql, $where );
|
422 |
}
|
423 |
|
@@ -444,6 +445,7 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
|
|
444 |
OR {$wpdb->posts}.ID LIKE %s
|
445 |
) ";
|
446 |
$sql = $wpdb->prepare( $sql, array( LP_ORDER_CPT, '_user_id', $s, $s, $s, $s, $s ) );
|
|
|
447 |
# search order via course name
|
448 |
$sql .= ' OR ' . $wpdb->prepare(
|
449 |
" {$wpdb->posts}.ID IN (
|
@@ -508,9 +510,11 @@ if ( ! class_exists( 'LP_Order_Post_Type' ) ) {
|
|
508 |
if ( ! $this->is_page_list_posts_on_backend() ) {
|
509 |
return $join;
|
510 |
}
|
511 |
-
|
512 |
$join .= " INNER JOIN {$wpdb->postmeta} pm1 ON {$wpdb->posts}.ID = pm1.post_id AND pm1.meta_key = '_user_id'";
|
513 |
$join .= " INNER JOIN {$wpdb->postmeta} pm2 ON {$wpdb->posts}.ID = pm2.post_id AND pm2.meta_key = '_order_total'";
|
|
|
|
|
514 |
if ( $s ) {
|
515 |
$join .= " INNER JOIN {$wpdb->learnpress_order_items} loi ON {$wpdb->posts}.ID = loi.order_id";
|
516 |
}
|
340 |
|
341 |
$created_via = $order->get_created_via();
|
342 |
if ( empty( $created_via ) ) {
|
|
|
343 |
$order->set_created_via( 'manual' );
|
344 |
+
}
|
345 |
+
|
346 |
+
if ( isset( $_POST['order-customer'] ) ) {
|
347 |
+
$user_id = LP_Helper::sanitize_params_submitted( $_POST['order-customer'] );
|
348 |
$order->set_user_id( $user_id );
|
349 |
}
|
350 |
|
369 |
<script type="text/javascript">
|
370 |
jQuery(function ($) {
|
371 |
$('#post-search-input').prop('placeholder',
|
372 |
+
'<?php esc_attr_e( 'Order number, course name etc...', 'learnpress' ); ?>').css('width', 300)
|
373 |
})
|
374 |
</script>
|
375 |
<?php
|
404 |
# filter by user id
|
405 |
preg_match( "#{$wpdb->posts}\.post_author IN\s*\((\d+)\)#", $where, $matches );
|
406 |
if ( ! empty( $matches ) && isset( $matches[1] ) ) {
|
407 |
+
$author_id = intval( $matches[1] );
|
408 |
+
$author_id_str = $wpdb->prepare( '%"%d"%', $author_id );
|
409 |
+
//$sql = ' ( pm1.meta_value = %d OR pm1.meta_value LIKE %s)';
|
410 |
|
411 |
$sql = " {$wpdb->posts}.ID IN ( SELECT
|
412 |
IF( p.post_parent >0, p.post_parent, p.ID)
|
414 |
{$wpdb->posts} AS p
|
415 |
INNER JOIN
|
416 |
{$wpdb->postmeta} m ON p.ID = m.post_id and p.post_type = %s
|
417 |
+
AND m.meta_key = %s AND (meta_value = %d OR meta_value like %s )
|
418 |
+
)
|
419 |
+
";
|
|
|
|
|
|
|
420 |
|
421 |
+
$sql = $wpdb->prepare( $sql, array( LP_ORDER_CPT, '_user_id', $author_id, $author_id_str ) );
|
422 |
$where = str_replace( $matches[0], $sql, $where );
|
423 |
}
|
424 |
|
445 |
OR {$wpdb->posts}.ID LIKE %s
|
446 |
) ";
|
447 |
$sql = $wpdb->prepare( $sql, array( LP_ORDER_CPT, '_user_id', $s, $s, $s, $s, $s ) );
|
448 |
+
//print_r($sql);die('ccc');
|
449 |
# search order via course name
|
450 |
$sql .= ' OR ' . $wpdb->prepare(
|
451 |
" {$wpdb->posts}.ID IN (
|
510 |
if ( ! $this->is_page_list_posts_on_backend() ) {
|
511 |
return $join;
|
512 |
}
|
513 |
+
|
514 |
$join .= " INNER JOIN {$wpdb->postmeta} pm1 ON {$wpdb->posts}.ID = pm1.post_id AND pm1.meta_key = '_user_id'";
|
515 |
$join .= " INNER JOIN {$wpdb->postmeta} pm2 ON {$wpdb->posts}.ID = pm2.post_id AND pm2.meta_key = '_order_total'";
|
516 |
+
|
517 |
+
$s = $wp_query->get( 's' );
|
518 |
if ( $s ) {
|
519 |
$join .= " INNER JOIN {$wpdb->learnpress_order_items} loi ON {$wpdb->posts}.ID = loi.order_id";
|
520 |
}
|
@@ -70,34 +70,27 @@ if ( ! class_exists( 'LP_Question_Post_Type' ) ) {
|
|
70 |
*
|
71 |
* @param array $views
|
72 |
*
|
73 |
-
* @return
|
74 |
* @since 3.0.1
|
75 |
* @editor tungnx
|
76 |
*/
|
77 |
-
public function views_pages( $views ) {
|
78 |
-
$
|
79 |
-
$unassigned_items = LP_Question_DB::getInstance()->get_total_question_unassigned();
|
80 |
-
$text = sprintf( __( 'Unassigned %s', 'learnpress' ), '<span class="count">(' . $unassigned_items . ')</span>' );
|
81 |
|
82 |
-
if (
|
83 |
-
$views['unassigned'] = sprintf(
|
84 |
-
'<a href="%s" class="current">%s</a>',
|
85 |
-
admin_url( 'edit.php?post_type=' . LP_QUESTION_CPT . '&unassigned=yes' ),
|
86 |
-
$text
|
87 |
-
);
|
88 |
-
} else {
|
89 |
$views['unassigned'] = sprintf(
|
90 |
-
'<a href="%s">%s</a>',
|
91 |
admin_url( 'edit.php?post_type=' . LP_QUESTION_CPT . '&unassigned=yes' ),
|
92 |
-
$
|
|
|
|
|
93 |
);
|
94 |
}
|
95 |
|
96 |
// Get count question
|
97 |
-
if ( ! current_user_can( 'administrator' ) ) {
|
98 |
$filter = new LP_Question_Filter();
|
99 |
-
$filter->
|
100 |
-
$filter->_user_id = $user_id;
|
101 |
|
102 |
$totalPostAllStatus = LP_Database::getInstance()->get_count_post_of_user( $filter );
|
103 |
$views['all'] = wp_sprintf( '<a href="edit.php?post_type=lp_question" class="current" aria-current="page">All <span class="count">(%d)</span></a>', $totalPostAllStatus );
|
@@ -113,7 +106,7 @@ if ( ! class_exists( 'LP_Question_Post_Type' ) ) {
|
|
113 |
$totalPostPublish = LP_Database::getInstance()->get_count_post_of_user( $filter );
|
114 |
$views['publish'] = wp_sprintf( '<a href="edit.php?post_type=lp_question&post_status=publish" class="current" aria-current="page">Published <span class="count">(%d)</span></a>', $totalPostPublish );
|
115 |
}
|
116 |
-
}
|
117 |
|
118 |
return $views;
|
119 |
}
|
@@ -428,21 +421,13 @@ if ( ! class_exists( 'LP_Question_Post_Type' ) ) {
|
|
428 |
|
429 |
if ( 'yes' === LP_Request::get( 'unassigned' ) ) {
|
430 |
global $wpdb;
|
431 |
-
$where .= $wpdb->
|
432 |
-
"
|
433 |
-
AND {$wpdb->posts}.ID NOT IN(
|
434 |
SELECT qq.question_id
|
435 |
FROM {$wpdb->learnpress_quiz_questions} qq
|
436 |
-
INNER JOIN {$wpdb->posts} p ON p.ID = qq.question_id
|
437 |
-
WHERE p.post_type = %s
|
438 |
)
|
439 |
-
"
|
440 |
-
LP_QUESTION_CPT
|
441 |
-
);
|
442 |
}
|
443 |
|
444 |
-
$posts_where_paged = true;
|
445 |
-
|
446 |
return $where;
|
447 |
}
|
448 |
|
70 |
*
|
71 |
* @param array $views
|
72 |
*
|
73 |
+
* @return array
|
74 |
* @since 3.0.1
|
75 |
* @editor tungnx
|
76 |
*/
|
77 |
+
public function views_pages( array $views ): array {
|
78 |
+
$count_unassigned_questions = LP_Question_DB::getInstance()->get_total_question_unassigned();
|
|
|
|
|
79 |
|
80 |
+
if ( $count_unassigned_questions > 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
$views['unassigned'] = sprintf(
|
82 |
+
'<a href="%s" class="%s">%s <span class="count">(%d)</span></a>',
|
83 |
admin_url( 'edit.php?post_type=' . LP_QUESTION_CPT . '&unassigned=yes' ),
|
84 |
+
isset( $_GET['unassigned'] ) ? 'current' : '',
|
85 |
+
__( 'Unassigned', 'learnpress' ),
|
86 |
+
$count_unassigned_questions
|
87 |
);
|
88 |
}
|
89 |
|
90 |
// Get count question
|
91 |
+
/*if ( ! current_user_can( 'administrator' ) ) {
|
92 |
$filter = new LP_Question_Filter();
|
93 |
+
$filter->post_author = $user_id;
|
|
|
94 |
|
95 |
$totalPostAllStatus = LP_Database::getInstance()->get_count_post_of_user( $filter );
|
96 |
$views['all'] = wp_sprintf( '<a href="edit.php?post_type=lp_question" class="current" aria-current="page">All <span class="count">(%d)</span></a>', $totalPostAllStatus );
|
106 |
$totalPostPublish = LP_Database::getInstance()->get_count_post_of_user( $filter );
|
107 |
$views['publish'] = wp_sprintf( '<a href="edit.php?post_type=lp_question&post_status=publish" class="current" aria-current="page">Published <span class="count">(%d)</span></a>', $totalPostPublish );
|
108 |
}
|
109 |
+
}*/
|
110 |
|
111 |
return $views;
|
112 |
}
|
421 |
|
422 |
if ( 'yes' === LP_Request::get( 'unassigned' ) ) {
|
423 |
global $wpdb;
|
424 |
+
$where .= " AND {$wpdb->posts}.ID NOT IN(
|
|
|
|
|
425 |
SELECT qq.question_id
|
426 |
FROM {$wpdb->learnpress_quiz_questions} qq
|
|
|
|
|
427 |
)
|
428 |
+
";
|
|
|
|
|
429 |
}
|
430 |
|
|
|
|
|
431 |
return $where;
|
432 |
}
|
433 |
|
@@ -56,23 +56,18 @@ if ( ! class_exists( 'LP_Quiz_Post_Type' ) ) {
|
|
56 |
*
|
57 |
* @param array $views
|
58 |
*
|
59 |
-
* @return
|
60 |
*/
|
61 |
-
public function views_pages( $views ) {
|
62 |
-
$
|
63 |
-
$text = sprintf( __( 'Unassigned %s', 'learnpress' ), '<span class="count">(' . sizeof( $unassigned_items ) . ')</span>' );
|
64 |
|
65 |
-
if (
|
66 |
-
$views['unassigned'] = sprintf(
|
67 |
-
'<a href="%s" class="current">%s</a>',
|
68 |
-
admin_url( 'edit.php?post_type=' . LP_QUIZ_CPT . '&unassigned=yes' ),
|
69 |
-
$text
|
70 |
-
);
|
71 |
-
} else {
|
72 |
$views['unassigned'] = sprintf(
|
73 |
-
'<a href="%s">%s</a>',
|
74 |
admin_url( 'edit.php?post_type=' . LP_QUIZ_CPT . '&unassigned=yes' ),
|
75 |
-
$
|
|
|
|
|
76 |
);
|
77 |
}
|
78 |
|
56 |
*
|
57 |
* @param array $views
|
58 |
*
|
59 |
+
* @return array
|
60 |
*/
|
61 |
+
public function views_pages( array $views ): array {
|
62 |
+
$count_unassigned_quiz = LP_Course_DB::getInstance()->get_total_item_unassigned( LP_QUIZ_CPT );
|
|
|
63 |
|
64 |
+
if ( $count_unassigned_quiz > 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
$views['unassigned'] = sprintf(
|
66 |
+
'<a href="%s" class="%s">%s <span class="count">(%d)</span></a>',
|
67 |
admin_url( 'edit.php?post_type=' . LP_QUIZ_CPT . '&unassigned=yes' ),
|
68 |
+
isset( $_GET['unassigned'] ) ? 'current' : '',
|
69 |
+
__( 'Unassigned', 'learnpress' ),
|
70 |
+
$count_unassigned_quiz
|
71 |
);
|
72 |
}
|
73 |
|
@@ -358,6 +358,88 @@ class LP_Course_DB extends LP_Database {
|
|
358 |
|
359 |
return (int) $this->wpdb->get_var( $query );
|
360 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
}
|
362 |
|
363 |
LP_Course_DB::getInstance();
|
358 |
|
359 |
return (int) $this->wpdb->get_var( $query );
|
360 |
}
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Get total items of course
|
364 |
+
*
|
365 |
+
* @param int $course_id
|
366 |
+
* @author tungnx
|
367 |
+
* @since 4.1.4.1
|
368 |
+
* @version 1.0.0
|
369 |
+
* @return null|object
|
370 |
+
*/
|
371 |
+
public function get_total_items( int $course_id = 0 ) {
|
372 |
+
// Get cache
|
373 |
+
$lp_course_cache = LP_Course_Cache::instance();
|
374 |
+
$key_cache = "$course_id/total_items";
|
375 |
+
$total_items = $lp_course_cache->get_cache( $key_cache );
|
376 |
+
|
377 |
+
if ( ! $total_items ) {
|
378 |
+
$item_types = learn_press_get_course_item_types();
|
379 |
+
$count_item_types = count( $item_types );
|
380 |
+
$i = 0;
|
381 |
+
|
382 |
+
$query_count = $this->wpdb->prepare( 'SUM(s.section_course_id = %d) AS count_items,', $course_id );
|
383 |
+
|
384 |
+
foreach ( $item_types as $item_type ) {
|
385 |
+
$i++;
|
386 |
+
if ( $i == $count_item_types ) {
|
387 |
+
$query_count .= $this->wpdb->prepare( 'SUM(s.section_course_id = %d AND si.item_type = %s) AS %s', $course_id, $item_type, $item_type );
|
388 |
+
} else {
|
389 |
+
$query_count .= $this->wpdb->prepare( 'SUM(s.section_course_id = %d AND si.item_type = %s) AS %s,', $course_id, $item_type, $item_type );
|
390 |
+
}
|
391 |
+
}
|
392 |
+
|
393 |
+
$query = "
|
394 |
+
SELECT $query_count
|
395 |
+
FROM $this->tb_lp_section_items si
|
396 |
+
INNER JOIN $this->tb_lp_sections s ON s.section_id = si.section_id
|
397 |
+
";
|
398 |
+
|
399 |
+
$total_items = $this->wpdb->get_row( $query );
|
400 |
+
|
401 |
+
// Set cache
|
402 |
+
$lp_course_cache->set_cache( $key_cache, $total_items );
|
403 |
+
}
|
404 |
+
|
405 |
+
return $total_items;
|
406 |
+
}
|
407 |
+
|
408 |
+
/**
|
409 |
+
* Count all item are unassigned to any courses.
|
410 |
+
*
|
411 |
+
* @param string $item_type (type item Lesson, Quiz, Assignment, H5P ...)
|
412 |
+
*
|
413 |
+
* @return int
|
414 |
+
* @since 4.1.4.1
|
415 |
+
* @author tungnx
|
416 |
+
* @version 1.0.0
|
417 |
+
*/
|
418 |
+
function get_total_item_unassigned( string $item_type ): int {
|
419 |
+
$query_append = '';
|
420 |
+
if ( ! current_user_can( 'administrator' ) ) {
|
421 |
+
$query_append .= $this->wpdb->prepare( ' AND post_author = %d', get_current_user_id() );
|
422 |
+
}
|
423 |
+
|
424 |
+
$query = $this->wpdb->prepare(
|
425 |
+
"SELECT COUNT(p.ID) as total
|
426 |
+
FROM $this->tb_posts AS p
|
427 |
+
WHERE p.post_type = %s
|
428 |
+
AND p.ID NOT IN(
|
429 |
+
SELECT si.item_id
|
430 |
+
FROM {$this->tb_lp_section_items} AS si
|
431 |
+
WHERE si.item_type = %s
|
432 |
+
)
|
433 |
+
AND p.post_status NOT IN(%s, %s)
|
434 |
+
$query_append",
|
435 |
+
$item_type,
|
436 |
+
$item_type,
|
437 |
+
'auto-draft',
|
438 |
+
'trash'
|
439 |
+
);
|
440 |
+
|
441 |
+
return (int) $this->wpdb->get_var( $query );
|
442 |
+
}
|
443 |
}
|
444 |
|
445 |
LP_Course_DB::getInstance();
|
@@ -128,13 +128,12 @@ class LP_Database {
|
|
128 |
}
|
129 |
|
130 |
if ( ! empty( $filter->post_status ) ) {
|
131 |
-
$query_append .= ' AND post_status =
|
132 |
}
|
133 |
|
134 |
$query = $this->wpdb->prepare(
|
135 |
-
"
|
136 |
-
|
137 |
-
WHERE post_type = '%s'
|
138 |
AND post_author = %d
|
139 |
{$query_append}",
|
140 |
$filter->post_type,
|
@@ -523,4 +522,26 @@ class LP_Database {
|
|
523 |
|
524 |
return $result;
|
525 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
526 |
}
|
128 |
}
|
129 |
|
130 |
if ( ! empty( $filter->post_status ) ) {
|
131 |
+
$query_append .= $this->wpdb->prepare( ' AND post_status = %s', $filter->post_status );
|
132 |
}
|
133 |
|
134 |
$query = $this->wpdb->prepare(
|
135 |
+
"SELECT Count(ID) FROM $this->tb_posts
|
136 |
+
WHERE post_type = %s
|
|
|
137 |
AND post_author = %d
|
138 |
{$query_append}",
|
139 |
$filter->post_type,
|
522 |
|
523 |
return $result;
|
524 |
}
|
525 |
+
|
526 |
+
/**
|
527 |
+
* Check key postmeta exist on Database
|
528 |
+
*
|
529 |
+
* @param int $post_id
|
530 |
+
* @param string $key
|
531 |
+
*
|
532 |
+
* @return bool|int
|
533 |
+
*/
|
534 |
+
public function check_key_postmeta_exists( int $post_id = 0, string $key = '' ) {
|
535 |
+
return $this->wpdb->query(
|
536 |
+
$this->wpdb->prepare(
|
537 |
+
"
|
538 |
+
SELECT meta_id FROM $this->tb_postmeta
|
539 |
+
WHERE meta_key = %s
|
540 |
+
AND post_id = %d
|
541 |
+
",
|
542 |
+
$key,
|
543 |
+
$post_id
|
544 |
+
)
|
545 |
+
);
|
546 |
+
}
|
547 |
}
|
@@ -63,30 +63,23 @@ class LP_Question_DB extends LP_Database {
|
|
63 |
*
|
64 |
* @return int
|
65 |
* @since 3.0.0
|
66 |
-
*
|
67 |
*/
|
68 |
-
function get_total_question_unassigned() {
|
69 |
-
|
70 |
$query_append = '';
|
71 |
if ( ! current_user_can( 'administrator' ) ) {
|
72 |
-
$query_append .= ' AND post_author = '
|
73 |
}
|
74 |
|
75 |
$query = $this->wpdb->prepare(
|
76 |
-
"
|
77 |
-
|
78 |
-
FROM {$this->tb_posts} AS p
|
79 |
WHERE p.post_type = %s
|
80 |
AND p.ID NOT IN(
|
81 |
SELECT qq.question_id
|
82 |
FROM {$this->tb_lp_quiz_questions} AS qq
|
83 |
-
INNER JOIN {$this->tb_posts} AS p
|
84 |
-
ON p.ID = qq.question_id
|
85 |
-
WHERE p.post_type = %s
|
86 |
)
|
87 |
AND p.post_status NOT IN(%s, %s)
|
88 |
$query_append",
|
89 |
-
LP_QUESTION_CPT,
|
90 |
LP_QUESTION_CPT,
|
91 |
'auto-draft',
|
92 |
'trash'
|
63 |
*
|
64 |
* @return int
|
65 |
* @since 3.0.0
|
|
|
66 |
*/
|
67 |
+
function get_total_question_unassigned(): int {
|
|
|
68 |
$query_append = '';
|
69 |
if ( ! current_user_can( 'administrator' ) ) {
|
70 |
+
$query_append .= $this->wpdb->prepare( ' AND post_author = %d', get_current_user_id() );
|
71 |
}
|
72 |
|
73 |
$query = $this->wpdb->prepare(
|
74 |
+
"SELECT COUNT(p.ID) as total
|
75 |
+
FROM $this->tb_posts AS p
|
|
|
76 |
WHERE p.post_type = %s
|
77 |
AND p.ID NOT IN(
|
78 |
SELECT qq.question_id
|
79 |
FROM {$this->tb_lp_quiz_questions} AS qq
|
|
|
|
|
|
|
80 |
)
|
81 |
AND p.post_status NOT IN(%s, %s)
|
82 |
$query_append",
|
|
|
83 |
LP_QUESTION_CPT,
|
84 |
'auto-draft',
|
85 |
'trash'
|
@@ -8,6 +8,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
8 |
* Class LP_Lesson_DB
|
9 |
*
|
10 |
* @since 3.2.7.4
|
|
|
|
|
11 |
*/
|
12 |
class LP_Quiz_DB extends LP_Database {
|
13 |
private static $_instance;
|
@@ -42,6 +44,26 @@ class LP_Quiz_DB extends LP_Database {
|
|
42 |
|
43 |
return (int) $this->wpdb->get_var( $query );
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
LP_Quiz_DB::getInstance();
|
8 |
* Class LP_Lesson_DB
|
9 |
*
|
10 |
* @since 3.2.7.4
|
11 |
+
* @author tungnx
|
12 |
+
* @version 1.0.0
|
13 |
*/
|
14 |
class LP_Quiz_DB extends LP_Database {
|
15 |
private static $_instance;
|
44 |
|
45 |
return (int) $this->wpdb->get_var( $query );
|
46 |
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get total questions assign for Quiz
|
50 |
+
*
|
51 |
+
* @param int $quiz_id
|
52 |
+
* @author tungnx
|
53 |
+
* @since 4.1.4.1
|
54 |
+
* @version 1.0.0
|
55 |
+
* @return int
|
56 |
+
*/
|
57 |
+
public function get_total_question( int $quiz_id = 0 ) : int {
|
58 |
+
$query = $this->wpdb->prepare(
|
59 |
+
"SELECT COUNT(question_id) AS total
|
60 |
+
FROM $this->tb_lp_quiz_questions
|
61 |
+
WHERE quiz_id = %d",
|
62 |
+
$quiz_id
|
63 |
+
);
|
64 |
+
|
65 |
+
return (int) $this->wpdb->get_var( $query );
|
66 |
+
}
|
67 |
}
|
68 |
|
69 |
LP_Quiz_DB::getInstance();
|
@@ -28,17 +28,97 @@ class LP_Section_DB extends LP_Database {
|
|
28 |
*
|
29 |
* @param int $section_Id
|
30 |
*
|
31 |
-
* @return
|
32 |
*/
|
33 |
-
public function get_course_id_by_section_id( $section_Id = 0 ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
$query = $this->wpdb->prepare(
|
35 |
-
"SELECT
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
$
|
|
|
|
|
|
|
40 |
|
41 |
-
return $
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
}
|
44 |
|
28 |
*
|
29 |
* @param int $section_Id
|
30 |
*
|
31 |
+
* @return mixed
|
32 |
*/
|
33 |
+
public function get_course_id_by_section_id( int $section_Id = 0 ) {
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Get section ids by course id
|
39 |
+
*
|
40 |
+
* @param int $course_id
|
41 |
+
* @author tungnx
|
42 |
+
* @since 4.1.4.1
|
43 |
+
* @version 1.0.0
|
44 |
+
* @return array
|
45 |
+
*/
|
46 |
+
public function get_section_ids_by_course( int $course_id ): array {
|
47 |
$query = $this->wpdb->prepare(
|
48 |
+
"SELECT section_id
|
49 |
+
FROM $this->tb_lp_sections
|
50 |
+
WHERE section_course_id = %d
|
51 |
+
",
|
52 |
+
$course_id
|
53 |
+
);
|
54 |
+
|
55 |
+
return $this->wpdb->get_col( $query );
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Remove rows IN user_item_ids
|
60 |
+
*
|
61 |
+
* @param LP_Section_Filter $filter $filter->section_ids, $filter->author_id_course
|
62 |
+
*
|
63 |
+
* @throws Exception
|
64 |
+
* @since 4.1.4.1
|
65 |
+
* @version 1.0.0
|
66 |
+
*/
|
67 |
+
public function delete_section( LP_Section_Filter $filter ) {
|
68 |
+
// Check valid user.
|
69 |
+
if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $filter->author_id_course ) ) {
|
70 |
+
throw new Exception( __FUNCTION__ . ': User invalid!' );
|
71 |
+
}
|
72 |
+
|
73 |
+
if ( empty( $filter->section_ids ) ) {
|
74 |
+
return 1;
|
75 |
+
}
|
76 |
+
|
77 |
+
$where = 'WHERE 1=1 ';
|
78 |
+
|
79 |
+
$where .= $this->wpdb->prepare(
|
80 |
+
'AND section_id IN(' . LP_Helper::db_format_array( $filter->section_ids, '%d' ) . ')',
|
81 |
+
$filter->section_ids
|
82 |
+
);
|
83 |
+
|
84 |
+
return $this->wpdb->query(
|
85 |
+
"DELETE FROM $this->tb_lp_sections
|
86 |
+
$where
|
87 |
+
"
|
88 |
+
);
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Remove rows IN user_item_ids
|
93 |
+
*
|
94 |
+
* @param LP_Section_Filter $filter $filter->section_ids, $filter->author_id_course
|
95 |
+
*
|
96 |
+
* @throws Exception
|
97 |
+
* @since 4.1.4.1
|
98 |
+
* @version 1.0.0
|
99 |
+
*/
|
100 |
+
public function delete_section_items( LP_Section_Filter $filter ) {
|
101 |
+
// Check valid user.
|
102 |
+
if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $filter->author_id_course ) ) {
|
103 |
+
throw new Exception( __FUNCTION__ . ': User invalid!' );
|
104 |
+
}
|
105 |
+
|
106 |
+
if ( empty( $filter->section_ids ) ) {
|
107 |
+
return 1;
|
108 |
+
}
|
109 |
+
|
110 |
+
$where = 'WHERE 1=1 ';
|
111 |
|
112 |
+
$where .= $this->wpdb->prepare(
|
113 |
+
'AND section_id IN(' . LP_Helper::db_format_array( $filter->section_ids, '%d' ) . ')',
|
114 |
+
$filter->section_ids
|
115 |
+
);
|
116 |
|
117 |
+
return $this->wpdb->query(
|
118 |
+
"DELETE FROM $this->tb_lp_section_items
|
119 |
+
$where
|
120 |
+
"
|
121 |
+
);
|
122 |
}
|
123 |
}
|
124 |
|
@@ -47,22 +47,22 @@ class LP_User_Items_Result_DB extends LP_Database {
|
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
-
* Get
|
51 |
*
|
52 |
* @param integer $user_item_id
|
53 |
*
|
54 |
-
* @return
|
55 |
*/
|
56 |
-
public function get_result( $user_item_id = 0 ) {
|
57 |
if ( ! $user_item_id ) {
|
58 |
return false;
|
59 |
}
|
60 |
|
61 |
$result = $this->wpdb->get_var(
|
62 |
$this->wpdb->prepare(
|
63 |
-
"
|
64 |
-
|
65 |
-
|
66 |
",
|
67 |
$user_item_id
|
68 |
)
|
@@ -71,7 +71,15 @@ class LP_User_Items_Result_DB extends LP_Database {
|
|
71 |
return $result && is_string( $result ) ? json_decode( $result, true ) : false;
|
72 |
}
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
global $wpdb;
|
76 |
|
77 |
if ( ! $user_item_id ) {
|
@@ -149,29 +157,21 @@ class LP_User_Items_Result_DB extends LP_Database {
|
|
149 |
return $delete;
|
150 |
}
|
151 |
|
152 |
-
/** Delete all record in table */
|
153 |
-
public function delete_all() {
|
154 |
-
global $wpdb;
|
155 |
-
|
156 |
-
$wpdb->query( "DELETE FROM {$wpdb->learnpress_user_item_results}" );
|
157 |
-
}
|
158 |
-
|
159 |
/**
|
160 |
* Delete all rows in user_item_ids
|
161 |
*
|
162 |
* @param LP_User_Items_Filter $filter $filter->user_item_ids
|
163 |
*
|
164 |
* @return bool|int
|
165 |
-
* @throws Exception
|
166 |
* @since 4.1.4
|
167 |
* @author tungnx
|
168 |
* @version 1.0.0
|
169 |
*/
|
170 |
public function remove_user_item_results( LP_User_Items_Filter $filter ) {
|
171 |
// Check valid user.
|
172 |
-
if ( ! is_user_logged_in() || ( ! current_user_can( 'administrator' ) && get_current_user_id() != $filter->user_id ) ) {
|
173 |
throw new Exception( __( 'User invalid!', 'learnpress' ) );
|
174 |
-
}
|
175 |
|
176 |
if ( empty( $filter->user_item_ids ) ) {
|
177 |
return 1;
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
+
* Get latest result.
|
51 |
*
|
52 |
* @param integer $user_item_id
|
53 |
*
|
54 |
+
* @return array|bool
|
55 |
*/
|
56 |
+
public function get_result( int $user_item_id = 0 ) {
|
57 |
if ( ! $user_item_id ) {
|
58 |
return false;
|
59 |
}
|
60 |
|
61 |
$result = $this->wpdb->get_var(
|
62 |
$this->wpdb->prepare(
|
63 |
+
"SELECT result FROM $this->tb_lp_user_item_results
|
64 |
+
WHERE user_item_id = %d
|
65 |
+
ORDER BY id DESC LIMIT 1
|
66 |
",
|
67 |
$user_item_id
|
68 |
)
|
71 |
return $result && is_string( $result ) ? json_decode( $result, true ) : false;
|
72 |
}
|
73 |
|
74 |
+
/**
|
75 |
+
* Update or Insert result
|
76 |
+
*
|
77 |
+
* @param int $user_item_id
|
78 |
+
* @param string $result
|
79 |
+
*
|
80 |
+
* @return bool|int
|
81 |
+
*/
|
82 |
+
public function update( int $user_item_id = 0, string $result = '' ) {
|
83 |
global $wpdb;
|
84 |
|
85 |
if ( ! $user_item_id ) {
|
157 |
return $delete;
|
158 |
}
|
159 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
/**
|
161 |
* Delete all rows in user_item_ids
|
162 |
*
|
163 |
* @param LP_User_Items_Filter $filter $filter->user_item_ids
|
164 |
*
|
165 |
* @return bool|int
|
|
|
166 |
* @since 4.1.4
|
167 |
* @author tungnx
|
168 |
* @version 1.0.0
|
169 |
*/
|
170 |
public function remove_user_item_results( LP_User_Items_Filter $filter ) {
|
171 |
// Check valid user.
|
172 |
+
/*if ( ! is_user_logged_in() || ( ! current_user_can( 'administrator' ) && get_current_user_id() != $filter->user_id ) ) {
|
173 |
throw new Exception( __( 'User invalid!', 'learnpress' ) );
|
174 |
+
}*/
|
175 |
|
176 |
if ( empty( $filter->user_item_ids ) ) {
|
177 |
return 1;
|
@@ -31,63 +31,38 @@ class LP_User_Items_DB extends LP_Database {
|
|
31 |
/**
|
32 |
* Get items by user_item_id | this is id where item_id = course_id
|
33 |
*
|
34 |
-
* @param
|
35 |
-
* @param
|
36 |
*
|
37 |
* @return object
|
38 |
* @throws Exception
|
|
|
39 |
*/
|
40 |
-
public function
|
41 |
-
|
42 |
-
|
|
|
|
|
43 |
}
|
44 |
|
45 |
$query = $this->wpdb->prepare(
|
46 |
-
"
|
47 |
-
SELECT * FROM {$this->tb_lp_user_items}
|
48 |
WHERE parent_id = %d
|
49 |
AND ref_type = %s
|
50 |
AND user_id = %d
|
51 |
",
|
52 |
-
$
|
53 |
LP_COURSE_CPT,
|
54 |
-
$user_id
|
55 |
);
|
56 |
|
57 |
$course_items = $this->wpdb->get_results( $query );
|
58 |
|
59 |
$this->check_execute_has_error();
|
60 |
|
61 |
-
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Get data user_items by course_id, quiz_id, user_id
|
66 |
-
*
|
67 |
-
* @param [type] $course_id
|
68 |
-
* @param [type] $item_id
|
69 |
-
* @param [type] $user_id
|
70 |
-
* @return array
|
71 |
-
*/
|
72 |
-
public function get_result_by_item_id( $course_id, $item_id, $user_id ) {
|
73 |
-
if ( empty( $course_id ) || empty( $item_id ) ) {
|
74 |
-
return false;
|
75 |
-
}
|
76 |
-
|
77 |
-
$query = $this->wpdb->prepare(
|
78 |
-
"SELECT * FROM {$this->tb_lp_user_items}
|
79 |
-
WHERE ref_id = %d
|
80 |
-
AND item_id = %d
|
81 |
-
AND user_id=%d
|
82 |
-
ORDER BY user_item_id DESC",
|
83 |
-
$course_id,
|
84 |
-
$item_id,
|
85 |
-
$user_id
|
86 |
-
);
|
87 |
-
|
88 |
-
$results = $this->wpdb->get_row( $query, ARRAY_A );
|
89 |
|
90 |
-
return $
|
91 |
}
|
92 |
|
93 |
/**
|
@@ -97,6 +72,7 @@ class LP_User_Items_DB extends LP_Database {
|
|
97 |
*
|
98 |
* @return bool|int
|
99 |
* @throws Exception .
|
|
|
100 |
*/
|
101 |
public function remove_items_of_user_course( LP_User_Items_Filter $filter ) {
|
102 |
$query_extra = '';
|
@@ -111,18 +87,17 @@ class LP_User_Items_DB extends LP_Database {
|
|
111 |
}
|
112 |
|
113 |
$query = $this->wpdb->prepare(
|
114 |
-
"
|
115 |
-
DELETE FROM {$this->tb_lp_user_items}
|
116 |
WHERE parent_id = %d
|
117 |
$query_extra;
|
118 |
-
|
119 |
$filter->parent_id
|
120 |
);
|
121 |
|
122 |
return $this->wpdb->query( $query );
|
123 |
}
|
124 |
|
125 |
-
public function get_item_status( $item_id, $course_id ) {
|
126 |
$query = $this->wpdb->prepare(
|
127 |
"
|
128 |
SELECT status FROM {$this->tb_lp_user_items}
|
@@ -136,7 +111,7 @@ class LP_User_Items_DB extends LP_Database {
|
|
136 |
);
|
137 |
|
138 |
return $this->wpdb->get_var( $query );
|
139 |
-
}
|
140 |
|
141 |
/**
|
142 |
* Insert/Update extra value
|
@@ -202,6 +177,7 @@ class LP_User_Items_DB extends LP_Database {
|
|
202 |
)
|
203 |
);
|
204 |
}
|
|
|
205 |
/**
|
206 |
* Re-set current item
|
207 |
* @param $course_id
|
@@ -254,13 +230,13 @@ class LP_User_Items_DB extends LP_Database {
|
|
254 |
public function get_total_courses_has_status( int $user_id, string $status ): int {
|
255 |
$query = $this->wpdb->prepare(
|
256 |
"
|
257 |
-
SELECT COUNT(DISTINCT(item_id)) total
|
258 |
-
FROM $this->tb_lp_user_items
|
259 |
INNER JOIN $this->tb_posts AS p
|
260 |
-
ON item_id = p.ID
|
261 |
-
WHERE item_type = %s
|
262 |
-
AND user_id = %d
|
263 |
-
AND graduation = %s
|
264 |
AND p.post_status = 'publish'
|
265 |
",
|
266 |
LP_COURSE_CPT,
|
@@ -274,53 +250,88 @@ class LP_User_Items_DB extends LP_Database {
|
|
274 |
}
|
275 |
|
276 |
/**
|
277 |
-
* Get
|
|
|
|
|
|
|
278 |
*
|
279 |
-
* @
|
280 |
* @throws Exception
|
281 |
-
* @return null|string
|
282 |
*/
|
283 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
$query = $this->wpdb->prepare(
|
285 |
-
"
|
286 |
-
SELECT status
|
287 |
FROM $this->tb_lp_user_items
|
288 |
-
WHERE
|
289 |
-
AND
|
290 |
-
AND
|
|
|
|
|
291 |
",
|
292 |
-
|
293 |
-
$
|
294 |
-
|
295 |
);
|
296 |
|
297 |
-
$result = $this->wpdb->
|
298 |
|
299 |
$this->check_execute_has_error();
|
300 |
|
|
|
|
|
301 |
return $result;
|
302 |
}
|
303 |
|
304 |
/**
|
305 |
-
* Get
|
306 |
*
|
307 |
-
* @param LP_User_Items_Filter $filter
|
308 |
-
* @
|
309 |
*
|
310 |
* @return null|object
|
|
|
311 |
*/
|
312 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
$query = $this->wpdb->prepare(
|
314 |
-
"
|
315 |
-
SELECT user_item_id, user_id, item_id, item_type, status, graduation, ref_id, ref_type, start_time, end_time
|
316 |
FROM $this->tb_lp_user_items
|
317 |
-
WHERE
|
318 |
AND item_id = %d
|
319 |
AND user_id = %d
|
320 |
ORDER BY user_item_id DESC
|
321 |
LIMIT 1
|
322 |
",
|
323 |
-
LP_COURSE_CPT,
|
324 |
$filter->item_id,
|
325 |
$filter->user_id
|
326 |
);
|
@@ -329,34 +340,39 @@ class LP_User_Items_DB extends LP_Database {
|
|
329 |
|
330 |
$this->check_execute_has_error();
|
331 |
|
|
|
|
|
332 |
return $result;
|
333 |
}
|
334 |
|
335 |
/**
|
336 |
-
* Get
|
337 |
*
|
338 |
-
* @param LP_User_Items_Filter $filter
|
339 |
* @throws Exception
|
340 |
-
*
|
341 |
-
* @return null|object
|
342 |
*/
|
343 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
$query = $this->wpdb->prepare(
|
345 |
-
"
|
346 |
-
SELECT user_item_id, user_id, item_id, item_type, status, graduation, ref_id, ref_type, start_time, end_time, parent_id
|
347 |
FROM $this->tb_lp_user_items
|
348 |
WHERE parent_id = %d
|
349 |
-
AND
|
350 |
-
AND user_id = %d
|
351 |
-
ORDER BY user_item_id DESC
|
352 |
-
LIMIT 1
|
353 |
",
|
354 |
-
$filter->parent_id
|
355 |
-
$filter->item_id,
|
356 |
-
$filter->user_id
|
357 |
);
|
358 |
|
359 |
-
$result = $this->wpdb->
|
360 |
|
361 |
$this->check_execute_has_error();
|
362 |
|
@@ -380,9 +396,9 @@ class LP_User_Items_DB extends LP_Database {
|
|
380 |
foreach ( $vars as $var ) {
|
381 |
if ( ! empty( $filter->{$var} ) ) {
|
382 |
if ( empty( $WHERE ) ) {
|
383 |
-
$WHERE
|
384 |
} else {
|
385 |
-
$WHERE
|
386 |
}
|
387 |
}
|
388 |
}
|
@@ -391,19 +407,46 @@ class LP_User_Items_DB extends LP_Database {
|
|
391 |
"
|
392 |
SELECT $filter->select FROM $this->tb_lp_user_items
|
393 |
$WHERE
|
394 |
-
"
|
395 |
-
$filter->item_type,
|
396 |
-
$filter->item_id,
|
397 |
-
$filter->user_id
|
398 |
);
|
399 |
|
400 |
-
$result = $this->wpdb->
|
401 |
|
402 |
$this->check_execute_has_error();
|
403 |
|
404 |
return $result;
|
405 |
}
|
406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
/**
|
408 |
* Get items is course has user
|
409 |
*
|
@@ -416,7 +459,7 @@ class LP_User_Items_DB extends LP_Database {
|
|
416 |
*/
|
417 |
public function get_ids_course_user( LP_User_Items_Filter $filter ): array {
|
418 |
$query = $this->wpdb->prepare(
|
419 |
-
"SELECT user_item_id FROM
|
420 |
WHERE user_id = %d
|
421 |
AND item_id = %d
|
422 |
AND item_type = %s
|
@@ -468,9 +511,9 @@ class LP_User_Items_DB extends LP_Database {
|
|
468 |
*/
|
469 |
public function remove_user_item_ids( LP_User_Items_Filter $filter ) {
|
470 |
// Check valid user.
|
471 |
-
if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $filter->user_id ) ) {
|
472 |
throw new Exception( __( 'User invalid!', 'learnpress' ) . ' | ' . __FUNCTION__ );
|
473 |
-
}
|
474 |
|
475 |
if ( empty( $filter->user_item_ids ) ) {
|
476 |
return 1;
|
@@ -501,9 +544,9 @@ class LP_User_Items_DB extends LP_Database {
|
|
501 |
*/
|
502 |
public function remove_user_itemmeta( LP_User_Items_Filter $filter ) {
|
503 |
// Check valid user.
|
504 |
-
if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $filter->user_id ) ) {
|
505 |
throw new Exception( __( 'User invalid!', 'learnpress' ) . ' | ' . __FUNCTION__ );
|
506 |
-
}
|
507 |
|
508 |
if ( empty( $filter->user_item_ids ) ) {
|
509 |
return 1;
|
@@ -538,9 +581,9 @@ class LP_User_Items_DB extends LP_Database {
|
|
538 |
|
539 |
try {
|
540 |
// Check valid user.
|
541 |
-
if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $user_id ) ) {
|
542 |
throw new Exception( __( 'User invalid!', 'learnpress' ) . ' | ' . __FUNCTION__ );
|
543 |
-
}
|
544 |
|
545 |
// Get all user_item_ids has user_id and course_id
|
546 |
$filter = new LP_User_Items_Filter();
|
@@ -553,26 +596,14 @@ class LP_User_Items_DB extends LP_Database {
|
|
553 |
return;
|
554 |
}
|
555 |
|
556 |
-
|
557 |
-
$
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
$user_item_ids_concat = array_merge( $user_course_ids, $user_item_ids );
|
562 |
-
|
563 |
-
// Delete on tb lp_user_items
|
564 |
-
$filter = new LP_User_Items_Filter();
|
565 |
-
$filter->user_item_ids = $user_item_ids_concat;
|
566 |
-
$filter->user_id = $user_id;
|
567 |
-
$lp_user_items_db->remove_user_item_ids( $filter );
|
568 |
-
|
569 |
-
// Delete user_itemmeta
|
570 |
-
$lp_user_items_db->remove_user_itemmeta( $filter );
|
571 |
|
572 |
-
|
573 |
-
$lp_user_item_results->remove_user_item_results( $filter );
|
574 |
} catch ( Throwable $e ) {
|
575 |
-
error_log( $e->getMessage() );
|
576 |
}
|
577 |
}
|
578 |
|
@@ -587,7 +618,7 @@ class LP_User_Items_DB extends LP_Database {
|
|
587 |
public function update_user_id_by_order( LP_User_Items_Filter $filter ) {
|
588 |
// Check valid user.
|
589 |
if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $filter->user_id ) ) {
|
590 |
-
throw new Exception(
|
591 |
}
|
592 |
|
593 |
$query = $this->wpdb->prepare(
|
@@ -603,6 +634,95 @@ class LP_User_Items_DB extends LP_Database {
|
|
603 |
|
604 |
return $this->wpdb->query( $query );
|
605 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
606 |
}
|
607 |
|
608 |
LP_Course_DB::getInstance();
|
31 |
/**
|
32 |
* Get items by user_item_id | this is id where item_id = course_id
|
33 |
*
|
34 |
+
* @param LP_User_Items_Filter $filter
|
35 |
+
* @param bool $force_cache
|
36 |
*
|
37 |
* @return object
|
38 |
* @throws Exception
|
39 |
+
* Todo: tungnx need set paginate - apply when do load API
|
40 |
*/
|
41 |
+
public function get_user_course_items( LP_User_Items_Filter $filter, bool $force_cache = false ) {
|
42 |
+
$key_first_cache = 'course_items/' . $filter->user_id . '/' . $filter->parent_id;
|
43 |
+
$course_items_cache = LP_Cache::cache_load_first( 'get', $key_first_cache );
|
44 |
+
if ( false !== $course_items_cache && ! $force_cache ) {
|
45 |
+
return $course_items_cache;
|
46 |
}
|
47 |
|
48 |
$query = $this->wpdb->prepare(
|
49 |
+
"SELECT * FROM $this->tb_lp_user_items
|
|
|
50 |
WHERE parent_id = %d
|
51 |
AND ref_type = %s
|
52 |
AND user_id = %d
|
53 |
",
|
54 |
+
$filter->parent_id,
|
55 |
LP_COURSE_CPT,
|
56 |
+
$filter->user_id
|
57 |
);
|
58 |
|
59 |
$course_items = $this->wpdb->get_results( $query );
|
60 |
|
61 |
$this->check_execute_has_error();
|
62 |
|
63 |
+
LP_Cache::cache_load_first( 'set', $key_first_cache, $course_items );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
return $course_items;
|
66 |
}
|
67 |
|
68 |
/**
|
72 |
*
|
73 |
* @return bool|int
|
74 |
* @throws Exception .
|
75 |
+
* @TODO tungnx - recheck this function
|
76 |
*/
|
77 |
public function remove_items_of_user_course( LP_User_Items_Filter $filter ) {
|
78 |
$query_extra = '';
|
87 |
}
|
88 |
|
89 |
$query = $this->wpdb->prepare(
|
90 |
+
"DELETE FROM {$this->tb_lp_user_items}
|
|
|
91 |
WHERE parent_id = %d
|
92 |
$query_extra;
|
93 |
+
",
|
94 |
$filter->parent_id
|
95 |
);
|
96 |
|
97 |
return $this->wpdb->query( $query );
|
98 |
}
|
99 |
|
100 |
+
/*public function get_item_status( $item_id, $course_id ) {
|
101 |
$query = $this->wpdb->prepare(
|
102 |
"
|
103 |
SELECT status FROM {$this->tb_lp_user_items}
|
111 |
);
|
112 |
|
113 |
return $this->wpdb->get_var( $query );
|
114 |
+
}*/
|
115 |
|
116 |
/**
|
117 |
* Insert/Update extra value
|
177 |
)
|
178 |
);
|
179 |
}
|
180 |
+
|
181 |
/**
|
182 |
* Re-set current item
|
183 |
* @param $course_id
|
230 |
public function get_total_courses_has_status( int $user_id, string $status ): int {
|
231 |
$query = $this->wpdb->prepare(
|
232 |
"
|
233 |
+
SELECT COUNT(DISTINCT(ui.item_id)) total
|
234 |
+
FROM $this->tb_lp_user_items AS ui
|
235 |
INNER JOIN $this->tb_posts AS p
|
236 |
+
ON ui.item_id = p.ID
|
237 |
+
WHERE ui.item_type = %s
|
238 |
+
AND ui.user_id = %d
|
239 |
+
AND ui.graduation = %s
|
240 |
AND p.post_status = 'publish'
|
241 |
",
|
242 |
LP_COURSE_CPT,
|
250 |
}
|
251 |
|
252 |
/**
|
253 |
+
* Get the newest item is course of user
|
254 |
+
*
|
255 |
+
* @param LP_User_Items_Filter $filter {course_id, user_id}
|
256 |
+
* @param bool $force_cache Reset first cache
|
257 |
*
|
258 |
+
* @return null|object
|
259 |
* @throws Exception
|
|
|
260 |
*/
|
261 |
+
public function get_last_user_course( LP_User_Items_Filter $filter, bool $force_cache = false ) {
|
262 |
+
$key_load_first = 'user_course/' . $filter->user_id . '/' . $filter->item_id;
|
263 |
+
$user_course = LP_Cache::cache_load_first( 'get', $key_load_first );
|
264 |
+
if ( false !== $user_course && ! $force_cache ) {
|
265 |
+
return $user_course;
|
266 |
+
}
|
267 |
+
|
268 |
$query = $this->wpdb->prepare(
|
269 |
+
"SELECT user_item_id, user_id, item_id, item_type, status, graduation, ref_id, ref_type, start_time, end_time
|
|
|
270 |
FROM $this->tb_lp_user_items
|
271 |
+
WHERE item_type = %s
|
272 |
+
AND item_id = %d
|
273 |
+
AND user_id = %d
|
274 |
+
ORDER BY user_item_id DESC
|
275 |
+
LIMIT 1
|
276 |
",
|
277 |
+
LP_COURSE_CPT,
|
278 |
+
$filter->item_id,
|
279 |
+
$filter->user_id
|
280 |
);
|
281 |
|
282 |
+
$result = $this->wpdb->get_row( $query );
|
283 |
|
284 |
$this->check_execute_has_error();
|
285 |
|
286 |
+
LP_Cache::cache_load_first( 'set', $key_load_first, $result );
|
287 |
+
|
288 |
return $result;
|
289 |
}
|
290 |
|
291 |
/**
|
292 |
+
* Get item of user and course
|
293 |
*
|
294 |
+
* @param LP_User_Items_Filter $filter {parent_id, item_id, user_id}
|
295 |
+
* @param bool $force_cache Reset first cache
|
296 |
*
|
297 |
* @return null|object
|
298 |
+
* @throws Exception
|
299 |
*/
|
300 |
+
public function get_user_course_item( LP_User_Items_Filter $filter, bool $force_cache = false ) {
|
301 |
+
$key_load_first = 'user_course_item/' . $filter->user_id . '/' . $filter->item_id;
|
302 |
+
$user_course = LP_Cache::cache_load_first( 'get', $key_load_first );
|
303 |
+
|
304 |
+
if ( false !== $user_course && ! $force_cache ) {
|
305 |
+
return $user_course;
|
306 |
+
}
|
307 |
+
|
308 |
+
$WHERE = 'WHERE 1=1 ';
|
309 |
+
|
310 |
+
if ( $filter->parent_id ) {
|
311 |
+
$WHERE .= $this->wpdb->prepare( 'AND parent_id = %d ', $filter->parent_id );
|
312 |
+
}
|
313 |
+
|
314 |
+
if ( $filter->ref_id ) {
|
315 |
+
$WHERE .= $this->wpdb->prepare( 'AND ref_id = %d ', $filter->ref_id );
|
316 |
+
}
|
317 |
+
|
318 |
+
if ( $filter->ref_type ) {
|
319 |
+
$WHERE .= $this->wpdb->prepare( 'AND ref_type = %s ', $filter->ref_type );
|
320 |
+
}
|
321 |
+
|
322 |
+
if ( $filter->item_type ) {
|
323 |
+
$WHERE .= $this->wpdb->prepare( 'AND item_type = %s ', $filter->item_type );
|
324 |
+
}
|
325 |
+
|
326 |
$query = $this->wpdb->prepare(
|
327 |
+
"SELECT user_item_id, user_id, item_id, item_type, status, graduation, ref_id, ref_type, start_time, end_time, parent_id
|
|
|
328 |
FROM $this->tb_lp_user_items
|
329 |
+
$WHERE
|
330 |
AND item_id = %d
|
331 |
AND user_id = %d
|
332 |
ORDER BY user_item_id DESC
|
333 |
LIMIT 1
|
334 |
",
|
|
|
335 |
$filter->item_id,
|
336 |
$filter->user_id
|
337 |
);
|
340 |
|
341 |
$this->check_execute_has_error();
|
342 |
|
343 |
+
LP_Cache::cache_load_first( 'set', $key_load_first, $result );
|
344 |
+
|
345 |
return $result;
|
346 |
}
|
347 |
|
348 |
/**
|
349 |
+
* Get items of course by item type
|
350 |
*
|
351 |
+
* @param LP_User_Items_Filter $filter {$filter->parent_id, $filter->item_type, [$filter->item_id]}
|
352 |
* @throws Exception
|
|
|
|
|
353 |
*/
|
354 |
+
public function get_user_course_items_by_item_type( LP_User_Items_Filter $filter ) {
|
355 |
+
|
356 |
+
$AND = '';
|
357 |
+
|
358 |
+
if ( $filter->item_type ) {
|
359 |
+
$AND .= $this->wpdb->prepare( ' AND item_type = %s', $filter->item_type );
|
360 |
+
}
|
361 |
+
|
362 |
+
if ( $filter->item_id ) {
|
363 |
+
$AND .= $this->wpdb->prepare( ' AND item_id = %d', $filter->item_id );
|
364 |
+
}
|
365 |
+
|
366 |
$query = $this->wpdb->prepare(
|
367 |
+
"SELECT user_item_id, user_id, item_id, item_type, status, graduation, ref_id, ref_type, start_time, end_time, parent_id
|
|
|
368 |
FROM $this->tb_lp_user_items
|
369 |
WHERE parent_id = %d
|
370 |
+
$AND
|
|
|
|
|
|
|
371 |
",
|
372 |
+
$filter->parent_id
|
|
|
|
|
373 |
);
|
374 |
|
375 |
+
$result = $this->wpdb->{$filter->query_type}( $query );
|
376 |
|
377 |
$this->check_execute_has_error();
|
378 |
|
396 |
foreach ( $vars as $var ) {
|
397 |
if ( ! empty( $filter->{$var} ) ) {
|
398 |
if ( empty( $WHERE ) ) {
|
399 |
+
$WHERE .= $this->wpdb->prepare( "WHERE . $filter->{$var} = %s", $filter->{$var} );
|
400 |
} else {
|
401 |
+
$WHERE .= $this->wpdb->prepare( " AND . $filter->{$var} = %s ", $filter->{$var} );
|
402 |
}
|
403 |
}
|
404 |
}
|
407 |
"
|
408 |
SELECT $filter->select FROM $this->tb_lp_user_items
|
409 |
$WHERE
|
410 |
+
"
|
|
|
|
|
|
|
411 |
);
|
412 |
|
413 |
+
$result = $this->wpdb->{$filter->query_type}( $query );
|
414 |
|
415 |
$this->check_execute_has_error();
|
416 |
|
417 |
return $result;
|
418 |
}
|
419 |
|
420 |
+
/**
|
421 |
+
* Get user_item_id by course_id
|
422 |
+
*
|
423 |
+
* @param LP_User_Items_Filter $filter $filter->item_id
|
424 |
+
*
|
425 |
+
* @return array
|
426 |
+
*/
|
427 |
+
public function get_user_items_by_course( LP_User_Items_Filter $filter ): array {
|
428 |
+
try {
|
429 |
+
// Check valid user.
|
430 |
+
if ( ! is_user_logged_in() ) {
|
431 |
+
throw new Exception( __( 'User invalid!', 'learnpress' ) . ' | ' . __FUNCTION__ );
|
432 |
+
}
|
433 |
+
|
434 |
+
$query = $this->wpdb->prepare(
|
435 |
+
"SELECT user_item_id FROM $this->tb_lp_user_items
|
436 |
+
WHERE item_id = %d
|
437 |
+
AND item_type = %s
|
438 |
+
",
|
439 |
+
$filter->item_id,
|
440 |
+
LP_COURSE_CPT
|
441 |
+
);
|
442 |
+
|
443 |
+
return $this->wpdb->get_col( $query );
|
444 |
+
} catch ( Throwable $e ) {
|
445 |
+
error_log( __FUNCTION__ . ':' . $e->getMessage() );
|
446 |
+
return array();
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
/**
|
451 |
* Get items is course has user
|
452 |
*
|
459 |
*/
|
460 |
public function get_ids_course_user( LP_User_Items_Filter $filter ): array {
|
461 |
$query = $this->wpdb->prepare(
|
462 |
+
"SELECT user_item_id FROM $this->tb_lp_user_items
|
463 |
WHERE user_id = %d
|
464 |
AND item_id = %d
|
465 |
AND item_type = %s
|
511 |
*/
|
512 |
public function remove_user_item_ids( LP_User_Items_Filter $filter ) {
|
513 |
// Check valid user.
|
514 |
+
/*if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $filter->user_id ) ) {
|
515 |
throw new Exception( __( 'User invalid!', 'learnpress' ) . ' | ' . __FUNCTION__ );
|
516 |
+
}*/
|
517 |
|
518 |
if ( empty( $filter->user_item_ids ) ) {
|
519 |
return 1;
|
544 |
*/
|
545 |
public function remove_user_itemmeta( LP_User_Items_Filter $filter ) {
|
546 |
// Check valid user.
|
547 |
+
/*if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $filter->user_id ) ) {
|
548 |
throw new Exception( __( 'User invalid!', 'learnpress' ) . ' | ' . __FUNCTION__ );
|
549 |
+
}*/
|
550 |
|
551 |
if ( empty( $filter->user_item_ids ) ) {
|
552 |
return 1;
|
581 |
|
582 |
try {
|
583 |
// Check valid user.
|
584 |
+
/*if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $user_id ) ) {
|
585 |
throw new Exception( __( 'User invalid!', 'learnpress' ) . ' | ' . __FUNCTION__ );
|
586 |
+
}*/
|
587 |
|
588 |
// Get all user_item_ids has user_id and course_id
|
589 |
$filter = new LP_User_Items_Filter();
|
596 |
return;
|
597 |
}
|
598 |
|
599 |
+
$course = learn_press_get_course( $course_id );
|
600 |
+
if ( ! $course ) {
|
601 |
+
return;
|
602 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
|
604 |
+
$course->delete_user_item_and_result( $user_course_ids );
|
|
|
605 |
} catch ( Throwable $e ) {
|
606 |
+
error_log( __FUNCTION__ . ': ' . $e->getMessage() );
|
607 |
}
|
608 |
}
|
609 |
|
618 |
public function update_user_id_by_order( LP_User_Items_Filter $filter ) {
|
619 |
// Check valid user.
|
620 |
if ( ! is_user_logged_in() || ( ! current_user_can( ADMIN_ROLE ) && get_current_user_id() != $filter->user_id ) ) {
|
621 |
+
throw new Exception( __FUNCTION__ . ': User invalid!' );
|
622 |
}
|
623 |
|
624 |
$query = $this->wpdb->prepare(
|
634 |
|
635 |
return $this->wpdb->query( $query );
|
636 |
}
|
637 |
+
|
638 |
+
/**
|
639 |
+
* Count items by type and total by status
|
640 |
+
* @throws Exception
|
641 |
+
*
|
642 |
+
* @return null|object
|
643 |
+
*/
|
644 |
+
public function count_items_of_course_with_status( LP_User_Items_Filter $filter ) {
|
645 |
+
$item_types = learn_press_get_course_item_types();
|
646 |
+
$count_item_types = count( $item_types );
|
647 |
+
$i = 0;
|
648 |
+
|
649 |
+
//$user_course = $this->get_last_user_course( $filter );
|
650 |
+
|
651 |
+
$query_count = '';
|
652 |
+
$query_count .= $this->wpdb->prepare( 'SUM(ui.status = %s) AS count_status,', $filter->status );
|
653 |
+
|
654 |
+
foreach ( $item_types as $item_type ) {
|
655 |
+
$i++;
|
656 |
+
$query_count .= $this->wpdb->prepare( 'SUM(ui.status = %s AND ui.item_type = %s) AS %s,', $filter->status, $item_type, $item_type . '_status_' . $filter->status );
|
657 |
+
$query_count .= $this->wpdb->prepare( 'SUM(ui.graduation = %s AND ui.item_type = %s) AS %s', $filter->graduation, $item_type, $item_type . '_graduation_' . $filter->graduation );
|
658 |
+
|
659 |
+
if ( $i < $count_item_types ) {
|
660 |
+
$query_count .= ',';
|
661 |
+
}
|
662 |
+
}
|
663 |
+
|
664 |
+
$query = $this->wpdb->prepare(
|
665 |
+
'SELECT ' . $query_count . ' FROM ' . $this->tb_lp_user_items . ' ui
|
666 |
+
WHERE parent_id = %d
|
667 |
+
',
|
668 |
+
$filter->parent_id
|
669 |
+
);
|
670 |
+
|
671 |
+
$total_items = $this->wpdb->get_row( $query );
|
672 |
+
|
673 |
+
return $total_items;
|
674 |
+
}
|
675 |
+
|
676 |
+
/**
|
677 |
+
* Get quizzes of user
|
678 |
+
*
|
679 |
+
* @param LP_User_Items_Filter $filter
|
680 |
+
*
|
681 |
+
* @return null|object
|
682 |
+
* @throws Exception
|
683 |
+
*/
|
684 |
+
public function get_user_quizzes( LP_User_Items_Filter $filter ) {
|
685 |
+
$this->wpdb->query( "SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))" );
|
686 |
+
$offset = ( absint( $filter->page ) - 1 ) * $filter->limit;
|
687 |
+
|
688 |
+
$WHERE = '';
|
689 |
+
|
690 |
+
if ( ! empty( $filter->graduation ) ) {
|
691 |
+
$WHERE .= $this->wpdb->prepare( 'AND graduation = %s ', $filter->graduation );
|
692 |
+
}
|
693 |
+
|
694 |
+
if ( ! empty( $filter->status ) ) {
|
695 |
+
$WHERE .= $this->wpdb->prepare( 'AND status = %s ', $filter->status );
|
696 |
+
}
|
697 |
+
|
698 |
+
$query = $this->wpdb->prepare(
|
699 |
+
"SELECT * FROM $this->tb_lp_user_items
|
700 |
+
WHERE user_item_id IN (
|
701 |
+
SELECT DISTINCT MAX(user_item_id)
|
702 |
+
FROM $this->tb_lp_user_items
|
703 |
+
WHERE user_id = %d
|
704 |
+
AND item_type = %s
|
705 |
+
AND status IN (%s, %s)
|
706 |
+
GROUP BY item_id
|
707 |
+
)
|
708 |
+
$WHERE
|
709 |
+
ORDER BY user_item_id DESC
|
710 |
+
LIMIT %d, %d
|
711 |
+
",
|
712 |
+
$filter->user_id,
|
713 |
+
LP_QUIZ_CPT,
|
714 |
+
LP_ITEM_STARTED,
|
715 |
+
LP_ITEM_COMPLETED,
|
716 |
+
$offset,
|
717 |
+
$filter->limit
|
718 |
+
);
|
719 |
+
|
720 |
+
$result = $this->wpdb->get_results( $query );
|
721 |
+
|
722 |
+
$this->check_execute_has_error();
|
723 |
+
|
724 |
+
return $result;
|
725 |
+
}
|
726 |
}
|
727 |
|
728 |
LP_Course_DB::getInstance();
|
@@ -37,6 +37,10 @@ class LP_Filter {
|
|
37 |
* @var string
|
38 |
*/
|
39 |
public $select = '';
|
|
|
|
|
|
|
|
|
40 |
|
41 |
public function __construct() {
|
42 |
$this->limit = apply_filters( 'lp/filter/limit', $this->limit );
|
37 |
* @var string
|
38 |
*/
|
39 |
public $select = '';
|
40 |
+
/**
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
public $query_type = 'get_results';
|
44 |
|
45 |
public function __construct() {
|
46 |
$this->limit = apply_filters( 'lp/filter/limit', $this->limit );
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class LP_Section_Filter
|
4 |
+
*
|
5 |
+
* @author ThimPress
|
6 |
+
* @package LearnPress/Classes/Filters
|
7 |
+
* @version 4.1.4.1
|
8 |
+
*/
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Prevent loading this file directly
|
12 |
+
*/
|
13 |
+
defined( 'ABSPATH' ) || exit();
|
14 |
+
|
15 |
+
if ( class_exists( 'LP_Section_Filter' ) ) {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
class LP_Section_Filter extends LP_Filter {
|
20 |
+
/**
|
21 |
+
* @var int
|
22 |
+
*/
|
23 |
+
public $author_id_course = 0;
|
24 |
+
/**
|
25 |
+
* @var int
|
26 |
+
*/
|
27 |
+
public $section_course_id = 0;
|
28 |
+
/**
|
29 |
+
* @var int[]
|
30 |
+
*/
|
31 |
+
public $section_ids = [];
|
32 |
+
}
|
@@ -32,6 +32,10 @@ if ( ! class_exists( 'LP_User_Items_Filter' ) ) {
|
|
32 |
* @var string
|
33 |
*/
|
34 |
public $status = '';
|
|
|
|
|
|
|
|
|
35 |
/**
|
36 |
* @var string
|
37 |
*/
|
32 |
* @var string
|
33 |
*/
|
34 |
public $status = '';
|
35 |
+
/**
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
public $graduation = '';
|
39 |
/**
|
40 |
* @var string
|
41 |
*/
|
@@ -19,9 +19,9 @@ class LP_Jwt_Auth {
|
|
19 |
$this->version = 'v1';
|
20 |
|
21 |
// Is enable rest api?
|
22 |
-
if ( LP()->settings()->get( 'enable_jwt_rest_api' ) !== 'yes' ) {
|
23 |
-
|
24 |
-
}
|
25 |
|
26 |
$this->includes();
|
27 |
$this->define_hooks();
|
@@ -53,7 +53,7 @@ class LP_Jwt_Auth {
|
|
53 |
add_action( 'rest_api_init', array( $public, 'register_routes' ) );
|
54 |
add_filter( 'rest_api_init', array( $public, 'add_cors_support' ) );
|
55 |
add_filter( 'rest_pre_dispatch', array( $public, 'rest_pre_dispatch' ), 10, 2 );
|
56 |
-
add_filter( 'determine_current_user', array( $public, 'determine_current_user' ),
|
57 |
add_filter( 'template_redirect', array( $public, 'auto_login' ) );
|
58 |
|
59 |
// Rest API
|
19 |
$this->version = 'v1';
|
20 |
|
21 |
// Is enable rest api?
|
22 |
+
// if ( LP()->settings()->get( 'enable_jwt_rest_api' ) !== 'yes' ) {
|
23 |
+
// return;
|
24 |
+
// }
|
25 |
|
26 |
$this->includes();
|
27 |
$this->define_hooks();
|
53 |
add_action( 'rest_api_init', array( $public, 'register_routes' ) );
|
54 |
add_filter( 'rest_api_init', array( $public, 'add_cors_support' ) );
|
55 |
add_filter( 'rest_pre_dispatch', array( $public, 'rest_pre_dispatch' ), 10, 2 );
|
56 |
+
add_filter( 'determine_current_user', array( $public, 'determine_current_user' ), 30 );
|
57 |
add_filter( 'template_redirect', array( $public, 'auto_login' ) );
|
58 |
|
59 |
// Rest API
|
@@ -343,7 +343,7 @@ class LP_Jwt_Public {
|
|
343 |
'lp_jwt_auth_no_auth_header',
|
344 |
esc_html__( 'Authorization header not found.', 'learnpress' ),
|
345 |
array(
|
346 |
-
'status' =>
|
347 |
)
|
348 |
);
|
349 |
}
|
@@ -359,7 +359,7 @@ class LP_Jwt_Public {
|
|
359 |
'lp_jwt_auth_bad_auth_header',
|
360 |
esc_html__( 'Authentication token is missing.', 'learnpress' ),
|
361 |
array(
|
362 |
-
'status' =>
|
363 |
)
|
364 |
);
|
365 |
}
|
@@ -372,7 +372,7 @@ class LP_Jwt_Public {
|
|
372 |
'lp_jwt_auth_bad_config',
|
373 |
esc_html__( 'LearnPress JWT is not configurated properly, please contact the admin', 'learnpress' ),
|
374 |
array(
|
375 |
-
'status' =>
|
376 |
)
|
377 |
);
|
378 |
}
|
@@ -387,7 +387,7 @@ class LP_Jwt_Public {
|
|
387 |
'lp_jwt_auth_bad_iss',
|
388 |
esc_html__( 'The iss do not match with this server', 'learnpress' ),
|
389 |
array(
|
390 |
-
'status' =>
|
391 |
)
|
392 |
);
|
393 |
}
|
@@ -398,7 +398,7 @@ class LP_Jwt_Public {
|
|
398 |
'lp_jwt_auth_bad_request',
|
399 |
esc_html__( 'User ID not found in the token', 'learnpress' ),
|
400 |
array(
|
401 |
-
'status' =>
|
402 |
)
|
403 |
);
|
404 |
}
|
@@ -408,7 +408,7 @@ class LP_Jwt_Public {
|
|
408 |
'rest_authentication_missing_token_expiration',
|
409 |
esc_html__( 'Token must have an expiration.', 'learnpress' ),
|
410 |
array(
|
411 |
-
'status' =>
|
412 |
)
|
413 |
);
|
414 |
}
|
@@ -418,7 +418,7 @@ class LP_Jwt_Public {
|
|
418 |
'rest_authentication_token_expired',
|
419 |
esc_html__( 'Token has expired.', 'learnpress' ),
|
420 |
array(
|
421 |
-
'status' =>
|
422 |
)
|
423 |
);
|
424 |
}
|
@@ -442,7 +442,7 @@ class LP_Jwt_Public {
|
|
442 |
'lp_jwt_auth_invalid_token',
|
443 |
$e->getMessage(),
|
444 |
array(
|
445 |
-
'status' =>
|
446 |
)
|
447 |
);
|
448 |
}
|
343 |
'lp_jwt_auth_no_auth_header',
|
344 |
esc_html__( 'Authorization header not found.', 'learnpress' ),
|
345 |
array(
|
346 |
+
'status' => 401,
|
347 |
)
|
348 |
);
|
349 |
}
|
359 |
'lp_jwt_auth_bad_auth_header',
|
360 |
esc_html__( 'Authentication token is missing.', 'learnpress' ),
|
361 |
array(
|
362 |
+
'status' => 401,
|
363 |
)
|
364 |
);
|
365 |
}
|
372 |
'lp_jwt_auth_bad_config',
|
373 |
esc_html__( 'LearnPress JWT is not configurated properly, please contact the admin', 'learnpress' ),
|
374 |
array(
|
375 |
+
'status' => 401,
|
376 |
)
|
377 |
);
|
378 |
}
|
387 |
'lp_jwt_auth_bad_iss',
|
388 |
esc_html__( 'The iss do not match with this server', 'learnpress' ),
|
389 |
array(
|
390 |
+
'status' => 401,
|
391 |
)
|
392 |
);
|
393 |
}
|
398 |
'lp_jwt_auth_bad_request',
|
399 |
esc_html__( 'User ID not found in the token', 'learnpress' ),
|
400 |
array(
|
401 |
+
'status' => 401,
|
402 |
)
|
403 |
);
|
404 |
}
|
408 |
'rest_authentication_missing_token_expiration',
|
409 |
esc_html__( 'Token must have an expiration.', 'learnpress' ),
|
410 |
array(
|
411 |
+
'status' => 401,
|
412 |
)
|
413 |
);
|
414 |
}
|
418 |
'rest_authentication_token_expired',
|
419 |
esc_html__( 'Token has expired.', 'learnpress' ),
|
420 |
array(
|
421 |
+
'status' => 401,
|
422 |
)
|
423 |
);
|
424 |
}
|
442 |
'lp_jwt_auth_invalid_token',
|
443 |
$e->getMessage(),
|
444 |
array(
|
445 |
+
'status' => 401,
|
446 |
)
|
447 |
);
|
448 |
}
|
@@ -35,9 +35,9 @@ Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvX
|
|
35 |
## Get list Course learned by user, if not learned will get all course
|
36 |
## add param: learned, course_filter: in-progress, passed, failed.
|
37 |
###
|
38 |
-
GET http://learnpress4.local/wp-json/learnpress/v1/courses?
|
39 |
Content-Type: application/json
|
40 |
-
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
|
41 |
|
42 |
## Get list Course learned by user, if not learned will get all course
|
43 |
## add param: learned, course_filter: in-progress, passed, failed.
|
@@ -210,15 +210,9 @@ Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvX
|
|
210 |
}
|
211 |
|
212 |
####
|
213 |
-
|
214 |
Content-Type: application/json
|
215 |
|
216 |
-
{
|
217 |
-
"username": "student4",
|
218 |
-
"password": "student4",
|
219 |
-
"email": "student4@gmail.com"
|
220 |
-
}
|
221 |
-
|
222 |
###
|
223 |
POST http://learnpress4.local/wp-json/learnpress/v1/users/reset-password
|
224 |
Content-Type: application/json
|
@@ -228,7 +222,7 @@ Content-Type: application/json
|
|
228 |
}
|
229 |
|
230 |
###
|
231 |
-
POST https://test.thimpress.com/wp-json/learnpress/v1/token?v=
|
232 |
Content-Type: application/json
|
233 |
|
234 |
{
|
@@ -237,5 +231,5 @@ Content-Type: application/json
|
|
237 |
}
|
238 |
|
239 |
###
|
240 |
-
GET
|
241 |
-
|
35 |
## Get list Course learned by user, if not learned will get all course
|
36 |
## add param: learned, course_filter: in-progress, passed, failed.
|
37 |
###
|
38 |
+
GET http://learnpress4.local/wp-json/learnpress/v1/courses?learned=true&per_page=1&order=desc&course_filter=in-progress&optimize=sections
|
39 |
Content-Type: application/json
|
40 |
+
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sZWFybnByZXNzNC5sb2NhbCIsImlhdCI6MTYzOTcxMTI2OCwibmJmIjoxNjM5NzExMjY4LCJleHAiOjE2NDAzMTYwNjgsImRhdGEiOnsidXNlciI6eyJpZCI6IjEifX19.o4T_GPJY34KtMq-7Fe7gBE_7ZZapdT6ZJfpheObdxbE
|
41 |
|
42 |
## Get list Course learned by user, if not learned will get all course
|
43 |
## add param: learned, course_filter: in-progress, passed, failed.
|
210 |
}
|
211 |
|
212 |
####
|
213 |
+
GET http://learnpress4.local/wp-json/wp/v2/users/
|
214 |
Content-Type: application/json
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
###
|
217 |
POST http://learnpress4.local/wp-json/learnpress/v1/users/reset-password
|
218 |
Content-Type: application/json
|
222 |
}
|
223 |
|
224 |
###
|
225 |
+
POST https://test.thimpress.com/wp-json/learnpress/v1/token?v=asdasdsdd
|
226 |
Content-Type: application/json
|
227 |
|
228 |
{
|
231 |
}
|
232 |
|
233 |
###
|
234 |
+
GET https://test.thimpress.com/wp-json/wp/v2/posts?v=qweqwedsfdsfds
|
235 |
+
Content-Type: application/json
|
@@ -236,7 +236,7 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
236 |
$check = $user->can_show_finish_course_btn( $course );
|
237 |
|
238 |
if ( $check['status'] !== 'success' ) {
|
239 |
-
throw new Exception( $check['message'] );
|
240 |
}
|
241 |
|
242 |
$finished = $user->finish_course( $course_id );
|
@@ -347,6 +347,15 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
347 |
$data = array();
|
348 |
|
349 |
foreach ( $fields as $field ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
switch ( $field ) {
|
351 |
case 'id':
|
352 |
$data['id'] = $course->get_id();
|
@@ -393,6 +402,15 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
393 |
case 'can_finish':
|
394 |
$data['can_finish'] = $this->check_can_finish( $course );
|
395 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
case 'duration':
|
397 |
$data['duration'] = learn_press_get_post_translated_duration( $id, esc_html__( 'Lifetime', 'learnpress' ) );
|
398 |
break;
|
@@ -414,6 +432,15 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
414 |
case 'rating':
|
415 |
$data['rating'] = $this->get_course_rating( $id );
|
416 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
}
|
418 |
}
|
419 |
|
@@ -422,6 +449,50 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
422 |
return $data;
|
423 |
}
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
public function get_course_rating( $id ) {
|
426 |
if ( ! function_exists( 'learn_press_get_course_rate' ) ) {
|
427 |
return false;
|
@@ -433,7 +504,13 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
433 |
}
|
434 |
|
435 |
public function check_can_finish( $course ) {
|
436 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
|
438 |
if ( $user && $course ) {
|
439 |
$check = $user->can_show_finish_course_btn( $course );
|
@@ -479,35 +556,17 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
479 |
$user_id = get_current_user_id();
|
480 |
|
481 |
if ( ! $user_id ) {
|
482 |
-
return;
|
483 |
-
}
|
484 |
-
|
485 |
-
$profile = learn_press_get_profile( $user_id );
|
486 |
-
|
487 |
-
$orders = $profile->get_user_orders( array( 'status' => 'completed' ) );
|
488 |
-
|
489 |
-
$course_ids = array();
|
490 |
-
|
491 |
-
if ( $orders ) {
|
492 |
-
foreach ( $orders as $order ) {
|
493 |
-
$course_ids = array_merge( array_values( $order ), $course_ids );
|
494 |
-
}
|
495 |
-
}
|
496 |
-
|
497 |
-
if ( empty( $course_ids ) ) {
|
498 |
return false;
|
499 |
}
|
500 |
|
501 |
-
$ids = implode( ',', $course_ids );
|
502 |
-
|
503 |
$filter = ! empty( $request['course_filter'] ) ? $request['course_filter'] : false;
|
504 |
-
$where = $wpdb->prepare( 'user_id=%d AND item_type=%s
|
505 |
|
506 |
if ( $filter ) {
|
507 |
if ( $filter === 'in-progress' ) {
|
508 |
-
$where .= $wpdb->prepare( ' AND status=%s', 'enrolled' );
|
509 |
} elseif ( in_array( $filter, array( 'passed', 'failed' ) ) ) { // is "passed" or "failed"
|
510 |
-
$where .= $wpdb->prepare( ' AND graduation=%s', $filter );
|
511 |
}
|
512 |
}
|
513 |
|
@@ -637,6 +696,12 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
637 |
}
|
638 |
|
639 |
public function get_course_meta( $id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
if ( ! class_exists( 'LP_Meta_Box_Course' ) ) {
|
641 |
include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/course/settings.php';
|
642 |
}
|
@@ -644,6 +709,7 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
644 |
$metabox = new LP_Meta_Box_Course();
|
645 |
|
646 |
$output = array();
|
|
|
647 |
foreach ( $metabox->metabox( $id ) as $key => $tab ) {
|
648 |
if ( isset( $tab['content'] ) ) {
|
649 |
foreach ( $tab['content'] as $meta_key => $object ) {
|
@@ -841,12 +907,48 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
841 |
'context' => array( 'view' ),
|
842 |
'readonly' => true,
|
843 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
'rating' => array(
|
845 |
'description' => __( 'Course Review add-on', 'learnpress' ),
|
846 |
'type' => array( 'boolean', 'integer' ),
|
847 |
'context' => array( 'view' ),
|
848 |
'readonly' => true,
|
849 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
850 |
'categories' => array(
|
851 |
'description' => __( 'List of categories.', 'learnpress' ),
|
852 |
'type' => 'array',
|
@@ -1091,11 +1193,16 @@ class LP_Jwt_Courses_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
1091 |
'validate_callback' => 'rest_validate_request_arg',
|
1092 |
);
|
1093 |
|
1094 |
-
$params['popular']
|
1095 |
'description' => __( 'Get item popularity.', 'learnpress' ),
|
1096 |
'type' => 'boolean',
|
1097 |
'validate_callback' => 'rest_validate_request_arg',
|
1098 |
);
|
|
|
|
|
|
|
|
|
|
|
1099 |
|
1100 |
return $params;
|
1101 |
}
|
236 |
$check = $user->can_show_finish_course_btn( $course );
|
237 |
|
238 |
if ( $check['status'] !== 'success' ) {
|
239 |
+
throw new Exception( $check['message'] ?? esc_html__( 'Can not finish course.', 'learnpress' ) );
|
240 |
}
|
241 |
|
242 |
$finished = $user->finish_course( $course_id );
|
347 |
$data = array();
|
348 |
|
349 |
foreach ( $fields as $field ) {
|
350 |
+
if ( ! empty( $request['optimize'] ) ) {
|
351 |
+
$disables = is_bool( $request['optimize'] ) ? 'sections,course_data,instructor,meta_data,tags,can_finish,can_retake,count_students,rataken,ratake_count' : $request['optimize'];
|
352 |
+
$disable = explode( ',', $disables );
|
353 |
+
|
354 |
+
if ( ! empty( $disable ) && in_array( $field, $disable ) ) {
|
355 |
+
continue;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
|
359 |
switch ( $field ) {
|
360 |
case 'id':
|
361 |
$data['id'] = $course->get_id();
|
402 |
case 'can_finish':
|
403 |
$data['can_finish'] = $this->check_can_finish( $course );
|
404 |
break;
|
405 |
+
case 'can_retake':
|
406 |
+
$data['can_retake'] = $this->check_can_retake( $id );
|
407 |
+
break;
|
408 |
+
case 'ratake_count':
|
409 |
+
$data['ratake_count'] = (int) $course->get_data( 'retake_count' );
|
410 |
+
break;
|
411 |
+
case 'rataken':
|
412 |
+
$data['rataken'] = $this->get_retaken_count( $id );
|
413 |
+
break;
|
414 |
case 'duration':
|
415 |
$data['duration'] = learn_press_get_post_translated_duration( $id, esc_html__( 'Lifetime', 'learnpress' ) );
|
416 |
break;
|
432 |
case 'rating':
|
433 |
$data['rating'] = $this->get_course_rating( $id );
|
434 |
break;
|
435 |
+
case 'price':
|
436 |
+
$data['price'] = floatval( $course->get_price() );
|
437 |
+
break;
|
438 |
+
case 'origin_price':
|
439 |
+
$data['origin_price'] = floatval( $course->get_origin_price() );
|
440 |
+
break;
|
441 |
+
case 'sale_price':
|
442 |
+
$data['sale_price'] = floatval( $course->get_sale_price() );
|
443 |
+
break;
|
444 |
}
|
445 |
}
|
446 |
|
449 |
return $data;
|
450 |
}
|
451 |
|
452 |
+
public function get_retaken_count( $id ) {
|
453 |
+
$user_id = get_current_user_id();
|
454 |
+
|
455 |
+
if ( ! $user_id ) {
|
456 |
+
return 0;
|
457 |
+
}
|
458 |
+
|
459 |
+
$user = learn_press_get_user( $user_id );
|
460 |
+
|
461 |
+
if ( ! $user ) {
|
462 |
+
return 0;
|
463 |
+
}
|
464 |
+
|
465 |
+
$user_course_data = $user->get_course_data( $id );
|
466 |
+
|
467 |
+
if ( ! $user_course_data ) {
|
468 |
+
return 0;
|
469 |
+
}
|
470 |
+
|
471 |
+
return absint( $user_course_data->get_retaken_count() );
|
472 |
+
}
|
473 |
+
|
474 |
+
public function check_can_retake( $id ) {
|
475 |
+
$user_id = get_current_user_id();
|
476 |
+
|
477 |
+
if ( ! $user_id ) {
|
478 |
+
return 0;
|
479 |
+
}
|
480 |
+
|
481 |
+
$user = learn_press_get_user( $user_id );
|
482 |
+
|
483 |
+
if ( $user ) {
|
484 |
+
$can_retake_times = $user->can_retry_course( $id );
|
485 |
+
|
486 |
+
if ( $can_retake_times ) {
|
487 |
+
return true;
|
488 |
+
}
|
489 |
+
|
490 |
+
return false;
|
491 |
+
}
|
492 |
+
|
493 |
+
return false;
|
494 |
+
}
|
495 |
+
|
496 |
public function get_course_rating( $id ) {
|
497 |
if ( ! function_exists( 'learn_press_get_course_rate' ) ) {
|
498 |
return false;
|
504 |
}
|
505 |
|
506 |
public function check_can_finish( $course ) {
|
507 |
+
$user_id = get_current_user_id();
|
508 |
+
|
509 |
+
if ( ! $user_id ) {
|
510 |
+
return false;
|
511 |
+
}
|
512 |
+
|
513 |
+
$user = learn_press_get_user( $user_id );
|
514 |
|
515 |
if ( $user && $course ) {
|
516 |
$check = $user->can_show_finish_course_btn( $course );
|
556 |
$user_id = get_current_user_id();
|
557 |
|
558 |
if ( ! $user_id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
return false;
|
560 |
}
|
561 |
|
|
|
|
|
562 |
$filter = ! empty( $request['course_filter'] ) ? $request['course_filter'] : false;
|
563 |
+
$where = $wpdb->prepare( 'user_id=%d AND item_type=%s', $user_id, $this->post_type ); // phpcs:ignore
|
564 |
|
565 |
if ( $filter ) {
|
566 |
if ( $filter === 'in-progress' ) {
|
567 |
+
$where .= $wpdb->prepare( ' AND status=%s AND graduation=%s', 'enrolled', 'in-progress' );
|
568 |
} elseif ( in_array( $filter, array( 'passed', 'failed' ) ) ) { // is "passed" or "failed"
|
569 |
+
$where .= $wpdb->prepare( ' AND status=%s AND graduation=%s', 'finished', $filter );
|
570 |
}
|
571 |
}
|
572 |
|
696 |
}
|
697 |
|
698 |
public function get_course_meta( $id ) {
|
699 |
+
$user_id = get_current_user_id();
|
700 |
+
|
701 |
+
if ( ! $user_id ) {
|
702 |
+
return array();
|
703 |
+
}
|
704 |
+
|
705 |
if ( ! class_exists( 'LP_Meta_Box_Course' ) ) {
|
706 |
include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/course/settings.php';
|
707 |
}
|
709 |
$metabox = new LP_Meta_Box_Course();
|
710 |
|
711 |
$output = array();
|
712 |
+
|
713 |
foreach ( $metabox->metabox( $id ) as $key => $tab ) {
|
714 |
if ( isset( $tab['content'] ) ) {
|
715 |
foreach ( $tab['content'] as $meta_key => $object ) {
|
907 |
'context' => array( 'view' ),
|
908 |
'readonly' => true,
|
909 |
),
|
910 |
+
'can_retake' => array(
|
911 |
+
'description' => __( 'Can retake course', 'learnpress' ),
|
912 |
+
'type' => 'boolean',
|
913 |
+
'context' => array( 'view' ),
|
914 |
+
'readonly' => true,
|
915 |
+
),
|
916 |
+
'ratake_count' => array(
|
917 |
+
'description' => __( 'Total retake', 'learnpress' ),
|
918 |
+
'type' => 'integer',
|
919 |
+
'context' => array( 'view' ),
|
920 |
+
'readonly' => true,
|
921 |
+
),
|
922 |
+
'rataken' => array(
|
923 |
+
'description' => __( 'Retaken', 'learnpress' ),
|
924 |
+
'type' => 'integer',
|
925 |
+
'context' => array( 'view' ),
|
926 |
+
'readonly' => true,
|
927 |
+
),
|
928 |
'rating' => array(
|
929 |
'description' => __( 'Course Review add-on', 'learnpress' ),
|
930 |
'type' => array( 'boolean', 'integer' ),
|
931 |
'context' => array( 'view' ),
|
932 |
'readonly' => true,
|
933 |
),
|
934 |
+
'price' => array(
|
935 |
+
'description' => __( 'Course Price', 'learnpress' ),
|
936 |
+
'type' => 'integer',
|
937 |
+
'context' => array( 'view' ),
|
938 |
+
'readonly' => true,
|
939 |
+
),
|
940 |
+
'origin_price' => array(
|
941 |
+
'description' => __( 'Course Origin Price', 'learnpress' ),
|
942 |
+
'type' => 'integer',
|
943 |
+
'context' => array( 'view' ),
|
944 |
+
'readonly' => true,
|
945 |
+
),
|
946 |
+
'sale_price' => array(
|
947 |
+
'description' => __( 'Course Sale Price', 'learnpress' ),
|
948 |
+
'type' => 'integer',
|
949 |
+
'context' => array( 'view' ),
|
950 |
+
'readonly' => true,
|
951 |
+
),
|
952 |
'categories' => array(
|
953 |
'description' => __( 'List of categories.', 'learnpress' ),
|
954 |
'type' => 'array',
|
1193 |
'validate_callback' => 'rest_validate_request_arg',
|
1194 |
);
|
1195 |
|
1196 |
+
$params['popular'] = array(
|
1197 |
'description' => __( 'Get item popularity.', 'learnpress' ),
|
1198 |
'type' => 'boolean',
|
1199 |
'validate_callback' => 'rest_validate_request_arg',
|
1200 |
);
|
1201 |
+
$params['optimize'] = array(
|
1202 |
+
'description' => __( 'Disable some fields schema.', 'learnpress' ),
|
1203 |
+
'type' => array( 'boolean', 'string' ),
|
1204 |
+
'validate_callback' => 'wp_parse_id_list',
|
1205 |
+
);
|
1206 |
|
1207 |
return $params;
|
1208 |
}
|
@@ -292,6 +292,9 @@ class LP_Jwt_Lessons_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
292 |
case 'can_finish_course':
|
293 |
$data['can_finish_course'] = $this->check_can_finish_course( $id );
|
294 |
break;
|
|
|
|
|
|
|
295 |
case 'assigned':
|
296 |
$data['assigned'] = $assigned;
|
297 |
break;
|
@@ -476,6 +479,11 @@ class LP_Jwt_Lessons_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
476 |
'context' => array( 'view' ),
|
477 |
'readonly' => true,
|
478 |
),
|
|
|
|
|
|
|
|
|
|
|
479 |
'assigned' => array(
|
480 |
'description' => __( 'Assigned.', 'learnpress' ),
|
481 |
'type' => 'array',
|
292 |
case 'can_finish_course':
|
293 |
$data['can_finish_course'] = $this->check_can_finish_course( $id );
|
294 |
break;
|
295 |
+
case 'duration':
|
296 |
+
$data['duration'] = learn_press_get_post_translated_duration( $id, esc_html__( 'Lifetime', 'learnpress' ) );
|
297 |
+
break;
|
298 |
case 'assigned':
|
299 |
$data['assigned'] = $assigned;
|
300 |
break;
|
479 |
'context' => array( 'view' ),
|
480 |
'readonly' => true,
|
481 |
),
|
482 |
+
'duration' => array(
|
483 |
+
'description' => __( 'Duration', 'learnpress' ),
|
484 |
+
'type' => 'string',
|
485 |
+
'context' => array( 'view' ),
|
486 |
+
),
|
487 |
'assigned' => array(
|
488 |
'description' => __( 'Assigned.', 'learnpress' ),
|
489 |
'type' => 'array',
|
@@ -82,7 +82,7 @@ class LP_Jwt_Quiz_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
82 |
),
|
83 |
'answered' => array(
|
84 |
'description' => esc_html__( 'Answer this question.', 'learnpress' ),
|
85 |
-
'type' => 'string',
|
86 |
),
|
87 |
),
|
88 |
array(
|
@@ -372,6 +372,9 @@ class LP_Jwt_Quiz_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
372 |
case 'can_finish_course':
|
373 |
$data['can_finish_course'] = $this->check_can_finish_course( $id );
|
374 |
break;
|
|
|
|
|
|
|
375 |
case 'assigned':
|
376 |
$data['assigned'] = $assigned;
|
377 |
break;
|
@@ -641,6 +644,11 @@ class LP_Jwt_Quiz_V1_Controller extends LP_REST_Jwt_Posts_Controller {
|
|
641 |
'context' => array( 'view' ),
|
642 |
'readonly' => true,
|
643 |
),
|
|
|
|
|
|
|
|
|
|
|
644 |
'assigned' => array(
|
645 |
'description' => __( 'Assigned.', 'learnpress' ),
|
646 |
'type' => 'array',
|
82 |
),
|
83 |
'answered' => array(
|
84 |
'description' => esc_html__( 'Answer this question.', 'learnpress' ),
|
85 |
+
'type' => array( 'array', 'string', 'object' ),
|
86 |
),
|
87 |
),
|
88 |
array(
|
372 |
case 'can_finish_course':
|
373 |
$data['can_finish_course'] = $this->check_can_finish_course( $id );
|
374 |
break;
|
375 |
+
case 'duration':
|
376 |
+
$data['duration'] = learn_press_get_post_translated_duration( $id, esc_html__( 'Lifetime', 'learnpress' ) );
|
377 |
+
break;
|
378 |
case 'assigned':
|
379 |
$data['assigned'] = $assigned;
|
380 |
break;
|
644 |
'context' => array( 'view' ),
|
645 |
'readonly' => true,
|
646 |
),
|
647 |
+
'duration' => array(
|
648 |
+
'description' => __( 'Duration', 'learnpress' ),
|
649 |
+
'type' => 'string',
|
650 |
+
'context' => array( 'view' ),
|
651 |
+
),
|
652 |
'assigned' => array(
|
653 |
'description' => __( 'Assigned.', 'learnpress' ),
|
654 |
'type' => 'array',
|
@@ -514,16 +514,19 @@ class LP_Jwt_Users_V1_Controller extends LP_REST_Jwt_Controller {
|
|
514 |
$enrolled_ids = array();
|
515 |
if ( ! empty( $query_enrolled['items'] ) ) {
|
516 |
foreach ( $query_enrolled['items'] as $enrolled_item ) {
|
517 |
-
$course_data
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
|
|
|
|
|
|
527 |
}
|
528 |
}
|
529 |
|
@@ -732,8 +735,6 @@ class LP_Jwt_Users_V1_Controller extends LP_REST_Jwt_Controller {
|
|
732 |
|
733 |
if ( isset( $registered['who'] ) && ! empty( $request['who'] ) && 'authors' === $request['who'] ) {
|
734 |
$prepared_args['who'] = 'authors';
|
735 |
-
} elseif ( ! current_user_can( 'list_users' ) ) {
|
736 |
-
$prepared_args['has_published_posts'] = get_post_types( array( 'show_in_rest' => true ), 'names' );
|
737 |
}
|
738 |
|
739 |
if ( ! empty( $prepared_args['search'] ) ) {
|
@@ -932,8 +933,8 @@ class LP_Jwt_Users_V1_Controller extends LP_REST_Jwt_Controller {
|
|
932 |
$counts = $query['counts'];
|
933 |
|
934 |
$output = array(
|
935 |
-
'enrolled_courses' => absint( $counts['all'] )
|
936 |
-
'completed_courses' => absint( $counts['finished'] )
|
937 |
'courses' => absint( count_user_posts( $user_id, LP_COURSE_CPT ) ),
|
938 |
'students' => absint( learn_press_count_instructor_users( $user_id ) ),
|
939 |
);
|
@@ -944,32 +945,34 @@ class LP_Jwt_Users_V1_Controller extends LP_REST_Jwt_Controller {
|
|
944 |
public function get_lp_data_tabs( $user, $request ) {
|
945 |
$output = array();
|
946 |
|
947 |
-
if (
|
948 |
-
|
949 |
-
|
950 |
-
$content = array(
|
951 |
-
'overview' => $this->get_overview_tab_contents( $user ),
|
952 |
-
'courses' => $this->get_course_tab_contents( $request ),
|
953 |
-
'quiz' => $this->get_quiz_tab_contents( $request ),
|
954 |
-
'orders' => $this->get_order_content_tab( $request ),
|
955 |
-
);
|
956 |
|
957 |
-
|
958 |
-
|
959 |
-
'
|
960 |
-
'
|
961 |
-
'
|
962 |
-
'icon' => $tab['icon'] ?? '',
|
963 |
-
'content' => $content[ $key ] ?? '',
|
964 |
);
|
965 |
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
973 |
}
|
974 |
}
|
975 |
}
|
514 |
$enrolled_ids = array();
|
515 |
if ( ! empty( $query_enrolled['items'] ) ) {
|
516 |
foreach ( $query_enrolled['items'] as $enrolled_item ) {
|
517 |
+
$course_data = $user->get_course_data( $enrolled_item->get_id() );
|
518 |
+
|
519 |
+
if ( $course_data ) {
|
520 |
+
$enrolled_ids[] = array(
|
521 |
+
'id' => $enrolled_item->get_id() ?? '',
|
522 |
+
'graduation' => ! empty( $course_data->get_graduation() ) ? $course_data->get_graduation() : '',
|
523 |
+
'status' => ! empty( $course_data->get_status() ) ? $course_data->get_status() : '',
|
524 |
+
'start_time' => lp_jwt_prepare_date_response( $course_data->get_start_time() ? $course_data->get_start_time()->toSql( false ) : '' ),
|
525 |
+
'end_time' => lp_jwt_prepare_date_response( $course_data->get_end_time() ? $course_data->get_end_time()->toSql( false ) : '' ),
|
526 |
+
'expiration' => lp_jwt_prepare_date_response( $course_data->get_expiration_time() ? $course_data->get_expiration_time()->toSql( false ) : '' ),
|
527 |
+
'results' => array_map( 'json_decode', LP_User_Items_Result_DB::instance()->get_results( $course_data->get_user_item_id(), 4, false ) ),
|
528 |
+
);
|
529 |
+
}
|
530 |
}
|
531 |
}
|
532 |
|
735 |
|
736 |
if ( isset( $registered['who'] ) && ! empty( $request['who'] ) && 'authors' === $request['who'] ) {
|
737 |
$prepared_args['who'] = 'authors';
|
|
|
|
|
738 |
}
|
739 |
|
740 |
if ( ! empty( $prepared_args['search'] ) ) {
|
933 |
$counts = $query['counts'];
|
934 |
|
935 |
$output = array(
|
936 |
+
'enrolled_courses' => isset( $counts['all'] ) ? absint( $counts['all'] ) : 0,
|
937 |
+
'completed_courses' => isset( $counts['finished'] ) ? absint( $counts['finished'] ) : 0,
|
938 |
'courses' => absint( count_user_posts( $user_id, LP_COURSE_CPT ) ),
|
939 |
'students' => absint( learn_press_count_instructor_users( $user_id ) ),
|
940 |
);
|
945 |
public function get_lp_data_tabs( $user, $request ) {
|
946 |
$output = array();
|
947 |
|
948 |
+
if ( get_current_user_id() === $user->ID || current_user_can( 'list_users' ) ) {
|
949 |
+
if ( function_exists( 'learn_press_get_user_profile_tabs' ) ) {
|
950 |
+
$tabs = learn_press_get_user_profile_tabs();
|
|
|
|
|
|
|
|
|
|
|
|
|
951 |
|
952 |
+
$content = array(
|
953 |
+
'overview' => $this->get_overview_tab_contents( $user ),
|
954 |
+
'courses' => $this->get_course_tab_contents( $request ),
|
955 |
+
'quiz' => $this->get_quiz_tab_contents( $request ),
|
956 |
+
'orders' => $this->get_order_content_tab( $request ),
|
|
|
|
|
957 |
);
|
958 |
|
959 |
+
foreach ( $tabs->get() as $key => $tab ) {
|
960 |
+
$output[ $key ] = array(
|
961 |
+
'title' => $tab['title'] ?? '',
|
962 |
+
'slug' => $tab['slug'] ?? '',
|
963 |
+
'priority' => $tab['priority'] ?? '',
|
964 |
+
'icon' => $tab['icon'] ?? '',
|
965 |
+
'content' => $content[ $key ] ?? '',
|
966 |
+
);
|
967 |
+
|
968 |
+
if ( ! empty( $tab['sections'] ) ) {
|
969 |
+
foreach ( $tab['sections'] as $section_key => $section ) {
|
970 |
+
$output[ $key ]['section'][ $section_key ] = array(
|
971 |
+
'title' => $section['title'] ?? '',
|
972 |
+
'slug' => $section['slug'] ?? '',
|
973 |
+
'priority' => $section['priority'] ?? '',
|
974 |
+
);
|
975 |
+
}
|
976 |
}
|
977 |
}
|
978 |
}
|
@@ -40,7 +40,7 @@ const LP_ORDER_CPT = 'lp_order';
|
|
40 |
|
41 |
// Role of user .
|
42 |
const LP_TEACHER_ROLE = 'lp_teacher';
|
43 |
-
const ADMIN_ROLE
|
44 |
|
45 |
// Turn debug mode on/off.
|
46 |
//define( 'LP_DEBUG', true );
|
@@ -93,6 +93,8 @@ const LP_BLOCK_COURSE_PURCHASE = 'block_course_purchased';
|
|
93 |
const LP_COURSE_ENROLLED = 'enrolled';
|
94 |
const LP_COURSE_FINISHED = 'finished';
|
95 |
const LP_COURSE_PURCHASED = 'purchased';
|
|
|
|
|
96 |
|
97 |
// Graduation user item course
|
98 |
const LP_COURSE_GRADUATION_IN_PROGRESS = 'in-progress';
|
40 |
|
41 |
// Role of user .
|
42 |
const LP_TEACHER_ROLE = 'lp_teacher';
|
43 |
+
const ADMIN_ROLE = 'administrator';
|
44 |
|
45 |
// Turn debug mode on/off.
|
46 |
//define( 'LP_DEBUG', true );
|
93 |
const LP_COURSE_ENROLLED = 'enrolled';
|
94 |
const LP_COURSE_FINISHED = 'finished';
|
95 |
const LP_COURSE_PURCHASED = 'purchased';
|
96 |
+
const LP_ITEM_COMPLETED = 'completed';
|
97 |
+
const LP_ITEM_STARTED = 'started';
|
98 |
|
99 |
// Graduation user item course
|
100 |
const LP_COURSE_GRADUATION_IN_PROGRESS = 'in-progress';
|
@@ -2894,6 +2894,7 @@ if ( ! function_exists( 'learn_press_get_lp_course' ) ) {
|
|
2894 |
*
|
2895 |
* @return array
|
2896 |
* @since 3.0.0
|
|
|
2897 |
*/
|
2898 |
function learn_press_get_unassigned_items( $type = '' ) {
|
2899 |
global $wpdb;
|
@@ -2914,7 +2915,7 @@ function learn_press_get_unassigned_items( $type = '' ) {
|
|
2914 |
SELECT p.ID
|
2915 |
FROM {$wpdb->posts} p
|
2916 |
WHERE p.post_type IN(" . join( ',', $format ) . ")
|
2917 |
-
AND p.ID IN(
|
2918 |
SELECT si.item_id
|
2919 |
FROM {$wpdb->learnpress_section_items} si
|
2920 |
INNER JOIN {$wpdb->posts} p ON p.ID = si.item_id
|
@@ -3444,58 +3445,41 @@ function learn_press_default_course_levels() {
|
|
3444 |
* @since 3.x.x
|
3445 |
*/
|
3446 |
function learn_press_course_evaluation_methods( $return = '', $final_quizz_passing = '' ) {
|
3447 |
-
global $
|
3448 |
|
3449 |
$course_tip = '<span class="learn-press-tip">%s</span>';
|
3450 |
-
$final_quiz_btn = '<a href="#" class="lp-metabox-get-final-quiz" data-postid="' . $
|
3451 |
'Loading...',
|
3452 |
'learnpress'
|
3453 |
) . '">' . esc_html__( 'Get Passing Grade', 'learnpress' ) . '</a>';
|
3454 |
|
3455 |
$course_desc = array(
|
3456 |
-
'evaluate_lesson' =>
|
3457 |
-
'
|
3458 |
-
'learnpress'
|
3459 |
-
|
3460 |
-
|
3461 |
-
'<p>%s</p>',
|
3462 |
-
__(
|
3463 |
-
'E.g: Course has 10 lessons and user completed 5 lessons then the result = 5/10 = 50.%',
|
3464 |
-
'learnpress'
|
3465 |
-
)
|
3466 |
-
),
|
3467 |
'evaluate_final_quiz' => __(
|
3468 |
-
'Evaluate by
|
3469 |
'learnpress'
|
3470 |
),
|
3471 |
-
'
|
3472 |
-
'
|
3473 |
-
'learnpress'
|
3474 |
-
|
3475 |
-
|
3476 |
-
|
3477 |
-
|
3478 |
-
|
3479 |
-
'
|
3480 |
-
'<p
|
3481 |
-
'learnpress'
|
3482 |
-
|
3483 |
-
|
3484 |
-
|
3485 |
-
|
3486 |
-
|
3487 |
-
'
|
3488 |
-
'Evaluate by achieved points of question passed per total point of all questions.',
|
3489 |
-
'learnpress'
|
3490 |
-
)
|
3491 |
-
. sprintf(
|
3492 |
-
'<p>%s</p>',
|
3493 |
-
__(
|
3494 |
-
'E.g: Course has 10 questions. User correct 5 questions. Result is 5/10 = 50%.',
|
3495 |
-
'learnpress'
|
3496 |
-
)
|
3497 |
-
),
|
3498 |
-
'evaluate_mark' => __( 'Evaluate by achieved marks per total marks of all questions.', 'learnpress' ),
|
3499 |
);
|
3500 |
|
3501 |
$methods = apply_filters(
|
@@ -3538,10 +3522,12 @@ function learn_press_course_evaluation_methods( $return = '', $final_quizz_passi
|
|
3538 |
*
|
3539 |
* @return int|string
|
3540 |
* @since 4.0.0
|
|
|
|
|
3541 |
*/
|
3542 |
-
function learn_press_mysql_time( $gmt = true ) {
|
3543 |
return current_time( 'mysql', $gmt );
|
3544 |
-
}
|
3545 |
|
3546 |
/**
|
3547 |
* Wrap WP Core function current_time with timestamp format.
|
2894 |
*
|
2895 |
* @return array
|
2896 |
* @since 3.0.0
|
2897 |
+
* @deprecated 4.1.4.1
|
2898 |
*/
|
2899 |
function learn_press_get_unassigned_items( $type = '' ) {
|
2900 |
global $wpdb;
|
2915 |
SELECT p.ID
|
2916 |
FROM {$wpdb->posts} p
|
2917 |
WHERE p.post_type IN(" . join( ',', $format ) . ")
|
2918 |
+
AND p.ID NOT IN(
|
2919 |
SELECT si.item_id
|
2920 |
FROM {$wpdb->learnpress_section_items} si
|
2921 |
INNER JOIN {$wpdb->posts} p ON p.ID = si.item_id
|
3445 |
* @since 3.x.x
|
3446 |
*/
|
3447 |
function learn_press_course_evaluation_methods( $return = '', $final_quizz_passing = '' ) {
|
3448 |
+
global $post;
|
3449 |
|
3450 |
$course_tip = '<span class="learn-press-tip">%s</span>';
|
3451 |
+
$final_quiz_btn = '<a href="#" class="lp-metabox-get-final-quiz" data-postid="' . $post->ID . '" data-loading="' . esc_attr__(
|
3452 |
'Loading...',
|
3453 |
'learnpress'
|
3454 |
) . '">' . esc_html__( 'Get Passing Grade', 'learnpress' ) . '</a>';
|
3455 |
|
3456 |
$course_desc = array(
|
3457 |
+
'evaluate_lesson' => sprintf(
|
3458 |
+
'<p>%s<br/>%s</p>',
|
3459 |
+
__( 'Evaluate by the number of lessons completed per total number of lessons.', 'learnpress' ),
|
3460 |
+
__( 'E.g: Course has 10 lessons and user completed 5 lessons then the result = 5/10 (50.%)', 'learnpress' )
|
3461 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
3462 |
'evaluate_final_quiz' => __(
|
3463 |
+
'Evaluate by result of final quiz in the course. You have to add a quiz to the end of the course.',
|
3464 |
'learnpress'
|
3465 |
),
|
3466 |
+
'evaluate_quiz' => sprintf(
|
3467 |
+
'<p>%s<br/>%s</p>',
|
3468 |
+
__( 'Evaluate by the number of quizzes passed per total number of quizzes.', 'learnpress' ),
|
3469 |
+
__(
|
3470 |
+
'E.g: The course has 10 quizzes and the user passed 5 quizzes then the result = 5/10 (50%).',
|
3471 |
+
'learnpress'
|
3472 |
+
)
|
3473 |
+
),
|
3474 |
+
'evaluate_questions' => sprintf(
|
3475 |
+
'<p>%s<br/>%s</p>',
|
3476 |
+
__( 'Evaluate by total number of correct answers per total number of questions.', 'learnpress' ),
|
3477 |
+
__(
|
3478 |
+
'E.g: Course has 10 questions. User correct 5 questions. Result is 5/10 (50%).',
|
3479 |
+
'learnpress'
|
3480 |
+
)
|
3481 |
+
),
|
3482 |
+
'evaluate_mark' => __( 'Evaluate by total score achieved per total score of the questions.', 'learnpress' ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3483 |
);
|
3484 |
|
3485 |
$methods = apply_filters(
|
3522 |
*
|
3523 |
* @return int|string
|
3524 |
* @since 4.0.0
|
3525 |
+
* @editor tungnx
|
3526 |
+
* @modify 4.1.4.1 - comment - not use
|
3527 |
*/
|
3528 |
+
/*function learn_press_mysql_time( $gmt = true ) {
|
3529 |
return current_time( 'mysql', $gmt );
|
3530 |
+
}*/
|
3531 |
|
3532 |
/**
|
3533 |
* Wrap WP Core function current_time with timestamp format.
|
@@ -837,41 +837,41 @@ if ( ! function_exists( 'learn_press_course_tabs' ) ) {
|
|
837 |
}
|
838 |
}
|
839 |
|
840 |
-
if ( ! function_exists( 'learn_press_course_item_content' ) ) {
|
841 |
-
/**
|
842 |
-
* Get course item content template.
|
843 |
-
*
|
844 |
-
* @since 3.0.0
|
845 |
-
*/
|
846 |
-
function learn_press_course_item_content() {
|
847 |
-
global $lp_course, $lp_course_item;
|
848 |
-
|
849 |
-
$item = LP_Global::course_item();
|
850 |
-
|
851 |
-
/**
|
852 |
-
* Fix only for WPBakery load style inline
|
853 |
-
* custom CSS is provided, load inline style.
|
854 |
-
*
|
855 |
-
* @editor tuanta
|
856 |
-
* @since 3.2.8.1
|
857 |
-
*/
|
858 |
-
$shortcodes_custom_css = get_post_meta( $item->get_id(), '_wpb_shortcodes_custom_css', true );
|
859 |
-
|
860 |
-
if ( ! empty( $shortcodes_custom_css ) ) {
|
861 |
-
$shortcodes_custom_css = strip_tags( $shortcodes_custom_css );
|
862 |
-
echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
|
863 |
-
echo $shortcodes_custom_css;
|
864 |
-
echo '</style>';
|
865 |
-
}
|
866 |
-
// End
|
867 |
-
|
868 |
-
$item_template_name = learn_press_locate_template( 'single-course/content-item-' . $item->get_item_type() . '.php' );
|
869 |
-
|
870 |
-
if ( file_exists( $item_template_name ) ) {
|
871 |
-
learn_press_get_template( 'single-course/content-item-' . $item->get_item_type() . '.php' );
|
872 |
-
}
|
873 |
-
}
|
874 |
-
}
|
875 |
|
876 |
|
877 |
if ( ! function_exists( 'learn_press_content_item_quiz_title' ) ) {
|
837 |
}
|
838 |
}
|
839 |
|
840 |
+
//if ( ! function_exists( 'learn_press_course_item_content' ) ) {
|
841 |
+
// /**
|
842 |
+
// * Get course item content template.
|
843 |
+
// *
|
844 |
+
// * @since 3.0.0
|
845 |
+
// */
|
846 |
+
// function learn_press_course_item_content() {
|
847 |
+
// global $lp_course, $lp_course_item;
|
848 |
+
//
|
849 |
+
// $item = LP_Global::course_item();
|
850 |
+
//
|
851 |
+
// /**
|
852 |
+
// * Fix only for WPBakery load style inline
|
853 |
+
// * custom CSS is provided, load inline style.
|
854 |
+
// *
|
855 |
+
// * @editor tuanta
|
856 |
+
// * @since 3.2.8.1
|
857 |
+
// */
|
858 |
+
// $shortcodes_custom_css = get_post_meta( $item->get_id(), '_wpb_shortcodes_custom_css', true );
|
859 |
+
//
|
860 |
+
// if ( ! empty( $shortcodes_custom_css ) ) {
|
861 |
+
// $shortcodes_custom_css = strip_tags( $shortcodes_custom_css );
|
862 |
+
// echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
|
863 |
+
// echo $shortcodes_custom_css;
|
864 |
+
// echo '</style>';
|
865 |
+
// }
|
866 |
+
// // End
|
867 |
+
//
|
868 |
+
// $item_template_name = learn_press_locate_template( 'single-course/content-item-' . $item->get_item_type() . '.php' );
|
869 |
+
//
|
870 |
+
// if ( file_exists( $item_template_name ) ) {
|
871 |
+
// learn_press_get_template( 'single-course/content-item-' . $item->get_item_type() . '.php' );
|
872 |
+
// }
|
873 |
+
// }
|
874 |
+
//}
|
875 |
|
876 |
|
877 |
if ( ! function_exists( 'learn_press_content_item_quiz_title' ) ) {
|
@@ -596,10 +596,7 @@ add_action( 'the_post', 'learn_press_setup_object_data' );
|
|
596 |
function learn_press_setup_user() {
|
597 |
$GLOBALS['lp_user'] = learn_press_get_current_user();
|
598 |
}
|
599 |
-
|
600 |
-
if ( ! is_admin() ) {
|
601 |
-
add_action( 'init', 'learn_press_setup_user', 1000 );
|
602 |
-
}
|
603 |
|
604 |
/**
|
605 |
* Display a message immediately with out push into queue
|
596 |
function learn_press_setup_user() {
|
597 |
$GLOBALS['lp_user'] = learn_press_get_current_user();
|
598 |
}
|
599 |
+
add_action( 'init', 'learn_press_setup_user', 1000 );
|
|
|
|
|
|
|
600 |
|
601 |
/**
|
602 |
* Display a message immediately with out push into queue
|
@@ -140,6 +140,9 @@ add_action(
|
|
140 |
LP()->template( 'course' )->callback( 'single-course/meta/level' ),
|
141 |
20
|
142 |
);
|
|
|
|
|
|
|
143 |
add_action( 'learn-press/after-courses-loop-item', LP()->template( 'course' )->func( 'count_object' ), 20 );
|
144 |
add_action(
|
145 |
'learn-press/after-courses-loop-item',
|
@@ -289,6 +292,9 @@ add_action(
|
|
289 |
LP()->template( 'course' )->callback( 'single-course/meta/level' ),
|
290 |
20
|
291 |
);
|
|
|
|
|
|
|
292 |
add_action( 'learn-press/course-meta-secondary-left', LP()->template( 'course' )->func( 'count_object' ), 20 );
|
293 |
|
294 |
|
@@ -540,12 +546,12 @@ add_action(
|
|
540 |
);
|
541 |
add_action( 'learn-press/content-item-summary/lp_quiz', LP()->template( 'course' )->callback( 'content-quiz/js' ), 25 );
|
542 |
add_action( 'learn-press/parse-course-item', 'learn_press_control_displaying_course_item', 5 );
|
543 |
-
add_action( 'learn-press/after-single-course', 'learn_press_single_course_args', 5 );
|
544 |
add_filter( 'document_title_parts', 'learn_press_single_document_title_parts', 5 );
|
545 |
|
546 |
add_filter( 'body_class', 'learn_press_body_classes', 10 );
|
547 |
add_filter( 'post_class', 'learn_press_course_class', 15, 3 );
|
548 |
-
add_action( 'wp_head', 'learn_press_single_course_args', 5 );
|
549 |
add_action(
|
550 |
'learn-press/before-checkout-order-review',
|
551 |
LP()->template( 'course' )->callback( 'checkout/form-logged-in.php' ),
|
140 |
LP()->template( 'course' )->callback( 'single-course/meta/level' ),
|
141 |
20
|
142 |
);
|
143 |
+
/**
|
144 |
+
* @see LP_Template_Course::count_object()
|
145 |
+
*/
|
146 |
add_action( 'learn-press/after-courses-loop-item', LP()->template( 'course' )->func( 'count_object' ), 20 );
|
147 |
add_action(
|
148 |
'learn-press/after-courses-loop-item',
|
292 |
LP()->template( 'course' )->callback( 'single-course/meta/level' ),
|
293 |
20
|
294 |
);
|
295 |
+
/**
|
296 |
+
* @see LP_Template_Course::count_object()
|
297 |
+
*/
|
298 |
add_action( 'learn-press/course-meta-secondary-left', LP()->template( 'course' )->func( 'count_object' ), 20 );
|
299 |
|
300 |
|
546 |
);
|
547 |
add_action( 'learn-press/content-item-summary/lp_quiz', LP()->template( 'course' )->callback( 'content-quiz/js' ), 25 );
|
548 |
add_action( 'learn-press/parse-course-item', 'learn_press_control_displaying_course_item', 5 );
|
549 |
+
//add_action( 'learn-press/after-single-course', 'learn_press_single_course_args', 5 );
|
550 |
add_filter( 'document_title_parts', 'learn_press_single_document_title_parts', 5 );
|
551 |
|
552 |
add_filter( 'body_class', 'learn_press_body_classes', 10 );
|
553 |
add_filter( 'post_class', 'learn_press_course_class', 15, 3 );
|
554 |
+
//add_action( 'wp_head', 'learn_press_single_course_args', 5 );
|
555 |
add_action(
|
556 |
'learn-press/before-checkout-order-review',
|
557 |
LP()->template( 'course' )->callback( 'checkout/form-logged-in.php' ),
|
@@ -4,7 +4,7 @@
|
|
4 |
* Class LP_Course_Extra_Info_Fast_Query_Model
|
5 |
*
|
6 |
* @author tungnnx
|
7 |
-
* @version 1.0.
|
8 |
* @since 4.1.3
|
9 |
*/
|
10 |
class LP_Course_Extra_Info_Fast_Query_Model {
|
@@ -12,6 +12,11 @@ class LP_Course_Extra_Info_Fast_Query_Model {
|
|
12 |
* @var int First item of Course
|
13 |
*/
|
14 |
public $first_item_id = 0;
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
* Mapper stdclass to model
|
4 |
* Class LP_Course_Extra_Info_Fast_Query_Model
|
5 |
*
|
6 |
* @author tungnnx
|
7 |
+
* @version 1.0.2
|
8 |
* @since 4.1.3
|
9 |
*/
|
10 |
class LP_Course_Extra_Info_Fast_Query_Model {
|
12 |
* @var int First item of Course
|
13 |
*/
|
14 |
public $first_item_id = 0;
|
15 |
+
/**
|
16 |
+
* @var object Total items of course
|
17 |
+
* {"count_items":"3","lp_lesson":"2","lp_quiz":"1", "{item_type}":"0"}
|
18 |
+
*/
|
19 |
+
public $total_items;
|
20 |
|
21 |
/**
|
22 |
* Mapper stdclass to model
|
@@ -175,7 +175,7 @@ if ( ! class_exists( 'LP_Order' ) ) {
|
|
175 |
* @return array|mixed
|
176 |
*/
|
177 |
public function get_order_key() {
|
178 |
-
return $this->get_data( 'order_key' );
|
179 |
}
|
180 |
|
181 |
/**
|
@@ -465,14 +465,22 @@ if ( ! class_exists( 'LP_Order' ) ) {
|
|
465 |
return false !== get_userdata( $this->get_data( 'user_id' ) );
|
466 |
}*/
|
467 |
|
|
|
|
|
468 |
/**
|
469 |
* Get items of the order
|
470 |
*
|
471 |
* @return mixed
|
472 |
*/
|
473 |
public function get_items() {
|
|
|
|
|
|
|
|
|
474 |
$items = $this->_curd->read_items( $this );
|
475 |
|
|
|
|
|
476 |
return apply_filters( 'learn-press/order-items', $items );
|
477 |
}
|
478 |
|
@@ -667,7 +675,7 @@ if ( ! class_exists( 'LP_Order' ) ) {
|
|
667 |
|
668 |
do_action( 'learn-press/added-order-item-data', $order_item_id, $item, $this->get_id() );
|
669 |
} catch ( Throwable $e ) {
|
670 |
-
|
671 |
}
|
672 |
|
673 |
return $order_item_id;
|
@@ -1361,10 +1369,10 @@ if ( ! class_exists( 'LP_Order' ) ) {
|
|
1361 |
* @version 1.0.0
|
1362 |
*/
|
1363 |
public function check_can_delete_item_old( LP_Course $course ): bool {
|
1364 |
-
|
1365 |
if ( $user_current instanceof LP_User_Guest ) {
|
1366 |
return false;
|
1367 |
-
}
|
1368 |
|
1369 |
$lp_user_items_db = LP_User_Items_DB::getInstance();
|
1370 |
|
175 |
* @return array|mixed
|
176 |
*/
|
177 |
public function get_order_key() {
|
178 |
+
return $this->get_data( 'order_key', '' );
|
179 |
}
|
180 |
|
181 |
/**
|
465 |
return false !== get_userdata( $this->get_data( 'user_id' ) );
|
466 |
}*/
|
467 |
|
468 |
+
public $order_items_loaded = false;
|
469 |
+
|
470 |
/**
|
471 |
* Get items of the order
|
472 |
*
|
473 |
* @return mixed
|
474 |
*/
|
475 |
public function get_items() {
|
476 |
+
if ( $this->order_items_loaded ) {
|
477 |
+
return $this->order_items_loaded;
|
478 |
+
}
|
479 |
+
|
480 |
$items = $this->_curd->read_items( $this );
|
481 |
|
482 |
+
$this->order_items_loaded = $items;
|
483 |
+
|
484 |
return apply_filters( 'learn-press/order-items', $items );
|
485 |
}
|
486 |
|
675 |
|
676 |
do_action( 'learn-press/added-order-item-data', $order_item_id, $item, $this->get_id() );
|
677 |
} catch ( Throwable $e ) {
|
678 |
+
error_log( __FUNCTION__ . ': ' . $e->getMessage() );
|
679 |
}
|
680 |
|
681 |
return $order_item_id;
|
1369 |
* @version 1.0.0
|
1370 |
*/
|
1371 |
public function check_can_delete_item_old( LP_Course $course ): bool {
|
1372 |
+
/*$user_current = learn_press_get_current_user();
|
1373 |
if ( $user_current instanceof LP_User_Guest ) {
|
1374 |
return false;
|
1375 |
+
}*/
|
1376 |
|
1377 |
$lp_user_items_db = LP_User_Items_DB::getInstance();
|
1378 |
|
@@ -278,8 +278,8 @@ if ( ! class_exists( 'LP_Question_Fill_In_Blanks' ) ) {
|
|
278 |
$question = LP_Question::get_question( $question_id );
|
279 |
$answers = $question->get_answers();
|
280 |
|
281 |
-
foreach ( $answers as $
|
282 |
-
learn_press_delete_question_answer_meta( $
|
283 |
}
|
284 |
}
|
285 |
|
@@ -404,18 +404,18 @@ if ( ! class_exists( 'LP_Question_Fill_In_Blanks' ) ) {
|
|
404 |
$blanks = array();
|
405 |
|
406 |
if ( $answers ) {
|
|
|
|
|
|
|
407 |
foreach ( $answers as $key => $answer ) {
|
408 |
-
|
409 |
-
|
410 |
-
} else {
|
411 |
-
$blanks = $answer->get_meta( '_blanks' );
|
412 |
-
}
|
413 |
|
414 |
$return['blanks'] = array();
|
415 |
$return['answered'] = array();
|
416 |
|
417 |
if ( $blanks ) {
|
418 |
-
$
|
419 |
|
420 |
foreach ( $user_answer as $answer_id => $answer_value ) {
|
421 |
$answer_id = trim( $answer_id );
|
@@ -429,14 +429,15 @@ if ( ! class_exists( 'LP_Question_Fill_In_Blanks' ) ) {
|
|
429 |
$return['answered'][ $answer_id ] = $user_fill;
|
430 |
|
431 |
if ( $blank_correct ) {
|
432 |
-
$
|
433 |
}
|
434 |
}
|
435 |
}
|
436 |
}
|
437 |
|
438 |
-
if (
|
439 |
$return['correct'] = true;
|
|
|
440 |
}
|
441 |
}
|
442 |
}
|
278 |
$question = LP_Question::get_question( $question_id );
|
279 |
$answers = $question->get_answers();
|
280 |
|
281 |
+
foreach ( $answers as $answer ) {
|
282 |
+
learn_press_delete_question_answer_meta( $answer->get_id(), '_blanks', '', true );
|
283 |
}
|
284 |
}
|
285 |
|
404 |
$blanks = array();
|
405 |
|
406 |
if ( $answers ) {
|
407 |
+
/**
|
408 |
+
* @var LP_Question_Answer_Option $answer
|
409 |
+
*/
|
410 |
foreach ( $answers as $key => $answer ) {
|
411 |
+
$blanks = $answer->get_meta( '_blanks' );
|
412 |
+
$total_field_input = count( $blanks );
|
|
|
|
|
|
|
413 |
|
414 |
$return['blanks'] = array();
|
415 |
$return['answered'] = array();
|
416 |
|
417 |
if ( $blanks ) {
|
418 |
+
$total_answer_correct = 0;
|
419 |
|
420 |
foreach ( $user_answer as $answer_id => $answer_value ) {
|
421 |
$answer_id = trim( $answer_id );
|
429 |
$return['answered'][ $answer_id ] = $user_fill;
|
430 |
|
431 |
if ( $blank_correct ) {
|
432 |
+
$total_answer_correct++;
|
433 |
}
|
434 |
}
|
435 |
}
|
436 |
}
|
437 |
|
438 |
+
if ( $total_answer_correct === $total_field_input ) {
|
439 |
$return['correct'] = true;
|
440 |
+
$return['mark'] = $this->get_mark();
|
441 |
}
|
442 |
}
|
443 |
}
|
@@ -206,7 +206,7 @@ if ( ! class_exists( 'LP_Question' ) ) {
|
|
206 |
* @return array|mixed
|
207 |
*/
|
208 |
public function get_mark() {
|
209 |
-
return $this->get_data( 'mark' );
|
210 |
}
|
211 |
|
212 |
/**
|
@@ -314,7 +314,7 @@ if ( ! class_exists( 'LP_Question' ) ) {
|
|
314 |
|
315 |
$options = $this->get_data( 'answer_options' );
|
316 |
|
317 |
-
// Remove key if it
|
318 |
if ( $options && ( $exclude || $map ) ) {
|
319 |
$exclude = array_flip( $exclude );
|
320 |
|
206 |
* @return array|mixed
|
207 |
*/
|
208 |
public function get_mark() {
|
209 |
+
return $this->get_data( 'mark', 1 );
|
210 |
}
|
211 |
|
212 |
/**
|
314 |
|
315 |
$options = $this->get_data( 'answer_options' );
|
316 |
|
317 |
+
// Remove key if it in $exclude.
|
318 |
if ( $options && ( $exclude || $map ) ) {
|
319 |
$exclude = array_flip( $exclude );
|
320 |
|
@@ -231,10 +231,12 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
|
|
231 |
}
|
232 |
|
233 |
/**
|
234 |
-
*
|
|
|
|
|
235 |
*/
|
236 |
-
public function get_review_questions() {
|
237 |
-
return $this->get_data( 'review_questions'
|
238 |
}
|
239 |
|
240 |
/**
|
@@ -248,7 +250,7 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
|
|
248 |
* @return array|mixed
|
249 |
*/
|
250 |
public function get_passing_grade_type() {
|
251 |
-
return $this->get_data( 'passing_grade_type' );
|
252 |
}
|
253 |
|
254 |
/**
|
@@ -263,7 +265,7 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
|
|
263 |
*/
|
264 |
public function get_passing_grade() {
|
265 |
$type = $this->get_passing_grade_type();
|
266 |
-
$value = $this->get_data( 'passing_grade' );
|
267 |
|
268 |
switch ( $type ) {
|
269 |
case 'point':
|
@@ -547,7 +549,6 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
|
|
547 |
* @editor tungnx
|
548 |
* @throws Exception
|
549 |
* @version 1.0.1
|
550 |
-
* @since 3.x.x
|
551 |
* @since 3.2.0
|
552 |
*
|
553 |
*/
|
@@ -1004,12 +1005,12 @@ if ( ! class_exists( 'LP_Quiz' ) ) {
|
|
1004 |
// }
|
1005 |
|
1006 |
/**
|
1007 |
-
*
|
1008 |
*
|
1009 |
* @return bool
|
1010 |
*/
|
1011 |
-
public function get_minus_skip_questions() {
|
1012 |
-
return 'yes' === $this->get_data( 'minus_skip_questions' );
|
1013 |
}
|
1014 |
|
1015 |
/**
|
231 |
}
|
232 |
|
233 |
/**
|
234 |
+
* Enable review quiz
|
235 |
+
*
|
236 |
+
* @return bool
|
237 |
*/
|
238 |
+
public function get_review_questions(): bool {
|
239 |
+
return 'yes' === $this->get_data( 'review_questions', 'yes' );
|
240 |
}
|
241 |
|
242 |
/**
|
250 |
* @return array|mixed
|
251 |
*/
|
252 |
public function get_passing_grade_type() {
|
253 |
+
return $this->get_data( 'passing_grade_type', 'percentage' );
|
254 |
}
|
255 |
|
256 |
/**
|
265 |
*/
|
266 |
public function get_passing_grade() {
|
267 |
$type = $this->get_passing_grade_type();
|
268 |
+
$value = $this->get_data( 'passing_grade', 0 );
|
269 |
|
270 |
switch ( $type ) {
|
271 |
case 'point':
|
549 |
* @editor tungnx
|
550 |
* @throws Exception
|
551 |
* @version 1.0.1
|
|
|
552 |
* @since 3.2.0
|
553 |
*
|
554 |
*/
|
1005 |
// }
|
1006 |
|
1007 |
/**
|
1008 |
+
* Get option skip question will be minus points
|
1009 |
*
|
1010 |
* @return bool
|
1011 |
*/
|
1012 |
+
public function get_minus_skip_questions(): bool {
|
1013 |
+
return 'yes' === $this->get_data( 'minus_skip_questions', 'no' );
|
1014 |
}
|
1015 |
|
1016 |
/**
|
@@ -44,7 +44,7 @@ class LP_REST_Admin_Course_Controller extends LP_Abstract_REST_Controller {
|
|
44 |
*/
|
45 |
public function get_final_quiz( WP_REST_Request $request ) {
|
46 |
$params = $request->get_params();
|
47 |
-
$course_id =
|
48 |
$response = new LP_REST_Response();
|
49 |
$response->data = '';
|
50 |
$final_quiz = '';
|
44 |
*/
|
45 |
public function get_final_quiz( WP_REST_Request $request ) {
|
46 |
$params = $request->get_params();
|
47 |
+
$course_id = $params['courseId'] ?? false;
|
48 |
$response = new LP_REST_Response();
|
49 |
$response->data = '';
|
50 |
$final_quiz = '';
|
@@ -47,33 +47,37 @@ class LP_REST_Lazy_Load_Controller extends LP_Abstract_REST_Controller {
|
|
47 |
*/
|
48 |
public function items_progress( $request ) {
|
49 |
$params = $request->get_params();
|
50 |
-
$course_id = $params['courseId'] ??
|
51 |
-
$user_id =
|
52 |
$response = new LP_REST_Response();
|
53 |
$response->data = '';
|
54 |
|
55 |
try {
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
59 |
|
60 |
-
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
throw new Exception( $check['message'] );
|
64 |
-
}
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
'course' => $course,
|
71 |
-
'user' => $user,
|
72 |
-
)
|
73 |
-
);
|
74 |
-
} else {
|
75 |
-
throw new Exception( esc_html__( 'Error: Cannot get course ID or user ID', 'learnpress' ) );
|
76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
} catch ( Exception $e ) {
|
78 |
$response->message = $e->getMessage();
|
79 |
}
|
@@ -84,34 +88,49 @@ class LP_REST_Lazy_Load_Controller extends LP_Abstract_REST_Controller {
|
|
84 |
/**
|
85 |
* Load user_progress in single course.
|
86 |
*
|
87 |
-
* @
|
88 |
*
|
89 |
-
* @return
|
|
|
|
|
|
|
|
|
90 |
*/
|
91 |
-
public function user_progress( $request ) {
|
92 |
$params = $request->get_params();
|
93 |
-
$course_id =
|
94 |
-
$user_id =
|
95 |
$response = new LP_REST_Response();
|
96 |
$response->data = '';
|
97 |
|
98 |
if ( $course_id && $user_id ) {
|
99 |
$course = learn_press_get_course( $course_id );
|
100 |
-
|
|
|
|
|
|
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
$response->
|
105 |
-
|
106 |
-
array(
|
107 |
-
'course' => $course,
|
108 |
-
'user' => $user,
|
109 |
-
)
|
110 |
-
);
|
111 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
|
114 |
-
return
|
115 |
}
|
116 |
|
117 |
/**
|
47 |
*/
|
48 |
public function items_progress( $request ) {
|
49 |
$params = $request->get_params();
|
50 |
+
$course_id = $params['courseId'] ?? 0;
|
51 |
+
$user_id = get_current_user_id();
|
52 |
$response = new LP_REST_Response();
|
53 |
$response->data = '';
|
54 |
|
55 |
try {
|
56 |
+
$course = learn_press_get_course( $course_id );
|
57 |
+
if ( ! $course ) {
|
58 |
+
throw new Exception( esc_html__( 'Course is invalid!', 'learnpress' ) );
|
59 |
+
}
|
60 |
|
61 |
+
if ( $course->is_no_required_enroll() ) {
|
62 |
+
throw new Exception( esc_html__( 'Course is no require enroll!', 'learnpress' ) );
|
63 |
+
}
|
64 |
|
65 |
+
$user = learn_press_get_user( $user_id );
|
|
|
|
|
66 |
|
67 |
+
$check = $user->can_show_finish_course_btn( $course );
|
68 |
+
|
69 |
+
if ( $check['status'] !== 'success' ) {
|
70 |
+
throw new Exception( $check['message'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
+
|
73 |
+
$response->status = 'success';
|
74 |
+
$response->data = learn_press_get_template_content(
|
75 |
+
'single-course/buttons/finish.php',
|
76 |
+
array(
|
77 |
+
'course' => $course,
|
78 |
+
'user' => $user,
|
79 |
+
)
|
80 |
+
);
|
81 |
} catch ( Exception $e ) {
|
82 |
$response->message = $e->getMessage();
|
83 |
}
|
88 |
/**
|
89 |
* Load user_progress in single course.
|
90 |
*
|
91 |
+
* @param WP_REST_Request $request
|
92 |
*
|
93 |
+
* @return LP_REST_Response
|
94 |
+
* @author Nhamdv <email@email.com>
|
95 |
+
* @editor tungnx
|
96 |
+
* @version 1.0.1
|
97 |
+
* @sicne 4.0.0
|
98 |
*/
|
99 |
+
public function user_progress( WP_REST_Request $request ): LP_REST_Response {
|
100 |
$params = $request->get_params();
|
101 |
+
$course_id = $params['courseId'] ?? false;
|
102 |
+
$user_id = $params['userId'] ?? false;
|
103 |
$response = new LP_REST_Response();
|
104 |
$response->data = '';
|
105 |
|
106 |
if ( $course_id && $user_id ) {
|
107 |
$course = learn_press_get_course( $course_id );
|
108 |
+
if ( ! $course ) {
|
109 |
+
$response->message = __( 'Course is invalid', 'learnpress' );
|
110 |
+
return $response;
|
111 |
+
}
|
112 |
|
113 |
+
$user = learn_press_get_user( $user_id );
|
114 |
+
if ( $user->is_guest() ) {
|
115 |
+
$response->message = __( 'You are Guest', 'learnpress' );
|
116 |
+
return $response;
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
+
|
119 |
+
$course_data = $user->get_course_data( $course->get_id() );
|
120 |
+
if ( ! $course_data ) {
|
121 |
+
return $response;
|
122 |
+
}
|
123 |
+
|
124 |
+
$course_results = $course_data->calculate_course_results();
|
125 |
+
|
126 |
+
$response->status = 'success';
|
127 |
+
$response->data = learn_press_get_template_content(
|
128 |
+
'single-course/sidebar/user-progress',
|
129 |
+
compact( 'user', 'course', 'course_data', 'course_results' )
|
130 |
+
);
|
131 |
}
|
132 |
|
133 |
+
return $response;
|
134 |
}
|
135 |
|
136 |
/**
|
@@ -36,7 +36,8 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
36 |
$this->rest_base = 'users';
|
37 |
parent::__construct();
|
38 |
|
39 |
-
|
|
|
40 |
}
|
41 |
|
42 |
/**
|
@@ -47,8 +48,10 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
47 |
* @param WP_REST_Request $request
|
48 |
*
|
49 |
* @return mixed
|
|
|
|
|
50 |
*/
|
51 |
-
public function rest_pre_dispatch( $null, $server, $request ) {
|
52 |
$user_id = get_current_user_id();
|
53 |
$item_id = $request['item_id'] ?? 0;
|
54 |
$course_id = $request['course_id'] ?? 0;
|
@@ -69,7 +72,7 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
69 |
}
|
70 |
|
71 |
return $null;
|
72 |
-
}
|
73 |
|
74 |
/**
|
75 |
* Register rest routes.
|
@@ -128,7 +131,8 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
128 |
'submit-quiz' => array(
|
129 |
array(
|
130 |
'methods' => WP_REST_Server::EDITABLE,
|
131 |
-
'callback'
|
|
|
132 |
// 'permission_callback' => array( $this, 'check_admin_permission' ),
|
133 |
'permission_callback' => '__return_true',
|
134 |
'args' => $this->get_item_endpoint_args(),
|
@@ -242,45 +246,69 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
242 |
/**
|
243 |
* User starts a quiz.
|
244 |
*
|
245 |
-
* @throws
|
246 |
-
*
|
247 |
* @param WP_REST_Request $request
|
248 |
*
|
|
|
|
|
|
|
249 |
* @return WP_REST_Response
|
250 |
*/
|
251 |
public function start_quiz( WP_REST_Request $request ): WP_REST_Response {
|
252 |
$user_id = get_current_user_id();
|
253 |
-
$item_id = $request['item_id'];
|
254 |
-
$course_id = $request['course_id'];
|
255 |
-
$
|
256 |
-
|
257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
|
|
|
|
263 |
}
|
264 |
-
$no_required_enroll = new LP_Course_No_Required_Enroll();
|
265 |
-
$response = $no_required_enroll->guest_start_quiz( $course_id, $item_id );
|
266 |
|
267 |
-
|
268 |
-
|
|
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
|
|
|
|
275 |
|
276 |
-
|
|
|
277 |
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
|
283 |
-
if ( $success ) {
|
284 |
/**
|
285 |
* Clear cache result quiz
|
286 |
* Cache set on @see LP_User_Item_Quiz::get_results
|
@@ -290,63 +318,39 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
290 |
$lp_quiz_cache->clear( $key_cache );
|
291 |
// End
|
292 |
|
293 |
-
$
|
294 |
-
$course = LP_Course::get_course( $course_id );
|
295 |
-
$quiz = LP_Quiz::get_quiz( $item_id );
|
296 |
-
$show_hint = $quiz->get_show_hint();
|
297 |
-
$show_check = $quiz->get_show_check_answer();
|
298 |
$duration = $quiz->get_duration();
|
299 |
$show_correct_review = $quiz->get_show_correct_review();
|
300 |
-
|
301 |
-
$status
|
302 |
-
$checked_questions
|
303 |
-
$hinted_questions
|
304 |
-
$
|
305 |
-
|
306 |
-
$question_ids = $quiz_results->getQuestions( 'ids' );
|
307 |
-
$answered = $quiz_results->getAnswered();
|
308 |
-
|
309 |
-
$expiration_time = $user_quiz->get_expiration_time();
|
310 |
-
|
311 |
-
if ( $expiration_time && ! $expiration_time->is_null() ) {
|
312 |
-
$total_time = strtotime( $user_quiz->get_expiration_time() ) - strtotime( $user_quiz->get_start_time() );
|
313 |
-
}
|
314 |
|
315 |
$questions = learn_press_rest_prepare_user_questions(
|
316 |
$question_ids,
|
317 |
array(
|
318 |
-
'instant_hint' => $show_hint,
|
319 |
'instant_check' => $show_check,
|
320 |
'quiz_status' => $status,
|
321 |
'checked_questions' => $checked_questions,
|
322 |
'hinted_questions' => $hinted_questions,
|
323 |
-
'answered' =>
|
324 |
'show_correct_review' => $show_correct_review,
|
325 |
)
|
326 |
);
|
327 |
|
328 |
-
$results =
|
329 |
-
|
330 |
-
|
331 |
-
);
|
332 |
-
|
333 |
-
|
334 |
-
if ( isset( $total_time ) ) {
|
335 |
-
$expiration = $expiration_time->toSql( false );
|
336 |
-
$results['total_time'] = $total_time;
|
337 |
-
$results['end_time'] = $expiration;
|
338 |
-
}
|
339 |
-
|
340 |
-
$results['duration'] = $duration ? $duration->get() : false;
|
341 |
-
$results['answered'] = $quiz_results->getQuestions();
|
342 |
-
$results['status'] = $quiz_results->get( 'status' );
|
343 |
-
$results['results'] = $quiz_results->get();
|
344 |
-
$results['retaken'] = absint( $user_quiz->get_retaken_count() );
|
345 |
-
|
346 |
$results['attempts'] = $user_quiz->get_attempts();
|
347 |
$results['user_item_id'] = $user_quiz->get_user_item_id();
|
348 |
-
|
349 |
-
$response['results']
|
|
|
|
|
350 |
}
|
351 |
|
352 |
return rest_ensure_response( $response );
|
@@ -358,7 +362,7 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
358 |
*
|
359 |
* @return mixed|WP_REST_Response
|
360 |
*/
|
361 |
-
public function
|
362 |
$user_id = get_current_user_id();
|
363 |
$item_id = $request['item_id'];
|
364 |
$course_id = $request['course_id'];
|
@@ -460,6 +464,119 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
460 |
|
461 |
}
|
462 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
return rest_ensure_response( $response );
|
464 |
}
|
465 |
|
@@ -483,53 +600,50 @@ class LP_REST_Users_Controller extends LP_Abstract_REST_Controller {
|
|
483 |
}
|
484 |
|
485 |
public function check_answer( $request ) {
|
486 |
-
$
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
$course = learn_press_get_course( $course_id );
|
491 |
-
$checked = false;
|
492 |
|
493 |
-
|
494 |
-
$
|
495 |
-
$
|
496 |
-
|
497 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
|
499 |
-
if ( $user ) {
|
500 |
$user_course = $user->get_course_data( $course_id );
|
|
|
|
|
|
|
501 |
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
}
|
|
|
|
|
506 |
}
|
507 |
-
}
|
508 |
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
)
|
517 |
-
)
|
518 |
-
);
|
519 |
}
|
520 |
|
521 |
-
$question = learn_press_get_question( $question_id );
|
522 |
-
$response = array(
|
523 |
-
'explanation' => $question->get_explanation(),
|
524 |
-
'options' => learn_press_get_question_options_for_js(
|
525 |
-
$question,
|
526 |
-
array(
|
527 |
-
'include_is_true' => true,
|
528 |
-
'answer' => $answered,
|
529 |
-
)
|
530 |
-
),
|
531 |
-
'result' => $checked,
|
532 |
-
);
|
533 |
return rest_ensure_response( $response );
|
534 |
}
|
535 |
|
36 |
$this->rest_base = 'users';
|
37 |
parent::__construct();
|
38 |
|
39 |
+
// tungnx - 4.1.4.1 - comment - not use - run wrong
|
40 |
+
// add_filter( 'rest_pre_dispatch', array( $this, 'rest_pre_dispatch' ), 10, 3 );
|
41 |
}
|
42 |
|
43 |
/**
|
48 |
* @param WP_REST_Request $request
|
49 |
*
|
50 |
* @return mixed
|
51 |
+
* @editor tungnx
|
52 |
+
* @modify 4.1.4.1 - comment - not use - run wrong
|
53 |
*/
|
54 |
+
/*public function rest_pre_dispatch( $null, $server, $request ) {
|
55 |
$user_id = get_current_user_id();
|
56 |
$item_id = $request['item_id'] ?? 0;
|
57 |
$course_id = $request['course_id'] ?? 0;
|
72 |
}
|
73 |
|
74 |
return $null;
|
75 |
+
}*/
|
76 |
|
77 |
/**
|
78 |
* Register rest routes.
|
131 |
'submit-quiz' => array(
|
132 |
array(
|
133 |
'methods' => WP_REST_Server::EDITABLE,
|
134 |
+
// 'callback' => array( $this, 'submit_quiz' ),
|
135 |
+
'callback' => array( $this, 'submit_quiz_new' ),
|
136 |
// 'permission_callback' => array( $this, 'check_admin_permission' ),
|
137 |
'permission_callback' => '__return_true',
|
138 |
'args' => $this->get_item_endpoint_args(),
|
246 |
/**
|
247 |
* User starts a quiz.
|
248 |
*
|
|
|
|
|
249 |
* @param WP_REST_Request $request
|
250 |
*
|
251 |
+
* @editor tungnx
|
252 |
+
* @version 1.0.1
|
253 |
+
* @sicne 4.0.0
|
254 |
* @return WP_REST_Response
|
255 |
*/
|
256 |
public function start_quiz( WP_REST_Request $request ): WP_REST_Response {
|
257 |
$user_id = get_current_user_id();
|
258 |
+
$item_id = $request['item_id'] ?? 0;
|
259 |
+
$course_id = $request['course_id'] ?? 0;
|
260 |
+
$results = array(
|
261 |
+
'question_ids' => array(),
|
262 |
+
'questions' => array(),
|
263 |
+
'total_time' => 0,
|
264 |
+
);
|
265 |
+
$response = array(
|
266 |
+
'status' => 'error',
|
267 |
+
'message' => '',
|
268 |
+
);
|
269 |
|
270 |
+
try {
|
271 |
+
$user = learn_press_get_user( $user_id );
|
272 |
+
$course = learn_press_get_course( $course_id );
|
273 |
+
$quiz = learn_press_get_quiz( $item_id );
|
274 |
+
|
275 |
+
if ( ! $course ) {
|
276 |
+
throw new Exception( __( 'Course is invalid!', 'learnpress' ) );
|
277 |
}
|
|
|
|
|
278 |
|
279 |
+
if ( ! $quiz ) {
|
280 |
+
throw new Exception( __( 'Quiz is invalid!', 'learnpress' ) );
|
281 |
+
}
|
282 |
|
283 |
+
// For no required enroll course
|
284 |
+
if ( $user->is_guest() && $course->is_no_required_enroll() ) {
|
285 |
+
if ( $quiz->get_retake_count() >= 0 ) {
|
286 |
+
//learn_press_remove_cookie( 'quiz_submit_status_' . $course_id . '_' . $item_id . '' );
|
287 |
+
}
|
288 |
+
$no_required_enroll = new LP_Course_No_Required_Enroll( $course );
|
289 |
+
$response = $no_required_enroll->guest_start_quiz( $quiz );
|
290 |
|
291 |
+
return rest_ensure_response( $response );
|
292 |
+
}
|
293 |
|
294 |
+
// Require enroll course
|
295 |
+
if ( $user->has_started_quiz( $item_id, $course_id ) ) {
|
296 |
+
/**
|
297 |
+
* @var LP_User_Item_Quiz $user_quiz
|
298 |
+
*/
|
299 |
+
$user_quiz = $user->retake_quiz( $item_id, $course_id, true );
|
300 |
+
$results['answered'] = []; // Reset answered before on js
|
301 |
+
} else {
|
302 |
+
/**
|
303 |
+
* @var LP_User_Item_Quiz $user_quiz
|
304 |
+
*/
|
305 |
+
$user_quiz = $user->start_quiz( $item_id, $course_id, true );
|
306 |
+
}
|
307 |
+
|
308 |
+
if ( is_wp_error( $user_quiz ) ) {
|
309 |
+
throw new Exception( $user_quiz->get_error_message() );
|
310 |
+
}
|
311 |
|
|
|
312 |
/**
|
313 |
* Clear cache result quiz
|
314 |
* Cache set on @see LP_User_Item_Quiz::get_results
|
318 |
$lp_quiz_cache->clear( $key_cache );
|
319 |
// End
|
320 |
|
321 |
+
$show_check = $quiz->get_instant_check();
|
|
|
|
|
|
|
|
|
322 |
$duration = $quiz->get_duration();
|
323 |
$show_correct_review = $quiz->get_show_correct_review();
|
324 |
+
$question_ids = $quiz->get_question_ids();
|
325 |
+
$status = $user_quiz->get_status();
|
326 |
+
$checked_questions = $user_quiz->get_checked_questions();
|
327 |
+
$hinted_questions = $user_quiz->get_hint_questions();
|
328 |
+
$time_remaining = $user_quiz->get_timestamp_remaining();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
|
330 |
$questions = learn_press_rest_prepare_user_questions(
|
331 |
$question_ids,
|
332 |
array(
|
|
|
333 |
'instant_check' => $show_check,
|
334 |
'quiz_status' => $status,
|
335 |
'checked_questions' => $checked_questions,
|
336 |
'hinted_questions' => $hinted_questions,
|
337 |
+
'answered' => [],
|
338 |
'show_correct_review' => $show_correct_review,
|
339 |
)
|
340 |
);
|
341 |
|
342 |
+
$results['question_ids'] = $question_ids;
|
343 |
+
$results['questions'] = $questions;
|
344 |
+
$results['total_time'] = $time_remaining;
|
345 |
+
$results['duration'] = $duration ? $duration->get() : false;
|
346 |
+
$results['status'] = $status; // Must be started
|
347 |
+
$results['retaken'] = absint( $user_quiz->get_retaken_count() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
$results['attempts'] = $user_quiz->get_attempts();
|
349 |
$results['user_item_id'] = $user_quiz->get_user_item_id();
|
350 |
+
$response['status'] = 'success';
|
351 |
+
$response['results'] = $results;
|
352 |
+
} catch ( Throwable $e ) {
|
353 |
+
$response['message'] = $e->getMessage();
|
354 |
}
|
355 |
|
356 |
return rest_ensure_response( $response );
|
362 |
*
|
363 |
* @return mixed|WP_REST_Response
|
364 |
*/
|
365 |
+
/*public function submit_quiz_bk( $request ) {
|
366 |
$user_id = get_current_user_id();
|
367 |
$item_id = $request['item_id'];
|
368 |
$course_id = $request['course_id'];
|
464 |
|
465 |
}
|
466 |
}
|
467 |
+
return rest_ensure_response( $response );
|
468 |
+
}*/
|
469 |
+
|
470 |
+
/**
|
471 |
+
* Submit quiz answer
|
472 |
+
*
|
473 |
+
* @param WP_REST_Request $request
|
474 |
+
*
|
475 |
+
* @return mixed|WP_REST_Response
|
476 |
+
* @editor tungnx
|
477 |
+
* @modify 4.1.4.1
|
478 |
+
* @version 1.0.1
|
479 |
+
*/
|
480 |
+
public function submit_quiz_new( WP_REST_Request $request ) {
|
481 |
+
//$response = new LP_REST_Response();
|
482 |
+
$response = array(
|
483 |
+
'status' => 'error',
|
484 |
+
'message' => '',
|
485 |
+
);
|
486 |
+
|
487 |
+
try {
|
488 |
+
$user_id = get_current_user_id();
|
489 |
+
$item_id = $request['item_id'] ?? 0;
|
490 |
+
$course_id = $request['course_id'] ?? 0;
|
491 |
+
$answered = $request['answered'] ?? [];
|
492 |
+
$time_spend = $request['time_spend'] ?? 0;
|
493 |
+
$user = learn_press_get_user( $user_id );
|
494 |
+
$course = learn_press_get_course( $course_id );
|
495 |
+
|
496 |
+
if ( ! $course ) {
|
497 |
+
throw new Exception( 'Course is invalid!' );
|
498 |
+
}
|
499 |
+
|
500 |
+
// Course is no required enroll
|
501 |
+
if ( $course->is_no_required_enroll() ) {
|
502 |
+
$no_required_enroll = new LP_Course_No_Required_Enroll( $course );
|
503 |
+
|
504 |
+
// Use for Review Quiz.
|
505 |
+
$quiz = learn_press_get_quiz( $item_id );
|
506 |
+
|
507 |
+
if ( ! $quiz ) {
|
508 |
+
throw new Exception( __( 'Quiz is invalid!', 'learnpress' ) );
|
509 |
+
}
|
510 |
+
|
511 |
+
$result = $no_required_enroll->get_result_quiz( $quiz, $answered );
|
512 |
+
|
513 |
+
// Set time spent
|
514 |
+
$interval = new LP_Duration( $time_spend );
|
515 |
+
$interval = $interval->to_timer();
|
516 |
+
$result['time_spend'] = $interval;
|
517 |
+
// End
|
518 |
+
|
519 |
+
$result['status'] = LP_ITEM_COMPLETED;
|
520 |
+
//$result['answered'] = $result['questions'];
|
521 |
+
$result['attempts'] = [];
|
522 |
+
$result['results'] = $result;
|
523 |
+
$response['status'] = 'success';
|
524 |
+
$response['results'] = $result;
|
525 |
+
|
526 |
+
//learn_press_setcookie( 'quiz_submit_status_' . $course_id . '_' . $item_id . '', 'completed', time() + ( 7 * DAY_IN_SECONDS ), false );
|
527 |
+
|
528 |
+
return rest_ensure_response( $response );
|
529 |
+
}
|
530 |
+
|
531 |
+
$user_course = $user->get_course_data( $course_id );
|
532 |
+
|
533 |
+
// Course required enroll
|
534 |
+
if ( ! $user_course ) {
|
535 |
+
throw new Exception( 'User not enrolled course!' );
|
536 |
+
}
|
537 |
+
|
538 |
+
$user_quiz = $user_course->get_item( $item_id );
|
539 |
+
|
540 |
+
if ( ! $user_quiz ) {
|
541 |
+
throw new Exception();
|
542 |
+
}
|
543 |
+
|
544 |
+
$end_time = gmdate( 'Y-m-d H:i:s', strtotime( $user_quiz->get_start_time( 'mysql' ) . " + $time_spend second" ) );
|
545 |
+
$user_quiz->set_end_time( $end_time );
|
546 |
+
|
547 |
+
// For case save result when check instant answer
|
548 |
+
$result_instant_check = LP_User_Items_Result_DB::instance()->get_result( $user_quiz->get_user_item_id() );
|
549 |
+
if ( $result_instant_check ) {
|
550 |
+
foreach ( $result_instant_check['questions'] as $question_answer_id => $question_answer ) {
|
551 |
+
if ( ! empty( $question_answer['answered'] ) ) {
|
552 |
+
$answered[ $question_answer_id ] = $question_answer['answered'];
|
553 |
+
}
|
554 |
+
}
|
555 |
+
}
|
556 |
+
|
557 |
+
// Calculate quiz result and save
|
558 |
+
$result = $user_quiz->calculate_quiz_result( $answered );
|
559 |
+
// Save
|
560 |
+
LP_User_Items_Result_DB::instance()->update( $user_quiz->get_user_item_id(), wp_json_encode( $result ) );
|
561 |
+
|
562 |
+
if ( $result['pass'] ) {
|
563 |
+
$user_quiz->set_graduation( LP_COURSE_GRADUATION_PASSED );
|
564 |
+
} else {
|
565 |
+
$user_quiz->set_graduation( LP_COURSE_GRADUATION_FAILED );
|
566 |
+
}
|
567 |
+
|
568 |
+
$user_quiz->complete();
|
569 |
+
|
570 |
+
$result['status'] = $user_quiz->get_status(); // Must be completed
|
571 |
+
$result['attempts'] = $user_quiz->get_attempts();
|
572 |
+
$result['answered'] = $result['questions'];
|
573 |
+
$result['results'] = $result;
|
574 |
+
$response['status'] = 'success';
|
575 |
+
$response['results'] = $result;
|
576 |
+
} catch ( Throwable $e ) {
|
577 |
+
$response['message'] = $e->getMessage();
|
578 |
+
}
|
579 |
+
|
580 |
return rest_ensure_response( $response );
|
581 |
}
|
582 |
|
600 |
}
|
601 |
|
602 |
public function check_answer( $request ) {
|
603 |
+
$response = array(
|
604 |
+
'status' => 'error',
|
605 |
+
'message' => '',
|
606 |
+
);
|
|
|
|
|
607 |
|
608 |
+
try {
|
609 |
+
$question_id = $request['question_id'] ?? 0;
|
610 |
+
$answered = $request['answered'] ?? '';
|
611 |
+
$course_id = $request['course_id'] ?? 0;
|
612 |
+
$quiz_id = $request['item_id'] ?? 0;
|
613 |
+
$course = learn_press_get_course( $course_id );
|
614 |
+
$checked = [];
|
615 |
+
|
616 |
+
if ( $course->is_no_required_enroll() ) {
|
617 |
+
$no_required_enroll = new LP_Course_No_Required_Enroll( $course );
|
618 |
+
$checked = $no_required_enroll->guest_check_question( $question_id, $answered );
|
619 |
+
} else {
|
620 |
+
$user = learn_press_get_current_user();
|
621 |
+
if ( $user->is_guest() ) {
|
622 |
+
throw new Exception( 'User is invalid!', 'learnrpess' );
|
623 |
+
}
|
624 |
|
|
|
625 |
$user_course = $user->get_course_data( $course_id );
|
626 |
+
if ( ! $user_course ) {
|
627 |
+
throw new Exception( 'User\'s course no data!', 'learnrpess' );
|
628 |
+
}
|
629 |
|
630 |
+
$user_quiz = $user_course->get_item( $quiz_id );
|
631 |
+
if ( ! $user_quiz ) {
|
632 |
+
throw new Exception( 'User\'s quiz no data!', 'learnrpess' );
|
633 |
}
|
634 |
+
|
635 |
+
$checked = $user_quiz->instant_check_question( $question_id, $answered );
|
636 |
}
|
|
|
637 |
|
638 |
+
$question = learn_press_get_question( $question_id );
|
639 |
+
$response['explanation'] = $question->get_explanation();
|
640 |
+
$response['options'] = learn_press_get_question_options_for_js( $question, array( 'answer' => $answered ) );
|
641 |
+
$response['result'] = $checked;
|
642 |
+
$response['status'] = 'success';
|
643 |
+
} catch ( Throwable $e ) {
|
644 |
+
$response['message'] = $e->getMessage();
|
|
|
|
|
|
|
645 |
}
|
646 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
return rest_ensure_response( $response );
|
648 |
}
|
649 |
|
@@ -50,7 +50,7 @@ if ( ! class_exists( 'LP_Shortcode_Button_Course' ) ) {
|
|
50 |
|
51 |
$atts = $this->_atts;
|
52 |
|
53 |
-
if ( '
|
54 |
$course_id = learn_press_is_course() ? get_the_ID() : 0;
|
55 |
} else {
|
56 |
$course_id = $atts['id'];
|
50 |
|
51 |
$atts = $this->_atts;
|
52 |
|
53 |
+
if ( 'current' === $atts['id'] ) {
|
54 |
$course_id = learn_press_is_course() ? get_the_ID() : 0;
|
55 |
} else {
|
56 |
$course_id = $atts['id'];
|
@@ -50,7 +50,7 @@ if ( ! class_exists( 'LP_Shortcode_Button_Enroll' ) ) {
|
|
50 |
|
51 |
$atts = $this->_atts;
|
52 |
|
53 |
-
if ( '
|
54 |
$course_id = learn_press_is_course() ? get_the_ID() : 0;
|
55 |
} else {
|
56 |
$course_id = $atts['id'];
|
50 |
|
51 |
$atts = $this->_atts;
|
52 |
|
53 |
+
if ( 'current' === $atts['id'] ) {
|
54 |
$course_id = learn_press_is_course() ? get_the_ID() : 0;
|
55 |
} else {
|
56 |
$course_id = $atts['id'];
|
@@ -50,7 +50,7 @@ if ( ! class_exists( 'LP_Shortcode_Button_Purchase' ) ) {
|
|
50 |
|
51 |
$atts = $this->_atts;
|
52 |
|
53 |
-
if ( '
|
54 |
$course_id = learn_press_is_course() ? get_the_ID() : 0;
|
55 |
} else {
|
56 |
$course_id = $atts['id'];
|
@@ -58,10 +58,14 @@ if ( ! class_exists( 'LP_Shortcode_Button_Purchase' ) ) {
|
|
58 |
|
59 |
$course = learn_press_get_course( $course_id );
|
60 |
|
61 |
-
if ( $course_id && $course ) {
|
62 |
LP_Global::set_course( $course );
|
63 |
global $post;
|
|
|
64 |
|
|
|
|
|
|
|
65 |
$post = get_post( $course_id );
|
66 |
|
67 |
setup_postdata( $post );
|
50 |
|
51 |
$atts = $this->_atts;
|
52 |
|
53 |
+
if ( 'current' === $atts['id'] ) {
|
54 |
$course_id = learn_press_is_course() ? get_the_ID() : 0;
|
55 |
} else {
|
56 |
$course_id = $atts['id'];
|
58 |
|
59 |
$course = learn_press_get_course( $course_id );
|
60 |
|
61 |
+
if ( $course_id && $course && ! $course->is_free() ) {
|
62 |
LP_Global::set_course( $course );
|
63 |
global $post;
|
64 |
+
$enqueued = wp_script_is( 'lp-single-course', 'enqueued' );
|
65 |
|
66 |
+
if ( ! $enqueued ) {
|
67 |
+
wp_enqueue_script( 'lp-single-course' );
|
68 |
+
}
|
69 |
$post = get_post( $course_id );
|
70 |
|
71 |
setup_postdata( $post );
|
@@ -33,7 +33,9 @@ if ( ! class_exists( 'LP_Shortcode_Profile' ) ) {
|
|
33 |
$current_user = learn_press_get_current_user();
|
34 |
$viewing_user = true;
|
35 |
|
36 |
-
if (
|
|
|
|
|
37 |
$viewing_user = $current_user;
|
38 |
} else {
|
39 |
$wp_user = get_user_by( 'login', urldecode( $wp->query_vars['user'] ) );
|
33 |
$current_user = learn_press_get_current_user();
|
34 |
$viewing_user = true;
|
35 |
|
36 |
+
if ( current_user_can( ADMIN_ROLE ) ) {
|
37 |
+
$viewing_user = true;
|
38 |
+
} elseif ( empty( $wp->query_vars['user'] ) ) {
|
39 |
$viewing_user = $current_user;
|
40 |
} else {
|
41 |
$wp_user = get_user_by( 'login', urldecode( $wp->query_vars['user'] ) );
|
@@ -207,18 +207,9 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
207 |
throw new Exception( 'User or Course is not exists' );
|
208 |
}
|
209 |
|
210 |
-
if ( $course->get_external_link() ) {
|
211 |
-
throw new Exception( 'Course is type external, so can not purchase' );
|
212 |
-
}
|
213 |
-
|
214 |
if ( ! $user->can_purchase_course( $course->get_id() ) ) {
|
215 |
throw new Exception( 'You can not purchase course' );
|
216 |
}
|
217 |
-
|
218 |
-
// Course is not require enrolling.
|
219 |
-
if ( $course->is_no_required_enroll() ) {
|
220 |
-
throw new Exception( 'Course is type no required enroll' );
|
221 |
-
}
|
222 |
} catch ( Throwable $e ) {
|
223 |
$can_show = false;
|
224 |
}
|
@@ -451,8 +442,10 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
451 |
* @param LP_User|LP_User_Guest $user
|
452 |
*
|
453 |
* @return array
|
|
|
|
|
454 |
*/
|
455 |
-
public function can_show_finish_course_btn( $course, $user ): array {
|
456 |
$return = [
|
457 |
'flag' => false,
|
458 |
'message' => '',
|
@@ -475,7 +468,8 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
475 |
throw new Exception( esc_html__( 'Error: Course is not in-progress.', 'learnpress' ) );
|
476 |
}
|
477 |
|
478 |
-
|
|
|
479 |
$is_passed = $user->has_reached_passing_condition( $course_id );
|
480 |
|
481 |
if ( ! $is_passed && $has_finish === 'no' ) {
|
@@ -483,11 +477,11 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
483 |
}
|
484 |
|
485 |
if ( $course_data ) {
|
486 |
-
$
|
487 |
|
488 |
$is_all_completed = $user->is_completed_all_items( $course_id );
|
489 |
|
490 |
-
if ( ! $is_all_completed && $has_finish === 'yes' && ! $
|
491 |
throw new Exception( esc_html__( 'Error: Cannot finish course.', 'learnpress' ) );
|
492 |
}
|
493 |
}
|
@@ -502,7 +496,7 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
502 |
}
|
503 |
|
504 |
return $return;
|
505 |
-
}
|
506 |
|
507 |
public function course_finish_button() {
|
508 |
$user = LP_Global::user();
|
@@ -513,9 +507,9 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
513 |
return;
|
514 |
}
|
515 |
|
516 |
-
$check = $
|
517 |
|
518 |
-
if (
|
519 |
return;
|
520 |
}
|
521 |
|
@@ -560,7 +554,24 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
560 |
}
|
561 |
|
562 |
public function popup_header() {
|
563 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
}
|
565 |
|
566 |
public function popup_sidebar() {
|
@@ -803,6 +814,13 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
803 |
|
804 |
}
|
805 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
806 |
public function count_object() {
|
807 |
$course = learn_press_get_course();
|
808 |
|
@@ -810,15 +828,12 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
810 |
return;
|
811 |
}
|
812 |
|
813 |
-
$lessons
|
814 |
-
$quizzes
|
815 |
-
|
816 |
-
$lessons = count( $lessons );
|
817 |
-
$quizzes = count( $quizzes );
|
818 |
$students = $course->count_students();
|
819 |
|
820 |
$counts = apply_filters(
|
821 |
-
'
|
822 |
array(
|
823 |
'lesson' => sprintf(
|
824 |
'<span class="meta-number">' . _n( '%d lesson', '%d lessons', $lessons, 'learnpress' ) . '</span>',
|
@@ -1045,7 +1060,7 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
1045 |
$course = LP_Global::course();
|
1046 |
$user = LP_Global::user();
|
1047 |
|
1048 |
-
if ( ! $course
|
1049 |
return;
|
1050 |
}
|
1051 |
|
@@ -1058,12 +1073,16 @@ class LP_Template_Course extends LP_Abstract_Template {
|
|
1058 |
echo lp_skeleton_animation_html( 3 );
|
1059 |
echo '</div>';
|
1060 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1061 |
learn_press_get_template(
|
1062 |
'single-course/sidebar/user-progress',
|
1063 |
-
|
1064 |
-
'course' => $course,
|
1065 |
-
'user' => $user,
|
1066 |
-
)
|
1067 |
);
|
1068 |
}
|
1069 |
}
|
207 |
throw new Exception( 'User or Course is not exists' );
|
208 |
}
|
209 |
|
|
|
|
|
|
|
|
|
210 |
if ( ! $user->can_purchase_course( $course->get_id() ) ) {
|
211 |
throw new Exception( 'You can not purchase course' );
|
212 |
}
|
|
|
|
|
|
|
|
|
|
|
213 |
} catch ( Throwable $e ) {
|
214 |
$can_show = false;
|
215 |
}
|
442 |
* @param LP_User|LP_User_Guest $user
|
443 |
*
|
444 |
* @return array
|
445 |
+
* @editor tungnx
|
446 |
+
* @modify 4.1.4.1 - comment - not use - replace on function can_show_finish_course_btn on LP_User
|
447 |
*/
|
448 |
+
/*public function can_show_finish_course_btn( $course, $user ): array {
|
449 |
$return = [
|
450 |
'flag' => false,
|
451 |
'message' => '',
|
468 |
throw new Exception( esc_html__( 'Error: Course is not in-progress.', 'learnpress' ) );
|
469 |
}
|
470 |
|
471 |
+
// Get option Allow show finish button when the student has completed all items but has not passed the course assessment.
|
472 |
+
$has_finish = get_post_meta( $course_id, '_lp_has_finish', true ) ?? 'yes';
|
473 |
$is_passed = $user->has_reached_passing_condition( $course_id );
|
474 |
|
475 |
if ( ! $is_passed && $has_finish === 'no' ) {
|
477 |
}
|
478 |
|
479 |
if ( $course_data ) {
|
480 |
+
$course_result = $course_data->get_result();
|
481 |
|
482 |
$is_all_completed = $user->is_completed_all_items( $course_id );
|
483 |
|
484 |
+
if ( ! $is_all_completed && $has_finish === 'yes' && ! $course_result['pass'] ) {
|
485 |
throw new Exception( esc_html__( 'Error: Cannot finish course.', 'learnpress' ) );
|
486 |
}
|
487 |
}
|
496 |
}
|
497 |
|
498 |
return $return;
|
499 |
+
}*/
|
500 |
|
501 |
public function course_finish_button() {
|
502 |
$user = LP_Global::user();
|
507 |
return;
|
508 |
}
|
509 |
|
510 |
+
$check = $user->can_show_finish_course_btn( $course );
|
511 |
|
512 |
+
if ( 'success' !== $check['status'] ) {
|
513 |
return;
|
514 |
}
|
515 |
|
554 |
}
|
555 |
|
556 |
public function popup_header() {
|
557 |
+
$user = LP_Global::user();
|
558 |
+
$course = LP_Global::course();
|
559 |
+
|
560 |
+
if ( ! $user || ! $course ) {
|
561 |
+
return;
|
562 |
+
}
|
563 |
+
|
564 |
+
$percentage = 0;
|
565 |
+
$completed_items = 0;
|
566 |
+
$course_data = $user->get_course_data( $course->get_id() );
|
567 |
+
|
568 |
+
if ( $course_data && ! $course->is_no_required_enroll() ) {
|
569 |
+
$course_results = $course_data->get_result();
|
570 |
+
$completed_items = $course_results['completed_items'];
|
571 |
+
$percentage = $course_results['count_items'] ? absint( $course_results['completed_items'] / $course_results['count_items'] * 100 ) : 0;
|
572 |
+
}
|
573 |
+
|
574 |
+
learn_press_get_template( 'single-course/content-item/popup-header', compact( 'user', 'course', 'completed_items', 'percentage' ) );
|
575 |
}
|
576 |
|
577 |
public function popup_sidebar() {
|
814 |
|
815 |
}
|
816 |
|
817 |
+
/**
|
818 |
+
* Template show count items
|
819 |
+
*
|
820 |
+
* @since 4.0.0
|
821 |
+
* @version 1.0.1
|
822 |
+
* @editor tungnx
|
823 |
+
*/
|
824 |
public function count_object() {
|
825 |
$course = learn_press_get_course();
|
826 |
|
828 |
return;
|
829 |
}
|
830 |
|
831 |
+
$lessons = $course->count_items( LP_LESSON_CPT );
|
832 |
+
$quizzes = $course->count_items( LP_QUIZ_CPT );
|
|
|
|
|
|
|
833 |
$students = $course->count_students();
|
834 |
|
835 |
$counts = apply_filters(
|
836 |
+
'learnpress/course/count/items',
|
837 |
array(
|
838 |
'lesson' => sprintf(
|
839 |
'<span class="meta-number">' . _n( '%d lesson', '%d lessons', $lessons, 'learnpress' ) . '</span>',
|
1060 |
$course = LP_Global::course();
|
1061 |
$user = LP_Global::user();
|
1062 |
|
1063 |
+
if ( ! $course ) {
|
1064 |
return;
|
1065 |
}
|
1066 |
|
1073 |
echo lp_skeleton_animation_html( 3 );
|
1074 |
echo '</div>';
|
1075 |
} else {
|
1076 |
+
$course_data = $user->get_course_data( $course->get_id() );
|
1077 |
+
if ( ! $course_data ) {
|
1078 |
+
return;
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
$course_results = $course_data->calculate_course_results();
|
1082 |
+
|
1083 |
learn_press_get_template(
|
1084 |
'single-course/sidebar/user-progress',
|
1085 |
+
compact( 'user', 'course', 'course_data', 'course_results' )
|
|
|
|
|
|
|
1086 |
);
|
1087 |
}
|
1088 |
}
|
@@ -40,13 +40,13 @@ class LP_Template_Profile extends LP_Abstract_Template {
|
|
40 |
|
41 |
$current_tab = $profile->get_current_tab();
|
42 |
|
43 |
-
if ( 'settings' === $current_tab && ! $user_id ) {
|
44 |
return;
|
45 |
}
|
46 |
|
47 |
-
$privacy = get_user_meta( $user->get_user()->get_id()
|
48 |
|
49 |
-
if ( $user->get_user()->get_id() != $user_id && empty( $privacy )) {
|
50 |
return;
|
51 |
}
|
52 |
|
@@ -68,7 +68,7 @@ class LP_Template_Profile extends LP_Abstract_Template {
|
|
68 |
return;
|
69 |
}
|
70 |
|
71 |
-
learn_press_get_template( 'profile/tabs.php',
|
72 |
}
|
73 |
|
74 |
public function dashboard_statistic() {
|
@@ -159,7 +159,7 @@ class LP_Template_Profile extends LP_Abstract_Template {
|
|
159 |
return;
|
160 |
}
|
161 |
|
162 |
-
learn_press_get_template( 'profile/tabs/orders/recover-my-order.php', array( 'order' => $order ) );
|
163 |
}
|
164 |
|
165 |
public function order_message() {
|
40 |
|
41 |
$current_tab = $profile->get_current_tab();
|
42 |
|
43 |
+
if ( 'settings' === $current_tab && ( ! $user_id || $user_id != $profile->get_user()->get_id() ) ) {
|
44 |
return;
|
45 |
}
|
46 |
|
47 |
+
$privacy = get_user_meta( $user->get_user()->get_id(), '_lp_profile_privacy', true );
|
48 |
|
49 |
+
if ( ! current_user_can( ADMIN_ROLE ) && ( $user->get_user()->get_id() != $user_id && empty( $privacy ) ) ) {
|
50 |
return;
|
51 |
}
|
52 |
|
68 |
return;
|
69 |
}
|
70 |
|
71 |
+
learn_press_get_template( 'profile/tabs.php', compact( 'user', 'profile' ) );
|
72 |
}
|
73 |
|
74 |
public function dashboard_statistic() {
|
159 |
return;
|
160 |
}
|
161 |
|
162 |
+
//learn_press_get_template( 'profile/tabs/orders/recover-my-order.php', array( 'order' => $order ) );
|
163 |
}
|
164 |
|
165 |
public function order_message() {
|
@@ -7,13 +7,6 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
7 |
public $_item_type = LP_COURSE_CPT;
|
8 |
public $_ref_type = LP_ORDER_CPT;
|
9 |
|
10 |
-
/**
|
11 |
-
* Course's items
|
12 |
-
*
|
13 |
-
* @var array
|
14 |
-
*/
|
15 |
-
protected $_items = array();
|
16 |
-
|
17 |
/**
|
18 |
* Course
|
19 |
*
|
@@ -78,7 +71,6 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
78 |
* @return array|bool
|
79 |
*/
|
80 |
public function read_items( $refresh = false ) {
|
81 |
-
$this->_items = array();
|
82 |
$this->_course = learn_press_get_course( $this->get_id() );
|
83 |
|
84 |
$user_course_item_id = $this->get_user_item_id();
|
@@ -87,11 +79,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
87 |
return false;
|
88 |
}
|
89 |
|
90 |
-
$items = $this->cache_get_items();
|
91 |
-
|
92 |
-
if ( ! $refresh && false !== $items ) {
|
93 |
-
return $items;
|
94 |
-
}
|
95 |
|
96 |
$course_items = $this->_course->get_item_ids();
|
97 |
|
@@ -99,10 +87,10 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
99 |
return false;
|
100 |
}
|
101 |
|
102 |
-
$
|
103 |
-
|
104 |
-
|
105 |
-
);
|
106 |
|
107 |
if ( $user_course_items ) {
|
108 |
$tmp = array();
|
@@ -130,19 +118,6 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
130 |
);
|
131 |
}
|
132 |
|
133 |
-
$item_type = learn_press_get_post_type( $item_id );
|
134 |
-
|
135 |
-
/*switch ( $item_type ) {
|
136 |
-
case LP_QUIZ_CPT:
|
137 |
-
$course_item = new LP_User_Item_Quiz( $user_course_item );
|
138 |
-
break;
|
139 |
-
case LP_LESSON_CPT:
|
140 |
-
$course_item = new LP_User_Item( $user_course_item );
|
141 |
-
break;
|
142 |
-
}
|
143 |
-
|
144 |
-
$course_item = apply_filters( 'learn-press/user-course-item', $course_item, $user_course_item, $this );*/
|
145 |
-
|
146 |
$course_item = apply_filters(
|
147 |
'learn-press/user-course-item',
|
148 |
LP_User_Item::get_item_object( $user_course_item ),
|
@@ -151,20 +126,11 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
151 |
);
|
152 |
|
153 |
if ( $course_item ) {
|
154 |
-
$this->
|
155 |
-
$this->_items_by_item_ids[ $course_item->get_user_item_id() ] = $item_id;
|
156 |
-
$this->_items_by_order[] = $item_id;
|
157 |
-
|
158 |
$items[ $item_id ] = $course_item;
|
159 |
}
|
160 |
}
|
161 |
|
162 |
-
LP_Object_Cache::set(
|
163 |
-
$this->get_user_id() . '-' . $this->get_id(),
|
164 |
-
$items,
|
165 |
-
'learn-press/user-course-item-objects'
|
166 |
-
);
|
167 |
-
|
168 |
return $items;
|
169 |
}
|
170 |
|
@@ -234,6 +200,28 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
234 |
return $cid;
|
235 |
}
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
/**
|
238 |
* Get current progress of course for an user.
|
239 |
* Firstly, get data from cache if it is already loaded.
|
@@ -259,13 +247,13 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
259 |
);
|
260 |
|
261 |
if ( $results === false ) {
|
262 |
-
$course_result = $course->get_evaluation_results_method();
|
263 |
|
264 |
-
$results = LP_User_Items_Result_DB::instance()->get_result( $this->get_user_item_id() );
|
265 |
|
266 |
-
if (
|
267 |
-
|
268 |
-
}
|
269 |
|
270 |
LP_Object_Cache::set(
|
271 |
'course-' . $this->get_item_id() . '-' . $this->get_user_id(),
|
@@ -280,82 +268,92 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
280 |
/**
|
281 |
* Calculate course result
|
282 |
*/
|
283 |
-
public function calculate_course_results() {
|
|
|
284 |
$results = array(
|
285 |
'count_items' => 0,
|
286 |
'completed_items' => 0,
|
|
|
|
|
|
|
287 |
);
|
288 |
|
289 |
try {
|
290 |
-
$course = $this->
|
291 |
|
292 |
if ( ! $course ) {
|
293 |
throw new Exception( 'Course invalid!' );
|
294 |
}
|
295 |
|
296 |
-
$
|
|
|
|
|
|
|
|
|
297 |
|
298 |
-
$this->
|
299 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
switch ( $evaluate_type ) {
|
301 |
case 'evaluate_lesson':
|
302 |
-
$
|
303 |
break;
|
304 |
-
|
305 |
case 'evaluate_final_quiz':
|
306 |
-
$
|
307 |
break;
|
308 |
-
|
309 |
case 'evaluate_quiz':
|
310 |
-
$
|
311 |
break;
|
312 |
-
|
313 |
case 'evaluate_questions':
|
314 |
-
$results = $this->_evaluate_course_by_question();
|
315 |
-
break;
|
316 |
-
|
317 |
case 'evaluate_mark':
|
318 |
-
$
|
319 |
break;
|
320 |
-
|
321 |
default:
|
322 |
-
$
|
323 |
-
$results = apply_filters( 'learn-press/evaluate_passed_conditions', $results, $evaluate_type, $this );
|
324 |
}
|
325 |
|
326 |
-
if ( ! is_array( $
|
327 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
}
|
329 |
|
330 |
-
$
|
331 |
-
|
332 |
-
|
333 |
-
array(
|
334 |
-
'count_items' => $count_items,
|
335 |
-
'completed_items' => $completed_items,
|
336 |
-
'items' => array(
|
337 |
-
'quiz' => array(
|
338 |
-
'completed' => $this->get_completed_items( LP_QUIZ_CPT ),
|
339 |
-
'passed' => $this->get_passed_items( LP_QUIZ_CPT ),
|
340 |
-
'total' => $course->count_items( LP_QUIZ_CPT ),
|
341 |
-
),
|
342 |
-
'lesson' => array(
|
343 |
-
'completed' => $this->get_completed_items( LP_LESSON_CPT ),
|
344 |
-
'total' => $course->count_items( LP_LESSON_CPT ),
|
345 |
-
),
|
346 |
-
),
|
347 |
-
'skipped_items' => $count_items - $completed_items,
|
348 |
-
'status' => $this->get_status(),
|
349 |
-
'evaluate_type' => $evaluate_type,
|
350 |
-
),
|
351 |
-
$results
|
352 |
);
|
353 |
|
|
|
354 |
$graduation = '';
|
355 |
|
356 |
if ( ! $this->is_purchased() ) {
|
357 |
$graduation = $this->is_finished() ? $this->_is_passed( $results['result'] ) : 'in-progress';
|
358 |
-
}
|
359 |
|
360 |
$results = apply_filters(
|
361 |
'learn-press/update-course-results',
|
@@ -365,12 +363,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
365 |
$this
|
366 |
);
|
367 |
|
368 |
-
|
369 |
-
|
370 |
-
learn_press_update_user_item_field(
|
371 |
-
array( 'graduation' => $graduation ),
|
372 |
-
array( 'user_item_id' => $this->get_user_item_id() )
|
373 |
-
);
|
374 |
} catch ( Throwable $e ) {
|
375 |
|
376 |
}
|
@@ -378,6 +371,11 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
378 |
return $results;
|
379 |
}
|
380 |
|
|
|
|
|
|
|
|
|
|
|
381 |
public function count_items() {
|
382 |
global $wpdb;
|
383 |
$t = microtime( true );
|
@@ -441,7 +439,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
441 |
|
442 |
}
|
443 |
|
444 |
-
}
|
445 |
|
446 |
/**
|
447 |
* Evaluate course results by count quizzes passed/all quizzes.
|
@@ -665,6 +663,254 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
665 |
return isset( $cached_data['lessons'] ) ? $cached_data['lessons'] : array();
|
666 |
}
|
667 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
/**
|
669 |
* Finish course for user
|
670 |
*
|
@@ -679,7 +925,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
679 |
$this
|
680 |
);
|
681 |
|
682 |
-
$results = $this->calculate_course_results();
|
683 |
|
684 |
return parent::complete( $status );
|
685 |
}
|
@@ -766,7 +1012,8 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
766 |
* @editor tungnx
|
767 |
* @modify 4.1.3 - comment - not use
|
768 |
*/
|
769 |
-
/*
|
|
|
770 |
$cache_key = 'user-course-' . $this->get_user_id() . '-' . $this->get_id();
|
771 |
$cached_data = LP_Object_Cache::get( $cache_key, 'learn-press/course-results' );
|
772 |
|
@@ -901,6 +1148,46 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
901 |
return $with_total ? $completed_items : $completed_items[0];
|
902 |
}
|
903 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
904 |
/**
|
905 |
* Get items completed by percentage.
|
906 |
*
|
@@ -935,12 +1222,13 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
935 |
* @return LP_User_Item[]
|
936 |
*/
|
937 |
public function get_items( $refresh = false ) {
|
938 |
-
$this->read_items( $refresh );
|
939 |
|
|
|
940 |
return LP_Object_Cache::get(
|
941 |
$this->get_user_id() . '-' . $this->get_id(),
|
942 |
'learn-press/user-course-item-objects'
|
943 |
-
)
|
944 |
}
|
945 |
|
946 |
/**
|
@@ -1027,7 +1315,6 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1027 |
*
|
1028 |
* @return LP_User_Item|LP_User_Item_Quiz|bool
|
1029 |
* @author tungnx
|
1030 |
-
*
|
1031 |
*/
|
1032 |
public function getItem( $item_id ) {
|
1033 |
|
@@ -1038,6 +1325,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1038 |
*
|
1039 |
* @return LP_User_Item|LP_User_Item_Quiz|bool
|
1040 |
*/
|
|
|
1041 |
public function get_item_by_user_item_id( $user_item_id ) {
|
1042 |
$this->read_items();
|
1043 |
|
@@ -1048,7 +1336,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1048 |
}
|
1049 |
|
1050 |
return false;
|
1051 |
-
}
|
1052 |
|
1053 |
/**
|
1054 |
* @param $item
|
@@ -1090,19 +1378,23 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1090 |
* @param string $prop
|
1091 |
*
|
1092 |
* @return bool|float|int
|
|
|
1093 |
*/
|
1094 |
public function get_item_result( $item_id, $prop = 'result' ) {
|
1095 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1096 |
return $item->get_result( $prop );
|
1097 |
}
|
1098 |
|
1099 |
return false;
|
1100 |
}
|
1101 |
|
1102 |
-
public function get_result( $prop = '' ) {
|
1103 |
-
return $this->get_results( $prop );
|
1104 |
-
}
|
1105 |
-
|
1106 |
/**
|
1107 |
* @param int $at
|
1108 |
*
|
@@ -1110,7 +1402,8 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1110 |
* @editor tungnx
|
1111 |
* @modify 4.1.3 - comment - not use
|
1112 |
*/
|
1113 |
-
/*
|
|
|
1114 |
$items = $this->read_items();
|
1115 |
$item_id = ! empty( $this->_items_by_order[ $at ] ) ? $this->_items_by_order[ $at ] : 0;
|
1116 |
if ( ! $item_id && $items ) {
|
@@ -1138,7 +1431,9 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1138 |
*/
|
1139 |
public function get_js_args() {
|
1140 |
$js_args = false;
|
1141 |
-
|
|
|
|
|
1142 |
$item = false;
|
1143 |
$js_args = array(
|
1144 |
'root_url' => trailingslashit( get_home_url() ),
|
@@ -1146,7 +1441,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1146 |
'url' => $course->get_permalink(),
|
1147 |
'result' => $this->get_results(),
|
1148 |
'current_item' => $item ? $item->get_id() : false,
|
1149 |
-
'items' => $this->get_items_for_js(),
|
1150 |
);
|
1151 |
}
|
1152 |
|
@@ -1203,23 +1498,25 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1203 |
* Get js settings of course items.
|
1204 |
*
|
1205 |
* @return array
|
|
|
|
|
1206 |
*/
|
1207 |
-
public function get_items_for_js() {
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
}
|
1223 |
|
1224 |
/**
|
1225 |
* Update course item and it's child.
|
@@ -1248,7 +1545,7 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1248 |
if ( in_array( $item->get_status(), array( 'completed', 'finished' ) ) ) {
|
1249 |
|
1250 |
if ( ! $item->get_end_time() || $item->get_end_time()->is_null() ) {
|
1251 |
-
$item->set_end_time(
|
1252 |
}
|
1253 |
}
|
1254 |
|
@@ -1360,4 +1657,25 @@ class LP_User_Item_Course extends LP_User_Item implements ArrayAccess {
|
|
1360 |
|
1361 |
return $order;
|
1362 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1363 |
}
|
7 |
public $_item_type = LP_COURSE_CPT;
|
8 |
public $_ref_type = LP_ORDER_CPT;
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* Course
|
12 |
*
|
71 |
* @return array|bool
|
72 |
*/
|
73 |
public function read_items( $refresh = false ) {
|
|
|
74 |
$this->_course = learn_press_get_course( $this->get_id() );
|
75 |
|
76 |
$user_course_item_id = $this->get_user_item_id();
|
79 |
return false;
|
80 |
}
|
81 |
|
82 |
+
// $items = $this->cache_get_items();
|
|
|
|
|
|
|
|
|
83 |
|
84 |
$course_items = $this->_course->get_item_ids();
|
85 |
|
87 |
return false;
|
88 |
}
|
89 |
|
90 |
+
$filter = new LP_User_Items_Filter();
|
91 |
+
$filter->parent_id = $user_course_item_id;
|
92 |
+
$filter->user_id = $this->get_user_id();
|
93 |
+
$user_course_items = LP_User_Items_DB::getInstance()->get_user_course_items( $filter );
|
94 |
|
95 |
if ( $user_course_items ) {
|
96 |
$tmp = array();
|
118 |
);
|
119 |
}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
$course_item = apply_filters(
|
122 |
'learn-press/user-course-item',
|
123 |
LP_User_Item::get_item_object( $user_course_item ),
|
126 |
);
|
127 |
|
128 |
if ( $course_item ) {
|
129 |
+
// $this->_items_by_item_ids[ $course_item->get_user_item_id() ] = $item_id;
|
|
|
|
|
|
|
130 |
$items[ $item_id ] = $course_item;
|
131 |
}
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
return $items;
|
135 |
}
|
136 |
|
200 |
return $cid;
|
201 |
}
|
202 |
|
203 |
+
/**
|
204 |
+
* Get result/processing course
|
205 |
+
*
|
206 |
+
* @param string $prop
|
207 |
+
*
|
208 |
+
* @return mixed
|
209 |
+
*/
|
210 |
+
public function get_result( $prop = '' ) {
|
211 |
+
$results = $this->calculate_course_results();
|
212 |
+
|
213 |
+
// Fix temporary for case call 'grade' - addons called
|
214 |
+
if ( 'grade' === $prop ) {
|
215 |
+
if ( $results['pass'] ) {
|
216 |
+
$results['grade'] = 'passed';
|
217 |
+
} else {
|
218 |
+
$results['grade'] = 'failed';
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
return $prop && $results && array_key_exists( $prop, $results ) ? $results[ $prop ] : $results;
|
223 |
+
}
|
224 |
+
|
225 |
/**
|
226 |
* Get current progress of course for an user.
|
227 |
* Firstly, get data from cache if it is already loaded.
|
247 |
);
|
248 |
|
249 |
if ( $results === false ) {
|
250 |
+
// $course_result = $course->get_evaluation_results_method();
|
251 |
|
252 |
+
// $results = LP_User_Items_Result_DB::instance()->get_result( $this->get_user_item_id() );
|
253 |
|
254 |
+
// if ( is_array( $results ) && array_key_exists( 'result', $results ) ) {
|
255 |
+
$results = $this->calculate_course_results();
|
256 |
+
// }
|
257 |
|
258 |
LP_Object_Cache::set(
|
259 |
'course-' . $this->get_item_id() . '-' . $this->get_user_id(),
|
268 |
/**
|
269 |
* Calculate course result
|
270 |
*/
|
271 |
+
public function calculate_course_results( bool $force_cache = false ) {
|
272 |
+
$items = array();
|
273 |
$results = array(
|
274 |
'count_items' => 0,
|
275 |
'completed_items' => 0,
|
276 |
+
'items' => array(),
|
277 |
+
'evaluate_type' => '',
|
278 |
+
'pass' => 0,
|
279 |
);
|
280 |
|
281 |
try {
|
282 |
+
$course = learn_press_get_course( $this->get_course_id() );
|
283 |
|
284 |
if ( ! $course ) {
|
285 |
throw new Exception( 'Course invalid!' );
|
286 |
}
|
287 |
|
288 |
+
$key_first_cache = 'calculate_course/' . $this->get_user_id() . '/' . $course->get_id();
|
289 |
+
$results_cache = LP_Cache::cache_load_first( 'get', $key_first_cache );
|
290 |
+
if ( false !== $results_cache && ! $force_cache ) {
|
291 |
+
return $results_cache;
|
292 |
+
}
|
293 |
|
294 |
+
$this->_course = $course;
|
295 |
|
296 |
+
if ( $this->is_finished() ) {
|
297 |
+
// Get result from lp_user_item_results
|
298 |
+
// Todo: tungnx - set cache
|
299 |
+
return LP_User_Items_Result_DB::instance()->get_result( $this->get_user_item_id() );
|
300 |
+
}
|
301 |
+
|
302 |
+
$count_items = $course->count_items();
|
303 |
+
$count_items_completed = $this->count_items_completed();
|
304 |
+
|
305 |
+
$evaluate_type = $course->get_data( 'course_result', 'evaluate_lesson' );
|
306 |
switch ( $evaluate_type ) {
|
307 |
case 'evaluate_lesson':
|
308 |
+
$results_evaluate = $this->evaluate_course_by_lesson( $count_items_completed, $course->count_items( LP_LESSON_CPT ) );
|
309 |
break;
|
|
|
310 |
case 'evaluate_final_quiz':
|
311 |
+
$results_evaluate = $this->evaluate_course_by_final_quiz();
|
312 |
break;
|
|
|
313 |
case 'evaluate_quiz':
|
314 |
+
$results_evaluate = $this->evaluate_course_by_quizzes_passed( $count_items_completed, $course->count_items( LP_QUIZ_CPT ) );
|
315 |
break;
|
|
|
316 |
case 'evaluate_questions':
|
|
|
|
|
|
|
317 |
case 'evaluate_mark':
|
318 |
+
$results_evaluate = $this->evaluate_course_by_question( $evaluate_type );
|
319 |
break;
|
|
|
320 |
default:
|
321 |
+
$results_evaluate = apply_filters( 'learn-press/evaluate_passed_conditions', $results, $evaluate_type, $this );
|
|
|
322 |
}
|
323 |
|
324 |
+
if ( ! is_array( $results_evaluate ) ) {
|
325 |
+
$results_evaluate = array(
|
326 |
+
'result' => 0,
|
327 |
+
'pass' => 0,
|
328 |
+
);
|
329 |
+
}
|
330 |
+
|
331 |
+
$results_evaluate['result'] = round( $results_evaluate['result'], 2 );
|
332 |
+
|
333 |
+
$completed_items = intval( $count_items_completed->count_status ?? 0 );
|
334 |
+
|
335 |
+
$item_types = learn_press_get_course_item_types();
|
336 |
+
foreach ( $item_types as $item_type ) {
|
337 |
+
$item_type_key = str_replace( 'lp_', '', $item_type );
|
338 |
+
|
339 |
+
$items[ $item_type_key ] = array(
|
340 |
+
'completed' => $count_items_completed->{$item_type . '_status_completed'} ?? 0,
|
341 |
+
'passed' => $count_items_completed->{$item_type . '_graduation_passed'} ?? 0,
|
342 |
+
'total' => $course->count_items( $item_type ),
|
343 |
+
);
|
344 |
}
|
345 |
|
346 |
+
$results = array_merge(
|
347 |
+
$results_evaluate,
|
348 |
+
compact( 'count_items', 'completed_items', 'items', 'evaluate_type' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
);
|
350 |
|
351 |
+
/*
|
352 |
$graduation = '';
|
353 |
|
354 |
if ( ! $this->is_purchased() ) {
|
355 |
$graduation = $this->is_finished() ? $this->_is_passed( $results['result'] ) : 'in-progress';
|
356 |
+
}*/
|
357 |
|
358 |
$results = apply_filters(
|
359 |
'learn-press/update-course-results',
|
363 |
$this
|
364 |
);
|
365 |
|
366 |
+
LP_Cache::cache_load_first( 'set', $key_first_cache, $results );
|
|
|
|
|
|
|
|
|
|
|
367 |
} catch ( Throwable $e ) {
|
368 |
|
369 |
}
|
371 |
return $results;
|
372 |
}
|
373 |
|
374 |
+
/**
|
375 |
+
* @editor tungnx
|
376 |
+
* @modify 4.1.4.1 - comment - not use
|
377 |
+
*/
|
378 |
+
/*
|
379 |
public function count_items() {
|
380 |
global $wpdb;
|
381 |
$t = microtime( true );
|
439 |
|
440 |
}
|
441 |
|
442 |
+
}*/
|
443 |
|
444 |
/**
|
445 |
* Evaluate course results by count quizzes passed/all quizzes.
|
663 |
return isset( $cached_data['lessons'] ) ? $cached_data['lessons'] : array();
|
664 |
}
|
665 |
|
666 |
+
/**
|
667 |
+
* Evaluate course result by lessons.
|
668 |
+
*
|
669 |
+
* @param $count_items_completed
|
670 |
+
* @param int $total_item_lesson
|
671 |
+
*
|
672 |
+
* @return array
|
673 |
+
* @author tungnx
|
674 |
+
* @since 4.1.4.1
|
675 |
+
* @version 1.0.0
|
676 |
+
*/
|
677 |
+
protected function evaluate_course_by_lesson( $count_items_completed, int $total_item_lesson = 0 ): array {
|
678 |
+
$evaluate = array(
|
679 |
+
'result' => 0,
|
680 |
+
'pass' => 0,
|
681 |
+
);
|
682 |
+
|
683 |
+
$count_items_completed = intval( $count_items_completed->{LP_LESSON_CPT . '_status_completed'} ?? 0 );
|
684 |
+
|
685 |
+
if ( $total_item_lesson && $count_items_completed ) {
|
686 |
+
$evaluate['result'] = $count_items_completed * 100 / $total_item_lesson;
|
687 |
+
}
|
688 |
+
|
689 |
+
$passing_condition = $this->_course->get_passing_condition();
|
690 |
+
if ( $evaluate['result'] >= $passing_condition ) {
|
691 |
+
$evaluate['pass'] = 1;
|
692 |
+
}
|
693 |
+
|
694 |
+
return $evaluate;
|
695 |
+
}
|
696 |
+
|
697 |
+
/**
|
698 |
+
* Evaluate course result by final quiz.
|
699 |
+
*
|
700 |
+
* @return array
|
701 |
+
*/
|
702 |
+
protected function evaluate_course_by_final_quiz(): array {
|
703 |
+
$lp_user_items_db = LP_User_Items_DB::getInstance();
|
704 |
+
$lp_user_item_result_db = LP_User_Items_Result_DB::instance();
|
705 |
+
$evaluate = array(
|
706 |
+
'result' => 0,
|
707 |
+
'pass' => 0,
|
708 |
+
);
|
709 |
+
|
710 |
+
try {
|
711 |
+
$quiz_final_id = get_post_meta( $this->get_course_id(), '_lp_final_quiz', true );
|
712 |
+
|
713 |
+
if ( ! $quiz_final_id ) {
|
714 |
+
throw new Exception( '' );
|
715 |
+
}
|
716 |
+
|
717 |
+
$quiz_final = learn_press_get_quiz( $quiz_final_id );
|
718 |
+
|
719 |
+
if ( ! $quiz_final ) {
|
720 |
+
throw new Exception( 'Quiz final invalid' );
|
721 |
+
}
|
722 |
+
|
723 |
+
$user_course = $this->get_last_user_course();
|
724 |
+
|
725 |
+
if ( ! $user_course ) {
|
726 |
+
throw new Exception( 'User course not exists' );
|
727 |
+
}
|
728 |
+
|
729 |
+
$filter = new LP_User_Items_Filter();
|
730 |
+
$filter->query_type = 'get_row';
|
731 |
+
$filter->parent_id = $user_course->user_item_id;
|
732 |
+
$filter->item_type = LP_QUIZ_CPT;
|
733 |
+
$filter->item_id = $quiz_final_id;
|
734 |
+
$user_quiz = $lp_user_items_db->get_user_course_items_by_item_type( $filter );
|
735 |
+
|
736 |
+
if ( ! $user_quiz ) {
|
737 |
+
throw new Exception();
|
738 |
+
}
|
739 |
+
|
740 |
+
// Get result did quiz
|
741 |
+
$quiz_result = $lp_user_item_result_db->get_result( $user_quiz->user_item_id );
|
742 |
+
|
743 |
+
if ( $quiz_result ) {
|
744 |
+
if ( ! isset( $quiz_result['result'] ) ) {
|
745 |
+
$evaluate['result'] = $quiz_result['user_mark'] * 100 / $quiz_result['mark'];
|
746 |
+
} else {
|
747 |
+
$evaluate['result'] = $quiz_result['result'];
|
748 |
+
}
|
749 |
+
|
750 |
+
$passing_condition = floatval( $quiz_final->get_data( 'passing_grade', 0 ) );
|
751 |
+
if ( $evaluate['result'] >= $passing_condition ) {
|
752 |
+
$evaluate['pass'] = 1;
|
753 |
+
}
|
754 |
+
}
|
755 |
+
} catch ( Throwable $e ) {
|
756 |
+
|
757 |
+
}
|
758 |
+
|
759 |
+
return $evaluate;
|
760 |
+
}
|
761 |
+
|
762 |
+
/**
|
763 |
+
* Evaluate course results by count quizzes passed/all quizzes.
|
764 |
+
*
|
765 |
+
* @author tungnx
|
766 |
+
* @since 4.1.4.1
|
767 |
+
* @version 1.0.0
|
768 |
+
*/
|
769 |
+
protected function evaluate_course_by_quizzes_passed( $count_items_completed, $total_item_quizzes ): array {
|
770 |
+
$evaluate = array(
|
771 |
+
'result' => 0,
|
772 |
+
'pass' => 0,
|
773 |
+
);
|
774 |
+
|
775 |
+
$count_items_completed = intval( $count_items_completed->{LP_QUIZ_CPT . '_graduation_passed'} ?? 0 );
|
776 |
+
|
777 |
+
if ( $total_item_quizzes && $count_items_completed ) {
|
778 |
+
$evaluate['result'] = $count_items_completed * 100 / $total_item_quizzes;
|
779 |
+
|
780 |
+
$passing_condition = $this->_course->get_passing_condition();
|
781 |
+
if ( $evaluate['result'] >= $passing_condition ) {
|
782 |
+
$evaluate['pass'] = 1;
|
783 |
+
}
|
784 |
+
}
|
785 |
+
|
786 |
+
return $evaluate;
|
787 |
+
}
|
788 |
+
|
789 |
+
/**
|
790 |
+
* Evaluate course results by count questions true/all questions.
|
791 |
+
*
|
792 |
+
* @author tungnx
|
793 |
+
* @since 4.1.4.1
|
794 |
+
* @version 1.0.0
|
795 |
+
*/
|
796 |
+
private function evaluate_course_by_questions( &$evaluate, $lp_quizzes, $total_questions ) {
|
797 |
+
$lp_user_item_results_db = LP_User_Items_Result_DB::instance();
|
798 |
+
$count_questions_correct = 0;
|
799 |
+
|
800 |
+
// get questions correct
|
801 |
+
foreach ( $lp_quizzes as $lp_quiz ) {
|
802 |
+
$lp_quiz_result = $lp_user_item_results_db->get_result( $lp_quiz->user_item_id );
|
803 |
+
if ( $lp_quiz_result ) {
|
804 |
+
$count_questions_correct += $lp_quiz_result['question_correct'];
|
805 |
+
}
|
806 |
+
}
|
807 |
+
|
808 |
+
if ( $total_questions && $count_questions_correct ) {
|
809 |
+
$evaluate['result'] = $count_questions_correct * 100 / $total_questions;
|
810 |
+
|
811 |
+
$passing_condition = $this->_course->get_passing_condition();
|
812 |
+
if ( $evaluate['result'] >= $passing_condition ) {
|
813 |
+
$evaluate['pass'] = 1;
|
814 |
+
}
|
815 |
+
}
|
816 |
+
}
|
817 |
+
|
818 |
+
/**
|
819 |
+
* Evaluate course results by total mark of questions.
|
820 |
+
*
|
821 |
+
* @author tungnx
|
822 |
+
* @since 4.1.4.1
|
823 |
+
* @version 1.0.0
|
824 |
+
*/
|
825 |
+
private function evaluate_course_by_mark( &$evaluate, $lp_quizzes, $total_mark_questions ) {
|
826 |
+
$lp_user_item_results_db = LP_User_Items_Result_DB::instance();
|
827 |
+
$count_mark_questions_receiver = 0;
|
828 |
+
|
829 |
+
foreach ( $lp_quizzes as $lp_quiz ) {
|
830 |
+
$lp_quiz_result = $lp_user_item_results_db->get_result( $lp_quiz->user_item_id );
|
831 |
+
if ( $lp_quiz_result ) {
|
832 |
+
$count_mark_questions_receiver += $lp_quiz_result['user_mark'];
|
833 |
+
}
|
834 |
+
}
|
835 |
+
|
836 |
+
if ( $count_mark_questions_receiver && $total_mark_questions ) {
|
837 |
+
$evaluate['result'] = $count_mark_questions_receiver * 100 / $total_mark_questions;
|
838 |
+
|
839 |
+
$passing_condition = floatval( $this->_course->get_passing_condition() );
|
840 |
+
if ( $evaluate['result'] >= $passing_condition ) {
|
841 |
+
$evaluate['pass'] = 1;
|
842 |
+
}
|
843 |
+
}
|
844 |
+
}
|
845 |
+
|
846 |
+
/**
|
847 |
+
* Evaluate course results by total mark of questions.
|
848 |
+
*
|
849 |
+
* @author tungnx
|
850 |
+
* @since 4.1.4.1
|
851 |
+
* @version 1.0.0
|
852 |
+
*/
|
853 |
+
protected function evaluate_course_by_question( string $evaluate_type ): array {
|
854 |
+
$lp_user_items_db = LP_User_Items_DB::getInstance();
|
855 |
+
$evaluate = array(
|
856 |
+
'result' => 0,
|
857 |
+
'pass' => 0,
|
858 |
+
);
|
859 |
+
|
860 |
+
try {
|
861 |
+
$user_course = $this->get_last_user_course();
|
862 |
+
|
863 |
+
if ( ! $user_course ) {
|
864 |
+
throw new Exception( '' );
|
865 |
+
}
|
866 |
+
|
867 |
+
// get quiz_ids
|
868 |
+
$filter_get_quiz_ids = new LP_User_Items_Filter();
|
869 |
+
$filter_get_quiz_ids->parent_id = $user_course->user_item_id;
|
870 |
+
$filter_get_quiz_ids->item_type = LP_QUIZ_CPT;
|
871 |
+
$lp_quizzes = $lp_user_items_db->get_user_course_items_by_item_type( $filter_get_quiz_ids );
|
872 |
+
|
873 |
+
// Get total questions, mark
|
874 |
+
// Todo: Tungnx - save (questions, mark) total when save quiz, course, if not query again
|
875 |
+
$course = $this->_course;
|
876 |
+
if ( is_int( $course ) ) {
|
877 |
+
$course = learn_press_get_course( $course );
|
878 |
+
}
|
879 |
+
|
880 |
+
$total_questions = 0;
|
881 |
+
$total_mark_question = 0;
|
882 |
+
|
883 |
+
// get all item by course
|
884 |
+
$items = $course->get_item_ids();
|
885 |
+
|
886 |
+
foreach ( $items as $item_id ) {
|
887 |
+
$item = $course->get_item( $item_id );
|
888 |
+
if ( $item->get_item_type() == LP_QUIZ_CPT ) {
|
889 |
+
$total_questions += count( $item->get_questions() );
|
890 |
+
$total_mark_question += $item->get_mark();
|
891 |
+
}
|
892 |
+
}
|
893 |
+
// End get total questions, mark
|
894 |
+
|
895 |
+
switch ( $evaluate_type ) {
|
896 |
+
case 'evaluate_questions':
|
897 |
+
$this->evaluate_course_by_questions( $evaluate, $lp_quizzes, $total_questions );
|
898 |
+
break;
|
899 |
+
case 'evaluate_mark':
|
900 |
+
$this->evaluate_course_by_mark( $evaluate, $lp_quizzes, $total_mark_question );
|
901 |
+
break;
|
902 |
+
default:
|
903 |
+
break;
|
904 |
+
}
|
905 |
+
|
906 |
+
// Get results of each quiz - has questions
|
907 |
+
} catch ( Throwable $e ) {
|
908 |
+
error_log( __FUNCTION__ . ': ' . $e->getMessage() );
|
909 |
+
}
|
910 |
+
|
911 |
+
return $evaluate;
|
912 |
+
}
|
913 |
+
|
914 |
/**
|
915 |
* Finish course for user
|
916 |
*
|
925 |
$this
|
926 |
);
|
927 |
|
928 |
+
// $results = $this->calculate_course_results();
|
929 |
|
930 |
return parent::complete( $status );
|
931 |
}
|
1012 |
* @editor tungnx
|
1013 |
* @modify 4.1.3 - comment - not use
|
1014 |
*/
|
1015 |
+
/*
|
1016 |
+
protected function _evaluate_course_by_quizzes() {
|
1017 |
$cache_key = 'user-course-' . $this->get_user_id() . '-' . $this->get_id();
|
1018 |
$cached_data = LP_Object_Cache::get( $cache_key, 'learn-press/course-results' );
|
1019 |
|
1148 |
return $with_total ? $completed_items : $completed_items[0];
|
1149 |
}
|
1150 |
|
1151 |
+
/**
|
1152 |
+
* Get completed items.
|
1153 |
+
*
|
1154 |
+
* @return object
|
1155 |
+
* @editor tungnx
|
1156 |
+
* @modify 4.1.4.1
|
1157 |
+
* @since 4.0.0
|
1158 |
+
* @version 4.0.1
|
1159 |
+
*/
|
1160 |
+
public function count_items_completed() {
|
1161 |
+
$lp_user_items_db = LP_User_Items_DB::getInstance();
|
1162 |
+
$count_items_completed = new stdClass();
|
1163 |
+
|
1164 |
+
try {
|
1165 |
+
$course = learn_press_get_course( $this->get_course_id() );
|
1166 |
+
|
1167 |
+
if ( ! $course ) {
|
1168 |
+
throw new Exception( __FUNCTION__ . ': Course is invalid!' );
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
$user_course = $this->get_last_user_course();
|
1172 |
+
|
1173 |
+
if ( ! $user_course ) {
|
1174 |
+
throw new Exception();
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
$filter_count = new LP_User_Items_Filter();
|
1178 |
+
$filter_count->parent_id = $user_course->user_item_id;
|
1179 |
+
$filter_count->item_id = $this->get_course_id();
|
1180 |
+
$filter_count->user_id = $this->get_user_id();
|
1181 |
+
$filter_count->status = 'completed';
|
1182 |
+
$filter_count->graduation = LP_COURSE_GRADUATION_PASSED;
|
1183 |
+
$count_items_completed = $lp_user_items_db->count_items_of_course_with_status( $filter_count );
|
1184 |
+
} catch ( Throwable $e ) {
|
1185 |
+
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
return $count_items_completed;
|
1189 |
+
}
|
1190 |
+
|
1191 |
/**
|
1192 |
* Get items completed by percentage.
|
1193 |
*
|
1222 |
* @return LP_User_Item[]
|
1223 |
*/
|
1224 |
public function get_items( $refresh = false ) {
|
1225 |
+
return $this->read_items( $refresh );
|
1226 |
|
1227 |
+
/*
|
1228 |
return LP_Object_Cache::get(
|
1229 |
$this->get_user_id() . '-' . $this->get_id(),
|
1230 |
'learn-press/user-course-item-objects'
|
1231 |
+
);*/
|
1232 |
}
|
1233 |
|
1234 |
/**
|
1315 |
*
|
1316 |
* @return LP_User_Item|LP_User_Item_Quiz|bool
|
1317 |
* @author tungnx
|
|
|
1318 |
*/
|
1319 |
public function getItem( $item_id ) {
|
1320 |
|
1325 |
*
|
1326 |
* @return LP_User_Item|LP_User_Item_Quiz|bool
|
1327 |
*/
|
1328 |
+
/*
|
1329 |
public function get_item_by_user_item_id( $user_item_id ) {
|
1330 |
$this->read_items();
|
1331 |
|
1336 |
}
|
1337 |
|
1338 |
return false;
|
1339 |
+
}*/
|
1340 |
|
1341 |
/**
|
1342 |
* @param $item
|
1378 |
* @param string $prop
|
1379 |
*
|
1380 |
* @return bool|float|int
|
1381 |
+
* @throws Exception
|
1382 |
*/
|
1383 |
public function get_item_result( $item_id, $prop = 'result' ) {
|
1384 |
+
$item = $this->get_item( $item_id );
|
1385 |
+
|
1386 |
+
if ( $item instanceof LP_User_Item_Quiz ) {
|
1387 |
+
/**
|
1388 |
+
* @var LP_User_Item_Quiz $item
|
1389 |
+
*/
|
1390 |
+
return $item->get_graduation();
|
1391 |
+
} elseif ( $item ) {
|
1392 |
return $item->get_result( $prop );
|
1393 |
}
|
1394 |
|
1395 |
return false;
|
1396 |
}
|
1397 |
|
|
|
|
|
|
|
|
|
1398 |
/**
|
1399 |
* @param int $at
|
1400 |
*
|
1402 |
* @editor tungnx
|
1403 |
* @modify 4.1.3 - comment - not use
|
1404 |
*/
|
1405 |
+
/*
|
1406 |
+
public function get_item_at( $at = 0 ) {
|
1407 |
$items = $this->read_items();
|
1408 |
$item_id = ! empty( $this->_items_by_order[ $at ] ) ? $this->_items_by_order[ $at ] : 0;
|
1409 |
if ( ! $item_id && $items ) {
|
1431 |
*/
|
1432 |
public function get_js_args() {
|
1433 |
$js_args = false;
|
1434 |
+
$course = $this->get_course();
|
1435 |
+
|
1436 |
+
if ( $course ) {
|
1437 |
$item = false;
|
1438 |
$js_args = array(
|
1439 |
'root_url' => trailingslashit( get_home_url() ),
|
1441 |
'url' => $course->get_permalink(),
|
1442 |
'result' => $this->get_results(),
|
1443 |
'current_item' => $item ? $item->get_id() : false,
|
1444 |
+
//'items' => $this->get_items_for_js(),
|
1445 |
);
|
1446 |
}
|
1447 |
|
1498 |
* Get js settings of course items.
|
1499 |
*
|
1500 |
* @return array
|
1501 |
+
* @editor tungnx
|
1502 |
+
* @modify 4.1.4.1 - comment - not use
|
1503 |
*/
|
1504 |
+
// public function get_items_for_js() {
|
1505 |
+
//
|
1506 |
+
// *** TEST CACHE */
|
1507 |
+
// return false;
|
1508 |
+
// $args = array();
|
1509 |
+
// if ( $items = $this->get_items() ) {
|
1510 |
+
// $user = $this->get_user();
|
1511 |
+
// $course = $this->get_course();
|
1512 |
+
// foreach ( $items as $item ) {
|
1513 |
+
//
|
1514 |
+
// $args[ $item->get_id() ] = $item->get_js_args();// $item_js;
|
1515 |
+
// }
|
1516 |
+
// }
|
1517 |
+
//
|
1518 |
+
// return apply_filters( 'learn-press/course/items-for-js', $args, $this->get_id(), $this->get_user_id() );
|
1519 |
+
// }
|
1520 |
|
1521 |
/**
|
1522 |
* Update course item and it's child.
|
1545 |
if ( in_array( $item->get_status(), array( 'completed', 'finished' ) ) ) {
|
1546 |
|
1547 |
if ( ! $item->get_end_time() || $item->get_end_time()->is_null() ) {
|
1548 |
+
$item->set_end_time( current_time( 'mysql', 1 ) );
|
1549 |
}
|
1550 |
}
|
1551 |
|
1657 |
|
1658 |
return $order;
|
1659 |
}
|
1660 |
+
|
1661 |
+
/**
|
1662 |
+
* Get child item ids by type item
|
1663 |
+
*
|
1664 |
+
* @return object|null
|
1665 |
+
*/
|
1666 |
+
public function get_last_user_course() {
|
1667 |
+
$lp_user_items_db = LP_User_Items_DB::getInstance();
|
1668 |
+
$user_course = null;
|
1669 |
+
|
1670 |
+
try {
|
1671 |
+
$filter_user_course = new LP_User_Items_Filter();
|
1672 |
+
$filter_user_course->item_id = $this->get_course_id();
|
1673 |
+
$filter_user_course->user_id = $this->get_user_id();
|
1674 |
+
$user_course = $lp_user_items_db->get_last_user_course( $filter_user_course );
|
1675 |
+
} catch ( Throwable $e ) {
|
1676 |
+
error_log( __FUNCTION__ . ':' . $e->getMessage() );
|
1677 |
+
}
|
1678 |
+
|
1679 |
+
return $user_course;
|
1680 |
+
}
|
1681 |
}
|
@@ -45,8 +45,10 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
45 |
*
|
46 |
* @return array|bool|LP_Quiz_Results|mixed
|
47 |
* @throws Exception
|
|
|
|
|
48 |
*/
|
49 |
-
public function add_question_answer( $id, $values = null ) {
|
50 |
$results = $this->get_results( '' );
|
51 |
|
52 |
if ( ! $results ) {
|
@@ -73,7 +75,7 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
73 |
|
74 |
$results['questions'] = $questions;
|
75 |
|
76 |
-
LP_User_Items_Result_DB::instance()->update( $this->get_user_item_id(), wp_json_encode( $results->get() ) );
|
77 |
|
78 |
$this->calculate_results();
|
79 |
|
@@ -82,7 +84,7 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
82 |
LP_Object_Cache::set( $cache_key, false, 'learn-press/quiz-result' );
|
83 |
|
84 |
return $this->get_results( '' );
|
85 |
-
}
|
86 |
|
87 |
public function get_question_answer( $id ) {
|
88 |
$results = $this->get_results( '' );
|
@@ -108,12 +110,12 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
108 |
*
|
109 |
* @return bool|mixed
|
110 |
*/
|
111 |
-
public function update( $force = false, $wp_error = false ) {
|
112 |
$return = parent::update( $force, $wp_error );
|
113 |
$this->calculate_results();
|
114 |
|
115 |
return $return;
|
116 |
-
}
|
117 |
|
118 |
/**
|
119 |
* Get list of data to update to database
|
@@ -174,15 +176,25 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
174 |
}
|
175 |
|
176 |
/**
|
177 |
-
*
|
178 |
*
|
179 |
* @param string $prop
|
180 |
-
* @param bool $force
|
181 |
*
|
182 |
* @return array|bool|mixed
|
183 |
*/
|
184 |
-
public function get_result( $prop = '
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
|
188 |
/**
|
@@ -252,6 +264,48 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
252 |
return apply_filters( 'learn-press/user-quiz-graduation-text', learn_press_get_graduation_text( $graduation ) );
|
253 |
}
|
254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
/**
|
256 |
* Get all attempts of a quiz.
|
257 |
*
|
@@ -260,7 +314,7 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
260 |
* @return array
|
261 |
*/
|
262 |
public function get_attempts( $limit = 3 ) {
|
263 |
-
$limit =
|
264 |
|
265 |
$limit = absint( apply_filters( 'lp/quiz/get-attempts/limit', $limit ) );
|
266 |
|
@@ -290,12 +344,8 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
290 |
* @return bool|array
|
291 |
*/
|
292 |
public function get_questions() {
|
293 |
-
$
|
294 |
-
|
295 |
-
if ( $ids === false ) {
|
296 |
-
$quiz = learn_press_get_quiz( $this->get_item_id() );
|
297 |
-
$ids = $quiz->get_question_ids();
|
298 |
-
}
|
299 |
|
300 |
return apply_filters( 'learn-press/user-item-quiz-questions', $ids, $this->get_user_id(), $this );
|
301 |
}
|
@@ -307,15 +357,16 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
307 |
* @throws Exception
|
308 |
* @version 4.0.0
|
309 |
*/
|
310 |
-
public function calculate_results() {
|
311 |
-
$quiz
|
312 |
-
$last_results
|
|
|
313 |
|
314 |
if ( ! $last_results ) {
|
315 |
$last_results = array();
|
316 |
}
|
317 |
|
318 |
-
$questions =
|
319 |
|
320 |
$result = array(
|
321 |
'questions' => array(),
|
@@ -334,7 +385,11 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
334 |
|
335 |
if ( $questions ) {
|
336 |
foreach ( $questions as $question_id => $last_checked ) {
|
337 |
-
$question
|
|
|
|
|
|
|
|
|
338 |
$answered = array_key_exists( 'answered', $last_checked ) ? $last_checked['answered'] : '';
|
339 |
$check = apply_filters( 'learn-press/quiz/check-question-result', $question->check( $answered ), $question_id, $this );
|
340 |
$check['answered'] = $answered;
|
@@ -374,25 +429,163 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
374 |
|
375 |
if ( $this->get_status() === 'completed' ) {
|
376 |
$grade = $percent >= $this->get_quiz()->get_data( 'passing_grade' ) ? 'passed' : 'failed';
|
|
|
377 |
}
|
378 |
|
379 |
$result['question_count'] = count( $questions );
|
380 |
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
}
|
390 |
|
391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
|
393 |
return $result;
|
394 |
}
|
395 |
|
|
|
|
|
|
|
|
|
396 |
protected function _get_results() {
|
397 |
return LP_User_Items_Result_DB::instance()->get_result( $this->get_user_item_id() );
|
398 |
}
|
@@ -401,8 +594,8 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
401 |
return $this->get_graduation();
|
402 |
}
|
403 |
|
404 |
-
public function get_percent_result( $decimal =
|
405 |
-
return apply_filters( 'learn-press/user/quiz-percent-result', sprintf( '%s%%', round( $this->
|
406 |
}
|
407 |
|
408 |
public function get_time_interval( $context = '' ) {
|
@@ -526,7 +719,7 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
526 |
*
|
527 |
* @return array
|
528 |
*/
|
529 |
-
public function get_checked_questions() {
|
530 |
$value = $this->get_meta( '_lp_question_checked', true );
|
531 |
|
532 |
if ( $value ) {
|
@@ -560,29 +753,48 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
560 |
}
|
561 |
|
562 |
/**
|
563 |
-
*
|
|
|
|
|
564 |
* @param mixed $answered
|
565 |
*
|
566 |
-
* @return
|
|
|
567 |
*/
|
568 |
-
public function
|
569 |
-
$
|
|
|
|
|
|
|
570 |
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
}
|
582 |
-
} catch ( Exception $ex ) {
|
583 |
-
return new WP_Error( $ex->getCode(), $ex->getMessage() );
|
584 |
}
|
585 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
586 |
return $checked;
|
587 |
}
|
588 |
|
@@ -631,9 +843,13 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
631 |
*
|
632 |
* @return bool
|
633 |
*/
|
634 |
-
public function can_check_answer( $question_id =
|
635 |
-
$quiz = learn_press_get_quiz( $this->get_item_id() );
|
636 |
$can = false;
|
|
|
|
|
|
|
|
|
|
|
637 |
|
638 |
if ( $quiz->get_instant_check() && $this->get_status() === 'started' ) {
|
639 |
$can = ! $this->has_checked_question( $question_id );
|
@@ -693,21 +909,24 @@ class LP_User_Item_Quiz extends LP_User_Item {
|
|
693 |
return apply_filters( 'learn-press/user-quiz/can-hint-answer', true, $this->get_id(), $this->get_course_id() );
|
694 |
}
|
695 |
|
696 |
-
public function complete( $status = 'completed' ) {
|
697 |
parent::complete( $status );
|
698 |
|
699 |
$this->update();
|
700 |
-
}
|
701 |
|
702 |
/**
|
703 |
* @deprecated
|
|
|
|
|
|
|
704 |
*/
|
705 |
-
public function finish() {
|
706 |
$this->complete( 'completed' );
|
707 |
|
708 |
// Force to re-calculate quiz results and update cache.
|
709 |
$r = $this->get_results( '', true );
|
710 |
-
}
|
711 |
|
712 |
public function is_review_questions() {
|
713 |
return LP_Global::quiz_question() && ( $this->get_status() === 'completed' );
|
45 |
*
|
46 |
* @return array|bool|LP_Quiz_Results|mixed
|
47 |
* @throws Exception
|
48 |
+
* @editor tungnx
|
49 |
+
* @modify 4.1.4.1 - comment - not use
|
50 |
*/
|
51 |
+
/*public function add_question_answer( $id, $values = null ) {
|
52 |
$results = $this->get_results( '' );
|
53 |
|
54 |
if ( ! $results ) {
|
75 |
|
76 |
$results['questions'] = $questions;
|
77 |
|
78 |
+
//LP_User_Items_Result_DB::instance()->update( $this->get_user_item_id(), wp_json_encode( $results->get() ) );
|
79 |
|
80 |
$this->calculate_results();
|
81 |
|
84 |
LP_Object_Cache::set( $cache_key, false, 'learn-press/quiz-result' );
|
85 |
|
86 |
return $this->get_results( '' );
|
87 |
+
}*/
|
88 |
|
89 |
public function get_question_answer( $id ) {
|
90 |
$results = $this->get_results( '' );
|
110 |
*
|
111 |
* @return bool|mixed
|
112 |
*/
|
113 |
+
/*public function update( $force = false, $wp_error = false ) {
|
114 |
$return = parent::update( $force, $wp_error );
|
115 |
$this->calculate_results();
|
116 |
|
117 |
return $return;
|
118 |
+
}*/
|
119 |
|
120 |
/**
|
121 |
* Get list of data to update to database
|
176 |
}
|
177 |
|
178 |
/**
|
179 |
+
* Get result
|
180 |
*
|
181 |
* @param string $prop
|
|
|
182 |
*
|
183 |
* @return array|bool|mixed
|
184 |
*/
|
185 |
+
public function get_result( $prop = '' ) {
|
186 |
+
$result = $this->calculate_quiz_result();
|
187 |
+
|
188 |
+
// Fix temporary for case call 'grade' - addons called
|
189 |
+
if ( 'grade' === $prop ) {
|
190 |
+
if ( $result['pass'] ) {
|
191 |
+
$result['grade'] = 'passed';
|
192 |
+
} else {
|
193 |
+
$result['grade'] = 'failed';
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
return $prop && $result && array_key_exists( $prop, $result ) ? $result[ $prop ] : $result;
|
198 |
}
|
199 |
|
200 |
/**
|
264 |
return apply_filters( 'learn-press/user-quiz-graduation-text', learn_press_get_graduation_text( $graduation ) );
|
265 |
}
|
266 |
|
267 |
+
/**
|
268 |
+
* Get Timestamp remaining when user doing quiz
|
269 |
+
*
|
270 |
+
* @author tungnx
|
271 |
+
* @version 1.0.0
|
272 |
+
* @sicne 4.1.4.1
|
273 |
+
* @return int
|
274 |
+
*/
|
275 |
+
public function get_timestamp_remaining(): int {
|
276 |
+
$timestamp_remaining = - 1;
|
277 |
+
|
278 |
+
try {
|
279 |
+
$quiz = learn_press_get_quiz( $this->get_item_id() );
|
280 |
+
|
281 |
+
if ( ! $quiz || LP_ITEM_STARTED != $this->get_status() ) {
|
282 |
+
return $timestamp_remaining;
|
283 |
+
}
|
284 |
+
|
285 |
+
$parent_id = $this->get_parent_id();
|
286 |
+
|
287 |
+
$duration = $quiz->get_duration()->get() . ' second';
|
288 |
+
|
289 |
+
$filter = new LP_User_Items_Filter();
|
290 |
+
$filter->parent_id = $parent_id;
|
291 |
+
$filter->item_id = $this->get_item_id();
|
292 |
+
$filter->user_id = get_current_user_id();
|
293 |
+
$user_quiz = LP_User_Items_DB::getInstance()->get_user_course_item( $filter, true );
|
294 |
+
$course_start_time = $user_quiz->start_time;
|
295 |
+
$timestamp_expire = strtotime( $course_start_time . ' +' . $duration );
|
296 |
+
$timestamp_current = strtotime( current_time( 'mysql', 1 ) );
|
297 |
+
$timestamp_remaining = $timestamp_expire - $timestamp_current;
|
298 |
+
|
299 |
+
if ( $timestamp_remaining < 0 ) {
|
300 |
+
$timestamp_remaining = 0;
|
301 |
+
}
|
302 |
+
} catch ( Throwable $e ) {
|
303 |
+
|
304 |
+
}
|
305 |
+
|
306 |
+
return apply_filters( 'learnpress/course/block_duration_expire/timestamp_remaining', $timestamp_remaining );
|
307 |
+
}
|
308 |
+
|
309 |
/**
|
310 |
* Get all attempts of a quiz.
|
311 |
*
|
314 |
* @return array
|
315 |
*/
|
316 |
public function get_attempts( $limit = 3 ) {
|
317 |
+
$limit = $limit ?? 3;
|
318 |
|
319 |
$limit = absint( apply_filters( 'lp/quiz/get-attempts/limit', $limit ) );
|
320 |
|
344 |
* @return bool|array
|
345 |
*/
|
346 |
public function get_questions() {
|
347 |
+
$quiz = learn_press_get_quiz( $this->get_item_id() );
|
348 |
+
$ids = $quiz->get_question_ids();
|
|
|
|
|
|
|
|
|
349 |
|
350 |
return apply_filters( 'learn-press/user-item-quiz-questions', $ids, $this->get_user_id(), $this );
|
351 |
}
|
357 |
* @throws Exception
|
358 |
* @version 4.0.0
|
359 |
*/
|
360 |
+
public function calculate_results(): array {
|
361 |
+
$quiz = learn_press_get_quiz( $this->get_item_id() );
|
362 |
+
$last_results = LP_User_Items_Result_DB::instance()->get_result( $this->get_user_item_id() );
|
363 |
+
$is_has_change = 0;
|
364 |
|
365 |
if ( ! $last_results ) {
|
366 |
$last_results = array();
|
367 |
}
|
368 |
|
369 |
+
$questions = $last_results['questions'] ?? array_fill_keys( $quiz->get_question_ids(), array() );
|
370 |
|
371 |
$result = array(
|
372 |
'questions' => array(),
|
385 |
|
386 |
if ( $questions ) {
|
387 |
foreach ( $questions as $question_id => $last_checked ) {
|
388 |
+
$question = LP_Question::get_question( $question_id );
|
389 |
+
if ( ! $question ) {
|
390 |
+
continue;
|
391 |
+
}
|
392 |
+
|
393 |
$answered = array_key_exists( 'answered', $last_checked ) ? $last_checked['answered'] : '';
|
394 |
$check = apply_filters( 'learn-press/quiz/check-question-result', $question->check( $answered ), $question_id, $this );
|
395 |
$check['answered'] = $answered;
|
429 |
|
430 |
if ( $this->get_status() === 'completed' ) {
|
431 |
$grade = $percent >= $this->get_quiz()->get_data( 'passing_grade' ) ? 'passed' : 'failed';
|
432 |
+
$this->_set_data( 'graduation', $grade );
|
433 |
}
|
434 |
|
435 |
$result['question_count'] = count( $questions );
|
436 |
|
437 |
+
if ( $grade ) {
|
438 |
+
$is_has_change = 1;
|
439 |
+
learn_press_update_user_item_field(
|
440 |
+
array(
|
441 |
+
'graduation' => $grade,
|
442 |
+
),
|
443 |
+
array(
|
444 |
+
'user_item_id' => $this->get_user_item_id(),
|
445 |
+
)
|
446 |
+
);
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
+
if ( $is_has_change ) {
|
451 |
+
//LP_User_Items_Result_DB::instance()->update( $this->get_user_item_id(), wp_json_encode( $result ) );
|
452 |
}
|
453 |
|
454 |
+
return $result;
|
455 |
+
}
|
456 |
+
|
457 |
+
/**
|
458 |
+
* Calculate result of quiz.
|
459 |
+
*
|
460 |
+
* @param array $answered [question_id => answered, 'instant_check' => 0]
|
461 |
+
*
|
462 |
+
* @return array
|
463 |
+
* @version 1.0.0
|
464 |
+
* @author tungnx
|
465 |
+
* @since 4.1.4.1
|
466 |
+
*/
|
467 |
+
public function calculate_quiz_result( array $answered = array() ): array {
|
468 |
+
$result = array(
|
469 |
+
'questions' => array(),
|
470 |
+
'mark' => 0,
|
471 |
+
'user_mark' => 0,
|
472 |
+
'question_count' => 0,
|
473 |
+
'question_empty' => 0,
|
474 |
+
'question_answered' => 0,
|
475 |
+
'question_wrong' => 0,
|
476 |
+
'question_correct' => 0,
|
477 |
+
'status' => '',
|
478 |
+
'result' => 0,
|
479 |
+
'time_spend' => '',
|
480 |
+
'passing_grade' => '',
|
481 |
+
'pass' => 0,
|
482 |
+
);
|
483 |
+
|
484 |
+
try {
|
485 |
+
if ( LP_ITEM_COMPLETED === $this->get_status() ) {
|
486 |
+
$result = LP_User_Items_Result_DB::instance()->get_result( $this->get_user_item_id() );
|
487 |
+
|
488 |
+
if ( isset( $result['user_mark'] ) && $result['user_mark'] < 0 ) {
|
489 |
+
$result['user_mark'] = 0;
|
490 |
+
}
|
491 |
+
|
492 |
+
return $result;
|
493 |
+
}
|
494 |
+
|
495 |
+
$quiz = learn_press_get_quiz( $this->get_item_id() );
|
496 |
+
|
497 |
+
if ( ! $quiz ) {
|
498 |
+
throw new Exception();
|
499 |
+
}
|
500 |
+
|
501 |
+
$question_ids = $quiz->get_questions();
|
502 |
+
$result['mark'] = $quiz->get_mark();
|
503 |
+
$result['question_count'] = count( $question_ids );
|
504 |
+
$result['time_spend'] = $this->get_time_interval( 'display' );
|
505 |
+
$result['passing_grade'] = $quiz->get_passing_grade();
|
506 |
+
|
507 |
+
foreach ( $question_ids as $question_id ) {
|
508 |
+
$question = LP_Question::get_question( $question_id );
|
509 |
+
$point = floatval( $question->get_mark() );
|
510 |
+
|
511 |
+
//if ( ! array_key_exists( 'instant_check', $answered ) || array_key_exists( $question_id, $answered ) ) {
|
512 |
+
$result['questions'][ $question_id ] = [];
|
513 |
+
$result['questions'][ $question_id ]['answered'] = $answered[ $question_id ] ?? '';
|
514 |
+
|
515 |
+
//}
|
516 |
+
|
517 |
+
if ( isset( $answered[ $question_id ] ) ) { // User's answer
|
518 |
+
$result['question_answered']++;
|
519 |
+
|
520 |
+
$check = $question->check( $answered[ $question_id ] );
|
521 |
+
if ( $check['correct'] ) {
|
522 |
+
$result['question_correct']++;
|
523 |
+
$result['user_mark'] += $point;
|
524 |
+
|
525 |
+
$result['questions'][ $question_id ]['correct'] = true;
|
526 |
+
$result['questions'][ $question_id ]['mark'] = $point;
|
527 |
+
} else {
|
528 |
+
if ( $quiz->get_negative_marking() ) {
|
529 |
+
$result['user_mark'] -= $point;
|
530 |
+
}
|
531 |
+
$result['question_wrong']++;
|
532 |
+
|
533 |
+
$result['questions'][ $question_id ]['correct'] = false;
|
534 |
+
$result['questions'][ $question_id ]['mark'] = 0;
|
535 |
+
}
|
536 |
+
} elseif ( ! array_key_exists( 'instant_check', $answered ) ) { // User skip question
|
537 |
+
if ( $quiz->get_negative_marking() && $quiz->get_minus_skip_questions() ) {
|
538 |
+
$result['user_mark'] -= $point;
|
539 |
+
}
|
540 |
+
$result['question_empty']++;
|
541 |
+
|
542 |
+
$result['questions'][ $question_id ]['correct'] = false;
|
543 |
+
$result['questions'][ $question_id ]['mark'] = 0;
|
544 |
+
}
|
545 |
+
|
546 |
+
$can_review_quiz = get_post_meta( $quiz->get_id(), '_lp_review', true ) === 'yes';
|
547 |
+
if ( $can_review_quiz && ! array_key_exists( 'instant_check', $answered ) ) {
|
548 |
+
$result['questions'][ $question_id ]['explanation'] = $question->get_explanation();
|
549 |
+
$result['questions'][ $question_id ]['options'] = learn_press_get_question_options_for_js(
|
550 |
+
$question,
|
551 |
+
array(
|
552 |
+
'include_is_true' => get_post_meta( $quiz->get_id(), '_lp_show_correct_review', true ) === 'yes',
|
553 |
+
'answer' => $answered[ $question_id ] ?? '',
|
554 |
+
)
|
555 |
+
);
|
556 |
+
}
|
557 |
+
}
|
558 |
+
|
559 |
+
if ( $result['user_mark'] < 0 ) {
|
560 |
+
$result['user_mark'] = 0;
|
561 |
+
}
|
562 |
+
|
563 |
+
if ( $result['user_mark'] > 0 && $result['mark'] > 0 ) {
|
564 |
+
$result['result'] = round( $result['user_mark'] * 100 / $result['mark'], 2, PHP_ROUND_HALF_DOWN );
|
565 |
+
}
|
566 |
+
|
567 |
+
$passing_grade = $quiz->get_data( 'passing_grade', 0 );
|
568 |
+
if ( $result['result'] >= $passing_grade ) {
|
569 |
+
$result['pass'] = 1;
|
570 |
+
} else {
|
571 |
+
$result['pass'] = 0;
|
572 |
+
}
|
573 |
+
|
574 |
+
//$result['answered'] = $answered;
|
575 |
+
//$results['status'] = $quiz->get_status();
|
576 |
+
//$result['results'] = $result;
|
577 |
+
//$result['attempts'] = $this->get_attempts();
|
578 |
+
} catch ( Throwable $e ) {
|
579 |
+
|
580 |
+
}
|
581 |
|
582 |
return $result;
|
583 |
}
|
584 |
|
585 |
+
public function get_option_answer() {
|
586 |
+
|
587 |
+
}
|
588 |
+
|
589 |
protected function _get_results() {
|
590 |
return LP_User_Items_Result_DB::instance()->get_result( $this->get_user_item_id() );
|
591 |
}
|
594 |
return $this->get_graduation();
|
595 |
}
|
596 |
|
597 |
+
public function get_percent_result( $decimal = 2 ) {
|
598 |
+
return apply_filters( 'learn-press/user/quiz-percent-result', sprintf( '%s%%', round( $this->get_result( 'result' ), $decimal ), $this->get_user_id(), $this->get_item_id() ) );
|
599 |
}
|
600 |
|
601 |
public function get_time_interval( $context = '' ) {
|
719 |
*
|
720 |
* @return array
|
721 |
*/
|
722 |
+
public function get_checked_questions(): array {
|
723 |
$value = $this->get_meta( '_lp_question_checked', true );
|
724 |
|
725 |
if ( $value ) {
|
753 |
}
|
754 |
|
755 |
/**
|
756 |
+
* Instant check question
|
757 |
+
*
|
758 |
+
* @param int $question_id
|
759 |
* @param mixed $answered
|
760 |
*
|
761 |
+
* @return array
|
762 |
+
* @throws Exception
|
763 |
*/
|
764 |
+
public function instant_check_question( int $question_id, $answered = null ): array {
|
765 |
+
$question = learn_press_get_question( $question_id );
|
766 |
+
if ( ! $question ) {
|
767 |
+
throw new Exception( __( 'Question is invalid!', 'learnpress' ) );
|
768 |
+
}
|
769 |
|
770 |
+
$can_check = $this->can_check_answer( $question_id );
|
771 |
+
if ( ! $can_check ) {
|
772 |
+
throw new Exception( __( 'Cannot check answer the question.', 'learnpress' ) );
|
773 |
+
}
|
774 |
|
775 |
+
$answered_check = [
|
776 |
+
'instant_check' => 1,
|
777 |
+
$question_id => $answered,
|
778 |
+
];
|
779 |
+
|
780 |
+
// For case save result when check instant answer
|
781 |
+
$result_instant_check = LP_User_Items_Result_DB::instance()->get_result( $this->get_user_item_id() );
|
782 |
+
if ( $result_instant_check ) {
|
783 |
+
foreach ( $result_instant_check['questions'] as $question_answer_id => $question_answer ) {
|
784 |
+
if ( ! empty( $question_answer['answered'] ) ) {
|
785 |
+
$answered_check[ $question_answer_id ] = $question_answer['answered'];
|
786 |
+
}
|
787 |
}
|
|
|
|
|
788 |
}
|
789 |
|
790 |
+
$result_answer = $this->calculate_quiz_result( $answered_check );
|
791 |
+
|
792 |
+
LP_User_Items_Result_DB::instance()->update( $this->get_user_item_id(), json_encode( $result_answer ) );
|
793 |
+
$this->add_checked_question( $question_id );
|
794 |
+
|
795 |
+
$checked['answered'] = $answered;
|
796 |
+
$checked['mark'] = $result_answer['questions'][ $question_id ]['mark'];
|
797 |
+
|
798 |
return $checked;
|
799 |
}
|
800 |
|
843 |
*
|
844 |
* @return bool
|
845 |
*/
|
846 |
+
public function can_check_answer( int $question_id = 0 ) : bool {
|
|
|
847 |
$can = false;
|
848 |
+
$quiz = learn_press_get_quiz( $this->get_item_id() );
|
849 |
+
|
850 |
+
if ( ! $quiz ) {
|
851 |
+
return $can;
|
852 |
+
}
|
853 |
|
854 |
if ( $quiz->get_instant_check() && $this->get_status() === 'started' ) {
|
855 |
$can = ! $this->has_checked_question( $question_id );
|
909 |
return apply_filters( 'learn-press/user-quiz/can-hint-answer', true, $this->get_id(), $this->get_course_id() );
|
910 |
}
|
911 |
|
912 |
+
/*public function complete( $status = 'completed' ) {
|
913 |
parent::complete( $status );
|
914 |
|
915 |
$this->update();
|
916 |
+
}*/
|
917 |
|
918 |
/**
|
919 |
* @deprecated
|
920 |
+
*
|
921 |
+
* @editor tungnx
|
922 |
+
* @modify 4.1.4.1 - comment - not use
|
923 |
*/
|
924 |
+
/*public function finish() {
|
925 |
$this->complete( 'completed' );
|
926 |
|
927 |
// Force to re-calculate quiz results and update cache.
|
928 |
$r = $this->get_results( '', true );
|
929 |
+
}*/
|
930 |
|
931 |
public function is_review_questions() {
|
932 |
return LP_Global::quiz_question() && ( $this->get_status() === 'completed' );
|
@@ -119,7 +119,7 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
119 |
if ( ! empty( $item['start_time'] ) ) {
|
120 |
$this->set_start_time( $item['start_time'] );
|
121 |
} else {
|
122 |
-
$this->set_start_time(
|
123 |
}
|
124 |
|
125 |
if ( ! empty( $item['end_time'] ) ) {
|
@@ -139,8 +139,7 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
139 |
if ( ! empty( $item['status'] ) ) {
|
140 |
$this->set_status( $item['status'] );
|
141 |
} else {
|
142 |
-
$
|
143 |
-
$this->set_status( $status );
|
144 |
}
|
145 |
|
146 |
if ( ! empty( $item['ref_id'] ) ) {
|
@@ -289,7 +288,6 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
289 |
/**
|
290 |
* Set end-time for item.
|
291 |
*
|
292 |
-
* @param bool $bound_to_gmt - Optional. Calculate gmt of end-time and update
|
293 |
* @param mixed $time
|
294 |
*
|
295 |
* @return $this
|
@@ -401,35 +399,39 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
401 |
* Get item status.
|
402 |
*
|
403 |
* @param string $field
|
404 |
-
* @
|
405 |
-
* @throws Exception
|
406 |
*
|
|
|
|
|
407 |
* @editor tungnx
|
408 |
* @modify 4.1.3
|
409 |
-
* @Todo: tungnx - after should set status when new instance or save, update, get_status only return status.
|
410 |
*/
|
411 |
-
public function get_status( string $field = 'status' ): string {
|
412 |
-
if ( !
|
413 |
return $this->get_data( $field );
|
414 |
-
}
|
415 |
|
416 |
-
$
|
417 |
-
$filter = new LP_User_Items_Filter();
|
418 |
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
$filter->parent_id = $this->get_parent_id();
|
423 |
|
424 |
-
|
|
|
|
|
|
|
425 |
|
426 |
-
|
427 |
-
$got_status = $user_item->$field;
|
428 |
-
} else {
|
429 |
-
$got_status = '';
|
430 |
-
}
|
431 |
|
432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
|
434 |
return $got_status;
|
435 |
}
|
@@ -442,7 +444,8 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
442 |
* @editor tungnx
|
443 |
* @reason comment - not use
|
444 |
*/
|
445 |
-
/*
|
|
|
446 |
if ( null === $this->_is_available ) {
|
447 |
$user = $this->get_user();
|
448 |
$order = $user->get_course_order( $this->get_item_id() );
|
@@ -479,7 +482,7 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
479 |
* @return int
|
480 |
*/
|
481 |
public function get_user_item_id() {
|
482 |
-
return $this->get_data( 'user_item_id' );
|
483 |
}
|
484 |
|
485 |
/**
|
@@ -769,6 +772,9 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
769 |
|
770 |
$return = learn_press_update_user_item_field( $data, $where );
|
771 |
|
|
|
|
|
|
|
772 |
if ( $return ) {
|
773 |
foreach ( (array) $return as $k => $v ) {
|
774 |
$this->_set_data( $k, $v );
|
@@ -776,10 +782,10 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
776 |
$this->_changes = array();
|
777 |
}
|
778 |
|
779 |
-
|
780 |
if ( $data_course ) {
|
781 |
$data_course->calculate_course_results();
|
782 |
-
}
|
783 |
|
784 |
return $return;
|
785 |
}
|
@@ -789,7 +795,8 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
789 |
* @reason commnet - not use
|
790 |
* @modify 4.1.2
|
791 |
*/
|
792 |
-
/*
|
|
|
793 |
return learn_press_is_support_course_item_type( $this->get_data( 'item_type' ) );
|
794 |
}*/
|
795 |
|
@@ -852,7 +859,8 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
852 |
* @modify 4.1.2
|
853 |
* @reason comment - not use
|
854 |
*/
|
855 |
-
/*
|
|
|
856 |
if ( $items = $this->get_history() ) {
|
857 |
return sizeof( $items );
|
858 |
}
|
@@ -865,7 +873,8 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
865 |
* @modify 4.1.2
|
866 |
* @reason comment - not use
|
867 |
*/
|
868 |
-
/*
|
|
|
869 |
learn_press_remove_user_items_history(
|
870 |
$this->get_item_id(),
|
871 |
$this->get_course( 'id' ),
|
@@ -954,33 +963,49 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
954 |
return $this->get_status() === $status;
|
955 |
}
|
956 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
957 |
public function complete( $status = 'completed' ) {
|
958 |
global $wpdb;
|
959 |
|
960 |
-
$end_time = new LP_Datetime();
|
961 |
-
$null_time =
|
962 |
|
963 |
-
|
964 |
-
|
965 |
-
|
|
|
966 |
|
967 |
-
|
968 |
-
|
969 |
-
|
|
|
|
|
|
|
970 |
FROM {$wpdb->prefix}learnpress_user_items
|
971 |
WHERE user_id = %d
|
972 |
AND item_id = %d
|
973 |
-
AND start_time <> %s AND end_time <> %s
|
974 |
AND status = %s
|
|
|
|
|
975 |
",
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
|
|
|
|
|
|
|
|
982 |
|
983 |
-
return
|
984 |
}
|
985 |
|
986 |
/**
|
@@ -988,7 +1013,8 @@ class LP_User_Item extends LP_Abstract_Object_Data implements ArrayAccess {
|
|
988 |
* @modify 4.1.2
|
989 |
* @reason comment - not use
|
990 |
*/
|
991 |
-
/*
|
|
|
992 |
global $wpdb;
|
993 |
|
994 |
$where = '';
|
119 |
if ( ! empty( $item['start_time'] ) ) {
|
120 |
$this->set_start_time( $item['start_time'] );
|
121 |
} else {
|
122 |
+
$this->set_start_time( current_time( 'mysql', 1 ) );
|
123 |
}
|
124 |
|
125 |
if ( ! empty( $item['end_time'] ) ) {
|
139 |
if ( ! empty( $item['status'] ) ) {
|
140 |
$this->set_status( $item['status'] );
|
141 |
} else {
|
142 |
+
$this->set_status( '' );
|
|
|
143 |
}
|
144 |
|
145 |
if ( ! empty( $item['ref_id'] ) ) {
|
288 |
/**
|
289 |
* Set end-time for item.
|
290 |
*
|
|
|
291 |
* @param mixed $time
|
292 |
*
|
293 |
* @return $this
|
399 |
* Get item status.
|
400 |
*
|
401 |
* @param string $field
|
402 |
+
* @param bool $force_cache Reset first cache
|
|
|
403 |
*
|
404 |
+
* @version 1.0.1
|
405 |
+
* @return string
|
406 |
* @editor tungnx
|
407 |
* @modify 4.1.3
|
|
|
408 |
*/
|
409 |
+
public function get_status( string $field = 'status', bool $force_cache = false ): string {
|
410 |
+
/*if ( ! is_null( $this->get_data( $field, null ) && ! $force_cache ) ) {
|
411 |
return $this->get_data( $field );
|
412 |
+
}*/
|
413 |
|
414 |
+
$got_status = '';
|
|
|
415 |
|
416 |
+
try {
|
417 |
+
$lp_user_item = LP_User_Items_DB::getInstance();
|
418 |
+
$filter = new LP_User_Items_Filter();
|
|
|
419 |
|
420 |
+
$filter->user_id = $this->get_user_id();
|
421 |
+
$filter->item_id = $this->get_item_id();
|
422 |
+
$filter->ref_id = $this->get_data( 'ref_id' );
|
423 |
+
$filter->parent_id = $this->get_parent_id();
|
424 |
|
425 |
+
$user_item = $lp_user_item->get_user_course_item( $filter, $force_cache );
|
|
|
|
|
|
|
|
|
426 |
|
427 |
+
if ( ! empty( $user_item ) && isset( $user_item->$field ) ) {
|
428 |
+
$got_status = $user_item->$field;
|
429 |
+
}
|
430 |
+
|
431 |
+
$this->set_data( $field, $got_status );
|
432 |
+
} catch ( Throwable $e ) {
|
433 |
+
error_log( __FUNCTION__ . ':' . $e->getMessage() );
|
434 |
+
}
|
435 |
|
436 |
return $got_status;
|
437 |
}
|
444 |
* @editor tungnx
|
445 |
* @reason comment - not use
|
446 |
*/
|
447 |
+
/*
|
448 |
+
public function is_available() {
|
449 |
if ( null === $this->_is_available ) {
|
450 |
$user = $this->get_user();
|
451 |
$order = $user->get_course_order( $this->get_item_id() );
|
482 |
* @return int
|
483 |
*/
|
484 |
public function get_user_item_id() {
|
485 |
+
return intval( $this->get_data( 'user_item_id' ) );
|
486 |
}
|
487 |
|
488 |
/**
|
772 |
|
773 |
$return = learn_press_update_user_item_field( $data, $where );
|
774 |
|
775 |
+
// Clear cache first status
|
776 |
+
$this->get_status( 'status', true );
|
777 |
+
|
778 |
if ( $return ) {
|
779 |
foreach ( (array) $return as $k => $v ) {
|
780 |
$this->_set_data( $k, $v );
|
782 |
$this->_changes = array();
|
783 |
}
|
784 |
|
785 |
+
/*$data_course = $this->get_parent();
|
786 |
if ( $data_course ) {
|
787 |
$data_course->calculate_course_results();
|
788 |
+
}*/
|
789 |
|
790 |
return $return;
|
791 |
}
|
795 |
* @reason commnet - not use
|
796 |
* @modify 4.1.2
|
797 |
*/
|
798 |
+
/*
|
799 |
+
public function is_course_item() {
|
800 |
return learn_press_is_support_course_item_type( $this->get_data( 'item_type' ) );
|
801 |
}*/
|
802 |
|
859 |
* @modify 4.1.2
|
860 |
* @reason comment - not use
|
861 |
*/
|
862 |
+
/*
|
863 |
+
public function count_history() {
|
864 |
if ( $items = $this->get_history() ) {
|
865 |
return sizeof( $items );
|
866 |
}
|
873 |
* @modify 4.1.2
|
874 |
* @reason comment - not use
|
875 |
*/
|
876 |
+
/*
|
877 |
+
public function remove_user_items_history( $keep = 10 ) {
|
878 |
learn_press_remove_user_items_history(
|
879 |
$this->get_item_id(),
|
880 |
$this->get_course( 'id' ),
|
963 |
return $this->get_status() === $status;
|
964 |
}
|
965 |
|
966 |
+
/**
|
967 |
+
* Complete item
|
968 |
+
*
|
969 |
+
* @editor tungnx
|
970 |
+
* @modify 4.1.4.1 - should review to improve
|
971 |
+
* @version 4.0.1
|
972 |
+
*/
|
973 |
public function complete( $status = 'completed' ) {
|
974 |
global $wpdb;
|
975 |
|
976 |
+
// $end_time = new LP_Datetime();
|
977 |
+
// $null_time = null;
|
978 |
|
979 |
+
try {
|
980 |
+
// if ( ! $this->get_end_time() ) {
|
981 |
+
$this->set_end_time( current_time( 'mysql', 1 ) );
|
982 |
+
// }
|
983 |
|
984 |
+
$this->set_status( $status );
|
985 |
+
$this->update();
|
986 |
+
|
987 |
+
/*
|
988 |
+
$query = $wpdb->prepare(
|
989 |
+
"SELECT user_item_id
|
990 |
FROM {$wpdb->prefix}learnpress_user_items
|
991 |
WHERE user_id = %d
|
992 |
AND item_id = %d
|
|
|
993 |
AND status = %s
|
994 |
+
GROUP BY user_item_id DESC
|
995 |
+
LIMIT 1
|
996 |
",
|
997 |
+
$this->get_user_id(),
|
998 |
+
$this->get_item_id(),
|
999 |
+
$status
|
1000 |
+
);
|
1001 |
+
|
1002 |
+
return $wpdb->get_var( $query );*/
|
1003 |
+
} catch ( Throwable $e ) {
|
1004 |
+
error_log( __FUNCTION__ . ':' . $e->getMessage() );
|
1005 |
+
return false;
|
1006 |
+
}
|
1007 |
|
1008 |
+
return true;
|
1009 |
}
|
1010 |
|
1011 |
/**
|
1013 |
* @modify 4.1.2
|
1014 |
* @reason comment - not use
|
1015 |
*/
|
1016 |
+
/*
|
1017 |
+
public function delete_meta_data( $include = '', $exclude = '' ) {
|
1018 |
global $wpdb;
|
1019 |
|
1020 |
$where = '';
|
@@ -430,6 +430,9 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
430 |
*
|
431 |
* @return mixed
|
432 |
* @since 3.0.0
|
|
|
|
|
|
|
433 |
*/
|
434 |
public function get_item_grade( $item_id, $course_id = 0 ) {
|
435 |
if ( ! $course_id ) {
|
@@ -439,10 +442,9 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
439 |
$grade = false;
|
440 |
|
441 |
$course_data = $this->get_course_data( $course_id );
|
442 |
-
$item_result = $course_data->get_item_result( $item_id, false );
|
443 |
|
444 |
-
if ( $course_data
|
445 |
-
$grade =
|
446 |
}
|
447 |
|
448 |
return apply_filters( 'learn-press/user-item-grade', $grade, $item_id, $this->get_id(), $course_id );
|
@@ -477,11 +479,11 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
477 |
* @throws Exception
|
478 |
* @author tungnx
|
479 |
*/
|
480 |
-
public function getItemStatus( $item_id, $course_id ) {
|
481 |
$status = LP_User_Items_DB::getInstance()->get_item_status( $item_id, $course_id );
|
482 |
|
483 |
return $status;
|
484 |
-
}
|
485 |
|
486 |
/**
|
487 |
* Update viewing item data into database.
|
@@ -506,6 +508,10 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
506 |
return $return;
|
507 |
}
|
508 |
|
|
|
|
|
|
|
|
|
509 |
$item->set_ref_id( $course_id );
|
510 |
$item->set_parent_id( $course_data->get_user_item_id() );
|
511 |
|
@@ -698,8 +704,10 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
698 |
*
|
699 |
* @return WP_Error|mixed
|
700 |
* @since 3.0.0
|
|
|
|
|
701 |
*/
|
702 |
-
public function check_question( $question_id, $quiz_id, $course_id ) {
|
703 |
if ( ! $course = learn_press_get_course( $course_id ) ) {
|
704 |
return false;
|
705 |
}
|
@@ -717,7 +725,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
717 |
$quiz_data = $this->get_item_data( $quiz_id, $course_id );
|
718 |
|
719 |
return $quiz_data->check_question( $question_id );
|
720 |
-
}
|
721 |
|
722 |
/**
|
723 |
* Mark question that user has checked.
|
@@ -761,9 +769,10 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
761 |
* @param int $course_id
|
762 |
*
|
763 |
* @return bool
|
|
|
764 |
*/
|
765 |
public function can_check_answer( $quiz_id, $course_id = 0 ) {
|
766 |
-
|
767 |
if ( ! $course_id ) {
|
768 |
$course_id = get_the_ID();
|
769 |
}
|
@@ -815,8 +824,10 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
815 |
* @param bool $force
|
816 |
*
|
817 |
* @return mixed|null|void
|
|
|
|
|
818 |
*/
|
819 |
-
public function get_quiz_history( $quiz_id, $course_id = 0, $history_id = null, $force = false ) {
|
820 |
$course_id = $this->_get_course( $course_id );
|
821 |
|
822 |
$course = learn_press_get_course( $course_id );
|
@@ -922,9 +933,13 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
922 |
$this,
|
923 |
$quiz_id
|
924 |
);
|
925 |
-
}
|
926 |
|
927 |
-
|
|
|
|
|
|
|
|
|
928 |
global $wpdb;
|
929 |
settype( $user_item_id, 'array' );
|
930 |
$in = array_fill( 0, sizeof( $user_item_id ), '%d' );
|
@@ -940,9 +955,13 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
940 |
);
|
941 |
|
942 |
return $wpdb->get_results( $query );
|
943 |
-
}
|
944 |
|
945 |
-
|
|
|
|
|
|
|
|
|
946 |
$course_id = $this->_get_course( $course_id );
|
947 |
|
948 |
$history = $this->get_quiz_history( $quiz_id, $course_id );
|
@@ -952,7 +971,7 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
952 |
}
|
953 |
|
954 |
return $current;
|
955 |
-
}
|
956 |
|
957 |
/**
|
958 |
* Check if user has at least one role.
|
@@ -1178,15 +1197,25 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
1178 |
if ( $course ) {
|
1179 |
$user_course = $this->get_course_data( $course_id );
|
1180 |
|
1181 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1182 |
|
1183 |
-
$user_course->
|
1184 |
|
1185 |
if ( $return ) {
|
1186 |
do_action( 'learn-press/user-course-finished', $course_id, $this->get_id(), $return );
|
1187 |
}
|
1188 |
-
|
1189 |
-
wp_cache_flush();
|
1190 |
}
|
1191 |
|
1192 |
return apply_filters( 'learn-press/user-course-finished-data', $return, $course_id, $this->get_id() );
|
@@ -1563,8 +1592,8 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
1563 |
);
|
1564 |
}
|
1565 |
// TODO: conflict???
|
1566 |
-
|
1567 |
-
$item->set_end_time(
|
1568 |
$item->set_status( 'completed' );
|
1569 |
$item->set_graduation( apply_filters( 'learn-press/complete-lesson-graduation', 'passed' ) );
|
1570 |
|
@@ -2411,12 +2440,16 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
2411 |
return isset( $user_course ) ? $user_course->get_results( 'result' ) : 0;
|
2412 |
}
|
2413 |
|
2414 |
-
|
|
|
|
|
|
|
|
|
2415 |
$course = learn_press_get_course( $course_id );
|
2416 |
$result = $this->evaluate_course_results( $course_id );
|
2417 |
|
2418 |
return $return = $result >= $course->get_passing_condition();
|
2419 |
-
}
|
2420 |
|
2421 |
/**
|
2422 |
* Check if all items in course completed.
|
@@ -2429,13 +2462,13 @@ if ( ! class_exists( 'LP_Abstract_User' ) ) {
|
|
2429 |
|
2430 |
$course_data = $this->get_course_data( $course_id );
|
2431 |
|
2432 |
-
$course_results = $course_data->
|
2433 |
|
2434 |
if ( ! isset( $course_results['completed_items'] ) ) {
|
2435 |
return false;
|
2436 |
}
|
2437 |
|
2438 |
-
return $course_results['completed_items'] >= $course->count_items(
|
2439 |
}
|
2440 |
|
2441 |
public function get_role() {
|
430 |
*
|
431 |
* @return mixed
|
432 |
* @since 3.0.0
|
433 |
+
* @version 1.0.1
|
434 |
+
* @editor tungnx
|
435 |
+
* @modify 4.1.4.1
|
436 |
*/
|
437 |
public function get_item_grade( $item_id, $course_id = 0 ) {
|
438 |
if ( ! $course_id ) {
|
442 |
$grade = false;
|
443 |
|
444 |
$course_data = $this->get_course_data( $course_id );
|
|
|
445 |
|
446 |
+
if ( $course_data ) {
|
447 |
+
$grade = $course_data->get_item_result( $item_id, 'grade' );
|
448 |
}
|
449 |
|
450 |
return apply_filters( 'learn-press/user-item-grade', $grade, $item_id, $this->get_id(), $course_id );
|
479 |
* @throws Exception
|
480 |
* @author tungnx
|
481 |
*/
|
482 |
+
/*public function getItemStatus( $item_id, $course_id ) {
|
483 |
$status = LP_User_Items_DB::getInstance()->get_item_status( $item_id, $course_id );
|
484 |
|
485 |
return $status;
|
486 |
+
}*/
|
487 |
|
488 |
/**
|
489 |
* Update viewing item data into database.
|
508 |
return $return;
|
509 |
}
|
510 |
|
511 |
+
if ( $item instanceof LP_User_Item_Quiz ) {
|
512 |
+
return $return;
|
513 |
+
}
|
514 |
+
|
515 |
$item->set_ref_id( $course_id );
|
516 |
$item->set_parent_id( $course_data->get_user_item_id() );
|
517 |
|
704 |
*
|
705 |
* @return WP_Error|mixed
|
706 |
* @since 3.0.0
|
707 |
+
* @editor tungnx
|
708 |
+
* @modify 4.1.4.1 - comment - not use
|
709 |
*/
|
710 |
+
/*public function check_question( $question_id, $quiz_id, $course_id ) {
|
711 |
if ( ! $course = learn_press_get_course( $course_id ) ) {
|
712 |
return false;
|
713 |
}
|
725 |
$quiz_data = $this->get_item_data( $quiz_id, $course_id );
|
726 |
|
727 |
return $quiz_data->check_question( $question_id );
|
728 |
+
}*/
|
729 |
|
730 |
/**
|
731 |
* Mark question that user has checked.
|
769 |
* @param int $course_id
|
770 |
*
|
771 |
* @return bool
|
772 |
+
* @deprecated 4.1.4.1
|
773 |
*/
|
774 |
public function can_check_answer( $quiz_id, $course_id = 0 ) {
|
775 |
+
_deprecated_function( __FUNCTION__, '4.1.4.1' );
|
776 |
if ( ! $course_id ) {
|
777 |
$course_id = get_the_ID();
|
778 |
}
|
824 |
* @param bool $force
|
825 |
*
|
826 |
* @return mixed|null|void
|
827 |
+
* @editor tungnx
|
828 |
+
* @modify 4.1.4.1 - comment - not use
|
829 |
*/
|
830 |
+
/*public function get_quiz_history( $quiz_id, $course_id = 0, $history_id = null, $force = false ) {
|
831 |
$course_id = $this->_get_course( $course_id );
|
832 |
|
833 |
$course = learn_press_get_course( $course_id );
|
933 |
$this,
|
934 |
$quiz_id
|
935 |
);
|
936 |
+
}*/
|
937 |
|
938 |
+
/**
|
939 |
+
* @editor tungnx
|
940 |
+
* @modify 4.1.4.1 - comment - not use
|
941 |
+
*/
|
942 |
+
/*private function _get_quiz_meta( $user_item_id ) {
|
943 |
global $wpdb;
|
944 |
settype( $user_item_id, 'array' );
|
945 |
$in = array_fill( 0, sizeof( $user_item_id ), '%d' );
|
955 |
);
|
956 |
|
957 |
return $wpdb->get_results( $query );
|
958 |
+
}*/
|
959 |
|
960 |
+
/**
|
961 |
+
* @editor tungnx
|
962 |
+
* @modify 4.1.4.1 comment - not use
|
963 |
+
*/
|
964 |
+
/*public function get_current_results( $quiz_id, $course_id = 0 ) {
|
965 |
$course_id = $this->_get_course( $course_id );
|
966 |
|
967 |
$history = $this->get_quiz_history( $quiz_id, $course_id );
|
971 |
}
|
972 |
|
973 |
return $current;
|
974 |
+
}*/
|
975 |
|
976 |
/**
|
977 |
* Check if user has at least one role.
|
1197 |
if ( $course ) {
|
1198 |
$user_course = $this->get_course_data( $course_id );
|
1199 |
|
1200 |
+
$result = $user_course->calculate_course_results();
|
1201 |
+
|
1202 |
+
// Save result for course
|
1203 |
+
LP_User_Items_Result_DB::instance()->update( $user_course->get_user_item_id(), wp_json_encode( $result ) );
|
1204 |
+
|
1205 |
+
if ( $result['pass'] ) {
|
1206 |
+
$graduation = LP_COURSE_GRADUATION_PASSED;
|
1207 |
+
} else {
|
1208 |
+
$graduation = LP_COURSE_GRADUATION_FAILED;
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
$user_course->set_graduation( $graduation );
|
1212 |
+
$user_course->save();
|
1213 |
|
1214 |
+
$return = $user_course->complete( 'finished' );
|
1215 |
|
1216 |
if ( $return ) {
|
1217 |
do_action( 'learn-press/user-course-finished', $course_id, $this->get_id(), $return );
|
1218 |
}
|
|
|
|
|
1219 |
}
|
1220 |
|
1221 |
return apply_filters( 'learn-press/user-course-finished-data', $return, $course_id, $this->get_id() );
|
1592 |
);
|
1593 |
}
|
1594 |
// TODO: conflict???
|
1595 |
+
//$time = new LP_Datetime();
|
1596 |
+
$item->set_end_time( current_time( 'mysql', 1 ) );
|
1597 |
$item->set_status( 'completed' );
|
1598 |
$item->set_graduation( apply_filters( 'learn-press/complete-lesson-graduation', 'passed' ) );
|
1599 |
|
2440 |
return isset( $user_course ) ? $user_course->get_results( 'result' ) : 0;
|
2441 |
}
|
2442 |
|
2443 |
+
/**
|
2444 |
+
* @editor tungnx
|
2445 |
+
* @modify 4.1.4.1 - comment - not use
|
2446 |
+
*/
|
2447 |
+
/*public function has_reached_passing_condition( $course_id ) {
|
2448 |
$course = learn_press_get_course( $course_id );
|
2449 |
$result = $this->evaluate_course_results( $course_id );
|
2450 |
|
2451 |
return $return = $result >= $course->get_passing_condition();
|
2452 |
+
}*/
|
2453 |
|
2454 |
/**
|
2455 |
* Check if all items in course completed.
|
2462 |
|
2463 |
$course_data = $this->get_course_data( $course_id );
|
2464 |
|
2465 |
+
$course_results = $course_data->get_result();
|
2466 |
|
2467 |
if ( ! isset( $course_results['completed_items'] ) ) {
|
2468 |
return false;
|
2469 |
}
|
2470 |
|
2471 |
+
return $course_results['completed_items'] >= $course->count_items();
|
2472 |
}
|
2473 |
|
2474 |
public function get_role() {
|
@@ -241,7 +241,7 @@ class LP_Profile_Tabs extends LP_Array_Access {
|
|
241 |
$url = get_author_posts_url( $user->get_id() );
|
242 |
}
|
243 |
|
244 |
-
return $url;
|
245 |
}
|
246 |
|
247 |
/**
|
@@ -446,7 +446,7 @@ class LP_Profile_Tab extends LP_Array_Access {
|
|
446 |
}
|
447 |
|
448 |
public function user_can_view() {
|
449 |
-
if ( $this->is_public() ) {
|
450 |
return true;
|
451 |
}
|
452 |
|
241 |
$url = get_author_posts_url( $user->get_id() );
|
242 |
}
|
243 |
|
244 |
+
return apply_filters( 'learnpress/profile/tab/link', $url, $tab, $with_section, $user );
|
245 |
}
|
246 |
|
247 |
/**
|
446 |
}
|
447 |
|
448 |
public function user_can_view() {
|
449 |
+
if ( $this->is_public() || current_user_can( ADMIN_ROLE ) ) {
|
450 |
return true;
|
451 |
}
|
452 |
|
@@ -496,7 +496,9 @@ if ( ! class_exists( 'LP_Profile' ) ) {
|
|
496 |
$tab = substr( $capability, strlen( 'view-tab-' ) );
|
497 |
$public_tabs = $this->get_default_public_tabs();
|
498 |
|
499 |
-
if (
|
|
|
|
|
500 |
$can = true;
|
501 |
} else {
|
502 |
if ( empty( $this->_privacy['view-tab-dashboard'] ) || ( false === $this->_privacy['view-tab-dashboard'] ) ) {
|
@@ -861,8 +863,8 @@ if ( ! class_exists( 'LP_Profile' ) ) {
|
|
861 |
$defaults = array(
|
862 |
'all' => sprintf( '<a href="%s">%s</a>', esc_url( $url ), __( 'All', 'learnpress' ) ),
|
863 |
'completed' => sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( 'filter-status', 'completed', $url ) ), __( 'Finished', 'learnpress' ) ),
|
864 |
-
'passed' => sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( 'filter-
|
865 |
-
'failed' => sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( 'filter-
|
866 |
);
|
867 |
|
868 |
if ( ! $current_filter ) {
|
496 |
$tab = substr( $capability, strlen( 'view-tab-' ) );
|
497 |
$public_tabs = $this->get_default_public_tabs();
|
498 |
|
499 |
+
if ( current_user_can( ADMIN_ROLE ) ) {
|
500 |
+
$can = true;
|
501 |
+
} elseif ( in_array( $tab, $public_tabs ) || $this->is_current_user() ) {
|
502 |
$can = true;
|
503 |
} else {
|
504 |
if ( empty( $this->_privacy['view-tab-dashboard'] ) || ( false === $this->_privacy['view-tab-dashboard'] ) ) {
|
863 |
$defaults = array(
|
864 |
'all' => sprintf( '<a href="%s">%s</a>', esc_url( $url ), __( 'All', 'learnpress' ) ),
|
865 |
'completed' => sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( 'filter-status', 'completed', $url ) ), __( 'Finished', 'learnpress' ) ),
|
866 |
+
'passed' => sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( 'filter-graduation', 'passed', $url ) ), __( 'Passed', 'learnpress' ) ),
|
867 |
+
'failed' => sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( 'filter-graduation', 'failed', $url ) ), __( 'Failed', 'learnpress' ) ),
|
868 |
);
|
869 |
|
870 |
if ( ! $current_filter ) {
|
@@ -273,6 +273,10 @@ class LP_User_Factory {
|
|
273 |
|
274 |
$user_item_data = apply_filters( 'learnpress/lp_order/item/handle_item_manual_order_completed', $user_item_data, $order, $user, $course, $item );
|
275 |
|
|
|
|
|
|
|
|
|
276 |
if ( isset( $user_item_data['status'] ) ) {
|
277 |
$user_item_new = new LP_User_Item_Course( $user_item_data );
|
278 |
$result = $user_item_new->update();
|
273 |
|
274 |
$user_item_data = apply_filters( 'learnpress/lp_order/item/handle_item_manual_order_completed', $user_item_data, $order, $user, $course, $item );
|
275 |
|
276 |
+
// Delete lp_user_items old
|
277 |
+
LP_User_Items_DB::getInstance()->delete_user_items_old( $user->get_id(), $course->get_id() );
|
278 |
+
// End
|
279 |
+
|
280 |
if ( isset( $user_item_data['status'] ) ) {
|
281 |
$user_item_new = new LP_User_Item_Course( $user_item_data );
|
282 |
$result = $user_item_new->update();
|
@@ -210,11 +210,11 @@ class LP_User extends LP_Abstract_User {
|
|
210 |
$result_check->message = '';
|
211 |
|
212 |
try {
|
213 |
-
|
214 |
|
215 |
if ( ! $order || ! $order->is_completed() ) {
|
216 |
throw new Exception( esc_html__( 'Order is not completed', 'learnpress' ) );
|
217 |
-
}
|
218 |
|
219 |
$user_course = $this->get_course_data( $course_id );
|
220 |
|
@@ -329,9 +329,10 @@ class LP_User extends LP_Abstract_User {
|
|
329 |
* @throws Exception
|
330 |
* @author nhamdv
|
331 |
* @editor tungnx
|
332 |
-
* @modify 4.1.
|
|
|
333 |
*/
|
334 |
-
public function can_purchase_course( int $course_id ): bool {
|
335 |
$can_purchase = true;
|
336 |
$course = learn_press_get_course( $course_id );
|
337 |
|
@@ -348,6 +349,15 @@ class LP_User extends LP_Abstract_User {
|
|
348 |
throw new Exception( 'Course is free' );
|
349 |
}
|
350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
if ( $this->can_retry_course( $course_id ) ) {
|
352 |
throw new Exception( 'Course is has retake' );
|
353 |
}
|
@@ -412,11 +422,11 @@ class LP_User extends LP_Abstract_User {
|
|
412 |
* @return array
|
413 |
* @author nhamdv
|
414 |
* @editor tungnx
|
415 |
-
* @version 1.0.
|
416 |
*/
|
417 |
public function can_show_finish_course_btn( $course ): array {
|
418 |
$return = array(
|
419 |
-
'status' => '
|
420 |
'message' => '',
|
421 |
);
|
422 |
|
@@ -427,37 +437,44 @@ class LP_User extends LP_Abstract_User {
|
|
427 |
|
428 |
$course_id = $course->get_id();
|
429 |
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
$course_data = $this->get_course_data( $course_id );
|
434 |
-
$course_results = $course_data->calculate_course_results();
|
435 |
-
// End
|
436 |
|
437 |
-
|
438 |
-
|
|
|
439 |
|
440 |
if ( ! $this->is_course_in_progress( $course_id ) ) {
|
441 |
throw new Exception( esc_html__( 'Error: Course is not in-progress.', 'learnpress' ) );
|
442 |
}
|
443 |
|
444 |
-
$
|
445 |
-
$is_passed = $this->has_reached_passing_condition( $course_id );
|
446 |
|
447 |
-
if (
|
448 |
-
|
449 |
-
|
|
|
|
|
|
|
450 |
|
451 |
-
|
452 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
}
|
454 |
|
455 |
if ( ! apply_filters( 'lp_can_finish_course', true ) ) {
|
456 |
throw new Exception( esc_html__( 'Error: Filter disable finish course.', 'learnpress' ) );
|
457 |
}
|
458 |
-
|
459 |
-
$return['status'] = 'success';
|
460 |
} catch ( Exception $e ) {
|
|
|
461 |
$return['message'] = $e->getMessage();
|
462 |
}
|
463 |
|
@@ -577,15 +594,6 @@ class LP_User extends LP_Abstract_User {
|
|
577 |
$return = false;
|
578 |
|
579 |
try {
|
580 |
-
// Validate course and quiz
|
581 |
-
/*_verify_course_item = $this->_verify_course_item( $quiz_id, $course_id );
|
582 |
-
if ( $course_id ) {
|
583 |
-
throw new Exception(
|
584 |
-
__( 'Course is not exists or does not contain the quiz', 'learnpress' ),
|
585 |
-
LP_INVALID_QUIZ_OR_COURSE
|
586 |
-
);
|
587 |
-
}*/
|
588 |
-
|
589 |
// If user has already finished the course
|
590 |
if ( $this->has_finished_course( $course_id ) ) {
|
591 |
throw new Exception(
|
@@ -603,13 +611,15 @@ class LP_User extends LP_Abstract_User {
|
|
603 |
);
|
604 |
}
|
605 |
|
|
|
|
|
|
|
606 |
$user_quiz = $this->get_item_data( $quiz_id, $course_id );
|
607 |
-
|
608 |
-
$user_quiz->finish();
|
609 |
|
610 |
do_action( 'learn-press/user/quiz-finished', $quiz_id, $course_id, $this->get_id() );
|
611 |
} catch ( Exception $ex ) {
|
612 |
-
$return = $wp_error ? new WP_Error( $ex->getCode(), $ex->getMessage() ) :
|
613 |
}
|
614 |
|
615 |
return $return;
|
@@ -694,4 +704,41 @@ class LP_User extends LP_Abstract_User {
|
|
694 |
|
695 |
return $return;
|
696 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
697 |
}
|
210 |
$result_check->message = '';
|
211 |
|
212 |
try {
|
213 |
+
/*$order = $this->get_course_order( $course_id );
|
214 |
|
215 |
if ( ! $order || ! $order->is_completed() ) {
|
216 |
throw new Exception( esc_html__( 'Order is not completed', 'learnpress' ) );
|
217 |
+
}*/
|
218 |
|
219 |
$user_course = $this->get_course_data( $course_id );
|
220 |
|
329 |
* @throws Exception
|
330 |
* @author nhamdv
|
331 |
* @editor tungnx
|
332 |
+
* @modify 4.1.4
|
333 |
+
* @version 1.0.3
|
334 |
*/
|
335 |
+
public function can_purchase_course( int $course_id = 0 ): bool {
|
336 |
$can_purchase = true;
|
337 |
$course = learn_press_get_course( $course_id );
|
338 |
|
349 |
throw new Exception( 'Course is free' );
|
350 |
}
|
351 |
|
352 |
+
if ( $course->get_external_link() ) {
|
353 |
+
throw new Exception( 'Course is type external, so can not purchase' );
|
354 |
+
}
|
355 |
+
|
356 |
+
// Course is not require enrolling.
|
357 |
+
if ( $course->is_no_required_enroll() ) {
|
358 |
+
throw new Exception( 'Course is type no required enroll' );
|
359 |
+
}
|
360 |
+
|
361 |
if ( $this->can_retry_course( $course_id ) ) {
|
362 |
throw new Exception( 'Course is has retake' );
|
363 |
}
|
422 |
* @return array
|
423 |
* @author nhamdv
|
424 |
* @editor tungnx
|
425 |
+
* @version 1.0.2
|
426 |
*/
|
427 |
public function can_show_finish_course_btn( $course ): array {
|
428 |
$return = array(
|
429 |
+
'status' => 'success',
|
430 |
'message' => '',
|
431 |
);
|
432 |
|
437 |
|
438 |
$course_id = $course->get_id();
|
439 |
|
440 |
+
if ( $this->has_finished_course( $course_id ) ) {
|
441 |
+
throw new Exception( esc_html__( 'Course is has finished.', 'learnpress' ) );
|
442 |
+
}
|
|
|
|
|
|
|
443 |
|
444 |
+
if ( ! $this->has_enrolled_course( $course_id ) ) {
|
445 |
+
throw new Exception( esc_html__( 'Course is not enroll.', 'learnpress' ) );
|
446 |
+
}
|
447 |
|
448 |
if ( ! $this->is_course_in_progress( $course_id ) ) {
|
449 |
throw new Exception( esc_html__( 'Error: Course is not in-progress.', 'learnpress' ) );
|
450 |
}
|
451 |
|
452 |
+
$course_data = $this->get_course_data( $course_id );
|
|
|
453 |
|
454 |
+
if ( $course_data ) {
|
455 |
+
$course_result = $course_data->get_result();
|
456 |
+
|
457 |
+
if ( ! $course_result['pass'] ) {
|
458 |
+
// Get option Can finish course if completed all item without pass
|
459 |
+
$can_finish = get_post_meta( $course_id, '_lp_has_finish', true ) ?? 'yes';
|
460 |
|
461 |
+
if ( $can_finish == 'yes' ) {
|
462 |
+
// Check completed all items
|
463 |
+
$is_all_completed = $this->is_completed_all_items( $course_id );
|
464 |
+
if ( ! $is_all_completed ) {
|
465 |
+
throw new Exception( 'All items not completed and Course not pass' );
|
466 |
+
}
|
467 |
+
} else {
|
468 |
+
throw new Exception( 'Course not pass' );
|
469 |
+
}
|
470 |
+
}
|
471 |
}
|
472 |
|
473 |
if ( ! apply_filters( 'lp_can_finish_course', true ) ) {
|
474 |
throw new Exception( esc_html__( 'Error: Filter disable finish course.', 'learnpress' ) );
|
475 |
}
|
|
|
|
|
476 |
} catch ( Exception $e ) {
|
477 |
+
$return['status'] = 'false';
|
478 |
$return['message'] = $e->getMessage();
|
479 |
}
|
480 |
|
594 |
$return = false;
|
595 |
|
596 |
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
// If user has already finished the course
|
598 |
if ( $this->has_finished_course( $course_id ) ) {
|
599 |
throw new Exception(
|
611 |
);
|
612 |
}
|
613 |
|
614 |
+
/**
|
615 |
+
* @var LP_User_Item_Quiz $user_quiz
|
616 |
+
*/
|
617 |
$user_quiz = $this->get_item_data( $quiz_id, $course_id );
|
618 |
+
$user_quiz->complete();
|
|
|
619 |
|
620 |
do_action( 'learn-press/user/quiz-finished', $quiz_id, $course_id, $this->get_id() );
|
621 |
} catch ( Exception $ex ) {
|
622 |
+
$return = $wp_error ? new WP_Error( $ex->getCode(), $ex->getMessage() ) : true;
|
623 |
}
|
624 |
|
625 |
return $return;
|
704 |
|
705 |
return $return;
|
706 |
}
|
707 |
+
|
708 |
+
/**
|
709 |
+
* Get quiz's user learning or completed
|
710 |
+
*
|
711 |
+
* @param LP_User_Items_Filter $filter
|
712 |
+
*
|
713 |
+
* @return LP_Query_List_Table
|
714 |
+
*/
|
715 |
+
public function get_user_quizzes( LP_User_Items_Filter $filter ): LP_Query_List_Table {
|
716 |
+
$quizzes = [
|
717 |
+
'total' => 0,
|
718 |
+
'items' => [],
|
719 |
+
'pages' => 0,
|
720 |
+
];
|
721 |
+
|
722 |
+
try {
|
723 |
+
$user_quizzes = LP_User_Items_DB::getInstance()->get_user_quizzes( $filter );
|
724 |
+
|
725 |
+
if ( $user_quizzes ) {
|
726 |
+
$count = LP_User_Items_DB::getInstance()->wpdb->get_var( 'SELECT FOUND_ROWS()' );
|
727 |
+
|
728 |
+
$quizzes['total'] = $count;
|
729 |
+
$quizzes['pages'] = ceil( $count / $filter->limit );
|
730 |
+
|
731 |
+
foreach ( $user_quizzes as $item ) {
|
732 |
+
$quizzes['items'][] = new LP_User_Item_Quiz( $item );
|
733 |
+
}
|
734 |
+
}
|
735 |
+
|
736 |
+
$quizzes['single'] = __( 'quiz', 'learnpress' );
|
737 |
+
$quizzes['plural'] = __( 'quizzes', 'learnpress' );
|
738 |
+
} catch ( Throwable $e ) {
|
739 |
+
error_log( __FUNCTION__ . ': ' . $e->getMessage() );
|
740 |
+
}
|
741 |
+
|
742 |
+
return new LP_Query_List_Table( $quizzes );
|
743 |
+
}
|
744 |
}
|
@@ -1462,7 +1462,7 @@ function learn_press_hk_before_start_quiz( $true, $quiz_id, $course_id, $user_id
|
|
1462 |
|
1463 |
add_filter( 'learn-press/before-start-quiz', 'learn_press_hk_before_start_quiz', 10, 4 );
|
1464 |
|
1465 |
-
function learn_press_default_user_item_status( $item_id ) {
|
1466 |
$status = '';
|
1467 |
switch ( learn_press_get_post_type( $item_id ) ) {
|
1468 |
case LP_LESSON_CPT:
|
@@ -1476,7 +1476,7 @@ function learn_press_default_user_item_status( $item_id ) {
|
|
1476 |
}
|
1477 |
|
1478 |
return apply_filters( 'learn-press/default-user-item-status', $status, $item_id );
|
1479 |
-
}
|
1480 |
|
1481 |
/**
|
1482 |
* Get current state of distraction mode
|
@@ -1619,8 +1619,8 @@ function learn_press_create_user_item_for_quiz( $args = array(), $wp_error = fal
|
|
1619 |
$args,
|
1620 |
array(
|
1621 |
'item_type' => LP_QUIZ_CPT,
|
1622 |
-
'status' =>
|
1623 |
-
'graduation' =>
|
1624 |
'user_id' => get_current_user_id(),
|
1625 |
)
|
1626 |
);
|
@@ -1713,6 +1713,9 @@ function learn_press_user_start_quiz( $quiz_id, $user_id = 0, $course_id = 0, $w
|
|
1713 |
do_action( 'learn-press/user-started-quiz', $user_quiz, $quiz_id, $user_id, $course_id );
|
1714 |
}
|
1715 |
|
|
|
|
|
|
|
1716 |
return $user_quiz;
|
1717 |
}
|
1718 |
|
@@ -1744,7 +1747,7 @@ function learn_press_user_retake_quiz( $quiz_id, $user_id = 0, $course_id = 0, $
|
|
1744 |
WHERE user_item_id = (SELECT max(user_item_id)
|
1745 |
FROM {$wpdb->learnpress_user_items}
|
1746 |
WHERE user_id = %d AND item_id = %d AND status IN ('enrolled', 'in-progress'))
|
1747 |
-
|
1748 |
$user_id,
|
1749 |
$course_id
|
1750 |
);
|
@@ -1775,21 +1778,24 @@ function learn_press_user_retake_quiz( $quiz_id, $user_id = 0, $course_id = 0, $
|
|
1775 |
// Remove user_item_meta.
|
1776 |
learn_press_delete_user_item_meta( $data->user_item_id, '_lp_question_checked' );
|
1777 |
|
1778 |
-
$user_item->set_status(
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
|
|
|
|
|
|
1783 |
|
1784 |
// Error Retake when change timezone - Nhamdv
|
1785 |
-
learn_press_update_user_item_field(
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
);
|
1793 |
|
1794 |
return $user_item;
|
1795 |
}
|
@@ -1851,10 +1857,11 @@ function learn_press_rest_prepare_user_questions( array $question_ids = array(),
|
|
1851 |
$mark = $question->get_mark() ? $question->get_mark() : 1;
|
1852 |
|
1853 |
$questionData = array(
|
1854 |
-
'
|
1855 |
-
'
|
1856 |
-
'
|
1857 |
-
'
|
|
|
1858 |
);
|
1859 |
|
1860 |
$content = $question->get_content();
|
@@ -2199,10 +2206,16 @@ function learn_press_get_user_extra_profile_fields() {
|
|
2199 |
return apply_filters( 'learn-press/user-extra-profile-fields', $fields );
|
2200 |
}
|
2201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2202 |
function learn_press_user_profile_data( $user ) {
|
2203 |
learn_press_admin_view( 'user/courses.php', array( 'user_id' => $user->ID ) );
|
2204 |
}
|
2205 |
-
|
2206 |
add_action( 'show_user_profile', 'learn_press_user_profile_data', 1000 );
|
2207 |
add_action( 'edit_user_profile', 'learn_press_user_profile_data', 1000 );
|
2208 |
|
@@ -2251,7 +2264,8 @@ function learnpress_get_count_by_user( $user_id = '', $post_type = 'lp_course' )
|
|
2251 |
|
2252 |
}
|
2253 |
|
2254 |
-
/*
|
|
|
2255 |
'admin_init',
|
2256 |
function() {
|
2257 |
$custom_fields = LP()->settings()->get( 'register_profile_fields' );
|
1462 |
|
1463 |
add_filter( 'learn-press/before-start-quiz', 'learn_press_hk_before_start_quiz', 10, 4 );
|
1464 |
|
1465 |
+
/*function learn_press_default_user_item_status( $item_id ) {
|
1466 |
$status = '';
|
1467 |
switch ( learn_press_get_post_type( $item_id ) ) {
|
1468 |
case LP_LESSON_CPT:
|
1476 |
}
|
1477 |
|
1478 |
return apply_filters( 'learn-press/default-user-item-status', $status, $item_id );
|
1479 |
+
}*/
|
1480 |
|
1481 |
/**
|
1482 |
* Get current state of distraction mode
|
1619 |
$args,
|
1620 |
array(
|
1621 |
'item_type' => LP_QUIZ_CPT,
|
1622 |
+
'status' => LP_ITEM_STARTED,
|
1623 |
+
'graduation' => LP_COURSE_GRADUATION_IN_PROGRESS,
|
1624 |
'user_id' => get_current_user_id(),
|
1625 |
)
|
1626 |
);
|
1713 |
do_action( 'learn-press/user-started-quiz', $user_quiz, $quiz_id, $user_id, $course_id );
|
1714 |
}
|
1715 |
|
1716 |
+
// Reset first cache
|
1717 |
+
$user_quiz->get_status( 'status', true );
|
1718 |
+
|
1719 |
return $user_quiz;
|
1720 |
}
|
1721 |
|
1747 |
WHERE user_item_id = (SELECT max(user_item_id)
|
1748 |
FROM {$wpdb->learnpress_user_items}
|
1749 |
WHERE user_id = %d AND item_id = %d AND status IN ('enrolled', 'in-progress'))
|
1750 |
+
",
|
1751 |
$user_id,
|
1752 |
$course_id
|
1753 |
);
|
1778 |
// Remove user_item_meta.
|
1779 |
learn_press_delete_user_item_meta( $data->user_item_id, '_lp_question_checked' );
|
1780 |
|
1781 |
+
$user_item->set_status( LP_ITEM_STARTED )
|
1782 |
+
->set_start_time( current_time( 'mysql', 1 ) ) // Error Retake when change timezone - Nhamdv
|
1783 |
+
->set_end_time( '' )
|
1784 |
+
->set_graduation( LP_COURSE_GRADUATION_IN_PROGRESS )
|
1785 |
+
->update();
|
1786 |
+
|
1787 |
+
// Reset first cache
|
1788 |
+
$user_item->get_status( 'status', true );
|
1789 |
|
1790 |
// Error Retake when change timezone - Nhamdv
|
1791 |
+
// learn_press_update_user_item_field(
|
1792 |
+
// array(
|
1793 |
+
// 'start_time' => current_time( 'mysql', true ),
|
1794 |
+
// ),
|
1795 |
+
// array(
|
1796 |
+
// 'user_item_id' => $data->user_item_id,
|
1797 |
+
// )
|
1798 |
+
// );
|
1799 |
|
1800 |
return $user_item;
|
1801 |
}
|
1857 |
$mark = $question->get_mark() ? $question->get_mark() : 1;
|
1858 |
|
1859 |
$questionData = array(
|
1860 |
+
'object' => $question,
|
1861 |
+
'id' => absint( $id ),
|
1862 |
+
'title' => $question->get_title(),
|
1863 |
+
'type' => $question->get_type(),
|
1864 |
+
'point' => $mark,
|
1865 |
);
|
1866 |
|
1867 |
$content = $question->get_content();
|
2206 |
return apply_filters( 'learn-press/user-extra-profile-fields', $fields );
|
2207 |
}
|
2208 |
|
2209 |
+
/**
|
2210 |
+
* Show courses user enrolled on backend
|
2211 |
+
*
|
2212 |
+
* @param $user
|
2213 |
+
*
|
2214 |
+
* @return void
|
2215 |
+
*/
|
2216 |
function learn_press_user_profile_data( $user ) {
|
2217 |
learn_press_admin_view( 'user/courses.php', array( 'user_id' => $user->ID ) );
|
2218 |
}
|
|
|
2219 |
add_action( 'show_user_profile', 'learn_press_user_profile_data', 1000 );
|
2220 |
add_action( 'edit_user_profile', 'learn_press_user_profile_data', 1000 );
|
2221 |
|
2264 |
|
2265 |
}
|
2266 |
|
2267 |
+
/*
|
2268 |
+
add_action(
|
2269 |
'admin_init',
|
2270 |
function() {
|
2271 |
$custom_fields = LP()->settings()->get( 'register_profile_fields' );
|
@@ -61,26 +61,29 @@ if ( ! class_exists( 'LP_Widget_Course_Progress' ) ) {
|
|
61 |
}
|
62 |
|
63 |
$course = learn_press_get_course( $instance['course_id'] );
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
if ( ! $user->has_enrolled_or_finished( $instance['course_id'] ) ) {
|
67 |
return new WP_Error( 'no_enroll', sprintf( esc_html__( 'You haven\'t started %s', 'learnpress' ), $course->get_title() ) );
|
68 |
}
|
69 |
|
70 |
-
$
|
71 |
|
72 |
-
|
73 |
-
return learn_press_get_template_content(
|
74 |
-
'widgets/course-progress',
|
75 |
-
array(
|
76 |
-
'course' => $course,
|
77 |
-
'user' => $user,
|
78 |
-
'instance' => $instance,
|
79 |
-
)
|
80 |
-
);
|
81 |
-
}
|
82 |
|
83 |
-
return
|
|
|
|
|
|
|
84 |
}
|
85 |
}
|
86 |
}
|
61 |
}
|
62 |
|
63 |
$course = learn_press_get_course( $instance['course_id'] );
|
64 |
+
if ( ! $course ) {
|
65 |
+
return new WP_Error( 'no_course', esc_html__( 'Course is invalid', 'learnpress' ) );
|
66 |
+
}
|
67 |
+
|
68 |
+
$user = learn_press_get_user( $user_id );
|
69 |
+
|
70 |
+
$course_data = $user->get_course_data( $course->get_id() );
|
71 |
+
if ( ! $course_data ) {
|
72 |
+
return new WP_Error( 'no_enroll', sprintf( esc_html__( 'You haven\'t started %s', 'learnpress' ), $course->get_title() ) );
|
73 |
+
}
|
74 |
|
75 |
if ( ! $user->has_enrolled_or_finished( $instance['course_id'] ) ) {
|
76 |
return new WP_Error( 'no_enroll', sprintf( esc_html__( 'You haven\'t started %s', 'learnpress' ), $course->get_title() ) );
|
77 |
}
|
78 |
|
79 |
+
$course_results = $course_data->get_result();
|
80 |
|
81 |
+
$instance['css_class'] = $instance['css_class'] ?? '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
return learn_press_get_template_content(
|
84 |
+
'widgets/course-progress',
|
85 |
+
compact( 'user', 'course', 'instance', 'course_data', 'course_results' )
|
86 |
+
);
|
87 |
}
|
88 |
}
|
89 |
}
|
@@ -7262,7 +7262,7 @@ msgstr ""
|
|
7262 |
#: templates/profile/tabs/quizzes.php:39
|
7263 |
#: assets/js/dist/frontend/quiz.js:22
|
7264 |
#: assets/js/dist/frontend/quiz.js:191
|
7265 |
-
msgid "Time
|
7266 |
msgstr ""
|
7267 |
|
7268 |
#: templates/profile/tabs/quizzes.php:97
|
@@ -7491,7 +7491,7 @@ msgid "Your Result"
|
|
7491 |
msgstr ""
|
7492 |
|
7493 |
#: assets/js/dist/frontend/quiz.js:195
|
7494 |
-
msgid "
|
7495 |
msgstr ""
|
7496 |
|
7497 |
#: assets/js/dist/frontend/quiz.js:203
|
7262 |
#: templates/profile/tabs/quizzes.php:39
|
7263 |
#: assets/js/dist/frontend/quiz.js:22
|
7264 |
#: assets/js/dist/frontend/quiz.js:191
|
7265 |
+
msgid "Time spent"
|
7266 |
msgstr ""
|
7267 |
|
7268 |
#: templates/profile/tabs/quizzes.php:97
|
7491 |
msgstr ""
|
7492 |
|
7493 |
#: assets/js/dist/frontend/quiz.js:195
|
7494 |
+
msgid "Points"
|
7495 |
msgstr ""
|
7496 |
|
7497 |
#: assets/js/dist/frontend/quiz.js:203
|
@@ -4,10 +4,10 @@
|
|
4 |
* Plugin URI: http://thimpress.com/learnpress
|
5 |
* Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
|
6 |
* Author: ThimPress
|
7 |
-
* Version: 4.1.4
|
8 |
* Author URI: http://thimpress.com
|
9 |
* Requires at least: 5.6
|
10 |
-
* Tested up to: 5.8
|
11 |
* Requires PHP: 7.0
|
12 |
* Text Domain: learnpress
|
13 |
* Domain Path: /languages/
|
@@ -247,6 +247,7 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
247 |
require_once 'inc/filters/class-lp-post-type-filter.php';
|
248 |
require_once 'inc/filters/class-lp-course-filter.php';
|
249 |
require_once 'inc/filters/class-lp-order-filter.php';
|
|
|
250 |
require_once 'inc/filters/class-lp-question-filter.php';
|
251 |
require_once 'inc/filters/class-lp-user-items-filter.php';
|
252 |
|
@@ -374,7 +375,7 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
374 |
require_once 'inc/class-lp-multi-language.php';
|
375 |
require_once 'inc/class-lp-page-controller.php';
|
376 |
require_once 'inc/class-lp-schedules.php';
|
377 |
-
//require_once 'inc/class-lp-preview-course.php';
|
378 |
|
379 |
require_once 'inc/class-lp-widget.php';
|
380 |
require_once 'inc/lp-widget-functions.php';
|
@@ -400,7 +401,8 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
400 |
include_once 'inc/jwt/class-jwt-auth.php';
|
401 |
|
402 |
// Comment by tungnx
|
403 |
-
/*
|
|
|
404 |
include_once 'local-debug.php';
|
405 |
}*/
|
406 |
|
@@ -460,9 +462,9 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
460 |
*
|
461 |
* @return string
|
462 |
*/
|
463 |
-
//
|
464 |
-
//
|
465 |
-
//
|
466 |
|
467 |
/**
|
468 |
* Magic function to get Learnpress data.
|
@@ -474,7 +476,8 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
474 |
* @editor tungnx
|
475 |
* @modify 4.1.3.1 - comment
|
476 |
*/
|
477 |
-
/*
|
|
|
478 |
return false;
|
479 |
}*/
|
480 |
|
@@ -553,7 +556,7 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
553 |
|
554 |
$this->init();
|
555 |
|
556 |
-
//Todo: tungnx - remove this code after handle ajax on page learn-press-addons
|
557 |
require_once 'inc/background-process/class-lp-background-query-items.php';
|
558 |
require_once 'inc/background-process/class-lp-background-installer.php';
|
559 |
|
@@ -585,7 +588,7 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
585 |
)
|
586 |
);
|
587 |
|
588 |
-
|
589 |
$lp_addon_version = $lp_addon_info['Version'];
|
590 |
|
591 |
$addon = new Lp_Addon();
|
@@ -645,7 +648,7 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
645 |
$this->admin_api = new LP_Admin_Core_API();
|
646 |
$this->theme_support = LP_Theme_Support::instance();
|
647 |
|
648 |
-
|
649 |
|
650 |
$this->get_session();
|
651 |
|
@@ -671,7 +674,8 @@ if ( ! class_exists( 'LearnPress' ) ) {
|
|
671 |
* @deprecated 3.2.8
|
672 |
* @editor tungnx
|
673 |
*/
|
674 |
-
/*
|
|
|
675 |
if ( ! empty( $_REQUEST['view-log'] ) ) {
|
676 |
$log = LP_Helper::sanitize_params_submitted( $_REQUEST['view-log'] );
|
677 |
echo '<pre>';
|
4 |
* Plugin URI: http://thimpress.com/learnpress
|
5 |
* Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
|
6 |
* Author: ThimPress
|
7 |
+
* Version: 4.1.4.1
|
8 |
* Author URI: http://thimpress.com
|
9 |
* Requires at least: 5.6
|
10 |
+
* Tested up to: 5.8
|
11 |
* Requires PHP: 7.0
|
12 |
* Text Domain: learnpress
|
13 |
* Domain Path: /languages/
|
247 |
require_once 'inc/filters/class-lp-post-type-filter.php';
|
248 |
require_once 'inc/filters/class-lp-course-filter.php';
|
249 |
require_once 'inc/filters/class-lp-order-filter.php';
|
250 |
+
require_once 'inc/filters/class-lp-section-filter.php';
|
251 |
require_once 'inc/filters/class-lp-question-filter.php';
|
252 |
require_once 'inc/filters/class-lp-user-items-filter.php';
|
253 |
|
375 |
require_once 'inc/class-lp-multi-language.php';
|
376 |
require_once 'inc/class-lp-page-controller.php';
|
377 |
require_once 'inc/class-lp-schedules.php';
|
378 |
+
// require_once 'inc/class-lp-preview-course.php';
|
379 |
|
380 |
require_once 'inc/class-lp-widget.php';
|
381 |
require_once 'inc/lp-widget-functions.php';
|
401 |
include_once 'inc/jwt/class-jwt-auth.php';
|
402 |
|
403 |
// Comment by tungnx
|
404 |
+
/*
|
405 |
+
if ( file_exists( LP_PLUGIN_PATH . '/local-debug.php' ) ) {
|
406 |
include_once 'local-debug.php';
|
407 |
}*/
|
408 |
|
462 |
*
|
463 |
* @return string
|
464 |
*/
|
465 |
+
// private function plugin_basename() {
|
466 |
+
// return learn_press_plugin_basename( __FILE__ );
|
467 |
+
// }
|
468 |
|
469 |
/**
|
470 |
* Magic function to get Learnpress data.
|
476 |
* @editor tungnx
|
477 |
* @modify 4.1.3.1 - comment
|
478 |
*/
|
479 |
+
/*
|
480 |
+
public function __get( $key ) {
|
481 |
return false;
|
482 |
}*/
|
483 |
|
556 |
|
557 |
$this->init();
|
558 |
|
559 |
+
// Todo: tungnx - remove this code after handle ajax on page learn-press-addons
|
560 |
require_once 'inc/background-process/class-lp-background-query-items.php';
|
561 |
require_once 'inc/background-process/class-lp-background-installer.php';
|
562 |
|
588 |
)
|
589 |
);
|
590 |
|
591 |
+
// $lp_addon_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $lp_addon );
|
592 |
$lp_addon_version = $lp_addon_info['Version'];
|
593 |
|
594 |
$addon = new Lp_Addon();
|
648 |
$this->admin_api = new LP_Admin_Core_API();
|
649 |
$this->theme_support = LP_Theme_Support::instance();
|
650 |
|
651 |
+
// $this->view_log();
|
652 |
|
653 |
$this->get_session();
|
654 |
|
674 |
* @deprecated 3.2.8
|
675 |
* @editor tungnx
|
676 |
*/
|
677 |
+
/*
|
678 |
+
public function view_log() {
|
679 |
if ( ! empty( $_REQUEST['view-log'] ) ) {
|
680 |
$log = LP_Helper::sanitize_params_submitted( $_REQUEST['view-log'] );
|
681 |
echo '<pre>';
|
@@ -5,7 +5,7 @@ Tags: elearning, education, course, lms, learning management system
|
|
5 |
Requires at least: 5.6
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 7.0
|
8 |
-
Stable tag: 4.1.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -197,6 +197,28 @@ https://www.transifex.com/projects/p/learnpress/
|
|
197 |
|
198 |
== Changelog ==
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
= 4.1.4 (2021-11-08) =
|
201 |
~ Fixed security: when user share profile, another user can see settings as change password, change info.
|
202 |
~ Modify: not scroll to title courses when load first.
|
@@ -221,7 +243,7 @@ https://www.transifex.com/projects/p/learnpress/
|
|
221 |
~ Fixed: error user login with mail buy as Guest and LP Oder completed but can't view course.
|
222 |
~ Fixed: error, <a href="https://blog.szfszf.top/static/papers/LearnPress_4.1.3.2_sql_injection_1cf8665be17b7708a3f180067fd2d50b.html">sql injection</a>, sanitize feature duplicate post (Course, Lesson, Quiz v.v...)
|
223 |
|
224 |
-
= 4.1.3.2 (2021-
|
225 |
~ Fixed: security CVE-2021-39348, set sanitize for some params missing.
|
226 |
|
227 |
= 4.1.3.1 (2021-09-15) =
|
5 |
Requires at least: 5.6
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 7.0
|
8 |
+
Stable tag: 4.1.4.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
197 |
|
198 |
== Changelog ==
|
199 |
|
200 |
+
= 4.1.4.1 (2021-12-22) =
|
201 |
+
~ Added: settings redirect when finish course.
|
202 |
+
~ Added: enqueue script by shortcode button purchase.
|
203 |
+
~ Fixed: error save value on the textarea format code HTML.
|
204 |
+
~ Fixed: error timezone is different UTC-0 will finish quiz soon.
|
205 |
+
~ Save info total items (quiz, question,...) of course when saving the course - improve performance.
|
206 |
+
~ Fixed: error change user Guest to another user on LP Order not save.
|
207 |
+
~ Fixed: Guest buy course with user exists.
|
208 |
+
~ Fixed: Guest buy course with create account.
|
209 |
+
~ Fixed: High CPU (many query) when user login view single course.
|
210 |
+
~ Fixed: No require enroll.
|
211 |
+
~ Changed: view course's user on the Backend to the profile's user.
|
212 |
+
~ Modified: submit quiz, get result course, quiz.
|
213 |
+
~ Fixed: query get orders on Profile page.
|
214 |
+
~ Fixed: query get orders by user (multiple user) on the Backend.
|
215 |
+
~ Modified: delete course will delete section, section_items, lp_user_items, user_itemmeta.
|
216 |
+
~ Saved: info total items of course when save course - to make call fast.
|
217 |
+
~ Rewrite: function count total items of the Course.
|
218 |
+
~ Fixed: get course id when click Get Passing Grade in Evaluate via results of the final quiz.
|
219 |
+
~ Fixed: count Unassigned questions.
|
220 |
+
~ Changed logic check "fill in blank" question: user answer right all fields will get point of question, one of answer wrong, the question is fail and get point = 0.
|
221 |
+
|
222 |
= 4.1.4 (2021-11-08) =
|
223 |
~ Fixed security: when user share profile, another user can see settings as change password, change info.
|
224 |
~ Modify: not scroll to title courses when load first.
|
243 |
~ Fixed: error user login with mail buy as Guest and LP Oder completed but can't view course.
|
244 |
~ Fixed: error, <a href="https://blog.szfszf.top/static/papers/LearnPress_4.1.3.2_sql_injection_1cf8665be17b7708a3f180067fd2d50b.html">sql injection</a>, sanitize feature duplicate post (Course, Lesson, Quiz v.v...)
|
245 |
|
246 |
+
= 4.1.3.2 (2021-10-15) =
|
247 |
~ Fixed: security CVE-2021-39348, set sanitize for some params missing.
|
248 |
|
249 |
= 4.1.3.1 (2021-09-15) =
|
@@ -42,6 +42,14 @@ echo wp_sprintf(
|
|
42 |
|
43 |
?>
|
44 |
<table class="order_details">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<tr class="order">
|
46 |
<th><?php esc_html_e( 'Order Number', 'learnpress' ); ?></th>
|
47 |
<td>
|
42 |
|
43 |
?>
|
44 |
<table class="order_details">
|
45 |
+
<?php if ( isset( $_GET['key'] ) && ! is_user_logged_in() ) : ?>
|
46 |
+
<tr class="order-key">
|
47 |
+
<th><?php esc_html_e( 'Order Key', 'learnpress' ); ?></th>
|
48 |
+
<td>
|
49 |
+
<?php echo esc_html( $_GET['key'] ); ?>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
<?php endif; ?>
|
53 |
<tr class="order">
|
54 |
<th><?php esc_html_e( 'Order Number', 'learnpress' ); ?></th>
|
55 |
<td>
|
@@ -9,17 +9,29 @@
|
|
9 |
|
10 |
defined( 'ABSPATH' ) || exit;
|
11 |
|
12 |
-
$user
|
13 |
-
$course
|
14 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
$total_question = $quiz->count_questions();
|
16 |
$questions = array();
|
17 |
$show_check = $quiz->get_instant_check();
|
18 |
$show_correct_review = $quiz->get_show_correct_review();
|
|
|
19 |
$user_js = array();
|
20 |
|
21 |
|
22 |
-
$user_course
|
|
|
|
|
|
|
23 |
$user_quiz = $user_course ? $user_course->get_item( $quiz->get_id() ) : false;
|
24 |
$answered = array();
|
25 |
$status = '';
|
@@ -28,20 +40,20 @@ $checked_questions = array();
|
|
28 |
$crypto_js_aes = false;
|
29 |
$editable = $user->is_admin() || get_post_field( $user->is_author_of( $course->get_id() ) );
|
30 |
$max_retrying = learn_press_get_quiz_max_retrying( $quiz->get_id(), $course->get_id() );
|
31 |
-
|
32 |
-
$question_ids = array();
|
33 |
|
34 |
if ( $user_quiz ) {
|
35 |
-
$status
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
$total_time = strtotime( $user_quiz->get_expiration_time() ) - strtotime( $user_quiz->get_start_time() );
|
43 |
}
|
44 |
|
|
|
|
|
45 |
$user_js = array(
|
46 |
'status' => $status,
|
47 |
'attempts' => $user_quiz->get_attempts(),
|
@@ -50,17 +62,12 @@ if ( $user_quiz ) {
|
|
50 |
'retaken' => absint( $user_quiz->get_retaken_count() ),
|
51 |
);
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
$user_js['endTime'] = $expiration_time->toSql( false );
|
56 |
-
}
|
57 |
|
58 |
if ( $quiz_results ) {
|
59 |
-
$user_js['results'] = $quiz_results
|
60 |
-
$answered = $quiz_results
|
61 |
-
$question_ids = $quiz_results->getQuestions( 'ids' );
|
62 |
-
} else {
|
63 |
-
$question_ids = $quiz->get_question_ids();
|
64 |
}
|
65 |
}
|
66 |
|
@@ -76,10 +83,6 @@ $questions = learn_press_rest_prepare_user_questions(
|
|
76 |
)
|
77 |
);
|
78 |
|
79 |
-
if ( empty( $question_ids ) ) {
|
80 |
-
$question_ids = $quiz->get_question_ids();
|
81 |
-
}
|
82 |
-
|
83 |
$duration = $quiz->get_duration();
|
84 |
|
85 |
$js = array(
|
@@ -95,6 +98,7 @@ $js = array(
|
|
95 |
'status' => '',
|
96 |
'attempts' => array(),
|
97 |
'answered' => $answered ? (object) $answered : new stdClass(),
|
|
|
98 |
'passing_grade' => $quiz->get_passing_grade(),
|
99 |
'negative_marking' => $quiz->get_negative_marking(),
|
100 |
'show_correct_review' => $show_correct_review,
|
@@ -111,13 +115,13 @@ $js = array(
|
|
111 |
'results' => array(),
|
112 |
);
|
113 |
|
114 |
-
if ( $course->is_no_required_enroll() ) {
|
115 |
$cookie_user_status = 'quiz_submit_status_' . $course->get_id() . '_' . $quiz->get_id() . '';
|
116 |
if ( ! empty( $_COOKIE[ $cookie_user_status ] ) ) {
|
117 |
$js_status = $_COOKIE[ $cookie_user_status ];
|
118 |
$js['status'] = $js_status;
|
119 |
}
|
120 |
-
}
|
121 |
|
122 |
$js = array_merge( $js, $user_js );
|
123 |
|
9 |
|
10 |
defined( 'ABSPATH' ) || exit;
|
11 |
|
12 |
+
$user = learn_press_get_current_user();
|
13 |
+
$course = LP_Global::course();
|
14 |
+
if ( ! $course ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
$quiz = LP_Global::course_item_quiz();
|
19 |
+
if ( ! $quiz ) {
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
$total_question = $quiz->count_questions();
|
24 |
$questions = array();
|
25 |
$show_check = $quiz->get_instant_check();
|
26 |
$show_correct_review = $quiz->get_show_correct_review();
|
27 |
+
$question_ids = $quiz->get_question_ids();
|
28 |
$user_js = array();
|
29 |
|
30 |
|
31 |
+
$user_course = $user->get_course_data( $course->get_id() );
|
32 |
+
/**
|
33 |
+
* @var LP_User_Item_Quiz $user_quiz
|
34 |
+
*/
|
35 |
$user_quiz = $user_course ? $user_course->get_item( $quiz->get_id() ) : false;
|
36 |
$answered = array();
|
37 |
$status = '';
|
40 |
$crypto_js_aes = false;
|
41 |
$editable = $user->is_admin() || get_post_field( $user->is_author_of( $course->get_id() ) );
|
42 |
$max_retrying = learn_press_get_quiz_max_retrying( $quiz->get_id(), $course->get_id() );
|
43 |
+
$quiz_results = null;
|
|
|
44 |
|
45 |
if ( $user_quiz ) {
|
46 |
+
$status = $user_quiz->get_status();
|
47 |
+
if ( LP_ITEM_STARTED === $status ) {
|
48 |
+
$quiz_results = LP_User_Items_Result_DB::instance()->get_result( $user_quiz->get_user_item_id() );
|
49 |
+
}
|
50 |
|
51 |
+
if ( ! $quiz_results ) {
|
52 |
+
$quiz_results = $user_quiz->get_result();
|
|
|
53 |
}
|
54 |
|
55 |
+
$checked_questions = $user_quiz->get_checked_questions();
|
56 |
+
|
57 |
$user_js = array(
|
58 |
'status' => $status,
|
59 |
'attempts' => $user_quiz->get_attempts(),
|
62 |
'retaken' => absint( $user_quiz->get_retaken_count() ),
|
63 |
);
|
64 |
|
65 |
+
$time_remaining = $user_quiz->get_timestamp_remaining();
|
66 |
+
$user_js['total_time'] = $time_remaining;
|
|
|
|
|
67 |
|
68 |
if ( $quiz_results ) {
|
69 |
+
$user_js['results'] = $quiz_results;
|
70 |
+
$answered = $quiz_results['questions'];
|
|
|
|
|
|
|
71 |
}
|
72 |
}
|
73 |
|
83 |
)
|
84 |
);
|
85 |
|
|
|
|
|
|
|
|
|
86 |
$duration = $quiz->get_duration();
|
87 |
|
88 |
$js = array(
|
98 |
'status' => '',
|
99 |
'attempts' => array(),
|
100 |
'answered' => $answered ? (object) $answered : new stdClass(),
|
101 |
+
'checked_questions' => array(),
|
102 |
'passing_grade' => $quiz->get_passing_grade(),
|
103 |
'negative_marking' => $quiz->get_negative_marking(),
|
104 |
'show_correct_review' => $show_correct_review,
|
115 |
'results' => array(),
|
116 |
);
|
117 |
|
118 |
+
/*if ( $course->is_no_required_enroll() ) {
|
119 |
$cookie_user_status = 'quiz_submit_status_' . $course->get_id() . '_' . $quiz->get_id() . '';
|
120 |
if ( ! empty( $_COOKIE[ $cookie_user_status ] ) ) {
|
121 |
$js_status = $_COOKIE[ $cookie_user_status ];
|
122 |
$js['status'] = $js_status;
|
123 |
}
|
124 |
+
}*/
|
125 |
|
126 |
$js = array_merge( $js, $user_js );
|
127 |
|
@@ -6,12 +6,14 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package Learnpress/Templates
|
9 |
-
* @version 4.0.
|
10 |
*/
|
11 |
|
12 |
defined( 'ABSPATH' ) || exit();
|
13 |
|
14 |
-
$
|
|
|
|
|
15 |
?>
|
16 |
|
17 |
<div id="profile-nav">
|
@@ -29,6 +31,14 @@ $profile = LP_Profile::instance();
|
|
29 |
continue;
|
30 |
}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
$slug = $profile->get_slug( $profile_tab, $tab_key );
|
33 |
$link = $profile->get_tab_link( $tab_key, true );
|
34 |
$tab_classes = array( esc_attr( $tab_key ) );
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package Learnpress/Templates
|
9 |
+
* @version 4.0.1
|
10 |
*/
|
11 |
|
12 |
defined( 'ABSPATH' ) || exit();
|
13 |
|
14 |
+
if ( ! isset( $user ) || ! isset( $profile ) ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
?>
|
18 |
|
19 |
<div id="profile-nav">
|
31 |
continue;
|
32 |
}
|
33 |
|
34 |
+
// Admin view another user profile
|
35 |
+
if ( $profile->get_user()->get_id() !== get_current_user_id() && current_user_can( ADMIN_ROLE ) ) {
|
36 |
+
$tab_key_hidden_admin_view_user = [ 'settings', 'logout', 'orders', 'gradebook' ];
|
37 |
+
if ( in_array( $tab_key, $tab_key_hidden_admin_view_user ) ) {
|
38 |
+
continue;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
$slug = $profile->get_slug( $profile_tab, $tab_key );
|
43 |
$link = $profile->get_tab_link( $tab_key, true );
|
44 |
$tab_classes = array( esc_attr( $tab_key ) );
|
@@ -6,7 +6,7 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package Learnpress/Templates
|
9 |
-
* @version 4.0.
|
10 |
*/
|
11 |
|
12 |
defined( 'ABSPATH' ) || exit();
|
@@ -40,7 +40,11 @@ $createds = array(
|
|
40 |
);
|
41 |
|
42 |
$enrolled_active = apply_filters( 'learnpress/profile/tab/enrolled/subtab-active', ! learn_press_user_maybe_is_a_teacher() ? 'in-progress' : '' );
|
43 |
-
$tab_active =
|
|
|
|
|
|
|
|
|
44 |
?>
|
45 |
|
46 |
<div class="learn-press-subtab-content">
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package Learnpress/Templates
|
9 |
+
* @version 4.0.10
|
10 |
*/
|
11 |
|
12 |
defined( 'ABSPATH' ) || exit();
|
40 |
);
|
41 |
|
42 |
$enrolled_active = apply_filters( 'learnpress/profile/tab/enrolled/subtab-active', ! learn_press_user_maybe_is_a_teacher() ? 'in-progress' : '' );
|
43 |
+
$tab_active = $_GET['tab'] ?? '';
|
44 |
+
if ( ! $tab_active ) {
|
45 |
+
$tab_active = ! learn_press_user_maybe_is_a_teacher() ? 'enrolled' : 'created';
|
46 |
+
}
|
47 |
+
$tab_active = apply_filters( 'learnpress/profile/tab-active', $tab_active );
|
48 |
?>
|
49 |
|
50 |
<div class="learn-press-subtab-content">
|
@@ -25,7 +25,7 @@ defined( 'ABSPATH' ) || exit();
|
|
25 |
setup_postdata( $post );
|
26 |
|
27 |
$course_data = $user->get_course_data( $id );
|
28 |
-
$course_results = $course_data->
|
29 |
learn_press_get_template( 'content-course.php' );
|
30 |
}
|
31 |
|
25 |
setup_postdata( $post );
|
26 |
|
27 |
$course_data = $user->get_course_data( $id );
|
28 |
+
$course_results = $course_data->get_result();
|
29 |
learn_press_get_template( 'content-course.php' );
|
30 |
}
|
31 |
|
@@ -30,13 +30,13 @@ defined( 'ABSPATH' ) || exit();
|
|
30 |
$post = get_post( $id );
|
31 |
setup_postdata( $post );
|
32 |
|
33 |
-
$course_data
|
34 |
-
$
|
35 |
?>
|
36 |
<div class="lp_profile_course_progress__item">
|
37 |
<div><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo $course->get_image( 'course_thumbnail' ); ?></a></div>
|
38 |
<div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
|
39 |
-
<div><?php echo
|
40 |
<div><?php echo ! empty( $course_data->get_expiration_time() ) ? $course_data->get_expiration_time() : '-'; ?></div>
|
41 |
<div><?php echo ! empty( $course_data->get_end_time() ) ? $course_data->get_end_time() : '-'; ?></div>
|
42 |
</div>
|
30 |
$post = get_post( $id );
|
31 |
setup_postdata( $post );
|
32 |
|
33 |
+
$course_data = $user->get_course_data( $id );
|
34 |
+
$course_result = $course_data->get_result();
|
35 |
?>
|
36 |
<div class="lp_profile_course_progress__item">
|
37 |
<div><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo $course->get_image( 'course_thumbnail' ); ?></a></div>
|
38 |
<div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
|
39 |
+
<div><?php echo $course_result['result']; ?>%</div>
|
40 |
<div><?php echo ! empty( $course_data->get_expiration_time() ) ? $course_data->get_expiration_time() : '-'; ?></div>
|
41 |
<div><?php echo ! empty( $course_data->get_end_time() ) ? $course_data->get_end_time() : '-'; ?></div>
|
42 |
</div>
|
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package Learnpress/Templates
|
7 |
-
* @version 4.0.
|
8 |
*/
|
9 |
|
10 |
defined( 'ABSPATH' ) || exit();
|
@@ -13,10 +13,27 @@ if ( ! LP_Profile::instance()->current_user_can( 'view-tab-quizzes' ) ) {
|
|
13 |
return;
|
14 |
}
|
15 |
|
16 |
-
$
|
17 |
-
|
18 |
-
$
|
19 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
?>
|
21 |
|
22 |
<div class="learn-press-subtab-content">
|
@@ -36,16 +53,20 @@ $filters = $profile->get_quizzes_filters( $filter_status );
|
|
36 |
<tr>
|
37 |
<th class="column-quiz"><?php esc_html_e( 'Quiz', 'learnpress' ); ?></th>
|
38 |
<th class="column-status"><?php esc_html_e( 'Result', 'learnpress' ); ?></th>
|
39 |
-
<th class="column-time-interval"><?php esc_html_e( 'Time
|
40 |
<th class="column-date"><?php esc_html_e( 'Date', 'learnpress' ); ?></th>
|
41 |
</tr>
|
42 |
</thead>
|
43 |
|
44 |
<tbody>
|
45 |
-
<?php
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
?>
|
50 |
|
51 |
<tr>
|
@@ -66,8 +87,8 @@ $filters = $profile->get_quizzes_filters( $filter_status );
|
|
66 |
|
67 |
<td class="column-status">
|
68 |
<span class="result-percent"><?php echo $user_quiz->get_percent_result(); ?></span>
|
69 |
-
<span class="lp-label label-<?php echo esc_attr( $user_quiz->
|
70 |
-
<?php echo $user_quiz->get_status_label(); ?>
|
71 |
</span>
|
72 |
</td>
|
73 |
<td class="column-time-interval">
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package Learnpress/Templates
|
7 |
+
* @version 4.0.1
|
8 |
*/
|
9 |
|
10 |
defined( 'ABSPATH' ) || exit();
|
13 |
return;
|
14 |
}
|
15 |
|
16 |
+
global $wp;
|
17 |
+
|
18 |
+
$profile = learn_press_get_profile();
|
19 |
+
$user_profile = learn_press_get_user( $profile->get_user_data( 'id' ) );
|
20 |
+
|
21 |
+
$filter = new LP_User_Items_Filter();
|
22 |
+
$filter->user_id = $user_profile->get_id();
|
23 |
+
$filter->limit = apply_filters( 'learnpress/user/quizzes/limit', 5 );
|
24 |
+
$filter->status = LP_Helper::sanitize_params_submitted( $_GET['filter-status'] ?? '' );
|
25 |
+
$filter->graduation = LP_Helper::sanitize_params_submitted( $_GET['filter-graduation'] ?? '' );
|
26 |
+
$query = $user_profile->get_user_quizzes( $filter );
|
27 |
+
|
28 |
+
$current_filter = '';
|
29 |
+
|
30 |
+
if ( ! empty( $filter->status ) ) {
|
31 |
+
$current_filter = $filter->status;
|
32 |
+
} elseif ( ! empty( $filter->graduation ) ) {
|
33 |
+
$current_filter = $filter->graduation;
|
34 |
+
}
|
35 |
+
|
36 |
+
$filters = $profile->get_quizzes_filters( $current_filter );
|
37 |
?>
|
38 |
|
39 |
<div class="learn-press-subtab-content">
|
53 |
<tr>
|
54 |
<th class="column-quiz"><?php esc_html_e( 'Quiz', 'learnpress' ); ?></th>
|
55 |
<th class="column-status"><?php esc_html_e( 'Result', 'learnpress' ); ?></th>
|
56 |
+
<th class="column-time-interval"><?php esc_html_e( 'Time spent', 'learnpress' ); ?></th>
|
57 |
<th class="column-date"><?php esc_html_e( 'Date', 'learnpress' ); ?></th>
|
58 |
</tr>
|
59 |
</thead>
|
60 |
|
61 |
<tbody>
|
62 |
+
<?php
|
63 |
+
/**
|
64 |
+
* @var LP_User_Item_Quiz $user_quiz
|
65 |
+
*/
|
66 |
+
foreach ( $query['items'] as $user_quiz ) :
|
67 |
+
$result_quiz = $user_quiz->get_result();
|
68 |
+
$quiz = learn_press_get_quiz( $user_quiz->get_id() );
|
69 |
+
$courses = learn_press_get_item_courses( array( $user_quiz->get_id() ) );
|
70 |
?>
|
71 |
|
72 |
<tr>
|
87 |
|
88 |
<td class="column-status">
|
89 |
<span class="result-percent"><?php echo $user_quiz->get_percent_result(); ?></span>
|
90 |
+
<span class="lp-label label-<?php echo esc_attr( $user_quiz->get_status() ); ?>">
|
91 |
+
<?php echo wp_sprintf( '%s', esc_attr( $user_quiz->get_status_label() ) ); ?>
|
92 |
</span>
|
93 |
</td>
|
94 |
<td class="column-time-interval">
|
@@ -6,7 +6,7 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package Learnpress/Templates
|
9 |
-
* @version 4.0.
|
10 |
*/
|
11 |
|
12 |
defined( 'ABSPATH' ) || exit();
|
@@ -15,7 +15,7 @@ if ( ! isset( $course ) ) {
|
|
15 |
$course = learn_press_get_course();
|
16 |
}
|
17 |
|
18 |
-
$classes_purchase
|
19 |
$classes_purchase .= ( LP()->checkout()->is_enable_guest_checkout() ) ? ' guest_checkout' : '';
|
20 |
|
21 |
$classes_purchase = apply_filters( 'lp/btn/purchase/classes', $classes_purchase );
|
@@ -30,7 +30,7 @@ $classes_purchase = apply_filters( 'lp/btn/purchase/classes', $classes_purchase
|
|
30 |
<input type="hidden" name="purchase-course" value="<?php echo esc_attr( $course->get_id() ); ?>"/>
|
31 |
|
32 |
<button class="lp-button button button-purchase-course">
|
33 |
-
<?php echo esc_html( apply_filters( 'learn-press/purchase-course-button-text', esc_html__( 'Buy Now', 'learnpress' ) ) ); ?>
|
34 |
</button>
|
35 |
|
36 |
<?php do_action( 'learn-press/after-purchase-button' ); ?>
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package Learnpress/Templates
|
9 |
+
* @version 4.0.1
|
10 |
*/
|
11 |
|
12 |
defined( 'ABSPATH' ) || exit();
|
15 |
$course = learn_press_get_course();
|
16 |
}
|
17 |
|
18 |
+
$classes_purchase = 'purchase-course';
|
19 |
$classes_purchase .= ( LP()->checkout()->is_enable_guest_checkout() ) ? ' guest_checkout' : '';
|
20 |
|
21 |
$classes_purchase = apply_filters( 'lp/btn/purchase/classes', $classes_purchase );
|
30 |
<input type="hidden" name="purchase-course" value="<?php echo esc_attr( $course->get_id() ); ?>"/>
|
31 |
|
32 |
<button class="lp-button button button-purchase-course">
|
33 |
+
<?php echo esc_html( apply_filters( 'learn-press/purchase-course-button-text', esc_html__( 'Buy Now', 'learnpress' ), $course->get_id() ) ); ?>
|
34 |
</button>
|
35 |
|
36 |
<?php do_action( 'learn-press/after-purchase-button' ); ?>
|
@@ -6,25 +6,14 @@
|
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package Learnpress/Templates
|
9 |
-
* @version 4.0.
|
10 |
*/
|
11 |
|
12 |
defined( 'ABSPATH' ) || exit();
|
13 |
|
14 |
-
$user
|
15 |
-
$course = LP_Global::course();
|
16 |
-
|
17 |
-
if ( ! $course || ! $user ) {
|
18 |
return;
|
19 |
}
|
20 |
-
|
21 |
-
$percentage = 0;
|
22 |
-
$course_data = $user->get_course_data( $course->get_id() );
|
23 |
-
|
24 |
-
if ( $course_data ) {
|
25 |
-
$course_results = $course_data->calculate_course_results();
|
26 |
-
$percentage = $course_results['count_items'] ? absint( $course_results['completed_items'] / $course_results['count_items'] * 100 ) : 0;
|
27 |
-
}
|
28 |
?>
|
29 |
|
30 |
<div id="popup-header">
|
@@ -35,7 +24,9 @@ if ( $course_data ) {
|
|
35 |
|
36 |
<?php if ( $user->has_enrolled_or_finished( $course->get_id() ) ) : ?>
|
37 |
<div class="items-progress">
|
38 |
-
<span class="number"
|
|
|
|
|
39 |
<div class="learn-press-progress">
|
40 |
<div class="learn-press-progress__active" data-value="<?php echo $percentage; ?>%;">
|
41 |
</div>
|
6 |
*
|
7 |
* @author ThimPress
|
8 |
* @package Learnpress/Templates
|
9 |
+
* @version 4.0.3
|
10 |
*/
|
11 |
|
12 |
defined( 'ABSPATH' ) || exit();
|
13 |
|
14 |
+
if ( ! isset( $course ) || ! isset( $user ) || ! isset( $percentage ) || ! isset( $completed_items ) ) {
|
|
|
|
|
|
|
15 |
return;
|
16 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
?>
|
18 |
|
19 |
<div id="popup-header">
|
24 |
|
25 |
<?php if ( $user->has_enrolled_or_finished( $course->get_id() ) ) : ?>
|
26 |
<div class="items-progress">
|
27 |
+
<span class="number">
|
28 |
+
<?php echo wp_sprintf( '<span class="items-completed">%1$s</span> of %2$d %3$s', esc_html( $completed_items ), esc_html( $course->count_items() ), __( 'items', 'learnpress' ) ); ?>
|
29 |
+
</span>
|
30 |
<div class="learn-press-progress">
|
31 |
<div class="learn-press-progress__active" data-value="<?php echo $percentage; ?>%;">
|
32 |
</div>
|
@@ -5,9 +5,14 @@
|
|
5 |
* @author ThimPress
|
6 |
* @package LearnPress/Templates
|
7 |
* @version 4.0.0
|
|
|
8 |
*/
|
9 |
|
10 |
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
|
11 |
?>
|
12 |
|
13 |
<div class="meta-item meta-item-<?php echo $object; ?>"><?php echo $count; ?></div>
|
5 |
* @author ThimPress
|
6 |
* @package LearnPress/Templates
|
7 |
* @version 4.0.0
|
8 |
+
* @see LP_Template_Course::count_object()
|
9 |
*/
|
10 |
|
11 |
defined( 'ABSPATH' ) || exit;
|
12 |
+
|
13 |
+
if ( ! isset( $object ) || ! isset( $count ) ) {
|
14 |
+
return;
|
15 |
+
}
|
16 |
?>
|
17 |
|
18 |
<div class="meta-item meta-item-<?php echo $object; ?>"><?php echo $count; ?></div>
|
@@ -23,7 +23,7 @@ $user = LP_Global::user();
|
|
23 |
|
24 |
<?php do_action( 'learn-press/course-section-item/before-' . $item->get_item_type() . '-meta', $item ); ?>
|
25 |
|
26 |
-
<?php if ( $item->is_preview() && ! $user->has_completed_item( $item->get_id(), $course->get_id() ) ) : ?>
|
27 |
<span class="item-meta course-item-preview"
|
28 |
data-preview="<?php esc_attr_e( 'Preview', 'learnpress' ); ?>"></span>
|
29 |
|
23 |
|
24 |
<?php do_action( 'learn-press/course-section-item/before-' . $item->get_item_type() . '-meta', $item ); ?>
|
25 |
|
26 |
+
<?php if ( $item->is_preview() && $user && ! $user->has_completed_item( $item->get_id(), $course->get_id() ) ) : ?>
|
27 |
<span class="item-meta course-item-preview"
|
28 |
data-preview="<?php esc_attr_e( 'Preview', 'learnpress' ); ?>"></span>
|
29 |
|
@@ -4,13 +4,23 @@
|
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package Learnpress/Templates
|
7 |
-
* @version 4.0.
|
8 |
*/
|
9 |
|
10 |
defined( 'ABSPATH' ) || exit();
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
$passing_condition = $course->get_passing_condition();
|
15 |
$quiz_false = 0;
|
16 |
|
@@ -20,21 +30,29 @@ if ( ! empty( $course_results['items'] ) ) {
|
|
20 |
?>
|
21 |
|
22 |
<div class="course-results-progress">
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
<?php do_action( 'learn-press/user-item-progress' ); ?>
|
38 |
|
39 |
<div class="course-progress">
|
40 |
<h4 class="items-progress__heading">
|
@@ -42,10 +60,13 @@ if ( ! empty( $course_results['items'] ) ) {
|
|
42 |
</h4>
|
43 |
|
44 |
<div class="lp-course-status">
|
45 |
-
<span class="number"><?php echo
|
46 |
</div>
|
47 |
|
48 |
-
<div class="learn-press-progress lp-course-progress <?php echo $course_data->is_passed() ? ' passed' : ''; ?>"
|
|
|
|
|
|
|
49 |
<div class="progress-bg lp-progress-bar">
|
50 |
<div class="progress-active lp-progress-value" style="left: <?php echo $course_results['result']; ?>%;">
|
51 |
</div>
|
4 |
*
|
5 |
* @author ThimPress
|
6 |
* @package Learnpress/Templates
|
7 |
+
* @version 4.0.1
|
8 |
*/
|
9 |
|
10 |
defined( 'ABSPATH' ) || exit();
|
11 |
|
12 |
+
if ( ! isset( $user ) || ! isset( $course ) || ! isset( $course_data ) || ! isset( $course_results ) ) {
|
13 |
+
return;
|
14 |
+
}
|
15 |
+
|
16 |
+
/*if ( ! isset( $course_data ) ) {
|
17 |
+
$course_data = $user->get_course_data( $course->get_id() );
|
18 |
+
}
|
19 |
+
|
20 |
+
if ( ! isset( $course_results ) ) {
|
21 |
+
$course_results = $course_data->calculate_course_results();
|
22 |
+
}*/
|
23 |
+
|
24 |
$passing_condition = $course->get_passing_condition();
|
25 |
$quiz_false = 0;
|
26 |
|
30 |
?>
|
31 |
|
32 |
<div class="course-results-progress">
|
33 |
+
<?php
|
34 |
+
if ( $course_results['items']['lesson']['total'] ) :
|
35 |
+
?>
|
36 |
+
<div class="items-progress">
|
37 |
+
<h4 class="items-progress__heading">
|
38 |
+
<?php esc_html_e( 'Lessons completed:', 'learnpress' ); ?>
|
39 |
+
</h4>
|
40 |
+
<span class="number"><?php printf( '%1$d/%2$d', $course_results['items']['lesson']['completed'], $course_results['items']['lesson']['total'] ); ?></span>
|
41 |
+
</div>
|
42 |
+
<?php endif; ?>
|
43 |
|
44 |
+
<?php
|
45 |
+
if ( $course_results['items']['quiz']['total'] ) :
|
46 |
+
?>
|
47 |
+
<div class="items-progress">
|
48 |
+
<h4 class="items-progress__heading">
|
49 |
+
<?php esc_html_e( 'Quizzes finished:', 'learnpress' ); ?>
|
50 |
+
</h4>
|
51 |
+
<span class="number" title="<?php esc_attr( sprintf( __( 'Failed %1$d, Passed %2$d', 'learnpress' ), $quiz_false, $course_results['items']['quiz']['passed'] ) ); ?>"><?php printf( __( '%1$d/%2$d', 'learnpress' ), $course_results['items']['quiz']['completed'], $course_results['items']['quiz']['total'] ); ?></span>
|
52 |
+
</div>
|
53 |
+
<?php endif; ?>
|
54 |
|
55 |
+
<?php do_action( 'learn-press/user-item-progress', $course_results, $course_data, $user, $course ); ?>
|
56 |
|
57 |
<div class="course-progress">
|
58 |
<h4 class="items-progress__heading">
|
60 |
</h4>
|
61 |
|
62 |
<div class="lp-course-status">
|
63 |
+
<span class="number"><?php echo $course_results['result']; ?><span class="percentage-sign">%</span></span>
|
64 |
</div>
|
65 |
|
66 |
+
<div class="learn-press-progress lp-course-progress <?php echo $course_data->is_passed() ? ' passed' : ''; ?>"
|
67 |
+
data-value="<?php echo $course_results['result']; ?>"
|
68 |
+
data-passing-condition="<?php echo $passing_condition; ?>"
|
69 |
+
title="<?php echo esc_attr( learn_press_translate_course_result_required( $course ) ); ?>">
|
70 |
<div class="progress-bg lp-progress-bar">
|
71 |
<div class="progress-active lp-progress-value" style="left: <?php echo $course_results['result']; ?>%;">
|
72 |
</div>
|
@@ -7,12 +7,12 @@
|
|
7 |
* @author ThimPress
|
8 |
* @category Widgets
|
9 |
* @package Learnpress/Templates
|
10 |
-
* @version 4.1.
|
11 |
*/
|
12 |
|
13 |
defined( 'ABSPATH' ) || exit();
|
14 |
|
15 |
-
if ( ! $course || ! $user ) {
|
16 |
return;
|
17 |
}
|
18 |
?>
|
@@ -23,10 +23,7 @@ if ( ! $course || ! $user ) {
|
|
23 |
<?php
|
24 |
learn_press_get_template(
|
25 |
'single-course/sidebar/user-progress.php',
|
26 |
-
|
27 |
-
'user' => $user,
|
28 |
-
'course' => $course,
|
29 |
-
)
|
30 |
);
|
31 |
?>
|
32 |
</div>
|
7 |
* @author ThimPress
|
8 |
* @category Widgets
|
9 |
* @package Learnpress/Templates
|
10 |
+
* @version 4.1.4
|
11 |
*/
|
12 |
|
13 |
defined( 'ABSPATH' ) || exit();
|
14 |
|
15 |
+
if ( ! isset( $course ) || ! isset( $user ) || ! isset( $instance ) || ! isset( $course_results ) || ! isset( $course_data ) ) {
|
16 |
return;
|
17 |
}
|
18 |
?>
|
23 |
<?php
|
24 |
learn_press_get_template(
|
25 |
'single-course/sidebar/user-progress.php',
|
26 |
+
compact( 'user', 'course', 'course_data', 'course_results' )
|
|
|
|
|
|
|
27 |
);
|
28 |
?>
|
29 |
</div>
|