Tutor LMS – eLearning and online course solution - Version 1.0.0

Version Description

  • 01 March, 2019 =

  • Added Quiz, quiz builder, course builder

  • Fixed huge bugs from alpha version

  • Stable Release

Download this release

Release Info

Developer themeum
Plugin Icon wp plugin Tutor LMS – eLearning and online course solution
Version 1.0.0
Comparing to
See all releases

Code changes from version 1.0.0-alpha to 1.0.0

assets/css/tutor-admin.css CHANGED
@@ -1,7 +1,7 @@
1
- /*! jQuery UI - v1.8.24 - 2012-09-28
2
- * https://github.com/jquery/jquery-ui
3
- * Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.tabs.css, jquery.ui.theme.css
4
- * Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
5
 
6
  /** Slider CSS */
7
  @import "../icons/css/tutor-icon.css";
@@ -21,9 +21,9 @@
21
  .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
22
  .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
23
  .ui-slider-vertical .ui-slider-range-max { top: 0; }
24
- /* Component containers
 
25
  ----------------------------------*/
26
-
27
  .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff; color: #222222; }
28
  .ui-widget-content a { color: #222222; }
29
  .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc; color: #222222; font-weight: bold; }
@@ -155,6 +155,13 @@ Group Field Option
155
  padding: 10px;
156
  margin-bottom: 5px;
157
  border: 1px solid #D9D9D9;
 
 
 
 
 
 
 
158
  }
159
  #tutor-course-topics .drop-lessons{
160
  border: 1px dashed #adabab96;
@@ -182,19 +189,19 @@ Group Field Option
182
  display: flex;
183
  font-size: 14px;
184
  }
185
- #tutor-course-topics .tutor-lesson-top .open-tutor-lesson-modal{
186
  flex: 1;
187
  }
188
- #tutor-course-topics .tutor-lesson-top i{
189
  margin-right: 10px;
190
  cursor: ns-resize;
191
  }
 
 
 
192
  #tutor-course-topics .tutor-lesson-top a{
193
  color: #393C40;
194
  }
195
- .tutor-topics-wrap, .tutor-lesson{
196
- background-color: #ffffff;
197
- }
198
  .tutor-topics-wrap, .course-move-handle{
199
  margin-right: 5px;
200
  }
@@ -418,32 +425,28 @@ a.tutor-delete-attachment {
418
  line-height: 7px;
419
  color: #ff0000;
420
  }
421
-
422
  a.tutor-delete-attachment:hover {
423
  background-color: #ff0000;
424
  color: #ffffff;
425
  }
426
-
427
  .tutor-status-context{
428
  padding: 5px 10px;
429
  margin: 5px 0;
430
  display: inline-block;
431
  }
432
-
433
- .tutor-status-pending-context, .quiz_started{
434
  background-color: #EEEEEE;
435
  }
436
-
437
  a.tutor-button{
438
  padding: 10px 20px;
439
  text-decoration: none;
440
  margin-right: 20px;
441
  }
442
- .tutor-status-approved-context, .quiz_finished, .tutor-button.button-success {
443
  background-color: #008000;
444
  color: #ffffff;
445
  }
446
- .tutor-status-blocked-context, .quiz_timeout, .tutor-button.button-danger {
447
  background-color: #ff0000;
448
  color: #ffffff;
449
  }
@@ -922,10 +925,411 @@ Quiz Modal
922
  color: #fff;
923
  font-size: 25px;
924
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
925
  /**
926
- #End Quiz Modal
927
  */
928
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
929
  .tutor-available-quizzes .added-quiz-item {
930
  background-color: #f5f5f5;
931
  padding: 10px;
@@ -948,16 +1352,11 @@ p.quiz-search-suggest-text{
948
  font-size: 12px;
949
  }
950
  span.result-pass{
951
- padding: 5px 10px;
952
- background-color: #04a704;
953
- color: #ffffff;
954
  }
955
  span.result-fail{
956
- padding: 5px 10px;
957
- background-color: #FF0000;
958
- color: #ffffff;
959
  }
960
-
961
  .tutor-quiz-attempt-info-row{
962
  margin: 30px 0;
963
  display: flex;
@@ -981,11 +1380,9 @@ span.result-fail{
981
  .quiz-attempt-student-info{
982
  margin-left: 20px;
983
  }
984
-
985
  .tutor-quiz-attempt-info-row .quiz-attempt-info-row{
986
  display: flex;
987
  }
988
-
989
  .tutor-quiz-attempt-info-row .quiz-attempt-info-row .attempt-property-name{
990
  width: 25%;
991
  }
@@ -1021,8 +1418,23 @@ span.result-fail{
1021
  color: #393C40;
1022
  text-decoration: none;
1023
  }
1024
-
1025
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1026
  /**
1027
  Uninstall
1028
  */
@@ -1050,7 +1462,6 @@ Updating Messsage
1050
  margin-right: 6px;
1051
  }
1052
 
1053
-
1054
  /**
1055
  Lesson Edit Modal
1056
  */
@@ -1064,7 +1475,6 @@ Lesson Edit Modal
1064
  line-height: 8px;
1065
  font-size: 12px;
1066
  }
1067
-
1068
  .lesson-modal-form-wrap .lesson-modal-field-row{
1069
  padding: 10px 0;
1070
  }
@@ -1104,11 +1514,20 @@ Lesson Edit Modal
1104
  bottom: 0;
1105
  position: -webkit-sticky;
1106
  }
1107
-
1108
  .tutor-lesson-modal-wrap .tutor-thumbnail-wrap img{
1109
  max-width: 150px;
1110
  height: auto;
1111
  }
1112
  .tutor-get-pro-text {
1113
  color: #e02424;
 
 
 
 
 
 
 
 
 
 
1114
  }
1
+ /**
2
+ @package: Tutor LMS
3
+ @author: themeum
4
+ */
5
 
6
  /** Slider CSS */
7
  @import "../icons/css/tutor-icon.css";
21
  .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
22
  .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
23
  .ui-slider-vertical .ui-slider-range-max { top: 0; }
24
+ /*----------------------------------
25
+ Component containers
26
  ----------------------------------*/
 
27
  .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff; color: #222222; }
28
  .ui-widget-content a { color: #222222; }
29
  .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc; color: #222222; font-weight: bold; }
155
  padding: 10px;
156
  margin-bottom: 5px;
157
  border: 1px solid #D9D9D9;
158
+ background-color: #ffffff;
159
+ }
160
+ .course-contents .tutor-quiz{
161
+ padding: 10px;
162
+ margin-bottom: 5px;
163
+ border: 1px solid #D9D9D9;
164
+ background-color: #ffffff;
165
  }
166
  #tutor-course-topics .drop-lessons{
167
  border: 1px dashed #adabab96;
189
  display: flex;
190
  font-size: 14px;
191
  }
192
+ #tutor-course-topics .tutor-lesson-top .open-tutor-lesson-modal, .tutor-quiz .open-tutor-quiz-modal{
193
  flex: 1;
194
  }
195
+ #tutor-course-topics .tutor-lesson-top i.tutor-icon-move{
196
  margin-right: 10px;
197
  cursor: ns-resize;
198
  }
199
+ #tutor-course-topics .tutor-lesson-top i.tutor-icon-pencil{
200
+ margin: 0 10px;
201
+ }
202
  #tutor-course-topics .tutor-lesson-top a{
203
  color: #393C40;
204
  }
 
 
 
205
  .tutor-topics-wrap, .course-move-handle{
206
  margin-right: 5px;
207
  }
425
  line-height: 7px;
426
  color: #ff0000;
427
  }
 
428
  a.tutor-delete-attachment:hover {
429
  background-color: #ff0000;
430
  color: #ffffff;
431
  }
 
432
  .tutor-status-context{
433
  padding: 5px 10px;
434
  margin: 5px 0;
435
  display: inline-block;
436
  }
437
+ .tutor-status-pending-context, .attempt_started{
 
438
  background-color: #EEEEEE;
439
  }
 
440
  a.tutor-button{
441
  padding: 10px 20px;
442
  text-decoration: none;
443
  margin-right: 20px;
444
  }
445
+ .tutor-status-approved-context, .attempt_ended, .tutor-button.button-success {
446
  background-color: #008000;
447
  color: #ffffff;
448
  }
449
+ .tutor-status-blocked-context, .attempt_timeout, .tutor-button.button-danger {
450
  background-color: #ff0000;
451
  color: #ffffff;
452
  }
925
  color: #fff;
926
  font-size: 25px;
927
  }
928
+ .tutor-modal-wrap.tutor-quiz-builder-modal-wrap .modal-title {
929
+ flex-basis: 0;
930
+ flex-grow: 1;
931
+ }
932
+ .tutor-modal-wrap.tutor-quiz-builder-modal-wrap .modal-close-wrap a.modal-close-btn {
933
+ background: #ffffff;
934
+ width: 20px;
935
+ height: 20px;
936
+ display: inline-block;
937
+ text-align: center;
938
+ line-height: 28px;
939
+ color: #3a3d42;
940
+ font-size: 22px;
941
+ }
942
+ .tutor-modal-wrap.tutor-quiz-builder-modal-wrap .modal-header {
943
+ padding: 15px 20px;
944
+ border-bottom: 1px solid #eeeff1;
945
+ }
946
+ .tutor-modal-wrap.tutor-quiz-builder-modal-wrap .modal-header h1{
947
+ padding: 0;
948
+ }
949
+ .tutor-modal-wrap.tutor-quiz-builder-modal-wrap .modal-container{
950
+ background-color: #F1F1F1;
951
+ padding: 0;
952
+ }
953
+ #tutor-quiz-modal-tab-items-wrap {
954
+ background-color: #fff;
955
+ font-size: 0;
956
+ }
957
+ #tutor-quiz-builder-modal-tabs-container{
958
+ padding: 20px;
959
+ }
960
+ #tutor-quiz-builder-modal-tabs-container .quiz-builder-tab-body{
961
+ min-height: 300px;
962
+ }
963
+ #tutor-quiz-modal-tab-items-wrap .tutor-quiz-modal-tab-item{
964
+ padding: 15px 25px;
965
+ display: inline-block;
966
+ color: #393C40;
967
+ border-left: 1px solid #F1F1F1;
968
+ font-size: 13px;
969
+ }
970
+ #tutor-quiz-modal-tab-items-wrap .tutor-quiz-modal-tab-item.active{
971
+ background-color: #F1F1F1;
972
+ }
973
+ #tutor-quiz-modal-tab-items-wrap .tutor-quiz-modal-tab-item.active i{
974
+ color: #3057D5;
975
+ }
976
+ .quiz-modal-tab-navigation-btn{
977
+ padding: 15px 20px;
978
+ border-radius: 3px;
979
+ }
980
+ .quiz-modal-btn-next, .quiz-modal-btn-next:focus, .quiz-modal-btn-first-step, .quiz-modal-btn-first-step:focus, .quiz-modal-question-save-btn, .quiz-modal-question-save-btn:focus, .quiz-modal-settings-save-btn, .quiz-modal-settings-save-btn:focus{
981
+ background-color: #1B52D8;
982
+ color: #ffffff;
983
+ }
984
+ .quiz-modal-btn-cancel, .quiz-modal-btn-back{
985
+ color: #4B5981;
986
+ border: 1px solid #D4DADB;
987
+ }
988
+ .tutor-quiz-builder-form-row .quiz-form-warning {
989
+ color: #e88e06;
990
+ }
991
+ #tutor_quiz_question_answer_form {
992
+ margin: 20px 0;
993
+ }
994
+ .tutor-quiz-question-answers-form {
995
+ background-color: #fff;
996
+ padding: 20px;
997
+ box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
998
+ transition: all 0.3s cubic-bezier(.25,.8,.25,1);
999
+ }
1000
+
1001
+ /** Tutor Quiz Modal Form */
1002
+ .tutor-quiz-builder-form-row{
1003
+ margin: 10px 0 25px;
1004
+ }
1005
+ .tutor-quiz-builder-form-row input[type="text"], .tutor-quiz-builder-form-row input[type="number"], .tutor-quiz-builder-form-row textarea{
1006
+ border: 1px solid #DEDEDE;
1007
+ margin: 0;
1008
+ padding: 10px;
1009
+ box-shadow: none;
1010
+ }
1011
+ .tutor-quiz-builder-form-row input[type="text"], .tutor-quiz-builder-form-row input[type="number"]{
1012
+ height: 42px;
1013
+ width: 100%;
1014
+ }
1015
+ #quiz-builder-tab-quiz-info input[type="text"], #quiz-builder-tab-quiz-info textarea{
1016
+ width: 100%;
1017
+ }
1018
+
1019
+
1020
+ .tutor-quiz-builder-modal-control-btn-group{
1021
+ display: flex;
1022
+ }
1023
+ .tutor-quiz-builder-modal-control-btn-group .quiz-builder-btn-group-left {
1024
+ flex: 1;
1025
+ }
1026
+ .tutor-quiz-builder-modal-control-btn-group .quiz-modal-tab-navigation-btn{
1027
+ display: inline-block;
1028
+ }
1029
+ .modal-container .tutor-quiz-add-question-btn{
1030
+ border: 1px solid #C6C9CF;
1031
+ padding: 10px 15px;
1032
+ color: #393C40;
1033
+ display: inline-block;
1034
+ border-radius: 3px;
1035
+ }
1036
+ .modal-container .tutor-quiz-add-question-btn i{
1037
+ color: #3057D5;
1038
+ }
1039
+ .tutor-quiz-builder-modal-wrap label {
1040
+ font-size: 14px;
1041
+ font-weight: 500;
1042
+ margin-bottom: 10px;
1043
+ display: block;
1044
+ }
1045
+ .tutor-quiz-builder-form-cols-row {
1046
+ display: flex;
1047
+ margin-bottom: 20px;
1048
+ }
1049
+ .quiz-form-field-col{
1050
+ padding-right: 20px;
1051
+ margin-right: 20px;
1052
+ }
1053
+ .quiz-form-field-col.result-fail{
1054
+ width: 100%;
1055
+ }
1056
+ .quiz-modal-switch-field {
1057
+ display: flex;
1058
+ margin-top: 30px;
1059
+ }
1060
+ .quiz-modal-switch-field label.btn-switch {
1061
+ margin-right: 20px;
1062
+ position: relative;
1063
+ }
1064
+ .switch-btn-title {
1065
+ position: absolute;
1066
+ left: 50px;
1067
+ width: 300px;
1068
+ top: -5px;
1069
+ }
1070
+ .tutor-quiz-builder-form-row label.btn-switch input:checked + .btn-slider {
1071
+ background-color: #4CD964;
1072
+ }
1073
+ .tutor-select {
1074
+ position: relative;
1075
+ }
1076
+ .tutor-select .select-header{
1077
+ border: 1px solid #DEDEDE;
1078
+ margin: 0;
1079
+ padding: 10px;
1080
+ width: 100%;
1081
+ box-shadow: none;
1082
+ background-color: #fff;
1083
+ display: flex;
1084
+ cursor: pointer;
1085
+ }
1086
+ .tutor-select .select-header .lead-option {
1087
+ flex: 1;
1088
+ }
1089
+ .tutor-select .tutor-select-options {
1090
+ border: 1px solid #DEDEDE;
1091
+ background-color: #fff;
1092
+ padding: 10px;
1093
+ width: 400px;
1094
+ position: absolute;
1095
+ font-size: 0;
1096
+ z-index: 9;
1097
+ }
1098
+ .tutor-select .tutor-select-options .tutor-select-option {
1099
+ width: 46%;
1100
+ display: inline-block;
1101
+ padding: 2%;
1102
+ cursor: pointer;
1103
+ }
1104
+ .tutor-select .tutor-select-options .tutor-select-option:hover {
1105
+ background: #eee;
1106
+ }
1107
+
1108
+ i.tutor-icon-block {
1109
+ padding: 5px;
1110
+ color: #fff;
1111
+ border-radius: 3px;
1112
+ margin-right: 2px;
1113
+ }
1114
+ i.tutor-icon-block.tutor-icon-short-ans{
1115
+ background-color: #f37512;
1116
+ }
1117
+ i.tutor-icon-block.tutor-icon-image-ans{
1118
+ background-color: #a322f9;
1119
+ }
1120
+ i.tutor-icon-block.tutor-icon-yes-no{
1121
+ background-color: #1a4bd8;
1122
+ }
1123
+ i.tutor-icon-block.tutor-icon-multiple-choice{
1124
+ background-color: #9034a9;
1125
+ }
1126
+ i.tutor-icon-block.tutor-icon-mark{
1127
+ background-color: #00b890;
1128
+ }
1129
+ i.tutor-icon-block.tutor-icon-open-ended{
1130
+ background-color: #fe3129;
1131
+ }
1132
+ i.tutor-icon-block.tutor-icon-fill-gaps{
1133
+ background-color: #ffbf00;
1134
+ }
1135
+ i.tutor-icon-block.tutor-icon-answer-shorting{
1136
+ background-color: #f80089;
1137
+ }
1138
+ i.tutor-icon-block.tutor-icon-assesment{
1139
+ background-color: #274055;
1140
+ }
1141
+ i.tutor-icon-block.tutor-icon-matching{
1142
+ background-color: #8a4a1b;
1143
+ }
1144
+ i.tutor-icon-block.tutor-icon-image-matching{
1145
+ background-color: #8a4a1b;
1146
+ }
1147
+ i.tutor-icon-block.tutor-icon-ordering{
1148
+ background-color: #1128d4;
1149
+ }
1150
+ i.tutor-icon-block.tutor-icon-plus-square-button, i.tutor-icon-block.tutor-icon-plus{
1151
+ background-color: #7BBC30;
1152
+ }
1153
+
1154
+ .quiz-modal-field-wrap .question_options_group_wrap {
1155
+ margin: 20px 0;
1156
+ display: block;
1157
+ clear: both;
1158
+ }
1159
+ .quiz-modal-field-wrap .add_question_option {
1160
+ display: block;
1161
+ }
1162
+ .quiz-modal-field-wrap.label-inline label{
1163
+ display: inline-block;
1164
+ font-weight: 300;
1165
+ margin-right: 20px;
1166
+ }
1167
+ a.back-to-quiz-questions-btn {
1168
+ font-size: 16px;
1169
+ font-weight: 300;
1170
+ color: #393C40;
1171
+ margin-bottom: 10px;
1172
+ display: block;
1173
+ }
1174
+ .modal-container .quiz-questions-form {
1175
+ padding: 20px;
1176
+ }
1177
+
1178
+ .tutor-quiz-builder-form-row .quiz-modal-form-help {
1179
+ color: #A4A4A4;
1180
+ font-style: italic;
1181
+ font-weight: 300;
1182
+ font-size: 12px;
1183
+ margin-top: 10px !important;
1184
+ }
1185
+ #quiz-builder-tab-advanced-options .tutor-quiz-builder-form-cols-row .quiz-form-field-col:first-child{
1186
+ flex: 0 0 150px;
1187
+ }
1188
+ .question-form-header {
1189
+ margin-bottom: 20px;
1190
+ }
1191
+ .quiz-question-form-body {
1192
+ margin-bottom: 50px;
1193
+ }
1194
+ .quiz-builder-question-wrap {
1195
+ display: flex;
1196
+ margin-bottom: 5px;
1197
+ }
1198
+ .quiz-builder-question {
1199
+ flex: 1;
1200
+ display: flex;
1201
+ background: #fff;
1202
+ padding: 10px;
1203
+ border: 1px solid #E2E2E2;
1204
+ }
1205
+ .quiz-builder-question .question-sorting {
1206
+ margin-right: 10px;
1207
+ }
1208
+ .quiz-builder-question .question-title {
1209
+ flex: 1;
1210
+ }
1211
+ .quiz-builder-question .question-icon {
1212
+ flex: 0 0 170px;
1213
+ }
1214
+ .quiz-builder-qustion-trash a{
1215
+ display: block;
1216
+ padding: 10px;
1217
+ font-size: 20px;
1218
+ color: #393C40;
1219
+ }
1220
+ .tutor-quiz-builder-modal-wrap select {
1221
+ border: 1px solid #ccc;
1222
+ box-shadow: none;
1223
+ height: 37px !important;
1224
+ }
1225
+ .tutor-quiz-builder-modal-wrap .tutor-field-type-slider{
1226
+ border: 1px solid #DEDEDE;
1227
+ padding: 10px;
1228
+ background-color: #ffffff;
1229
+ }
1230
+ .tutor-quiz-builder-modal-wrap .tutor-field-type-slider .ui-widget-content {
1231
+ background-color: #3057D5;
1232
+ border: none;
1233
+ }
1234
+ .tutor-quiz-builder-modal-wrap .tutor-field-type-slider .ui-widget-header{
1235
+ background: #DEDEDE;
1236
+ }
1237
+ .tutor-quiz-builder-modal-wrap .tutor-field-type-slider .ui-widget-content .ui-state-default{
1238
+ background-color: #3057D5;
1239
+ border: 1px solid #3057D5;
1240
+ border-radius: 50%;
1241
+ }
1242
+ .tutor-quiz-builder-modal-wrap .tutor-field-type-slider .tutor-field-type-slider-value {
1243
+ font-size: 16px;
1244
+ font-weight: 600;
1245
+ }
1246
+ .tutor-quiz-answer-wrap {
1247
+ display: flex;
1248
+ }
1249
+ .tutor-quiz-answer {
1250
+ background-color: #fff;
1251
+ flex: 1;
1252
+ margin-bottom: 10px;
1253
+ padding: 10px;
1254
+ border: 1px solid #DEDEDE;
1255
+ display: flex;
1256
+ }
1257
+ .tutor-quiz-answer .tutor-quiz-answer-edit a {
1258
+ display: block;
1259
+ padding: 0px 9px;
1260
+ }
1261
+ .tutor-quiz-answer-trash-wrap a.answer-trash-btn {
1262
+ padding: 10px;
1263
+ display: inline-block;
1264
+ }
1265
+ span.tutor-quiz-answer-title {
1266
+ flex: 1;
1267
+ }
1268
+ .tutor-quiz-answer-media .option-media-preview{
1269
+ margin-bottom: 20px;
1270
+ }
1271
+ .tutor-quiz-answer-media .option-media-preview img {
1272
+ max-width: 80px;
1273
+ height: auto;
1274
+ }
1275
+ .tutor-question-answer-image{
1276
+ margin-right: 10px;
1277
+ }
1278
+ .tutor-question-answer-image img{
1279
+ max-height: 25px;
1280
+ width: auto;
1281
+ }
1282
+ button#quiz-answer-save-btn, button#quiz-answer-edit-btn {
1283
+ background-color: #7BBC30;
1284
+ color: #fff;
1285
+ padding: 10px 15px;
1286
+ border: none;
1287
+ cursor: pointer;
1288
+ }
1289
+ button#quiz-answer-save-btn:hover, button#quiz-answer-edit-btn:hover {
1290
+ background-color: #5e981b;
1291
+ }
1292
  /**
1293
+ Tutor Media Upload
1294
  */
1295
 
1296
+ .tutor-media-upload-wrap {
1297
+ border: 1px solid #DEDEDE;
1298
+ display: flex;
1299
+ width: 130px;
1300
+ }
1301
+ .tutor-media-upload-wrap img{
1302
+ max-width: 100%;
1303
+ }
1304
+ .tutor-media-preview {
1305
+ flex: 1;
1306
+ }
1307
+ .tutor-media-upload-btn {
1308
+ display: block;
1309
+ padding: 10px;
1310
+ font-size: 50px;
1311
+ line-height: 50px;
1312
+ text-align: center;
1313
+ color: #DEDEDE;
1314
+ }
1315
+ .tutor-media-upload-trash-wrap {
1316
+ border-left: 1px solid #dedede;
1317
+ }
1318
+ .tutor-media-upload-trash {
1319
+ color: #dedede;
1320
+ display: block;
1321
+ line-height: 50px;
1322
+ padding: 12px;
1323
+ }
1324
+ .tutor-quiz-answers-form-footer.tutor-quiz-builder-form-row {
1325
+ margin-top: 40px;
1326
+ margin-bottom: 10px;
1327
+ }
1328
+
1329
+ /**
1330
+ #End Quiz Modal
1331
+ */
1332
+
1333
  .tutor-available-quizzes .added-quiz-item {
1334
  background-color: #f5f5f5;
1335
  padding: 10px;
1352
  font-size: 12px;
1353
  }
1354
  span.result-pass{
1355
+ color: #04a704;
 
 
1356
  }
1357
  span.result-fail{
1358
+ color: #FF0000;
 
 
1359
  }
 
1360
  .tutor-quiz-attempt-info-row{
1361
  margin: 30px 0;
1362
  display: flex;
1380
  .quiz-attempt-student-info{
1381
  margin-left: 20px;
1382
  }
 
1383
  .tutor-quiz-attempt-info-row .quiz-attempt-info-row{
1384
  display: flex;
1385
  }
 
1386
  .tutor-quiz-attempt-info-row .quiz-attempt-info-row .attempt-property-name{
1387
  width: 25%;
1388
  }
1418
  color: #393C40;
1419
  text-decoration: none;
1420
  }
1421
+ .answer-image-matched-wrap {
1422
+ display: flex;
1423
+ }
1424
+ .image-matching-item {
1425
+ flex: 0 0 50px;
1426
+ margin-right: 10px;
1427
+ padding: 5px;
1428
+ border: 1px solid #dddddd;
1429
+ }
1430
+ .image-matching-item img{
1431
+ max-width: 80px;
1432
+ }
1433
+ span.filled_dash_unser {
1434
+ font-weight: bold;
1435
+ text-decoration: underline;
1436
+ margin: 0 5px;
1437
+ }
1438
  /**
1439
  Uninstall
1440
  */
1462
  margin-right: 6px;
1463
  }
1464
 
 
1465
  /**
1466
  Lesson Edit Modal
1467
  */
1475
  line-height: 8px;
1476
  font-size: 12px;
1477
  }
 
1478
  .lesson-modal-form-wrap .lesson-modal-field-row{
1479
  padding: 10px 0;
1480
  }
1514
  bottom: 0;
1515
  position: -webkit-sticky;
1516
  }
 
1517
  .tutor-lesson-modal-wrap .tutor-thumbnail-wrap img{
1518
  max-width: 150px;
1519
  height: auto;
1520
  }
1521
  .tutor-get-pro-text {
1522
  color: #e02424;
1523
+ }
1524
+ .updating-icon:before{
1525
+ font-family: 'tutor';
1526
+ margin-right: 5px;
1527
+ content: "\e91d";
1528
+ -moz-animation: spin 2s infinite linear;
1529
+ -o-animation: spin 2s infinite linear;
1530
+ -webkit-animation: spin 2s infinite linear;
1531
+ animation: spin 2s infinite linear;
1532
+ display: inline-block;
1533
  }
assets/css/tutor-front.css CHANGED
@@ -1064,7 +1064,7 @@ Instructor
1064
  .tutor-lesson-sidebar{
1065
  flex: 0 0 400px;
1066
  }
1067
- .tutor-lesson-content {
1068
  flex: 1;
1069
  }
1070
  .tutor-single-lesson-button-group .tutor-single-lesson-button a,
@@ -1137,12 +1137,12 @@ Instructor
1137
  border-top: 1px solid #DCE4E6;
1138
  display: none;
1139
  }
1140
- .tutor-topics-lesson-list .tutor-lesson-right-icons{
1141
  position: absolute;
1142
  right: 15px;
1143
  top: 14px;
1144
  }
1145
- .tutor-topics-lesson-list .tutor-lesson-right-icons .tutor-lesson-complete{
1146
  height: 16px;
1147
  width: 16px;
1148
  border: 1px solid #E8EFF1;
@@ -1155,16 +1155,16 @@ Instructor
1155
  vertical-align: middle;
1156
  margin-left: 8px;
1157
  }
1158
- .tutor-topics-lesson-list .tutor-single-lesson-items.active .tutor-lesson-right-icons .tutor-lesson-complete{
1159
  border-color: #b7d6b7;
1160
  }
1161
- .tutor-topics-lesson-list .tutor-single-lesson-items.active .tutor-lesson-right-icons .tutor-lesson-complete.tutor-done,
1162
- .tutor-topics-lesson-list .tutor-lesson-right-icons .tutor-lesson-complete.tutor-done{
1163
  background: #86B223;
1164
  border-color: #86B223;
1165
  color: #fff;
1166
  }
1167
- .tutor-topics-lesson-list .tutor-lesson-right-icons i{
1168
  font-style: normal;
1169
  }
1170
 
@@ -1189,7 +1189,7 @@ Instructor
1189
  text-align: right;
1190
  margin-right: 30px;
1191
  }
1192
- .tutor-lesson-content-area{
1193
  margin: 0 100px;
1194
  }
1195
  .tutor-lesson-sidebar-hide-bar{
@@ -1234,18 +1234,48 @@ Instructor
1234
  font-weight: 400;
1235
  background: #F4F8FA;
1236
  }
1237
-
1238
  .tutor-lesson-video-wrap .plyr--video{
1239
  border-radius: 4px;
1240
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1241
 
1242
- /*attachment*/
1243
-
 
 
 
 
 
 
 
 
 
 
 
1244
 
 
1245
  .tutor-attachments-wrap{
1246
  margin: -3px -3px 15px -3px;
1247
  }
1248
-
1249
  .tutor-attachments-wrap .tutor-lesson-attachment{
1250
  display: inline-block;
1251
  border: 1px solid #E8EFF1;
@@ -1256,11 +1286,9 @@ Instructor
1256
  margin: 3px;
1257
  transition: 300ms;
1258
  }
1259
-
1260
  .tutor-attachments-wrap .tutor-lesson-attachment:hover{
1261
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
1262
  }
1263
-
1264
  .tutor-attachments-wrap .tutor-attachment-icon{
1265
  font-size: 30px;
1266
  float: left;
@@ -1307,14 +1335,12 @@ Instructor
1307
  border-radius: 30px;
1308
  margin-top: 7.5px;
1309
  }
1310
-
1311
  .tutor-progress-bar .tutor-progress-filled{
1312
  background-color: #1B52D8;
1313
  height: 8px;
1314
  border-radius: 30px;
1315
  width: var(--tutor-progress-left);
1316
  }
1317
-
1318
  .tutor-progress-bar .tutor-progress-filled::after{
1319
  content: '';
1320
  position: absolute;
@@ -1328,7 +1354,6 @@ Instructor
1328
  top: 50%;
1329
  box-sizing: border-box;
1330
  }
1331
-
1332
  .tutor-progress-percent{
1333
  -ms-flex: 0 0 auto;
1334
  flex: 0 0 auto;
@@ -1339,7 +1364,6 @@ Instructor
1339
  .tutor-course-purchase-box{
1340
  margin-bottom: 0;
1341
  }
1342
-
1343
  .tutor-price-preview-box .tutor-course-purchase-box button{
1344
  display: block;
1345
  width: 100%;
@@ -1348,7 +1372,6 @@ Instructor
1348
  text-transform: uppercase;
1349
  font-size: 14px;
1350
  }
1351
-
1352
  .tutor-price-preview-box .tutor-course-purchase-box button i{
1353
  margin-right: 8px;
1354
  }
@@ -1362,7 +1385,6 @@ Instructor
1362
  .tutor-price-preview-box .tutor-course-material-includes-wrap{
1363
  margin-bottom: 25px;
1364
  }
1365
-
1366
  .tutor-alert-warning{
1367
  padding: 10px;
1368
  color: #8a6d3b;
@@ -1374,7 +1396,6 @@ Instructor
1374
  overflow: hidden;
1375
  margin: -10px -10px 35px;
1376
  }
1377
-
1378
  .tutor-lead-info-btn-group .tutor-course-compelte-form-wrap{
1379
  display: inline-block;
1380
  }
@@ -1382,7 +1403,6 @@ Instructor
1382
  .tutor-lead-info-btn-group .tutor-course-compelte-form-wrap form{
1383
  margin: 0;
1384
  }
1385
-
1386
  .tutor-lead-info-btn-group a.tutor-button,
1387
  .tutor-lead-info-btn-group .tutor-course-compelte-form-wrap button{
1388
  display: block;
@@ -1671,13 +1691,11 @@ Course question and answer
1671
  text-align: center;
1672
  font-size: 17px;
1673
  }
1674
-
1675
  .question-top-meta .tutor-question-avater a img{
1676
  width: 50px;
1677
  height: 50px;
1678
  border-radius: 50%;
1679
  }
1680
-
1681
  .question-top-meta{
1682
  overflow: hidden;
1683
  margin-bottom: 20px;
@@ -1726,14 +1744,11 @@ Course question and answer
1726
  .announcement-delete-btn{
1727
  float: right;
1728
  }
1729
-
1730
  .tutor-announcement-title-wrap h3{
1731
  color: #4B5981;
1732
  font-weight: 500;
1733
  margin-bottom: 10px;
1734
  }
1735
-
1736
-
1737
  /* ********************* */
1738
  /* Single Quiz */
1739
  /* ********************* */
@@ -1748,7 +1763,6 @@ Course question and answer
1748
  text-transform: uppercase;
1749
  font-size: 10px;
1750
  }
1751
-
1752
  .tutor-quiz-header h2{
1753
  color: #4B5981;
1754
  font-size: 36px;
@@ -1756,7 +1770,6 @@ Course question and answer
1756
  font-weight: 500;
1757
  margin-bottom: 15px;
1758
  }
1759
-
1760
  .tutor-quiz-header h5{
1761
  font-size: 14px;
1762
  color: #8C94A8;
@@ -1776,14 +1789,11 @@ Course question and answer
1776
  justify-content: space-between;
1777
  font-size: 14px;
1778
  }
1779
-
1780
-
1781
  .tutor-quiz-header .tutor-quiz-meta li{
1782
  display: inline-block;
1783
  color: #4B5981;
1784
  }
1785
 
1786
-
1787
  @media (max-width: 767px) {
1788
  .tutor-quiz-header .tutor-quiz-meta{
1789
  display: block;
@@ -1799,17 +1809,14 @@ Course question and answer
1799
  border-radius: 4px;
1800
  }
1801
  }
1802
-
1803
  .tutor-quiz-header .tutor-quiz-meta li strong{
1804
  display: block;
1805
  color: #B1B8C9;
1806
  font-weight: 400;
1807
  }
1808
-
1809
  .tutor-quiz-attempt-history{
1810
  overflow-x: auto;
1811
  }
1812
-
1813
  .tutor-quiz-attempt-history-title{
1814
  font-size: 18px;
1815
  color: #8C94A8;
@@ -1818,7 +1825,6 @@ Course question and answer
1818
  margin-bottom: 15px;
1819
  margin-top: 70px;
1820
  }
1821
-
1822
  .tutor-quiz-attempt-history table{
1823
  border-collapse: collapse;
1824
  border-radius: 4px;
@@ -1831,9 +1837,8 @@ Course question and answer
1831
  .tutor-quiz-attempt-history th,
1832
  .tutor-quiz-attempt-history td{
1833
  border: 1px solid #E8EFF1;
 
1834
  }
1835
-
1836
-
1837
  .tutor-quiz-attempt-history table span.result-fail,
1838
  .tutor-quiz-attempt-history table span.result-pass{
1839
  display: inline-block;
@@ -1844,7 +1849,6 @@ Course question and answer
1844
  line-height: 26px;
1845
  text-align: center;
1846
  }
1847
-
1848
  .tutor-quiz-attempt-history table span.result-fail{
1849
  background: #DF3247;
1850
  }
@@ -1852,28 +1856,72 @@ Course question and answer
1852
  .tutor-quiz-attempt-history table span.result-pass{
1853
  background: #99C335;
1854
  }
1855
-
 
 
 
 
1856
  .quiz-head-meta-info{
1857
  font-size: 14px;
1858
  color: #8C94A8;
1859
  margin-bottom: 40px;
1860
  }
1861
-
1862
  .quiz-head-meta-info span{
1863
  color: #4B5981;
1864
  }
1865
-
 
 
1866
  .tutor-quiz-single-wrap .question-text{
1867
  color: #4B5981;
1868
  font-size: 20px;
1869
  font-weight: 600;
1870
  }
1871
-
1872
- .tutor-quiz-answare-wrap{
1873
- margin-bottom: 40px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1874
  }
1875
 
1876
- .tutor-quiz-answare-wrap label{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1877
  display: block;
1878
  position: relative;
1879
  padding-left: 30px;
@@ -1881,15 +1929,13 @@ Course question and answer
1881
  font-size: 14px;
1882
  cursor: pointer;
1883
  }
1884
- .tutor-quiz-answare-wrap label input{
1885
  display: none;
1886
  }
1887
-
1888
- .tutor-quiz-answare-wrap label input + span{
1889
  line-height: 20px;
1890
  }
1891
-
1892
- .tutor-quiz-answare-wrap label input + span::before{
1893
  content: '';
1894
  width: 20px;
1895
  height: 20px;
@@ -1901,14 +1947,11 @@ Course question and answer
1901
  top: 50%;
1902
  transform: translateY(-50%);
1903
  }
1904
-
1905
- .tutor-quiz-answare-wrap label input:checked + span::before{
1906
  background: #1B52D8;
1907
  border-color: #1B52D8;
1908
  }
1909
-
1910
-
1911
- .tutor-quiz-answare-wrap label input:checked + span::after{
1912
  content: '\e90f';
1913
  position: absolute;
1914
  left: 0;
@@ -1920,22 +1963,133 @@ Course question and answer
1920
  left: 4px;
1921
  font-size: 14px;
1922
  }
1923
-
1924
-
1925
- .tutor-quiz-answare-wrap label input[type="radio"] + span::before{
1926
  content: '';
1927
  border-radius: 50%;
1928
  }
1929
-
1930
- .tutor-quiz-answare-wrap label input[type="radio"] + span::after{
1931
  content: '';
1932
  height: 10px;
1933
  width: 10px;
1934
  background: #fff;
1935
  border-radius: 50%;
1936
  left: 6px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1937
  }
1938
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1939
  /* ********************* */
1940
  /*start global login form*/
1941
  /* ********************* */
@@ -1944,17 +2098,14 @@ Course question and answer
1944
  max-width: 560px;
1945
  margin: 0 auto;
1946
  }
1947
-
1948
  .tutor-login-form-wrap p{
1949
  margin-bottom: 0;
1950
  }
1951
-
1952
  .tutor-login-form-wrap label{
1953
  display: block;
1954
  font-size: 13px;
1955
  margin-bottom: 4px;
1956
  }
1957
-
1958
  .tutor-login-form-wrap input[type="password"],
1959
  .tutor-login-form-wrap input[type="text"]{
1960
  width: 100%;
@@ -1973,7 +2124,6 @@ Course question and answer
1973
  background: #ffffff;
1974
  border-color: #1B52D8;
1975
  }
1976
-
1977
  .tutor-login-form-wrap input::-webkit-input-placeholder {
1978
  color: #b0b6c8;
1979
  opacity: 1;
@@ -1990,13 +2140,11 @@ Course question and answer
1990
  color: #b0b6c8;
1991
  opacity: 1;
1992
  }
1993
-
1994
  .tutor-login-rememeber-wrap{
1995
  overflow: hidden;
1996
  text-align: right;
1997
  margin-bottom: 30px;
1998
  }
1999
-
2000
  .tutor-login-rememeber-wrap p{
2001
  display: inline-block;
2002
  float: left;
@@ -2006,8 +2154,6 @@ Course question and answer
2006
  .tutor-login-rememeber-wrap label{
2007
  margin: 0;
2008
  }
2009
-
2010
-
2011
  .tutor-form-register-wrap a,
2012
  .tutor-login-rememeber-wrap a,
2013
  .tutor-login-rememeber-wrap label{
@@ -2018,15 +2164,11 @@ Course question and answer
2018
  transition: 300ms;
2019
  }
2020
 
2021
-
2022
-
2023
  .tutor-form-register-wrap a:hover,
2024
  .tutor-login-rememeber-wrap a:hover,
2025
  .tutor-login-rememeber-wrap label:hover{
2026
  opacity: 1;
2027
  }
2028
-
2029
-
2030
  .tutor-login-form-wrap input[type="submit"]{
2031
  color: #fff;
2032
  background-color: #86B223;
@@ -2046,8 +2188,6 @@ Course question and answer
2046
  background-color: #759c1f;
2047
  border-color: #759c1f;
2048
  }
2049
-
2050
-
2051
  .tutor-login-form-wrap input[type="checkbox"]{
2052
  margin-right: 4px;
2053
  }
1064
  .tutor-lesson-sidebar{
1065
  flex: 0 0 400px;
1066
  }
1067
+ .tutor-single-entry-content {
1068
  flex: 1;
1069
  }
1070
  .tutor-single-lesson-button-group .tutor-single-lesson-button a,
1137
  border-top: 1px solid #DCE4E6;
1138
  display: none;
1139
  }
1140
+ .tutor-lessons-under-topic .tutor-lesson-right-icons{
1141
  position: absolute;
1142
  right: 15px;
1143
  top: 14px;
1144
  }
1145
+ .tutor-lessons-under-topic .tutor-lesson-right-icons .tutor-lesson-complete{
1146
  height: 16px;
1147
  width: 16px;
1148
  border: 1px solid #E8EFF1;
1155
  vertical-align: middle;
1156
  margin-left: 8px;
1157
  }
1158
+ .tutor-lessons-under-topic .tutor-single-lesson-items.active .tutor-lesson-right-icons .tutor-lesson-complete{
1159
  border-color: #b7d6b7;
1160
  }
1161
+ .tutor-lessons-under-topic .tutor-single-lesson-items.active .tutor-lesson-right-icons .tutor-lesson-complete.tutor-done,
1162
+ .tutor-lessons-under-topic .tutor-lesson-right-icons .tutor-lesson-complete.tutor-done{
1163
  background: #86B223;
1164
  border-color: #86B223;
1165
  color: #fff;
1166
  }
1167
+ .tutor-lessons-under-topic .tutor-lesson-right-icons i{
1168
  font-style: normal;
1169
  }
1170
 
1189
  text-align: right;
1190
  margin-right: 30px;
1191
  }
1192
+ .tutor-lesson-content-area, .tutor-quiz-single-wrap {
1193
  margin: 0 100px;
1194
  }
1195
  .tutor-lesson-sidebar-hide-bar{
1234
  font-weight: 400;
1235
  background: #F4F8FA;
1236
  }
 
1237
  .tutor-lesson-video-wrap .plyr--video{
1238
  border-radius: 4px;
1239
  }
1240
+ #tutor-lesson-sidebar-qa-tab-content{
1241
+ background-color: #ffffff;
1242
+ padding: 20px;
1243
+ }
1244
+ #tutor-lesson-sidebar-qa-tab-content .tutor-add-question-wrap{
1245
+ border-top: 1px solid #E8EFF1;
1246
+ padding-top: 25px;
1247
+ }
1248
+ #tutor-lesson-sidebar-qa-tab-content .tutor-add-question-wrap h3{
1249
+ color: #1B52D8;
1250
+ }
1251
+ #tutor-lesson-sidebar-qa-tab-content .tutor-add-question-wrap button.tutor_ask_question_btn {
1252
+ display: block;
1253
+ width: 100%;
1254
+ background-color: #1B52D8;
1255
+ }
1256
+ #tutor-lesson-sidebar-qa-tab-content .tutor_question_answer_wrap .tutor_original_question{
1257
+ margin-bottom: 20px;
1258
+ margin-top: 20px;
1259
+ }
1260
 
1261
+ .tutor-lesson-sidebar-emptyqa-wrap{
1262
+ text-align: center;
1263
+ padding: 50px 20px;
1264
+ color: #4B5981;
1265
+ }
1266
+ .tutor-lesson-sidebar-emptyqa-wrap h3{
1267
+ margin: 0;
1268
+ padding: 0 0 25px;
1269
+ }
1270
+ .tutor-lesson-sidebar-emptyqa-wrap i{
1271
+ font-size: 150px;
1272
+ color: #E8EFF1;
1273
+ }
1274
 
1275
+ /*attachment*/
1276
  .tutor-attachments-wrap{
1277
  margin: -3px -3px 15px -3px;
1278
  }
 
1279
  .tutor-attachments-wrap .tutor-lesson-attachment{
1280
  display: inline-block;
1281
  border: 1px solid #E8EFF1;
1286
  margin: 3px;
1287
  transition: 300ms;
1288
  }
 
1289
  .tutor-attachments-wrap .tutor-lesson-attachment:hover{
1290
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
1291
  }
 
1292
  .tutor-attachments-wrap .tutor-attachment-icon{
1293
  font-size: 30px;
1294
  float: left;
1335
  border-radius: 30px;
1336
  margin-top: 7.5px;
1337
  }
 
1338
  .tutor-progress-bar .tutor-progress-filled{
1339
  background-color: #1B52D8;
1340
  height: 8px;
1341
  border-radius: 30px;
1342
  width: var(--tutor-progress-left);
1343
  }
 
1344
  .tutor-progress-bar .tutor-progress-filled::after{
1345
  content: '';
1346
  position: absolute;
1354
  top: 50%;
1355
  box-sizing: border-box;
1356
  }
 
1357
  .tutor-progress-percent{
1358
  -ms-flex: 0 0 auto;
1359
  flex: 0 0 auto;
1364
  .tutor-course-purchase-box{
1365
  margin-bottom: 0;
1366
  }
 
1367
  .tutor-price-preview-box .tutor-course-purchase-box button{
1368
  display: block;
1369
  width: 100%;
1372
  text-transform: uppercase;
1373
  font-size: 14px;
1374
  }
 
1375
  .tutor-price-preview-box .tutor-course-purchase-box button i{
1376
  margin-right: 8px;
1377
  }
1385
  .tutor-price-preview-box .tutor-course-material-includes-wrap{
1386
  margin-bottom: 25px;
1387
  }
 
1388
  .tutor-alert-warning{
1389
  padding: 10px;
1390
  color: #8a6d3b;
1396
  overflow: hidden;
1397
  margin: -10px -10px 35px;
1398
  }
 
1399
  .tutor-lead-info-btn-group .tutor-course-compelte-form-wrap{
1400
  display: inline-block;
1401
  }
1403
  .tutor-lead-info-btn-group .tutor-course-compelte-form-wrap form{
1404
  margin: 0;
1405
  }
 
1406
  .tutor-lead-info-btn-group a.tutor-button,
1407
  .tutor-lead-info-btn-group .tutor-course-compelte-form-wrap button{
1408
  display: block;
1691
  text-align: center;
1692
  font-size: 17px;
1693
  }
 
1694
  .question-top-meta .tutor-question-avater a img{
1695
  width: 50px;
1696
  height: 50px;
1697
  border-radius: 50%;
1698
  }
 
1699
  .question-top-meta{
1700
  overflow: hidden;
1701
  margin-bottom: 20px;
1744
  .announcement-delete-btn{
1745
  float: right;
1746
  }
 
1747
  .tutor-announcement-title-wrap h3{
1748
  color: #4B5981;
1749
  font-weight: 500;
1750
  margin-bottom: 10px;
1751
  }
 
 
1752
  /* ********************* */
1753
  /* Single Quiz */
1754
  /* ********************* */
1763
  text-transform: uppercase;
1764
  font-size: 10px;
1765
  }
 
1766
  .tutor-quiz-header h2{
1767
  color: #4B5981;
1768
  font-size: 36px;
1770
  font-weight: 500;
1771
  margin-bottom: 15px;
1772
  }
 
1773
  .tutor-quiz-header h5{
1774
  font-size: 14px;
1775
  color: #8C94A8;
1789
  justify-content: space-between;
1790
  font-size: 14px;
1791
  }
 
 
1792
  .tutor-quiz-header .tutor-quiz-meta li{
1793
  display: inline-block;
1794
  color: #4B5981;
1795
  }
1796
 
 
1797
  @media (max-width: 767px) {
1798
  .tutor-quiz-header .tutor-quiz-meta{
1799
  display: block;
1809
  border-radius: 4px;
1810
  }
1811
  }
 
1812
  .tutor-quiz-header .tutor-quiz-meta li strong{
1813
  display: block;
1814
  color: #B1B8C9;
1815
  font-weight: 400;
1816
  }
 
1817
  .tutor-quiz-attempt-history{
1818
  overflow-x: auto;
1819
  }
 
1820
  .tutor-quiz-attempt-history-title{
1821
  font-size: 18px;
1822
  color: #8C94A8;
1825
  margin-bottom: 15px;
1826
  margin-top: 70px;
1827
  }
 
1828
  .tutor-quiz-attempt-history table{
1829
  border-collapse: collapse;
1830
  border-radius: 4px;
1837
  .tutor-quiz-attempt-history th,
1838
  .tutor-quiz-attempt-history td{
1839
  border: 1px solid #E8EFF1;
1840
+ padding: 10px !important;
1841
  }
 
 
1842
  .tutor-quiz-attempt-history table span.result-fail,
1843
  .tutor-quiz-attempt-history table span.result-pass{
1844
  display: inline-block;
1849
  line-height: 26px;
1850
  text-align: center;
1851
  }
 
1852
  .tutor-quiz-attempt-history table span.result-fail{
1853
  background: #DF3247;
1854
  }
1856
  .tutor-quiz-attempt-history table span.result-pass{
1857
  background: #99C335;
1858
  }
1859
+ .attempt-reviewed-text {
1860
+ color: #777;
1861
+ font-size: 12px;
1862
+ margin-top: 10px;
1863
+ }
1864
  .quiz-head-meta-info{
1865
  font-size: 14px;
1866
  color: #8C94A8;
1867
  margin-bottom: 40px;
1868
  }
 
1869
  .quiz-head-meta-info span{
1870
  color: #4B5981;
1871
  }
1872
+ #tutor-quiz-attempt-questions-wrap {
1873
+ margin-bottom: 50px;
1874
+ }
1875
  .tutor-quiz-single-wrap .question-text{
1876
  color: #4B5981;
1877
  font-size: 20px;
1878
  font-weight: 600;
1879
  }
1880
+ .tutor-quiz-single-wrap .question-description{
1881
+ color: #4B5981;
1882
+ font-size: 14px;
1883
+ font-weight: 300;
1884
+ }
1885
+ .quiz-attempt-single-question {
1886
+ margin-bottom: 80px;
1887
+ }
1888
+ .fill-in-the-blank-field {
1889
+ display: flex;
1890
+ vertical-align: bottom;
1891
+ align-items: flex-end;
1892
+ }
1893
+ .fill-in-the-blank-field .fill-in-the-blank-text-input {
1894
+ flex: 0 0 200px;
1895
+ border-top: none;
1896
+ border-left: none;
1897
+ border-right: none;
1898
+ border-bottom: 1px dashed;
1899
+ background-color: transparent;
1900
+ font-size: 14px;
1901
+ padding: 2px;
1902
+ border-radius: 0;
1903
  }
1904
 
1905
+ .tutor-quiz-answers-wrap {
1906
+ margin-bottom: 50px;
1907
+ }
1908
+ .tutor-quiz-answers-wrap label{
1909
+ display: flex;
1910
+ }
1911
+ .tutor-quiz-answers-wrap p{
1912
+ margin: 0;
1913
+ }
1914
+ .quiz-answer-image-wrap {
1915
+ margin-top: 10px;
1916
+ margin-bottom: 10px;
1917
+ max-width: 200px;
1918
+ }
1919
+ .quiz-answer-image-wrap img{
1920
+ max-width: 100%;
1921
+ height: auto;
1922
+ }
1923
+ /*
1924
+ .tutor-quiz-answers-wrap label{
1925
  display: block;
1926
  position: relative;
1927
  padding-left: 30px;
1929
  font-size: 14px;
1930
  cursor: pointer;
1931
  }
1932
+ .tutor-quiz-answers-wrap label input{
1933
  display: none;
1934
  }
1935
+ .tutor-quiz-answers-wrap label input + span{
 
1936
  line-height: 20px;
1937
  }
1938
+ .tutor-quiz-answers-wrap label input + span::before{
 
1939
  content: '';
1940
  width: 20px;
1941
  height: 20px;
1947
  top: 50%;
1948
  transform: translateY(-50%);
1949
  }
1950
+ .tutor-quiz-answers-wrap label input:checked + span::before{
 
1951
  background: #1B52D8;
1952
  border-color: #1B52D8;
1953
  }
1954
+ .tutor-quiz-answers-wrap label input:checked + span::after{
 
 
1955
  content: '\e90f';
1956
  position: absolute;
1957
  left: 0;
1963
  left: 4px;
1964
  font-size: 14px;
1965
  }
1966
+ .tutor-quiz-answers-wrap label input[type="radio"] + span::before{
 
 
1967
  content: '';
1968
  border-radius: 50%;
1969
  }
1970
+ .tutor-quiz-answers-wrap label input[type="radio"] + span::after{
 
1971
  content: '';
1972
  height: 10px;
1973
  width: 10px;
1974
  background: #fff;
1975
  border-radius: 50%;
1976
  left: 6px;
1977
+ }*/
1978
+ .question-type-ordering-item {
1979
+ border: 1px solid #D4DADB;
1980
+ padding: 10px;
1981
+ margin-bottom: 10px;
1982
+ width: 250px;
1983
+ background-color: #fff;
1984
+ display: flex;
1985
+ }
1986
+ .question-type-ordering-item .answer-title {
1987
+ flex: 1;
1988
+ }
1989
+ .question-type-ordering-item .answer-sorting-bar {
1990
+ cursor: pointer;
1991
+ }
1992
+ .quiz-answer-item-matching {
1993
+ padding: 10px 0;
1994
+ display: flex;
1995
+ }
1996
+ .quiz-answer-matching-title{
1997
+ flex: 0 0 300px;
1998
+ }
1999
+ .quiz-answer-matching-droppable {
2000
+ height: 48px;
2001
+ min-width: 200px;
2002
+ border: 1px dashed #D4DADB;
2003
+ }
2004
+ .quiz-draggable-answer-item {
2005
+ padding: 10px;
2006
+ border: 1px solid #D4DADB;
2007
+ margin-right: 10px;
2008
+ margin-bottom: 10px;
2009
+ max-width: 150px;
2010
+ background-color: #fff;
2011
+ display: inline-flex;
2012
+ width: 150px;
2013
+ }
2014
+ .quiz-draggable-answer-item .draggable-answer-title {
2015
+ flex: 1;
2016
+ }
2017
+ .quiz-draggable-rand-answers{
2018
+ min-height: 50px;
2019
+ }
2020
+ .drop-hover{
2021
+ display: none;
2022
+ }
2023
+ .quiz-answer-matching-droppable .drop-hover{
2024
+ background-color: #eeeeee;
2025
+ height: 100%;
2026
+ width: 100%;
2027
+ display: inline-block;
2028
+ float: left;
2029
+ }
2030
+ .quiz-answer-matching-droppable .quiz-draggable-answer-item{
2031
+ width: 100%;
2032
+ max-width: 100%;
2033
+ }
2034
+ .answer-type-image_matching .quiz-answer-item-matching{
2035
+ /*display: inline-block;
2036
+ width: 190px;
2037
+ margin-right: 10px;*/
2038
+ display: block;
2039
+ }
2040
+ .answer-type-image_matching .quiz-answer-matching-items-wrap {
2041
+ /*display: flex;*/
2042
+ column-count: 4;
2043
+ }
2044
+ .answer-type-image_matching .quiz-answer-matching-droppable{
2045
+ width: 100%;
2046
+ min-width: 100%;
2047
+ }
2048
+ .answer-type-image_matching img{
2049
+ width: 100%;
2050
+ height: auto;
2051
  }
2052
 
2053
+ .tutor-quiz-questions-pagination ul{
2054
+ margin: 0;
2055
+ padding: 0;
2056
+ list-style: none;
2057
+ }
2058
+ .tutor-quiz-questions-pagination ul li{
2059
+ display: inline-block;
2060
+ }
2061
+ .tutor-quiz-questions-pagination ul li a{
2062
+ background-color: #1B52D8;
2063
+ padding: 7px 13px;
2064
+ display: block;
2065
+ border-radius: 50%;
2066
+ margin-right: 10px;
2067
+ color: #ffffff;
2068
+ font-size: 14px;
2069
+ }
2070
+ .tutor-quiz-questions-pagination ul li a:hover, .tutor-quiz-questions-pagination ul li a.active {
2071
+ background-color: #05329F;
2072
+ }
2073
+
2074
+ .quiz-image-answering-wrap {
2075
+ display: flex;
2076
+ flex-wrap: wrap;
2077
+ flex-direction: row;
2078
+ /*justify-content: space-between;*/
2079
+ }
2080
+ .quiz-image-answering-wrap img{
2081
+ max-width: 100%;
2082
+ height: auto;
2083
+ }
2084
+ .quiz-image-answering-answer {
2085
+ width: calc(1/4*100% - (1 - 1/4)*10px);
2086
+ margin-right: 10px;
2087
+ }
2088
+ .quiz-image-answering-image-wrap {
2089
+ margin-bottom: 20px;
2090
+ }
2091
+
2092
+
2093
  /* ********************* */
2094
  /*start global login form*/
2095
  /* ********************* */
2098
  max-width: 560px;
2099
  margin: 0 auto;
2100
  }
 
2101
  .tutor-login-form-wrap p{
2102
  margin-bottom: 0;
2103
  }
 
2104
  .tutor-login-form-wrap label{
2105
  display: block;
2106
  font-size: 13px;
2107
  margin-bottom: 4px;
2108
  }
 
2109
  .tutor-login-form-wrap input[type="password"],
2110
  .tutor-login-form-wrap input[type="text"]{
2111
  width: 100%;
2124
  background: #ffffff;
2125
  border-color: #1B52D8;
2126
  }
 
2127
  .tutor-login-form-wrap input::-webkit-input-placeholder {
2128
  color: #b0b6c8;
2129
  opacity: 1;
2140
  color: #b0b6c8;
2141
  opacity: 1;
2142
  }
 
2143
  .tutor-login-rememeber-wrap{
2144
  overflow: hidden;
2145
  text-align: right;
2146
  margin-bottom: 30px;
2147
  }
 
2148
  .tutor-login-rememeber-wrap p{
2149
  display: inline-block;
2150
  float: left;
2154
  .tutor-login-rememeber-wrap label{
2155
  margin: 0;
2156
  }
 
 
2157
  .tutor-form-register-wrap a,
2158
  .tutor-login-rememeber-wrap a,
2159
  .tutor-login-rememeber-wrap label{
2164
  transition: 300ms;
2165
  }
2166
 
 
 
2167
  .tutor-form-register-wrap a:hover,
2168
  .tutor-login-rememeber-wrap a:hover,
2169
  .tutor-login-rememeber-wrap label:hover{
2170
  opacity: 1;
2171
  }
 
 
2172
  .tutor-login-form-wrap input[type="submit"]{
2173
  color: #fff;
2174
  background-color: #86B223;
2188
  background-color: #759c1f;
2189
  border-color: #759c1f;
2190
  }
 
 
2191
  .tutor-login-form-wrap input[type="checkbox"]{
2192
  margin-right: 4px;
2193
  }
assets/icons/css/tutor-icon.css CHANGED
@@ -22,6 +22,81 @@
22
  -moz-osx-font-smoothing: grayscale;
23
  }
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  .tutor-icon-manual:before {
26
  content: "\e936";
27
  }
@@ -193,9 +268,6 @@
193
  .tutor-icon-offer:before {
194
  content: "\e912";
195
  }
196
- .tutor-icon-play:before {
197
- content: "\e913";
198
- }
199
  .tutor-icon-plus:before {
200
  content: "\e914";
201
  }
22
  -moz-osx-font-smoothing: grayscale;
23
  }
24
 
25
+ .tutor-icon-image-ans:before {
26
+ content: "\e959";
27
+ }
28
+ .tutor-icon-short-ans:before {
29
+ content: "\e95a";
30
+ }
31
+ .tutor-icon-image-matching:before {
32
+ content: "\e956";
33
+ }
34
+ .tutor-icon-menu:before {
35
+ content: "\e957";
36
+ }
37
+ .tutor-icon-image1:before {
38
+ content: "\e958";
39
+ }
40
+ .tutor-icon-answer-shorting:before {
41
+ content: "\e94a";
42
+ }
43
+ .tutor-icon-assesment:before {
44
+ content: "\e94b";
45
+ }
46
+ .tutor-icon-fill-gaps:before {
47
+ content: "\e94c";
48
+ }
49
+ .tutor-icon-matching:before {
50
+ content: "\e94d";
51
+ }
52
+ .tutor-icon-multiple-choice:before {
53
+ content: "\e94e";
54
+ }
55
+ .tutor-icon-open-ended:before {
56
+ content: "\e94f";
57
+ }
58
+ .tutor-icon-ordering:before {
59
+ content: "\e950";
60
+ }
61
+ .tutor-icon-yes-no:before {
62
+ content: "\e951";
63
+ }
64
+ .tutor-icon-line-cross:before {
65
+ content: "\e952";
66
+ }
67
+ .tutor-icon-filter-tool-black-shape:before {
68
+ content: "\e953";
69
+ }
70
+ .tutor-icon-plus-square-button:before {
71
+ content: "\e954";
72
+ }
73
+ .tutor-icon-settings-1:before {
74
+ content: "\e955";
75
+ }
76
+ .tutor-icon-cross:before {
77
+ content: "\e913";
78
+ }
79
+ .tutor-icon-cup:before {
80
+ content: "\e943";
81
+ }
82
+ .tutor-icon-next-2:before {
83
+ content: "\e944";
84
+ }
85
+ .tutor-icon-next2:before {
86
+ content: "\e945";
87
+ }
88
+ .tutor-icon-menu-2:before {
89
+ content: "\e946";
90
+ }
91
+ .tutor-icon-question-2:before {
92
+ content: "\e947";
93
+ }
94
+ .tutor-icon-question-1:before {
95
+ content: "\e948";
96
+ }
97
+ .tutor-icon-education:before {
98
+ content: "\e949";
99
+ }
100
  .tutor-icon-manual:before {
101
  content: "\e936";
102
  }
268
  .tutor-icon-offer:before {
269
  content: "\e912";
270
  }
 
 
 
271
  .tutor-icon-plus:before {
272
  content: "\e914";
273
  }
assets/icons/font/tutor.svg CHANGED
@@ -26,7 +26,7 @@
26
  <glyph unicode="&#xe910;" glyph-name="minus" d="M64 512h853.333c35.346 0 64-28.654 64-64s-28.654-64-64-64h-853.333c-35.346 0-64 28.654-64 64s28.654 64 64 64z" />
27
  <glyph unicode="&#xe911;" glyph-name="mortarboard" d="M702.009 81.892c-8.908 2.261-17.931-3.19-20.141-12.082l-16.618-66.474c-2.244-8.923 3.19-17.931 12.098-20.159 1.346-0.349 2.709-0.499 4.039-0.499 7.445 0 14.209 5.036 16.104 12.581l16.618 66.474c2.226 8.908-3.192 17.931-12.1 20.159zM498.562 414.764c2.16 0 4.322 0.415 6.349 1.262l182.807 75.649c8.476 3.507 12.497 13.229 8.992 21.705-3.507 8.493-13.263 12.482-21.721 9.007l-176.427-73.022-465.324 192.544v5.517c0 9.173-7.445 16.618-16.618 16.618s-16.62-7.445-16.62-16.618v-16.618c0-6.731 4.055-12.797 10.271-15.356l481.944-199.425c2.025-0.847 4.187-1.264 6.347-1.264zM696.26 244.505c-4.055 8.226-13.993 11.617-22.252 7.545-31.559-15.605-84.275-33.752-158.825-36.23v149.088c0 9.173-7.445 16.618-16.618 16.618s-16.618-7.445-16.618-16.618v-148.938c-206.354 6.581-272.945 131.587-282.519 152.394v112.874c0 9.173-7.445 16.618-16.618 16.618s-16.618-7.445-16.618-16.618v-116.331c0-2.111 0.399-4.205 1.18-6.181 2.892-7.196 73.622-176.623 331.195-176.623 90.024 0 153.109 21.837 190.168 40.152 8.238 4.070 11.613 14.024 7.525 22.25zM747.843 65.77c-9.19 0-16.618-7.445-16.618-16.618v-49.856c0-9.173 7.428-16.618 16.618-16.618s16.618 7.445 16.618 16.618v49.856c0 9.173-7.428 16.618-16.618 16.618zM980.506 664.045c-9.19 0-16.618-7.445-16.618-16.618v-5.484l-199.425-82.080v30.031l222.392 92.035c6.215 2.559 10.271 8.626 10.271 15.356s-4.055 12.78-10.254 15.356l-481.962 199.423c-4.072 1.679-8.626 1.679-12.696 0l-481.944-199.425c-6.216-2.577-10.271-8.626-10.271-15.356s4.055-12.797 10.271-15.356l481.944-199.425c2.027-0.847 4.187-1.264 6.349-1.264s4.322 0.415 6.349 1.264l174.265 72.108c8.493 3.49 12.515 13.212 9.007 21.705-3.507 8.476-13.229 12.482-21.705 8.992l-167.918-69.468-438.485 181.444 438.485 181.444 438.485-181.444-190.799-78.956-182.756 68.237c0.964 3.457 1.546 7.013 1.546 10.719 0 27.953-29.199 49.856-66.474 49.856s-66.474-21.904-66.474-49.856c0-27.953 29.199-49.856 66.474-49.856 16.636 0 31.476 4.538 43.009 11.849l189.652-70.813v-409.421c-19.294-6.896-33.238-25.16-33.238-46.799 0-27.487 22.369-49.856 49.856-49.856s49.856 22.369 49.856 49.856c0 21.637-13.942 39.901-33.238 46.799v94.328c47.712 36.013 64.813 83.975 65.561 86.101 0.598 1.745 0.913 3.589 0.913 5.434v116.331c0 9.173-7.428 16.618-16.618 16.618s-16.618-7.445-16.618-16.618v-113.257c-2.875-7.046-12.863-28.767-33.238-50.205v206.144l222.376 91.519c6.232 2.559 10.287 8.641 10.287 15.372v16.618c0 9.175-7.428 16.62-16.618 16.62zM498.562 680.665c-20.291 0-33.238 9.839-33.238 16.618 0 6.781 12.945 16.618 33.238 16.618s33.238-9.839 33.238-16.618c0-6.781-12.947-16.618-33.238-16.618zM747.843 115.627c-9.173 0-16.618 7.461-16.618 16.618s7.445 16.618 16.618 16.618c9.173 0 16.618-7.461 16.618-16.618 0-9.155-7.445-16.618-16.618-16.618zM813.819 69.809c-2.226 8.89-11.268 14.326-20.141 12.082-8.908-2.226-14.326-11.251-12.098-20.159l16.618-66.474c1.895-7.545 8.659-12.581 16.104-12.581 1.33 0 2.691 0.15 4.039 0.499 8.908 2.226 14.326 11.235 12.098 20.159l-16.62 66.474z" />
28
  <glyph unicode="&#xe912;" glyph-name="offer" d="M932.274 434.786c-4.104 8.397-4.104 18.028 0 26.423l38.043 77.826c21.181 43.333 4.399 94.981-38.207 117.587l-76.521 40.601c-8.256 4.379-13.916 12.172-15.531 21.375l-14.966 85.325c-8.333 47.506-52.278 79.43-100.025 72.674l-85.771-12.133c-9.258-1.307-18.412 1.669-25.128 8.166l-62.259 60.229c-34.667 33.537-88.974 33.539-123.639 0l-62.261-60.235c-6.718-6.499-15.872-9.469-25.128-8.166l-85.771 12.133c-47.763 6.76-91.692-25.168-100.025-72.674l-14.966-85.321c-1.616-9.204-7.276-16.996-15.529-21.376l-76.521-40.601c-42.606-22.604-59.388-74.256-38.207-117.589l38.041-77.824c4.104-8.397 4.104-18.028 0-26.423l-38.043-77.824c-21.181-43.333-4.399-94.981 38.207-117.587l76.521-40.601c8.256-4.379 13.916-12.172 15.531-21.375l14.966-85.325c7.586-43.247 44.67-73.577 87.289-73.573 4.198 0 8.457 0.295 12.738 0.9l85.771 12.133c9.25 1.313 18.41-1.669 25.128-8.166l62.259-60.229c17.336-16.77 39.573-25.154 61.819-25.152 22.239 0.002 44.49 8.385 61.819 25.152l62.261 60.229c6.718 6.497 15.874 9.465 25.128 8.166l85.771-12.133c47.769-6.758 91.692 25.168 100.025 72.674l14.968 85.321c1.616 9.204 7.276 16.996 15.529 21.376l76.521 40.601c42.606 22.604 59.388 74.256 38.207 117.589l-38.043 77.826zM904.537 291.342l-76.521-40.601c-24.397-12.947-41.129-35.973-45.901-63.179l-14.966-85.323c-2.819-16.073-17.679-26.869-33.842-24.588l-85.771 12.133c-27.353 3.875-54.419-4.929-74.272-24.132l-62.261-60.227c-11.726-11.344-30.1-11.344-41.831 0l-62.259 60.229c-16.778 16.231-38.713 25.026-61.611 25.026-4.196 0-8.425-0.295-12.661-0.895l-85.771-12.133c-16.149-2.283-31.021 8.515-33.842 24.588l-14.968 85.325c-4.773 27.206-21.504 50.234-45.903 63.177l-76.521 40.601c-14.416 7.648-20.094 25.122-12.928 39.783l38.043 77.826c12.129 24.815 12.129 53.276 0 78.091l-38.043 77.826c-7.166 14.661-1.488 32.134 12.928 39.783l76.521 40.601c24.397 12.947 41.129 35.973 45.901 63.179l14.966 85.323c2.821 16.073 17.679 26.871 33.842 24.588l85.771-12.133c27.343-3.871 54.419 4.929 74.272 24.132l62.261 60.229c11.726 11.344 30.1 11.344 41.831 0l62.259-60.229c19.852-19.205 46.925-28.003 74.272-24.132l85.771 12.133c16.151 2.285 31.023-8.515 33.842-24.588l14.966-85.325c4.773-27.206 21.504-50.234 45.903-63.177l76.521-40.601c14.416-7.648 20.094-25.122 12.928-39.783l-38.043-77.824c-12.129-24.813-12.129-53.278 0-78.091l38.043-77.824c7.168-14.665 1.49-32.14-12.926-39.789zM705.018 662.928c-11.485 11.487-30.112 11.487-41.6 0l-388.261-388.263c-11.487-11.487-11.487-30.112 0-41.6 5.744-5.744 13.272-8.616 20.799-8.616s15.057 2.871 20.799 8.616l388.261 388.261c11.491 11.489 11.491 30.112 0.002 41.601zM372.427 712.734c-59.472 0-107.857-48.385-107.857-107.857s48.385-107.857 107.857-107.857c59.472 0 107.857 48.385 107.857 107.857s-48.385 107.857-107.857 107.857zM372.427 555.853c-27.032 0-49.024 21.992-49.024 49.026 0 27.032 21.992 49.024 49.024 49.024s49.026-21.992 49.026-49.024c-0.002-27.034-21.994-49.026-49.026-49.026zM607.748 398.972c-59.472 0-107.857-48.385-107.857-107.857s48.385-107.857 107.857-107.857c59.472 0 107.857 48.385 107.857 107.857s-48.385 107.857-107.857 107.857zM607.748 242.090c-27.032 0-49.026 21.992-49.026 49.024s21.992 49.024 49.026 49.024c27.032 0 49.024-21.992 49.024-49.024s-21.992-49.024-49.024-49.024z" />
29
- <glyph unicode="&#xe913;" glyph-name="play" d="M483.043 356.403l110.517 63.003c7.559 4.309 10.193 13.93 5.884 21.488-1.346 2.361-3.28 4.334-5.615 5.727l-110.517 65.934c-7.472 4.458-17.143 2.014-21.6-5.458-1.456-2.441-2.225-5.229-2.225-8.071v-128.937c0-8.701 7.053-15.754 15.754-15.754 2.736 0 5.425 0.713 7.802 2.068zM1013.996 663.246c-0.016 0.086-0.034 0.189-0.034 0.275-0.426 3.219-10.754 79.539-43.493 115.38-38.492 43.495-81.149 47.877-104.073 50.223l-6.537 0.718c-137.563 10.806-345.469 11.986-348.2 12.004-2.082-0.018-209.989-1.198-348.304-12.090l-5.753-0.634c-22.924-2.346-65.565-6.73-103.901-50.035-32.893-36.028-43.237-112.332-43.697-115.842-0.104-0.875-10.004-88.547-10.004-175.073v-81.132c0-86.578 9.9-174.2 10.038-175.364 0.426-3.219 10.736-79.505 43.493-115.294 35.522-40.104 79.817-45.875 106.292-49.334 4.677-0.6 8.825-1.114 13.86-2.055 79.049-8.203 327.598-10.736 338.352-10.84 2.082 0 210.227 0.496 348.678 11.268l5.957 0.668c22.874 2.414 65.461 6.935 103.595 50.069 32.909 35.978 43.253 112.246 43.731 115.755 0.086 0.891 10.004 88.547 10.004 175.089v81.15c0 86.546-9.918 174.218-10.004 175.093zM725.248 415.928l-324.32-182.008c-2.594-1.455-5.463-2.191-8.329-2.191-2.986 0-5.975 0.789-8.637 2.346-5.223 3.082-8.431 8.699-8.431 14.777v372.492c0 6.13 3.277 11.815 8.569 14.863 5.343 3.048 11.846 2.996 17.121-0.086l324.32-190.484c5.291-3.098 8.501-8.801 8.449-14.932-0.070-6.146-3.399-11.781-8.741-14.777z" />
30
  <glyph unicode="&#xe914;" glyph-name="plus" d="M426.667 512v362.667c0 35.346 28.654 64 64 64s64-28.654 64-64v-362.667h362.667c35.346 0 64-28.654 64-64s-28.654-64-64-64h-362.667v-362.667c0-35.346-28.654-64-64-64s-64 28.654-64 64v362.667h-362.667c-35.346 0-64 28.654-64 64s28.654 64 64 64h362.667z" />
31
  <glyph unicode="&#xe915;" glyph-name="shopping-cart" d="M296.989 286.37h563.726c63.921 0 116.067 52.146 116.067 116.067v237.181c0 0.21 0 0.631 0 0.841 0 0.631 0 1.051 0 1.682 0 0.421 0 0.841-0.21 1.262 0 0.421-0.21 1.051-0.21 1.472s-0.21 0.841-0.21 1.262c-0.21 0.421-0.21 0.841-0.421 1.472-0.21 0.421-0.21 0.841-0.421 1.262s-0.21 0.841-0.421 1.262c-0.21 0.421-0.421 0.841-0.631 1.472-0.21 0.421-0.421 0.841-0.631 1.051-0.21 0.421-0.421 0.841-0.631 1.262s-0.421 0.631-0.631 1.051c-0.21 0.421-0.631 0.841-0.841 1.262s-0.421 0.631-0.841 1.051c-0.21 0.421-0.631 0.631-0.841 1.051s-0.631 0.631-0.841 1.051c-0.21 0.421-0.631 0.631-0.841 0.841-0.421 0.421-0.631 0.631-1.051 1.051-0.421 0.21-0.631 0.631-1.051 0.841s-0.841 0.631-1.262 0.841c-0.421 0.21-0.631 0.421-1.051 0.631s-0.841 0.421-1.262 0.841c-0.421 0.21-0.841 0.421-1.262 0.631s-0.841 0.421-1.262 0.631c-0.421 0.21-0.841 0.421-1.262 0.631s-0.841 0.21-1.262 0.421c-0.421 0.21-1.051 0.421-1.472 0.421s-0.841 0.21-1.051 0.21-1.051 0.21-1.682 0.21c-0.21 0-0.421 0.21-0.841 0.21l-714.487 98.615v99.667c0 1.051 0 2.103-0.21 2.944 0 0.21 0 0.421-0.21 0.841 0 0.631-0.21 1.262-0.21 1.892-0.21 0.631-0.21 1.051-0.421 1.682 0 0.421-0.21 0.631-0.21 1.051-0.21 0.631-0.421 1.262-0.631 1.892 0 0.21-0.21 0.631-0.21 0.841-0.21 0.631-0.421 1.051-0.841 1.682-0.21 0.21-0.21 0.631-0.421 0.841-0.21 0.421-0.421 0.841-0.841 1.262-0.21 0.421-0.421 0.631-0.631 1.051s-0.421 0.631-0.631 1.051c-0.21 0.421-0.631 0.841-0.841 1.262-0.21 0.21-0.421 0.421-0.631 0.631-0.421 0.421-0.841 0.841-1.262 1.262-0.21 0.21-0.421 0.421-0.631 0.631-0.421 0.421-0.841 0.841-1.472 1.262-0.21 0.21-0.631 0.421-0.841 0.631-0.421 0.421-0.841 0.631-1.262 1.051-0.631 0.421-1.262 0.841-1.682 1.051-0.21 0.21-0.421 0.21-0.631 0.421-0.841 0.421-1.892 0.841-2.733 1.262l-154.967 65.183c-14.508 6.098-31.12-0.631-37.217-15.139s0.631-31.12 15.139-37.217l137.515-58.034v-621.97c0-58.875 44.156-107.657 101.138-115.016-10.303-17.242-16.401-37.428-16.401-58.875 0-63.29 51.515-114.595 114.595-114.595s114.595 51.515 114.595 114.595c0 21.027-5.677 41.002-15.77 57.823h255.264c-10.093-17.032-15.77-36.797-15.77-57.823 0-63.29 51.515-114.595 114.595-114.595s114.595 51.515 114.595 114.595c0 63.080-51.515 114.595-114.595 114.595h-536.181c-32.802 0-59.295 26.704-59.295 59.295v76.958c17.242-10.093 37.638-15.98 59.295-15.98zM438.289 51.712c0-31.961-26.073-57.823-57.823-57.823s-57.823 26.073-57.823 57.823c0 31.75 26.073 57.823 57.823 57.823s57.823-25.863 57.823-57.823zM891.204 51.712c0-31.961-26.073-57.823-57.823-57.823s-57.823 26.073-57.823 57.823c0 31.75 26.073 57.823 57.823 57.823s57.823-25.863 57.823-57.823zM860.715 343.142h-563.726c-32.802 0-59.295 26.704-59.295 59.295v306.779l682.316-93.989v-212.58c0-33.012-26.704-59.506-59.295-59.506z" />
32
  <glyph unicode="&#xe916;" glyph-name="star-full" d="M489.984 934.093c14.643 5.12 29.286 5.12 44.032 0 14.643-5.12 25.805-15.36 33.485-30.618l124.416-252.621 279.45-40.141c16.589-2.56 29.696-10.24 39.219-22.938 9.523-12.8 14.029-26.829 13.414-42.086-0.614-15.36-6.656-28.672-18.227-40.141l-202.854-197.222 47.821-279.45c2.56-15.36-0.307-29.696-8.602-43.11s-20.070-22.016-35.43-25.805c-15.36-3.789-30.003-1.946-44.032 5.734l-250.675 130.15-250.675-130.15c-14.029-7.68-28.672-9.523-44.032-5.734s-27.136 12.39-35.43 25.805c-8.294 13.414-11.162 27.75-8.602 43.11l47.821 279.45-202.854 197.12c-11.469 11.469-17.51 24.883-18.125 40.141-0.614 15.36 3.789 29.286 13.414 42.086 9.523 12.698 22.63 20.378 39.219 22.938l279.45 40.141 124.314 252.723c7.68 15.36 18.842 25.498 33.485 30.618z" />
@@ -74,4 +74,28 @@
74
  <glyph unicode="&#xe940;" glyph-name="video-camera" d="M1017.846 433.846c-11.077 19.692-36.923 27.077-57.845 14.769l-140.306-81.23-35.692-20.923v-194.459l33.23-19.692c1.231 0 1.231-1.231 2.462-1.231l137.844-79.999c6.154-4.923 14.769-7.385 23.384-7.385 23.384 0 41.846 18.461 41.846 41.846v164.921l1.231 162.46c0 7.385-1.231 14.769-6.154 20.923zM198.164 496.615c109.537 0 198.151 88.614 198.151 198.151s-88.614 198.151-198.151 198.151-198.151-88.614-198.151-198.151c-1.231-109.537 88.614-198.151 198.151-198.151zM198.164 775.996c45.538 0 81.23-36.923 81.23-81.23 0-45.538-36.923-81.23-81.23-81.23s-81.23 36.923-81.23 81.23c-1.231 45.538 35.692 81.23 81.23 81.23zM700.312 485.538c-32-16-67.691-25.846-105.845-25.846-46.769 0-91.076 13.538-127.998 38.153h-140.306c-36.923-24.615-81.23-38.153-127.998-38.153-38.153 0-73.845 8.615-105.845 25.846-28.307-16-47.999-47.999-47.999-82.461v-300.304c0-55.384 45.538-99.691 99.691-99.691h505.84c55.384 0 99.691 45.538 99.691 99.691v300.304c-1.231 34.461-20.923 66.461-49.23 82.461zM594.467 496.615c109.537 0 198.151 88.614 198.151 198.151s-88.614 198.151-198.151 198.151c-109.537 0-198.151-88.614-198.151-198.151s88.614-198.151 198.151-198.151zM594.467 775.996c45.538 0 81.23-36.923 81.23-81.23 0-45.538-36.923-81.23-81.23-81.23s-81.23 36.923-81.23 81.23c0 45.538 35.692 81.23 81.23 81.23z" />
75
  <glyph unicode="&#xe941;" glyph-name="garbage" d="M901.8 813h-236.8v104.2c0 11.6-9.4 20.8-20.8 20.8h-264.4c-11.6 0-20.8-9.4-20.8-20.8v-104.2h-236.8c-11.6 0-20.8-9.4-20.8-20.8v-129.8c0-11.6 9.4-20.8 20.8-20.8h49.2v-529.4c0-85 69.2-154.2 154.2-154.2h372.8c85 0 154.2 69.2 154.2 154.2v529.2h49.2c11.6 0 20.8 9.4 20.8 20.8v130c0 11.4-9.4 20.8-20.8 20.8zM400.8 896.2h222.6v-83.4h-222.6v83.4zM810.8 112.2c0-62-50.4-112.4-112.4-112.4h-372.8c-62 0-112.4 50.4-112.4 112.4v529.2h597.6v-529.2zM880.8 683.2h-737.6v88h737.8v-88zM328.2 106c11.6 0 20.8 9.4 20.8 20.8v387.4c0 11.6-9.4 20.8-20.8 20.8-11.6 0-20.8-9.4-20.8-20.8v-387.4c0-11.4 9.4-20.8 20.8-20.8zM512 106c11.6 0 20.8 9.4 20.8 20.8v387.4c0 11.6-9.4 20.8-20.8 20.8s-20.8-9.4-20.8-20.8v-387.4c0-11.4 9.2-20.8 20.8-20.8zM695.8 106c11.6 0 20.8 9.4 20.8 20.8v387.4c0 11.6-9.4 20.8-20.8 20.8-11.6 0-20.8-9.4-20.8-20.8v-387.4c-0.2-11.4 9.2-20.8 20.8-20.8z" />
76
  <glyph unicode="&#xe942;" glyph-name="add-line" d="M916.122 960h-808.245c-59.584 0-107.878-48.503-107.878-107.878v-808.245c0-59.584 48.503-107.878 107.878-107.878h808.245c59.584 0 107.878 48.503 107.878 107.878v808.245c0 59.374-48.503 107.878-107.878 107.878zM972.779 43.878c0-31.151-25.506-56.657-56.657-56.657h-808.245c-31.151 0-56.657 25.506-56.657 56.657v808.245c0 31.151 25.506 56.657 56.657 56.657h808.245c31.151 0 56.657-25.506 56.657-56.657v-808.245zM705.385 473.506h-167.879v167.879c0 14.216-11.499 25.715-25.715 25.715s-25.715-11.499-25.715-25.715v-167.879h-167.879c-14.216 0-25.715-11.499-25.715-25.506 0-14.216 11.499-25.715 25.715-25.715h167.879v-167.879c0-14.216 11.499-25.715 25.715-25.715s25.715 11.499 25.715 25.715v167.879h167.879c14.216 0 25.715 11.499 25.715 25.715s-11.499 25.506-25.715 25.506z" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  </font></defs></svg>
26
  <glyph unicode="&#xe910;" glyph-name="minus" d="M64 512h853.333c35.346 0 64-28.654 64-64s-28.654-64-64-64h-853.333c-35.346 0-64 28.654-64 64s28.654 64 64 64z" />
27
  <glyph unicode="&#xe911;" glyph-name="mortarboard" d="M702.009 81.892c-8.908 2.261-17.931-3.19-20.141-12.082l-16.618-66.474c-2.244-8.923 3.19-17.931 12.098-20.159 1.346-0.349 2.709-0.499 4.039-0.499 7.445 0 14.209 5.036 16.104 12.581l16.618 66.474c2.226 8.908-3.192 17.931-12.1 20.159zM498.562 414.764c2.16 0 4.322 0.415 6.349 1.262l182.807 75.649c8.476 3.507 12.497 13.229 8.992 21.705-3.507 8.493-13.263 12.482-21.721 9.007l-176.427-73.022-465.324 192.544v5.517c0 9.173-7.445 16.618-16.618 16.618s-16.62-7.445-16.62-16.618v-16.618c0-6.731 4.055-12.797 10.271-15.356l481.944-199.425c2.025-0.847 4.187-1.264 6.347-1.264zM696.26 244.505c-4.055 8.226-13.993 11.617-22.252 7.545-31.559-15.605-84.275-33.752-158.825-36.23v149.088c0 9.173-7.445 16.618-16.618 16.618s-16.618-7.445-16.618-16.618v-148.938c-206.354 6.581-272.945 131.587-282.519 152.394v112.874c0 9.173-7.445 16.618-16.618 16.618s-16.618-7.445-16.618-16.618v-116.331c0-2.111 0.399-4.205 1.18-6.181 2.892-7.196 73.622-176.623 331.195-176.623 90.024 0 153.109 21.837 190.168 40.152 8.238 4.070 11.613 14.024 7.525 22.25zM747.843 65.77c-9.19 0-16.618-7.445-16.618-16.618v-49.856c0-9.173 7.428-16.618 16.618-16.618s16.618 7.445 16.618 16.618v49.856c0 9.173-7.428 16.618-16.618 16.618zM980.506 664.045c-9.19 0-16.618-7.445-16.618-16.618v-5.484l-199.425-82.080v30.031l222.392 92.035c6.215 2.559 10.271 8.626 10.271 15.356s-4.055 12.78-10.254 15.356l-481.962 199.423c-4.072 1.679-8.626 1.679-12.696 0l-481.944-199.425c-6.216-2.577-10.271-8.626-10.271-15.356s4.055-12.797 10.271-15.356l481.944-199.425c2.027-0.847 4.187-1.264 6.349-1.264s4.322 0.415 6.349 1.264l174.265 72.108c8.493 3.49 12.515 13.212 9.007 21.705-3.507 8.476-13.229 12.482-21.705 8.992l-167.918-69.468-438.485 181.444 438.485 181.444 438.485-181.444-190.799-78.956-182.756 68.237c0.964 3.457 1.546 7.013 1.546 10.719 0 27.953-29.199 49.856-66.474 49.856s-66.474-21.904-66.474-49.856c0-27.953 29.199-49.856 66.474-49.856 16.636 0 31.476 4.538 43.009 11.849l189.652-70.813v-409.421c-19.294-6.896-33.238-25.16-33.238-46.799 0-27.487 22.369-49.856 49.856-49.856s49.856 22.369 49.856 49.856c0 21.637-13.942 39.901-33.238 46.799v94.328c47.712 36.013 64.813 83.975 65.561 86.101 0.598 1.745 0.913 3.589 0.913 5.434v116.331c0 9.173-7.428 16.618-16.618 16.618s-16.618-7.445-16.618-16.618v-113.257c-2.875-7.046-12.863-28.767-33.238-50.205v206.144l222.376 91.519c6.232 2.559 10.287 8.641 10.287 15.372v16.618c0 9.175-7.428 16.62-16.618 16.62zM498.562 680.665c-20.291 0-33.238 9.839-33.238 16.618 0 6.781 12.945 16.618 33.238 16.618s33.238-9.839 33.238-16.618c0-6.781-12.947-16.618-33.238-16.618zM747.843 115.627c-9.173 0-16.618 7.461-16.618 16.618s7.445 16.618 16.618 16.618c9.173 0 16.618-7.461 16.618-16.618 0-9.155-7.445-16.618-16.618-16.618zM813.819 69.809c-2.226 8.89-11.268 14.326-20.141 12.082-8.908-2.226-14.326-11.251-12.098-20.159l16.618-66.474c1.895-7.545 8.659-12.581 16.104-12.581 1.33 0 2.691 0.15 4.039 0.499 8.908 2.226 14.326 11.235 12.098 20.159l-16.62 66.474z" />
28
  <glyph unicode="&#xe912;" glyph-name="offer" d="M932.274 434.786c-4.104 8.397-4.104 18.028 0 26.423l38.043 77.826c21.181 43.333 4.399 94.981-38.207 117.587l-76.521 40.601c-8.256 4.379-13.916 12.172-15.531 21.375l-14.966 85.325c-8.333 47.506-52.278 79.43-100.025 72.674l-85.771-12.133c-9.258-1.307-18.412 1.669-25.128 8.166l-62.259 60.229c-34.667 33.537-88.974 33.539-123.639 0l-62.261-60.235c-6.718-6.499-15.872-9.469-25.128-8.166l-85.771 12.133c-47.763 6.76-91.692-25.168-100.025-72.674l-14.966-85.321c-1.616-9.204-7.276-16.996-15.529-21.376l-76.521-40.601c-42.606-22.604-59.388-74.256-38.207-117.589l38.041-77.824c4.104-8.397 4.104-18.028 0-26.423l-38.043-77.824c-21.181-43.333-4.399-94.981 38.207-117.587l76.521-40.601c8.256-4.379 13.916-12.172 15.531-21.375l14.966-85.325c7.586-43.247 44.67-73.577 87.289-73.573 4.198 0 8.457 0.295 12.738 0.9l85.771 12.133c9.25 1.313 18.41-1.669 25.128-8.166l62.259-60.229c17.336-16.77 39.573-25.154 61.819-25.152 22.239 0.002 44.49 8.385 61.819 25.152l62.261 60.229c6.718 6.497 15.874 9.465 25.128 8.166l85.771-12.133c47.769-6.758 91.692 25.168 100.025 72.674l14.968 85.321c1.616 9.204 7.276 16.996 15.529 21.376l76.521 40.601c42.606 22.604 59.388 74.256 38.207 117.589l-38.043 77.826zM904.537 291.342l-76.521-40.601c-24.397-12.947-41.129-35.973-45.901-63.179l-14.966-85.323c-2.819-16.073-17.679-26.869-33.842-24.588l-85.771 12.133c-27.353 3.875-54.419-4.929-74.272-24.132l-62.261-60.227c-11.726-11.344-30.1-11.344-41.831 0l-62.259 60.229c-16.778 16.231-38.713 25.026-61.611 25.026-4.196 0-8.425-0.295-12.661-0.895l-85.771-12.133c-16.149-2.283-31.021 8.515-33.842 24.588l-14.968 85.325c-4.773 27.206-21.504 50.234-45.903 63.177l-76.521 40.601c-14.416 7.648-20.094 25.122-12.928 39.783l38.043 77.826c12.129 24.815 12.129 53.276 0 78.091l-38.043 77.826c-7.166 14.661-1.488 32.134 12.928 39.783l76.521 40.601c24.397 12.947 41.129 35.973 45.901 63.179l14.966 85.323c2.821 16.073 17.679 26.871 33.842 24.588l85.771-12.133c27.343-3.871 54.419 4.929 74.272 24.132l62.261 60.229c11.726 11.344 30.1 11.344 41.831 0l62.259-60.229c19.852-19.205 46.925-28.003 74.272-24.132l85.771 12.133c16.151 2.285 31.023-8.515 33.842-24.588l14.966-85.325c4.773-27.206 21.504-50.234 45.903-63.177l76.521-40.601c14.416-7.648 20.094-25.122 12.928-39.783l-38.043-77.824c-12.129-24.813-12.129-53.278 0-78.091l38.043-77.824c7.168-14.665 1.49-32.14-12.926-39.789zM705.018 662.928c-11.485 11.487-30.112 11.487-41.6 0l-388.261-388.263c-11.487-11.487-11.487-30.112 0-41.6 5.744-5.744 13.272-8.616 20.799-8.616s15.057 2.871 20.799 8.616l388.261 388.261c11.491 11.489 11.491 30.112 0.002 41.601zM372.427 712.734c-59.472 0-107.857-48.385-107.857-107.857s48.385-107.857 107.857-107.857c59.472 0 107.857 48.385 107.857 107.857s-48.385 107.857-107.857 107.857zM372.427 555.853c-27.032 0-49.024 21.992-49.024 49.026 0 27.032 21.992 49.024 49.024 49.024s49.026-21.992 49.026-49.024c-0.002-27.034-21.994-49.026-49.026-49.026zM607.748 398.972c-59.472 0-107.857-48.385-107.857-107.857s48.385-107.857 107.857-107.857c59.472 0 107.857 48.385 107.857 107.857s-48.385 107.857-107.857 107.857zM607.748 242.090c-27.032 0-49.026 21.992-49.026 49.024s21.992 49.024 49.026 49.024c27.032 0 49.024-21.992 49.024-49.024s-21.992-49.024-49.024-49.024z" />
29
+ <glyph unicode="&#xe913;" glyph-name="cross" horiz-adv-x="1020" d="M983.896 164.595c17.379-17.379 25.399-37.431 25.399-62.83 0-24.063-8.021-46.789-25.399-65.504l-62.83-62.83c-18.715-17.379-40.104-25.399-65.504-25.399-24.063 0-45.452 8.021-62.83 25.399l-283.405 284.742-283.405-284.742c-17.379-17.379-37.431-25.399-62.83-25.399-24.063 0-46.789 8.021-65.504 25.399l-62.83 62.83c-17.379 18.715-25.399 40.104-25.399 65.504 0 24.063 8.021 45.452 25.399 62.83l283.405 283.405-282.068 283.405c-17.379 17.379-25.399 37.431-25.399 62.83 0 24.063 8.021 46.789 25.399 65.504l62.83 62.83c18.715 17.379 40.104 25.399 65.504 25.399 24.063 0 45.452-8.021 62.83-25.399l283.405-283.405 283.405 283.405c17.379 17.379 37.431 25.399 62.83 25.399 24.063 0 46.789-8.021 65.504-25.399l62.83-62.83c17.379-18.715 25.399-40.104 25.399-65.504 0-24.063-8.021-45.452-25.399-62.83l-284.742-283.405 283.405-283.405z" />
30
  <glyph unicode="&#xe914;" glyph-name="plus" d="M426.667 512v362.667c0 35.346 28.654 64 64 64s64-28.654 64-64v-362.667h362.667c35.346 0 64-28.654 64-64s-28.654-64-64-64h-362.667v-362.667c0-35.346-28.654-64-64-64s-64 28.654-64 64v362.667h-362.667c-35.346 0-64 28.654-64 64s28.654 64 64 64h362.667z" />
31
  <glyph unicode="&#xe915;" glyph-name="shopping-cart" d="M296.989 286.37h563.726c63.921 0 116.067 52.146 116.067 116.067v237.181c0 0.21 0 0.631 0 0.841 0 0.631 0 1.051 0 1.682 0 0.421 0 0.841-0.21 1.262 0 0.421-0.21 1.051-0.21 1.472s-0.21 0.841-0.21 1.262c-0.21 0.421-0.21 0.841-0.421 1.472-0.21 0.421-0.21 0.841-0.421 1.262s-0.21 0.841-0.421 1.262c-0.21 0.421-0.421 0.841-0.631 1.472-0.21 0.421-0.421 0.841-0.631 1.051-0.21 0.421-0.421 0.841-0.631 1.262s-0.421 0.631-0.631 1.051c-0.21 0.421-0.631 0.841-0.841 1.262s-0.421 0.631-0.841 1.051c-0.21 0.421-0.631 0.631-0.841 1.051s-0.631 0.631-0.841 1.051c-0.21 0.421-0.631 0.631-0.841 0.841-0.421 0.421-0.631 0.631-1.051 1.051-0.421 0.21-0.631 0.631-1.051 0.841s-0.841 0.631-1.262 0.841c-0.421 0.21-0.631 0.421-1.051 0.631s-0.841 0.421-1.262 0.841c-0.421 0.21-0.841 0.421-1.262 0.631s-0.841 0.421-1.262 0.631c-0.421 0.21-0.841 0.421-1.262 0.631s-0.841 0.21-1.262 0.421c-0.421 0.21-1.051 0.421-1.472 0.421s-0.841 0.21-1.051 0.21-1.051 0.21-1.682 0.21c-0.21 0-0.421 0.21-0.841 0.21l-714.487 98.615v99.667c0 1.051 0 2.103-0.21 2.944 0 0.21 0 0.421-0.21 0.841 0 0.631-0.21 1.262-0.21 1.892-0.21 0.631-0.21 1.051-0.421 1.682 0 0.421-0.21 0.631-0.21 1.051-0.21 0.631-0.421 1.262-0.631 1.892 0 0.21-0.21 0.631-0.21 0.841-0.21 0.631-0.421 1.051-0.841 1.682-0.21 0.21-0.21 0.631-0.421 0.841-0.21 0.421-0.421 0.841-0.841 1.262-0.21 0.421-0.421 0.631-0.631 1.051s-0.421 0.631-0.631 1.051c-0.21 0.421-0.631 0.841-0.841 1.262-0.21 0.21-0.421 0.421-0.631 0.631-0.421 0.421-0.841 0.841-1.262 1.262-0.21 0.21-0.421 0.421-0.631 0.631-0.421 0.421-0.841 0.841-1.472 1.262-0.21 0.21-0.631 0.421-0.841 0.631-0.421 0.421-0.841 0.631-1.262 1.051-0.631 0.421-1.262 0.841-1.682 1.051-0.21 0.21-0.421 0.21-0.631 0.421-0.841 0.421-1.892 0.841-2.733 1.262l-154.967 65.183c-14.508 6.098-31.12-0.631-37.217-15.139s0.631-31.12 15.139-37.217l137.515-58.034v-621.97c0-58.875 44.156-107.657 101.138-115.016-10.303-17.242-16.401-37.428-16.401-58.875 0-63.29 51.515-114.595 114.595-114.595s114.595 51.515 114.595 114.595c0 21.027-5.677 41.002-15.77 57.823h255.264c-10.093-17.032-15.77-36.797-15.77-57.823 0-63.29 51.515-114.595 114.595-114.595s114.595 51.515 114.595 114.595c0 63.080-51.515 114.595-114.595 114.595h-536.181c-32.802 0-59.295 26.704-59.295 59.295v76.958c17.242-10.093 37.638-15.98 59.295-15.98zM438.289 51.712c0-31.961-26.073-57.823-57.823-57.823s-57.823 26.073-57.823 57.823c0 31.75 26.073 57.823 57.823 57.823s57.823-25.863 57.823-57.823zM891.204 51.712c0-31.961-26.073-57.823-57.823-57.823s-57.823 26.073-57.823 57.823c0 31.75 26.073 57.823 57.823 57.823s57.823-25.863 57.823-57.823zM860.715 343.142h-563.726c-32.802 0-59.295 26.704-59.295 59.295v306.779l682.316-93.989v-212.58c0-33.012-26.704-59.506-59.295-59.506z" />
32
  <glyph unicode="&#xe916;" glyph-name="star-full" d="M489.984 934.093c14.643 5.12 29.286 5.12 44.032 0 14.643-5.12 25.805-15.36 33.485-30.618l124.416-252.621 279.45-40.141c16.589-2.56 29.696-10.24 39.219-22.938 9.523-12.8 14.029-26.829 13.414-42.086-0.614-15.36-6.656-28.672-18.227-40.141l-202.854-197.222 47.821-279.45c2.56-15.36-0.307-29.696-8.602-43.11s-20.070-22.016-35.43-25.805c-15.36-3.789-30.003-1.946-44.032 5.734l-250.675 130.15-250.675-130.15c-14.029-7.68-28.672-9.523-44.032-5.734s-27.136 12.39-35.43 25.805c-8.294 13.414-11.162 27.75-8.602 43.11l47.821 279.45-202.854 197.12c-11.469 11.469-17.51 24.883-18.125 40.141-0.614 15.36 3.789 29.286 13.414 42.086 9.523 12.698 22.63 20.378 39.219 22.938l279.45 40.141 124.314 252.723c7.68 15.36 18.842 25.498 33.485 30.618z" />
74
  <glyph unicode="&#xe940;" glyph-name="video-camera" d="M1017.846 433.846c-11.077 19.692-36.923 27.077-57.845 14.769l-140.306-81.23-35.692-20.923v-194.459l33.23-19.692c1.231 0 1.231-1.231 2.462-1.231l137.844-79.999c6.154-4.923 14.769-7.385 23.384-7.385 23.384 0 41.846 18.461 41.846 41.846v164.921l1.231 162.46c0 7.385-1.231 14.769-6.154 20.923zM198.164 496.615c109.537 0 198.151 88.614 198.151 198.151s-88.614 198.151-198.151 198.151-198.151-88.614-198.151-198.151c-1.231-109.537 88.614-198.151 198.151-198.151zM198.164 775.996c45.538 0 81.23-36.923 81.23-81.23 0-45.538-36.923-81.23-81.23-81.23s-81.23 36.923-81.23 81.23c-1.231 45.538 35.692 81.23 81.23 81.23zM700.312 485.538c-32-16-67.691-25.846-105.845-25.846-46.769 0-91.076 13.538-127.998 38.153h-140.306c-36.923-24.615-81.23-38.153-127.998-38.153-38.153 0-73.845 8.615-105.845 25.846-28.307-16-47.999-47.999-47.999-82.461v-300.304c0-55.384 45.538-99.691 99.691-99.691h505.84c55.384 0 99.691 45.538 99.691 99.691v300.304c-1.231 34.461-20.923 66.461-49.23 82.461zM594.467 496.615c109.537 0 198.151 88.614 198.151 198.151s-88.614 198.151-198.151 198.151c-109.537 0-198.151-88.614-198.151-198.151s88.614-198.151 198.151-198.151zM594.467 775.996c45.538 0 81.23-36.923 81.23-81.23 0-45.538-36.923-81.23-81.23-81.23s-81.23 36.923-81.23 81.23c0 45.538 35.692 81.23 81.23 81.23z" />
75
  <glyph unicode="&#xe941;" glyph-name="garbage" d="M901.8 813h-236.8v104.2c0 11.6-9.4 20.8-20.8 20.8h-264.4c-11.6 0-20.8-9.4-20.8-20.8v-104.2h-236.8c-11.6 0-20.8-9.4-20.8-20.8v-129.8c0-11.6 9.4-20.8 20.8-20.8h49.2v-529.4c0-85 69.2-154.2 154.2-154.2h372.8c85 0 154.2 69.2 154.2 154.2v529.2h49.2c11.6 0 20.8 9.4 20.8 20.8v130c0 11.4-9.4 20.8-20.8 20.8zM400.8 896.2h222.6v-83.4h-222.6v83.4zM810.8 112.2c0-62-50.4-112.4-112.4-112.4h-372.8c-62 0-112.4 50.4-112.4 112.4v529.2h597.6v-529.2zM880.8 683.2h-737.6v88h737.8v-88zM328.2 106c11.6 0 20.8 9.4 20.8 20.8v387.4c0 11.6-9.4 20.8-20.8 20.8-11.6 0-20.8-9.4-20.8-20.8v-387.4c0-11.4 9.4-20.8 20.8-20.8zM512 106c11.6 0 20.8 9.4 20.8 20.8v387.4c0 11.6-9.4 20.8-20.8 20.8s-20.8-9.4-20.8-20.8v-387.4c0-11.4 9.2-20.8 20.8-20.8zM695.8 106c11.6 0 20.8 9.4 20.8 20.8v387.4c0 11.6-9.4 20.8-20.8 20.8-11.6 0-20.8-9.4-20.8-20.8v-387.4c-0.2-11.4 9.2-20.8 20.8-20.8z" />
76
  <glyph unicode="&#xe942;" glyph-name="add-line" d="M916.122 960h-808.245c-59.584 0-107.878-48.503-107.878-107.878v-808.245c0-59.584 48.503-107.878 107.878-107.878h808.245c59.584 0 107.878 48.503 107.878 107.878v808.245c0 59.374-48.503 107.878-107.878 107.878zM972.779 43.878c0-31.151-25.506-56.657-56.657-56.657h-808.245c-31.151 0-56.657 25.506-56.657 56.657v808.245c0 31.151 25.506 56.657 56.657 56.657h808.245c31.151 0 56.657-25.506 56.657-56.657v-808.245zM705.385 473.506h-167.879v167.879c0 14.216-11.499 25.715-25.715 25.715s-25.715-11.499-25.715-25.715v-167.879h-167.879c-14.216 0-25.715-11.499-25.715-25.506 0-14.216 11.499-25.715 25.715-25.715h167.879v-167.879c0-14.216 11.499-25.715 25.715-25.715s25.715 11.499 25.715 25.715v167.879h167.879c14.216 0 25.715 11.499 25.715 25.715s-11.499 25.506-25.715 25.506z" />
77
+ <glyph unicode="&#xe943;" glyph-name="cup" d="M1023.964 764.598c-1.020 86.91-45.496 134.776-125.238 134.776-30.864 0-60.604-7.184-80.046-13.178 1.936 35.524 1.966 57.452 1.966 58.542l0.002 15.208h-617.282v-15.206c0-0.52 0.052-22.794 2.010-58.562-19.44 5.998-49.208 13.196-80.102 13.196-79.74 0-124.218-47.864-125.238-134.776-1.004-85.5 18.496-161.608 57.954-226.214 38.74-63.43 88.256-101.652 122.974-122.542 55.606-33.464 111.18-40.488 148.012-40.488 9.080 0 17.828 0.428 26.010 1.272 0.542 0.056 1.044 0.12 1.574 0.178 17.808-19.178 37.006-34.54 57.52-45.956 15.122-8.414 25.64-23.088 29.244-39.954-20.39-6.346-35.236-25.396-35.236-47.846 0-22.954 15.526-42.34 36.62-48.24v-63.82h-82.284v-66.602h-81.2v-128.334h461.562v128.334h-81.2v66.602h-82.284v63.82c21.096 5.902 36.622 25.286 36.622 48.24 0 22.452-14.846 41.5-35.236 47.846 3.604 16.866 14.12 31.538 29.244 39.954 20.464 11.386 39.794 26.832 57.558 45.948 6.294-0.698 15.732-1.44 27.532-1.44 0.004 0 0.002 0 0.008 0 36.828 0 92.4 7.028 148.002 40.488 34.716 20.892 84.234 59.112 122.974 122.542 39.464 64.604 58.962 140.714 57.958 226.212zM789.984 929.534c-0.136-5.562-0.352-12.554-0.684-20.738h-554.526c-0.344 8.182-0.574 15.184-0.722 20.738h555.932zM810.668 789.908c20.604 6.858 47.308 13.774 71.23 13.774 20.058 0 34.5-4.9 42.926-14.564 9.684-11.108 12.806-29.768 9.274-55.468-14.706-107.052-61.124-190.616-130.708-235.294-24.238-15.564-50.342-21.994-72.218-24.278 46.274 97.262 68.67 219.294 79.496 315.83zM228.99 683.982c14.958-80.23 35.61-149.126 61.386-204.772 0.798-1.728 1.61-3.43 2.418-5.132-21.868 2.29-47.956 8.718-72.184 24.274-69.582 44.68-116.002 128.242-130.708 235.294-3.53 25.702-0.41 44.364 9.276 55.468 8.426 9.664 22.87 14.562 42.926 14.562 23.942 0 50.67-6.926 71.282-13.788 3.682-32.924 8.716-68.962 15.604-105.906zM328.976 405.766c-32.976 0-82.706 6.27-132.328 36.132-50.75 30.54-168.54 123.088-166.2 322.342 0.828 70.466 31.846 104.72 94.826 104.72 33.682 0 66.948-10.154 82.154-15.51 0.758-10.202 1.608-20.434 2.548-30.624-20.67 6.072-45.024 11.268-67.872 11.268-29.236 0-51.39-8.406-65.85-24.986-15.718-18.026-21.264-44.806-16.484-79.596 8.188-59.602 25.3-112.282 50.862-156.574 24.402-42.284 55.876-75.988 93.544-100.172 36.792-23.626 76.586-29.584 104.972-30.154 0.096-0.168 0.194-0.328 0.29-0.494 1.556-2.726 3.128-5.406 4.716-8.052 0.494-0.826 0.992-1.646 1.49-2.464 1.514-2.488 3.040-4.952 4.582-7.366 0.58-0.908 1.168-1.794 1.752-2.694 1.050-1.614 2.106-3.214 3.17-4.796 1.028-1.53 2.060-3.044 3.098-4.542 1.018-1.466 2.038-2.924 3.066-4.362 0.482-0.676 0.956-1.378 1.438-2.046-1.224-0.020-2.482-0.030-3.774-0.030zM712.376 33.97v-67.506h-400.736v67.506h400.736zM579.306 100.572h51.868v-36.188h-238.334v36.188h186.466zM475.122 130.986v61.964h73.77v-61.964h-73.77zM585.514 243.048c0-10.854-8.832-19.684-19.684-19.684h-107.644c-10.854 0-19.684 8.83-19.684 19.684s8.83 19.684 19.684 19.684h107.644c10.854 0 19.684-8.83 19.684-19.684zM661.582 416.896c-0.168-0.218-0.336-0.436-0.504-0.654-1.496-1.936-3.004-3.824-4.52-5.686-0.372-0.454-0.738-0.916-1.112-1.368-1.666-2.024-3.346-4.004-5.034-5.936-0.082-0.092-0.158-0.188-0.24-0.28-16.958-19.346-35.47-34.668-55.024-45.548-24.102-13.408-40.49-37.222-44.998-64.278h-76.284c-4.51 27.058-20.898 50.87-45 64.278-18.872 10.498-35.916 24.532-51.314 41.302l-3.72 4.244c-15.12 17.244-29.372 38.136-42.358 62.090l-3.978 7.342c-65.394 126.354-85.174 308.976-91.138 405.982h551.41c-0.254-4.22-0.532-8.578-0.84-13.104-0.014-0.21-0.030-0.426-0.044-0.636-0.336-4.904-0.696-9.822-1.078-14.744-0.010-0.144-0.022-0.288-0.032-0.434-1.216-15.6-2.656-31.258-4.298-46.73l-0.994-9.356c-11.050-99.056-34.388-225.25-83.602-320.306l-4.346-8.012c-9.67-17.832-20.042-33.964-30.952-48.166zM827.354 441.898c-49.626-29.864-99.346-36.132-132.32-36.132-0.002 0-0.006 0-0.008 0-1.294 0-2.552 0.010-3.778 0.030 0.020 0.028 0.040 0.058 0.060 0.086 1.974 2.724 3.918 5.488 5.832 8.29 0.234 0.342 0.464 0.692 0.698 1.034 1.618 2.384 3.212 4.8 4.788 7.24 0.406 0.626 0.812 1.254 1.214 1.884 1.744 2.738 3.47 5.494 5.162 8.298 0.266 0.438 0.524 0.888 0.788 1.33 1.386 2.316 2.756 4.654 4.108 7.014 0.316 0.552 0.642 1.080 0.96 1.636 28.386 0.57 68.18 6.528 104.972 30.154 37.668 24.188 69.142 57.892 93.544 100.172 25.56 44.292 42.672 96.972 50.862 156.574 4.776 34.792-0.768 61.572-16.484 79.596-14.458 16.582-36.614 24.988-65.85 24.988-22.846 0-47.204-5.192-67.872-11.266 0.958 10.39 1.78 20.356 2.484 29.828 0.020 0.264 0.042 0.53 0.062 0.792 15.21 5.358 48.474 15.51 82.154 15.51 62.98 0 93.998-34.254 94.828-104.716 2.332-199.254-115.454-291.8-166.204-322.342zM384.712 467.526l-25.4-16.734c8.672-13.166 17.992-25.128 27.702-35.552l22.256 20.732c-8.554 9.182-16.816 19.8-24.558 31.554zM319.432 636.156l-29.652-6.764c14.584-63.93 34.054-117.598 57.866-159.512l26.444 15.024c-22.344 39.33-40.734 90.218-54.658 151.252zM887.332 292.982l-0.022 30.414-25.674-0.016-0.018 25.674-30.414-0.020 0.018-25.676-25.674-0.018 0.020-30.414 25.674 0.018 0.018-25.672 30.414 0.020-0.018 25.674zM225.57 135.050l-0.032 30.414-21.544-0.022-0.022 21.546-30.414-0.032 0.022-21.544-21.548-0.022 0.034-30.414 21.544 0.022 0.022-21.548 30.414 0.032-0.022 21.546zM97.69 383.678h28.69v-30.414h-28.69v30.414zM282.078 293.694h28.69v-30.414h-28.69v30.414zM744.508 202.19h28.69v-30.414h-28.69v30.414z" />
78
+ <glyph unicode="&#xe944;" glyph-name="next-2" d="M15.689 463.673h992.623c8.66 0 15.689-7.029 15.689-15.689s-7.029-15.689-15.689-15.689h-992.623c-8.66 0-15.689 7.029-15.689 15.689s7.029 15.689 15.689 15.689zM409.067 857.020c4.016 0 8.033-1.537 11.108-4.581 6.119-6.119 6.119-16.065 0-22.184l-382.302-382.302 382.302-382.176c6.119-6.119 6.119-16.065 0-22.184s-16.065-6.119-22.184 0l-393.378 393.252c-2.949 2.949-4.581 6.934-4.581 11.108s1.663 8.158 4.581 11.108l393.378 393.347c3.044 3.075 7.060 4.612 11.076 4.612z" />
79
+ <glyph unicode="&#xe945;" glyph-name="next2" d="M1008.311 432.327h-992.623c-8.66 0-15.689 7.029-15.689 15.689s7.029 15.689 15.689 15.689h992.623c8.66 0 15.689-7.029 15.689-15.689s-7.029-15.689-15.689-15.689zM614.933 38.98c-4.016 0-8.033 1.537-11.108 4.581-6.119 6.119-6.119 16.065 0 22.184l382.302 382.302-382.302 382.176c-6.119 6.119-6.119 16.065 0 22.184s16.065 6.119 22.184 0l393.378-393.252c2.949-2.949 4.581-6.934 4.581-11.108s-1.663-8.158-4.581-11.108l-393.378-393.347c-3.044-3.075-7.060-4.612-11.076-4.612z" />
80
+ <glyph unicode="&#xe946;" glyph-name="menu-2" d="M887.218 480.976h-750.433c-18.209 0-32.976-14.765-32.976-32.976s14.767-32.976 32.976-32.976h750.433c18.211 0 32.976 14.765 32.976 32.976 0 18.209-14.765 32.976-32.976 32.976zM887.218 731.122h-750.433c-18.209 0-32.976-14.767-32.976-32.976s14.767-32.976 32.976-32.976h750.433c18.211 0 32.976 14.767 32.976 32.976s-14.765 32.976-32.976 32.976zM887.218 230.83h-750.433c-18.209 0-32.976-14.765-32.976-32.976s14.767-32.976 32.976-32.976h750.433c18.211 0 32.976 14.765 32.976 32.976s-14.765 32.976-32.976 32.976z" />
81
+ <glyph unicode="&#xe947;" glyph-name="question-2" d="M976.168 633.997c-45.644 68.232-118.564 113.268-200.069 123.558-8.224 1.054-15.722-4.784-16.76-13.002s4.784-15.722 13.002-16.76c72.878-9.206 138.081-49.472 178.891-110.474 61.42-91.854 56.596-211.691-12.004-298.201-2.248-2.836-3.396-6.386-3.232-10l6.074-133.733-121.276 56.684c-3.28 1.534-7.002 1.83-10.48 0.83-91.392-26.16-191.907 2.14-256.109 72.132-4.67 5.060-9.226 10.466-13.57 16.1-3.644 4.702-7.184 9.604-10.52 14.566-0.176 0.264-0.352 0.542-0.528 0.808 20.966 36.874 33.486 78.064 36.392 120.308 0.568 8.266-5.67 15.426-13.936 15.994-8.262 0.546-15.426-5.67-15.994-13.936-3.014-43.846-17.6-86.446-42.18-123.194-20.724-30.988-47.298-56.448-78.986-75.67-7.084-4.296-9.34-13.522-5.044-20.604 2.822-4.652 7.768-7.222 12.838-7.222 2.65 0 5.334 0.704 7.766 2.178 32.090 19.468 59.472 44.662 81.568 74.958 1.614-2.206 3.236-4.404 4.89-6.536 4.856-6.298 9.988-12.386 15.226-18.060 35.658-38.874 81.476-66.924 132.499-81.122 48.708-13.552 99.916-13.894 148.465-1.048l138.733-64.842c2.022-0.944 4.19-1.41 6.35-1.41 2.922 0 5.832 0.854 8.34 2.532 4.364 2.918 6.884 7.906 6.646 13.148l-6.948 152.979c34.824 45.738 54.662 100.278 57.452 158.117 2.946 60.948-13.478 120.050-47.494 170.923zM730.053 745.033c-0.782 8.246-8.116 14.294-16.348 13.518-46.392-4.398-91.526-20.506-130.519-46.582-17.684-11.818-34.038-25.622-48.602-41.026-6.128-6.476-12.074-13.402-17.688-20.604-1.702-2.192-3.366-4.408-4.996-6.64-19.366 26.5-43.332 49.718-71.082 68.278-129.845 86.842-306.131 51.858-392.978-77.986-34.018-50.866-50.446-109.968-47.504-170.919 2.792-57.836 22.632-112.374 57.458-158.115l-6.952-152.981c-0.238-5.244 2.282-10.232 6.646-13.15 2.508-1.678 5.416-2.532 8.34-2.532 2.162 0 4.33 0.466 6.35 1.41l138.735 64.846c52.23-13.822 107.044-12.396 158.903 4.194 7.89 2.524 12.24 10.966 9.716 18.858-2.524 7.89-10.968 12.24-18.858 9.716-48.008-15.362-98.834-16.198-146.983-2.418-3.476 0.996-7.2 0.702-10.478-0.832l-121.278-56.686 6.076 133.733c0.164 3.616-0.984 7.168-3.232 10.002-68.604 86.514-73.428 206.349-12 298.193 77.648 116.094 235.267 147.375 351.363 69.73 58.924-39.408 98.864-102.234 109.578-172.369 1.25-8.19 8.894-13.808 17.094-12.562 8.19 1.252 13.814 8.904 12.562 17.094-5.274 34.524-16.89 67.464-33.854 97.286 3.454 5.224 7.142 10.394 11.050 15.426 5.014 6.43 10.334 12.626 15.81 18.416 13.026 13.778 27.654 26.124 43.478 36.698 34.876 23.322 75.222 37.726 116.674 41.656 8.248 0.778 14.3 8.098 13.518 16.346zM414.156 359.7l-38.872 38.872c17.11 21.674 27.36 49.004 27.36 78.696 0 70.176-57.092 127.268-127.268 127.268-70.178 0-127.268-57.094-127.268-127.268 0-70.176 57.094-127.268 127.268-127.268 29.694 0 57.022 10.25 78.696 27.358l38.872-38.872c2.928-2.928 6.768-4.392 10.606-4.392s7.678 1.464 10.606 4.392c5.858 5.858 5.858 15.354 0 21.214zM353.899 419.956l-67.918 67.918c-5.856 5.856-15.354 5.856-21.212 0-5.858-5.86-5.858-15.356 0-21.214l67.918-67.918c-16.090-11.772-35.898-18.744-57.314-18.744-53.634 0-97.27 43.634-97.27 97.27s43.636 97.27 97.27 97.27c53.634 0 97.27-43.634 97.27-97.27 0-21.416-6.972-41.226-18.744-57.312zM846.845 374.822l-37.174 89.314c-0.020 0.046-0.038 0.094-0.058 0.14l-56.224 135.083c-2.328 5.594-7.792 9.236-13.848 9.236s-11.522-3.642-13.85-9.236l-56.218-135.069c-0.024-0.058-0.048-0.116-0.072-0.174l-37.166-89.294c-3.182-7.648 0.436-16.428 8.084-19.612s16.428 0.436 19.612 8.084l33.332 80.082h92.554l33.332-80.082c2.4-5.764 7.978-9.24 13.854-9.24 1.92 0 3.874 0.372 5.758 1.156 7.648 3.184 11.268 11.962 8.084 19.612zM705.747 473.374l33.79 81.186 33.792-81.186h-67.582z" />
82
+ <glyph unicode="&#xe948;" glyph-name="question-1" d="M566.514 314.569c115.412 0 209.268 93.857 209.268 209.268s-93.857 209.268-209.268 209.268c-115.411 0-209.268-93.856-209.268-209.268s93.857-209.268 209.268-209.268zM388.57 273.030c-80.609 0-145.949-65.339-145.949-145.949v-163.014c0-15.494 12.574-28.067 28.067-28.067h591.654c15.493 0 28.067 12.573 28.067 28.067v158.972c2.47 4.266 4.715 8.869 6.512 13.697l114.514 303.125c3.817 10.104 5.838 20.882 5.838 31.772v340.173c0 49.623-40.192 89.815-89.815 89.815s-89.815-40.192-89.815-89.815v-323.782l-81.17-214.994h-367.904zM34.588 760.050h66.238c13.921 0 25.709 10.104 27.73 23.801 3.817 24.924 11.564 43.336 23.015 54.45 10.665 10.329 25.373 15.381 45.132 15.381 20.433 0 36.038-5.613 47.939-17.289s17.402-25.709 17.402-44.346c0-8.757-2.021-16.84-6.175-24.699-2.133-3.929-10.441-16.054-42.101-42.887-29.414-24.924-49.286-48.388-60.849-71.627-11.788-23.689-17.514-58.155-17.514-105.083v0c0-15.493 12.574-28.067 28.067-28.067h59.839c15.493 0 28.067 12.574 28.067 28.067v0c0 36.263 4.378 51.082 6.961 56.696 2.021 4.491 10.441 17.738 43.785 45.356 30.986 25.709 51.868 49.174 63.768 71.627 12.237 23.015 18.412 48.275 18.412 74.995 0 47.714-18.076 87.569-53.889 118.555-34.579 29.863-79.711 45.020-134.161 45.020-51.868 0-95.765-15.493-130.231-45.918-34.803-30.762-54.675-72.413-59.165-123.72v0c-1.572-16.167 11.339-30.312 27.73-30.312zM223.086 360.936c15.493 0 28.067 12.573 28.067 28.067v59.727c0 15.494-12.574 28.067-28.067 28.067h-59.727c-15.493 0-28.067-12.573-28.067-28.067v-59.727c0-15.494 12.574-28.067 28.067-28.067h59.727z" />
83
+ <glyph unicode="&#xe949;" glyph-name="education" d="M156.641 839.157c-0.028 0-0.059 0-0.086 0-9.685 0-18.794-3.775-25.672-10.637-6.954-6.937-10.785-16.174-10.785-26.007v-549.462c0-20.149 16.456-36.581 36.688-36.633 85.292-0.203 228.191-17.98 326.771-121.143v575.028c0 6.83-1.745 13.247-5.037 18.556-80.91 130.3-236.393 150.098-321.878 150.298zM903.905 253.051v549.466c0 9.833-3.831 19.070-10.785 26.007-6.878 6.861-15.994 10.637-25.669 10.637-0.031 0-0.062 0-0.090 0-85.482-0.203-240.965-20.001-321.878-150.301-3.293-5.31-5.034-11.726-5.034-18.556v-575.024c98.58 103.162 241.479 120.939 326.771 121.143 20.228 0.052 36.685 16.484 36.685 36.63zM987.363 712.443h-26.569v-459.391c0-51.445-41.915-93.395-93.439-93.522-72.346-0.172-191.633-14.319-276.115-94.277 146.112 35.775 300.14 12.519 387.921-7.485 10.961-2.496 22.287 0.083 31.068 7.082 8.751 6.982 13.771 17.418 13.771 28.62v582.337c0.003 20.201-16.436 36.637-36.637 36.637zM63.205 253.051v459.391h-26.569c-20.197 0-36.637-16.436-36.637-36.637v-582.327c0-11.205 5.020-21.639 13.771-28.62 8.775-6.996 20.090-9.585 31.068-7.082 87.782 20.008 241.813 43.26 387.918 7.485-84.479 79.955-203.766 94.098-276.112 94.27-51.521 0.124-93.439 42.074-93.439 93.519z" />
84
+ <glyph unicode="&#xe94a;" glyph-name="answer-shorting" horiz-adv-x="1020" d="M22.726 665.901c-6.684 5.347-9.358 13.368-9.358 21.389v124.324c0 9.358 2.674 16.042 9.358 22.726s13.368 9.358 22.726 9.358h124.324c9.358 0 16.042-2.674 22.726-9.358 5.347-5.347 9.358-13.368 9.358-22.726v-124.324c0-9.358-2.674-16.042-9.358-22.726-5.347-5.347-13.368-9.358-22.726-9.358h-125.661c-9.358 1.337-16.042 4.010-21.389 10.695zM22.726 355.76c-5.347 5.347-9.358 13.368-9.358 22.726v124.324c0 9.358 2.674 16.042 9.358 22.726s13.368 9.358 22.726 9.358h124.324c9.358 0 16.042-2.674 22.726-9.358 5.347-5.347 9.358-13.368 9.358-22.726v-124.324c0-9.358-2.674-16.042-9.358-22.726-5.347-5.347-13.368-9.358-22.726-9.358h-125.661c-9.358 0-16.042 4.010-21.389 9.358zM22.726 45.619c-5.347 5.347-9.358 13.368-9.358 22.726v124.324c0 9.358 2.674 16.042 9.358 22.726s13.368 9.358 22.726 9.358h124.324c9.358 0 16.042-2.674 22.726-9.358 5.347-5.347 9.358-13.368 9.358-22.726v-124.324c0-9.358-2.674-16.042-9.358-22.726-5.347-5.347-13.368-9.358-22.726-9.358h-125.661c-9.358 1.337-16.042 4.010-21.389 9.358zM270.037 688.627c5.347-5.347 13.368-9.358 22.726-9.358h681.775c9.358 0 16.042 2.674 22.726 9.358 5.347 5.347 9.358 13.368 9.358 22.726v77.535c0 9.358-2.674 16.042-9.358 22.726s-13.368 9.358-22.726 9.358h-681.775c-9.358 0-16.042-2.674-22.726-9.358s-9.358-13.368-9.358-22.726v-77.535c0-9.358 4.010-17.379 9.358-22.726zM270.037 378.486c-5.347 5.347-9.358 13.368-9.358 22.726v77.535c0 9.358 2.674 16.042 9.358 22.726s13.368 9.358 22.726 9.358h681.775c9.358 0 16.042-2.674 22.726-9.358s9.358-13.368 9.358-22.726v-77.535c0-9.358-2.674-16.042-9.358-22.726s-13.368-9.358-22.726-9.358h-681.775c-9.358 1.337-17.379 4.010-22.726 9.358zM270.037 69.681c-5.347 5.347-9.358 13.368-9.358 22.726v77.535c0 9.358 2.674 16.042 9.358 22.726 5.347 5.347 13.368 9.358 22.726 9.358h681.775c9.358 0 16.042-2.674 22.726-9.358 5.347-5.347 9.358-13.368 9.358-22.726v-78.872c0-9.358-2.674-16.042-9.358-22.726s-13.368-9.358-22.726-9.358h-681.775c-9.358 1.337-17.379 4.010-22.726 10.695z" />
85
+ <glyph unicode="&#xe94b;" glyph-name="assesment" horiz-adv-x="1020" d="M1007.958 530.883c-4.010-13.368-10.695-24.063-22.726-29.41l-780.7-443.822c-12.031-6.684-24.063-8.021-37.431-5.347s-24.063 10.695-29.41 24.063l-125.661 212.554c-6.684 12.031-8.021 24.063-5.347 37.431s10.695 22.726 24.063 30.747l108.282 61.493 94.914-159.081c1.337-2.674 4.010-5.347 6.684-6.684 4.010-1.337 6.684 0 10.695 1.337l20.052 12.031c2.674 1.337 5.347 4.010 6.684 6.684 1.337 4.010 0 6.684-1.337 8.021l-92.24 160.418 86.893 48.125 44.115-73.525c1.337-2.674 4.010-5.347 6.684-6.684 4.010-1.337 6.684 0 10.695 1.337l20.052 12.031c2.674 1.337 5.347 4.010 6.684 6.684 1.337 4.010 0 6.684-1.337 8.021l-44.115 74.862 88.23 48.125 92.24-160.418c2.674-2.674 5.347-4.010 8.021-5.347s6.684 0 9.358 1.337l21.389 10.695c2.674 2.674 5.347 5.347 5.347 8.021s0 6.684-1.337 9.358l-94.914 160.418 86.893 48.125 44.115-73.525c2.674-2.674 5.347-5.347 8.021-6.684s6.684 0 9.358 1.337l21.389 12.031c2.674 1.337 5.347 2.674 5.347 6.684 0 2.674 0 6.684-1.337 9.358l-44.115 74.862 86.893 48.125 94.914-160.418c1.337-2.674 4.010-4.010 6.684-5.347 4.010-1.337 6.684 0 10.695 1.337l20.052 10.695c2.674 2.674 5.347 5.347 6.684 8.021s0 6.684-1.337 9.358l-92.24 160.418 108.282 61.493c12.031 6.684 24.063 8.021 37.431 5.347s24.063-10.695 29.41-24.063l125.661-212.554c5.347-2.674 6.684-14.705 2.674-28.073z" />
86
+ <glyph unicode="&#xe94c;" glyph-name="fill-gaps" horiz-adv-x="1020" d="M737.922 583.018c-42.778-66.841-97.587-112.292-164.428-135.018 66.841-22.726 121.65-68.178 164.428-135.018s64.167-143.039 64.167-227.258c12.031 0 22.726-4.010 32.084-13.368s13.368-20.052 13.368-32.084v-29.41c0-12.031-4.010-22.726-13.368-32.084s-20.052-13.368-32.084-13.368h-632.313c-12.031 0-22.726 4.010-32.084 13.368s-13.368 20.052-13.368 32.084v30.747c0 12.031 4.010 22.726 13.368 32.084s20.052 13.368 32.084 13.368c0 84.219 21.389 160.418 64.167 227.258s97.587 112.292 164.428 135.018c-66.841 22.726-121.65 66.841-164.428 135.018-42.778 66.841-64.167 143.039-64.167 227.258-12.031 0-22.726 4.010-32.084 13.368s-13.368 20.052-13.368 32.084v28.073c0 12.031 4.010 22.726 13.368 32.084s20.052 13.368 32.084 13.368h632.313c12.031 0 22.726-4.010 32.084-13.368s13.368-20.052 13.368-32.084v-30.747c0-12.031-4.010-22.726-13.368-32.084s-20.052-13.368-32.084-13.368c0-82.883-21.389-159.081-64.167-225.922zM584.188 574.997c30.747 24.063 53.473 57.483 72.188 100.261 17.379 41.441 26.736 86.893 26.736 135.018h-393.023c0-48.125 9.358-92.24 26.736-135.018 17.379-41.441 41.441-74.862 72.188-100.261s62.83-36.094 97.587-36.094c34.757 0 66.841 12.031 97.587 36.094z" />
87
+ <glyph unicode="&#xe94d;" glyph-name="matching" horiz-adv-x="1020" d="M25.399 609.755v30.747c0 13.368 4.010 24.063 13.368 32.084 9.358 9.358 20.052 13.368 32.084 13.368h688.46v92.24c0 13.368 4.010 24.063 13.368 32.084 9.358 9.358 20.052 13.368 32.084 13.368 13.368 0 24.063-4.010 32.084-13.368l152.397-152.397c9.358-9.358 13.368-20.052 13.368-32.084 0-13.368-4.010-24.063-13.368-32.084l-151.060-153.734c-9.358-9.358-20.052-13.368-32.084-13.368-13.368 0-24.063 4.010-32.084 13.368-9.358 9.358-13.368 20.052-13.368 32.084v92.24h-689.796c-13.368 0-24.063 4.010-32.084 13.368-9.358 9.358-13.368 20.052-13.368 32.084zM958.496 319.666h-688.46v92.24c0 13.368-4.010 24.063-13.368 32.084-9.358 9.358-20.052 13.368-32.084 13.368-13.368 0-24.063-4.010-32.084-13.368l-153.734-153.734c-9.358-9.358-13.368-20.052-13.368-32.084 0-13.368 4.010-24.063 13.368-32.084l152.397-152.397c9.358-9.358 20.052-13.368 32.084-13.368 13.368 0 24.063 4.010 32.084 13.368 9.358 9.358 13.368 20.052 13.368 32.084v92.24h688.46c13.368 0 24.063 4.010 32.084 13.368 9.358 9.358 13.368 20.052 13.368 32.084v30.747c0 13.368-4.010 24.063-13.368 32.084-8.021 9.358-18.715 13.368-30.747 13.368z" />
88
+ <glyph unicode="&#xe94e;" glyph-name="multiple-choice" horiz-adv-x="1020" d="M969.191 587.029c0-13.368-4.010-25.399-13.368-33.42l-552.104-553.441c-9.358-9.358-20.052-14.705-33.42-14.705s-25.399 5.347-33.42 14.705l-310.141 312.815c-9.358 9.358-14.705 20.052-14.705 33.42s5.347 25.399 14.705 33.42l66.841 69.514c9.358 9.358 20.052 13.368 32.084 13.368s24.063-4.010 34.757-13.368l209.88-211.217 449.17 450.507c9.358 9.358 21.389 14.705 34.757 14.705s24.063-5.347 32.084-14.705l69.514-66.841c8.021-9.358 13.368-20.052 13.368-34.757zM93.577 645.849c-6.684 6.684-9.358 13.368-9.358 22.726s2.674 17.379 9.358 22.726l78.872 78.872c8.021 6.684 16.042 9.358 24.063 9.358 9.358 0 16.042-2.674 22.726-9.358l129.671-129.671 292.762 292.762c6.684 6.684 13.368 9.358 22.726 9.358s17.379-2.674 22.726-9.358l78.872-78.872c6.684-6.684 9.358-16.042 9.358-25.399s-2.674-17.379-9.358-22.726l-395.697-393.023c-8.021-6.684-16.042-9.358-24.063-9.358-9.358 0-16.042 2.674-22.726 9.358l-229.932 232.606z" />
89
+ <glyph unicode="&#xe94f;" glyph-name="open-ended" horiz-adv-x="1020" d="M65.504 927.916h894.329c9.358 0 18.715-2.674 24.063-9.358 6.684-6.684 9.358-14.705 9.358-24.063v-205.869c0-10.695-2.674-18.715-9.358-24.063-6.684-6.684-14.705-9.358-24.063-9.358h-74.862c-10.695 0-18.715 2.674-24.063 9.358-6.684 6.684-9.358 14.705-9.358 24.063v102.935h-258.005v-275.384h73.525c9.358 0 18.715-2.674 24.063-9.358 6.684-6.684 9.358-14.705 9.358-24.063v-70.851c0-10.695-2.674-18.715-9.358-24.063-6.684-6.684-14.705-9.358-24.063-9.358h-310.141c-10.695 0-18.715 2.674-24.063 9.358-6.684 6.684-9.358 14.705-9.358 24.063v68.178c0 9.358 2.674 18.715 9.358 24.063 6.684 6.684 14.705 9.358 24.063 9.358h73.525v276.721h-255.332v-102.935c0-10.695-2.674-18.715-9.358-24.063-6.684-6.684-14.705-9.358-24.063-9.358h-76.198c-10.695 0-18.715 2.674-24.063 9.358-6.684 6.684-9.358 14.705-9.358 24.063v207.206c0 9.358 2.674 18.715 9.358 24.063s13.368 9.358 24.063 9.358zM982.559 195.342l-172.449 172.449c-10.695 12.031-22.726 14.705-36.094 8.021-14.705-5.347-21.389-16.042-21.389-32.084v-102.935h-481.253v102.935c0 16.042-6.684 26.736-21.389 32.084s-26.736 2.674-36.094-8.021l-172.449-172.449c-6.684-5.347-10.695-13.368-10.695-24.063s4.010-17.379 10.695-24.063l172.449-172.449c9.358-12.031 22.726-14.705 36.094-8.021 14.705 5.347 21.389 16.042 21.389 32.084v102.935h481.253v-102.935c0-16.042 6.684-26.736 21.389-32.084s26.736-2.674 36.094 8.021l172.449 172.449c6.684 5.347 10.695 13.368 10.695 24.063s-4.010 18.715-10.695 24.063z" />
90
+ <glyph unicode="&#xe950;" glyph-name="ordering" horiz-adv-x="1020" d="M44.115 755.467l173.786 173.786c5.347 6.684 13.368 10.695 24.063 10.695s18.715-4.010 24.063-10.695l173.786-173.786c12.031-10.695 14.705-22.726 9.358-37.431s-16.042-21.389-32.084-21.389h-104.272v-695.144c0-10.695-2.674-18.715-9.358-25.399s-14.705-9.358-25.399-9.358h-69.514c-10.695 0-18.715 2.674-25.399 9.358s-9.358 14.705-9.358 25.399v695.144h-105.608c-16.042 0-26.736 6.684-32.084 21.389-6.684 14.705-4.010 26.736 8.021 37.431zM697.817 541.577c-1.337-5.347-4.010-10.695-9.358-14.705-4.010-4.010-9.358-5.347-14.705-5.347h-78.872c-9.358 0-16.042 4.010-20.052 10.695-5.347 6.684-6.684 14.705-2.674 24.063l124.324 364.95c4.010 12.031 12.031 17.379 24.063 17.379h86.893c12.031 0 20.052-5.347 24.063-17.379l124.324-364.95c2.674-9.358 1.337-16.042-2.674-24.063-5.347-6.684-12.031-10.695-20.052-10.695h-78.872c-13.368 0-21.389 6.684-24.063 20.052l-20.052 61.493h-93.577l-18.715-61.493zM776.689 88.397l145.713 208.543c2.674 4.010 4.010 9.358 4.010 14.705v45.452c0 6.684-2.674 13.368-8.021 18.715s-10.695 8.021-18.715 8.021h-268.7c-6.684 0-13.368-2.674-18.715-8.021s-8.021-10.695-8.021-18.715v-62.83c0-6.684 2.674-13.368 8.021-18.715s10.695-8.021 18.715-8.021h121.65l-149.723-212.554c-4.010-4.010-6.684-9.358-6.684-14.705v-48.125c0-6.684 2.674-13.368 8.021-18.715s10.695-8.021 18.715-8.021h282.068c6.684 0 13.368 2.674 18.715 8.021s8.021 10.695 8.021 18.715v62.83c0 6.684-2.674 13.368-8.021 18.715s-10.695 8.021-18.715 8.021h-132.345l4.010 6.684zM748.616 711.352h30.747l-14.705 49.462-16.042-49.462z" />
91
+ <glyph unicode="&#xe951;" glyph-name="yes-no" horiz-adv-x="1020" d="M80.209 696.648c44.115 76.198 105.608 136.355 180.47 180.47 76.198 44.115 159.081 66.841 247.311 66.841 89.567 0 172.449-22.726 247.311-66.841 76.198-44.115 136.355-105.608 180.47-181.807s66.841-159.081 66.841-248.648c0-89.567-22.726-172.449-66.841-248.648s-104.272-136.355-180.47-181.807c-76.198-44.115-159.081-66.841-247.311-66.841-89.567 0-172.449 22.726-247.311 66.841-74.862 46.789-136.355 106.945-180.47 183.144s-66.841 159.081-66.841 248.648c0 89.567 22.726 172.449 66.841 248.648zM693.807 128.501c56.146 32.084 101.598 77.535 133.681 133.681s49.462 118.977 49.462 184.48c0 66.841-16.042 128.334-49.462 184.48-32.084 56.146-77.535 101.598-133.681 133.681s-117.64 49.462-184.48 49.462v-736.585c66.841 1.337 128.334 18.715 184.48 50.799z" />
92
+ <glyph unicode="&#xe952;" glyph-name="line-cross" d="M463.030 447.843l-453.266-456.432c-12.593-12.68-12.593-33.224 0-45.904 6.288-6.348 14.545-9.506 22.785-9.506 8.256 0 16.497 3.158 22.785 9.506l456.674 459.864 456.674-459.864c6.304-6.348 14.545-9.506 22.785-9.506s16.497 3.158 22.785 9.506c12.592 12.68 12.592 33.224 0 45.904l-453.25 456.432 453.554 456.755c12.592 12.68 12.592 33.224 0 45.904-12.592 12.664-32.993 12.664-45.57 0l-456.962-460.187-457.010 460.17c-12.592 12.664-32.977 12.664-45.57 0-12.592-12.68-12.592-33.224 0-45.904l453.586-456.738z" />
93
+ <glyph unicode="&#xe953;" glyph-name="filter-tool-black-shape" d="M1019.628 930.934c-8.244 18.876-22.511 28.315-42.87 28.326h-929.538c-20.331 0-34.619-9.45-42.85-28.326-8.226-19.843-4.84-36.798 10.172-50.834l358.031-358.021v-352.939c0-12.604 4.601-23.483 13.797-32.696l185.9-185.895c8.722-9.193 19.611-13.807 32.688-13.807 5.805 0 11.853 1.218 18.149 3.637 18.889 8.236 28.336 22.514 28.336 42.847v538.849l358.019 358.021c15.017 14.036 18.395 30.986 10.167 50.837z" />
94
+ <glyph unicode="&#xe954;" glyph-name="plus-square-button" d="M963.394 960h-902.829c-33.392 0-60.565-27.093-60.565-60.565v-902.869c0-33.432 27.133-60.565 60.565-60.565h902.829c33.432 0 60.565 27.133 60.565 60.565v902.869c0 33.472-27.133 60.565-60.565 60.565zM779.518 387.374h-206.932v-206.932c0-33.513-27.133-60.565-60.565-60.565s-60.565 27.053-60.565 60.565v206.932h-206.932c-33.432 0-60.565 27.053-60.565 60.565 0 33.472 27.133 60.565 60.565 60.565h206.932v206.932c0 33.472 27.133 60.565 60.565 60.565 33.513 0 60.565-27.093 60.565-60.565v-206.932h206.932c33.432 0 60.565-27.093 60.565-60.565 0-33.513-27.133-60.565-60.565-60.565z" />
95
+ <glyph unicode="&#xe955;" glyph-name="settings-1" d="M986.532 522.56l-101.436 16.922c-7.372 30.141-18.122 58.953-32.121 85.825l64.936 80.514c13.811 17.016 13.184 41.498-1.377 57.921l-40.343 45.403c-14.624 16.405-38.874 19.875-57.372 8.188l-86.747-54.531c-38.154 26.658-81.374 46.343-127.996 57.765l-16.971 101.98c-3.561 21.594-22.247 37.438-44.183 37.438h-60.796c-21.891 0-40.64-15.844-44.122-37.438l-17.064-102.012c-38.546-9.437-74.687-24.671-107.669-44.735l-82.498 58.876c-17.78 12.703-42.201 10.716-57.717-4.767l-42.951-42.982c-15.483-15.516-17.469-39.937-4.734-57.717l59.013-82.656c-19.875-32.733-34.952-68.668-44.388-106.871l-102.561-17.125c-21.561-3.561-37.436-22.249-37.436-44.185v-60.748c0-21.934 15.875-40.624 37.436-44.185l102.561-17.125c7.749-31.437 18.999-61.466 33.952-89.308l-64.64-80.059c-13.764-17-13.186-41.498 1.375-57.906l40.312-45.404c14.625-16.436 38.888-19.843 57.388-8.186l87.998 55.278c37.234-25.468 79.358-44.186 124.56-55.278l17.064-101.997c3.483-21.595 22.231-37.439 44.122-37.439h60.796c21.935 0 40.622 15.843 44.183 37.438l17 101.997c38.065 9.311 73.748 24.279 106.436 43.999l85.936-61.375c17.748-12.748 42.187-10.748 57.688 4.784l42.968 42.967c15.465 15.469 17.56 39.877 4.716 57.689l-61.182 85.779c19.932 32.843 35.089 68.842 44.466 107.215l101.435 16.937c21.623 3.561 37.434 22.25 37.434 44.185v60.748c-0.032 21.933-15.843 40.621-37.469 44.183zM513.609 256.005c-106.013 0-191.995 85.998-191.995 191.995 0 106.013 85.982 191.995 191.995 191.995 105.995 0 191.992-85.982 191.992-191.995 0-105.997-85.998-191.995-191.992-191.995z" />
96
+ <glyph unicode="&#xe956;" glyph-name="Image-matching" d="M838.921 175.597v-27.212c0-22.756-7.964-42.003-23.799-57.932-15.929-15.834-35.176-23.799-57.932-23.799h-653.843c-22.756 0-42.003 7.964-57.932 23.799-15.834 15.929-23.704 35.176-23.704 57.932v435.864c0 22.661 7.964 42.003 23.799 57.932 15.834 15.834 35.176 23.799 57.932 23.799h27.212v-81.73h-17.067c-2.276 0-4.551-1.138-6.827-3.413s-3.413-4.551-3.413-6.827v-415.384c0-2.276 1.138-4.551 3.413-6.827s4.551-3.413 6.827-3.413h633.363c2.276 0 4.551 1.138 6.827 3.413s3.413 4.551 3.413 6.827v17.067h81.73zM920.652 829.345c22.661 0 42.003-7.964 57.932-23.799 15.929-15.929 23.799-35.176 23.799-57.932v-435.864c0-22.756-7.964-42.003-23.799-57.932-15.929-15.929-35.176-23.799-57.932-23.799h-653.843c-22.756 0-42.003 7.964-57.932 23.799s-23.799 35.176-23.799 57.932v435.864c0 22.661 7.964 42.003 23.799 57.932 15.834 15.834 35.176 23.799 57.932 23.799h653.843zM910.412 747.615h-633.363c-2.276 0-4.551-1.138-6.827-3.413s-3.413-4.551-3.413-6.827v-415.384c0-2.276 1.138-4.551 3.413-6.827s4.551-3.413 6.827-3.413h633.363c2.276 0 4.551 1.138 6.827 3.413s3.413 4.551 3.413 6.827v415.479c0 2.276-1.138 4.551-3.413 6.827-2.37 2.181-4.551 3.319-6.827 3.319zM471.135 638.673c0-19.342-6.542-35.461-19.627-48.545s-29.203-19.627-48.545-19.627c-19.342 0-35.461 6.542-48.545 19.627-13.084 12.99-19.532 29.203-19.532 48.545 0 19.247 6.542 35.461 19.532 48.545 12.99 12.99 29.203 19.532 48.545 19.532 19.247 0 35.461-6.542 48.545-19.532 13.084-13.084 19.627-29.203 19.627-48.545zM348.539 475.212l68.077 68.077c3.413 3.413 7.964 5.12 13.653 5.12s10.24-1.707 13.653-5.12l68.077-68.077 177.019 177.019c3.413 3.413 7.964 5.12 13.653 5.12s10.24-1.707 13.653-5.12l122.596-122.596v-136.249h-490.382v81.825z" />
97
+ <glyph unicode="&#xe957;" glyph-name="menu" horiz-adv-x="1099" d="M183.355 846.012h732.231c33.705 0 61.023-27.317 61.023-61.023v0c0-33.705-27.317-61.023-61.023-61.023h-732.231c-33.705 0-61.023 27.317-61.023 61.023v0c0 33.705 27.317 61.023 61.023 61.023zM183.355 515.955h732.231c33.705 0 61.023-27.317 61.023-61.023v0c0-33.705-27.317-61.023-61.023-61.023h-732.231c-33.705 0-61.023 27.317-61.023 61.023v0c0 33.705 27.317 61.023 61.023 61.023zM183.355 185.897h732.231c33.705 0 61.023-27.317 61.023-61.023v0c0-33.705-27.317-61.023-61.023-61.023h-732.231c-33.705 0-61.023 27.317-61.023 61.023v0c0 33.705 27.317 61.023 61.023 61.023z" />
98
+ <glyph unicode="&#xe958;" glyph-name="image1" d="M632.483 739.068c-31.094 0-56.385-25.283-56.385-56.385 0.008-31.086 25.299-56.369 56.385-56.369s56.385 25.275 56.385 56.369c0 31.094-25.291 56.385-56.385 56.385zM512.333 378.717c-101.571 0-183.889-82.326-183.889-183.873 0-101.555 82.318-183.889 183.889-183.889s183.897 82.334 183.897 183.889c0 101.547-82.326 183.873-183.897 183.873zM615.92 173.048h-79.921v-81.969c0-13.158-10.841-23.861-23.999-23.861s-23.999 10.695-23.999 23.861v81.969h-79.588c-13.158 0-23.869 10.841-23.869 23.999s10.703 23.999 23.869 23.999h79.588v77.548c0 13.149 10.841 23.861 23.999 23.861s23.999-10.703 23.999-23.861v-77.548h79.921c13.158 0 23.869-10.841 23.869-23.999s-10.711-23.999-23.869-23.999zM984.088 885.045h-943.502c-22.057 0-40.586-19.643-40.586-41.7v-608.5c0-22.065 18.53-37.79 40.586-37.79h239.86c0 128 104.025 231.871 231.887 231.871 127.87 0 231.895-103.871 231.895-231.871h239.86c22.057 0 39.912 15.734 39.912 37.79v608.5c0 22.057-17.855 41.7-39.912 41.7zM795.429 609.418l-151.276-151.308-230.262 230.229c-3.129 3.129-8.176 3.129-11.305 0l-146.050-146.042-66.674 66.666c-3.121 3.129-8.476 3.129-11.597 0l-106.268-105.976v310.061h879.998v-348.948l-145.27 145.319c-3.129 3.129-8.168 3.129-11.297 0z" />
99
+ <glyph unicode="&#xe959;" glyph-name="Image-ans" d="M1011.917 666.726v-562.381c0-26.010-9.216-48.128-27.238-66.355-18.227-18.227-40.346-27.238-66.355-27.238h-812.442c-26.010 0-48.128 9.216-66.355 27.238-18.227 18.227-27.238 40.346-27.238 66.355v562.381c0 26.010 9.011 48.128 27.238 66.355s40.346 27.238 66.355 27.238h171.827l23.347 64.512c7.782 18.227 19.456 32.768 35.226 44.032 15.565 11.059 33.178 16.589 52.634 16.589h245.965c19.456 0 37.069-5.53 52.634-16.589s27.238-25.805 35.226-44.032l23.347-64.512h171.827c26.010 0 48.128-9.216 66.355-27.238 18.432-18.227 27.648-40.346 27.648-66.355zM746.291 385.536c0 43.008-10.445 82.33-31.334 118.17s-49.152 64.102-84.992 84.992c-35.84 20.89-75.162 31.334-118.17 31.334s-82.33-10.445-118.17-31.334c-35.84-20.89-64.102-49.152-84.992-84.992s-31.334-75.162-31.334-118.17c0-43.008 10.445-82.33 31.334-118.17s49.152-64.102 84.992-84.992c35.84-20.89 75.162-31.334 118.17-31.334s82.33 10.445 118.17 31.334c35.84 20.89 64.102 49.152 84.992 84.992s31.334 75.162 31.334 118.17zM683.827 385.536c0-46.899-16.998-87.245-50.79-121.037s-74.138-50.79-121.037-50.79-87.245 16.998-121.037 50.79c-33.792 33.792-50.79 74.138-50.79 121.037s16.998 87.245 50.79 121.037c33.792 33.792 74.138 50.79 121.037 50.79s87.245-16.998 121.037-50.79c33.792-33.792 50.79-74.138 50.79-121.037z" />
100
+ <glyph unicode="&#xe95a;" glyph-name="short-ans" d="M355.123 604.877c-10.24-10.24-22.938-15.565-37.478-15.565h-274.022c-7.373 0-13.722 2.458-18.842 7.782-5.12 5.12-7.782 11.469-7.782 18.842v88.269c0 7.373 2.458 13.517 7.782 18.842 5.12 5.12 11.469 7.782 18.842 7.782h185.549v185.549c0 7.373 2.458 13.517 7.782 18.842 5.12 5.12 11.469 7.782 18.842 7.782h88.269c7.373 0 13.517-2.662 18.842-7.782 5.12-5.12 7.782-11.469 7.782-18.842v-273.818c0-14.95-5.325-27.443-15.565-37.683zM362.906-39.014c-5.12-5.12-11.469-7.782-18.842-7.782h-88.269c-7.373 0-13.722 2.662-18.842 7.782s-7.782 11.469-7.782 18.842v185.549h-185.549c-7.373 0-13.722 2.458-18.842 7.782-5.12 5.12-7.782 11.469-7.782 18.842v88.064c0 7.373 2.458 13.517 7.782 18.842 5.12 5.12 11.469 7.782 18.842 7.782h273.818c14.746 0 27.238-5.12 37.478-15.565 10.24-10.24 15.36-22.938 15.36-37.478v-273.818c0.41-7.578-2.253-13.722-7.373-18.842zM999.014 597.094c5.12 5.12 7.782 11.469 7.782 18.842v88.269c0 7.373-2.662 13.517-7.782 18.842-5.12 5.12-11.469 7.782-18.842 7.782h-185.549v185.549c0 7.373-2.662 13.517-7.782 18.842-5.12 5.12-11.469 7.782-18.842 7.782h-88.064c-7.373 0-13.722-2.662-18.842-7.782s-7.782-11.469-7.782-18.842v-273.818c0-14.746 5.12-27.238 15.36-37.478s22.733-15.565 37.478-15.565h273.818c7.782-0.205 13.926 2.458 19.046 7.578zM787.046-39.014c-5.12-5.12-11.469-7.782-18.842-7.782h-88.269c-7.373 0-13.722 2.662-18.842 7.782s-7.782 11.469-7.782 18.842v273.818c0 14.746 5.12 27.238 15.36 37.478s22.733 15.565 37.478 15.565h273.818c7.373 0 13.517-2.662 18.842-7.782 5.12-5.12 7.782-11.469 7.782-18.842v-88.269c0-7.373-2.662-13.722-7.782-18.842s-11.469-7.782-18.842-7.782h-185.549v-185.549c0.41-7.373-2.253-13.517-7.373-18.637z" />
101
  </font></defs></svg>
assets/icons/font/tutor.ttf CHANGED
Binary file
assets/icons/font/tutor.woff CHANGED
Binary file
assets/js/tutor-admin.js CHANGED
@@ -44,24 +44,28 @@ jQuery(document).ready(function($){
44
  });
45
  });
46
 
47
- $('.tutor-field-slider').each(function(){
48
- var $slider = $(this);
49
- var $input = $slider.closest('.tutor-field-type-slider').find('input[type="hidden"]');
50
- var $showVal = $slider.closest('.tutor-field-type-slider').find('.tutor-field-type-slider-value');
51
- var min = parseFloat($slider.closest('.tutor-field-type-slider').attr('data-min'));
52
- var max = parseFloat($slider.closest('.tutor-field-type-slider').attr('data-max'));
53
-
54
- $slider.slider({
55
- range: "max",
56
- min: min,
57
- max: max,
58
- value: $input.val(),
59
- slide: function( event, ui ) {
60
- $showVal.text(ui.value);
61
- $input.val(ui.value);
62
- }
 
 
63
  });
64
- });
 
 
65
 
66
  /**
67
  * Course and lesson sorting
@@ -79,7 +83,7 @@ jQuery(document).ready(function($){
79
  });
80
  $(".tutor-lessons:not(.drop-lessons)").sortable({
81
  connectWith: ".tutor-lessons",
82
- items: "div.tutor-lesson",
83
  start: function (e, ui) {
84
  ui.placeholder.css('visibility', 'visible');
85
  },
@@ -97,23 +101,13 @@ jQuery(document).ready(function($){
97
  var topics_id = parseInt($topic.attr('id').match(/\d+/)[0], 10);
98
  var lessons = {};
99
 
100
- $topic.find('.tutor-lesson').each(function(lessonIndex, lessonItem){
101
  var $lesson = $(this);
102
  var lesson_id = parseInt($lesson.attr('id').match(/\d+/)[0], 10);
103
 
104
  lessons[lessonIndex] = lesson_id;
105
  });
106
  topics[index] = { 'topic_id' : topics_id, 'lesson_ids' : lessons };
107
-
108
- //Hide drop element
109
- /*
110
- if ($topic.find('.tutor-lesson').length){
111
- $topic.find('.drop-lessons').hide();
112
- }else{
113
- $topic.find('.drop-lessons').show();
114
- }
115
- */
116
-
117
  });
118
  $('#tutor_topics_lessons_sorting').val(JSON.stringify(topics));
119
  }
@@ -379,6 +373,29 @@ jQuery(document).ready(function($){
379
  });
380
  });
381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  /**
383
  * Lesson Update or Create Modal
384
  */
@@ -779,12 +796,13 @@ jQuery(document).ready(function($){
779
  $('.tutor-modal-wrap').removeClass('show');
780
  }
781
  });
 
 
782
  $(document).on('click', '.tutor-add-quiz-btn', function(e){
783
  e.preventDefault();
784
-
785
  var $that = $(this);
786
  var quiz_for_post_id = $(this).closest('.tutor_add_quiz_wrap').attr('data-add-quiz-under');
787
-
788
  $.ajax({
789
  url : ajaxurl,
790
  type : 'POST',
@@ -801,6 +819,495 @@ jQuery(document).ready(function($){
801
  }
802
  });
803
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
804
 
805
  $(document).on('click', '.add_quiz_to_post_btn', function(e){
806
  e.preventDefault();
@@ -1030,7 +1537,110 @@ jQuery(document).ready(function($){
1030
  }
1031
  }
1032
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1033
 
 
 
 
1034
  });
1035
 
1036
  });
44
  });
45
  });
46
 
47
+ function tutor_slider_init(){
48
+ $('.tutor-field-slider').each(function(){
49
+ var $slider = $(this);
50
+ var $input = $slider.closest('.tutor-field-type-slider').find('input[type="hidden"]');
51
+ var $showVal = $slider.closest('.tutor-field-type-slider').find('.tutor-field-type-slider-value');
52
+ var min = parseFloat($slider.closest('.tutor-field-type-slider').attr('data-min'));
53
+ var max = parseFloat($slider.closest('.tutor-field-type-slider').attr('data-max'));
54
+
55
+ $slider.slider({
56
+ range: "max",
57
+ min: min,
58
+ max: max,
59
+ value: $input.val(),
60
+ slide: function( event, ui ) {
61
+ $showVal.text(ui.value);
62
+ $input.val(ui.value);
63
+ }
64
+ });
65
  });
66
+ }
67
+
68
+ tutor_slider_init();
69
 
70
  /**
71
  * Course and lesson sorting
83
  });
84
  $(".tutor-lessons:not(.drop-lessons)").sortable({
85
  connectWith: ".tutor-lessons",
86
+ items: "div.course-content-item",
87
  start: function (e, ui) {
88
  ui.placeholder.css('visibility', 'visible');
89
  },
101
  var topics_id = parseInt($topic.attr('id').match(/\d+/)[0], 10);
102
  var lessons = {};
103
 
104
+ $topic.find('.course-content-item').each(function(lessonIndex, lessonItem){
105
  var $lesson = $(this);
106
  var lesson_id = parseInt($lesson.attr('id').match(/\d+/)[0], 10);
107
 
108
  lessons[lessonIndex] = lesson_id;
109
  });
110
  topics[index] = { 'topic_id' : topics_id, 'lesson_ids' : lessons };
 
 
 
 
 
 
 
 
 
 
111
  });
112
  $('#tutor_topics_lessons_sorting').val(JSON.stringify(topics));
113
  }
373
  });
374
  });
375
 
376
+ /**
377
+ * Delete quiz
378
+ */
379
+ $(document).on('click', '.tutor-delete-quiz-btn', function(e){
380
+ e.preventDefault();
381
+
382
+ if( ! confirm('Are you sure?')){
383
+ return;
384
+ }
385
+
386
+ var $that = $(this);
387
+ var quiz_id = $that.attr('data-quiz-id');
388
+
389
+ $.ajax({
390
+ url : ajaxurl,
391
+ type : 'POST',
392
+ data : {quiz_id : quiz_id, action: 'tutor_delete_quiz_by_id'},
393
+ beforeSend: function () {
394
+ $that.closest('.course-content-item').remove();
395
+ }
396
+ });
397
+ });
398
+
399
  /**
400
  * Lesson Update or Create Modal
401
  */
796
  $('.tutor-modal-wrap').removeClass('show');
797
  }
798
  });
799
+
800
+ /*
801
  $(document).on('click', '.tutor-add-quiz-btn', function(e){
802
  e.preventDefault();
803
+
804
  var $that = $(this);
805
  var quiz_for_post_id = $(this).closest('.tutor_add_quiz_wrap').attr('data-add-quiz-under');
 
806
  $.ajax({
807
  url : ajaxurl,
808
  type : 'POST',
819
  }
820
  });
821
  });
822
+ */
823
+
824
+
825
+
826
+ $(document).on('click', '.tutor-add-quiz-btn', function(e){
827
+ e.preventDefault();
828
+
829
+ var $that = $(this);
830
+ var quiz_for_post_id = $(this).closest('.tutor_add_quiz_wrap').attr('data-add-quiz-under');
831
+ $.ajax({
832
+ url : ajaxurl,
833
+ type : 'POST',
834
+ data : {quiz_for_post_id : quiz_for_post_id, action: 'tutor_load_quiz_builder_modal'},
835
+ beforeSend: function () {
836
+ $that.addClass('tutor-updating-message');
837
+ },
838
+ success: function (data) {
839
+ $('.tutor-quiz-builder-modal-wrap .modal-container').html(data.data.output);
840
+ $('.tutor-quiz-builder-modal-wrap').attr('quiz-for-post-id', quiz_for_post_id).addClass('show');
841
+ },
842
+ complete: function () {
843
+ $that.removeClass('tutor-updating-message');
844
+ }
845
+ });
846
+ });
847
+
848
+ /**
849
+ * Quiz Builder Modal Tabs
850
+ */
851
+ $(document).on('click', '.tutor-quiz-modal-tab-item', function(e){
852
+ e.preventDefault();
853
+
854
+ var $that = $(this);
855
+
856
+ var $quizTitle = $('[name="quiz_title"]');
857
+ var quiz_title = $quizTitle.val();
858
+ if ( ! quiz_title){
859
+ $quizTitle.closest('.tutor-quiz-builder-form-row').find('.quiz_form_msg').html('<p class="quiz-form-warning">Please save the quiz' +
860
+ ' first</p>');
861
+ return;
862
+ }else{
863
+ $quizTitle.closest('.tutor-quiz-builder-form-row').find('.quiz_form_msg').html('');
864
+ }
865
+
866
+ var tabSelector = $that.attr('href');
867
+ $('.quiz-builder-tab-container').hide();
868
+ $(tabSelector).show();
869
+
870
+ $('a.tutor-quiz-modal-tab-item').removeClass('active');
871
+ $that.addClass('active');
872
+ });
873
+
874
+ //Next Prev Tab
875
+ $(document).on('click', '.quiz-modal-btn-next, .quiz-modal-btn-back', function(e){
876
+ e.preventDefault();
877
+
878
+ var tabSelector = $(this).attr('href');
879
+ $('#tutor-quiz-modal-tab-items-wrap a[href="'+tabSelector+'"]').trigger('click');
880
+ });
881
+
882
+ $(document).on('click', '.quiz-modal-tab-navigation-btn.quiz-modal-btn-cancel', function(e){
883
+ e.preventDefault();
884
+ $('.tutor-modal-wrap').removeClass('show');
885
+ });
886
+
887
+ $(document).on('click', '.quiz-modal-btn-first-step', function(e){
888
+ e.preventDefault();
889
+
890
+ var $that = $(this);
891
+ var $quizTitle = $('[name="quiz_title"]');
892
+ var quiz_title = $quizTitle.val();
893
+ var quiz_description = $('[name="quiz_description"]').val();
894
+
895
+ if ( ! quiz_title){
896
+ $quizTitle.closest('.tutor-quiz-builder-form-row').find('.quiz_form_msg').html('<p class="quiz-form-warning">Please enter quiz title</p>');
897
+ return;
898
+ }else{
899
+ $quizTitle.closest('.tutor-quiz-builder-form-row').find('.quiz_form_msg').html('');
900
+ }
901
+
902
+
903
+
904
+ var course_id = $('#post_ID').val();
905
+ var topic_id = $that.closest('.tutor-modal-wrap').attr('quiz-for-post-id');
906
+
907
+
908
+ if ($('#tutor_quiz_builder_quiz_id').length) {
909
+ /**
910
+ *
911
+ * @type {jQuery}
912
+ *
913
+ * if quiz id exists, we are sending it to update quiz
914
+ */
915
+
916
+ var quiz_id = $('#tutor_quiz_builder_quiz_id').val();
917
+ $.ajax({
918
+ url : ajaxurl,
919
+ type : 'POST',
920
+ data : {quiz_title:quiz_title, quiz_description: quiz_description, quiz_id : quiz_id, topic_id : topic_id, action: 'tutor_quiz_builder_quiz_update'},
921
+ beforeSend: function () {
922
+ $that.addClass('tutor-updating-message');
923
+ },
924
+ success: function (data) {
925
+ $('#tutor-quiz-'+quiz_id).html(data.data.output_quiz_row);
926
+ $('#tutor-quiz-modal-tab-items-wrap a[href="#quiz-builder-tab-questions"]').trigger('click');
927
+ },
928
+ complete: function () {
929
+ $that.removeClass('tutor-updating-message');
930
+ }
931
+ });
932
+
933
+ return;
934
+ }
935
+
936
+ $.ajax({
937
+ url : ajaxurl,
938
+ type : 'POST',
939
+ data : {quiz_title:quiz_title, quiz_description: quiz_description, course_id : course_id, topic_id : topic_id, action: 'tutor_create_quiz_and_load_modal'},
940
+ beforeSend: function () {
941
+ $that.addClass('tutor-updating-message');
942
+ },
943
+ success: function (data) {
944
+ $('.tutor-quiz-builder-modal-wrap .modal-container').html(data.data.output);
945
+ $('#tutor-topics-'+topic_id+' .tutor-lessons').append(data.data.output_quiz_row);
946
+ $('#tutor-quiz-modal-tab-items-wrap a[href="#quiz-builder-tab-questions"]').trigger('click');
947
+ },
948
+ complete: function () {
949
+ $that.removeClass('tutor-updating-message');
950
+ }
951
+ });
952
+
953
+ });
954
+
955
+ /**
956
+ * Ope modal for edit quiz
957
+ */
958
+ $(document).on('click', '.open-tutor-quiz-modal', function(e){
959
+ e.preventDefault();
960
+
961
+ var $that = $(this);
962
+ var quiz_id = $that.attr('data-quiz-id');
963
+ var topic_id = $that.attr('data-topic-id');
964
+ var course_id = $('#post_ID').val();
965
+
966
+ $.ajax({
967
+ url : ajaxurl,
968
+ type : 'POST',
969
+ data : {quiz_id : quiz_id, topic_id : topic_id, course_id : course_id, action: 'tutor_load_edit_quiz_modal'},
970
+ beforeSend: function () {
971
+ $that.addClass('tutor-updating-message');
972
+ },
973
+ success: function (data) {
974
+ $('.tutor-quiz-builder-modal-wrap .modal-container').html(data.data.output);
975
+ $('.tutor-quiz-builder-modal-wrap').attr('data-quiz-id', quiz_id).addClass('show');
976
+
977
+ //Back to question Tab if exists
978
+ if ($that.attr('data-back-to-tab')){
979
+ var tabSelector = $that.attr('data-back-to-tab');
980
+ $('#tutor-quiz-modal-tab-items-wrap a[href="'+tabSelector+'"]').trigger('click');
981
+ }
982
+ tutor_slider_init();
983
+ },
984
+ complete: function () {
985
+ $that.removeClass('tutor-updating-message');
986
+ }
987
+ });
988
+ });
989
+
990
+
991
+ $(document).on('click', '.quiz-modal-settings-save-btn', function(e){
992
+ e.preventDefault();
993
+
994
+ var $that = $(this);
995
+ var quiz_id = $('.tutor-quiz-builder-modal-wrap').attr('data-quiz-id');
996
+
997
+ var $formInput = $('#quiz-builder-tab-settings :input, #quiz-builder-tab-advanced-options :input').serialize()+'&quiz_id='+quiz_id+'&action=tutor_quiz_modal_update_settings';
998
+
999
+ $.ajax({
1000
+ url : ajaxurl,
1001
+ type : 'POST',
1002
+ data : $formInput,
1003
+ beforeSend: function () {
1004
+ $that.addClass('tutor-updating-message');
1005
+ },
1006
+ success: function (data) {
1007
+ //
1008
+ },
1009
+ complete: function () {
1010
+ $that.removeClass('tutor-updating-message');
1011
+ }
1012
+ });
1013
+ });
1014
+
1015
+
1016
+ /**
1017
+ * Add Question to quiz modal
1018
+ */
1019
+ $(document).on('click', '.tutor-quiz-open-question-form', function(e){
1020
+ e.preventDefault();
1021
+
1022
+ var $that = $(this);
1023
+
1024
+ var quiz_id = $('#tutor_quiz_builder_quiz_id').val();
1025
+ var course_id = $('#post_ID').val();
1026
+ var question_id = $that.attr('data-question-id');
1027
+
1028
+
1029
+ var params = {quiz_id : quiz_id, course_id : course_id, action: 'tutor_quiz_builder_get_question_form'};
1030
+
1031
+ if (question_id) {
1032
+ params.question_id = question_id;
1033
+ }
1034
+
1035
+ $.ajax({
1036
+ url : ajaxurl,
1037
+ type : 'POST',
1038
+ data : params,
1039
+ beforeSend: function () {
1040
+ $that.addClass('tutor-updating-message');
1041
+ },
1042
+ success: function (data) {
1043
+ $('.tutor-quiz-builder-modal-contents').html(data.data.output);
1044
+
1045
+ //Initializing Tutor Select
1046
+ tutor_select().reInit();
1047
+ enable_quiz_answer_sorting();
1048
+ },
1049
+ complete: function () {
1050
+ $that.removeClass('tutor-updating-message');
1051
+ }
1052
+ });
1053
+
1054
+ });
1055
+
1056
+ $(document).on('click', '.quiz-modal-question-save-btn', function(e){
1057
+ e.preventDefault();
1058
+
1059
+ var $that = $(this);
1060
+ var $formInput = $('.quiz_question_form :input').serialize()+'&action=tutor_quiz_modal_update_question';
1061
+ $.ajax({
1062
+ url : ajaxurl,
1063
+ type : 'POST',
1064
+ data : $formInput,
1065
+ beforeSend: function () {
1066
+ $that.addClass('tutor-updating-message');
1067
+ },
1068
+ success: function (data) {
1069
+ //ReOpen questions
1070
+ $that.closest('.quiz-questions-form').find('.open-tutor-quiz-modal').trigger('click');
1071
+ },
1072
+ complete: function () {
1073
+ $that.removeClass('tutor-updating-message');
1074
+ }
1075
+ });
1076
+ });
1077
+
1078
+ $(document).on('click', '.tutor-quiz-question-trash', function(e){
1079
+ e.preventDefault();
1080
+
1081
+ var $that = $(this);
1082
+ var question_id = $that.attr('data-question-id');
1083
+
1084
+ $.ajax({
1085
+ url : ajaxurl,
1086
+ type : 'POST',
1087
+ data : {question_id : question_id, action: 'tutor_quiz_builder_question_delete'},
1088
+ beforeSend: function () {
1089
+ $that.closest('.quiz-builder-question-wrap').remove();
1090
+ },
1091
+ });
1092
+ });
1093
+
1094
+ /**
1095
+ * Get question answers option form to save multiple/single/true-false options
1096
+ *
1097
+ * @since v.1.0.0
1098
+ */
1099
+
1100
+ $(document).on('click', '.add_question_answers_option', function(e){
1101
+ e.preventDefault();
1102
+
1103
+ var $that = $(this);
1104
+ var question_id = $that.attr('data-question-id');
1105
+ var $formInput = $('.quiz_question_form :input').serialize()+'&question_id='+question_id+'&action=tutor_quiz_add_question_answers';
1106
+
1107
+ $.ajax({
1108
+ url : ajaxurl,
1109
+ type : 'POST',
1110
+ data : $formInput,
1111
+ beforeSend: function () {
1112
+ $that.addClass('tutor-updating-message');
1113
+ },
1114
+ success: function (data) {
1115
+ $('#tutor_quiz_question_answer_form').html(data.data.output);
1116
+ },
1117
+ complete: function () {
1118
+ $that.removeClass('tutor-updating-message');
1119
+ }
1120
+ });
1121
+ });
1122
+
1123
+ /**
1124
+ * Get question answers option edit form
1125
+ *
1126
+ * @since v.1.0.0
1127
+ */
1128
+ $(document).on('click', '.tutor-quiz-answer-edit a', function(e){
1129
+ e.preventDefault();
1130
+
1131
+ var $that = $(this);
1132
+ var answer_id = $that.closest('.tutor-quiz-answer-wrap').attr('data-answer-id');
1133
+
1134
+ $.ajax({
1135
+ url : ajaxurl,
1136
+ type : 'POST',
1137
+ data : {answer_id : answer_id, action : 'tutor_quiz_edit_question_answer'},
1138
+ beforeSend: function () {
1139
+ $that.addClass('tutor-updating-message');
1140
+ },
1141
+ success: function (data) {
1142
+ $('#tutor_quiz_question_answer_form').html(data.data.output);
1143
+ },
1144
+ complete: function () {
1145
+ $that.removeClass('tutor-updating-message');
1146
+ }
1147
+ });
1148
+ });
1149
+
1150
+
1151
+ /**
1152
+ * Saving question answers options
1153
+ * Student should select the right answer at quiz attempts
1154
+ *
1155
+ * @since v.1.0.0
1156
+ */
1157
+
1158
+ $(document).on('click', '#quiz-answer-save-btn', function(e){
1159
+ e.preventDefault();
1160
+
1161
+ var $that = $(this);
1162
+ var $formInput = $('.quiz_question_form :input').serialize()+'&action=tutor_save_quiz_answer_options';
1163
+
1164
+ $.ajax({
1165
+ url : ajaxurl,
1166
+ type : 'POST',
1167
+ data : $formInput,
1168
+ beforeSend: function () {
1169
+ $that.addClass('tutor-updating-message');
1170
+ },
1171
+ success: function (data) {
1172
+ $('#tutor_quiz_question_answers').trigger('refresh');
1173
+ },
1174
+ complete: function () {
1175
+ $that.removeClass('tutor-updating-message');
1176
+ }
1177
+ });
1178
+ });
1179
+
1180
+ /**
1181
+ * Updating Answer
1182
+ *
1183
+ * @since v.1.0.0
1184
+ */
1185
+ $(document).on('click', '#quiz-answer-edit-btn', function(e){
1186
+ e.preventDefault();
1187
+
1188
+ var $that = $(this);
1189
+ var $formInput = $('.quiz_question_form :input').serialize()+'&action=tutor_update_quiz_answer_options';
1190
+
1191
+ $.ajax({
1192
+ url : ajaxurl,
1193
+ type : 'POST',
1194
+ data : $formInput,
1195
+ beforeSend: function () {
1196
+ $that.addClass('tutor-updating-message');
1197
+ },
1198
+ success: function (data) {
1199
+ $('#tutor_quiz_question_answers').trigger('refresh');
1200
+ },
1201
+ complete: function () {
1202
+ $that.removeClass('tutor-updating-message');
1203
+ }
1204
+ });
1205
+ });
1206
+
1207
+ $(document).on('change', '.tutor-quiz-answers-mark-correct-wrap input', function(e){
1208
+ e.preventDefault();
1209
+
1210
+ var $that = $(this);
1211
+
1212
+ var answer_id = $that.val();
1213
+ var inputValue = 1;
1214
+ if ( ! $that.prop('checked')) {
1215
+ inputValue = 0;
1216
+ }
1217
+
1218
+ $.ajax({
1219
+ url : ajaxurl,
1220
+ type : 'POST',
1221
+ data : {answer_id:answer_id, inputValue : inputValue, action : 'tutor_mark_answer_as_correct'},
1222
+ });
1223
+ });
1224
+
1225
+
1226
+ $(document).on('refresh', '#tutor_quiz_question_answers', function(e){
1227
+ e.preventDefault();
1228
+
1229
+ var $that = $(this);
1230
+ var question_id = $that.attr('data-question-id');
1231
+ var question_type = $('.tutor_select_value_holder').val();
1232
+
1233
+ $.ajax({
1234
+ url : ajaxurl,
1235
+ type : 'POST',
1236
+ data : {question_id : question_id, question_type : question_type, action: 'tutor_quiz_builder_get_answers_by_question'},
1237
+ beforeSend: function () {
1238
+ $that.addClass('tutor-updating-message');
1239
+ $('#tutor_quiz_question_answer_form').html('');
1240
+ },
1241
+ success: function (data) {
1242
+ if (data.success){
1243
+ $that.html(data.data.output);
1244
+ }
1245
+ },
1246
+ complete: function () {
1247
+ $that.removeClass('tutor-updating-message');
1248
+ }
1249
+ });
1250
+ });
1251
+
1252
+ /**
1253
+ * Delete answer for a question in quiz builder
1254
+ *
1255
+ * @since v.1.0.0
1256
+ */
1257
+
1258
+ $(document).on('click', '.tutor-quiz-answer-trash-wrap a.answer-trash-btn', function(e){
1259
+ e.preventDefault();
1260
+
1261
+ var $that = $(this);
1262
+ var answer_id = $that.attr('data-answer-id');
1263
+
1264
+ $.ajax({
1265
+ url : ajaxurl,
1266
+ type : 'POST',
1267
+ data : {answer_id : answer_id, action: 'tutor_quiz_builder_delete_answer'},
1268
+ beforeSend: function () {
1269
+ $that.closest('.tutor-quiz-answer-wrap').remove();
1270
+ },
1271
+ });
1272
+ });
1273
+
1274
+ /**
1275
+ * Save answer sorting placement
1276
+ *
1277
+ * @since v.1.0.0
1278
+ */
1279
+ function enable_quiz_answer_sorting(){
1280
+ if (jQuery().sortable) {
1281
+ $("#tutor_quiz_question_answers").sortable({
1282
+ handle: ".tutor-quiz-answer-sort-icon",
1283
+ start: function (e, ui) {
1284
+ ui.placeholder.css('visibility', 'visible');
1285
+ },
1286
+ stop: function (e, ui) {
1287
+ tutor_save_sorting_quiz_answer_order();
1288
+ },
1289
+ });
1290
+ }
1291
+ }
1292
+ function tutor_save_sorting_quiz_answer_order(){
1293
+ var answers = {};
1294
+ $('.tutor-quiz-answer-wrap').each(function(index, item){
1295
+ var $answer = $(this);
1296
+ var answer_id = parseInt($answer.attr('data-answer-id'), 10);
1297
+ answers[index] = answer_id;
1298
+ });
1299
+
1300
+ $.ajax({url : ajaxurl, type : 'POST',
1301
+ data : {sorted_answer_ids : answers, action: 'tutor_quiz_answer_sorting'},
1302
+ });
1303
+ }
1304
+
1305
+
1306
+
1307
+ /**
1308
+ * Deprecated, should remove
1309
+ * @todo: should remove this
1310
+ */
1311
 
1312
  $(document).on('click', '.add_quiz_to_post_btn', function(e){
1313
  e.preventDefault();
1537
  }
1538
  }
1539
  });
1540
+ });
1541
+
1542
+ /**
1543
+ * Tutor Custom Select
1544
+ */
1545
+
1546
+ function tutor_select(){
1547
+ var obj = {
1548
+ init : function(){
1549
+ $(document).on('click', '.tutor-select .tutor-select-option', function(e){
1550
+ e.preventDefault();
1551
+
1552
+ var $that = $(this);
1553
+ var $html = $that.html().trim();
1554
+ $that.closest('.tutor-select').find('.select-header .lead-option').html($html);
1555
+ $that.closest('.tutor-select').find('.select-header input.tutor_select_value_holder').val($that.attr('data-value')).trigger('change');
1556
+ $that.closest('.tutor-select-options').hide();
1557
+ });
1558
+ $(document).on('click', '.tutor-select .select-header', function(e){
1559
+ e.preventDefault();
1560
+
1561
+ var $that = $(this);
1562
+ $that.closest('.tutor-select').find('.tutor-select-options').slideToggle();
1563
+ });
1564
+
1565
+ this.setValue();
1566
+ this.hideOnOutSideClick();
1567
+ },
1568
+ setValue : function(){
1569
+ $('.tutor-select').each(function(){
1570
+ var $that = $(this);
1571
+ var $option = $that.find('.tutor-select-option');
1572
+
1573
+ if ($option.length){
1574
+ $option.each(function(){
1575
+ var $thisOption = $(this);
1576
+
1577
+ if ($thisOption.attr('data-selected') === 'selected'){
1578
+ var $html = $thisOption.html().trim();
1579
+ $thisOption.closest('.tutor-select').find('.select-header .lead-option').html($html);
1580
+ $thisOption.closest('.tutor-select').find('.select-header input.tutor_select_value_holder').val($thisOption.attr('data-value'));
1581
+ }
1582
+ });
1583
+ }
1584
+ });
1585
+ },
1586
+ hideOnOutSideClick : function(){
1587
+ $(document).mouseup(function(e) {
1588
+ var $option_wrap = $(".tutor-select-options");
1589
+ if ( ! $(e.target).closest('.select-header').length && !$option_wrap.is(e.target) && $option_wrap.has(e.target).length === 0) {
1590
+ $option_wrap.hide();
1591
+ }
1592
+ });
1593
+ },
1594
+ reInit : function(){
1595
+ this.setValue();
1596
+ }
1597
+ };
1598
+
1599
+ return obj;
1600
+ }
1601
+ tutor_select().init();
1602
+
1603
+ /**
1604
+ * If change question type from quiz builder question
1605
+ *
1606
+ * @since v.1.0.0
1607
+ */
1608
+ $(document).on('change', 'input.tutor_select_value_holder', function(e) {
1609
+ var $that = $(this);
1610
+ //$('#tutor_quiz_question_answer_form').html('');
1611
+ $('.add_question_answers_option').trigger('click');
1612
+ $('#tutor_quiz_question_answers').trigger('refresh');
1613
+ });
1614
+
1615
+ $(document).on('click', '.tutor-media-upload-btn', function(e){
1616
+ e.preventDefault();
1617
+
1618
+ var $that = $(this);
1619
+ var frame;
1620
+ if ( frame ) {
1621
+ frame.open();
1622
+ return;
1623
+ }
1624
+ frame = wp.media({
1625
+ title: 'Select or Upload Media Of Your Chosen Persuasion',
1626
+ button: {
1627
+ text: 'Use this media'
1628
+ },
1629
+ multiple: false
1630
+ });
1631
+ frame.on( 'select', function() {
1632
+ var attachment = frame.state().get('selection').first().toJSON();
1633
+ $that.html('<img src="'+attachment.url+'" alt="" />');
1634
+ $that.closest('.tutor-media-upload-wrap').find('input').val(attachment.id);
1635
+ });
1636
+ frame.open();
1637
+ });
1638
+ $(document).on('click', '.tutor-media-upload-trash', function(e){
1639
+ e.preventDefault();
1640
 
1641
+ var $that = $(this);
1642
+ $that.closest('.tutor-media-upload-wrap').find('.tutor-media-upload-btn').html('<i class="tutor-icon-image1"></i>');
1643
+ $that.closest('.tutor-media-upload-wrap').find('input').val('');
1644
  });
1645
 
1646
  });
assets/js/tutor-front.js CHANGED
@@ -235,7 +235,7 @@ jQuery(document).ready(function($){
235
  attempt_settings = JSON.parse($tutor_quiz_time_update.attr('data-attempt-settings'));
236
  var attempt_meta = JSON.parse($tutor_quiz_time_update.attr('data-attempt-meta'));
237
 
238
- var countDownDate = new Date(attempt_settings.quiz_started_at).getTime() + (attempt_meta.time_limit_seconds * 1000);
239
  var time_now = new Date(attempt_meta.date_time_now).getTime();
240
 
241
  var tutor_quiz_interval = setInterval(function() {
@@ -266,30 +266,54 @@ jQuery(document).ready(function($){
266
  countdown_human = "EXPIRED";
267
  //Set the quiz attempt to timeout in ajax
268
 
269
- var quiz_id = $('#tutor_quiz_id').val();
270
- var tutor_quiz_remaining_time_secs = $('#tutor_quiz_remaining_time_secs').val();
271
- var quiz_timeout_data = { quiz_id : quiz_id, action : 'tutor_quiz_timeout' };
272
-
273
- $.ajax({
274
- url: _tutorobject.ajaxurl,
275
- type: 'POST',
276
- data: quiz_timeout_data,
277
- success: function (data) {
278
- if (data.success){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  window.location.reload(true);
280
  }
281
- },
282
- complete: function () {
283
- $('#tutor-quiz-body').html('');
284
- window.location.reload(true);
285
- }
286
- });
287
  }
288
  time_now = time_now + 1000;
289
  $tutor_quiz_time_update.html(countdown_human);
290
  }, 1000);
291
  }
292
 
 
 
 
 
 
 
 
293
  // tutor course content accordion
294
  $('.tutor-course-topic.tutor-active').find('.tutor-course-lessons').slideDown();
295
  $('.tutor-course-title').on('click', function () {
@@ -337,7 +361,7 @@ jQuery(document).ready(function($){
337
 
338
  var $that = $(this);
339
  var lesson_id = $that.attr('data-lesson-id');
340
- var $wrap = $('#tutor-single-lesson-entry-content');
341
 
342
  $.ajax({
343
  url: _tutorobject.ajaxurl,
@@ -361,6 +385,36 @@ jQuery(document).ready(function($){
361
  });
362
  });
363
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  /**
365
  * @date 05 Feb, 2019
366
  */
@@ -374,7 +428,6 @@ jQuery(document).ready(function($){
374
  e.preventDefault();
375
  var $that = $(this);
376
 
377
-
378
  var tabSelector = $that.attr('href');
379
  $('.tutor-lesson-sidebar-tab-item').hide();
380
  $(tabSelector).show();
@@ -382,6 +435,92 @@ jQuery(document).ready(function($){
382
  $('.tutor-tabs-btn-group a').removeClass('active');
383
  $that.addClass('active');
384
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
 
386
 
387
  });
235
  attempt_settings = JSON.parse($tutor_quiz_time_update.attr('data-attempt-settings'));
236
  var attempt_meta = JSON.parse($tutor_quiz_time_update.attr('data-attempt-meta'));
237
 
238
+ var countDownDate = new Date(attempt_settings.attempt_started_at).getTime() + (attempt_meta.time_limit.time_limit_seconds * 1000);
239
  var time_now = new Date(attempt_meta.date_time_now).getTime();
240
 
241
  var tutor_quiz_interval = setInterval(function() {
266
  countdown_human = "EXPIRED";
267
  //Set the quiz attempt to timeout in ajax
268
 
269
+ if (_tutorobject.options.quiz_when_time_expires === 'autosubmit'){
270
+ /**
271
+ * Auto Submit
272
+ */
273
+ $('form#tutor-answering-quiz').submit();
274
+
275
+ } else if(_tutorobject.options.quiz_when_time_expires === 'autoabandon'){
276
+ /**
277
+ *
278
+ * @type {jQuery}
279
+ *
280
+ * Current attempt will be cancel with attempt status attempt_timeout
281
+ */
282
+
283
+ var quiz_id = $('#tutor_quiz_id').val();
284
+ var tutor_quiz_remaining_time_secs = $('#tutor_quiz_remaining_time_secs').val();
285
+ var quiz_timeout_data = { quiz_id : quiz_id, action : 'tutor_quiz_timeout' };
286
+
287
+ $.ajax({
288
+ url: _tutorobject.ajaxurl,
289
+ type: 'POST',
290
+ data: quiz_timeout_data,
291
+ success: function (data) {
292
+ if (data.success){
293
+ window.location.reload(true);
294
+ }
295
+ },
296
+ complete: function () {
297
+ $('#tutor-quiz-body').html('');
298
  window.location.reload(true);
299
  }
300
+ });
301
+
302
+ }
303
+
 
 
304
  }
305
  time_now = time_now + 1000;
306
  $tutor_quiz_time_update.html(countdown_human);
307
  }, 1000);
308
  }
309
 
310
+ var $quiz_start_form = $('#tutor-quiz-body form#tutor-start-quiz');
311
+ if ($quiz_start_form.length){
312
+ if (_tutorobject.quiz_options.quiz_auto_start === '1'){
313
+ $quiz_start_form.submit();
314
+ }
315
+ }
316
+
317
  // tutor course content accordion
318
  $('.tutor-course-topic.tutor-active').find('.tutor-course-lessons').slideDown();
319
  $('.tutor-course-title').on('click', function () {
361
 
362
  var $that = $(this);
363
  var lesson_id = $that.attr('data-lesson-id');
364
+ var $wrap = $('#tutor-single-entry-content');
365
 
366
  $.ajax({
367
  url: _tutorobject.ajaxurl,
385
  });
386
  });
387
 
388
+ $(document).on('click', '.sidebar-single-quiz-a', function (e) {
389
+ e.preventDefault();
390
+
391
+ var $that = $(this);
392
+ var quiz_id = $that.attr('data-quiz-id');
393
+ var page_title = $that.find('.lesson_title').text();
394
+ var $wrap = $('#tutor-single-entry-content');
395
+
396
+ $.ajax({
397
+ url: _tutorobject.ajaxurl,
398
+ type: 'POST',
399
+ data: {quiz_id : quiz_id, 'action': 'tutor_render_quiz_content'},
400
+ beforeSend: function () {
401
+ $('head title').text(page_title);
402
+ window.history.pushState('obj', page_title, $that.attr('href'));
403
+ $wrap.addClass('loading-lesson');
404
+ $('.tutor-single-lesson-items').removeClass('active');
405
+ $that.closest('.tutor-single-lesson-items').addClass('active');
406
+ },
407
+ success: function (data) {
408
+ $wrap.html(data.data.html);
409
+ },
410
+ complete: function () {
411
+ $wrap.removeClass('loading-lesson');
412
+ }
413
+ });
414
+
415
+
416
+ });
417
+
418
  /**
419
  * @date 05 Feb, 2019
420
  */
428
  e.preventDefault();
429
  var $that = $(this);
430
 
 
431
  var tabSelector = $that.attr('href');
432
  $('.tutor-lesson-sidebar-tab-item').hide();
433
  $(tabSelector).show();
435
  $('.tutor-tabs-btn-group a').removeClass('active');
436
  $that.addClass('active');
437
  });
438
+ /**
439
+ * @date 18 Feb, 2019
440
+ * @since v.1.0.0
441
+ */
442
+
443
+ if (jQuery().sortable) {
444
+ $(".tutor-quiz-answers-wrap").sortable({
445
+ handle: ".answer-sorting-bar",
446
+ start: function (e, ui) {
447
+ ui.placeholder.css('visibility', 'visible');
448
+ },
449
+ stop: function (e, ui) {
450
+
451
+ //Sorting Stopped...
452
+ },
453
+ }).disableSelection();;
454
+
455
+
456
+ $( ".quiz-draggable-rand-answers, .quiz-answer-matching-droppable" ).sortable({
457
+ connectWith: ".quiz-answer-matching-droppable",
458
+ placeholder: "drop-hover"
459
+
460
+ }).disableSelection();
461
+ }
462
+
463
+ /**
464
+ * Quiz view
465
+ * @date 22 Feb, 2019
466
+ * @since v.1.0.0
467
+ */
468
+
469
+ $(document).on('click', '.tutor-quiz-answer-next-btn', function (e) {
470
+ e.preventDefault();
471
+ var $that = $(this);
472
+ var question_id = parseInt($that.closest('.quiz-attempt-single-question').attr('id').match(/\d+/)[0], 10);
473
+
474
+ var next_question_id = $that.closest('.quiz-attempt-single-question').attr('data-next-question-id');
475
+
476
+ if (next_question_id) {
477
+ var $nextQuestion = $(next_question_id);
478
+ if ($nextQuestion && $nextQuestion.length) {
479
+ $('.quiz-attempt-single-question').hide();
480
+ $nextQuestion.show();
481
+
482
+ /**
483
+ * If pagination exists, set active class
484
+ */
485
+
486
+ if ($('.tutor-quiz-questions-pagination').length){
487
+ $('.tutor-quiz-question-paginate-item').removeClass('active');
488
+ $('.tutor-quiz-questions-pagination a[href="'+next_question_id+'"]').addClass('active');
489
+ }
490
+
491
+ }
492
+ }
493
+ });
494
+ $(document).on('click', '.tutor-quiz-question-paginate-item', function (e) {
495
+ e.preventDefault();
496
+ var $that = $(this);
497
+ var $question = $($that.attr('href'));
498
+ $('.quiz-attempt-single-question').hide();
499
+ $question.show();
500
+
501
+ //Active Class
502
+ $('.tutor-quiz-question-paginate-item').removeClass('active');
503
+ $that.addClass('active');
504
+ });
505
+
506
+ /**
507
+ * Limit Short Answer Question Type
508
+ */
509
+ $(document).on('keyup', 'textarea.question_type_short_answer', function (e) {
510
+ var $that = $(this);
511
+ var value = $that.val();
512
+ var limit = _tutorobject.quiz_options.short_answer_characters_limit;
513
+ var remaining = limit - value.length;
514
+
515
+ if (remaining < 1){
516
+ $that.val(value.substr(0, limit));
517
+ remaining = 0;
518
+ }
519
+ $that.closest('.tutor-quiz-answers-wrap').find('.characters_remaining').html(remaining);
520
+ });
521
+
522
+
523
+
524
 
525
 
526
  });
classes/Admin.php CHANGED
@@ -48,7 +48,7 @@ class Admin{
48
 
49
  add_submenu_page('tutor', __('Q & A', 'tutor'), __('Q & A '.$unanswered_bubble, 'tutor'), 'manage_tutor_instructor', 'question_answer', array($this, 'question_answer') );
50
 
51
- //add_submenu_page('tutor', __('Quiz Attempts', 'tutor'), __('Quiz Attempts', 'tutor'), 'manage_tutor_instructor', 'tutor_quiz_attempts',array($this, 'quiz_attempts') );
52
 
53
  //add_submenu_page('tutor', __('Add-ons', 'tutor'), __('Add-ons', 'tutor'), 'manage_tutor', 'tutor-addons', array(new Addons(),'addons_page') );
54
 
48
 
49
  add_submenu_page('tutor', __('Q & A', 'tutor'), __('Q & A '.$unanswered_bubble, 'tutor'), 'manage_tutor_instructor', 'question_answer', array($this, 'question_answer') );
50
 
51
+ add_submenu_page('tutor', __('Quiz Attempts', 'tutor'), __('Quiz Attempts', 'tutor'), 'manage_tutor_instructor', 'tutor_quiz_attempts',array($this, 'quiz_attempts') );
52
 
53
  //add_submenu_page('tutor', __('Add-ons', 'tutor'), __('Add-ons', 'tutor'), 'manage_tutor', 'tutor-addons', array(new Addons(),'addons_page') );
54
 
classes/Assets.php CHANGED
@@ -9,17 +9,11 @@ class Assets{
9
  public function __construct() {
10
  add_action('admin_enqueue_scripts', array($this, 'admin_scripts'));
11
  add_action('wp_enqueue_scripts', array($this, 'frontend_scripts'));
12
-
13
  add_action( 'admin_head', array($this, 'tutor_add_mce_button'));
14
-
15
-
16
-
17
  add_filter( 'get_the_generator_html', array($this, 'tutor_generator_tag'), 10, 2 );
18
  add_filter( 'get_the_generator_xhtml', array($this, 'tutor_generator_tag'), 10, 2 );
19
-
20
  }
21
 
22
-
23
  public function admin_scripts(){
24
  wp_enqueue_style('tutor-select2', tutor()->url.'assets/packages/select2/select2.min.css', array(), tutor()->version);
25
  wp_enqueue_style('tutor-admin', tutor()->url.'assets/css/tutor-admin.css', array(), tutor()->version);
@@ -44,15 +38,27 @@ class Assets{
44
  * Load frontend scripts
45
  */
46
  public function frontend_scripts(){
 
47
 
48
  wp_enqueue_editor();
49
 
 
50
  $localize_data = array(
51
- 'ajaxurl' => admin_url('admin-ajax.php'),
52
- 'nonce_key' => tutor()->nonce,
53
  tutor()->nonce => wp_create_nonce( tutor()->nonce_action ),
 
54
  );
55
 
 
 
 
 
 
 
 
 
 
56
 
57
  //Plyr
58
  wp_enqueue_style( 'tutor-plyr', tutor()->url . 'assets/packages/plyr/plyr.css', array(), tutor()->version );
@@ -70,6 +76,8 @@ class Assets{
70
  }
71
  }
72
 
 
 
73
  if (tutor_utils()->get_option('load_tutor_css')){
74
  wp_enqueue_style('tutor-frontend', tutor()->url.'assets/css/tutor-front.css', array(), tutor()->version);
75
  }
@@ -79,12 +87,10 @@ class Assets{
79
  }
80
  }
81
 
82
-
83
  /**
84
  * Add Tinymce button for placing shortcode
85
  */
86
  function tutor_add_mce_button() {
87
-
88
  // check user permissions
89
  if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
90
  return;
@@ -106,7 +112,6 @@ class Assets{
106
  return $buttons;
107
  }
108
 
109
-
110
  /**
111
  * Output generator tag to aid debugging.
112
  *
9
  public function __construct() {
10
  add_action('admin_enqueue_scripts', array($this, 'admin_scripts'));
11
  add_action('wp_enqueue_scripts', array($this, 'frontend_scripts'));
 
12
  add_action( 'admin_head', array($this, 'tutor_add_mce_button'));
 
 
 
13
  add_filter( 'get_the_generator_html', array($this, 'tutor_generator_tag'), 10, 2 );
14
  add_filter( 'get_the_generator_xhtml', array($this, 'tutor_generator_tag'), 10, 2 );
 
15
  }
16
 
 
17
  public function admin_scripts(){
18
  wp_enqueue_style('tutor-select2', tutor()->url.'assets/packages/select2/select2.min.css', array(), tutor()->version);
19
  wp_enqueue_style('tutor-admin', tutor()->url.'assets/css/tutor-admin.css', array(), tutor()->version);
38
  * Load frontend scripts
39
  */
40
  public function frontend_scripts(){
41
+ global $post;
42
 
43
  wp_enqueue_editor();
44
 
45
+ $options = tutor_utils()->get_option();
46
  $localize_data = array(
47
+ 'ajaxurl' => admin_url('admin-ajax.php'),
48
+ 'nonce_key' => tutor()->nonce,
49
  tutor()->nonce => wp_create_nonce( tutor()->nonce_action ),
50
+ 'options' => $options,
51
  );
52
 
53
+ if ( ! empty($post->post_type) && $post->post_type === 'tutor_quiz'){
54
+ $quiz_options = tutor_utils()->get_quiz_option($post->ID);
55
+ $localize_data['quiz_options'] = $quiz_options;
56
+ }
57
+
58
+ /**
59
+ * Enabling Sorting, draggable, droppable...
60
+ */
61
+ wp_enqueue_script('jquery-ui-sortable');
62
 
63
  //Plyr
64
  wp_enqueue_style( 'tutor-plyr', tutor()->url . 'assets/packages/plyr/plyr.css', array(), tutor()->version );
76
  }
77
  }
78
 
79
+ $localize_data = apply_filters('tutor_localize_data', $localize_data);
80
+
81
  if (tutor_utils()->get_option('load_tutor_css')){
82
  wp_enqueue_style('tutor-frontend', tutor()->url.'assets/css/tutor-front.css', array(), tutor()->version);
83
  }
87
  }
88
  }
89
 
 
90
  /**
91
  * Add Tinymce button for placing shortcode
92
  */
93
  function tutor_add_mce_button() {
 
94
  // check user permissions
95
  if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
96
  return;
112
  return $buttons;
113
  }
114
 
 
115
  /**
116
  * Output generator tag to aid debugging.
117
  *
classes/Course.php CHANGED
@@ -491,7 +491,6 @@ class Course extends Tutor_Base {
491
  }
492
  }
493
 
494
-
495
  wp_send_json_success(array('output' => $output));
496
  }
497
 
491
  }
492
  }
493
 
 
494
  wp_send_json_success(array('output' => $output));
495
  }
496
 
classes/Instructor.php CHANGED
@@ -18,7 +18,6 @@ class Instructor {
18
  add_action('template_redirect', array($this, 'apply_instructor'));
19
  }
20
 
21
-
22
  /**
23
  * Register new user and mark him as instructor
24
  *
18
  add_action('template_redirect', array($this, 'apply_instructor'));
19
  }
20
 
 
21
  /**
22
  * Register new user and mark him as instructor
23
  *
classes/Post_types.php CHANGED
@@ -14,8 +14,7 @@ class Post_types{
14
 
15
  add_action( 'init', array($this, 'register_course_post_types') );
16
  add_action( 'init', array($this, 'register_lesson_post_types') );
17
- //add_action( 'init', array($this, 'register_quiz_post_types') );
18
- //add_action( 'init', array($this, 'register_quiz_question_post_types') );
19
  }
20
 
21
  public function register_course_post_types() {
@@ -103,22 +102,22 @@ class Post_types{
103
  register_taxonomy( 'course-category', $this->course_post_type, $args );
104
 
105
  $labels = array(
106
- 'name' => _x( 'Tags', 'taxonomy general name', 'tutor' ),
107
- 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'tutor' ),
108
- 'search_items' => __( 'Search Tags', 'tutor' ),
109
- 'popular_items' => __( 'Popular Tags', 'tutor' ),
110
- 'all_items' => __( 'All Tags', 'tutor' ),
111
  'parent_item' => null,
112
  'parent_item_colon' => null,
113
- 'edit_item' => __( 'Edit Tag', 'tutor' ),
114
- 'update_item' => __( 'Update Tag', 'tutor' ),
115
- 'add_new_item' => __( 'Add New Tag', 'tutor' ),
116
- 'new_item_name' => __( 'New Tag Name', 'tutor' ),
117
- 'separate_items_with_commas' => __( 'Separate tags with commas', 'tutor' ),
118
- 'add_or_remove_items' => __( 'Add or remove tags', 'tutor' ),
119
- 'choose_from_most_used' => __( 'Choose from the most used tags', 'tutor' ),
120
- 'not_found' => __( 'No tags found.', 'tutor' ),
121
- 'menu_name' => __( 'Tags', 'tutor' ),
122
  );
123
 
124
  $args = array(
@@ -157,7 +156,7 @@ class Post_types{
157
  'description' => __( 'Description.', 'tutor' ),
158
  'public' => true,
159
  'publicly_queryable' => true,
160
- 'show_ui' => true,
161
  'show_in_menu' => 'tutor',
162
  'query_var' => true,
163
  'rewrite' => array( 'slug' => $this->lesson_post_type ),
@@ -206,7 +205,7 @@ class Post_types{
206
  'description' => __( 'Description.', 'tutor' ),
207
  'public' => true,
208
  'publicly_queryable' => true,
209
- 'show_ui' => true,
210
  'show_in_menu' => 'tutor',
211
  'query_var' => true,
212
  'rewrite' => array( 'slug' => $this->lesson_post_type ),
@@ -231,53 +230,5 @@ class Post_types{
231
 
232
  register_post_type( 'tutor_quiz', $args );
233
  }
234
-
235
- public function register_quiz_question_post_types() {
236
- $labels = array(
237
- 'name' => _x( 'Questions', 'post type general name', 'tutor' ),
238
- 'singular_name' => _x( 'Question', 'post type singular name', 'tutor' ),
239
- 'menu_name' => _x( 'Questions', 'admin menu', 'tutor' ),
240
- 'name_admin_bar' => _x( 'Question', 'add new on admin bar', 'tutor' ),
241
- 'add_new' => _x( 'Add New', $this->lesson_post_type, 'tutor' ),
242
- 'add_new_item' => __( 'Add New Question', 'tutor' ),
243
- 'new_item' => __( 'New Question', 'tutor' ),
244
- 'edit_item' => __( 'Edit Question', 'tutor' ),
245
- 'view_item' => __( 'View Question', 'tutor' ),
246
- 'all_items' => __( 'Questions', 'tutor' ),
247
- 'search_items' => __( 'Search Questions', 'tutor' ),
248
- 'parent_item_colon' => __( 'Parent Questions:', 'tutor' ),
249
- 'not_found' => __( 'No questions found.', 'tutor' ),
250
- 'not_found_in_trash' => __( 'No questions found in Trash.', 'tutor' )
251
- );
252
 
253
- $args = array(
254
- 'labels' => $labels,
255
- 'description' => __( 'Description.', 'tutor' ),
256
- 'public' => true,
257
- 'publicly_queryable' => true,
258
- 'show_ui' => true,
259
- 'show_in_menu' => 'tutor',
260
- 'query_var' => true,
261
- 'rewrite' => array( 'slug' => $this->lesson_post_type ),
262
- 'menu_icon' => 'dashicons-editor-help',
263
- 'capability_type' => 'post',
264
- 'has_archive' => true,
265
- 'hierarchical' => false,
266
- 'menu_position' => null,
267
- 'supports' => array( ''),
268
- 'capabilities' => array(
269
- 'edit_post' => 'edit_tutor_question',
270
- 'read_post' => 'read_tutor_question',
271
- 'delete_post' => 'delete_tutor_question',
272
- 'delete_posts' => 'delete_tutor_questions',
273
- 'edit_posts' => 'edit_tutor_questions',
274
- 'edit_others_posts' => 'edit_others_tutor_questions',
275
- 'publish_posts' => 'publish_tutor_questions',
276
- 'read_private_posts' => 'read_private_tutor_questions',
277
- 'create_posts' => 'edit_tutor_questions',
278
- ),
279
- );
280
-
281
- register_post_type( 'tutor_question', $args );
282
- }
283
  }
14
 
15
  add_action( 'init', array($this, 'register_course_post_types') );
16
  add_action( 'init', array($this, 'register_lesson_post_types') );
17
+ add_action( 'init', array($this, 'register_quiz_post_types') );
 
18
  }
19
 
20
  public function register_course_post_types() {
102
  register_taxonomy( 'course-category', $this->course_post_type, $args );
103
 
104
  $labels = array(
105
+ 'name' => _x( 'Skills', 'taxonomy general name', 'tutor' ),
106
+ 'singular_name' => _x( 'Skill', 'taxonomy singular name', 'tutor' ),
107
+ 'search_items' => __( 'Search Skills', 'tutor' ),
108
+ 'popular_items' => __( 'Popular Skills', 'tutor' ),
109
+ 'all_items' => __( 'All Skills', 'tutor' ),
110
  'parent_item' => null,
111
  'parent_item_colon' => null,
112
+ 'edit_item' => __( 'Edit Skill', 'tutor' ),
113
+ 'update_item' => __( 'Update Skill', 'tutor' ),
114
+ 'add_new_item' => __( 'Add New Skill', 'tutor' ),
115
+ 'new_item_name' => __( 'New Skill Name', 'tutor' ),
116
+ 'separate_items_with_commas' => __( 'Separate skills with commas', 'tutor' ),
117
+ 'add_or_remove_items' => __( 'Add or remove skills', 'tutor' ),
118
+ 'choose_from_most_used' => __( 'Choose from the most used skills', 'tutor' ),
119
+ 'not_found' => __( 'No skills found.', 'tutor' ),
120
+ 'menu_name' => __( 'Skills', 'tutor' ),
121
  );
122
 
123
  $args = array(
156
  'description' => __( 'Description.', 'tutor' ),
157
  'public' => true,
158
  'publicly_queryable' => true,
159
+ 'show_ui' => false,
160
  'show_in_menu' => 'tutor',
161
  'query_var' => true,
162
  'rewrite' => array( 'slug' => $this->lesson_post_type ),
205
  'description' => __( 'Description.', 'tutor' ),
206
  'public' => true,
207
  'publicly_queryable' => true,
208
+ 'show_ui' => false,
209
  'show_in_menu' => 'tutor',
210
  'query_var' => true,
211
  'rewrite' => array( 'slug' => $this->lesson_post_type ),
230
 
231
  register_post_type( 'tutor_quiz', $args );
232
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  }
classes/Q_and_A.php CHANGED
@@ -10,7 +10,6 @@ class Q_and_A{
10
  add_action('admin_post_tutor_place_answer', array($this, 'place_answer'));
11
  }
12
 
13
-
14
  public function place_answer(){
15
  tutor_utils()->checking_nonce();
16
 
@@ -39,7 +38,6 @@ class Q_and_A{
39
  'user_id' => $user_id,
40
  ));
41
 
42
-
43
  $wpdb->insert($wpdb->comments, $data);
44
  $answer_id = (int) $wpdb->insert_id;
45
 
10
  add_action('admin_post_tutor_place_answer', array($this, 'place_answer'));
11
  }
12
 
 
13
  public function place_answer(){
14
  tutor_utils()->checking_nonce();
15
 
38
  'user_id' => $user_id,
39
  ));
40
 
 
41
  $wpdb->insert($wpdb->comments, $data);
42
  $answer_id = (int) $wpdb->insert_id;
43
 
classes/Question.php CHANGED
@@ -19,10 +19,8 @@ class Question {
19
  add_action('wp_ajax_quiz_question_delete', array($this, 'quiz_question_delete'));
20
  add_action('wp_ajax_sorting_quiz_questions', array($this, 'sorting_quiz_questions'));
21
 
22
-
23
  add_filter( "manage_tutor_question_posts_columns", array($this, 'add_column'), 10,1 );
24
  add_action( "manage_tutor_question_posts_custom_column" , array($this, 'custom_question_column'), 10, 2 );
25
-
26
  }
27
 
28
  public function register_meta_box(){
19
  add_action('wp_ajax_quiz_question_delete', array($this, 'quiz_question_delete'));
20
  add_action('wp_ajax_sorting_quiz_questions', array($this, 'sorting_quiz_questions'));
21
 
 
22
  add_filter( "manage_tutor_question_posts_columns", array($this, 'add_column'), 10,1 );
23
  add_action( "manage_tutor_question_posts_custom_column" , array($this, 'custom_question_column'), 10, 2 );
 
24
  }
25
 
26
  public function register_meta_box(){
classes/Quiz.php CHANGED
@@ -23,7 +23,10 @@ class Quiz {
23
  add_action( 'add_meta_boxes', array($this, 'register_meta_box') );
24
  add_action('save_post_tutor_quiz', array($this, 'save_quiz_meta'));
25
 
 
26
  add_action('wp_ajax_tutor_load_quiz_modal', array($this, 'tutor_load_quiz_modal'));
 
 
27
  add_action('wp_ajax_tutor_add_quiz_to_post', array($this, 'tutor_add_quiz_to_post'));
28
  add_action('wp_ajax_remove_quiz_from_post', array($this, 'remove_quiz_from_post'));
29
 
@@ -35,9 +38,37 @@ class Quiz {
35
  add_action('template_redirect', array($this, 'finishing_quiz_attempt'));
36
 
37
  add_action('admin_action_review_quiz_answer', array($this, 'review_quiz_answer'));
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
 
 
 
 
 
 
 
 
41
 
42
  public function add_column($columns){
43
  $date_col = $columns['date'];
@@ -52,18 +83,17 @@ class Quiz {
52
  public function custom_question_column($column, $post_id ){
53
  if ($column === 'quiz'){
54
  $quiz = tutor_utils()->get_course_by_quiz($post_id);
55
-
56
  if ($quiz){
57
- echo '<a href="'.admin_url('post.php?post='.$quiz->ID.'&action=edit').'">'.get_the_title($quiz->ID).'</a>';
58
  }
59
  }
60
 
61
  if ($column === 'questions'){
62
- echo tutor_utils()->total_questions_for_student_by_quiz($post_id);
63
  }
64
  }
65
 
66
-
67
  public function register_meta_box(){
68
  add_meta_box( 'tutor-quiz-questions', __( 'Questions', 'tutor' ), array($this, 'quiz_questions'), 'tutor_quiz' );
69
  add_meta_box( 'tutor-quiz-settings', __( 'Settings', 'tutor' ), array($this, 'quiz_settings'), 'tutor_quiz' );
@@ -84,6 +114,10 @@ class Quiz {
84
  }
85
  }
86
 
 
 
 
 
87
  public function tutor_load_quiz_modal(){
88
  $quiz_for_post_id = (int) sanitize_text_field($_POST['quiz_for_post_id']);
89
 
@@ -102,11 +136,11 @@ class Quiz {
102
  }
103
 
104
  ob_start();
105
- ?>
106
  <div class="tutor-option-field-row">
107
  <div class="tutor-option-field-label">
108
  <label for="">
109
- <?php _e('New quiz title', 'tutor'); ?>
110
  </label>
111
  </div>
112
  <div class="tutor-option-field">
@@ -115,12 +149,24 @@ class Quiz {
115
  </div>
116
  </div>
117
 
118
- <?php
119
  $output .= ob_get_clean();
120
 
121
  wp_send_json_success(array('output' => $output));
122
  }
123
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  public function tutor_add_quiz_to_post(){
125
  global $wpdb;
126
 
@@ -142,8 +188,8 @@ class Quiz {
142
  wp_insert_post(array(
143
  'post_parent' => $post_id,
144
  'post_title' => $quiz_title,
145
- 'post_type' => 'tutor_quiz',
146
- 'post_status' => 'publish',
147
  ));
148
  }
149
 
@@ -153,15 +199,15 @@ class Quiz {
153
  if ( $attached_quizzes ) {
154
  foreach ( $attached_quizzes as $attached_quiz ) {
155
  ?>
156
- <div id="added-quiz-id-<?php echo $attached_quiz->ID; ?>" class="added-quiz-item added-quiz-item-<?php echo $attached_quiz->ID; ?>" data-quiz-id="<?php echo $attached_quiz->ID; ?>">
157
- <span class="quiz-icon"><i class="dashicons dashicons-clock"></i></span>
158
- <span class="quiz-name">
159
  <?php edit_post_link( $attached_quiz->post_title, null, null, $attached_quiz->ID ); ?>
160
  </span>
161
- <span class="quiz-control">
162
  <a href="javascript:;" class="tutor-quiz-delete-btn"><i class="dashicons dashicons-trash"></i></a>
163
  </span>
164
- </div>
165
  <?php
166
  }
167
  }
@@ -178,6 +224,13 @@ class Quiz {
178
  wp_send_json_success();
179
  }
180
 
 
 
 
 
 
 
 
181
  public function start_the_quiz(){
182
  if ( ! isset($_POST['tutor_action']) || $_POST['tutor_action'] !== 'tutor_start_quiz' ){
183
  return;
@@ -196,27 +249,13 @@ class Quiz {
196
  $user = get_userdata($user_id);
197
 
198
  $quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
 
199
  $quiz = get_post($quiz_id);
200
  $date = date("Y-m-d H:i:s");
201
 
 
202
  $attempts_allowed = tutor_utils()->get_quiz_option($quiz_id, 'attempts_allowed', 0);
203
 
204
- do_action('tutor_before_start_quiz', $quiz_id);
205
- $data = array(
206
- 'comment_post_ID' => $quiz_id, //QuizID
207
- 'comment_author' => $user->user_login,
208
- 'comment_date' => $date,
209
- 'comment_date_gmt' => get_gmt_from_date($date),
210
- 'comment_approved' => 'quiz_started', //quiz_timeup, quiz_complete
211
- 'comment_agent' => 'TutorLMSPlugin',
212
- 'comment_type' => 'tutor_quiz_attempt',
213
- 'comment_parent' => $quiz->post_parent, //Quiz Parent Attached Course || Lesson || Topic
214
- 'user_id' => $user_id,
215
- );
216
-
217
- $wpdb->insert($wpdb->comments, $data);
218
- $attempt_id = (int) $wpdb->insert_id;
219
-
220
  $time_limit = tutor_utils()->get_quiz_option($quiz_id, 'time_limit.time_value');
221
  $time_limit_seconds = 0;
222
  $time_type = 'seconds';
@@ -224,9 +263,9 @@ class Quiz {
224
  $time_type = tutor_utils()->get_quiz_option($quiz_id, 'time_limit.time_type');
225
 
226
  switch ($time_type){
227
- case 'seconds':
228
- $time_limit_seconds = $time_limit;
229
- break;
230
  case 'minutes':
231
  $time_limit_seconds = $time_limit * 60;
232
  break;
@@ -243,278 +282,762 @@ class Quiz {
243
  }
244
 
245
  $max_question_allowed = tutor_utils()->max_questions_for_take_quiz($quiz_id);
246
- $quiz_attempt_info = array(
247
- 'time_limit' => $time_limit,
248
- 'time_type' => $time_type,
249
- 'time_limit_seconds' => $time_limit_seconds,
250
- 'total_question' => $max_question_allowed,
251
- 'answered_question' => 0,
252
- 'current_question' => 0,
253
- 'marks_earned' => 0,
254
- 'answers' => array(),
 
 
255
  );
256
 
257
- //answers format
258
- /*
259
- array(
260
- '0' => array( 'questionID' => 344, 'has_correct' => 1, //or 0 for false, 'questionSiNo' => 1
261
- 'answers_list' => array(
262
- 'answers_id' => array('selected_answerId_1', 'selected_answerId_2', 'or_line_answer_text')
263
- )
264
- ),
265
-
266
- '1' => array( 'questionID' => 654, 'has_correct' => 0, //or 0 for false, 'questionSiNo' => 2
267
- 'answers_list' => array(
268
- 'answers_id' => array('selected_answerId_1', 'selected_answerId_2', 'or_line_answer_text')
269
- )
270
- ),
271
- );
272
- */
273
-
274
- update_comment_meta($attempt_id, 'quiz_attempt_info', $quiz_attempt_info);
275
- update_comment_meta($attempt_id, 'earned_mark_percent', '0');
276
-
277
- do_action('tutor_after_start_quiz', $quiz_id, $attempt_id);
278
 
279
  wp_redirect(tutor_utils()->input_old('_wp_http_referer'));
280
  die();
281
- }
282
 
 
 
 
 
 
 
283
 
284
- public function answering_quiz(){
285
- if ( ! isset($_POST['tutor_action']) || $_POST['tutor_action'] !== 'tutor_answering_quiz_question' ){
286
- return;
287
- }
288
- //Checking nonce
289
- tutor_utils()->checking_nonce();
290
 
291
- if ( ! is_user_logged_in()){
292
- die('Please sign in to do this operation');
293
- }
294
 
295
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
- $user_id = get_current_user_id();
298
- $attempt_id = (int) sanitize_text_field(tutor_utils()->avalue_dot('attempt_id', $_POST));
299
- $post_question_id = (int) sanitize_text_field(tutor_utils()->avalue_dot('quiz_question_id', $_POST));
300
- $attempt = tutor_utils()->get_attempt($attempt_id);
301
 
302
- if ( ! $attempt || $user_id != $attempt->user_id){
303
- die('Operation not allowed, attempt not found or permission denied');
304
- }
 
 
305
 
306
- $attempt_info = tutor_utils()->quiz_attempt_info($attempt_id);
307
- $given_answers = tutor_utils()->avalue_dot("attempt.{$attempt_id}.quiz_question.{$post_question_id}", $_POST);
308
 
309
- $plus_mark = 0;
310
- $minus_mark = 0;
311
- $is_answer_corrected = false;
312
 
313
- $answers = array(
314
- 'questionID' => $post_question_id,
315
- );
316
 
317
- $question_type = get_post_meta($post_question_id, '_question_type', true);
318
- $question_mark = get_post_meta($post_question_id, '_question_mark', true);
319
 
320
- if ($given_answers){
321
- $answers['status'] = 'answered'; //or 0 for false, 'questionSiNo' => 2
322
- $answers['has_correct'] = 0;
 
 
323
 
324
- $saved_answers = tutor_utils()->get_quiz_answer_options_by_question($post_question_id);
325
- $corrects_answer_ids = array();
326
- if (is_array($saved_answers) && count($saved_answers)){
327
- foreach ($saved_answers as $saved_answer){
328
- $saved_answer_info = json_decode($saved_answer->comment_content);
329
 
330
- if ( ! empty($saved_answer_info->is_correct) && $saved_answer_info->is_correct){
331
- $corrects_answer_ids[] = $saved_answer->comment_ID;
332
- }
333
- }
334
- }
335
 
336
- if ($question_type === 'multiple_choice'){
337
- $given_answers = (array) $given_answers;
338
- }
339
-
340
- //TODO: need to provide support for question type more if we add
341
- //Checking if all answer corrects
342
- if ($question_type === 'true_false' || $question_type === 'multiple_choice' || $question_type === 'single_choice'){
343
- if ($question_type === 'multiple_choice') {
344
- $is_answer_corrected = count(array_intersect($given_answers, $corrects_answer_ids)) == count($given_answers);
345
- }else{
346
- $is_answer_corrected = in_array($given_answers, $corrects_answer_ids);
347
- }
348
- }
349
 
350
- if ($is_answer_corrected){
351
- $plus_mark = $question_mark;
352
- $answers['has_correct'] = 1;
353
- }else{
354
- //TODO: Do operation for incorrect answer
355
- }
356
 
357
- $answers['plus_mark'] = $plus_mark;
358
- $answers['minus_mark'] = $minus_mark;
359
 
360
- $answers['answers_list'] = array(
361
- 'answer_type' => $question_type,
362
- 'answer_ids' => $given_answers
363
- );
364
- }else{
365
- //If not answered, that means users skipped the questions
366
- $answers = array(
367
- 'questionID' => $post_question_id, 'status' => 'skipped', 'has_correct' => 0, //or 0 for false, 'questionSiNo' => 2
368
- 'plus_mark' => 0,
369
- 'minus_mark' => 0,
370
- 'answers_list' => array()
371
- );
372
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
373
 
374
- $answers['question_mark'] = $question_mark;
375
-
376
- if ($is_answer_corrected){
377
- if (isset($attempt_info['marks_earned'])){
378
- //If not found
379
- $attempt_info['marks_earned'] = $attempt_info['marks_earned'] + $plus_mark;
380
- }else{
381
- $attempt_info['marks_earned'] = $plus_mark;
382
- }
383
- }else{
384
- if ( ! isset($attempt_info['marks_earned'])){
385
- $attempt_info['marks_earned'] = 0;
386
- }
387
-
388
- //Todo: mark minus if necessary
 
 
 
 
 
 
 
 
 
 
 
 
389
  }
390
 
391
- $attempt_info['answers'][] = $answers;
392
- tutor_utils()->quiz_update_attempt_info($attempt_id, $attempt_info);
 
393
 
394
- wp_redirect(tutor_utils()->input_old('_wp_http_referer'));
395
- die();
396
- }
397
 
398
  /**
399
  * Quiz attempt will be finish here
400
- *
401
  */
402
 
403
- public function finishing_quiz_attempt(){
404
- if ( ! isset($_POST['tutor_action']) || $_POST['tutor_action'] !== 'tutor_finish_quiz_attempt' ){
405
- return;
406
- }
407
- //Checking nonce
408
- tutor_utils()->checking_nonce();
409
 
410
- if ( ! is_user_logged_in()){
411
- die('Please sign in to do this operation');
412
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
 
 
415
  global $wpdb;
416
 
417
- $quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
 
 
418
 
419
- $is_started_quiz = tutor_utils()->is_started_quiz($quiz_id);
420
- $attempt_id = $is_started_quiz->comment_ID;
421
 
422
- if ($is_started_quiz) {
423
- do_action('tutor_quiz_finished_before', $attempt_id);
424
 
425
- $quiz_attempt_info = tutor_utils()->quiz_attempt_info( $attempt_id );
426
- $answers = tutor_utils()->avalue_dot('answers', $quiz_attempt_info);
427
 
428
- $total_marks = 0;
429
- if (is_array($answers)){
430
- $total_marks = array_sum(wp_list_pluck($answers, 'question_mark'));
431
- }
 
432
 
433
- $quiz_attempt_info['total_marks'] = $total_marks;
434
- $pass_mark_percent = tutor_utils()->get_quiz_option($quiz_id,'passing_grade');
435
- $quiz_attempt_info['pass_mark_percent'] = $pass_mark_percent;
436
- $quiz_attempt_info['submission_time'] = time();
 
437
 
438
- //Updating Attempt Info
439
- tutor_utils()->quiz_update_attempt_info($attempt_id, $quiz_attempt_info);
440
 
441
- $wpdb->update($wpdb->comments, array('comment_approved' => 'quiz_finished'), array('comment_ID' => $attempt_id));
442
 
443
- do_action('tutor_quiz_finished_after', $attempt_id);
444
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
445
 
446
- wp_redirect(tutor_utils()->input_old('_wp_http_referer'));
447
- die();
448
- }
449
 
450
  /**
451
- * Quiz timeout by ajax
452
  */
453
- public function tutor_quiz_timeout(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
  global $wpdb;
455
 
456
  $quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
 
458
- $is_started_quiz = tutor_utils()->is_started_quiz($quiz_id);
459
- $attempt_id = $is_started_quiz->comment_ID;
460
 
461
- if ($is_started_quiz) {
462
- $quiz_attempt_info = tutor_utils()->quiz_attempt_info( $attempt_id );
463
- $answers = tutor_utils()->avalue_dot('answers', $quiz_attempt_info);
 
 
 
 
 
 
 
464
 
465
- $total_marks = 0;
466
- if (is_array($answers)){
467
- $total_marks = array_sum(wp_list_pluck($answers, 'question_mark'));
468
- }
469
 
470
- $quiz_attempt_info['total_marks'] = $total_marks;
471
- $pass_mark_percent = tutor_utils()->get_quiz_option($quiz_id,'passing_grade');
472
- $quiz_attempt_info['pass_mark_percent'] = $pass_mark_percent;
473
 
474
- //Updating Attempt Info
475
- tutor_utils()->quiz_update_attempt_info($attempt_id, $quiz_attempt_info);
 
 
 
 
 
 
 
 
476
 
477
- $wpdb->update($wpdb->comments, array('comment_approved' => 'quiz_timeout'), array('comment_ID' => $attempt_id));
478
- wp_send_json_success();
479
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
 
481
- wp_send_json_error(__('Quiz has been timeout already', 'tutor'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
  }
483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
484
  /**
485
- * Review the answer and change individual answer result
 
 
486
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
 
488
- public function review_quiz_answer(){
489
- $attempt_id = (int) sanitize_text_field($_GET['attempt_id']);
490
- $answer_index = (int) sanitize_text_field($_GET['answer_index']);
491
- $mark_as = sanitize_text_field($_GET['mark_as']);
492
 
493
- $attempt_info = tutor_utils()->quiz_attempt_info($attempt_id);
 
 
 
494
 
495
- $previous_answer = $attempt_info['answers'][$answer_index];
496
- $previous_correct = tutor_utils()->avalue_dot('has_correct', $previous_answer);
497
 
498
- if ($mark_as === 'correct' && ! $previous_correct ){
499
- $previous_answer['has_correct'] = 1;
500
- $previous_answer['plus_mark'] = $previous_answer['question_mark'];
501
- $previous_answer['minus_mark'] = 0;
502
- $attempt_info['marks_earned'] = $attempt_info['marks_earned'] + $previous_answer['question_mark'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
 
504
- }elseif($mark_as === 'incorrect' && $previous_correct){
505
- $previous_answer['has_correct'] = 0;
506
- $previous_answer['plus_mark'] = 0;
507
- $previous_answer['minus_mark'] = 0;
508
- $attempt_info['marks_earned'] = $attempt_info['marks_earned'] - $previous_answer['question_mark'];
 
 
509
  }
510
 
511
- $attempt_info['answers'][$answer_index] = $previous_answer;
512
- $attempt_info['manual_reviewed'] = time();
 
 
 
 
 
 
513
 
514
- tutor_utils()->quiz_update_attempt_info($attempt_id, $attempt_info);
 
515
 
516
- wp_redirect(admin_url("admin.php?page=tutor_quiz_attempts&sub_page=view_attempt&attempt_id=".$attempt_id));
517
- die();
 
 
 
518
  }
519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  }
23
  add_action( 'add_meta_boxes', array($this, 'register_meta_box') );
24
  add_action('save_post_tutor_quiz', array($this, 'save_quiz_meta'));
25
 
26
+ //Depricated at alpha version
27
  add_action('wp_ajax_tutor_load_quiz_modal', array($this, 'tutor_load_quiz_modal'));
28
+
29
+ add_action('wp_ajax_tutor_load_quiz_builder_modal', array($this, 'tutor_load_quiz_builder_modal'));
30
  add_action('wp_ajax_tutor_add_quiz_to_post', array($this, 'tutor_add_quiz_to_post'));
31
  add_action('wp_ajax_remove_quiz_from_post', array($this, 'remove_quiz_from_post'));
32
 
38
  add_action('template_redirect', array($this, 'finishing_quiz_attempt'));
39
 
40
  add_action('admin_action_review_quiz_answer', array($this, 'review_quiz_answer'));
41
+
42
+ /**
43
+ * New Design Quiz
44
+ */
45
+
46
+ add_action('wp_ajax_tutor_create_quiz_and_load_modal', array($this, 'tutor_create_quiz_and_load_modal'));
47
+ add_action('wp_ajax_tutor_delete_quiz_by_id', array($this, 'tutor_delete_quiz_by_id'));
48
+ add_action('wp_ajax_tutor_quiz_builder_quiz_update', array($this, 'tutor_quiz_builder_quiz_update'));
49
+ add_action('wp_ajax_tutor_load_edit_quiz_modal', array($this, 'tutor_load_edit_quiz_modal'));
50
+ add_action('wp_ajax_tutor_quiz_builder_get_question_form', array($this, 'tutor_quiz_builder_get_question_form'));
51
+ add_action('wp_ajax_tutor_quiz_modal_update_question', array($this, 'tutor_quiz_modal_update_question'));
52
+ add_action('wp_ajax_tutor_quiz_builder_question_delete', array($this, 'tutor_quiz_builder_question_delete'));
53
+ add_action('wp_ajax_tutor_quiz_add_question_answers', array($this, 'tutor_quiz_add_question_answers'));
54
+ add_action('wp_ajax_tutor_quiz_edit_question_answer', array($this, 'tutor_quiz_edit_question_answer'));
55
+ add_action('wp_ajax_tutor_save_quiz_answer_options', array($this, 'tutor_save_quiz_answer_options'));
56
+ add_action('wp_ajax_tutor_update_quiz_answer_options', array($this, 'tutor_update_quiz_answer_options'));
57
+ add_action('wp_ajax_tutor_quiz_builder_get_answers_by_question', array($this, 'tutor_quiz_builder_get_answers_by_question'));
58
+ add_action('wp_ajax_tutor_quiz_builder_delete_answer', array($this, 'tutor_quiz_builder_delete_answer'));
59
+ add_action('wp_ajax_tutor_quiz_answer_sorting', array($this, 'tutor_quiz_answer_sorting'));
60
+ add_action('wp_ajax_tutor_mark_answer_as_correct', array($this, 'tutor_mark_answer_as_correct'));
61
+ add_action('wp_ajax_tutor_quiz_modal_update_settings', array($this, 'tutor_quiz_modal_update_settings'));
62
+
63
 
64
 
65
+ /**
66
+ * Frontend Stuff
67
+ */
68
+
69
+ add_action('wp_ajax_tutor_render_quiz_content', array($this, 'tutor_render_quiz_content'));
70
+
71
+ }
72
 
73
  public function add_column($columns){
74
  $date_col = $columns['date'];
83
  public function custom_question_column($column, $post_id ){
84
  if ($column === 'quiz'){
85
  $quiz = tutor_utils()->get_course_by_quiz($post_id);
86
+
87
  if ($quiz){
88
+ echo '<a href="'.admin_url('post.php?post='.$quiz->ID.'&action=edit').'">'.get_the_title($quiz->ID).'</a>';
89
  }
90
  }
91
 
92
  if ($column === 'questions'){
93
+ echo tutor_utils()->total_questions_for_student_by_quiz($post_id);
94
  }
95
  }
96
 
 
97
  public function register_meta_box(){
98
  add_meta_box( 'tutor-quiz-questions', __( 'Questions', 'tutor' ), array($this, 'quiz_questions'), 'tutor_quiz' );
99
  add_meta_box( 'tutor-quiz-settings', __( 'Settings', 'tutor' ), array($this, 'quiz_settings'), 'tutor_quiz' );
114
  }
115
  }
116
 
117
+ /**
118
+ * @depricated at alpha version
119
+ * Check tutor_load_quiz_builder_modal instead of this method
120
+ */
121
  public function tutor_load_quiz_modal(){
122
  $quiz_for_post_id = (int) sanitize_text_field($_POST['quiz_for_post_id']);
123
 
136
  }
137
 
138
  ob_start();
139
+ ?>
140
  <div class="tutor-option-field-row">
141
  <div class="tutor-option-field-label">
142
  <label for="">
143
+ <?php _e('New quiz title', 'tutor'); ?>
144
  </label>
145
  </div>
146
  <div class="tutor-option-field">
149
  </div>
150
  </div>
151
 
152
+ <?php
153
  $output .= ob_get_clean();
154
 
155
  wp_send_json_success(array('output' => $output));
156
  }
157
 
158
+ /**
159
+ * Tutor Quiz Builder Modal
160
+ */
161
+ public function tutor_load_quiz_builder_modal(){
162
+ ob_start();
163
+ include tutor()->path.'views/modal/add_quiz.php';
164
+ $output = ob_get_clean();
165
+
166
+ wp_send_json_success(array('output' => $output));
167
+
168
+ }
169
+
170
  public function tutor_add_quiz_to_post(){
171
  global $wpdb;
172
 
188
  wp_insert_post(array(
189
  'post_parent' => $post_id,
190
  'post_title' => $quiz_title,
191
+ 'post_type' => 'tutor_quiz',
192
+ 'post_status' => 'publish',
193
  ));
194
  }
195
 
199
  if ( $attached_quizzes ) {
200
  foreach ( $attached_quizzes as $attached_quiz ) {
201
  ?>
202
+ <div id="added-quiz-id-<?php echo $attached_quiz->ID; ?>" class="added-quiz-item added-quiz-item-<?php echo $attached_quiz->ID; ?>" data-quiz-id="<?php echo $attached_quiz->ID; ?>">
203
+ <span class="quiz-icon"><i class="dashicons dashicons-clock"></i></span>
204
+ <span class="quiz-name">
205
  <?php edit_post_link( $attached_quiz->post_title, null, null, $attached_quiz->ID ); ?>
206
  </span>
207
+ <span class="quiz-control">
208
  <a href="javascript:;" class="tutor-quiz-delete-btn"><i class="dashicons dashicons-trash"></i></a>
209
  </span>
210
+ </div>
211
  <?php
212
  }
213
  }
224
  wp_send_json_success();
225
  }
226
 
227
+ /**
228
+ *
229
+ * Start Quiz from here...
230
+ *
231
+ * @since v.1.0.0
232
+ */
233
+
234
  public function start_the_quiz(){
235
  if ( ! isset($_POST['tutor_action']) || $_POST['tutor_action'] !== 'tutor_start_quiz' ){
236
  return;
249
  $user = get_userdata($user_id);
250
 
251
  $quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
252
+
253
  $quiz = get_post($quiz_id);
254
  $date = date("Y-m-d H:i:s");
255
 
256
+ $tutor_quiz_option = maybe_unserialize(get_post_meta($quiz_id, 'tutor_quiz_option', true));
257
  $attempts_allowed = tutor_utils()->get_quiz_option($quiz_id, 'attempts_allowed', 0);
258
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  $time_limit = tutor_utils()->get_quiz_option($quiz_id, 'time_limit.time_value');
260
  $time_limit_seconds = 0;
261
  $time_type = 'seconds';
263
  $time_type = tutor_utils()->get_quiz_option($quiz_id, 'time_limit.time_type');
264
 
265
  switch ($time_type){
266
+ case 'seconds':
267
+ $time_limit_seconds = $time_limit;
268
+ break;
269
  case 'minutes':
270
  $time_limit_seconds = $time_limit * 60;
271
  break;
282
  }
283
 
284
  $max_question_allowed = tutor_utils()->max_questions_for_take_quiz($quiz_id);
285
+ $tutor_quiz_option['time_limit']['time_limit_seconds'] = $time_limit_seconds;
286
+
287
+ $attempt_data = array(
288
+ 'quiz_id' => $quiz_id,
289
+ 'user_id' => $user_id,
290
+ 'total_questions' => $max_question_allowed,
291
+ 'total_answered_questions' => 0,
292
+ 'attempt_info' => maybe_serialize($tutor_quiz_option),
293
+ 'attempt_status' => 'attempt_started',
294
+ 'attempt_ip' => tutor_utils()->get_ip(),
295
+ 'attempt_started_at' => $date,
296
  );
297
 
298
+ $wpdb->insert($wpdb->prefix.'tutor_quiz_attempts', $attempt_data);
299
+ $attempt_id = (int) $wpdb->insert_id;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
 
301
  wp_redirect(tutor_utils()->input_old('_wp_http_referer'));
302
  die();
303
+ }
304
 
305
+ public function answering_quiz(){
306
+ if ( ! isset($_POST['tutor_action']) || $_POST['tutor_action'] !== 'tutor_answering_quiz_question' ){
307
+ return;
308
+ }
309
+ //Checking nonce
310
+ tutor_utils()->checking_nonce();
311
 
312
+ $attempt_answers = isset($_POST['attempt']) ? $_POST['attempt'] : false;
313
+ if ( ! is_user_logged_in()){
314
+ die('Please sign in to do this operation');
315
+ }
 
 
316
 
317
+ global $wpdb;
318
+ $user_id = get_current_user_id();
 
319
 
320
+ if ($attempt_answers && is_array($attempt_answers) && count($attempt_answers)){
321
+ foreach ($attempt_answers as $attempt_id => $attempt_answers){
322
+ $attempt = tutor_utils()->get_attempt($attempt_id);
323
+
324
+ /**
325
+ * Get total marks of all question comes
326
+ */
327
+ $question_ids = tutor_utils()->avalue_dot('quiz_question_ids', $attempt_answers);
328
+ if (is_array($question_ids) && count($question_ids)){
329
+ $question_ids_string = "'".implode("','", $question_ids)."'";
330
+ $total_question_marks = $wpdb->get_var("SELECT SUM(question_mark) FROM {$wpdb->prefix}tutor_quiz_questions WHERE question_id IN({$question_ids_string}) ;");
331
+ $wpdb->update($wpdb->prefix.'tutor_quiz_attempts', array('total_marks' =>$total_question_marks ), array('attempt_id' => $attempt_id ));
332
+ }
333
 
334
+ if ( ! $attempt || $user_id != $attempt->user_id){
335
+ die('Operation not allowed, attempt not found or permission denied');
336
+ }
 
337
 
338
+ $quiz_answers = tutor_utils()->avalue_dot('quiz_question', $attempt_answers);
339
+ $total_marks = 0;
340
+ foreach ($quiz_answers as $question_id => $answers){
341
+ $question = tutor_utils()->get_quiz_question_by_id($question_id);
342
+ $question_type = $question->question_type;
343
 
344
+ $is_answer_was_correct = false;
345
+ $given_answer = '';
346
 
347
+ if ($question_type === 'true_false' || $question_type === 'single_choice'){
 
 
348
 
349
+ $given_answer = $answers;
350
+ $is_answer_was_correct = (bool) $wpdb->get_var("SELECT is_correct FROM {$wpdb->prefix}tutor_quiz_question_answers WHERE answer_id = {$answers} ");
 
351
 
352
+ }elseif ($question_type === 'multiple_choice'){
 
353
 
354
+ $given_answer = maybe_serialize($answers);
355
+ $get_original_answers = (array) $wpdb->get_col("SELECT answer_id FROM {$wpdb->prefix}tutor_quiz_question_answers WHERE belongs_question_id = {$question->question_id} AND belongs_question_type = '{$question_type}' AND is_correct = 1 ;");
356
+ if (maybe_serialize($get_original_answers) == $given_answer){
357
+ $is_answer_was_correct = true;
358
+ }
359
 
360
+ }elseif ($question_type === 'fill_in_the_blank'){
 
 
 
 
361
 
362
+ $given_answer = (array) array_map('sanitize_text_field', $answers);
363
+ $given_answer = maybe_serialize($given_answer);
 
 
 
364
 
365
+ $get_original_answer = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_question_answers WHERE belongs_question_id = {$question->question_id} AND belongs_question_type = '{$question_type}' ;");
366
+ $gap_answer = (array) explode('|', $get_original_answer->answer_two_gap_match);
 
 
 
 
 
 
 
 
 
 
 
367
 
368
+ $gap_answer = array_map('sanitize_text_field', $gap_answer);
369
+ if ($given_answer == maybe_serialize($gap_answer)){
370
+ $is_answer_was_correct = true;
371
+ }
 
 
372
 
373
+ }elseif ($question_type === 'open_ended' || $question_type === 'short_answer'){
 
374
 
375
+ $given_answer = wp_kses_post($answers);
376
+
377
+ }elseif ($question_type === 'ordering' || $question_type === 'matching'|| $question_type === 'image_matching' ){
378
+
379
+ $given_answer = (array) array_map('sanitize_text_field', tutor_utils()->avalue_dot('answers', $answers));
380
+ $given_answer = maybe_serialize($given_answer);
381
+
382
+ $get_original_answers = (array) $wpdb->get_col("SELECT answer_id FROM {$wpdb->prefix}tutor_quiz_question_answers WHERE belongs_question_id = {$question->question_id} AND belongs_question_type = '{$question_type}' ORDER BY answer_order ASC ;");
383
+ $get_original_answers = array_map('sanitize_text_field', $get_original_answers);
384
+
385
+ if ($given_answer == maybe_serialize($get_original_answers)){
386
+ $is_answer_was_correct = true;
387
+ }
388
+
389
+ }elseif ($question_type === 'image_answering'){
390
+ $image_inputs = tutor_utils()->avalue_dot('answer_id', $answers);
391
+ $given_answer = maybe_serialize($image_inputs);
392
+
393
+ $is_answer_was_correct = false;
394
+
395
+ if (is_array($image_inputs) && count($image_inputs)){
396
+ foreach ($image_inputs as $answer_id => $answer){
397
+ $db_answer = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_question_answers WHERE answer_id = {$answer_id} ;");
398
+
399
+ $is_answer_was_correct = sanitize_text_field($answer) == $db_answer->answer_title;
400
+ }
401
+ }
402
 
403
+ }
404
+
405
+ $question_mark = $is_answer_was_correct ? $question->question_mark : 0;
406
+ $total_marks += $question_mark;
407
+
408
+ $answers_data = array(
409
+ 'user_id' => $user_id,
410
+ 'quiz_id' => $attempt->quiz_id,
411
+ 'question_id' => $question_id,
412
+ 'quiz_attempt_id' => $attempt_id,
413
+ 'given_answer' => $given_answer,
414
+ 'question_mark' => $question->question_mark,
415
+ 'achieved_mark' => $question_mark,
416
+ 'minus_mark' => 0,
417
+ 'is_correct' => $is_answer_was_correct ? 1 : 0,
418
+ );
419
+ $wpdb->insert($wpdb->prefix.'tutor_quiz_attempt_answers', $answers_data);
420
+ }
421
+
422
+ $attempt_info = array(
423
+ 'total_answered_questions' => count($quiz_answers),
424
+ 'earned_marks' => $total_marks,
425
+ 'attempt_status' => 'attempt_ended',
426
+ 'attempt_ended_at' => date("Y-m-d H:i:s"),
427
+ );
428
+ $wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $attempt_info, array('attempt_id' => $attempt_id));
429
+ }
430
  }
431
 
432
+ wp_redirect(tutor_utils()->input_old('_wp_http_referer'));
433
+ die();
434
+ }
435
 
 
 
 
436
 
437
  /**
438
  * Quiz attempt will be finish here
439
+ *
440
  */
441
 
442
+ public function finishing_quiz_attempt(){
443
+ if ( ! isset($_POST['tutor_action']) || $_POST['tutor_action'] !== 'tutor_finish_quiz_attempt' ){
444
+ return;
445
+ }
446
+ //Checking nonce
447
+ tutor_utils()->checking_nonce();
448
 
449
+ if ( ! is_user_logged_in()){
450
+ die('Please sign in to do this operation');
451
+ }
452
+
453
+ global $wpdb;
454
+
455
+ $quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
456
+ $attempt = tutor_utils()->is_started_quiz($quiz_id);
457
+
458
+ $attempt_info = array(
459
+ 'total_answered_questions' => 0,
460
+ 'earned_marks' => 0,
461
+ 'attempt_status' => 'attempt_ended',
462
+ 'attempt_ended_at' => date("Y-m-d H:i:s"),
463
+ );
464
+ $wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $attempt_info, array('attempt_id' => $attempt->attempt_id));
465
+
466
+ wp_redirect(tutor_utils()->input_old('_wp_http_referer'));
467
+ }
468
+
469
+ /**
470
+ * Quiz timeout by ajax
471
+ */
472
+ public function tutor_quiz_timeout(){
473
+ global $wpdb;
474
+
475
+ $quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
476
+ $attempt = tutor_utils()->is_started_quiz($quiz_id);
477
 
478
+ if ($attempt) {
479
+ $data = array(
480
+ 'attempt_status' => 'attempt_timeout',
481
+ 'attempt_ended_at' => date("Y-m-d H:i:s"),
482
+ );
483
+ $wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $data, array('attempt_id' => $attempt->attempt_id));
484
+ wp_send_json_success();
485
+ }
486
+
487
+ wp_send_json_error(__('Quiz has been timeout already', 'tutor'));
488
+ }
489
+
490
+ /**
491
+ * Review the answer and change individual answer result
492
+ */
493
 
494
+ public function review_quiz_answer(){
495
  global $wpdb;
496
 
497
+ $attempt_id = (int) sanitize_text_field($_GET['attempt_id']);
498
+ $attempt_answer_id = (int) sanitize_text_field($_GET['attempt_answer_id']);
499
+ $mark_as = sanitize_text_field($_GET['mark_as']);
500
 
501
+ $attempt_answer = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_attempt_answers WHERE attempt_answer_id = {$attempt_answer_id} ");
502
+ $attempt = tutor_utils()->get_attempt($attempt_id);
503
 
504
+ $is_correct = (int) $attempt_answer->is_correct;
 
505
 
506
+ if ($mark_as === 'correct' && ! $is_correct){
 
507
 
508
+ $answer_update_data = array(
509
+ 'achieved_mark' => $attempt_answer->question_mark,
510
+ 'is_correct' => 1,
511
+ );
512
+ $wpdb->update($wpdb->prefix.'tutor_quiz_attempt_answers', $answer_update_data, array('attempt_answer_id' => $attempt_answer_id ));
513
 
514
+ $attempt_update_data = array(
515
+ 'earned_marks' => $attempt->earned_marks + $attempt_answer->question_mark,
516
+ 'is_manually_reviewed' => 1,
517
+ 'manually_reviewed_at' => date("Y-m-d H:i:s"),
518
+ );
519
 
520
+ $wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $attempt_update_data, array('attempt_id' => $attempt_id ));
 
521
 
522
+ }elseif($mark_as === 'incorrect' && $is_correct){
523
 
524
+ $answer_update_data = array(
525
+ 'achieved_mark' => '0.00',
526
+ 'is_correct' => 0,
527
+ );
528
+ $wpdb->update($wpdb->prefix.'tutor_quiz_attempt_answers', $answer_update_data, array('attempt_answer_id' => $attempt_id ));
529
+
530
+ $attempt_update_data = array(
531
+ 'earned_marks' => $attempt->earned_marks - $attempt_answer->question_mark,
532
+ 'is_manually_reviewed' => 1,
533
+ 'manually_reviewed_at' => date("Y-m-d H:i:s"),
534
+ );
535
+
536
+ $wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $attempt_update_data, array('attempt_id' => $attempt_id ));
537
+ }
538
+
539
+ wp_redirect(admin_url("admin.php?page=tutor_quiz_attempts&sub_page=view_attempt&attempt_id=".$attempt_id));
540
+ die();
541
+ }
542
 
 
 
 
543
 
544
  /**
545
+ * New Design Quiz
546
  */
547
+ public function tutor_create_quiz_and_load_modal(){
548
+ $topic_id = sanitize_text_field($_POST['topic_id']);
549
+ $quiz_title = sanitize_text_field($_POST['quiz_title']);
550
+ $quiz_description = sanitize_text_field($_POST['quiz_description']);
551
+ $next_order_id = tutor_utils()->get_next_course_content_order_id($topic_id);
552
+
553
+ $post_arr = array(
554
+ 'post_type' => 'tutor_quiz',
555
+ 'post_title' => $quiz_title,
556
+ 'post_content' => $quiz_description,
557
+ 'post_status' => 'publish',
558
+ 'post_author' => get_current_user_id(),
559
+ 'post_parent' => $topic_id,
560
+ 'menu_order' => $next_order_id,
561
+ );
562
+ $quiz_id = wp_insert_post( $post_arr );
563
+
564
+ ob_start();
565
+ include tutor()->path.'views/modal/edit_quiz.php';
566
+ $output = ob_get_clean();
567
+
568
+ ob_start();
569
+ ?>
570
+ <div id="tutor-quiz-<?php echo $quiz_id; ?>" class="course-content-item tutor-quiz tutor-quiz-<?php echo $quiz_id; ?>">
571
+ <div class="tutor-lesson-top">
572
+ <i class="tutor-icon-move"></i>
573
+ <a href="javascript:;" class="open-tutor-quiz-modal" data-quiz-id="<?php echo $quiz_id; ?>" data-topic-id="<?php echo $topic_id;
574
+ ?>"> <i class=" tutor-icon-doubt"></i>[QUIZ] <?php echo $quiz_title; ?> </a>
575
+ <a href="javascript:;" class="tutor-delete-quiz-btn" data-quiz-id="<?php echo $quiz_id; ?>"><i class="tutor-icon-garbage"></i></a>
576
+ </div>
577
+ </div>
578
+ <?php
579
+ $output_quiz_row = ob_get_clean();
580
+
581
+ wp_send_json_success(array('output' => $output, 'output_quiz_row' => $output_quiz_row));
582
+ }
583
+
584
+ public function tutor_delete_quiz_by_id(){
585
  global $wpdb;
586
 
587
  $quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
588
+ $post = get_post($quiz_id);
589
+
590
+ if ( $post->post_type === 'tutor_quiz'){
591
+ $wpdb->delete($wpdb->prefix.'tutor_quiz_attempts', array('quiz_id' => $quiz_id));
592
+ $wpdb->delete($wpdb->prefix.'tutor_quiz_attempt_answers', array('quiz_id' => $quiz_id));
593
+
594
+ $questions_ids = $wpdb->get_col("SELECT question_id FROM {$wpdb->prefix}tutor_quiz_questions WHERE quiz_id = {$quiz_id} ");
595
+ if (is_array($questions_ids) && count($questions_ids)){
596
+ $in_question_ids = "'".implode("','", $questions_ids)."'";
597
+ $wpdb->query("DELETE FROM {$wpdb->prefix}tutor_quiz_question_answers WHERE belongs_question_id IN({$in_question_ids}) ");
598
+ }
599
+ $wpdb->delete($wpdb->prefix.'tutor_quiz_questions', array('quiz_id' => $quiz_id));
600
+
601
+ wp_delete_post($quiz_id, true);
602
+ delete_post_meta($quiz_id, '_tutor_course_id_for_lesson');
603
+ wp_send_json_success();
604
+ }
605
 
606
+ wp_send_json_error();
607
+ }
608
 
609
+ /**
610
+ * Update Quiz from quiz builder modal
611
+ *
612
+ * @since v.1.0.0
613
+ */
614
+ public function tutor_quiz_builder_quiz_update(){
615
+ $quiz_id = sanitize_text_field($_POST['quiz_id']);
616
+ $topic_id = sanitize_text_field($_POST['topic_id']);
617
+ $quiz_title = sanitize_text_field($_POST['quiz_title']);
618
+ $quiz_description = sanitize_text_field($_POST['quiz_description']);
619
 
620
+ $post_arr = array(
621
+ 'ID' => $quiz_id,
622
+ 'post_title' => $quiz_title,
623
+ 'post_content' => $quiz_description,
624
 
625
+ );
626
+ $quiz_id = wp_update_post( $post_arr );
 
627
 
628
+ ob_start();
629
+ ?>
630
+ <div class="tutor-lesson-top">
631
+ <i class="tutor-icon-move"></i>
632
+ <a href="javascript:;" class="open-tutor-quiz-modal" data-quiz-id="<?php echo $quiz_id; ?>" data-topic-id="<?php echo $topic_id;
633
+ ?>"> <i class=" tutor-icon-doubt"></i>[QUIZ] <?php echo $quiz_title; ?> </a>
634
+ <a href="javascript:;" class="tutor-delete-quiz-btn" data-quiz-id="<?php echo $quiz_id; ?>"><i class="tutor-icon-garbage"></i></a>
635
+ </div>
636
+ <?php
637
+ $output_quiz_row = ob_get_clean();
638
 
639
+ wp_send_json_success(array('output_quiz_row' => $output_quiz_row));
640
+ }
641
+
642
+ /**
643
+ * Load quiz Modal for edit quiz
644
+ *
645
+ * @since v.1.0.0
646
+ */
647
+ public function tutor_load_edit_quiz_modal(){
648
+ $quiz_id = sanitize_text_field($_POST['quiz_id']);
649
+
650
+ ob_start();
651
+ include tutor()->path.'views/modal/edit_quiz.php';
652
+ $output = ob_get_clean();
653
+
654
+ wp_send_json_success(array('output' => $output));
655
+ }
656
+
657
+ /**
658
+ * Load quiz question form for quiz
659
+ *
660
+ * @since v.1.0.0
661
+ */
662
+ public function tutor_quiz_builder_get_question_form(){
663
+ global $wpdb;
664
+ $quiz_id = sanitize_text_field($_POST['quiz_id']);
665
+ $question_id = sanitize_text_field(tutor_utils()->avalue_dot('question_id', $_POST));
666
+
667
+ if ( ! $question_id){
668
+ $next_question_id = tutor_utils()->quiz_next_question_id();
669
+ $next_question_order = tutor_utils()->quiz_next_question_order_id($quiz_id);
670
+
671
+ $new_question_data = array(
672
+ 'quiz_id' => $quiz_id,
673
+ 'question_title' => __('Question ').$next_question_id,
674
+ 'question_description' => '',
675
+ 'question_type' => 'true_false',
676
+ 'question_mark' => 1,
677
+ 'question_settings' => maybe_serialize(array()),
678
+ 'question_order' => $next_question_order,
679
+ );
680
+
681
+ $wpdb->insert($wpdb->prefix.'tutor_quiz_questions', $new_question_data);
682
+ $question_id = $wpdb->insert_id;
683
+ }
684
+
685
+ $question = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_questions where question_id = {$question_id} ");
686
+
687
+ ob_start();
688
+ include tutor()->path.'views/modal/question_form.php';
689
+ $output = ob_get_clean();
690
+
691
+ wp_send_json_success(array('output' => $output));
692
+ }
693
+
694
+ public function tutor_quiz_modal_update_question(){
695
+ global $wpdb;
696
+
697
+ $question_data = $_POST['tutor_quiz_question'];
698
+
699
+ foreach ($question_data as $question_id => $question){
700
+ $question_title = $question['question_title'];
701
+ $question_description = $question['question_description'];
702
+ $question_type = $question['question_type'];
703
+ $question_mark = $question['question_mark'];
704
 
705
+ unset($question['question_title']);
706
+ unset($question['question_description']);
707
+
708
+ $data = array(
709
+ 'question_title' => $question_title,
710
+ 'question_description' => $question_description,
711
+ 'question_type' => $question_type,
712
+ 'question_mark' => $question_mark,
713
+ 'question_settings' => maybe_serialize($question),
714
+ );
715
+
716
+ $wpdb->update($wpdb->prefix.'tutor_quiz_questions', $data, array('question_id' => $question_id) );
717
+ }
718
+
719
+ wp_send_json_success();
720
+ }
721
+
722
+ public function tutor_quiz_builder_question_delete(){
723
+ global $wpdb;
724
+
725
+ $question_id = sanitize_text_field(tutor_utils()->avalue_dot('question_id', $_POST));
726
+ if ($question_id){
727
+ $wpdb->delete($wpdb->prefix.'tutor_quiz_questions', array('question_id' => $question_id));
728
+ }
729
+
730
+ wp_send_json_success();
731
+ }
732
+
733
+ /**
734
+ * Get answers options form for quiz question
735
+ *
736
+ * @since v.1.0.0
737
+ */
738
+ public function tutor_quiz_add_question_answers(){
739
+ $question_id = sanitize_text_field($_POST['question_id']);
740
+ $question = tutor_utils()->avalue_dot($question_id, $_POST['tutor_quiz_question']);
741
+ $question_type = $question['question_type'];
742
+
743
+ ob_start();
744
+ include tutor()->path.'views/modal/question_answer_form.php';
745
+ $output = ob_get_clean();
746
+
747
+ wp_send_json_success(array('output' => $output));
748
+ }
749
+
750
+ /**
751
+ * Edit Answer Form
752
+ *
753
+ * @since v.1.0.0
754
+ */
755
+ public function tutor_quiz_edit_question_answer(){
756
+ $answer_id = (int) sanitize_text_field($_POST['answer_id']);
757
+ $old_answer = tutor_utils()->get_answer_by_id($answer_id);
758
+ foreach ($old_answer as $old_answer);
759
+ $question_id = $old_answer->belongs_question_id;
760
+ $question_type = $old_answer->belongs_question_type;
761
+
762
+ ob_start();
763
+ include tutor()->path.'views/modal/question_answer_edit_form.php';
764
+ $output = ob_get_clean();
765
+
766
+ wp_send_json_success(array('output' => $output));
767
  }
768
 
769
+ public function tutor_save_quiz_answer_options(){
770
+ global $wpdb;
771
+
772
+ $questions = $_POST['tutor_quiz_question'];
773
+ $answers = $_POST['quiz_answer'];
774
+
775
+ foreach ($answers as $question_id => $answer){
776
+ $question = tutor_utils()->avalue_dot($question_id, $questions);
777
+ $question_type = $question['question_type'];
778
+
779
+ //Getting next sorting order
780
+ $next_order_id = (int) $wpdb->get_var("SELECT MAX(answer_order) FROM {$wpdb->prefix}tutor_quiz_question_answers where belongs_question_id = {$question_id} AND belongs_question_type = '{$question_type}' ");
781
+ $next_order_id = $next_order_id + 1;
782
+
783
+ if ($question){
784
+ if ($question_type === 'true_false'){
785
+ $wpdb->delete($wpdb->prefix.'tutor_quiz_question_answers', array('belongs_question_id' => $question_id, 'belongs_question_type' => $question_type));
786
+ $data_true_false = array(
787
+ array(
788
+ 'belongs_question_id' => $question_id,
789
+ 'belongs_question_type' => $question_type,
790
+ 'answer_title' => __('True', 'tutor'),
791
+ 'is_correct' => $answer['true_false'] == 'true' ? 1 : 0,
792
+ 'answer_two_gap_match' => 'true',
793
+ ),
794
+ array(
795
+ 'belongs_question_id' => $question_id,
796
+ 'belongs_question_type' => $question_type,
797
+ 'answer_title' => __('False', 'tutor'),
798
+ 'is_correct' => $answer['true_false'] == 'false' ? 1 : 0,
799
+ 'answer_two_gap_match' => 'false',
800
+ ),
801
+ );
802
+
803
+ foreach ($data_true_false as $true_false_data){
804
+ $wpdb->insert($wpdb->prefix.'tutor_quiz_question_answers', $true_false_data);
805
+ }
806
+
807
+ }elseif($question_type === 'multiple_choice' || $question_type === 'single_choice' || $question_type === 'ordering' ||
808
+ $question_type === 'matching' || $question_type === 'image_matching' || $question_type === 'image_answering' ){
809
+
810
+ $answer_data = array(
811
+ 'belongs_question_id' => $question_id,
812
+ 'belongs_question_type' => $question_type,
813
+ 'answer_title' => $answer['answer_title'],
814
+ 'image_id' => isset($answer['image_id']) ? $answer['image_id'] : 0,
815
+ 'answer_view_format' => isset($answer['answer_view_format']) ? $answer['answer_view_format'] : 0,
816
+ 'answer_order' => $next_order_id,
817
+ );
818
+ if (isset($answer['matched_answer_title'])){
819
+ $answer_data['answer_two_gap_match'] = $answer['matched_answer_title'];
820
+ }
821
+
822
+ $wpdb->insert($wpdb->prefix.'tutor_quiz_question_answers', $answer_data);
823
+
824
+ }elseif($question_type === 'fill_in_the_blank'){
825
+ $wpdb->delete($wpdb->prefix.'tutor_quiz_question_answers', array('belongs_question_id' => $question_id, 'belongs_question_type' => $question_type));
826
+ $answer_data = array(
827
+ 'belongs_question_id' => $question_id,
828
+ 'belongs_question_type' => $question_type,
829
+ 'answer_title' => $answer['answer_title'],
830
+ 'answer_two_gap_match' => isset($answer['answer_two_gap_match']) ? strtolower(trim($answer['answer_two_gap_match'])) : null,
831
+ );
832
+ $wpdb->insert($wpdb->prefix.'tutor_quiz_question_answers', $answer_data);
833
+ }
834
+ }
835
+ }
836
+
837
+ wp_send_json_success();
838
+ }
839
+
840
  /**
841
+ * Tutor Update Answer
842
+ *
843
+ * @since v.1.0.0
844
  */
845
+ public function tutor_update_quiz_answer_options(){
846
+ global $wpdb;
847
+
848
+ $answer_id = (int) sanitize_text_field($_POST['tutor_quiz_answer_id']);
849
+ $questions = $_POST['tutor_quiz_question'];
850
+ $answers = $_POST['quiz_answer'];
851
+
852
+ foreach ($answers as $question_id => $answer){
853
+ $question = tutor_utils()->avalue_dot($question_id, $questions);
854
+ $question_type = $question['question_type'];
855
+
856
+ if ($question){
857
+ if($question_type === 'multiple_choice' || $question_type === 'single_choice' || $question_type === 'ordering' || $question_type === 'matching' || $question_type === 'image_matching' || $question_type === 'fill_in_the_blank' || $question_type === 'image_answering' ){
858
+
859
+ $answer_data = array(
860
+ 'belongs_question_id' => $question_id,
861
+ 'belongs_question_type' => $question_type,
862
+ 'answer_title' => $answer['answer_title'],
863
+ 'image_id' => isset($answer['image_id']) ? $answer['image_id'] : 0,
864
+ 'answer_view_format' => isset($answer['answer_view_format']) ? $answer['answer_view_format'] : '',
865
+ );
866
+ if (isset($answer['matched_answer_title'])){
867
+ $answer_data['answer_two_gap_match'] = $answer['matched_answer_title'];
868
+ }
869
+
870
+ if ($question_type === 'fill_in_the_blank'){
871
+ $answer_data['answer_two_gap_match'] = isset($answer['answer_two_gap_match']) ? strtolower(trim($answer['answer_two_gap_match'])) : null;
872
+ }
873
+
874
+ $wpdb->update($wpdb->prefix.'tutor_quiz_question_answers', $answer_data, array('answer_id' => $answer_id));
875
+ }
876
+ }
877
+ }
878
 
879
+ //die(print_r($_POST));
880
+ wp_send_json_success();
881
+ }
 
882
 
883
+ public function tutor_quiz_builder_get_answers_by_question(){
884
+ global $wpdb;
885
+ $question_id = sanitize_text_field($_POST['question_id']);
886
+ $question_type = sanitize_text_field($_POST['question_type']);
887
 
888
+ $question = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_questions WHERE question_id = {$question_id} ");
889
+ $answers = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_question_answers where belongs_question_id = {$question_id} AND belongs_question_type = '{$question_type}' order by answer_order asc ;");
890
 
891
+ ob_start();
892
+
893
+ switch ($question_type){
894
+ case 'true_false':
895
+ echo '<label>'.__('Answer options &amp; mark correct', 'tutor').'</label>';
896
+ break;
897
+ case 'ordering':
898
+ echo '<label>'.__('Student should order below items exact this order, make sure your answer is in right order, you can re-order them', 'tutor').'</label>';
899
+ break;
900
+ }
901
+
902
+ if (is_array($answers) && count($answers)){
903
+ foreach ($answers as $answer){
904
+ ?>
905
+ <div class="tutor-quiz-answer-wrap" data-answer-id="<?php echo $answer->answer_id; ?>">
906
+ <div class="tutor-quiz-answer">
907
+ <span class="tutor-quiz-answer-title">
908
+ <?php
909
+ echo $answer->answer_title;
910
+ if ($answer->belongs_question_type === 'fill_in_the_blank'){
911
+ echo ' ('.__('Answer', 'tutor').' : ';
912
+ echo "<strong>{$answer->answer_two_gap_match} </strong>)";
913
+ }
914
+ if ($answer->belongs_question_type === 'matching'){
915
+ echo " - {$answer->answer_two_gap_match}";
916
+ }
917
+ ?>
918
+ </span>
919
+
920
+ <?php
921
+ if ($answer->image_id){
922
+ echo '<span class="tutor-question-answer-image"><img src="'.wp_get_attachment_image_url($answer->image_id).'" /> </span>';
923
+ }
924
+ if ($question->question_type === 'true_false' || $question->question_type === 'single_choice'){
925
+ ?>
926
+ <span class="tutor-quiz-answers-mark-correct-wrap">
927
+ <input type="radio" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]" value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> >
928
+ </span>
929
+ <?php
930
+ }elseif ($question->question_type === 'multiple_choice'){
931
+ ?>
932
+ <span class="tutor-quiz-answers-mark-correct-wrap">
933
+ <input type="checkbox" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]" value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> >
934
+ </span>
935
+ <?php
936
+ }
937
+ ?>
938
+ <span class="tutor-quiz-answer-edit">
939
+ <a href="javascript:;"><i class="tutor-icon-pencil"></i> </a>
940
+ </span>
941
+ <span class="tutor-quiz-answer-sort-icon"><i class="tutor-icon-menu-2"></i> </span>
942
+ </div>
943
+
944
+ <div class="tutor-quiz-answer-trash-wrap">
945
+ <a href="javascript:;" class="answer-trash-btn" data-answer-id="<?php echo $answer->answer_id; ?>"><i class="tutor-icon-garbage"></i> </a>
946
+ </div>
947
+ </div>
948
+ <?php
949
+ }
950
+ }
951
+ $output = ob_get_clean();
952
+
953
+ wp_send_json_success(array('output' => $output));
954
+ }
955
+
956
+ public function tutor_quiz_builder_delete_answer(){
957
+ global $wpdb;
958
+ $answer_id = sanitize_text_field($_POST['answer_id']);
959
+
960
+ $wpdb->delete($wpdb->prefix.'tutor_quiz_question_answers', array('answer_id' => $answer_id));
961
+ wp_send_json_success();
962
+ }
963
+
964
+ /**
965
+ * Save sorting data for quiz answers
966
+ */
967
+ public function tutor_quiz_answer_sorting(){
968
+ global $wpdb;
969
 
970
+ if ( ! empty($_POST['sorted_answer_ids']) && is_array($_POST['sorted_answer_ids']) && count($_POST['sorted_answer_ids']) ){
971
+ $answer_ids = $_POST['sorted_answer_ids'];
972
+ $i = 0;
973
+ foreach ($answer_ids as $key => $answer_id){
974
+ $i++;
975
+ $wpdb->update($wpdb->prefix.'tutor_quiz_question_answers', array('answer_order' => $i), array('answer_id' => $answer_id));
976
+ }
977
  }
978
 
979
+ }
980
+
981
+ /**
982
+ * Mark answer as correct
983
+ */
984
+
985
+ public function tutor_mark_answer_as_correct(){
986
+ global $wpdb;
987
 
988
+ $answer_id = sanitize_text_field($_POST['answer_id']);
989
+ $inputValue = sanitize_text_field($_POST['inputValue']);
990
 
991
+ $answer = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_question_answers WHERE answer_id = {$answer_id} LIMIT 0,1 ;");
992
+ if ($answer->belongs_question_type === 'single_choice'){
993
+ $wpdb->update($wpdb->prefix.'tutor_quiz_question_answers', array('is_correct' => 0), array('belongs_question_id' => $answer->belongs_question_id));
994
+ }
995
+ $wpdb->update($wpdb->prefix.'tutor_quiz_question_answers', array('is_correct' => $inputValue), array('answer_id' => $answer_id));
996
  }
997
 
998
+ /**
999
+ * Update quiz settings from modal
1000
+ *
1001
+ * @since : v.1.0.0
1002
+ */
1003
+ public function tutor_quiz_modal_update_settings(){
1004
+ $quiz_id = sanitize_text_field($_POST['quiz_id']);
1005
+
1006
+ $quiz_option = tutor_utils()->sanitize_array($_POST['quiz_option']);
1007
+ update_post_meta($quiz_id, 'tutor_quiz_option', $quiz_option);
1008
+
1009
+ wp_send_json_success();
1010
+ }
1011
+
1012
+
1013
+ //=========================//
1014
+ // Front end stuffs
1015
+ //=========================//
1016
+
1017
+ /**
1018
+ * Rendering quiz for frontend
1019
+ *
1020
+ * @since v.1.0.0
1021
+ */
1022
+
1023
+ public function tutor_render_quiz_content(){
1024
+ $quiz_id = (int) sanitize_text_field(tutor_utils()->avalue_dot('quiz_id', $_POST));
1025
+
1026
+ ob_start();
1027
+ global $post;
1028
+
1029
+ $post = get_post($quiz_id);
1030
+ setup_postdata($post);
1031
+ //tutor_lesson_content();
1032
+
1033
+ single_quiz_contents();
1034
+
1035
+ wp_reset_postdata();
1036
+
1037
+
1038
+ $html = ob_get_clean();
1039
+ wp_send_json_success(array('html' => $html));
1040
+ }
1041
+
1042
+
1043
  }
classes/Quiz_Attempts_List.php CHANGED
@@ -33,16 +33,16 @@ class Quiz_Attempts_List extends \Tutor_List_Table {
33
  function column_student($item){
34
  $actions = array();
35
 
36
- $actions['answer'] = sprintf('<a href="?page=%s&sub_page=%s&attempt_id=%s">'.__('Review', 'tutor').'</a>',$_REQUEST['page'],'view_attempt',$item->comment_ID);
37
- //$actions['delete'] = sprintf('<a href="?page=%s&action=%s&attempt_id=%s">Delete</a>',$_REQUEST['page'],'delete',$item->comment_ID);
38
 
39
  $quiz_title = '<strong>'.$item->display_name.'</strong> <br />'.$item->user_email.'<br /><br />'. human_time_diff(strtotime
40
- ($item->comment_date)).__(' ago', 'tutor');
41
 
42
  //Return the title contents
43
  return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
44
  $quiz_title,
45
- $item->comment_ID,
46
  $this->row_actions($actions)
47
  );
48
  }
@@ -55,12 +55,12 @@ class Quiz_Attempts_List extends \Tutor_List_Table {
55
  return sprintf(
56
  '<input type="checkbox" name="%1$s[]" value="%2$s" />',
57
  /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("instructor")
58
- /*$2%s*/ $item->comment_ID //The value of the checkbox should be the record's id
59
  );
60
  }
61
 
62
  function column_course($item) {
63
- $quiz = tutor_utils()->get_course_by_quiz($item->comment_post_ID);
64
 
65
  if ($quiz) {
66
  $title = get_the_title( $quiz->ID );
@@ -68,25 +68,17 @@ class Quiz_Attempts_List extends \Tutor_List_Table {
68
  }
69
  }
70
 
71
-
72
  function column_total_questions($item) {
73
- $attempt_info = maybe_unserialize($item->quiz_attempt_info);
74
-
75
- echo tutor_utils()->avalue_dot('total_question', $attempt_info);
76
  }
77
 
78
  function column_earned_marks($item){
79
- $attempt_info = maybe_unserialize($item->quiz_attempt_info);
80
-
81
- $answers_mark = wp_list_pluck(tutor_utils()->avalue_dot('answers', $attempt_info), 'question_mark' );
82
- $total_marks = array_sum($answers_mark);
83
 
84
- $marks_earned = tutor_utils()->avalue_dot('marks_earned', $attempt_info);
85
- $earned_percentage = $marks_earned > 0 ? ( number_format(($marks_earned * 100) / $total_marks)) : 0;
86
 
87
- $pass_mark_percent = tutor_utils()->avalue_dot('pass_mark_percent', $attempt_info);
88
-
89
- $output = $marks_earned." out of {$total_marks} ({$earned_percentage}%) ";
90
  if ($earned_percentage >= $pass_mark_percent){
91
  $output .= '<span class="result-pass">'.__('Pass', 'tutor').'</span>';
92
  }else{
@@ -101,7 +93,6 @@ class Quiz_Attempts_List extends \Tutor_List_Table {
101
  return "<span class='tutor-status-context {$item->attempt_status}'>{$status}</span>";
102
  }
103
 
104
-
105
  function get_columns(){
106
  $columns = array(
107
  'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
@@ -110,7 +101,7 @@ class Quiz_Attempts_List extends \Tutor_List_Table {
110
  'course' => __('Course', 'tutor'),
111
  'total_questions' => __('Total Questions', 'tutor'),
112
  'earned_marks' => __('Earned Mark', 'tutor'),
113
- 'attempt_status' => __('Earned Mark', 'tutor'),
114
  );
115
  return $columns;
116
  }
33
  function column_student($item){
34
  $actions = array();
35
 
36
+ $actions['answer'] = sprintf('<a href="?page=%s&sub_page=%s&attempt_id=%s">'.__('Review', 'tutor').'</a>',$_REQUEST['page'],'view_attempt',$item->attempt_id);
37
+ //$actions['delete'] = sprintf('<a href="?page=%s&action=%s&attempt_id=%s">Delete</a>',$_REQUEST['page'],'delete',$item->attempt_id);
38
 
39
  $quiz_title = '<strong>'.$item->display_name.'</strong> <br />'.$item->user_email.'<br /><br />'. human_time_diff(strtotime
40
+ ($item->attempt_ended_at)).__(' ago', 'tutor');
41
 
42
  //Return the title contents
43
  return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
44
  $quiz_title,
45
+ $item->attempt_id,
46
  $this->row_actions($actions)
47
  );
48
  }
55
  return sprintf(
56
  '<input type="checkbox" name="%1$s[]" value="%2$s" />',
57
  /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("instructor")
58
+ /*$2%s*/ $item->attempt_id //The value of the checkbox should be the record's id
59
  );
60
  }
61
 
62
  function column_course($item) {
63
+ $quiz = tutor_utils()->get_course_by_quiz($item->quiz_id);
64
 
65
  if ($quiz) {
66
  $title = get_the_title( $quiz->ID );
68
  }
69
  }
70
 
 
71
  function column_total_questions($item) {
72
+ echo $item->total_questions;
 
 
73
  }
74
 
75
  function column_earned_marks($item){
76
+ $pass_mark_percent = tutor_utils()->get_quiz_option($item->quiz_id, 'passing_grade', 0);
77
+ $earned_percentage = $item->earned_marks > 0 ? ( number_format(($item->earned_marks * 100) / $item->total_marks)) : 0;
 
 
78
 
79
+ $output = $item->earned_marks." out of {$item->total_marks} <br />";
80
+ $output .= "({$earned_percentage}%) out of ({$pass_mark_percent}%) <br />";
81
 
 
 
 
82
  if ($earned_percentage >= $pass_mark_percent){
83
  $output .= '<span class="result-pass">'.__('Pass', 'tutor').'</span>';
84
  }else{
93
  return "<span class='tutor-status-context {$item->attempt_status}'>{$status}</span>";
94
  }
95
 
 
96
  function get_columns(){
97
  $columns = array(
98
  'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
101
  'course' => __('Course', 'tutor'),
102
  'total_questions' => __('Total Questions', 'tutor'),
103
  'earned_marks' => __('Earned Mark', 'tutor'),
104
+ 'attempt_status' => __('Attempt Status', 'tutor'),
105
  );
106
  return $columns;
107
  }
classes/Rewrite_Rules.php CHANGED
@@ -100,13 +100,14 @@ class Rewrite_Rules extends Tutor_Base {
100
  $course = $wpdb->get_row("select ID, post_name, post_type, post_parent from {$wpdb->posts} where ID = {$course->post_parent} ");
101
  }
102
  //Checking if this lesson
103
- if ($course->post_type !== $this->course_post_type){
104
  $course = $wpdb->get_row("select ID, post_name, post_type, post_parent from {$wpdb->posts} where ID = {$course->post_parent} ");
105
  }
106
 
107
- return home_url("/{$this->course_post_type}/".$course->post_name."/tutor_quiz/". $post->post_name.'/');
 
108
  }else{
109
- return home_url("/{$this->course_post_type}/sample-course/tutor_quiz/". $post->post_name.'/');
110
  }
111
  }
112
  return $post_link;
100
  $course = $wpdb->get_row("select ID, post_name, post_type, post_parent from {$wpdb->posts} where ID = {$course->post_parent} ");
101
  }
102
  //Checking if this lesson
103
+ if (isset($course->post_type) && $course->post_type !== $this->course_post_type){
104
  $course = $wpdb->get_row("select ID, post_name, post_type, post_parent from {$wpdb->posts} where ID = {$course->post_parent} ");
105
  }
106
 
107
+ $course_post_name = isset($course->post_name) ? $course->post_name : 'sample-course';
108
+ return home_url("/{$this->course_post_type}/{$course_post_name}/tutor_quiz/{$post->post_name}/");
109
  }else{
110
+ return home_url("/{$this->course_post_type}/sample-course/tutor_quiz/{$post->post_name}/");
111
  }
112
  }
113
  return $post_link;
classes/Utils.php CHANGED
@@ -51,6 +51,8 @@ class Utils {
51
  * @param bool $value
52
  *
53
  * Update Option
 
 
54
  */
55
 
56
  public function update_option($key = null, $value = false){
@@ -94,6 +96,8 @@ class Utils {
94
  * @return array
95
  *
96
  * Get all pages
 
 
97
  */
98
  public function get_pages(){
99
  $pages = array();
@@ -110,6 +114,8 @@ class Utils {
110
  * @return string
111
  *
112
  * Get course archive URL
 
 
113
  */
114
  public function course_archive_page_url(){
115
  $course_post_type = tutor()->course_post_type;
@@ -128,6 +134,8 @@ class Utils {
128
  * @return string
129
  *
130
  * Get student URL
 
 
131
  */
132
 
133
  public function profile_url($student_id = 0){
@@ -154,6 +162,8 @@ class Utils {
154
  * @return array|null|object
155
  *
156
  * Get user by user login
 
 
157
  */
158
  public function get_user_by_login($user_login = ''){
159
  global $wpdb;
@@ -166,6 +176,8 @@ class Utils {
166
  * @return bool
167
  *
168
  * Check if WooCommerce Activated
 
 
169
  */
170
 
171
  public function has_wc(){
@@ -177,6 +189,13 @@ class Utils {
177
  return $has;
178
  }
179
 
 
 
 
 
 
 
 
180
  public function has_edd(){
181
  $activated_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ));
182
  //$depends = array('easy-digital-downloads/easy-digital-downloads.php', 'tutor-edd/tutor-edd.php');
@@ -189,7 +208,7 @@ class Utils {
189
  /**
190
  * @return mixed
191
  *
192
- *
193
  */
194
  public function languages(){
195
  $language_codes = array(
@@ -333,12 +352,30 @@ class Utils {
333
  return apply_filters('tutor/utils/languages', $language_codes);
334
  }
335
 
 
 
 
 
 
 
 
 
336
  public function print_view($value = ''){
337
  echo '<pre>';
338
  print_r($value);
339
  echo '</pre>';
340
  }
341
 
 
 
 
 
 
 
 
 
 
 
342
  public function get_courses($excludes = array()){
343
  global $wpdb;
344
 
@@ -357,6 +394,15 @@ class Utils {
357
  return $query;
358
  }
359
 
 
 
 
 
 
 
 
 
 
360
  public function get_courses_for_instructors($instructor_id = 0){
361
  global $wpdb;
362
 
@@ -371,6 +417,16 @@ class Utils {
371
  return $query;
372
  }
373
 
 
 
 
 
 
 
 
 
 
 
374
  public function get_course_count_by_instructor($instructor_id){
375
  global $wpdb;
376
 
@@ -383,6 +439,15 @@ class Utils {
383
  return $count;
384
  }
385
 
 
 
 
 
 
 
 
 
 
386
  public function get_courses_by_instructor($instructor_id){
387
  global $wpdb;
388
 
@@ -403,11 +468,25 @@ class Utils {
403
  return $pageposts;
404
  }
405
 
 
 
 
 
 
 
 
406
  public function get_archive_page_course_count(){
407
  global $wp_query;
408
  return $wp_query->post_count;
409
  }
410
 
 
 
 
 
 
 
 
411
  public function get_course_count(){
412
  global $wpdb;
413
 
@@ -416,6 +495,13 @@ class Utils {
416
  return $count;
417
  }
418
 
 
 
 
 
 
 
 
419
  public function get_lesson_count(){
420
  global $wpdb;
421
 
@@ -424,6 +510,16 @@ class Utils {
424
  return $count;
425
  }
426
 
 
 
 
 
 
 
 
 
 
 
427
  public function get_lesson($course_id = 0, $limit = 10){
428
  $course_id = $this->get_post_id($course_id);
429
 
@@ -445,6 +541,15 @@ class Utils {
445
  return $query;
446
  }
447
 
 
 
 
 
 
 
 
 
 
448
  public function get_lesson_count_by_course($course_id = 0){
449
  $course_id = $this->get_post_id($course_id);
450
  global $wpdb;
@@ -454,6 +559,16 @@ class Utils {
454
  return (int) $count_lesson;
455
  }
456
 
 
 
 
 
 
 
 
 
 
 
457
  public function get_completed_lesson_count_by_course($course_id = 0, $user_id = 0){
458
  $course_id = $this->get_post_id($course_id);
459
  $user_id = $this->get_user_id($user_id);
@@ -481,6 +596,7 @@ class Utils {
481
  *
482
  * @return float|int
483
  *
 
484
  */
485
  public function get_course_completed_percent($course_id = 0, $user_id = 0){
486
  $course_id = $this->get_post_id($course_id);
@@ -496,6 +612,15 @@ class Utils {
496
  return 0;
497
  }
498
 
 
 
 
 
 
 
 
 
 
499
  public function get_topics($course_id = 0){
500
  $course_id = $this->get_post_id($course_id);
501
 
@@ -511,6 +636,15 @@ class Utils {
511
  return $query;
512
  }
513
 
 
 
 
 
 
 
 
 
 
514
  public function get_next_topic_order_id($course_ID){
515
  global $wpdb;
516
 
@@ -518,6 +652,32 @@ class Utils {
518
  return $last_order + 1;
519
  }
520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  public function get_lessons_by_topic($topics_id = 0, $limit = 10){
522
  $topics_id = $this->get_post_id($topics_id);
523
 
@@ -535,6 +695,40 @@ class Utils {
535
  return $query;
536
  }
537
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  public function checking_nonce($request_method = 'post'){
539
  if ($request_method === 'post'){
540
  if (!isset($_POST[tutor()->nonce]) || !wp_verify_nonce($_POST[tutor()->nonce], tutor()->nonce_action)) {
@@ -616,6 +810,16 @@ class Utils {
616
  return false;
617
  }
618
 
 
 
 
 
 
 
 
 
 
 
619
  public function has_any_enrolled($course_id = 0, $user_id = 0){
620
  $course_id = $this->get_post_id($course_id);
621
  $user_id = $this->get_user_id($user_id);
@@ -701,7 +905,7 @@ class Utils {
701
  return false;
702
  }
703
 
704
- /*
705
  *
706
  * Get course sub pages in course dashboard
707
  *
@@ -839,6 +1043,8 @@ class Utils {
839
  * @return array
840
  *
841
  * Get the playtime in array
 
 
842
  */
843
  public function playtime_array($seconds){
844
  $run_time_format = array(
@@ -867,6 +1073,15 @@ class Utils {
867
  return $run_time_format;
868
  }
869
 
 
 
 
 
 
 
 
 
 
870
  public function seconds_to_time_context($seconds) {
871
  $sign = (($seconds < 0) ? '-' : '');
872
  $seconds = round(abs($seconds));
@@ -939,6 +1154,8 @@ class Utils {
939
  * @return bool
940
  *
941
  * Ensure if attached video is self hosted or not
 
 
942
  */
943
  public function is_html5_video($post_id = 0){
944
  $post_id = $this->get_post_id($post_id);
@@ -1015,6 +1232,8 @@ class Utils {
1015
  * @return array|bool|null|object|void
1016
  *
1017
  * Determine if a course completed
 
 
1018
  */
1019
 
1020
  public function is_completed_course($course_id = 0, $user_id = 0){
@@ -1046,6 +1265,8 @@ class Utils {
1046
  * @return array
1047
  *
1048
  * Sanitize input array
 
 
1049
  */
1050
  public function sanitize_array($input = array()){
1051
  $array = array();
@@ -1065,6 +1286,16 @@ class Utils {
1065
  return $array;
1066
  }
1067
 
 
 
 
 
 
 
 
 
 
 
1068
  public function has_video_in_single($post_id = 0){
1069
  if (is_single()) {
1070
  $post_id = $this->get_post_id($post_id);
@@ -1119,6 +1350,8 @@ class Utils {
1119
  *
1120
  * get the total students
1121
  * pass course id to get course wise total students
 
 
1122
  */
1123
  public function get_total_students($search_term = ''){
1124
  $meta_key = '_is_tutor_student';
@@ -1134,6 +1367,15 @@ class Utils {
1134
  return (int) $count;
1135
  }
1136
 
 
 
 
 
 
 
 
 
 
1137
  public function get_completed_courses_ids_by_user($user_id = 0){
1138
  global $wpdb;
1139
 
@@ -1154,6 +1396,8 @@ class Utils {
1154
  * @return bool|\WP_Query
1155
  *
1156
  * Return courses by user_id
 
 
1157
  */
1158
  public function get_courses_by_user($user_id = 0){
1159
  $user_id = $this->get_user_id($user_id);
@@ -1179,6 +1423,8 @@ class Utils {
1179
  * @return bool|\WP_Query
1180
  *
1181
  * Get the active course by user
 
 
1182
  */
1183
 
1184
  public function get_active_courses_by_user($user_id = 0){
@@ -1202,6 +1448,16 @@ class Utils {
1202
  return false;
1203
  }
1204
 
 
 
 
 
 
 
 
 
 
 
1205
  public function get_enrolled_courses_ids_by_user($user_id = 0){
1206
  global $wpdb;
1207
  $user_id = $this->get_user_id($user_id);
@@ -1291,6 +1547,15 @@ class Utils {
1291
  return $this->avalue_dot($lesson_id, $lesson_info);
1292
  }
1293
 
 
 
 
 
 
 
 
 
 
1294
  public function get_post_id($post_id = 0){
1295
  if ( ! $post_id){
1296
  $post_id = get_the_ID();
@@ -1302,6 +1567,15 @@ class Utils {
1302
  return $post_id;
1303
  }
1304
 
 
 
 
 
 
 
 
 
 
1305
  public function get_user_id($user_id = 0){
1306
  if ( ! $user_id){
1307
  $user_id = get_current_user_id();
@@ -1401,6 +1675,8 @@ class Utils {
1401
  * @param int $post_id
1402
  *
1403
  * Mark lesson complete
 
 
1404
  */
1405
  public function mark_lesson_complete($post_id = 0, $user_id = 0){
1406
  $post_id = $this->get_post_id($post_id);
@@ -1415,6 +1691,8 @@ class Utils {
1415
  *
1416
  * @type: call when need
1417
  * @return bool;
 
 
1418
  */
1419
  public function do_enroll($course_id = 0, $order_id = 0){
1420
  if ( ! $course_id){
@@ -1466,6 +1744,13 @@ class Utils {
1466
  return false;
1467
  }
1468
 
 
 
 
 
 
 
 
1469
  public function complete_course_enroll($order_id){
1470
  if ( ! tutor_utils()->is_tutor_order($order_id)){
1471
  return;
@@ -1489,6 +1774,8 @@ class Utils {
1489
  * @param $order_id
1490
  *
1491
  * @return array|bool
 
 
1492
  */
1493
  public function get_course_enrolled_ids_by_order_id($order_id){
1494
  global $wpdb;
@@ -1526,13 +1813,32 @@ class Utils {
1526
  return $query;
1527
  }
1528
 
 
 
 
 
 
 
 
 
 
1529
  public function get_course_product_id($course_id = 0){
1530
  $course_id = $this->get_post_id($course_id);
1531
  return (int) get_post_meta($course_id, '_tutor_course_product_id', true);
1532
  }
1533
 
1534
- public function product_belongs_with_course($product_id = 0){
1535
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
1536
 
1537
  $query = $wpdb->get_row("select * from {$wpdb->postmeta} WHERE meta_key='_tutor_course_product_id' AND meta_value = {$product_id} limit 1 ");
1538
  return $query;
@@ -1540,6 +1846,8 @@ class Utils {
1540
 
1541
  /**
1542
  * #End WooCommerce specific utils
 
 
1543
  */
1544
 
1545
  public function get_enrolled_statuses(){
@@ -1554,6 +1862,15 @@ class Utils {
1554
  );
1555
  }
1556
 
 
 
 
 
 
 
 
 
 
1557
  public function is_tutor_order($order_id){
1558
  return get_post_meta($order_id, '_is_tutor_order_for_course', true);
1559
  }
@@ -1562,6 +1879,8 @@ class Utils {
1562
  * @return mixed
1563
  *
1564
  * Tutor Dashboard Pages
 
 
1565
  */
1566
 
1567
  public function tutor_student_dashboard_pages(){
@@ -1576,7 +1895,16 @@ class Utils {
1576
  return apply_filters('tutor_dashboard/student/pages', $nav_items);
1577
  }
1578
 
1579
-
 
 
 
 
 
 
 
 
 
1580
  public function get_tutor_dashboard_page_permalink($page_key = '', $page_id = 0){
1581
  if ($page_key === 'index'){
1582
  $page_key = '';
@@ -1585,6 +1913,15 @@ class Utils {
1585
  return trailingslashit(get_permalink($page_id)).$page_key;
1586
  }
1587
 
 
 
 
 
 
 
 
 
 
1588
  public function input_old($input = ''){
1589
  $value = $this->avalue_dot($input, $_REQUEST);
1590
  if ($value){
@@ -1607,6 +1944,16 @@ class Utils {
1607
  return get_user_meta($user_id, '_is_tutor_instructor', true);
1608
  }
1609
 
 
 
 
 
 
 
 
 
 
 
1610
  public function instructor_status($user_id = 0, $status_name = true){
1611
  $user_id = $this->get_user_id($user_id);
1612
 
@@ -1627,6 +1974,15 @@ class Utils {
1627
  return false;
1628
  }
1629
 
 
 
 
 
 
 
 
 
 
1630
 
1631
  public function get_total_instructors($search_term = ''){
1632
  $meta_key = '_is_tutor_instructor';
@@ -1642,6 +1998,17 @@ class Utils {
1642
  return (int) $count;
1643
  }
1644
 
 
 
 
 
 
 
 
 
 
 
 
1645
  public function get_instructors($start = 0, $limit = 10, $search_term = ''){
1646
  $meta_key = '_is_tutor_instructor';
1647
  global $wpdb;
@@ -1660,6 +2027,15 @@ class Utils {
1660
  return $instructors;
1661
  }
1662
 
 
 
 
 
 
 
 
 
 
1663
  public function get_instructors_by_course($course_id = 0){
1664
  global $wpdb;
1665
  $course_id = $this->get_post_id($course_id);
@@ -1689,8 +2065,11 @@ class Utils {
1689
  * Get total Students by instructor
1690
  * 1 enrollment = 1 student, so total enrolled for a equivalent total students (Tricks)
1691
  *
 
 
1692
  * @since v.1.0.0
1693
  */
 
1694
  public function get_total_students_by_instructor($instructor_id){
1695
  global $wpdb;
1696
 
@@ -1710,6 +2089,8 @@ class Utils {
1710
  * @return float|string
1711
  *
1712
  * Get rating format from value
 
 
1713
  */
1714
  public function get_rating_value($input = 0.00){
1715
 
@@ -1738,6 +2119,8 @@ class Utils {
1738
  * @return string
1739
  *
1740
  * Generate star rating based in given rating value
 
 
1741
  */
1742
  public function star_rating_generator($current_rating = 0.00, $echo = true){
1743
  $output = '';
@@ -1768,6 +2151,8 @@ class Utils {
1768
  * @return string
1769
  *
1770
  * Generate text to avatar
 
 
1771
  */
1772
  public function get_tutor_avatar($user_id = null, $size = 'thumbnail'){
1773
  global $wpdb;
@@ -1800,6 +2185,16 @@ class Utils {
1800
  return $initial_avatar;
1801
  }
1802
 
 
 
 
 
 
 
 
 
 
 
1803
  public function get_tutor_user($user_id){
1804
  global $wpdb;
1805
 
@@ -1860,6 +2255,8 @@ class Utils {
1860
  * @return object
1861
  *
1862
  * Get course rating
 
 
1863
  */
1864
  public function get_course_rating($course_id = 0){
1865
  $course_id = $this->get_post_id($course_id);
@@ -1892,7 +2289,17 @@ class Utils {
1892
  return (object) $ratings;
1893
  }
1894
 
1895
-
 
 
 
 
 
 
 
 
 
 
1896
  public function get_reviews_by_user($user_id = 0, $offset = 0, $limit = 150){
1897
  $user_id = $this->get_user_id($user_id);
1898
  global $wpdb;
@@ -1925,6 +2332,8 @@ class Utils {
1925
  * @return object
1926
  *
1927
  * Get instructors rating
 
 
1928
  */
1929
  public function get_instructor_ratings($instructor_id){
1930
  global $wpdb;
@@ -1961,6 +2370,8 @@ class Utils {
1961
  * @return object
1962
  *
1963
  * Get course rating by user
 
 
1964
  */
1965
  public function get_course_rating_by_user($course_id = 0, $user_id = 0){
1966
  $course_id = $this->get_post_id($course_id);
@@ -1995,6 +2406,8 @@ class Utils {
1995
  * @param int $user_id
1996
  *
1997
  * @return null|string
 
 
1998
  */
1999
  public function count_reviews_wrote_by_user($user_id = 0){
2000
  global $wpdb;
@@ -2010,6 +2423,8 @@ class Utils {
2010
  * @return bool|int|string
2011
  *
2012
  * This function transforms the php.ini notation for numbers (like '2M') to an integer.
 
 
2013
  */
2014
 
2015
  function let_to_num( $size ) {
@@ -2037,8 +2452,13 @@ class Utils {
2037
  return $ret;
2038
  }
2039
 
2040
-
2041
-
 
 
 
 
 
2042
  function get_db_version() {
2043
  global $wpdb;
2044
 
@@ -2065,7 +2485,18 @@ class Utils {
2065
  return '<span class="tutor-help-tip" data-tip="' . $tip . '"></span>';
2066
  }
2067
 
2068
-
 
 
 
 
 
 
 
 
 
 
 
2069
  public function get_top_question($course_id = 0, $user_id = 0, $offset = 0, $limit = 20){
2070
  $course_id = $this->get_post_id($course_id);
2071
  $user_id = $this->get_user_id($user_id);
@@ -2095,6 +2526,15 @@ class Utils {
2095
  return $questions;
2096
  }
2097
 
 
 
 
 
 
 
 
 
 
2098
  public function get_total_qa_question($search_term = ''){
2099
  global $wpdb;
2100
 
@@ -2161,6 +2601,15 @@ class Utils {
2161
  return $query;
2162
  }
2163
 
 
 
 
 
 
 
 
 
 
2164
  public function get_qa_question($question_id){
2165
  global $wpdb;
2166
  $query = $wpdb->get_row("SELECT
@@ -2188,6 +2637,13 @@ class Utils {
2188
  return $query;
2189
  }
2190
 
 
 
 
 
 
 
 
2191
  public function get_qa_answer_by_question($question_id){
2192
  global $wpdb;
2193
  $query = $wpdb->get_results("SELECT
@@ -2242,6 +2698,16 @@ class Utils {
2242
  return $query;
2243
  }
2244
 
 
 
 
 
 
 
 
 
 
 
2245
  public function announcement_content($content = ''){
2246
  $search = array('{user_display_name}');
2247
 
@@ -2268,8 +2734,12 @@ class Utils {
2268
  $post_id = $this->get_post_id($post_id);
2269
  $get_option_meta = maybe_unserialize(get_post_meta($post_id, 'tutor_quiz_option', true));
2270
 
2271
- $value = $this->avalue_dot($option_key, $get_option_meta);
2272
- if ($value){
 
 
 
 
2273
  return $value;
2274
  }
2275
  return $default;
@@ -2287,7 +2757,10 @@ class Utils {
2287
  $quiz_id = $this->get_post_id($quiz_id);
2288
  global $wpdb;
2289
 
2290
- $questions = $wpdb->get_results("SELECT ID, post_content, post_title, post_parent from {$wpdb->posts} WHERE post_type = 'tutor_question' AND post_parent = {$quiz_id} ORDER BY menu_order ASC ");
 
 
 
2291
 
2292
  if (is_array($questions) && count($questions)){
2293
  return $questions;
@@ -2295,11 +2768,48 @@ class Utils {
2295
  return false;
2296
  }
2297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2298
  public function get_question_types($type = null){
2299
  $types = array(
2300
- 'true_false' => __('True/False', 'tutor'),
2301
- 'multiple_choice' => __('Multiple Choice', 'tutor'),
2302
- 'single_choice' => __('Single Choice', 'tutor'),
 
 
 
 
 
 
 
 
 
2303
  );
2304
 
2305
  if (isset($types[$type])){
@@ -2333,12 +2843,32 @@ class Utils {
2333
  * @return int
2334
  *
2335
  * Get the next question order ID
 
 
2336
  */
2337
 
2338
  public function quiz_next_question_order_id($quiz_id){
2339
  global $wpdb;
2340
 
2341
- $last_order = (int) $wpdb->get_var("SELECT MAX(menu_order) FROM {$wpdb->posts} WHERE post_parent = {$quiz_id} AND post_type = 'tutor_question';");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2342
  return $last_order + 1;
2343
  }
2344
 
@@ -2349,6 +2879,17 @@ class Utils {
2349
  return $quiz_id;
2350
  }
2351
 
 
 
 
 
 
 
 
 
 
 
 
2352
  public function get_unattached_quiz($config = array()){
2353
  global $wpdb;
2354
 
@@ -2379,6 +2920,8 @@ class Utils {
2379
  * @param int $post_id
2380
  *
2381
  * @return array|bool|null|object
 
 
2382
  */
2383
  public function get_attached_quiz($post_id = 0){
2384
  global $wpdb;
@@ -2393,6 +2936,15 @@ class Utils {
2393
  return false;
2394
  }
2395
 
 
 
 
 
 
 
 
 
 
2396
 
2397
  public function get_course_by_quiz($quiz_id){
2398
  global $wpdb;
@@ -2425,6 +2977,8 @@ class Utils {
2425
  * @param $quiz_id
2426
  *
2427
  * @return int
 
 
2428
  */
2429
  public function total_questions_for_student_by_quiz($quiz_id){
2430
  $quiz_id = $this->get_post_id($quiz_id);
@@ -2435,27 +2989,23 @@ class Utils {
2435
  return $total_question;
2436
  }
2437
 
 
 
 
 
 
 
 
 
 
 
2438
  public function is_started_quiz($quiz_id = 0){
2439
  global $wpdb;
2440
 
2441
  $quiz_id = $this->get_post_id($quiz_id);
2442
  $user_id = get_current_user_id();
2443
 
2444
- $is_started = $wpdb->get_row("SELECT
2445
- comment_ID,
2446
- comment_post_ID,
2447
- comment_author,
2448
- comment_date as quiz_started_at,
2449
- comment_date_gmt,
2450
- comment_approved as quiz_attempt_status,
2451
- comment_parent,
2452
- user_id
2453
-
2454
- FROM {$wpdb->comments}
2455
- WHERE user_id = {$user_id}
2456
- AND comment_type = 'tutor_quiz_attempt'
2457
- AND comment_approved = 'quiz_started'
2458
- AND comment_post_ID = {$quiz_id} ; ");
2459
 
2460
  return $is_started;
2461
  }
@@ -2468,13 +3018,15 @@ class Utils {
2468
  * but student will answer a specific amount of questions
2469
  *
2470
  * @return int
 
 
2471
  */
2472
 
2473
  public function max_questions_for_take_quiz($quiz_id){
2474
  $quiz_id = $this->get_post_id($quiz_id);
2475
  global $wpdb;
2476
 
2477
- $max_questions = (int) $wpdb->get_var("select count(ID) from {$wpdb->posts} where post_parent = {$quiz_id} AND post_type = 'tutor_question' ");
2478
  $max_mentioned = (int) $this->get_quiz_option($quiz_id, 'max_questions_for_answer', 10);
2479
 
2480
  if ($max_mentioned < $max_questions ){
@@ -2484,31 +3036,48 @@ class Utils {
2484
  return $max_questions;
2485
  }
2486
 
 
 
 
 
 
 
 
 
 
2487
  public function get_attempt($attempt_id = 0){
2488
  global $wpdb;
2489
-
2490
- $attempt = $wpdb->get_row("SELECT
2491
- comment_ID,
2492
- comment_post_ID,
2493
- comment_author,
2494
- comment_date as quiz_started_at,
2495
- comment_date_gmt,
2496
- comment_approved as quiz_attempt_status,
2497
- comment_parent,
2498
- user_id
2499
-
2500
- FROM {$wpdb->comments}
2501
- WHERE comment_type = 'tutor_quiz_attempt'
2502
- AND comment_ID = {$attempt_id} ;");
2503
-
2504
  return $attempt;
2505
  }
2506
 
2507
- public function quiz_attempt_info($quiz_attempt_id){
2508
- $attempt_info = get_comment_meta($quiz_attempt_id, 'quiz_attempt_info', true);
2509
- return $attempt_info;
 
 
 
 
 
 
 
 
 
2510
  }
2511
 
 
 
 
 
 
 
 
 
 
 
2512
  public function quiz_update_attempt_info($quiz_attempt_id, $attempt_info = array()){
2513
  $answers = tutor_utils()->avalue_dot('answers', $attempt_info);
2514
  $total_marks = array_sum(wp_list_pluck($answers, 'question_mark'));
@@ -2519,28 +3088,77 @@ class Utils {
2519
  return update_comment_meta($quiz_attempt_id,'quiz_attempt_info', $attempt_info);
2520
  }
2521
 
2522
- public function get_rand_single_question_by_quiz_for_student($quiz_id = 0){
 
 
 
 
 
 
 
 
 
 
2523
  global $wpdb;
2524
 
2525
  $quiz_id = $this->get_post_id($quiz_id);
2526
-
2527
  $is_attempt = $this->is_started_quiz($quiz_id);
2528
- $attempted_question_ids = array();
2529
- if ($is_attempt){
2530
- $attempt_info = $this->quiz_attempt_info($is_attempt->comment_ID);
2531
- $attempted_question_ids = wp_list_pluck($this->avalue_dot('answers', $attempt_info),'questionID');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2532
  }
2533
- $attempted_question_ids_string = implode(",", $attempted_question_ids);
2534
 
2535
- $not_in_sql = "";
2536
- if (is_array($attempted_question_ids) && count($attempted_question_ids)){
2537
- $not_in_sql = " AND ID NOT IN({$attempted_question_ids_string}) ";
2538
  }
2539
 
2540
- $question = $wpdb->get_row("SELECT ID, post_content, post_title, post_parent
2541
- from {$wpdb->posts} WHERE post_type = 'tutor_question' AND post_parent = {$quiz_id} {$not_in_sql} ORDER BY RAND() ;");
 
2542
 
2543
- return $question;
 
 
2544
  }
2545
 
2546
  /**
@@ -2550,6 +3168,8 @@ class Utils {
2550
  * @return array|bool|null|object
2551
  *
2552
  * Get all of the attempts by an user of a quiz
 
 
2553
  */
2554
 
2555
  public function quiz_attempts($quiz_id = 0, $user_id = 0){
@@ -2558,28 +3178,7 @@ class Utils {
2558
  $quiz_id = $this->get_post_id($quiz_id);
2559
  $user_id = $this->get_user_id($user_id);
2560
 
2561
- $attempts = $wpdb->get_results("SELECT
2562
- {$wpdb->comments}.comment_ID,
2563
- comment_post_ID,
2564
- comment_author,
2565
- comment_date as quiz_started_at,
2566
- comment_date_gmt,
2567
- comment_approved as quiz_attempt_status,
2568
- comment_parent,
2569
- user_id,
2570
-
2571
- attempt_info.meta_value as quiz_attempt_info,
2572
- pass_mark.meta_value as pass_mark_percent
2573
-
2574
- FROM {$wpdb->comments}
2575
-
2576
- LEFT JOIN {$wpdb->commentmeta} attempt_info ON {$wpdb->comments}.comment_ID = attempt_info.comment_id AND attempt_info.meta_key = 'quiz_attempt_info'
2577
- LEFT JOIN {$wpdb->commentmeta} pass_mark ON {$wpdb->comments}.comment_ID = pass_mark.comment_id AND pass_mark.meta_key = 'pass_mark_percent'
2578
-
2579
- WHERE user_id = {$user_id}
2580
- AND comment_type = 'tutor_quiz_attempt'
2581
- AND comment_approved != 'quiz_started'
2582
- AND comment_post_ID = {$quiz_id} ; ");
2583
 
2584
  if (is_array($attempts) && count($attempts)){
2585
  return $attempts;
@@ -2588,6 +3187,16 @@ class Utils {
2588
  return false;
2589
  }
2590
 
 
 
 
 
 
 
 
 
 
 
2591
  public function get_total_quiz_attempts($search_term = ''){
2592
  global $wpdb;
2593
 
@@ -2595,18 +3204,28 @@ class Utils {
2595
  $search_term = " AND ( user_email like '%{$search_term}%' OR display_name like '%{$search_term}%' OR post_title like '%{$search_term}%' ) ";
2596
  }
2597
 
2598
- $count = $wpdb->get_var("SELECT COUNT({$wpdb->comments}.comment_ID) FROM {$wpdb->comments}
2599
- INNER JOIN {$wpdb->posts}
2600
- ON {$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID
2601
-
2602
- INNER JOIN {$wpdb->users}
2603
- ON {$wpdb->comments}.user_id = {$wpdb->users}.ID
2604
-
2605
- WHERE comment_type = 'tutor_quiz_attempt' {$search_term} ");
2606
-
2607
  return (int) $count;
2608
  }
2609
 
 
 
 
 
 
 
 
 
 
 
 
 
2610
  public function get_quiz_attempts($start = 0, $limit = 10, $search_term = '') {
2611
  global $wpdb;
2612
 
@@ -2614,42 +3233,75 @@ class Utils {
2614
  $search_term = " AND ( user_email like '%{$search_term}%' OR display_name like '%{$search_term}%' OR post_title like '%{$search_term}%' ) ";
2615
  }
2616
 
2617
- $query = $wpdb->get_results("SELECT
2618
- {$wpdb->comments}.comment_ID,
2619
- {$wpdb->comments}.comment_post_ID,
2620
- {$wpdb->comments}.comment_author,
2621
- {$wpdb->comments}.comment_date,
2622
- {$wpdb->comments}.comment_content,
2623
- {$wpdb->comments}.comment_approved as attempt_status,
2624
- {$wpdb->comments}.user_id,
2625
- {$wpdb->users}.display_name,
2626
- {$wpdb->users}.user_email,
2627
- {$wpdb->posts}.post_title,
2628
-
2629
- attempt_info.meta_value as quiz_attempt_info,
2630
- pass_mark.meta_value as pass_mark_percent,
2631
-
2632
- (SELECT COUNT(answers_t.comment_ID) FROM {$wpdb->comments} answers_t
2633
- WHERE answers_t.comment_parent = {$wpdb->comments}.comment_ID ) as answer_count
2634
-
2635
- FROM {$wpdb->comments}
2636
-
2637
- INNER JOIN {$wpdb->posts}
2638
- ON {$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID
2639
-
2640
  INNER JOIN {$wpdb->users}
2641
- ON {$wpdb->comments}.user_id = {$wpdb->users}.ID
2642
-
2643
- LEFT JOIN {$wpdb->commentmeta} attempt_info ON {$wpdb->comments}.comment_ID = attempt_info.comment_id AND attempt_info.meta_key = 'quiz_attempt_info'
2644
- LEFT JOIN {$wpdb->commentmeta} pass_mark ON {$wpdb->comments}.comment_ID = pass_mark.comment_id AND pass_mark.meta_key = 'pass_mark_percent'
2645
-
2646
- WHERE {$wpdb->comments}.comment_type = 'tutor_quiz_attempt' {$search_term}
2647
- ORDER BY {$wpdb->comments}.comment_ID DESC
2648
  LIMIT {$start},{$limit}; ");
2649
-
2650
  return $query;
2651
  }
2652
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2653
  public function get_quiz_answers_by_ids($ids){
2654
  $ids = (array) $ids;
2655
 
@@ -2679,6 +3331,8 @@ class Utils {
2679
  * @return mixed
2680
  *
2681
  * Get the users / students / course levels
 
 
2682
  */
2683
 
2684
  public function course_levels($level = null){
@@ -2700,6 +3354,13 @@ class Utils {
2700
  return $levels;
2701
  }
2702
 
 
 
 
 
 
 
 
2703
  public function user_profile_permalinks(){
2704
  $permalinks = array(
2705
  'enrolled_course' => __('Enrolled Course', 'tutor'),
@@ -2710,6 +3371,13 @@ class Utils {
2710
  return apply_filters('tutor_public_profile/permalinks', $permalinks);
2711
  }
2712
 
 
 
 
 
 
 
 
2713
  public function student_register_url(){
2714
  $student_register_page = (int) $this->get_option('student_register_page');
2715
 
@@ -2719,6 +3387,11 @@ class Utils {
2719
  return false;
2720
  }
2721
 
 
 
 
 
 
2722
  public function tutor_dashboard_url(){
2723
  $page_id = (int) tutor_utils()->get_option('student_dashboard');
2724
  $page_id = apply_filters('tutor_dashboard_url', $page_id);
@@ -2732,6 +3405,8 @@ class Utils {
2732
  * @return bool
2733
  *
2734
  * is_wishlisted();
 
 
2735
  */
2736
  public function is_wishlisted($course_id = 0, $user_id = 0){
2737
  $course_id = $this->get_post_id($course_id);
@@ -2752,6 +3427,8 @@ class Utils {
2752
  * @return array|null|object
2753
  *
2754
  * Get the wish lists by an user
 
 
2755
  */
2756
  public function get_wishlist($user_id = 0){
2757
  $user_id = $this->get_user_id($user_id);
@@ -2773,6 +3450,8 @@ class Utils {
2773
  * @return array|null|object
2774
  *
2775
  * Getting popular courses
 
 
2776
  */
2777
  public function most_popular_courses($limit = 10){
2778
  global $wpdb;
@@ -2797,6 +3476,8 @@ class Utils {
2797
  * @return array|bool|null|object
2798
  *
2799
  * Get most rated courses lists
 
 
2800
  */
2801
  public function most_rated_courses($limit = 10){
2802
  global $wpdb;
@@ -2818,7 +3499,15 @@ class Utils {
2818
  return false;
2819
  }
2820
 
2821
-
 
 
 
 
 
 
 
 
2822
  public function get_addon_config($addon_field = null){
2823
  if ( ! $addon_field){
2824
  return false;
@@ -2826,7 +3515,6 @@ class Utils {
2826
 
2827
  $addonsConfig = maybe_unserialize(get_option('tutor_addons_config'));
2828
 
2829
-
2830
  if (isset($addonsConfig[$addon_field])){
2831
  return $addonsConfig[$addon_field];
2832
  }
@@ -2834,5 +3522,30 @@ class Utils {
2834
  return false;
2835
  }
2836
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2837
 
2838
  }
51
  * @param bool $value
52
  *
53
  * Update Option
54
+ *
55
+ * @since v.1.0.0
56
  */
57
 
58
  public function update_option($key = null, $value = false){
96
  * @return array
97
  *
98
  * Get all pages
99
+ *
100
+ * @since v.1.0.0
101
  */
102
  public function get_pages(){
103
  $pages = array();
114
  * @return string
115
  *
116
  * Get course archive URL
117
+ *
118
+ * @since v.1.0.0
119
  */
120
  public function course_archive_page_url(){
121
  $course_post_type = tutor()->course_post_type;
134
  * @return string
135
  *
136
  * Get student URL
137
+ *
138
+ * @since v.1.0.0
139
  */
140
 
141
  public function profile_url($student_id = 0){
162
  * @return array|null|object
163
  *
164
  * Get user by user login
165
+ *
166
+ * @since v.1.0.0
167
  */
168
  public function get_user_by_login($user_login = ''){
169
  global $wpdb;
176
  * @return bool
177
  *
178
  * Check if WooCommerce Activated
179
+ *
180
+ * @since v.1.0.0
181
  */
182
 
183
  public function has_wc(){
189
  return $has;
190
  }
191
 
192
+ /**
193
+ * @return bool
194
+ *
195
+ * determine if EDD plugin activated
196
+ *
197
+ * @since v.1.0.0
198
+ */
199
  public function has_edd(){
200
  $activated_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ));
201
  //$depends = array('easy-digital-downloads/easy-digital-downloads.php', 'tutor-edd/tutor-edd.php');
208
  /**
209
  * @return mixed
210
  *
211
+ * @since v.1.0.0
212
  */
213
  public function languages(){
214
  $language_codes = array(
352
  return apply_filters('tutor/utils/languages', $language_codes);
353
  }
354
 
355
+
356
+ /**
357
+ * @param string $value
358
+ *
359
+ * Check raw data
360
+ *
361
+ * @since v.1.0.0
362
+ */
363
  public function print_view($value = ''){
364
  echo '<pre>';
365
  print_r($value);
366
  echo '</pre>';
367
  }
368
 
369
+ /**
370
+ * @param array $excludes
371
+ *
372
+ * @return array|null|object
373
+ *
374
+ * Get courses
375
+ *
376
+ * @since v.1.0.0
377
+ */
378
+
379
  public function get_courses($excludes = array()){
380
  global $wpdb;
381
 
394
  return $query;
395
  }
396
 
397
+ /**
398
+ * @param int $instructor_id
399
+ *
400
+ * @return array|null|object
401
+ *
402
+ * Get courses for instructors
403
+ *
404
+ * @since v.1.0.0
405
+ */
406
  public function get_courses_for_instructors($instructor_id = 0){
407
  global $wpdb;
408
 
417
  return $query;
418
  }
419
 
420
+ /**
421
+ * @param $instructor_id
422
+ *
423
+ * @return null|string
424
+ *
425
+ * Get course count by instructor
426
+ *
427
+ * @since v.1.0.0
428
+ */
429
+
430
  public function get_course_count_by_instructor($instructor_id){
431
  global $wpdb;
432
 
439
  return $count;
440
  }
441
 
442
+ /**
443
+ * @param $instructor_id
444
+ *
445
+ * @return array|null|object
446
+ *
447
+ * Get courses by a instructor
448
+ *
449
+ * @since v.1.0.0
450
+ */
451
  public function get_courses_by_instructor($instructor_id){
452
  global $wpdb;
453
 
468
  return $pageposts;
469
  }
470
 
471
+ /**
472
+ * @return mixed
473
+ *
474
+ * Get archive page course count
475
+ *
476
+ * @since v.1.0.0
477
+ */
478
  public function get_archive_page_course_count(){
479
  global $wp_query;
480
  return $wp_query->post_count;
481
  }
482
 
483
+ /**
484
+ * @return null|string
485
+ *
486
+ * Get course count
487
+ *
488
+ * @since v.1.0.0
489
+ */
490
  public function get_course_count(){
491
  global $wpdb;
492
 
495
  return $count;
496
  }
497
 
498
+ /**
499
+ * @return null|string
500
+ *
501
+ * Get lesson count
502
+ *
503
+ * @since v.1.0.0
504
+ */
505
  public function get_lesson_count(){
506
  global $wpdb;
507
 
510
  return $count;
511
  }
512
 
513
+ /**
514
+ * @param int $course_id
515
+ * @param int $limit
516
+ *
517
+ * @return \WP_Query
518
+ *
519
+ * Get lesson
520
+ *
521
+ * @since v.1.0.0
522
+ */
523
  public function get_lesson($course_id = 0, $limit = 10){
524
  $course_id = $this->get_post_id($course_id);
525
 
541
  return $query;
542
  }
543
 
544
+ /**
545
+ * @param int $course_id
546
+ *
547
+ * @return int
548
+ *
549
+ * Get total lesson count by a course
550
+ *
551
+ * @since v.1.0.0
552
+ */
553
  public function get_lesson_count_by_course($course_id = 0){
554
  $course_id = $this->get_post_id($course_id);
555
  global $wpdb;
559
  return (int) $count_lesson;
560
  }
561
 
562
+ /**
563
+ * @param int $course_id
564
+ * @param int $user_id
565
+ *
566
+ * @return int
567
+ *
568
+ * Get completed lesson total number by a course
569
+ *
570
+ * @since v.1.0.0
571
+ */
572
  public function get_completed_lesson_count_by_course($course_id = 0, $user_id = 0){
573
  $course_id = $this->get_post_id($course_id);
574
  $user_id = $this->get_user_id($user_id);
596
  *
597
  * @return float|int
598
  *
599
+ * @since v.1.0.0
600
  */
601
  public function get_course_completed_percent($course_id = 0, $user_id = 0){
602
  $course_id = $this->get_post_id($course_id);
612
  return 0;
613
  }
614
 
615
+ /**
616
+ * @param int $course_id
617
+ *
618
+ * @return \WP_Query
619
+ *
620
+ * Get all topics by given course ID
621
+ *
622
+ * @since v.1.0.0
623
+ */
624
  public function get_topics($course_id = 0){
625
  $course_id = $this->get_post_id($course_id);
626
 
636
  return $query;
637
  }
638
 
639
+ /**
640
+ * @param $course_ID
641
+ *
642
+ * @return int
643
+ *
644
+ * Get next topic order id
645
+ *
646
+ * @since v.1.0.0
647
+ */
648
  public function get_next_topic_order_id($course_ID){
649
  global $wpdb;
650
 
652
  return $last_order + 1;
653
  }
654
 
655
+ /**
656
+ * @param $topic_ID
657
+ *
658
+ * @return int
659
+ *
660
+ * Get next course content order id
661
+ *
662
+ * @since v.1.0.0
663
+ */
664
+ public function get_next_course_content_order_id($topic_ID){
665
+ global $wpdb;
666
+
667
+ $last_order = (int) $wpdb->get_var("SELECT MAX(menu_order) FROM {$wpdb->posts} WHERE post_parent = {$topic_ID};");
668
+ return $last_order + 1;
669
+ }
670
+
671
+ /**
672
+ * @param int $topics_id
673
+ * @param int $limit
674
+ *
675
+ * @return \WP_Query
676
+ *
677
+ * Get lesson by topic
678
+ *
679
+ * @since v.1.0.0
680
+ */
681
  public function get_lessons_by_topic($topics_id = 0, $limit = 10){
682
  $topics_id = $this->get_post_id($topics_id);
683
 
695
  return $query;
696
  }
697
 
698
+ /**
699
+ * @param int $topics_id
700
+ * @param int $limit
701
+ *
702
+ * @return \WP_Query
703
+ *
704
+ * Get course content by topic
705
+ *
706
+ * @since v.1.0.0
707
+ */
708
+ public function get_course_contents_by_topic($topics_id = 0, $limit = 10){
709
+ $topics_id = $this->get_post_id($topics_id);
710
+
711
+ $lesson_post_type = tutor()->lesson_post_type;
712
+ $args = array(
713
+ 'post_type' => array($lesson_post_type, 'tutor_quiz'),
714
+ 'post_parent' => $topics_id,
715
+ 'posts_per_page' => $limit,
716
+ 'orderby' => 'menu_order',
717
+ 'order' => 'ASC',
718
+ );
719
+
720
+ $query = new \WP_Query($args);
721
+
722
+ return $query;
723
+ }
724
+
725
+ /**
726
+ * @param string $request_method
727
+ *
728
+ * Check actions nonce
729
+ *
730
+ * @since v.1.0.0
731
+ */
732
  public function checking_nonce($request_method = 'post'){
733
  if ($request_method === 'post'){
734
  if (!isset($_POST[tutor()->nonce]) || !wp_verify_nonce($_POST[tutor()->nonce], tutor()->nonce_action)) {
810
  return false;
811
  }
812
 
813
+ /**
814
+ * @param int $course_id
815
+ * @param int $user_id
816
+ *
817
+ * @return array|bool|null|object|void
818
+ *
819
+ * Has any enrolled for a user in a course
820
+ *
821
+ * @since v.1.0.0
822
+ */
823
  public function has_any_enrolled($course_id = 0, $user_id = 0){
824
  $course_id = $this->get_post_id($course_id);
825
  $user_id = $this->get_user_id($user_id);
905
  return false;
906
  }
907
 
908
+ /**
909
  *
910
  * Get course sub pages in course dashboard
911
  *
1043
  * @return array
1044
  *
1045
  * Get the playtime in array
1046
+ *
1047
+ * @since v.1.0.0
1048
  */
1049
  public function playtime_array($seconds){
1050
  $run_time_format = array(
1073
  return $run_time_format;
1074
  }
1075
 
1076
+ /**
1077
+ * @param $seconds
1078
+ *
1079
+ * @return string
1080
+ *
1081
+ * Convert seconds to human readable time
1082
+ *
1083
+ * @since v.1.0.0
1084
+ */
1085
  public function seconds_to_time_context($seconds) {
1086
  $sign = (($seconds < 0) ? '-' : '');
1087
  $seconds = round(abs($seconds));
1154
  * @return bool
1155
  *
1156
  * Ensure if attached video is self hosted or not
1157
+ *
1158
+ * @since v.1.0.0
1159
  */
1160
  public function is_html5_video($post_id = 0){
1161
  $post_id = $this->get_post_id($post_id);
1232
  * @return array|bool|null|object|void
1233
  *
1234
  * Determine if a course completed
1235
+ *
1236
+ * @since v.1.0.0
1237
  */
1238
 
1239
  public function is_completed_course($course_id = 0, $user_id = 0){
1265
  * @return array
1266
  *
1267
  * Sanitize input array
1268
+ *
1269
+ * @since v.1.0.0
1270
  */
1271
  public function sanitize_array($input = array()){
1272
  $array = array();
1286
  return $array;
1287
  }
1288
 
1289
+ /**
1290
+ * @param int $post_id
1291
+ *
1292
+ * @return array|bool
1293
+ *
1294
+ * Determine if has any video in single
1295
+ *
1296
+ * @since v.1.0.0
1297
+ */
1298
+
1299
  public function has_video_in_single($post_id = 0){
1300
  if (is_single()) {
1301
  $post_id = $this->get_post_id($post_id);
1350
  *
1351
  * get the total students
1352
  * pass course id to get course wise total students
1353
+ *
1354
+ * @since v.1.0.0
1355
  */
1356
  public function get_total_students($search_term = ''){
1357
  $meta_key = '_is_tutor_student';
1367
  return (int) $count;
1368
  }
1369
 
1370
+ /**
1371
+ * @param int $user_id
1372
+ *
1373
+ * @return array
1374
+ *
1375
+ * Get complete courses ids by user
1376
+ *
1377
+ * @since v.1.0.0
1378
+ */
1379
  public function get_completed_courses_ids_by_user($user_id = 0){
1380
  global $wpdb;
1381
 
1396
  * @return bool|\WP_Query
1397
  *
1398
  * Return courses by user_id
1399
+ *
1400
+ * @since v.1.0.0
1401
  */
1402
  public function get_courses_by_user($user_id = 0){
1403
  $user_id = $this->get_user_id($user_id);
1423
  * @return bool|\WP_Query
1424
  *
1425
  * Get the active course by user
1426
+ *
1427
+ * @since v.1.0.0
1428
  */
1429
 
1430
  public function get_active_courses_by_user($user_id = 0){
1448
  return false;
1449
  }
1450
 
1451
+ /**
1452
+ * @param int $user_id
1453
+ *
1454
+ * @return array
1455
+ *
1456
+ * Get enrolled course ids by a user
1457
+ *
1458
+ * @since v.1.0.0
1459
+ */
1460
+
1461
  public function get_enrolled_courses_ids_by_user($user_id = 0){
1462
  global $wpdb;
1463
  $user_id = $this->get_user_id($user_id);
1547
  return $this->avalue_dot($lesson_id, $lesson_info);
1548
  }
1549
 
1550
+ /**
1551
+ * @param int $post_id
1552
+ *
1553
+ * @return bool|false|int
1554
+ *
1555
+ * Get current post id or given post id
1556
+ *
1557
+ * @since v.1.0.0
1558
+ */
1559
  public function get_post_id($post_id = 0){
1560
  if ( ! $post_id){
1561
  $post_id = get_the_ID();
1567
  return $post_id;
1568
  }
1569
 
1570
+ /**
1571
+ * @param int $user_id
1572
+ *
1573
+ * @return bool|int
1574
+ *
1575
+ * Get current user or given user ID
1576
+ *
1577
+ * @since v.1.0.0
1578
+ */
1579
  public function get_user_id($user_id = 0){
1580
  if ( ! $user_id){
1581
  $user_id = get_current_user_id();
1675
  * @param int $post_id
1676
  *
1677
  * Mark lesson complete
1678
+ *
1679
+ * @since v.1.0.0
1680
  */
1681
  public function mark_lesson_complete($post_id = 0, $user_id = 0){
1682
  $post_id = $this->get_post_id($post_id);
1691
  *
1692
  * @type: call when need
1693
  * @return bool;
1694
+ *
1695
+ * @since v.1.0.0
1696
  */
1697
  public function do_enroll($course_id = 0, $order_id = 0){
1698
  if ( ! $course_id){
1744
  return false;
1745
  }
1746
 
1747
+ /**
1748
+ * @param $order_id
1749
+ *
1750
+ * Complete course enrollment and do some task
1751
+ *
1752
+ * @since v.1.0.0
1753
+ */
1754
  public function complete_course_enroll($order_id){
1755
  if ( ! tutor_utils()->is_tutor_order($order_id)){
1756
  return;
1774
  * @param $order_id
1775
  *
1776
  * @return array|bool
1777
+ *
1778
+ * @since v.1.0.0
1779
  */
1780
  public function get_course_enrolled_ids_by_order_id($order_id){
1781
  global $wpdb;
1813
  return $query;
1814
  }
1815
 
1816
+ /**
1817
+ * @param int $course_id
1818
+ *
1819
+ * @return int
1820
+ *
1821
+ * Get course productID
1822
+ *
1823
+ * @since v.1.0.0
1824
+ */
1825
  public function get_course_product_id($course_id = 0){
1826
  $course_id = $this->get_post_id($course_id);
1827
  return (int) get_post_meta($course_id, '_tutor_course_product_id', true);
1828
  }
1829
 
1830
+ /**
1831
+ * @param int $product_id
1832
+ *
1833
+ * @return array|null|object|void
1834
+ *
1835
+ * Get Product belongs with course
1836
+ *
1837
+ * @since v.1.0.0
1838
+ */
1839
+
1840
+ public function product_belongs_with_course($product_id = 0){
1841
+ global $wpdb;
1842
 
1843
  $query = $wpdb->get_row("select * from {$wpdb->postmeta} WHERE meta_key='_tutor_course_product_id' AND meta_value = {$product_id} limit 1 ");
1844
  return $query;
1846
 
1847
  /**
1848
  * #End WooCommerce specific utils
1849
+ *
1850
+ * @since v.1.0.0
1851
  */
1852
 
1853
  public function get_enrolled_statuses(){
1862
  );
1863
  }
1864
 
1865
+ /**
1866
+ * @param $order_id
1867
+ *
1868
+ * @return mixed
1869
+ *
1870
+ * determine is this a tutor order
1871
+ *
1872
+ * @since v.1.0.0
1873
+ */
1874
  public function is_tutor_order($order_id){
1875
  return get_post_meta($order_id, '_is_tutor_order_for_course', true);
1876
  }
1879
  * @return mixed
1880
  *
1881
  * Tutor Dashboard Pages
1882
+ *
1883
+ * @since v.1.0.0
1884
  */
1885
 
1886
  public function tutor_student_dashboard_pages(){
1895
  return apply_filters('tutor_dashboard/student/pages', $nav_items);
1896
  }
1897
 
1898
+ /**
1899
+ * @param string $page_key
1900
+ * @param int $page_id
1901
+ *
1902
+ * @return string
1903
+ *
1904
+ * Get tutor dashboard page single URL
1905
+ *
1906
+ * @since v.1.0.0
1907
+ */
1908
  public function get_tutor_dashboard_page_permalink($page_key = '', $page_id = 0){
1909
  if ($page_key === 'index'){
1910
  $page_key = '';
1913
  return trailingslashit(get_permalink($page_id)).$page_key;
1914
  }
1915
 
1916
+ /**
1917
+ * @param string $input
1918
+ *
1919
+ * @return array|bool|mixed|string
1920
+ *
1921
+ * Get old input
1922
+ *
1923
+ * @since v.1.0.0
1924
+ */
1925
  public function input_old($input = ''){
1926
  $value = $this->avalue_dot($input, $_REQUEST);
1927
  if ($value){
1944
  return get_user_meta($user_id, '_is_tutor_instructor', true);
1945
  }
1946
 
1947
+ /**
1948
+ * @param int $user_id
1949
+ * @param bool $status_name
1950
+ *
1951
+ * @return bool|mixed
1952
+ *
1953
+ * Instructor status
1954
+ *
1955
+ * @since v.1.0.0
1956
+ */
1957
  public function instructor_status($user_id = 0, $status_name = true){
1958
  $user_id = $this->get_user_id($user_id);
1959
 
1974
  return false;
1975
  }
1976
 
1977
+ /**
1978
+ * @param string $search_term
1979
+ *
1980
+ * @return int
1981
+ *
1982
+ * Get total number of instructors
1983
+ *
1984
+ * @since v.1.0.0
1985
+ */
1986
 
1987
  public function get_total_instructors($search_term = ''){
1988
  $meta_key = '_is_tutor_instructor';
1998
  return (int) $count;
1999
  }
2000
 
2001
+ /**
2002
+ * @param int $start
2003
+ * @param int $limit
2004
+ * @param string $search_term
2005
+ *
2006
+ * @return array|null|object
2007
+ *
2008
+ * Get all instructors
2009
+ *
2010
+ * @since v.1.0.0
2011
+ */
2012
  public function get_instructors($start = 0, $limit = 10, $search_term = ''){
2013
  $meta_key = '_is_tutor_instructor';
2014
  global $wpdb;
2027
  return $instructors;
2028
  }
2029
 
2030
+ /**
2031
+ * @param int $course_id
2032
+ *
2033
+ * @return array|bool|null|object
2034
+ *
2035
+ * Get all instructors by course
2036
+ *
2037
+ * @since v.1.0.0
2038
+ */
2039
  public function get_instructors_by_course($course_id = 0){
2040
  global $wpdb;
2041
  $course_id = $this->get_post_id($course_id);
2065
  * Get total Students by instructor
2066
  * 1 enrollment = 1 student, so total enrolled for a equivalent total students (Tricks)
2067
  *
2068
+ * @return int
2069
+ *
2070
  * @since v.1.0.0
2071
  */
2072
+
2073
  public function get_total_students_by_instructor($instructor_id){
2074
  global $wpdb;
2075
 
2089
  * @return float|string
2090
  *
2091
  * Get rating format from value
2092
+ *
2093
+ * @since v.1.0.0
2094
  */
2095
  public function get_rating_value($input = 0.00){
2096
 
2119
  * @return string
2120
  *
2121
  * Generate star rating based in given rating value
2122
+ *
2123
+ * @since v.1.0.0
2124
  */
2125
  public function star_rating_generator($current_rating = 0.00, $echo = true){
2126
  $output = '';
2151
  * @return string
2152
  *
2153
  * Generate text to avatar
2154
+ *
2155
+ * @since v.1.0.0
2156
  */
2157
  public function get_tutor_avatar($user_id = null, $size = 'thumbnail'){
2158
  global $wpdb;
2185
  return $initial_avatar;
2186
  }
2187
 
2188
+ /**
2189
+ * @param $user_id
2190
+ *
2191
+ * @return array|null|object|void
2192
+ *
2193
+ * Get tutor user
2194
+ *
2195
+ * @since v.1.0.0
2196
+ */
2197
+
2198
  public function get_tutor_user($user_id){
2199
  global $wpdb;
2200
 
2255
  * @return object
2256
  *
2257
  * Get course rating
2258
+ *
2259
+ * @since v.1.0.0
2260
  */
2261
  public function get_course_rating($course_id = 0){
2262
  $course_id = $this->get_post_id($course_id);
2289
  return (object) $ratings;
2290
  }
2291
 
2292
+ /**
2293
+ * @param int $user_id
2294
+ * @param int $offset
2295
+ * @param int $limit
2296
+ *
2297
+ * @return array|null|object
2298
+ *
2299
+ * Get reviews by a user
2300
+ *
2301
+ * @since v.1.0.0
2302
+ */
2303
  public function get_reviews_by_user($user_id = 0, $offset = 0, $limit = 150){
2304
  $user_id = $this->get_user_id($user_id);
2305
  global $wpdb;
2332
  * @return object
2333
  *
2334
  * Get instructors rating
2335
+ *
2336
+ * @since v.1.0.0
2337
  */
2338
  public function get_instructor_ratings($instructor_id){
2339
  global $wpdb;
2370
  * @return object
2371
  *
2372
  * Get course rating by user
2373
+ *
2374
+ * @since v.1.0.0
2375
  */
2376
  public function get_course_rating_by_user($course_id = 0, $user_id = 0){
2377
  $course_id = $this->get_post_id($course_id);
2406
  * @param int $user_id
2407
  *
2408
  * @return null|string
2409
+ *
2410
+ * @since v.1.0.0
2411
  */
2412
  public function count_reviews_wrote_by_user($user_id = 0){
2413
  global $wpdb;
2423
  * @return bool|int|string
2424
  *
2425
  * This function transforms the php.ini notation for numbers (like '2M') to an integer.
2426
+ *
2427
+ * @since v.1.0.0
2428
  */
2429
 
2430
  function let_to_num( $size ) {
2452
  return $ret;
2453
  }
2454
 
2455
+ /**
2456
+ * @return array
2457
+ *
2458
+ * Get Database version
2459
+ *
2460
+ * @since v.1.0.0
2461
+ */
2462
  function get_db_version() {
2463
  global $wpdb;
2464
 
2485
  return '<span class="tutor-help-tip" data-tip="' . $tip . '"></span>';
2486
  }
2487
 
2488
+ /**
2489
+ * @param int $course_id
2490
+ * @param int $user_id
2491
+ * @param int $offset
2492
+ * @param int $limit
2493
+ *
2494
+ * @return array|null|object
2495
+ *
2496
+ * Get top question
2497
+ *
2498
+ * @since v.1.0.0
2499
+ */
2500
  public function get_top_question($course_id = 0, $user_id = 0, $offset = 0, $limit = 20){
2501
  $course_id = $this->get_post_id($course_id);
2502
  $user_id = $this->get_user_id($user_id);
2526
  return $questions;
2527
  }
2528
 
2529
+ /**
2530
+ * @param string $search_term
2531
+ *
2532
+ * @return int
2533
+ *
2534
+ * Get total number of Q&A questions
2535
+ *
2536
+ * @since v.1.0.0
2537
+ */
2538
  public function get_total_qa_question($search_term = ''){
2539
  global $wpdb;
2540
 
2601
  return $query;
2602
  }
2603
 
2604
+ /**
2605
+ * @param $question_id
2606
+ *
2607
+ * @return array|null|object|void
2608
+ *
2609
+ * Get question for Q&A
2610
+ *
2611
+ * @since v.1.0.0
2612
+ */
2613
  public function get_qa_question($question_id){
2614
  global $wpdb;
2615
  $query = $wpdb->get_row("SELECT
2637
  return $query;
2638
  }
2639
 
2640
+ /**
2641
+ * @param $question_id
2642
+ *
2643
+ * @return array|null|object
2644
+ *
2645
+ * Get question and asnwer by question
2646
+ */
2647
  public function get_qa_answer_by_question($question_id){
2648
  global $wpdb;
2649
  $query = $wpdb->get_results("SELECT
2698
  return $query;
2699
  }
2700
 
2701
+ /**
2702
+ * @param string $content
2703
+ *
2704
+ * @return mixed
2705
+ *
2706
+ * Announcement content
2707
+ *
2708
+ * @since v.1.0.0
2709
+ */
2710
+
2711
  public function announcement_content($content = ''){
2712
  $search = array('{user_display_name}');
2713
 
2734
  $post_id = $this->get_post_id($post_id);
2735
  $get_option_meta = maybe_unserialize(get_post_meta($post_id, 'tutor_quiz_option', true));
2736
 
2737
+ if ( ! $option_key && ! empty($get_option_meta)) {
2738
+ return $get_option_meta;
2739
+ }
2740
+
2741
+ $value = $this->avalue_dot( $option_key, $get_option_meta );
2742
+ if ( $value ) {
2743
  return $value;
2744
  }
2745
  return $default;
2757
  $quiz_id = $this->get_post_id($quiz_id);
2758
  global $wpdb;
2759
 
2760
+ //$questions = $wpdb->get_results("SELECT ID, post_content, post_title, post_parent from {$wpdb->posts} WHERE post_type = 'tutor_question'
2761
+ // AND post_parent = {$quiz_id} ORDER BY menu_order ASC ");
2762
+
2763
+ $questions = $wpdb->get_results("SELECT * from {$wpdb->prefix}tutor_quiz_questions WHERE quiz_id = {$quiz_id} ORDER BY question_order ASC ");
2764
 
2765
  if (is_array($questions) && count($questions)){
2766
  return $questions;
2768
  return false;
2769
  }
2770
 
2771
+ /**
2772
+ * @param int $question_id
2773
+ *
2774
+ * @return array|bool|object|void|null
2775
+ *
2776
+ * Get Quiz question by question id
2777
+ */
2778
+ public function get_quiz_question_by_id($question_id = 0){
2779
+ global $wpdb;
2780
+
2781
+ if ($question_id){
2782
+ $question = $wpdb->get_row("SELECT * from {$wpdb->prefix}tutor_quiz_questions WHERE question_id = {$question_id} LIMIT 0,1 ;");
2783
+ return $question;
2784
+ }
2785
+
2786
+ return false;
2787
+ }
2788
+
2789
+ /**
2790
+ * @param null $type
2791
+ *
2792
+ * @return array|mixed
2793
+ *
2794
+ * Get all question types
2795
+ *
2796
+ * @since v.1.0.0
2797
+ */
2798
+
2799
  public function get_question_types($type = null){
2800
  $types = array(
2801
+ 'true_false' => array('name' => __('True/False', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-yes-no"></i>'),
2802
+ 'single_choice' => array('name' => __('Single Choice', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-mark"></i>'),
2803
+ 'multiple_choice' => array('name' => __('Multiple Choice', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-multiple-choice"></i>'),
2804
+ 'open_ended' => array('name' => __('Open Ended/Essay', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-open-ended"></i>'),
2805
+ 'short_answer' => array('name' => __('Short Answer', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-short-ans"></i>'),
2806
+ 'fill_in_the_blank' => array('name' => __('Fill In The Blank', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-fill-gaps"></i>'),
2807
+ 'answer_sorting' => array('name' => __('Answer Sorting', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-answer-shorting"></i>'),
2808
+ 'assessment' => array('name' => __('Assessment', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-assesment"></i>'),
2809
+ 'matching' => array('name' => __('Matching', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-matching"></i>'),
2810
+ 'image_matching' => array('name' => __('Image Matching', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-image-matching"></i>'),
2811
+ 'image_answering' => array('name' => __('Image Answering', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-image-ans"></i>'),
2812
+ 'ordering' => array('name' => __('Ordering', 'tutor'), 'icon' => '<i class="tutor-icon-block tutor-icon-ordering"></i>'),
2813
  );
2814
 
2815
  if (isset($types[$type])){
2843
  * @return int
2844
  *
2845
  * Get the next question order ID
2846
+ *
2847
+ * @since v.1.0.0
2848
  */
2849
 
2850
  public function quiz_next_question_order_id($quiz_id){
2851
  global $wpdb;
2852
 
2853
+ //$last_order = (int) $wpdb->get_var("SELECT MAX(menu_order) FROM {$wpdb->posts} WHERE post_parent = {$quiz_id} AND post_type =
2854
+ // 'tutor_question';");
2855
+
2856
+ $last_order = (int) $wpdb->get_var("SELECT MAX(question_order) FROM {$wpdb->prefix}tutor_quiz_questions WHERE quiz_id = {$quiz_id} ;");
2857
+ return $last_order + 1;
2858
+ }
2859
+
2860
+ /**
2861
+ * @param $quiz_id
2862
+ *
2863
+ * @return int
2864
+ *
2865
+ * new design quiz question
2866
+ * @since v.1.0.0
2867
+ */
2868
+ public function quiz_next_question_id(){
2869
+ global $wpdb;
2870
+
2871
+ $last_order = (int) $wpdb->get_var("SELECT MAX(question_id) FROM {$wpdb->prefix}tutor_quiz_questions;");
2872
  return $last_order + 1;
2873
  }
2874
 
2879
  return $quiz_id;
2880
  }
2881
 
2882
+ /**
2883
+ * @param array $config
2884
+ *
2885
+ * @return array|bool|null|object
2886
+ *
2887
+ * It was used in previous quiz algorithm
2888
+ *
2889
+ * @deprecated
2890
+ *
2891
+ * @since v.1.0.0
2892
+ */
2893
  public function get_unattached_quiz($config = array()){
2894
  global $wpdb;
2895
 
2920
  * @param int $post_id
2921
  *
2922
  * @return array|bool|null|object
2923
+ *
2924
+ * @since v.1.0.0
2925
  */
2926
  public function get_attached_quiz($post_id = 0){
2927
  global $wpdb;
2936
  return false;
2937
  }
2938
 
2939
+ /**
2940
+ * @param $quiz_id
2941
+ *
2942
+ * @return array|bool|null|object|void
2943
+ *
2944
+ * Get course by quiz
2945
+ *
2946
+ * @since v.1.0.0
2947
+ */
2948
 
2949
  public function get_course_by_quiz($quiz_id){
2950
  global $wpdb;
2977
  * @param $quiz_id
2978
  *
2979
  * @return int
2980
+ *
2981
+ * @since v.1.0.0
2982
  */
2983
  public function total_questions_for_student_by_quiz($quiz_id){
2984
  $quiz_id = $this->get_post_id($quiz_id);
2989
  return $total_question;
2990
  }
2991
 
2992
+ /**
2993
+ * @param int $quiz_id
2994
+ *
2995
+ * @return array|null|object|void
2996
+ *
2997
+ * Determine if there is any started quiz exists
2998
+ *
2999
+ * @since v.1.0.0
3000
+ */
3001
+
3002
  public function is_started_quiz($quiz_id = 0){
3003
  global $wpdb;
3004
 
3005
  $quiz_id = $this->get_post_id($quiz_id);
3006
  $user_id = get_current_user_id();
3007
 
3008
+ $is_started = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_attempts WHERE user_id = {$user_id} AND quiz_id = {$quiz_id} AND attempt_status = 'attempt_started' ");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3009
 
3010
  return $is_started;
3011
  }
3018
  * but student will answer a specific amount of questions
3019
  *
3020
  * @return int
3021
+ *
3022
+ * @since v.1.0.0
3023
  */
3024
 
3025
  public function max_questions_for_take_quiz($quiz_id){
3026
  $quiz_id = $this->get_post_id($quiz_id);
3027
  global $wpdb;
3028
 
3029
+ $max_questions = (int) $wpdb->get_var("select count(question_id) from {$wpdb->prefix}tutor_quiz_questions where quiz_id = {$quiz_id} ");
3030
  $max_mentioned = (int) $this->get_quiz_option($quiz_id, 'max_questions_for_answer', 10);
3031
 
3032
  if ($max_mentioned < $max_questions ){
3036
  return $max_questions;
3037
  }
3038
 
3039
+ /**
3040
+ * @param int $attempt_id
3041
+ *
3042
+ * @return array|bool|null|object|void
3043
+ *
3044
+ * Get single quiz attempt
3045
+ *
3046
+ * @since v.1.0.0
3047
+ */
3048
  public function get_attempt($attempt_id = 0){
3049
  global $wpdb;
3050
+ if ( ! $attempt_id){
3051
+ return false;
3052
+ }
3053
+ $attempt = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_attempts WHERE attempt_id = {$attempt_id} ");
 
 
 
 
 
 
 
 
 
 
 
3054
  return $attempt;
3055
  }
3056
 
3057
+ /**
3058
+ * @param $attempt_info
3059
+ *
3060
+ * @return mixed
3061
+ *
3062
+ * Get unserialize attempt info
3063
+ *
3064
+ * @since v.1.0.0
3065
+ */
3066
+
3067
+ public function quiz_attempt_info($attempt_info){
3068
+ return maybe_unserialize($attempt_info);
3069
  }
3070
 
3071
+ /**
3072
+ * @param $quiz_attempt_id
3073
+ * @param array $attempt_info
3074
+ *
3075
+ * @return bool|int
3076
+ *
3077
+ * Update attempt for various action
3078
+ *
3079
+ * @since v.1.0.0
3080
+ */
3081
  public function quiz_update_attempt_info($quiz_attempt_id, $attempt_info = array()){
3082
  $answers = tutor_utils()->avalue_dot('answers', $attempt_info);
3083
  $total_marks = array_sum(wp_list_pluck($answers, 'question_mark'));
3088
  return update_comment_meta($quiz_attempt_id,'quiz_attempt_info', $attempt_info);
3089
  }
3090
 
3091
+ /**
3092
+ * @param int $quiz_id
3093
+ *
3094
+ * @return array|null|object
3095
+ *
3096
+ * Get random question by quiz id
3097
+ *
3098
+ * @since v.1.0.0
3099
+ */
3100
+
3101
+ public function get_random_question_by_quiz($quiz_id = 0){
3102
  global $wpdb;
3103
 
3104
  $quiz_id = $this->get_post_id($quiz_id);
 
3105
  $is_attempt = $this->is_started_quiz($quiz_id);
3106
+
3107
+ $tempSql = " AND question_type = 'matching' ";
3108
+ $questions = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_questions WHERE quiz_id = {$quiz_id} {$tempSql} ORDER BY RAND() LIMIT 0,1 ");
3109
+
3110
+ return $questions;
3111
+ }
3112
+
3113
+ /**
3114
+ * @param int $quiz_id
3115
+ *
3116
+ * @return array|null|object
3117
+ *
3118
+ * Get random questions by quiz
3119
+ */
3120
+ public function get_random_questions_by_quiz($quiz_id = 0){
3121
+ global $wpdb;
3122
+
3123
+ $quiz_id = $this->get_post_id($quiz_id);
3124
+ $quiz_limit = (int) $this->get_quiz_option($quiz_id, 'attempts_allowed');
3125
+
3126
+ $questions = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_questions WHERE quiz_id = {$quiz_id} ORDER BY RAND() LIMIT {$quiz_limit} ");
3127
+
3128
+ return $questions;
3129
+ }
3130
+
3131
+ /**
3132
+ * @param $question_id
3133
+ * @param bool $rand
3134
+ *
3135
+ * @return array|bool|null|object
3136
+ *
3137
+ * Get answers list by quiz question
3138
+ *
3139
+ * @since v.1.0.0
3140
+ */
3141
+ public function get_answers_by_quiz_question($question_id, $rand = false){
3142
+ global $wpdb;
3143
+
3144
+
3145
+ $question = $wpdb->get_row("SELECT * from {$wpdb->prefix}tutor_quiz_questions WHERE question_id = {$question_id} ;");
3146
+ if ( ! $question){
3147
+ return false;
3148
  }
 
3149
 
3150
+ $order = " answer_order ASC ";
3151
+ if ($question->question_type === 'ordering'){
3152
+ $order = " RAND() ";
3153
  }
3154
 
3155
+ if ($rand){
3156
+ $order = " RAND() ";
3157
+ }
3158
 
3159
+ $answers = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_question_answers WHERE belongs_question_id = {$question_id} AND belongs_question_type =
3160
+ '{$question->question_type}' order by {$order} ");
3161
+ return $answers;
3162
  }
3163
 
3164
  /**
3168
  * @return array|bool|null|object
3169
  *
3170
  * Get all of the attempts by an user of a quiz
3171
+ *
3172
+ * @since v.1.0.0
3173
  */
3174
 
3175
  public function quiz_attempts($quiz_id = 0, $user_id = 0){
3178
  $quiz_id = $this->get_post_id($quiz_id);
3179
  $user_id = $this->get_user_id($user_id);
3180
 
3181
+ $attempts = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_attempts WHERE quiz_id = {$quiz_id} AND user_id = {$user_id} ");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3182
 
3183
  if (is_array($attempts) && count($attempts)){
3184
  return $attempts;
3187
  return false;
3188
  }
3189
 
3190
+ /**
3191
+ * @param string $search_term
3192
+ *
3193
+ * @return int
3194
+ *
3195
+ * Total number of quiz attempts
3196
+ *
3197
+ * @since v.1.0.0
3198
+ */
3199
+
3200
  public function get_total_quiz_attempts($search_term = ''){
3201
  global $wpdb;
3202
 
3204
  $search_term = " AND ( user_email like '%{$search_term}%' OR display_name like '%{$search_term}%' OR post_title like '%{$search_term}%' ) ";
3205
  }
3206
 
3207
+ $count = $wpdb->get_var("SELECT COUNT(attempt_id)
3208
+ FROM {$wpdb->prefix}tutor_quiz_attempts quiz_attempts
3209
+ INNER JOIN {$wpdb->posts} quiz
3210
+ ON quiz_attempts.quiz_id = quiz.ID
3211
+ INNER JOIN {$wpdb->users}
3212
+ ON quiz_attempts.user_id = {$wpdb->users}.ID
3213
+ WHERE 1=1 {$search_term} ");
 
 
3214
  return (int) $count;
3215
  }
3216
 
3217
+ /**
3218
+ * @param int $start
3219
+ * @param int $limit
3220
+ * @param string $search_term
3221
+ *
3222
+ * @return array|null|object
3223
+ *
3224
+ *
3225
+ * Get the all quiz attempts
3226
+ *
3227
+ * @since v.1.0.0
3228
+ */
3229
  public function get_quiz_attempts($start = 0, $limit = 10, $search_term = '') {
3230
  global $wpdb;
3231
 
3233
  $search_term = " AND ( user_email like '%{$search_term}%' OR display_name like '%{$search_term}%' OR post_title like '%{$search_term}%' ) ";
3234
  }
3235
 
3236
+ $query = $wpdb->get_results("SELECT *
3237
+ FROM {$wpdb->prefix}tutor_quiz_attempts quiz_attempts
3238
+ INNER JOIN {$wpdb->posts} quiz
3239
+ ON quiz_attempts.quiz_id = quiz.ID
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3240
  INNER JOIN {$wpdb->users}
3241
+ ON quiz_attempts.user_id = {$wpdb->users}.ID
3242
+ WHERE 1=1 {$search_term}
3243
+ ORDER BY quiz_attempts.attempt_id DESC
 
 
 
 
3244
  LIMIT {$start},{$limit}; ");
 
3245
  return $query;
3246
  }
3247
 
3248
+ /**
3249
+ * @param $attempt_id
3250
+ *
3251
+ * @return array|null|object
3252
+ *
3253
+ * Get quiz answers by attempt id
3254
+ *
3255
+ * @since v.1.0.0
3256
+ */
3257
+ public function get_quiz_answers_by_attempt_id($attempt_id){
3258
+ global $wpdb;
3259
+
3260
+ $results = $wpdb->get_results("SELECT answers.*, question.question_title, question.question_type
3261
+ FROM {$wpdb->prefix}tutor_quiz_attempt_answers answers
3262
+ LEFT JOIN {$wpdb->prefix}tutor_quiz_questions question ON answers.question_id = question.question_id
3263
+ WHERE answers.quiz_attempt_id = {$attempt_id} ");
3264
+
3265
+ return $results;
3266
+ }
3267
+
3268
+ /**
3269
+ * @param $answer_id
3270
+ *
3271
+ * @return array|null|object
3272
+ *
3273
+ * Get single answer by answer_id
3274
+ *
3275
+ * @since v.1.0.0
3276
+ */
3277
+ public function get_answer_by_id($answer_id){
3278
+ global $wpdb;
3279
+
3280
+ if (is_array($answer_id)){
3281
+ $in_ids = implode(",", $answer_id);
3282
+ $sql = "answer.answer_id IN({$in_ids})";
3283
+ }else{
3284
+ $sql = "answer.answer_id = {$answer_id}";
3285
+ }
3286
+
3287
+ $answer = $wpdb->get_results("SELECT answer.*, question.question_title, question.question_type
3288
+ FROM {$wpdb->prefix}tutor_quiz_question_answers answer
3289
+ LEFT JOIN {$wpdb->prefix}tutor_quiz_questions question ON answer.belongs_question_id = question.question_id
3290
+ WHERE 1=1 AND {$sql} ");
3291
+
3292
+ return $answer;
3293
+ }
3294
+
3295
+ /**
3296
+ * @param $ids
3297
+ *
3298
+ * @return array|bool|null|object
3299
+ *
3300
+ * Get quiz answers by ids
3301
+ *
3302
+ * @since v.1.0.0
3303
+ */
3304
+
3305
  public function get_quiz_answers_by_ids($ids){
3306
  $ids = (array) $ids;
3307
 
3331
  * @return mixed
3332
  *
3333
  * Get the users / students / course levels
3334
+ *
3335
+ * @since v.1.0.0
3336
  */
3337
 
3338
  public function course_levels($level = null){
3354
  return $levels;
3355
  }
3356
 
3357
+ /**
3358
+ * @return mixed|void
3359
+ *
3360
+ * Get user permalink for dashboard
3361
+ *
3362
+ * @since v.1.0.0
3363
+ */
3364
  public function user_profile_permalinks(){
3365
  $permalinks = array(
3366
  'enrolled_course' => __('Enrolled Course', 'tutor'),
3371
  return apply_filters('tutor_public_profile/permalinks', $permalinks);
3372
  }
3373
 
3374
+ /**
3375
+ * @return bool|false|string
3376
+ *
3377
+ * Student registration form
3378
+ *
3379
+ * @since v.1.0.0
3380
+ */
3381
  public function student_register_url(){
3382
  $student_register_page = (int) $this->get_option('student_register_page');
3383
 
3387
  return false;
3388
  }
3389
 
3390
+ /**
3391
+ * @return false|string
3392
+ *
3393
+ * Get frontend dashboard URL
3394
+ */
3395
  public function tutor_dashboard_url(){
3396
  $page_id = (int) tutor_utils()->get_option('student_dashboard');
3397
  $page_id = apply_filters('tutor_dashboard_url', $page_id);
3405
  * @return bool
3406
  *
3407
  * is_wishlisted();
3408
+ *
3409
+ * @since v.1.0.0
3410
  */
3411
  public function is_wishlisted($course_id = 0, $user_id = 0){
3412
  $course_id = $this->get_post_id($course_id);
3427
  * @return array|null|object
3428
  *
3429
  * Get the wish lists by an user
3430
+ *
3431
+ * @since v.1.0.0
3432
  */
3433
  public function get_wishlist($user_id = 0){
3434
  $user_id = $this->get_user_id($user_id);
3450
  * @return array|null|object
3451
  *
3452
  * Getting popular courses
3453
+ *
3454
+ * @since v.1.0.0
3455
  */
3456
  public function most_popular_courses($limit = 10){
3457
  global $wpdb;
3476
  * @return array|bool|null|object
3477
  *
3478
  * Get most rated courses lists
3479
+ *
3480
+ * @since v.1.0.0
3481
  */
3482
  public function most_rated_courses($limit = 10){
3483
  global $wpdb;
3499
  return false;
3500
  }
3501
 
3502
+ /**
3503
+ * @param null $addon_field
3504
+ *
3505
+ * @return bool
3506
+ *
3507
+ * Get Addon config
3508
+ *
3509
+ * @since v.1.0.0
3510
+ */
3511
  public function get_addon_config($addon_field = null){
3512
  if ( ! $addon_field){
3513
  return false;
3515
 
3516
  $addonsConfig = maybe_unserialize(get_option('tutor_addons_config'));
3517
 
 
3518
  if (isset($addonsConfig[$addon_field])){
3519
  return $addonsConfig[$addon_field];
3520
  }
3522
  return false;
3523
  }
3524
 
3525
+ /**
3526
+ * @return array|false|string
3527
+ *
3528
+ * Get the IP from visitor
3529
+ *
3530
+ * @since v.1.0.0
3531
+ */
3532
+ function get_ip() {
3533
+ $ipaddress = '';
3534
+ if (getenv('HTTP_CLIENT_IP'))
3535
+ $ipaddress = getenv('HTTP_CLIENT_IP');
3536
+ else if(getenv('HTTP_X_FORWARDED_FOR'))
3537
+ $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
3538
+ else if(getenv('HTTP_X_FORWARDED'))
3539
+ $ipaddress = getenv('HTTP_X_FORWARDED');
3540
+ else if(getenv('HTTP_FORWARDED_FOR'))
3541
+ $ipaddress = getenv('HTTP_FORWARDED_FOR');
3542
+ else if(getenv('HTTP_FORWARDED'))
3543
+ $ipaddress = getenv('HTTP_FORWARDED');
3544
+ else if(getenv('REMOTE_ADDR'))
3545
+ $ipaddress = getenv('REMOTE_ADDR');
3546
+ else
3547
+ $ipaddress = 'UNKNOWN';
3548
+ return $ipaddress;
3549
+ }
3550
 
3551
  }
classes/Video_Stream.php CHANGED
@@ -93,7 +93,7 @@ class Video_Stream {
93
  }
94
 
95
  /**
96
- * close curretly opened stream
97
  */
98
  private function end() {
99
  fclose($this->stream);
93
  }
94
 
95
  /**
96
+ * close currently opened stream
97
  */
98
  private function end() {
99
  fclose($this->stream);
classes/init.php CHANGED
@@ -118,6 +118,9 @@ class init{
118
  $version = get_option('tutor_version');
119
  //Save Option
120
  if ( ! $version){
 
 
 
121
  $options = self::default_options();
122
  update_option('tutor_option', $options);
123
 
@@ -133,6 +136,15 @@ class init{
133
  if (! wp_next_scheduled ( 'tutor_once_in_day_run_schedule' )) {
134
  wp_schedule_event(time(), 'twicedaily', 'tutor_once_in_day_run_schedule');
135
  }
 
 
 
 
 
 
 
 
 
136
  }
137
 
138
  //Run task on deactivation
@@ -140,6 +152,85 @@ class init{
140
  wp_clear_scheduled_hook('tutor_once_in_day_run_schedule');
141
  }
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
  public static function manage_tutor_roles_and_permissions(){
145
  /**
118
  $version = get_option('tutor_version');
119
  //Save Option
120
  if ( ! $version){
121
+ //Create Database
122
+ $this->create_database();
123
+
124
  $options = self::default_options();
125
  update_option('tutor_option', $options);
126
 
136
  if (! wp_next_scheduled ( 'tutor_once_in_day_run_schedule' )) {
137
  wp_schedule_event(time(), 'twicedaily', 'tutor_once_in_day_run_schedule');
138
  }
139
+
140
+ /**
141
+ * backward / Alpha version compatibility
142
+ */
143
+ if (version_compare(get_option('TUTOR_VERSION'), '1.0.0', '<')){
144
+ //Create Database
145
+ $this->create_database();
146
+ update_option('tutor_version', TUTOR_VERSION);
147
+ }
148
  }
149
 
150
  //Run task on deactivation
152
  wp_clear_scheduled_hook('tutor_once_in_day_run_schedule');
153
  }
154
 
155
+ public function create_database(){
156
+ global $wpdb;
157
+
158
+ $charset_collate = $wpdb->get_charset_collate();
159
+
160
+ /**
161
+ * Table SQL
162
+ *
163
+ * {$wpdb->prefix}tutor_quiz_attempts
164
+ * {$wpdb->prefix}tutor_quiz_attempt_answers
165
+ * {$wpdb->prefix}tutor_quiz_questions
166
+ * {$wpdb->prefix}tutor_quiz_question_answers
167
+ *
168
+ * @since v.1.0.0
169
+ */
170
+ $quiz_attempts_sql = "CREATE TABLE {$wpdb->prefix}tutor_quiz_attempts (
171
+ attempt_id int(11) NOT NULL AUTO_INCREMENT,
172
+ quiz_id int(11) DEFAULT NULL,
173
+ user_id int(11) DEFAULT NULL,
174
+ total_questions int(11) DEFAULT NULL,
175
+ total_answered_questions int(11) DEFAULT NULL,
176
+ total_marks decimal(9,2) DEFAULT NULL,
177
+ earned_marks decimal(9,2) DEFAULT NULL,
178
+ attempt_info text,
179
+ attempt_status varchar(50) DEFAULT NULL,
180
+ attempt_ip varchar(250) DEFAULT NULL,
181
+ attempt_started_at datetime DEFAULT NULL,
182
+ attempt_ended_at datetime DEFAULT NULL,
183
+ is_manually_reviewed int(1) DEFAULT NULL,
184
+ manually_reviewed_at datetime DEFAULT NULL,
185
+ PRIMARY KEY (attempt_id)
186
+ ) $charset_collate;";
187
+
188
+ $quiz_attempt_answers = "CREATE TABLE {$wpdb->prefix}tutor_quiz_attempt_answers (
189
+ attempt_answer_id int(11) NOT NULL AUTO_INCREMENT,
190
+ user_id int(11) DEFAULT NULL,
191
+ quiz_id int(11) DEFAULT NULL,
192
+ question_id int(11) DEFAULT NULL,
193
+ quiz_attempt_id int(11) DEFAULT NULL,
194
+ given_answer longtext,
195
+ question_mark decimal(8,2) DEFAULT NULL,
196
+ achieved_mark decimal(8,2) DEFAULT NULL,
197
+ minus_mark decimal(8,2) DEFAULT NULL,
198
+ is_correct tinyint(4) DEFAULT NULL,
199
+ PRIMARY KEY (attempt_answer_id)
200
+ ) $charset_collate;";
201
+
202
+ $tutor_quiz_questions = "CREATE TABLE {$wpdb->prefix}tutor_quiz_questions (
203
+ question_id int(11) NOT NULL AUTO_INCREMENT,
204
+ quiz_id int(11) DEFAULT NULL,
205
+ question_title text,
206
+ question_description longtext,
207
+ question_type varchar(50) DEFAULT NULL,
208
+ question_mark decimal(9,2) DEFAULT NULL,
209
+ question_settings longtext,
210
+ question_order int(11) DEFAULT NULL,
211
+ PRIMARY KEY (question_id)
212
+ ) $charset_collate;";
213
+
214
+ $tutor_quiz_question_answers = "CREATE TABLE {$wpdb->prefix}tutor_quiz_question_answers (
215
+ answer_id int(11) NOT NULL AUTO_INCREMENT,
216
+ belongs_question_id int(11) DEFAULT NULL,
217
+ belongs_question_type varchar(250) DEFAULT NULL,
218
+ answer_title text,
219
+ is_correct tinyint(4) DEFAULT NULL,
220
+ image_id int(11) DEFAULT NULL,
221
+ answer_two_gap_match text,
222
+ answer_view_format varchar(250) DEFAULT NULL,
223
+ answer_settings text,
224
+ answer_order int(11) DEFAULT '0',
225
+ PRIMARY KEY (answer_id)
226
+ ) $charset_collate;";
227
+
228
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
229
+ dbDelta( $quiz_attempts_sql );
230
+ dbDelta( $quiz_attempt_answers );
231
+ dbDelta( $tutor_quiz_questions );
232
+ dbDelta( $tutor_quiz_question_answers );
233
+ }
234
 
235
  public static function manage_tutor_roles_and_permissions(){
236
  /**
includes/tutor-template-functions.php CHANGED
@@ -1075,6 +1075,18 @@ function tutor_single_quiz_no_course_belongs($echo = true){
1075
  return $output;
1076
  }
1077
 
 
 
 
 
 
 
 
 
 
 
 
 
1078
  function get_tutor_course_level($course_id = 0){
1079
  if ( ! $course_id){
1080
  $course_id = get_the_ID();
@@ -1158,3 +1170,15 @@ if ( ! function_exists('tutor_course_tags_html')) {
1158
  return $output;
1159
  }
1160
  }
 
 
 
 
 
 
 
 
 
 
 
 
1075
  return $output;
1076
  }
1077
 
1078
+ function single_quiz_contents($echo = true){
1079
+
1080
+ ob_start();
1081
+ tutor_load_template( 'single.quiz.single_quiz_contents' );
1082
+ $output = apply_filters( 'tutor_single_quiz/single_quiz_contents', ob_get_clean() );
1083
+
1084
+ if ( $echo ) {
1085
+ echo $output;
1086
+ }
1087
+ return $output;
1088
+ }
1089
+
1090
  function get_tutor_course_level($course_id = 0){
1091
  if ( ! $course_id){
1092
  $course_id = get_the_ID();
1170
  return $output;
1171
  }
1172
  }
1173
+
1174
+ function tutor_lesson_sidebar_question_and_answer($echo = true){
1175
+ ob_start();
1176
+ tutor_load_template( 'single.lesson.sidebar_question_and_answer' );
1177
+ $output = apply_filters( 'tutor_lesson/single/sidebar_question_and_answer', ob_get_clean() );
1178
+
1179
+ if ( $echo ) {
1180
+ echo $output;
1181
+ }
1182
+
1183
+ return $output;
1184
+ }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: lms, education, wp-lms, education management system
5
  Requires at least: 4.5
6
  Tested up to: 5.0
7
  Requires PHP: 5.4.0
8
- Stable tag: 1.0.0-alpha
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -19,6 +19,8 @@ Want to create an e-learning platform like Udemy, Lynda, Coursera, and Edx? Get
19
 
20
  Create, customize, manage, and sell online courses by building a functional e-learning website with this free LMS plugin for WordPress.
21
 
 
 
22
  = Features =
23
 
24
  Here are the most notable features of Tutor LMS plugin. If you need any further information, please feel free to contact us. Below are the best offerings of Tutor LMS.
@@ -30,16 +32,18 @@ Here are the most notable features of Tutor LMS plugin. If you need any further
30
  * Teacher profiles and panels
31
  * Lesson management
32
  * Course requirement & instruction
33
- * WooCommerce integration to sell courses
34
- * Quizzes and Questions under course
35
  * Teacher registration form
36
  * Course review and rating system
37
  * Q&A for students with course teacher
38
  * Video Poster (trailer/teaser)
39
- * Lesson attachments
40
  * Tracking course progress
41
- * Lesson download option
42
- * Email notification
 
 
 
 
43
 
44
  = Intuitive Course Builder =
45
  Create courses with their details like videos, attachments, excerpt, additional data, benefit of the course, requirement, topic, summary, announcement, and video banners. Have lessons under course and attach video and other attachments to each lesson. Tutor, the advanced WordPress LMS plugin lets you present courses on an intuitive user interface with all required options to offer a top notch learning system.
@@ -65,6 +69,7 @@ Being integrated with WooCommerce, Tutor, the WordPress LMS plugin offers eComme
65
  Looking for the best LMS for WordPress? Get Tutor and start your e-learning website immediately.
66
 
67
 
 
68
  == Installation ==
69
 
70
  = Minimum Requirements =
@@ -90,23 +95,45 @@ The WordPress codex contains [instructions on how to do this here](https://codex
90
 
91
  Yes. Tutor can be used with your existing theme or any theme you wish to use it with.
92
 
 
 
 
 
93
  = Where can I get support? =
94
 
95
  You can get support by posting your issues on the support section of this plugin on WordPress plugins directory or directly place your question to Themeum Forums.
96
 
97
-
98
  = Where can I report a bug? =
99
 
100
- If any bug is found, please let us know by posting on the support section of this plugin on WordPress plugin directory or directly on our support forums: https://www.themeum.com/support/ 🙂
101
 
102
  == Screenshots ==
103
 
104
- 1. Course Builder
105
- 2. Multi Instructors
106
- 3. Lesson Add to course
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
110
  = 1.0.0-alpha - 06 Feb, 2019 =
111
 
112
  * Alpha Release
5
  Requires at least: 4.5
6
  Tested up to: 5.0
7
  Requires PHP: 5.4.0
8
+ Stable tag: 1.0.0
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
19
 
20
  Create, customize, manage, and sell online courses by building a functional e-learning website with this free LMS plugin for WordPress.
21
 
22
+ [youtube https://www.youtube.com/watch?v=yo47fDYIGQo]
23
+
24
  = Features =
25
 
26
  Here are the most notable features of Tutor LMS plugin. If you need any further information, please feel free to contact us. Below are the best offerings of Tutor LMS.
32
  * Teacher profiles and panels
33
  * Lesson management
34
  * Course requirement & instruction
35
+ * Quizzes
 
36
  * Teacher registration form
37
  * Course review and rating system
38
  * Q&A for students with course teacher
39
  * Video Poster (trailer/teaser)
 
40
  * Tracking course progress
41
+ * Course Difficulty Level
42
+ * Define Course Duration
43
+ * Add course requirement and instruction
44
+ * Quiz Timer
45
+ * Quiz Attempts
46
+
47
 
48
  = Intuitive Course Builder =
49
  Create courses with their details like videos, attachments, excerpt, additional data, benefit of the course, requirement, topic, summary, announcement, and video banners. Have lessons under course and attach video and other attachments to each lesson. Tutor, the advanced WordPress LMS plugin lets you present courses on an intuitive user interface with all required options to offer a top notch learning system.
69
  Looking for the best LMS for WordPress? Get Tutor and start your e-learning website immediately.
70
 
71
 
72
+
73
  == Installation ==
74
 
75
  = Minimum Requirements =
95
 
96
  Yes. Tutor can be used with your existing theme or any theme you wish to use it with.
97
 
98
+ = Is this plugin free? =
99
+
100
+ This WordPress course plugin has two versions. One is free and another is paid. The paid version has more advanced features which are not accessible in this free version. Click here to get the paid version.
101
+
102
  = Where can I get support? =
103
 
104
  You can get support by posting your issues on the support section of this plugin on WordPress plugins directory or directly place your question to Themeum Forums.
105
 
 
106
  = Where can I report a bug? =
107
 
108
+ This is an alpha version of Tutor, as bugs and issues expected, if you found any bugs or issues, please let us know by posting on the support section of this plugin on WordPress plugin directory or directly on our support forums: https://www.themeum.com/support/ 🙂
109
 
110
  == Screenshots ==
111
 
112
+ 1. Course list
113
+ 2. Lessons
114
+ 3. Course status
115
+ 4. Student profile
116
+ 5. Teacher profile
117
+ 6. About instructor
118
+ 7. Rating and review
119
+ 8. Course details
120
+ 9. Question and answers
121
+ 10. Quiz results
122
+ 11. Quiz question types
123
+ 12. Multi instructors
124
+ 13. Tutor LMS report
125
+ 14. Quiz builder, questions
126
+ 15. Quiz builder, question edit and settings
127
+ 16. Course builder
128
 
129
  == Changelog ==
130
 
131
+ = 1.0.0 - 01 March, 2019 =
132
+
133
+ * Added Quiz, quiz builder, course builder
134
+ * Fixed huge bugs from alpha version
135
+ * Stable Release
136
+
137
  = 1.0.0-alpha - 06 Feb, 2019 =
138
 
139
  * Alpha Release
templates/single-lesson.php CHANGED
@@ -21,7 +21,7 @@ $currentPost = $post;
21
  <?php tutor_lessons_sidebar(); ?>
22
  </div>
23
 
24
- <div id="tutor-single-lesson-entry-content" class="tutor-lesson-content tutor-single-lesson-entry-content-<?php the_ID(); ?>">
25
  <?php tutor_lesson_content(); ?>
26
  </div>
27
 
21
  <?php tutor_lessons_sidebar(); ?>
22
  </div>
23
 
24
+ <div id="tutor-single-entry-content" class="tutor-lesson-content tutor-single-entry-content tutor-single-entry-content-<?php the_ID(); ?>">
25
  <?php tutor_lesson_content(); ?>
26
  </div>
27
 
templates/single-quiz.php CHANGED
@@ -15,22 +15,53 @@ $course = tutor_utils()->get_course_by_quiz(get_the_ID());
15
 
16
  <?php do_action('tutor_quiz/single/before/wrap'); ?>
17
 
18
- <div <?php tutor_post_class('tutor-page-wrap'); ?>>
19
- <div class="tutor-quiz-single-wrap tutor-container">
 
 
 
 
 
 
 
20
  <input type="hidden" name="tutor_quiz_id" id="tutor_quiz_id" value="<?php the_ID(); ?>">
21
 
22
- <?php
23
- if ($course){
24
- tutor_single_quiz_top();
25
- tutor_single_quiz_body();
26
- }else{
27
- tutor_single_quiz_no_course_belongs();
28
- }
29
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  </div>
32
  </div><!-- .wrap -->
33
 
34
- <?php do_action('tutor_quiz/single/after/wrap');
35
 
36
  get_footer();
15
 
16
  <?php do_action('tutor_quiz/single/before/wrap'); ?>
17
 
18
+
19
+ <div class="tutor-single-lesson-wrap ">
20
+
21
+ <div class="tutor-lesson-sidebar">
22
+ <?php tutor_lessons_sidebar(); ?>
23
+ </div>
24
+
25
+
26
+ <div id="tutor-single-entry-content" class="tutor-quiz-single-entry-wrap tutor-single-entry-content tutor-container">
27
  <input type="hidden" name="tutor_quiz_id" id="tutor_quiz_id" value="<?php the_ID(); ?>">
28
 
29
+
30
+ <div class="tutor-single-page-top-bar">
31
+ <div class="tutor-topbar-item tutor-hide-sidebar-bar">
32
+ <a href="javascript:;" class="tutor-lesson-sidebar-hide-bar"><i class="tutor-icon-menu-2"></i> </a>
33
+ </div>
34
+ <div class="tutor-topbar-item tutor-topbar-content-title-wrap">
35
+ <?php
36
+ tutor_utils()->get_lesson_type_icon(get_the_ID(), true, true);
37
+ the_title(); ?>
38
+ </div>
39
+
40
+ <div class="tutor-topbar-item tutor-topbar-back-to-curse-wrap">
41
+ <a href="<?php echo get_the_permalink($course->ID); ?>">
42
+ <i class="tutor-icon-next-2"></i> <?php echo sprintf(__('Go to %s Course Home %s', 'tutor'), '<strong>', '</strong>') ; ?>
43
+ </a>
44
+ </div>
45
+ </div>
46
+
47
+
48
+
49
+ <div class="tutor-quiz-single-wrap ">
50
+ <input type="hidden" name="tutor_quiz_id" id="tutor_quiz_id" value="<?php the_ID(); ?>">
51
+
52
+ <?php
53
+ if ($course){
54
+ tutor_single_quiz_top();
55
+ tutor_single_quiz_body();
56
+ }else{
57
+ tutor_single_quiz_no_course_belongs();
58
+ }
59
+ ?>
60
+ </div>
61
 
62
  </div>
63
  </div><!-- .wrap -->
64
 
65
+ <?php
66
 
67
  get_footer();
templates/single/lesson/content.php CHANGED
@@ -27,13 +27,11 @@ if ($best_watch_time > 0){
27
 
28
  <div class="tutor-single-page-top-bar">
29
  <div class="tutor-topbar-item tutor-hide-sidebar-bar">
30
- <a href="javascript:;" class="tutor-lesson-sidebar-hide-bar">=</a>
31
  </div>
32
-
33
  <div class="tutor-topbar-item tutor-topbar-content-title-wrap">
34
  <?php
35
  tutor_utils()->get_lesson_type_icon(get_the_ID(), true, true);
36
-
37
  the_title(); ?>
38
  </div>
39
 
@@ -41,9 +39,10 @@ if ($best_watch_time > 0){
41
  <?php
42
  $course_id = get_post_meta(get_the_ID(), '_tutor_course_id_for_lesson', true);
43
  ?>
44
- <a href="<?php echo get_the_permalink($course_id); ?>">&leftarrow; Go to <strong>Course Home</strong></a>
 
 
45
  </div>
46
-
47
  </div>
48
 
49
 
27
 
28
  <div class="tutor-single-page-top-bar">
29
  <div class="tutor-topbar-item tutor-hide-sidebar-bar">
30
+ <a href="javascript:;" class="tutor-lesson-sidebar-hide-bar"><i class="tutor-icon-menu-2"></i> </a>
31
  </div>
 
32
  <div class="tutor-topbar-item tutor-topbar-content-title-wrap">
33
  <?php
34
  tutor_utils()->get_lesson_type_icon(get_the_ID(), true, true);
 
35
  the_title(); ?>
36
  </div>
37
 
39
  <?php
40
  $course_id = get_post_meta(get_the_ID(), '_tutor_course_id_for_lesson', true);
41
  ?>
42
+ <a href="<?php echo get_the_permalink($course_id); ?>">
43
+ <i class="tutor-icon-next-2"></i> <?php echo sprintf(__('Go to %s Course Home %s', 'tutor'), '<strong>', '</strong>') ; ?>
44
+ </a>
45
  </div>
 
46
  </div>
47
 
48
 
templates/single/lesson/lesson_sidebar.php CHANGED
@@ -12,141 +12,151 @@ if ( ! defined( 'ABSPATH' ) )
12
  exit;
13
 
14
  global $post;
 
15
  $currentPost = $post;
16
 
17
- $course_id = get_post_meta($post->ID, '_tutor_course_id_for_lesson', true);
 
 
 
 
 
 
 
 
18
  ?>
19
 
20
  <?php do_action('tutor_lesson/single/before/lesson_sidebar'); ?>
21
 
22
  <div class="tutor-sidebar-tabs-wrap">
23
  <div class="tutor-tabs-btn-group">
24
- <a href="#tutor-lesson-sidebar-tab-content" class="active">Lesson List</a>
25
- <!--<a href="#tutor-lesson-sidebar-qa-tab-content">Browse Q&A</a>-->
26
  </div>
27
 
28
  <div class="tutor-sidebar-tabs-content">
29
 
30
- <div id="tutor-lesson-sidebar-qa-tab-content" class="tutor-lesson-sidebar-tab-item" style="display: none;">
31
- <h3>No questions yet</h3>
32
- <p>Perhaps you can make a try by search</p>
33
- </div>
34
-
35
  <div id="tutor-lesson-sidebar-tab-content" class="tutor-lesson-sidebar-tab-item">
36
- <?php
37
- $topics = tutor_utils()->get_topics($course_id);
38
- if ($topics->have_posts()){
39
- while ($topics->have_posts()){ $topics->the_post();
40
- $topic_id = get_the_ID();
41
- $topic_summery = get_the_content();
42
- ?>
43
 
44
  <div class="tutor-topics-in-single-lesson tutor-topics-<?php echo $topic_id; ?>">
45
  <div class="tutor-topics-title <?php echo $topic_summery ? 'has-summery' : ''; ?>">
46
  <h3>
47
- <?php
48
- the_title();
49
- if($topic_summery) {
50
- echo "<i class='tutor-icon-angle-down'></i>";
51
- }
52
- ?>
53
  </h3>
54
  </div>
55
 
56
- <?php
57
- if ($topic_summery){
58
- ?>
59
  <div class="tutor-topics-summery">
60
- <?php echo $topic_summery; ?>
61
  </div>
62
- <?php
63
- }
64
- ?>
65
 
66
  <div class="tutor-lessons-under-topic">
67
- <?php
68
- do_action('tutor/lesson_list/before/topic', $topic_id);
69
-
70
- $lessons = tutor_utils()->get_lessons_by_topic(get_the_ID());
71
- if ($lessons->have_posts()){
72
- while ($lessons->have_posts()){
73
- $lessons->the_post();
74
- $video = tutor_utils()->get_video_info();
75
-
76
- $play_time = false;
77
- if ($video){
78
- $play_time = $video->playtime;
79
- }
80
- $is_completed_lesson = tutor_utils()->is_completed_lesson();
81
- ?>
82
-
83
- <div class="tutor-single-lesson-items <?php echo ($currentPost->ID === get_the_ID()) ? 'active' : ''; ?>">
84
- <a href="<?php the_permalink(); ?>" class="tutor-single-lesson-a" data-lesson-id="<?php the_ID(); ?>">
85
-
86
- <?php
87
- $tutor_lesson_type_icon = $play_time ? 'youtube' : 'document';
88
- echo "<i class='tutor-icon-$tutor_lesson_type_icon'></i>";
89
- ?>
90
- <span class="lesson_title"><?php the_title(); ?></span>
91
- <span class="tutor-lesson-right-icons">
 
 
 
92
  <?php
93
- if ($play_time){
94
  echo "<i class='tutor-play-duration'>$play_time</i>";
95
  }
96
  $lesson_complete_icon = $is_completed_lesson ? 'tutor-icon-mark tutor-done' : '';
97
  echo "<i class='tutor-lesson-complete $lesson_complete_icon'></i>";
98
  ?>
99
  </span>
100
- </a>
101
- </div>
102
-
103
- <?php
104
- }
105
- $lessons->reset_postdata();
106
- }
107
-
108
- #quizzes
109
- $quizzes = tutor_utils()->get_attached_quiz($topic_id);
110
- if ($quizzes){
111
- ?>
112
- <?php
113
- foreach ($quizzes as $quiz){
114
- ?>
115
- <div class="tutor-single-lesson-items quiz-single-item-<?php echo $quiz->ID; ?>">
116
- <a href="<?php echo get_permalink($quiz->ID); ?>">
117
- <i class="tutor-icon-doubt"></i>
118
- <span class="lesson_title"><?php echo $quiz->post_title; ?></span>
119
- <span class="tutor-lesson-right-icons">
120
-
121
- <?php
122
- $time_limit = tutor_utils()->get_quiz_option($quiz->ID, 'time_limit.time_value');
123
- if ($time_limit){
124
- $time_type = tutor_utils()->get_quiz_option($quiz->ID, 'time_limit.time_type');
125
- echo "<span class='quiz-time-limit'>{$time_limit} {$time_type}</span>";
126
- }
127
- ?>
128
- </span>
129
- </a>
130
- </div>
131
- <?php
132
- }
133
- ?>
134
- <?php
135
- }
136
- ?>
137
-
138
- <?php do_action('tutor/lesson_list/after/topic', $topic_id); ?>
139
  </div>
140
  </div>
141
 
142
- <?php
143
- }
144
- $topics->reset_postdata();
145
- wp_reset_postdata();
146
- }
147
- ?>
148
  </div>
149
 
 
 
 
 
 
 
 
 
 
150
  </div>
151
 
152
  </div>
12
  exit;
13
 
14
  global $post;
15
+
16
  $currentPost = $post;
17
 
18
+ $course_id = 0;
19
+ if ($post->post_type === 'tutor_quiz'){
20
+ $course = tutor_utils()->get_course_by_quiz(get_the_ID());
21
+ $course_id = $course->ID;
22
+ }else{
23
+ $course_id = get_post_meta($post->ID, '_tutor_course_id_for_lesson', true);
24
+ }
25
+
26
+
27
  ?>
28
 
29
  <?php do_action('tutor_lesson/single/before/lesson_sidebar'); ?>
30
 
31
  <div class="tutor-sidebar-tabs-wrap">
32
  <div class="tutor-tabs-btn-group">
33
+ <a href="#tutor-lesson-sidebar-tab-content" class="active"> <i class="tutor-icon-education"></i> Lesson List</a>
34
+ <a href="#tutor-lesson-sidebar-qa-tab-content"> <i class="tutor-icon-question-2"></i> Browse Q&A</a>
35
  </div>
36
 
37
  <div class="tutor-sidebar-tabs-content">
38
 
 
 
 
 
 
39
  <div id="tutor-lesson-sidebar-tab-content" class="tutor-lesson-sidebar-tab-item">
40
+ <?php
41
+ $topics = tutor_utils()->get_topics($course_id);
42
+ if ($topics->have_posts()){
43
+ while ($topics->have_posts()){ $topics->the_post();
44
+ $topic_id = get_the_ID();
45
+ $topic_summery = get_the_content();
46
+ ?>
47
 
48
  <div class="tutor-topics-in-single-lesson tutor-topics-<?php echo $topic_id; ?>">
49
  <div class="tutor-topics-title <?php echo $topic_summery ? 'has-summery' : ''; ?>">
50
  <h3>
51
+ <?php
52
+ the_title();
53
+ if($topic_summery) {
54
+ echo "<i class='tutor-icon-angle-down'></i>";
55
+ }
56
+ ?>
57
  </h3>
58
  </div>
59
 
60
+ <?php
61
+ if ($topic_summery){
62
+ ?>
63
  <div class="tutor-topics-summery">
64
+ <?php echo $topic_summery; ?>
65
  </div>
66
+ <?php
67
+ }
68
+ ?>
69
 
70
  <div class="tutor-lessons-under-topic">
71
+ <?php
72
+ do_action('tutor/lesson_list/before/topic', $topic_id);
73
+
74
+ $lessons = tutor_utils()->get_course_contents_by_topic(get_the_ID(), -1);
75
+ if ($lessons->have_posts()){
76
+ while ($lessons->have_posts()){
77
+ $lessons->the_post();
78
+
79
+ if ($post->post_type !== 'tutor_quiz') {
80
+
81
+ $video = tutor_utils()->get_video_info();
82
+
83
+ $play_time = false;
84
+ if ( $video ) {
85
+ $play_time = $video->playtime;
86
+ }
87
+ $is_completed_lesson = tutor_utils()->is_completed_lesson();
88
+ ?>
89
+
90
+ <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID === get_the_ID() ) ? 'active' : ''; ?>">
91
+ <a href="<?php the_permalink(); ?>" class="tutor-single-lesson-a" data-lesson-id="<?php the_ID(); ?>">
92
+
93
+ <?php
94
+ $tutor_lesson_type_icon = $play_time ? 'youtube' : 'document';
95
+ echo "<i class='tutor-icon-$tutor_lesson_type_icon'></i>";
96
+ ?>
97
+ <span class="lesson_title"><?php the_title(); ?></span>
98
+ <span class="tutor-lesson-right-icons">
99
  <?php
100
+ if ( $play_time ) {
101
  echo "<i class='tutor-play-duration'>$play_time</i>";
102
  }
103
  $lesson_complete_icon = $is_completed_lesson ? 'tutor-icon-mark tutor-done' : '';
104
  echo "<i class='tutor-lesson-complete $lesson_complete_icon'></i>";
105
  ?>
106
  </span>
107
+ </a>
108
+ </div>
109
+
110
+ <?php
111
+ }else{
112
+ $quiz = $post;
113
+ ?>
114
+ <div class="tutor-single-lesson-items quiz-single-item quiz-single-item-<?php echo $quiz->ID; ?>" data-quiz-id="<?php echo $quiz->ID; ?>">
115
+ <a href="<?php echo get_permalink($quiz->ID); ?>" class="sidebar-single-quiz-a" data-quiz-id="<?php echo $quiz->ID; ?>">
116
+ <i class="tutor-icon-doubt"></i>
117
+ <span class="lesson_title"><?php echo $quiz->post_title; ?></span>
118
+ <span class="tutor-lesson-right-icons">
119
+
120
+ <?php
121
+ $time_limit = tutor_utils()->get_quiz_option($quiz->ID, 'time_limit.time_value');
122
+ if ($time_limit){
123
+ $time_type = tutor_utils()->get_quiz_option($quiz->ID, 'time_limit.time_type');
124
+ echo "<span class='quiz-time-limit'>{$time_limit} {$time_type}</span>";
125
+ }
126
+ ?>
127
+ </span>
128
+ </a>
129
+ </div>
130
+ <?php
131
+ }
132
+
133
+ }
134
+ $lessons->reset_postdata();
135
+ }
136
+
137
+ ?>
138
+
139
+ <?php do_action('tutor/lesson_list/after/topic', $topic_id); ?>
 
 
 
 
 
 
140
  </div>
141
  </div>
142
 
143
+ <?php
144
+ }
145
+ $topics->reset_postdata();
146
+ wp_reset_postdata();
147
+ }
148
+ ?>
149
  </div>
150
 
151
+
152
+ <div id="tutor-lesson-sidebar-qa-tab-content" class="tutor-lesson-sidebar-tab-item" style="display: none;">
153
+ <?php
154
+ tutor_lesson_sidebar_question_and_answer();
155
+ ?>
156
+ </div>
157
+
158
+
159
+
160
  </div>
161
 
162
  </div>
templates/single/lesson/sidebar_question_and_answer.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Question and answer
4
+ *
5
+ * @since v.1.0.0
6
+ * @author themeum
7
+ * @url https://themeum.com
8
+ */
9
+
10
+ $enable_q_and_a_on_course = tutor_utils()->get_option('enable_q_and_a_on_course');
11
+ if ( ! $enable_q_and_a_on_course) {
12
+ tutor_load_template( 'single.course.q_and_a_turned_off' );
13
+ return;
14
+ }
15
+
16
+
17
+ global $post;
18
+ $currentPost = $post;
19
+
20
+ $course_id = get_post_meta($post->ID, '_tutor_course_id_for_lesson', true);
21
+
22
+ ?>
23
+ <?php do_action('tutor_course/question_and_answer/before'); ?>
24
+ <div class="tutor-queston-and-answer-wrap">
25
+
26
+
27
+ <div class="tutor_question_answer_wrap">
28
+ <?php
29
+ $questions = tutor_utils()->get_top_question($course_id);
30
+
31
+ if (is_array($questions) && count($questions)){
32
+ foreach ($questions as $question){
33
+ $answers = tutor_utils()->get_qa_answer_by_question($question->comment_ID);
34
+ $profile_url = tutor_utils()->profile_url($question->user_id);
35
+ ?>
36
+ <div class="tutor_original_question">
37
+ <div class="tutor-question-wrap">
38
+ <div class="question-top-meta">
39
+ <div class="tutor-question-avater">
40
+ <a href="<?php echo $profile_url; ?>"> <?php echo tutor_utils()->get_tutor_avatar($question->user_id); ?></a>
41
+ </div>
42
+ <p class="review-meta">
43
+ <a href="<?php echo $profile_url; ?>"><?php echo $question->display_name; ?></a>
44
+ <span class="tutor-text-mute"><?php _e(sprintf('%s ago', human_time_diff(strtotime($question->comment_date))), 'tutor'); ?></span>
45
+ </p>
46
+ </div>
47
+
48
+ <div class="tutor_question_area">
49
+ <p><strong><?php echo $question->question_title; ?> </strong></p>
50
+ <?php echo wpautop(stripslashes($question->comment_content)); ?>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+
56
+ <?php
57
+ if (is_array($answers) && count($answers)){ ?>
58
+ <div class="tutor_admin_answers_list_wrap">
59
+ <?php
60
+ foreach ($answers as $answer){
61
+ $answer_profile = tutor_utils()->profile_url($answer->user_id);
62
+ ?>
63
+ <div class="tutor_individual_answer <?php echo ($question->user_id == $answer->user_id) ? 'tutor-bg-white' : 'tutor-bg-light'
64
+ ?> ">
65
+ <div class="tutor-question-wrap">
66
+ <div class="question-top-meta">
67
+ <div class="tutor-question-avater">
68
+ <a href="<?php echo $answer_profile; ?>"> <?php echo tutor_utils()->get_tutor_avatar($answer->user_id); ?></a>
69
+ </div>
70
+ <p class="review-meta">
71
+ <a href="<?php echo $answer_profile; ?>"><?php echo $answer->display_name; ?></a>
72
+ <span class="tutor-text-mute">
73
+ <?php _e(sprintf('%s ago', human_time_diff(strtotime($answer->comment_date))), 'tutor'); ?>
74
+ </span>
75
+ </p>
76
+ </div>
77
+
78
+ <div class="tutor_question_area">
79
+ <?php echo wpautop(stripslashes($answer->comment_content)); ?>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ <?php
84
+ }
85
+ ?>
86
+ </div>
87
+ <?php
88
+ } ?>
89
+ <div class="tutor_add_answer_row">
90
+ <div class="tutor_add_answer_wrap " data-question-id="<?php echo $question->comment_ID; ?>">
91
+ <div class="tutor_wp_editor_show_btn_wrap">
92
+ <a href="javascript:;" class="tutor_wp_editor_show_btn tutor-button tutor-success"><?php _e('Add an answer', 'tutor'); ?></a>
93
+ </div>
94
+ <div class="tutor_wp_editor_wrap" style="display: none;">
95
+ <form method="post" class="tutor-add-answer-form">
96
+ <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
97
+ <input type="hidden" value="tutor_add_answer" name="tutor_action"/>
98
+ <input type="hidden" value="<?php echo $question->comment_ID; ?>" name="question_id"/>
99
+
100
+ <div class="tutor-form-group">
101
+ <textarea id="tutor_answer_<?php echo $question->comment_ID; ?>" name="answer" class="tutor_add_answer_textarea" placeholder="<?php _e('Write your answer here...', 'tutor'); ?>"></textarea>
102
+ </div>
103
+
104
+ <div class="tutor-form-group">
105
+ <a href="javascript:;" class="tutor_cancel_wp_editor tutor-button tutor-danger"><?php _e('Cancel', 'tutor'); ?></a>
106
+ <button type="submit" class="tutor-button tutor_add_answer_btn tutor-success" name="tutor_answer_search_btn">
107
+ <?php _e('Add Answer', 'tutor'); ?>
108
+ </button>
109
+ </div>
110
+ </form>
111
+ </div>
112
+ </div>
113
+ </div>
114
+
115
+ <?php
116
+ }
117
+ }else{
118
+ ?>
119
+
120
+ <div class="tutor-lesson-sidebar-emptyqa-wrap">
121
+ <i class="tutor-icon-question-2"></i>
122
+ <h3><?php _e('No questions yet', 'tutor'); ?></h3>
123
+ <p><?php _e('Be the first to ask your question! You’ll be able to add details in the next step.', 'tutor'); ?></p>
124
+ </div>
125
+
126
+ <?php
127
+ }
128
+ ?>
129
+ </div>
130
+
131
+
132
+ <div class="tutor-add-question-wrap">
133
+
134
+ <h3><?php _e('Ask a new question', 'tutor'); ?></h3>
135
+
136
+
137
+ <form method="post" id="tutor-ask-question-form">
138
+ <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
139
+ <input type="hidden" value="add_question" name="tutor_action"/>
140
+ <input type="hidden" value="<?php echo $course_id; ?>" name="tutor_course_id"/>
141
+
142
+ <div class="tutor-form-group">
143
+ <input type="text" name="question_title" value="" placeholder="<?php _e('Question Title', 'tutor'); ?>">
144
+ </div>
145
+
146
+ <div class="tutor-form-group">
147
+ <?php
148
+ $editor_settings = array(
149
+ 'teeny' => true,
150
+ 'media_buttons' => false,
151
+ 'quicktags' => false,
152
+ 'editor_height' => 100,
153
+ );
154
+ wp_editor(null, 'question', $editor_settings);
155
+ ?>
156
+ </div>
157
+
158
+ <div class="tutor-form-group">
159
+ <button type="submit" class="tutor_ask_question_btn" name="tutor_question_search_btn"><?php _e('Submit My Question', 'tutor'); ?></button>
160
+ </div>
161
+ </form>
162
+ </div>
163
+
164
+
165
+
166
+ </div>
167
+ <?php do_action('tutor_course/question_and_answer/after'); ?>
templates/single/quiz/body.php CHANGED
@@ -4,6 +4,7 @@ global $post;
4
  $currentPost = $post;
5
 
6
  $is_started_quiz = tutor_utils()->is_started_quiz();
 
7
  $previous_attempts = tutor_utils()->quiz_attempts();
8
  $attempted_count = is_array($previous_attempts) ? count($previous_attempts) : 0;
9
 
@@ -13,218 +14,443 @@ $passing_grade = tutor_utils()->get_quiz_option(get_the_ID(), 'passing_grade', 0
13
  $attempt_remaining = $attempts_allowed - $attempted_count;
14
  ?>
15
 
16
- <?php do_action('tutor_quiz/single/before/body'); ?>
17
-
18
  <div id="tutor-quiz-body" class="tutor-quiz-body tutor-quiz-body-<?php the_ID(); ?>">
19
  <?php
20
  if ($is_started_quiz){
21
- $quiz_attempt_info = tutor_utils()->quiz_attempt_info($is_started_quiz->comment_ID);
22
  $quiz_attempt_info['date_time_now'] = date("Y-m-d H:i:s");
23
 
24
- $time_limit_seconds = tutor_utils()->avalue_dot('time_limit_seconds', $quiz_attempt_info);
25
- $remaining_time_secs = (strtotime($is_started_quiz->quiz_started_at) + $time_limit_seconds ) - strtotime($quiz_attempt_info['date_time_now']);
26
 
27
- $remaining_time_context = tutor_utils()->seconds_to_time_context($remaining_time_secs);
28
- $question = tutor_utils()->get_rand_single_question_by_quiz_for_student();
29
- do_action('tutor_quiz/single/before/meta'); ?>
30
 
31
- <div class="quiz-head-meta-info">
32
- <div class="time-remaining">
33
- <?php _e('Time remaining : '); ?> <span id="tutor-quiz-time-update" data-attempt-settings="<?php echo esc_attr(json_encode($is_started_quiz)) ?>" data-attempt-meta="<?php echo esc_attr(json_encode($quiz_attempt_info)) ?>"><?php echo $remaining_time_context; ?></span>
34
- </div>
35
- </div>
36
 
37
- <?php do_action('tutor_quiz/single/after/meta');
 
 
38
 
39
- if ($question) {
40
- do_action('tutor_quiz/single/before/question'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
- <div id="tutor-quiz-single-wrap">
43
  <?php
44
- $question_type = get_post_meta( $question->ID, '_question_type', true );
45
- $answers = tutor_utils()->get_quiz_answer_options_by_question( $question->ID );
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  ?>
47
- <p class="question-text"><?php echo $question->post_title; ?></p>
48
 
49
- <div class="quiz-answers">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
- <?php do_action('tutor_quiz/single/before/question/form'); ?>
52
 
53
- <form id="tutor-answering-quiz" method="post">
54
- <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
 
55
 
56
- <input type="hidden" value="<?php echo $is_started_quiz->comment_ID; ?>" name="attempt_id"/>
57
- <input type="hidden" value="<?php echo $question->ID; ?>" name="quiz_question_id"/>
58
- <input type="hidden" value="tutor_answering_quiz_question" name="tutor_action"/>
59
- <?php do_action('tutor_quiz/single/before/question/form_field'); ?>
 
 
60
 
61
- <div class="tutor-quiz-answare-wrap">
62
- <?php
63
- if ( $answers ) {
64
- if ( $question_type === 'true_false' || $question_type === 'single_choice' ) {
65
- foreach ( $answers as $answer ) {
66
- $answer_content = json_decode( $answer->comment_content, true );
67
- ?>
 
 
 
 
 
68
  <label>
69
- <input name="attempt[<?php echo $is_started_quiz->comment_ID; ?>][quiz_question][<?php echo $question->ID; ?>]"
70
- type="radio" value="<?php echo $answer->comment_ID; ?>">
71
- <span>
72
- <?php
73
- if ( isset( $answer_content['answer_option_text'] ) ) {
74
- echo $answer_content['answer_option_text'];
75
- }
76
- ?>
77
- </span>
 
 
 
 
 
 
 
 
 
78
  </label>
79
- <?php
80
- }
81
- }elseif($question_type === 'multiple_choice' ){
82
- foreach ( $answers as $answer ) {
83
- $answer_content = json_decode( $answer->comment_content, true );
84
- ?>
85
  <label>
86
- <input name="attempt[<?php echo $is_started_quiz->comment_ID; ?>][quiz_question][<?php echo $question->ID; ?>][]" type="checkbox" value="<?php echo $answer->comment_ID; ?>">
87
- <span>
88
- <?php
89
- if ( isset( $answer_content['answer_option_text'] ) ) {
90
- echo $answer_content['answer_option_text'];
91
- }
92
- ?>
93
- </span>
 
 
 
 
 
 
 
 
 
 
94
  </label>
95
- <?php
96
- }
97
- }
98
- }
99
- ?>
100
- </div>
101
- <?php do_action('tutor_quiz/single/after/question/form_field'); ?>
102
-
103
- <?php do_action('tutor_quiz/single/before/question/form_submit_btn'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
- <div class="quiz-answer-footer-bar">
106
- <div class="quiz-footer-button">
107
- <button type="submit" name="quiz_answer_submit_btn" value="quiz_answer_submit" class="tutor-button tutor-success"><?php _e( 'Answer and Next Question', 'tutor' ); ?></button>
108
- </div>
109
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
- <?php do_action('tutor_quiz/single/after/question/form_submit_btn'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
- </form>
114
 
115
- <?php do_action('tutor_quiz/single/after/question/form'); ?>
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
- </div>
119
- </div>
120
 
121
- <?php do_action('tutor_quiz/single/after/question'); ?>
 
 
 
 
 
 
 
 
122
 
 
 
123
 
124
  <?php
125
- }else{
126
- do_action('tutor_quiz/single/before/finish-quiz'); ?>
127
 
128
- <div class="start-quiz-wrap">
129
- <form id="tutor-finish-quiz" method="post">
 
 
130
  <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
131
 
132
- <input type="hidden" value="<?php echo get_the_ID(); ?>" name="quiz_id"/>
133
- <input type="hidden" value="tutor_finish_quiz_attempt" name="tutor_action"/>
134
 
135
- <button type="submit" class="tutor-button" name="finish_quiz_btn" value="finish_quiz">
136
- <i class="icon-floppy"></i> <?php _e( 'Finish', 'tutor' ); ?>
137
- </button>
138
- </form>
139
- </div>
140
 
141
- <?php do_action('tutor_quiz/single/after/finish-quiz');
142
  }
143
  }else{
144
  if ($attempt_remaining > 0) {
145
- do_action('tutor_quiz/single/before/start-quiz'); ?>
146
-
147
- <div class="start-quiz-wrap">
148
- <form id="tutor-start-quiz" method="post">
149
  <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
150
 
151
- <input type="hidden" value="<?php echo get_the_ID(); ?>" name="quiz_id"/>
152
- <input type="hidden" value="tutor_start_quiz" name="tutor_action"/>
153
 
154
- <button type="submit" class="tutor-button" name="start_quiz_btn" value="start_quiz">
155
- <i class="icon-hourglass-1"></i> <?php _e( 'Start Quiz', 'tutor' ); ?>
156
- </button>
157
- </form>
158
- </div>
159
 
160
- <?php do_action('tutor_quiz/single/after/start-quiz');
161
  }
 
 
 
162
  if ($previous_attempts){
163
- do_action('tutor_quiz/single/before/quiz-attempted-table');
164
  ?>
165
-
166
- <h4 class="tutor-quiz-attempt-history-title"><?php _e('Previous attempts', 'tutor'); ?></h4>
167
-
168
- <div class="tutor-quiz-attempt-history">
169
- <table>
170
- <tr>
171
- <th><?php _e('Time', 'tutor'); ?></th>
172
- <th><?php _e('Questions', 'tutor'); ?></th>
173
- <th><?php _e('Total Marks', 'tutor'); ?></th>
174
- <th><?php _e('Earned Marks', 'tutor'); ?></th>
175
- <th><?php _e('Result', 'tutor'); ?></th>
176
- </tr>
177
  <?php
178
  foreach ( $previous_attempts as $attempt){
179
- $attempt_info = maybe_unserialize($attempt->quiz_attempt_info);
180
  ?>
181
 
182
- <tr>
183
- <td>
184
  <?php
185
- echo date_i18n(get_option('date_format'), strtotime($attempt->quiz_started_at)).' '.date_i18n(get_option('time_format'), strtotime($attempt->quiz_started_at));
186
 
187
- $manual_reviewed = tutor_utils()->avalue_dot('manual_reviewed', $attempt_info);
188
- if ($manual_reviewed){
189
- if ($manual_reviewed){
190
- ?>
191
- <p class="attempt-reviewed-text">
192
- <?php
193
- echo __('Manually reviewed at', 'tutor').' <br /> '.date_i18n(get_option('date_format', strtotime($manual_reviewed))).' '.date_i18n(get_option('time_format', strtotime
194
- ($manual_reviewed)));
195
- ?>
196
- </p>
197
  <?php
198
- }
 
 
 
199
  }
200
  ?>
 
 
 
 
201
 
 
 
 
202
 
203
-
204
- </td>
205
- <td>
206
  <?php
207
- echo tutor_utils()->avalue_dot('total_question', $attempt_info)
 
208
  ?>
209
- </td>
210
 
211
- <td>
212
  <?php
213
- $answers_mark = wp_list_pluck(tutor_utils()->avalue_dot('answers', $attempt_info), 'question_mark' );
214
- $total_marks = array_sum($answers_mark);
215
- echo $total_marks;
216
- ?>
217
- </td>
218
 
219
- <td>
220
- <?php
221
- $earned_marks = tutor_utils()->avalue_dot('marks_earned', $attempt_info);
222
- $earned_percentage = $earned_marks > 0 ? ( number_format(($earned_marks * 100) / $total_marks)) : 0;
223
- echo $earned_marks."({$earned_percentage}%)";
224
  ?>
225
- </td>
226
 
227
- <td>
228
  <?php
229
  if ($earned_percentage >= $passing_grade){
230
  echo '<span class="result-pass">'.__('Pass', 'tutor').'</span>';
@@ -232,20 +458,17 @@ $attempt_remaining = $attempts_allowed - $attempted_count;
232
  echo '<span class="result-fail">'.__('Fail', 'tutor').'</span>';
233
  }
234
  ?>
235
- </td>
236
- </tr>
237
 
238
  <?php
239
  }
240
  ?>
241
 
242
- </table>
243
- </div>
244
- <?php do_action('tutor_quiz/single/after/quiz-attempted-table'); ?>
245
  <?php
246
  }
247
  }
248
  ?>
249
- </div>
250
-
251
- <?php do_action('tutor_quiz/single/after/body'); ?>
4
  $currentPost = $post;
5
 
6
  $is_started_quiz = tutor_utils()->is_started_quiz();
7
+
8
  $previous_attempts = tutor_utils()->quiz_attempts();
9
  $attempted_count = is_array($previous_attempts) ? count($previous_attempts) : 0;
10
 
14
  $attempt_remaining = $attempts_allowed - $attempted_count;
15
  ?>
16
 
 
 
17
  <div id="tutor-quiz-body" class="tutor-quiz-body tutor-quiz-body-<?php the_ID(); ?>">
18
  <?php
19
  if ($is_started_quiz){
20
+ $quiz_attempt_info = tutor_utils()->quiz_attempt_info($is_started_quiz->attempt_info);
21
  $quiz_attempt_info['date_time_now'] = date("Y-m-d H:i:s");
22
 
23
+ $time_limit_seconds = tutor_utils()->avalue_dot('time_limit.time_limit_seconds', $quiz_attempt_info);
24
+ $question_layout_view = tutor_utils()->avalue_dot('question_layout_view', $quiz_attempt_info);
25
 
26
+ $hide_quiz_time_display = (bool) tutor_utils()->avalue_dot('hide_quiz_time_display', $quiz_attempt_info);
27
+ $hide_question_number_overview = (bool) tutor_utils()->avalue_dot('hide_question_number_overview', $quiz_attempt_info);
 
28
 
29
+ $remaining_time_secs = (strtotime($is_started_quiz->attempt_started_at) + $time_limit_seconds ) - strtotime($quiz_attempt_info['date_time_now']);
 
 
 
 
30
 
31
+ $remaining_time_context = tutor_utils()->seconds_to_time_context($remaining_time_secs);
32
+ $questions = tutor_utils()->get_random_questions_by_quiz();
33
+ ?>
34
 
35
+ <div class="quiz-head-meta-info">
36
+ <?php
37
+ if ( ! $hide_quiz_time_display){
38
+ ?>
39
+ <div class="time-remaining">
40
+ <?php _e('Time remaining : '); ?> <span id="tutor-quiz-time-update" data-attempt-settings="<?php echo esc_attr(json_encode($is_started_quiz)) ?>" data-attempt-meta="<?php echo esc_attr(json_encode($quiz_attempt_info)) ?>"><?php echo $remaining_time_context; ?></span>
41
+ </div>
42
+ <?php } ?>
43
+ </div>
44
+
45
+ <?php
46
+ if (is_array($questions) && count($questions)) {
47
+ ?>
48
+ <div id="tutor-quiz-attempt-questions-wrap" data-question-layout-view="<?php echo $question_layout_view; ?>">
49
 
 
50
  <?php
51
+ if ($question_layout_view === 'question_pagination'){
52
+ $question_i = 0;
53
+ ?>
54
+ <div class="tutor-quiz-questions-pagination">
55
+ <ul>
56
+ <?php
57
+ foreach ($questions as $question) {
58
+ $question_i++;
59
+ echo "<li><a href='#quiz-attempt-single-question-{$question->question_id}' class='tutor-quiz-question-paginate-item'>{$question_i}</a> </li>";
60
+ }
61
+ ?>
62
+ </ul>
63
+ </div>
64
+ <?php
65
+ }
66
  ?>
 
67
 
68
+ <form id="tutor-answering-quiz" method="post">
69
+ <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
70
+ <input type="hidden" value="<?php echo $is_started_quiz->attempt_id; ?>" name="attempt_id"/>
71
+ <input type="hidden" value="tutor_answering_quiz_question" name="tutor_action"/>
72
+ <?php
73
+ $question_i = 0;
74
+ foreach ($questions as $question) {
75
+ $question_i++;
76
+ $question_settings = maybe_unserialize($question->question_settings);
77
+
78
+ $style_display = ($question_layout_view !== 'question_below_each_other' && $question_i == 1) ? 'block' : 'none';
79
+ if ($question_layout_view === 'question_below_each_other'){
80
+ $style_display = 'block';
81
+ }
82
+
83
+ $next_question = isset($questions[$question_i]) ? $questions[$question_i] : false;
84
+ ?>
85
+ <div id="quiz-attempt-single-question-<?php echo $question->question_id; ?>" class="quiz-attempt-single-question quiz-attempt-single-question-<?php echo $question_i; ?>" style="display: <?php echo $style_display; ?> ;" <?php echo $next_question ? "data-next-question-id='#quiz-attempt-single-question-{$next_question->question_id}'" : '' ; ?> >
86
+
87
+ <?php echo "<input type='hidden' name='attempt[{$is_started_quiz->attempt_id}][quiz_question_ids][]' value='{$question->question_id}' />";
88
 
 
89
 
90
+ $question_type = $question->question_type;
91
+ $answers = tutor_utils()->get_answers_by_quiz_question($question->question_id);
92
+ $show_question_mark = (bool) tutor_utils()->avalue_dot('show_question_mark', $question_settings);
93
 
94
+ echo '<h4 class="question-text">';
95
+ if ( ! $hide_question_number_overview){
96
+ echo $question_i;
97
+ }
98
+ echo $question->question_title;
99
+ echo '</h4>';
100
 
101
+ if ($show_question_mark){
102
+ echo '<p class="question-marks"> '.__('Marks : ', 'tutor').$question->question_mark.' </p>';
103
+ }
104
+ ?>
105
+ <p class="question-description"><?php echo $question->question_description; ?></p>
106
+
107
+ <div class="tutor-quiz-answers-wrap">
108
+ <?php
109
+ if ( is_array($answers) && count($answers) ) {
110
+ foreach ($answers as $answer){
111
+ if ( $question_type === 'true_false' || $question_type === 'single_choice' ) {
112
+ ?>
113
  <label>
114
+ <div class="quiz-answer-input-field">
115
+ <input name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>]" type="radio" value="<?php echo $answer->answer_id; ?>">
116
+ </div>
117
+
118
+ <div class="quiz-answer-input-body">
119
+ <?php
120
+ if ($answer->answer_view_format !== 'image'){
121
+ echo "<p class='tutor-quiz-answer-title'>{$answer->answer_title}</p>";
122
+ }
123
+ if ($answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image'){
124
+ ?>
125
+ <div class="quiz-answer-image-wrap">
126
+ <img src="<?php echo wp_get_attachment_image_url($answer->image_id, 'full') ?>" />
127
+ </div>
128
+ <?php
129
+ }
130
+ ?>
131
+ </div>
132
  </label>
133
+ <?php
134
+ }elseif ($question_type === 'multiple_choice'){
135
+ ?>
 
 
 
136
  <label>
137
+ <div class="quiz-answer-input-field">
138
+ <input name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>][]" type="checkbox" value="<?php echo $answer->answer_id; ?>">
139
+ </div>
140
+
141
+ <div class="quiz-answer-input-body">
142
+ <?php
143
+ if ($answer->answer_view_format !== 'image'){
144
+ echo "<p class='tutor-quiz-answer-title'>{$answer->answer_title}</p>";
145
+ }
146
+ if ($answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image'){
147
+ ?>
148
+ <div class="quiz-answer-image-wrap">
149
+ <img src="<?php echo wp_get_attachment_image_url($answer->image_id, 'full') ?>" />
150
+ </div>
151
+ <?php
152
+ }
153
+ ?>
154
+ </div>
155
  </label>
156
+ <?php
157
+ }
158
+ elseif ($question_type === 'fill_in_the_blank'){
159
+ ?>
160
+ <p class="fill-in-the-blank-field">
161
+ <?php
162
+ $count_dash_fields = substr_count($answer->answer_title, '{dash}');
163
+ if ($count_dash_fields){
164
+
165
+ $dash_string = array();
166
+ $input_data = array();
167
+ for($i=1; $i <=$count_dash_fields; $i ++){
168
+ $dash_string[] = '{dash}';
169
+ $input_data[] = "<input type='text' name='attempt[{$is_started_quiz->attempt_id}][quiz_question][{$question->question_id}][]' class='fill-in-the-blank-text-input' />";
170
+ }
171
+ echo str_replace($dash_string, $input_data, $answer->answer_title);
172
+ }
173
+ ?>
174
+ </p>
175
+ <?php
176
+ }
177
+ elseif ($question_type === 'ordering'){
178
+ ?>
179
+ <div class="question-type-ordering-item">
180
+ <div class="answer-title">
181
+ <?php
182
+ if ($answer->answer_view_format !== 'image'){
183
+ echo "<p class='tutor-quiz-answer-title'>{$answer->answer_title}</p>";
184
+ }
185
+ if ($answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image'){
186
+ ?>
187
+ <div class="quiz-answer-image-wrap">
188
+ <img src="<?php echo wp_get_attachment_image_url($answer->image_id, 'full') ?>" />
189
+ </div>
190
+ <?php
191
+ }
192
+ ?>
193
+ </div>
194
+ <span class="answer-sorting-bar"><i class="tutor-icon-menu-2"></i> </span>
195
+ <input type="hidden" name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>][answers][]" value="<?php echo $answer->answer_id; ?>" >
196
+ </div>
197
+ <?php
198
+ }
199
+ }
200
 
201
+ /**
202
+ * Question type matchind and image matching
203
+ */
204
+ if ($question_type === 'matching' || $question_type === 'image_matching'){
205
+ ?>
206
+ <div class="quiz-answers-type-matching-wrap <?php echo 'answer-type-'.$question_type ?> ">
207
+ <div class="quiz-draggable-rand-answers">
208
+ <?php
209
+ $rand_answers = tutor_utils()->get_answers_by_quiz_question($question->question_id, true);
210
+ foreach ($rand_answers as $rand_answer){
211
+ ?>
212
+ <div class="quiz-draggable-answer-item">
213
+ <?php
214
+ if ($question_type === 'matching'){
215
+ echo "<span class='draggable-answer-title'>{$rand_answer->answer_two_gap_match}</span>";
216
+ }else{
217
+ echo "<span class='draggable-answer-title'>{$rand_answer->answer_title}</span>";
218
+ }
219
+ ?>
220
+ <span class="draggable-answer-icon"> <i class="tutor-icon-menu-2"></i> </span>
221
+ <input type="hidden" name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>][answers][]" value="<?php echo $rand_answer->answer_id; ?>" >
222
+ </div>
223
+ <?php
224
+ }
225
+ ?>
226
+ </div>
227
+
228
+ <div class="quiz-answer-matching-items-wrap">
229
+
230
+ <?php
231
+ foreach ($answers as $answer){
232
+ ?>
233
+ <div class="quiz-answer-item-matching">
234
+ <div class="quiz-answer-matching-title">
235
+ <?php
236
+ if ($question_type === 'matching') {
237
+
238
+ if ($answer->answer_view_format !== 'image'){
239
+ echo "<p class='tutor-quiz-answer-title'>{$answer->answer_title}</p>";
240
+ }
241
+ if ($answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image'){
242
+ ?>
243
+ <div class="quiz-answer-image-wrap">
244
+ <img src="<?php echo wp_get_attachment_image_url($answer->image_id, 'full') ?>" />
245
+ </div>
246
+ <?php
247
+ }
248
+ }elseif (intval($answer->image_id)){
249
+ echo '<img src="'.wp_get_attachment_image_url($answer->image_id, 'full').'" />';
250
+ }
251
+ ?>
252
+ </div>
253
+ <div class="quiz-answer-matching-droppable"></div>
254
+ </div>
255
+ <?php
256
+ }
257
+ ?>
258
+
259
+ </div>
260
+ </div>
261
+ <?php
262
+ }
263
+ }
264
 
265
+ /**
266
+ * For Open Ended Question Type
267
+ */
268
+ if ($question_type === 'open_ended' || $question_type === 'short_answer'){
269
+ ?>
270
+ <textarea class="question_type_<?php echo $question_type; ?>" name="attempt[<?php echo
271
+ $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>]"></textarea>
272
+ <?php
273
+
274
+ if ($question_type === 'short_answer'){
275
+ $characters_limit = tutor_utils()->avalue_dot('short_answer_characters_limit', $quiz_attempt_info);
276
+ echo '<p class="answer_limit_desc"> characters remaining <span class="characters_remaining">'.$characters_limit.'</span> </p>';
277
+ }
278
 
279
+ }
280
 
 
281
 
282
+ if ($question_type === 'image_answering'){
283
+ ?>
284
+ <div class="quiz-image-answering-wrap">
285
+ <?php
286
+ foreach ($answers as $answer){
287
+ ?>
288
+ <div class="quiz-image-answering-answer">
289
+ <?php
290
+ if (intval($answer->image_id)){
291
+ ?>
292
+ <div class="quiz-image-answering-image-wrap">
293
+ <?php echo '<img src="'.wp_get_attachment_image_url($answer->image_id, 'full').'" />'; ?>
294
+ </div>
295
+
296
+ <div class="quiz-image-answering-input-field-wrap">
297
+ <input type="text" name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>][answer_id][<?php echo $answer->answer_id; ?>]" >
298
+ </div>
299
+ <?php
300
+ }
301
+ ?>
302
+ </div>
303
+ <?php
304
+ }
305
+ ?>
306
+ </div>
307
+ <?php
308
+ }
309
+ ?>
310
+ </div>
311
+
312
+ <?php
313
+ if ($question_layout_view !== 'question_below_each_other'){
314
+ if ($next_question){
315
+ ?>
316
+ <div class="quiz-answer-footer-bar">
317
+ <div class="quiz-footer-button">
318
+ <button type="button" value="quiz_answer_submit" class="tutor-button
319
+ tutor-success tutor-quiz-answer-next-btn"><?php _e( 'Answer &amp; Next Question', 'tutor' ); ?></button>
320
+ </div>
321
+ </div>
322
+ <?php
323
+ }else{
324
+ ?>
325
+ <div class="quiz-answer-footer-bar">
326
+ <div class="quiz-footer-button">
327
+ <button type="submit" name="quiz_answer_submit_btn" value="quiz_answer_submit" class="tutor-button tutor-success"><?php
328
+ _e( 'Submit Quiz', 'tutor' ); ?></button>
329
+ </div>
330
+ </div>
331
+ <?php
332
+ }
333
+ }
334
+ ?>
335
+ </div>
336
 
337
+ <?php
338
+ }
339
 
340
+ if ($question_layout_view === 'question_below_each_other'){
341
+ ?>
342
+ <div class="quiz-answer-footer-bar">
343
+ <div class="quiz-footer-button">
344
+ <button type="submit" name="quiz_answer_submit_btn" value="quiz_answer_submit" class="tutor-button
345
+ tutor-success"><?php _e( 'Submit Quiz', 'tutor' ); ?></button>
346
+ </div>
347
+ </div>
348
+ <?php } ?>
349
 
350
+ </form>
351
+ </div>
352
 
353
  <?php
 
 
354
 
355
+ }else{
356
+ ?>
357
+ <div class="start-quiz-wrap">
358
+ <form id="tutor-finish-quiz" method="post">
359
  <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
360
 
361
+ <input type="hidden" value="<?php echo get_the_ID(); ?>" name="quiz_id"/>
362
+ <input type="hidden" value="tutor_finish_quiz_attempt" name="tutor_action"/>
363
 
364
+ <button type="submit" class="tutor-button" name="finish_quiz_btn" value="finish_quiz">
365
+ <i class="icon-floppy"></i> <?php _e( 'Finish', 'tutor' ); ?>
366
+ </button>
367
+ </form>
368
+ </div>
369
 
370
+ <?php
371
  }
372
  }else{
373
  if ($attempt_remaining > 0) {
374
+ ?>
375
+ <div class="start-quiz-wrap">
376
+ <form id="tutor-start-quiz" method="post">
 
377
  <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
378
 
379
+ <input type="hidden" value="<?php echo get_the_ID(); ?>" name="quiz_id"/>
380
+ <input type="hidden" value="tutor_start_quiz" name="tutor_action"/>
381
 
382
+ <button type="submit" class="tutor-button" name="start_quiz_btn" value="start_quiz">
383
+ <i class="icon-hourglass-1"></i> <?php _e( 'Start Quiz', 'tutor' ); ?>
384
+ </button>
385
+ </form>
386
+ </div>
387
 
388
+ <?php
389
  }
390
+
391
+
392
+
393
  if ($previous_attempts){
 
394
  ?>
395
+ <h4 class="tutor-quiz-attempt-history-title"><?php _e('Previous attempts', 'tutor'); ?></h4>
396
+
397
+ <div class="tutor-quiz-attempt-history">
398
+ <table>
399
+ <tr>
400
+ <th><?php _e('Time', 'tutor'); ?></th>
401
+ <th><?php _e('Questions', 'tutor'); ?></th>
402
+ <th><?php _e('Total Marks', 'tutor'); ?></th>
403
+ <th><?php _e('Earned Marks', 'tutor'); ?></th>
404
+ <th><?php _e('Pass Mark', 'tutor'); ?></th>
405
+ <th><?php _e('Result', 'tutor'); ?></th>
406
+ </tr>
407
  <?php
408
  foreach ( $previous_attempts as $attempt){
 
409
  ?>
410
 
411
+ <tr>
412
+ <td>
413
  <?php
414
+ echo date_i18n(get_option('date_format'), strtotime($attempt->attempt_started_at)).' '.date_i18n(get_option('time_format'), strtotime($attempt->attempt_started_at));
415
 
416
+ if ($attempt->is_manually_reviewed){
417
+ ?>
418
+ <p class="attempt-reviewed-text">
 
 
 
 
 
 
 
419
  <?php
420
+ echo __('Manually reviewed at', 'tutor').' <br /> '.date_i18n(get_option('date_format', strtotime($attempt->manually_reviewed_at))).' '.date_i18n(get_option('time_format', strtotime($attempt->manually_reviewed_at)));
421
+ ?>
422
+ </p>
423
+ <?php
424
  }
425
  ?>
426
+ </td>
427
+ <td>
428
+ <?php echo $attempt->total_questions; ?>
429
+ </td>
430
 
431
+ <td>
432
+ <?php echo $attempt->total_marks; ?>
433
+ </td>
434
 
435
+ <td>
 
 
436
  <?php
437
+ $earned_percentage = $attempt->earned_marks > 0 ? ( number_format(($attempt->earned_marks * 100) / $attempt->total_marks)) : 0;
438
+ echo $attempt->earned_marks."({$earned_percentage}%)";
439
  ?>
440
+ </td>
441
 
442
+ <td>
443
  <?php
 
 
 
 
 
444
 
445
+ $pass_marks = ($attempt->total_marks * $passing_grade) / 100;
446
+ if ($pass_marks > 0){
447
+ echo number_format_i18n($pass_marks, 2);
448
+ }
449
+ echo "({$passing_grade}%)";
450
  ?>
451
+ </td>
452
 
453
+ <td>
454
  <?php
455
  if ($earned_percentage >= $passing_grade){
456
  echo '<span class="result-pass">'.__('Pass', 'tutor').'</span>';
458
  echo '<span class="result-fail">'.__('Fail', 'tutor').'</span>';
459
  }
460
  ?>
461
+ </td>
462
+ </tr>
463
 
464
  <?php
465
  }
466
  ?>
467
 
468
+ </table>
469
+ </div>
 
470
  <?php
471
  }
472
  }
473
  ?>
474
+ </div>
 
 
templates/single/quiz/single_quiz_contents.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php
3
+ $course = tutor_utils()->get_course_by_quiz(get_the_ID());
4
+ ?>
5
+
6
+
7
+
8
+ <div class="tutor-single-page-top-bar">
9
+ <div class="tutor-topbar-item tutor-hide-sidebar-bar">
10
+ <a href="javascript:;" class="tutor-lesson-sidebar-hide-bar"><i class="tutor-icon-menu-2"></i> </a>
11
+ </div>
12
+ <div class="tutor-topbar-item tutor-topbar-content-title-wrap">
13
+ <?php
14
+ tutor_utils()->get_lesson_type_icon(get_the_ID(), true, true);
15
+ the_title(); ?>
16
+ </div>
17
+
18
+ <div class="tutor-topbar-item tutor-topbar-back-to-curse-wrap">
19
+ <a href="<?php echo get_the_permalink($course->ID); ?>">
20
+ <i class="tutor-icon-next-2"></i> <?php echo sprintf(__('Go to %s Course Home %s', 'tutor'), '<strong>', '</strong>') ; ?>
21
+ </a>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="tutor-quiz-single-wrap ">
26
+ <input type="hidden" name="tutor_quiz_id" id="tutor_quiz_id" value="<?php the_ID(); ?>">
27
+
28
+ <?php
29
+ if ($course){
30
+ tutor_single_quiz_top();
31
+ tutor_single_quiz_body();
32
+ }else{
33
+ tutor_single_quiz_no_course_belongs();
34
+ }
35
+ ?>
36
+ </div>
tutor.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://https://themeum.com/tutor
5
  Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create
6
  courses, lessons and quizzes.
7
  Author: Themeum
8
- Version: 1.0.0-alpha
9
  Author URI: http://themeum.com
10
  Requires at least: 4.5
11
  Tested up to: 4.9
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) )
18
  /**
19
  * Defined the tutor main file
20
  */
21
- define('TUTOR_VERSION', '1.0.0-alpha');
22
  define('TUTOR_FILE', __FILE__);
23
 
24
  if ( ! function_exists('tutor')) {
@@ -27,18 +27,18 @@ if ( ! function_exists('tutor')) {
27
  $hasPro = defined('TUTOR_PRO_VERSION');
28
 
29
  $info = array(
30
- 'path' => $path,
31
- 'url' => plugin_dir_url( TUTOR_FILE ),
32
- 'basename' => plugin_basename( TUTOR_FILE ),
33
- 'version' => TUTOR_VERSION,
34
- 'nonce_action' => 'tutor_nonce_action',
35
- 'nonce' => '_wpnonce',
36
- 'course_post_type' => apply_filters( 'tutor_course_post_type', 'course' ),
37
- 'lesson_post_type' => apply_filters( 'tutor_lesson_post_type', 'lesson' ),
38
- 'instructor_role' => apply_filters( 'tutor_instructor_role', 'tutor_instructor' ),
39
- 'instructor_role_name' => apply_filters( 'tutor_instructor_role_name', __( 'Tutor Instructor', 'tutor' ) ),
40
- 'template_path' => apply_filters( 'tutor_template_path', 'tutor/' ),
41
- 'has_pro' => $hasPro,
42
  );
43
 
44
  return (object) $info;
5
  Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create
6
  courses, lessons and quizzes.
7
  Author: Themeum
8
+ Version: 1.0.0
9
  Author URI: http://themeum.com
10
  Requires at least: 4.5
11
  Tested up to: 4.9
18
  /**
19
  * Defined the tutor main file
20
  */
21
+ define('TUTOR_VERSION', '1.0.0');
22
  define('TUTOR_FILE', __FILE__);
23
 
24
  if ( ! function_exists('tutor')) {
27
  $hasPro = defined('TUTOR_PRO_VERSION');
28
 
29
  $info = array(
30
+ 'path' => $path,
31
+ 'url' => plugin_dir_url( TUTOR_FILE ),
32
+ 'basename' => plugin_basename( TUTOR_FILE ),
33
+ 'version' => TUTOR_VERSION,
34
+ 'nonce_action' => 'tutor_nonce_action',
35
+ 'nonce' => '_wpnonce',
36
+ 'course_post_type' => apply_filters( 'tutor_course_post_type', 'course' ),
37
+ 'lesson_post_type' => apply_filters( 'tutor_lesson_post_type', 'lesson' ),
38
+ 'instructor_role' => apply_filters( 'tutor_instructor_role', 'tutor_instructor' ),
39
+ 'instructor_role_name' => apply_filters( 'tutor_instructor_role_name', __( 'Tutor Instructor', 'tutor' ) ),
40
+ 'template_path' => apply_filters( 'tutor_template_path', 'tutor/' ),
41
+ 'has_pro' => $hasPro,
42
  );
43
 
44
  return (object) $info;
views/metabox/course-contents.php CHANGED
@@ -69,23 +69,40 @@
69
 
70
  <div class="tutor-lessons">
71
  <?php
72
- $lessons = tutor_utils()->get_lessons_by_topic($topic->ID, -1);
73
  foreach ($lessons->posts as $lesson){
74
  $attached_lesson_ids[] = $lesson->ID;
75
- ?>
76
- <div id="tutor-lesson-<?php echo $lesson->ID; ?>" class=" tutor-lesson tutor-lesson-<?php echo $lesson->ID; ?>">
77
- <div class="tutor-lesson-top">
78
- <i class="tutor-icon-move"></i>
79
- <a href="javascript:;" class="open-tutor-lesson-modal" data-lesson-id="<?php echo $lesson->ID; ?>" data-topic-id="<?php echo $topic->ID; ?>"><?php echo $lesson->post_title; ?> </a>
80
-
81
- <a href="<?php echo admin_url("post.php?post={$lesson->ID}&action=edit"); ?>"><i class="tutor-icon-pencil"></i> </a>
82
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
- <a href="javascript:;" class="tutor-delete-lesson-btn" data-lesson-id="<?php echo $lesson->ID; ?>"><i class="tutor-icon-garbage"></i></a>
85
-
 
 
 
 
 
 
 
 
 
 
 
 
86
  </div>
87
- </div>
88
- <?php
89
  }
90
  ?>
91
 
@@ -128,32 +145,34 @@
128
  </div>
129
 
130
  <div class="tutor_add_quiz_wrap" data-add-quiz-under="<?php echo $topic->ID; ?>">
 
 
131
  <div class="tutor-available-quizzes">
132
  <?php
133
- $attached_quizzes = tutor_utils()->get_attached_quiz($topic->ID);
134
  if ($attached_quizzes){
135
  foreach ($attached_quizzes as $attached_quiz){
136
- ?>
137
- <div id="added-quiz-id-<?php echo $attached_quiz->ID; ?>" class="added-quiz-item added-quiz-item-<?php echo $attached_quiz->ID; ?>" data-quiz-id="<?php echo $attached_quiz->ID; ?>">
138
  <span class="quiz-icon"><i class="dashicons dashicons-clock"></i></span>
139
  <span class="quiz-name">
140
- <?php edit_post_link( $attached_quiz->post_title, null, null, $attached_quiz->ID ); ?>
141
  </span>
142
  <span class="quiz-control">
143
  <a href="javascript:;" class="tutor-quiz-delete-btn"><i class="tutor-icon-garbage"></i></a>
144
  </span>
145
  </div>
146
  <?php
147
- }
148
  }
149
- ?>
150
  </div>
 
151
 
152
  <div class="tutor-add-quiz-button-wrap">
153
- <a href="javascript:;" class="create-lesson-in-topic-btn open-tutor-lesson-modal" data-topic-id="<?php echo $topic->ID; ?>"
154
- data-lesson-id="0" ><?php _e('Add new lesson', 'tutor'); ?></a>
155
 
156
- <!--<button type="button" class="tutor-add-quiz-btn"> <?php /*_e('Add Topic Quiz', 'tutor'); */?> </button>-->
157
  </div>
158
 
159
  </div>
@@ -186,7 +205,6 @@
186
  ?>
187
  <div id="tutor-lesson-<?php echo $lesson->ID; ?>" class="tutor-lesson tutor-lesson-<?php echo $lesson->ID; ?>">
188
 
189
-
190
  <div class="tutor-lesson-top">
191
  <i class="tutor-icon-move"></i>
192
  <a href="javascript:;" class="open-tutor-lesson-modal" data-lesson-id="<?php echo $lesson->ID; ?>"><?php echo $lesson->post_title; ?> </a>
@@ -194,7 +212,6 @@
194
  <a href="<?php echo admin_url("post.php?post={$lesson->ID}&action=edit"); ?>"><i class="tutor-icon-pencil"></i> </a>
195
 
196
  <a href="javascript:;" class="tutor-delete-lesson-btn" data-lesson-id="<?php echo $lesson->ID; ?>"><i class="tutor-icon-garbage"></i></a>
197
-
198
  </div>
199
 
200
  </div>
69
 
70
  <div class="tutor-lessons">
71
  <?php
72
+ $lessons = tutor_utils()->get_course_contents_by_topic($topic->ID, -1);
73
  foreach ($lessons->posts as $lesson){
74
  $attached_lesson_ids[] = $lesson->ID;
 
 
 
 
 
 
 
75
 
76
+ if ($lesson->post_type === 'tutor_quiz'){
77
+ $quiz = $lesson;
78
+ ?>
79
+ <div id="tutor-quiz-<?php echo $quiz->ID; ?>" class="course-content-item tutor-quiz tutor-quiz-<?php echo $topic->ID; ?>">
80
+ <div class="tutor-lesson-top">
81
+ <i class="tutor-icon-move"></i>
82
+ <a href="javascript:;" class="open-tutor-quiz-modal" data-quiz-id="<?php echo $quiz->ID; ?>" data-topic-id="<?php echo $topic->ID; ?>">
83
+ <i class=" tutor-icon-doubt"></i>[QUIZ] <?php echo $quiz->post_title; ?>
84
+ </a>
85
+ <a href="javascript:;" class="tutor-delete-quiz-btn" data-quiz-id="<?php echo $quiz->ID; ?>"><i class="tutor-icon-garbage"></i></a>
86
+ </div>
87
+ </div>
88
 
89
+ <?php
90
+ }else {
91
+ ?>
92
+ <div id="tutor-lesson-<?php echo $lesson->ID; ?>" class="course-content-item tutor-lesson tutor-lesson-<?php echo
93
+ $lesson->ID; ?>">
94
+ <div class="tutor-lesson-top">
95
+ <i class="tutor-icon-move"></i>
96
+ <a href="javascript:;" class="open-tutor-lesson-modal" data-lesson-id="<?php echo $lesson->ID; ?>" data-topic-id="<?php echo $topic->ID; ?>"><?php echo $lesson->post_title; ?> </a>
97
+ <!--
98
+ <a href="<?php /*echo admin_url( "post.php?post={$lesson->ID}&action=edit" ); */?>"><i class="tutor-icon-pencil"></i>
99
+ </a>-->
100
+
101
+ <a href="javascript:;" class="tutor-delete-lesson-btn" data-lesson-id="<?php echo $lesson->ID; ?>"><i class="tutor-icon-garbage"></i></a>
102
+ </div>
103
  </div>
104
+ <?php
105
+ }
106
  }
107
  ?>
108
 
145
  </div>
146
 
147
  <div class="tutor_add_quiz_wrap" data-add-quiz-under="<?php echo $topic->ID; ?>">
148
+
149
+ <!--
150
  <div class="tutor-available-quizzes">
151
  <?php
152
+ /* $attached_quizzes = tutor_utils()->get_attached_quiz($topic->ID);
153
  if ($attached_quizzes){
154
  foreach ($attached_quizzes as $attached_quiz){
155
+ */?>
156
+ <div id="added-quiz-id-<?php /*echo $attached_quiz->ID; */?>" class="added-quiz-item added-quiz-item-<?php /*echo $attached_quiz->ID; */?>" data-quiz-id="<?php /*echo $attached_quiz->ID; */?>">
157
  <span class="quiz-icon"><i class="dashicons dashicons-clock"></i></span>
158
  <span class="quiz-name">
159
+ <?php /*edit_post_link( $attached_quiz->post_title, null, null, $attached_quiz->ID ); */?>
160
  </span>
161
  <span class="quiz-control">
162
  <a href="javascript:;" class="tutor-quiz-delete-btn"><i class="tutor-icon-garbage"></i></a>
163
  </span>
164
  </div>
165
  <?php
166
+ /* }
167
  }
168
+ */?>
169
  </div>
170
+ -->
171
 
172
  <div class="tutor-add-quiz-button-wrap">
173
+ <a href="javascript:;" class="create-lesson-in-topic-btn open-tutor-lesson-modal" data-topic-id="<?php echo $topic->ID; ?>" data-lesson-id="0" ><?php _e('Add new lesson', 'tutor'); ?></a>
 
174
 
175
+ <button type="button" class="tutor-add-quiz-btn"> <?php _e('Add Topic Quiz', 'tutor'); ?> </button>
176
  </div>
177
 
178
  </div>
205
  ?>
206
  <div id="tutor-lesson-<?php echo $lesson->ID; ?>" class="tutor-lesson tutor-lesson-<?php echo $lesson->ID; ?>">
207
 
 
208
  <div class="tutor-lesson-top">
209
  <i class="tutor-icon-move"></i>
210
  <a href="javascript:;" class="open-tutor-lesson-modal" data-lesson-id="<?php echo $lesson->ID; ?>"><?php echo $lesson->post_title; ?> </a>
212
  <a href="<?php echo admin_url("post.php?post={$lesson->ID}&action=edit"); ?>"><i class="tutor-icon-pencil"></i> </a>
213
 
214
  <a href="javascript:;" class="tutor-delete-lesson-btn" data-lesson-id="<?php echo $lesson->ID; ?>"><i class="tutor-icon-garbage"></i></a>
 
215
  </div>
216
 
217
  </div>
views/metabox/course-topics.php CHANGED
@@ -47,11 +47,11 @@
47
  </div>
48
  </div>
49
 
50
- <div class="tutor-modal-wrap tutor-quiz-modal-wrap">
51
  <div class="tutor-modal-content">
52
  <div class="modal-header">
53
  <div class="search-bar">
54
- <input type="text" class="tutor-modal-search-input" placeholder="<?php _e('Search quiz...'); ?>">
55
  </div>
56
  <div class="modal-close-wrap">
57
  <a href="javascript:;" class="modal-close-btn">&times;</a>
@@ -59,24 +59,33 @@
59
  </div>
60
  <div class="modal-container"></div>
61
  <div class="modal-footer">
62
- <button type="button" class="button button-primary add_quiz_to_post_btn"><?php _e('Add Quiz', 'tutor'); ?></button>
63
  </div>
64
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  </div>
66
 
67
  <div class="tutor-modal-wrap tutor-lesson-modal-wrap">
68
  <div class="tutor-modal-content">
69
-
70
  <div class="modal-header">
71
  <div class="lesson-modal-close-wrap">
72
  <a href="javascript:;" class="modal-close-btn">&times;</a>
73
  </div>
74
  </div>
75
-
76
- <div class="modal-container">
77
-
78
-
79
- </div>
80
-
81
  </div>
82
  </div>
47
  </div>
48
  </div>
49
 
50
+ <!--<div class="tutor-modal-wrap tutor-quiz-modal-wrap">
51
  <div class="tutor-modal-content">
52
  <div class="modal-header">
53
  <div class="search-bar">
54
+ <input type="text" class="tutor-modal-search-input" placeholder="<?php /*_e('Search quiz...'); */?>">
55
  </div>
56
  <div class="modal-close-wrap">
57
  <a href="javascript:;" class="modal-close-btn">&times;</a>
59
  </div>
60
  <div class="modal-container"></div>
61
  <div class="modal-footer">
62
+ <button type="button" class="button button-primary add_quiz_to_post_btn"><?php /*_e('Add Quiz', 'tutor'); */?></button>
63
  </div>
64
  </div>
65
+ </div>-->
66
+
67
+
68
+ <div class="tutor-modal-wrap tutor-quiz-builder-modal-wrap">
69
+ <div class="tutor-modal-content">
70
+ <div class="modal-header">
71
+ <div class="modal-title">
72
+ <h1><?php _e('Quiz'); ?></h1>
73
+ </div>
74
+ <div class="modal-close-wrap">
75
+ <a href="javascript:;" class="modal-close-btn"><i class="tutor-icon-line-cross"></i> </a>
76
+ </div>
77
+ </div>
78
+ <div class="modal-container"></div>
79
+ </div>
80
  </div>
81
 
82
  <div class="tutor-modal-wrap tutor-lesson-modal-wrap">
83
  <div class="tutor-modal-content">
 
84
  <div class="modal-header">
85
  <div class="lesson-modal-close-wrap">
86
  <a href="javascript:;" class="modal-close-btn">&times;</a>
87
  </div>
88
  </div>
89
+ <div class="modal-container"></div>
 
 
 
 
 
90
  </div>
91
  </div>
views/modal/add_quiz.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ <?php
4
+ if ( ! empty($_POST['tutor_quiz_builder_quiz_id'])){
5
+ $quiz_id = sanitize_text_field($_POST['tutor_quiz_builder_quiz_id']);
6
+ echo '<input id="tutor_quiz_builder_quiz_id" value="'.$quiz_id.'" />';
7
+ }
8
+ ?>
9
+
10
+ <div class="tutor-quiz-builder-modal-contents">
11
+
12
+ <div id="tutor-quiz-modal-tab-items-wrap" class="tutor-quiz-modal-tab-items-wrap">
13
+
14
+ <a href="#quiz-builder-tab-quiz-info" class="tutor-quiz-modal-tab-item active">
15
+ <i class="tutor-icon-list"></i> <?php _e('Quiz Info', 'tutor'); ?>
16
+ </a>
17
+ <a href="#quiz-builder-tab-questions" class="tutor-quiz-modal-tab-item">
18
+ <i class="tutor-icon-doubt"></i> <?php _e('Questions', 'tutor'); ?>
19
+ </a>
20
+ <a href="#quiz-builder-tab-settings" class="tutor-quiz-modal-tab-item">
21
+ <i class="tutor-icon-settings-1"></i> <?php _e('Settings', 'tutor'); ?>
22
+ </a>
23
+ <a href="#quiz-builder-tab-advanced-options" class="tutor-quiz-modal-tab-item">
24
+ <i class="tutor-icon-filter-tool-black-shape"></i> <?php _e('Advanced Options', 'tutor'); ?>
25
+ </a>
26
+
27
+ </div>
28
+
29
+
30
+
31
+ <div id="tutor-quiz-builder-modal-tabs-container" class="tutor-quiz-builder-modal-tabs-container">
32
+
33
+ <div id="quiz-builder-tab-quiz-info" class="quiz-builder-tab-container">
34
+
35
+ <div class="quiz-builder-tab-body">
36
+ <div class="tutor-quiz-builder-form-row">
37
+ <input type="text" name="quiz_title" placeholder="<?php _e('Type your quiz title here', 'tutor'); ?>">
38
+
39
+ <div class="quiz_form_msg"></div>
40
+ </div>
41
+
42
+ <div class="tutor-quiz-builder-form-row">
43
+ <textarea name="quiz_description" rows="5"></textarea>
44
+ </div>
45
+ </div>
46
+
47
+
48
+ <div class="tutor-quiz-builder-modal-control-btn-group">
49
+ <div class="quiz-builder-btn-group-left">
50
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-first-step"><?php _e('Save &amp; Next', 'tutor'); ?></a>
51
+ </div>
52
+ <div class="quiz-builder-btn-group-right">
53
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor');
54
+ ?></a>
55
+ </div>
56
+ </div>
57
+
58
+
59
+ </div>
60
+
61
+ <div id="quiz-builder-tab-questions" class="quiz-builder-tab-container" style="display: none;">
62
+
63
+ <div class="quiz-builder-tab-body">
64
+ <h1>Questions</h1>
65
+ </div>
66
+
67
+
68
+
69
+ <div class="tutor-quiz-builder-modal-control-btn-group">
70
+ <div class="quiz-builder-btn-group-left">
71
+ <a href="#quiz-builder-tab-quiz-info" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor');
72
+ ?></a>
73
+ <a href="#quiz-builder-tab-settings" class="quiz-modal-tab-navigation-btn quiz-modal-btn-next"><?php _e('Next', 'tutor'); ?></a>
74
+ </div>
75
+ <div class="quiz-builder-btn-group-right">
76
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor');
77
+ ?></a>
78
+ </div>
79
+ </div>
80
+
81
+
82
+ </div>
83
+
84
+ <div id="quiz-builder-tab-settings" class="quiz-builder-tab-container" style="display: none;">
85
+
86
+
87
+ <div class="quiz-builder-tab-body">
88
+ <h1>Settings</h1>
89
+ </div>
90
+
91
+
92
+
93
+
94
+ <div class="tutor-quiz-builder-modal-control-btn-group">
95
+ <div class="quiz-builder-btn-group-left">
96
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor');
97
+ ?></a>
98
+ <a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-btn-next"><?php _e('Next', 'tutor'); ?></a>
99
+ </div>
100
+ <div class="quiz-builder-btn-group-right">
101
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor');
102
+ ?></a>
103
+ </div>
104
+ </div>
105
+
106
+
107
+ </div>
108
+
109
+ <div id="quiz-builder-tab-advanced-options" class="quiz-builder-tab-container" style="display: none;">
110
+ <h1>Advanced Options</h1>
111
+ </div>
112
+
113
+
114
+
115
+ </div>
116
+
117
+ </div>
views/modal/edit_quiz.php ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $quiz = null;
3
+ if ( ! empty($_POST['tutor_quiz_builder_quiz_id'])){
4
+ $quiz_id = sanitize_text_field($_POST['tutor_quiz_builder_quiz_id']);
5
+ $quiz = get_post($quiz_id);
6
+
7
+ echo '<input type="hidden" id="tutor_quiz_builder_quiz_id" value="'.$quiz_id.'" />';
8
+ }elseif( ! empty($quiz_id)){
9
+ $quiz = get_post($quiz_id);
10
+
11
+ echo '<input type="hidden" id="tutor_quiz_builder_quiz_id" value="'.$quiz_id.'" />';
12
+ }
13
+
14
+ if ( ! $quiz){
15
+ die('No quiz found');
16
+ }
17
+
18
+ ?>
19
+
20
+ <div class="tutor-quiz-builder-modal-contents">
21
+
22
+ <div id="tutor-quiz-modal-tab-items-wrap" class="tutor-quiz-modal-tab-items-wrap">
23
+
24
+ <a href="#quiz-builder-tab-quiz-info" class="tutor-quiz-modal-tab-item active">
25
+ <i class="tutor-icon-list"></i> <?php _e('Quiz Info', 'tutor'); ?>
26
+ </a>
27
+ <a href="#quiz-builder-tab-questions" class="tutor-quiz-modal-tab-item">
28
+ <i class="tutor-icon-doubt"></i> <?php _e('Questions', 'tutor'); ?>
29
+ </a>
30
+ <a href="#quiz-builder-tab-settings" class="tutor-quiz-modal-tab-item">
31
+ <i class="tutor-icon-settings-1"></i> <?php _e('Settings', 'tutor'); ?>
32
+ </a>
33
+ <a href="#quiz-builder-tab-advanced-options" class="tutor-quiz-modal-tab-item">
34
+ <i class="tutor-icon-filter-tool-black-shape"></i> <?php _e('Advanced Options', 'tutor'); ?>
35
+ </a>
36
+
37
+ </div>
38
+
39
+
40
+
41
+ <div id="tutor-quiz-builder-modal-tabs-container" class="tutor-quiz-builder-modal-tabs-container">
42
+
43
+ <div id="quiz-builder-tab-quiz-info" class="quiz-builder-tab-container">
44
+
45
+ <div class="quiz-builder-tab-body">
46
+ <div class="tutor-quiz-builder-form-row">
47
+ <input type="text" name="quiz_title" placeholder="<?php _e('Type your quiz title here', 'tutor'); ?>" value="<?php echo
48
+ $quiz->post_title; ?>">
49
+
50
+ <div class="quiz_form_msg"></div>
51
+ </div>
52
+
53
+ <div class="tutor-quiz-builder-form-row">
54
+ <textarea name="quiz_description" rows="5"><?php echo $quiz->post_content; ?></textarea>
55
+ </div>
56
+ </div>
57
+
58
+
59
+ <div class="tutor-quiz-builder-modal-control-btn-group">
60
+ <div class="quiz-builder-btn-group-left">
61
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-first-step"><?php _e('Save &amp; Next', 'tutor'); ?></a>
62
+ </div>
63
+ <div class="quiz-builder-btn-group-right">
64
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor');
65
+ ?></a>
66
+ </div>
67
+ </div>
68
+
69
+
70
+ </div>
71
+
72
+ <div id="quiz-builder-tab-questions" class="quiz-builder-tab-container" style="display: none;">
73
+ <div class="quiz-builder-tab-body">
74
+ <div class="quiz-builder-questions-wrap">
75
+
76
+ <?php
77
+ $questions = tutor_utils()->get_questions_by_quiz($quiz_id);
78
+ if ($questions){
79
+ foreach ($questions as $question){
80
+ ?>
81
+ <div class="quiz-builder-question-wrap">
82
+ <div class="quiz-builder-question">
83
+ <span class="question-sorting">
84
+ <i class="tutor-icon-move"></i>
85
+ </span>
86
+
87
+ <span class="question-title"><?php echo $question->question_title; ?></span>
88
+
89
+ <span class="question-icon">
90
+ <?php
91
+ $type = tutor_utils()->get_question_types($question->question_type);
92
+ echo $type['icon'].' '.$type['name'];
93
+ ?>
94
+ </span>
95
+
96
+ <span class="question-edit-icon">
97
+ <a href="javascript:;" class="tutor-quiz-open-question-form" data-question-id="<?php echo $question->question_id; ?>"><i class="tutor-icon-pencil"></i> </a>
98
+ </span>
99
+ </div>
100
+
101
+ <div class="quiz-builder-qustion-trash">
102
+ <a href="javascript:;" class="tutor-quiz-question-trash" data-question-id="<?php echo $question->question_id; ?>"><i class="tutor-icon-garbage"></i> </a>
103
+ </div>
104
+ </div>
105
+ <?php
106
+ }
107
+ }
108
+ ?>
109
+ </div>
110
+
111
+ <div class="tutor-quiz-builder-form-row">
112
+ <a href="javascript:;" class="tutor-quiz-add-question-btn tutor-quiz-open-question-form">
113
+ <i class="tutor-icon-add-line"></i>
114
+ <?php _e('Add Question', 'tutor'); ?>
115
+ </a>
116
+ </div>
117
+
118
+
119
+
120
+ </div>
121
+
122
+ <div class="tutor-quiz-builder-modal-control-btn-group">
123
+ <div class="quiz-builder-btn-group-left">
124
+ <a href="#quiz-builder-tab-quiz-info" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor'); ?></a>
125
+ <a href="#quiz-builder-tab-settings" class="quiz-modal-tab-navigation-btn quiz-modal-btn-next"><?php _e('Next', 'tutor'); ?></a>
126
+ </div>
127
+ <div class="quiz-builder-btn-group-right">
128
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a>
129
+ </div>
130
+ </div>
131
+
132
+ </div>
133
+
134
+ <div id="quiz-builder-tab-settings" class="quiz-builder-tab-container" style="display: none;">
135
+ <div class="quiz-builder-tab-body">
136
+
137
+ <div class="quiz-builder-modal-settins">
138
+
139
+ <div class="tutor-quiz-builder-form-row">
140
+ <div class="tutor-quiz-builder-form-cols-row">
141
+ <div class="quiz-form-field-col">
142
+ <label><?php _e('Time Limit', 'tutor'); ?></label>
143
+ <input type="text" name="quiz_option[time_limit][time_value]" value="<?php echo tutor_utils()->get_quiz_option($quiz_id, 'time_limit.time_value', 0) ?>">
144
+ </div>
145
+
146
+ <div class="quiz-form-field-col">
147
+ <label>&nbsp;</label>
148
+
149
+ <?php $limit_time_type = tutor_utils()->get_quiz_option($quiz_id, 'time_limit.time_type', 'minutes') ?>
150
+
151
+ <select name="quiz_option[time_limit][time_type]">
152
+ <option value="seconds" <?php selected('seconds', $limit_time_type); ?> ><?php _e('Seconds', 'tutor'); ?></option>
153
+ <option value="minutes" <?php selected('minutes', $limit_time_type); ?> ><?php _e('Minutes', 'tutor'); ?></option>
154
+ <option value="hours" <?php selected('hours', $limit_time_type); ?> ><?php _e('Hours', 'tutor'); ?></option>
155
+ <option value="days" <?php selected('days', $limit_time_type); ?> ><?php _e('Days', 'tutor'); ?></option>
156
+ <option value="weeks" <?php selected('weeks', $limit_time_type); ?> ><?php _e('Weeks', 'tutor'); ?></option>
157
+ </select>
158
+ </div>
159
+
160
+ <div class="quiz-form-field-col">
161
+ <label>&nbsp;</label>
162
+
163
+ <div class="quiz-form-field-col">
164
+ <label class="btn-switch">
165
+ <input type="checkbox" value="1" name="quiz_option[hide_quiz_time_display]" <?php checked('1', tutor_utils()->get_quiz_option($quiz_id, 'hide_quiz_time_display')); ?> />
166
+ <div class="btn-slider btn-round"></div>
167
+ </label>
168
+ <label><?php _e('Hide quiz time - display', 'tutor'); ?></label>
169
+ </div>
170
+ </div>
171
+ </div>
172
+
173
+ <p class="quiz-modal-form-help"><?php _e('Time limit for this quiz. 0 means no time limit.', 'tutor'); ?></p>
174
+ </div>
175
+
176
+
177
+ <div class="tutor-quiz-builder-form-row">
178
+ <label><?php _e('Attempts Allowed', 'tutor'); ?> <span>(<?php _e('Optional', 'tutor'); ?>)</span> </label>
179
+ <div class="quiz-modal-field-wrap">
180
+
181
+ <?php
182
+ $default_attempts_allowed = tutor_utils()->get_option('quiz_attempts_allowed');
183
+ $attempts_allowed = tutor_utils()->get_quiz_option($quiz_id, 'attempts_allowed', $default_attempts_allowed);
184
+ ?>
185
+
186
+ <div class="tutor-field-type-slider" data-min="0" data-max="20">
187
+ <p class="tutor-field-type-slider-value"><?php echo $attempts_allowed; ?></p>
188
+ <div class="tutor-field-slider"></div>
189
+ <input type="hidden" value="<?php echo $attempts_allowed; ?>" name="quiz_option[attempts_allowed]" />
190
+ </div>
191
+
192
+ <p class="quiz-modal-form-help"><?php _e('Restriction on the number of attempts a student is allowed to take for this quiz. 0 for no limit', 'tutor'); ?></p>
193
+ </div>
194
+ </div>
195
+
196
+ <div class="tutor-quiz-builder-form-row">
197
+ <label><?php _e('Passing Grade', 'tutor'); ?> </label>
198
+ <div class="tutor-quiz-builder-form-cols-row">
199
+ <div class="quiz-form-field-col">
200
+ <input type="number" name="quiz_option[passing_grade]" value="<?php echo tutor_utils()->get_quiz_option($quiz_id, 'passing_grade', 80) ?>" size="10">
201
+ </div>
202
+
203
+ <div class="quiz-form-field-col">
204
+ %
205
+ </div>
206
+ </div>
207
+ <p class="quiz-modal-form-help"><?php _e('Set the passing percentage for this quiz', 'tutor'); ?></p>
208
+ </div>
209
+
210
+ <div class="tutor-quiz-builder-form-row">
211
+ <label for=""><?php _e('Max questions allowed to answer', 'tutor'); ?></label>
212
+ <div class="quiz-modal-field-wrap">
213
+ <input type="number" name="quiz_option[max_questions_for_answer]" value="<?php echo tutor_utils()->get_quiz_option($quiz_id, 'max_questions_for_answer', 10) ?>">
214
+ </div>
215
+ <p class="quiz-modal-form-help"><?php _e('This amount of question will be available for students to answer, and question will comes randomly from all available questions belongs with a quiz, if this amount greater then available question, then all questions will be available for a student to answer.', 'tutor'); ?></p>
216
+ </div>
217
+
218
+ </div>
219
+
220
+
221
+
222
+ </div>
223
+
224
+ <div class="tutor-quiz-builder-modal-control-btn-group">
225
+ <div class="quiz-builder-btn-group-left">
226
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor'); ?></a>
227
+ <a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-settings-save-btn"><?php _e('Save &amp; Update', 'tutor'); ?></a>
228
+ </div>
229
+ <div class="quiz-builder-btn-group-right">
230
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a>
231
+ </div>
232
+ </div>
233
+ </div>
234
+
235
+ <div id="quiz-builder-tab-advanced-options" class="quiz-builder-tab-container" style="display: none;">
236
+
237
+ <div class="tutor-quiz-builder-form-row">
238
+ <div class="tutor-quiz-builder-form-cols-row">
239
+ <div class="quiz-form-field-col">
240
+ <label><?php _e('Quiz Auto Start', 'tutor'); ?></label>
241
+ </div>
242
+
243
+ <div class="quiz-form-field-col">
244
+ <label class="btn-switch">
245
+ <input type="checkbox" value="1" name="quiz_option[quiz_auto_start]" <?php checked('1', tutor_utils()->get_quiz_option($quiz_id, 'quiz_auto_start')); ?> />
246
+ <div class="btn-slider btn-round"></div>
247
+ </label>
248
+ <p class="quiz-modal-form-help"><?php _e('If you enable this option, the quiz will start automatically after the page is loaded.', 'tutor'); ?></p>
249
+ </div>
250
+ </div>
251
+ </div>
252
+
253
+ <div class="tutor-quiz-builder-form-row">
254
+ <div class="tutor-quiz-builder-form-cols-row">
255
+ <div class="quiz-form-field-col">
256
+ <label><?php _e('Question Layout', 'tutor'); ?></label>
257
+ </div>
258
+
259
+ <div class="quiz-form-field-col">
260
+
261
+ <select name="quiz_option[question_layout_view]">
262
+ <option value=""><?php _e('Set question layout view', 'tutor'); ?></option>
263
+ <option value="single_question" <?php selected('single_question', tutor_utils()->get_quiz_option($quiz_id, 'question_layout_view')); ?>> <?php _e('Single Question', 'tutor'); ?> </option>
264
+ <option value="question_pagination" <?php selected('question_pagination', tutor_utils()->get_quiz_option($quiz_id, 'question_layout_view') ); ?>> <?php _e('Question Pagination', 'tutor'); ?> </option>
265
+ <option value="question_below_each_other" <?php selected('question_below_each_other', tutor_utils()->get_quiz_option($quiz_id, 'question_layout_view') ); ?>> <?php _e('Question below each other', 'tutor'); ?> </option>
266
+ </select>
267
+
268
+ </div>
269
+ </div>
270
+ </div>
271
+
272
+ <!-- <div class="tutor-quiz-builder-form-row">
273
+ <div class="tutor-quiz-builder-form-cols-row">
274
+ <div class="quiz-form-field-col">
275
+ <label><?php /*_e('Show correct questions - display', 'tutor'); */?></label>
276
+ </div>
277
+
278
+ <div class="quiz-form-field-col">
279
+ <label class="btn-switch">
280
+ <input type="checkbox" value="1" name="quiz_option[show_correct_questions]" <?php /*checked('1', tutor_utils()->get_quiz_option($quiz_id, 'show_correct_questions')); */?> />
281
+ <div class="btn-slider btn-round"></div>
282
+ </label>
283
+ <p class="quiz-modal-form-help"><?php /*_e('If this option is activated, all answers are displayed below each other, i.e. all questions are on a single page.', 'tutor'); */?></p>
284
+ </div>
285
+ </div>
286
+ </div>-->
287
+
288
+ <div class="tutor-quiz-builder-form-row">
289
+ <div class="tutor-quiz-builder-form-cols-row">
290
+ <div class="quiz-form-field-col">
291
+ <label><?php _e('Hide question number', 'tutor'); ?></label>
292
+ </div>
293
+
294
+ <div class="quiz-form-field-col">
295
+ <label class="btn-switch">
296
+ <input type="checkbox" value="1" name="quiz_option[hide_question_number_overview]" <?php checked('1', tutor_utils()->get_quiz_option($quiz_id, 'hide_question_number_overview')); ?> />
297
+ <div class="btn-slider btn-round"></div>
298
+ </label>
299
+ <p class="quiz-modal-form-help"><?php _e('Show/hide question number during attempt.', 'tutor'); ?></p>
300
+ </div>
301
+ </div>
302
+ </div>
303
+
304
+
305
+ <div class="tutor-quiz-builder-form-row">
306
+ <div class="tutor-quiz-builder-form-cols-row">
307
+ <div class="quiz-form-field-col">
308
+ <label><?php _e('Short answer characters limit', 'tutor'); ?></label>
309
+ </div>
310
+
311
+ <div class="quiz-form-field-col">
312
+ <input type="number" name="quiz_option[short_answer_characters_limit]" value="<?php echo tutor_utils()->get_quiz_option
313
+ ($quiz_id, 'short_answer_characters_limit', 200); ?>" >
314
+ <p class="quiz-modal-form-help"><?php _e('Student will place answer in short answer question type within this characters limit.', 'tutor');
315
+ ?></p>
316
+ </div>
317
+ </div>
318
+ </div>
319
+
320
+ <!--<div class="tutor-quiz-builder-form-row">
321
+ <div class="tutor-quiz-builder-form-cols-row">
322
+ <div class="quiz-form-field-col">
323
+ <label><?php /*_e('Question overview', 'tutor'); */?></label>
324
+ </div>
325
+
326
+ <div class="quiz-form-field-col">
327
+ <label class="btn-switch">
328
+ <input type="checkbox" value="1" name="quiz_option[question_overview]" <?php /*checked('1', tutor_utils()->get_quiz_option($quiz_id, 'question_overview')); */?> />
329
+ <div class="btn-slider btn-round"></div>
330
+ </label>
331
+ </div>
332
+ </div>
333
+ </div>
334
+
335
+ <div class="tutor-quiz-builder-form-row">
336
+ <div class="tutor-quiz-builder-form-cols-row">
337
+ <div class="quiz-form-field-col">
338
+ <label><?php _e('Hide "Skip Question"', 'tutor'); ?></label>
339
+ </div>
340
+
341
+ <div class="quiz-form-field-col">
342
+ <label class="btn-switch">
343
+ <input type="checkbox" value="1" name="quiz_option[hide_skip_question]" <?php checked('1', tutor_utils()->get_quiz_option($quiz_id, 'hide_skip_question')); ?> />
344
+ <div class="btn-slider btn-round"></div>
345
+ </label>
346
+ </div>
347
+ </div>
348
+ </div>
349
+
350
+ <div class="tutor-quiz-builder-form-row">
351
+ <div class="tutor-quiz-builder-form-cols-row">
352
+ <div class="quiz-form-field-col">
353
+ <label><?php _e('Hide "Retry Quiz"', 'tutor'); ?></label>
354
+ </div>
355
+
356
+ <div class="quiz-form-field-col">
357
+ <label class="btn-switch">
358
+ <input type="checkbox" value="1" name="quiz_option[hide_retry_quiz]" <?php checked('1', tutor_utils()->get_quiz_option($quiz_id, 'hide_retry_quiz')); ?> />
359
+ <div class="btn-slider btn-round"></div>
360
+ </label>
361
+ </div>
362
+ </div>
363
+ </div>-->
364
+
365
+
366
+ <div class="tutor-quiz-builder-modal-control-btn-group">
367
+ <div class="quiz-builder-btn-group-left">
368
+ <a href="#quiz-builder-tab-settings" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor'); ?></a>
369
+ <a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-settings-save-btn"><?php _e('Save &amp; Update', 'tutor'); ?></a>
370
+ </div>
371
+ <div class="quiz-builder-btn-group-right">
372
+ <a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a>
373
+ </div>
374
+ </div>
375
+
376
+
377
+ </div>
378
+
379
+
380
+
381
+ </div>
382
+
383
+ </div>
views/modal/question_answer_edit_form.php ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($question_type === 'open_ended'){
3
+ echo '<p style="color: #ff0000;">No need any options</p>';
4
+ return '';
5
+ }
6
+
7
+ $answer_title = ! empty($old_answer->answer_title) ? $old_answer->answer_title : '';
8
+ $image_id = ! empty($old_answer->image_id) ? $old_answer->image_id : '';
9
+ $answer_view_format = ! empty($old_answer->answer_view_format) ? $old_answer->answer_view_format : '';
10
+ $answer_two_gap_match = ! empty($old_answer->answer_two_gap_match) ? $old_answer->answer_two_gap_match : '';
11
+ ?>
12
+
13
+ <div class="tutor-quiz-question-answers-form">
14
+
15
+ <input type="hidden" name="tutor_quiz_answer_id" value="<?php echo $old_answer->answer_id; ?>" />
16
+
17
+ <?php
18
+ if ($question_type === 'true_false'){
19
+ //No Need
20
+ }elseif($question_type === 'multiple_choice' || $question_type === 'single_choice' || $question_type === 'ordering' ){
21
+
22
+ if ($question_type === 'ordering'){
23
+ echo '<p class="quiz-modal-form-help">Make sure you are saving answer in right sorting in answers lists, student should ordering should match with this answer order.</p>';
24
+ echo '<p class="quiz-modal-form-help">You can re-order it from above answer list.</p>';
25
+ }
26
+ ?>
27
+
28
+ <div class="tutor-quiz-builder-form-row">
29
+ <label><?php _e('Answer title', 'tutor'); ?></label>
30
+ <div class="quiz-modal-field-wrap">
31
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
32
+ </div>
33
+ </div>
34
+
35
+ <div class="tutor-quiz-builder-form-cols-row">
36
+ <div class="quiz-form-field-col">
37
+ <label><?php _e('Upload Image', 'tutor'); ?></label>
38
+ <div class="tutor-media-upload-wrap">
39
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>">
40
+ <div class="tutor-media-preview">
41
+ <a href="javascript:;" class="tutor-media-upload-btn">
42
+ <?php
43
+ if ($image_id){
44
+ echo '<img src="'.wp_get_attachment_image_url($image_id).'" />';
45
+ }else{
46
+ echo '<i class="tutor-icon-image1"></i>';
47
+ }
48
+ ?>
49
+ </a>
50
+ </div>
51
+ <div class="tutor-media-upload-trash-wrap">
52
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
53
+ </div>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="quiz-form-field-col">
58
+ <label><?php _e('Answer option view format', 'tutor'); ?></label>
59
+ <div class="quiz-modal-field-wrap label-inline">
60
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" <?php
61
+ echo $answer_view_format ? checked('text', $answer_view_format) : 'checked="checked"' ?>> <?php _e('Only text', 'tutor'); ?> </label>
62
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image" <?php echo
63
+ checked('image', $answer_view_format) ?> > <?php _e('Only Image', 'tutor'); ?> </label>
64
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image" <?php echo checked('text_image', $answer_view_format) ?> > <?php _e('Text &amp; Image both', 'tutor'); ?> </label>
65
+ </div>
66
+ </div>
67
+ </div>
68
+
69
+ <?php
70
+ }elseif($question_type === 'fill_in_the_blank'){
71
+ ?>
72
+ <div class="tutor-quiz-builder-form-cols-row">
73
+ <div class="quiz-form-field-col full-width">
74
+ <label><?php _e('Question Title', 'tutor'); ?></label>
75
+ <div class="quiz-modal-field-wrap">
76
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
77
+ <p class="quiz-modal-form-help"><?php _e( 'Please make sure that <b>{dash}</b> variable contains in your question title to show dash, You can use multiple variable', 'tutor' ); ?></p>
78
+ </div>
79
+ </div>
80
+
81
+ <div class="quiz-form-field-col full-width">
82
+ <label><?php _e('Gap Answer', 'tutor'); ?></label>
83
+ <div class="quiz-modal-field-wrap">
84
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_two_gap_match]" value="<?php echo $answer_two_gap_match; ?>">
85
+ <p class="quiz-modal-form-help"><?php _e( 'Separate multiple answer by pipe <b>( | )</b> , 1 answer per variable assigned in question', 'tutor' ); ?></p>
86
+ </div>
87
+ </div>
88
+ </div>
89
+
90
+ <?php
91
+ }elseif($question_type === 'matching'){
92
+ ?>
93
+
94
+ <div class="tutor-quiz-builder-form-cols-row">
95
+ <div class="quiz-form-field-col full-width">
96
+ <label><?php _e('Answer title', 'tutor'); ?></label>
97
+ <div class="quiz-modal-field-wrap">
98
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
99
+ </div>
100
+ </div>
101
+
102
+ <div class="quiz-form-field-col full-width">
103
+ <label><?php _e('Matched Answer title', 'tutor'); ?></label>
104
+ <div class="quiz-modal-field-wrap">
105
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][matched_answer_title]" value="<?php echo $answer_two_gap_match; ?>">
106
+ </div>
107
+ </div>
108
+ </div>
109
+
110
+ <div class="tutor-quiz-builder-form-cols-row">
111
+ <div class="quiz-form-field-col">
112
+ <label><?php _e('Upload Image', 'tutor'); ?></label>
113
+ <div class="tutor-media-upload-wrap">
114
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>">
115
+ <div class="tutor-media-preview">
116
+ <a href="javascript:;" class="tutor-media-upload-btn">
117
+ <?php
118
+ if ($image_id){
119
+ echo '<img src="'.wp_get_attachment_image_url($image_id).'" />';
120
+ }else{
121
+ echo '<i class="tutor-icon-image1"></i>';
122
+ }
123
+ ?>
124
+ </a>
125
+ </div>
126
+ <div class="tutor-media-upload-trash-wrap">
127
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
128
+ </div>
129
+ </div>
130
+ </div>
131
+
132
+ <div class="quiz-form-field-col">
133
+ <label><?php _e('Answer option view format', 'tutor'); ?></label>
134
+ <div class="quiz-modal-field-wrap label-inline">
135
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" <?php
136
+ echo $answer_view_format ? checked('text', $answer_view_format) : 'checked="checked"' ?>> <?php _e('Only text', 'tutor'); ?> </label>
137
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image" <?php echo
138
+ checked('image', $answer_view_format) ?> > <?php _e('Only Image', 'tutor'); ?> </label>
139
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image" <?php echo checked('text_image', $answer_view_format) ?> > <?php _e('Text &amp; Image both', 'tutor'); ?> </label>
140
+ </div>
141
+ </div>
142
+ </div>
143
+
144
+ <?php
145
+ }elseif ($question_type === 'image_matching'){
146
+ ?>
147
+ <div class="tutor-quiz-builder-form-cols-row">
148
+ <div class="quiz-form-field-col full-width">
149
+ <div class="quiz-form-field-col">
150
+ <label><?php _e('Upload Image', 'tutor'); ?></label>
151
+ <div class="tutor-media-upload-wrap">
152
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>">
153
+ <div class="tutor-media-preview">
154
+ <a href="javascript:;" class="tutor-media-upload-btn">
155
+ <?php
156
+ if ($image_id){
157
+ echo '<img src="'.wp_get_attachment_image_url($image_id).'" />';
158
+ }else{
159
+ echo '<i class="tutor-icon-image1"></i>';
160
+ }
161
+ ?>
162
+ </a>
163
+ </div>
164
+ <div class="tutor-media-upload-trash-wrap">
165
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
166
+ </div>
167
+ </div>
168
+ </div>
169
+ </div>
170
+
171
+ <div class="quiz-form-field-col full-width">
172
+ <label><?php _e('Image matched text', 'tutor'); ?></label>
173
+ <div class="quiz-modal-field-wrap">
174
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
175
+ </div>
176
+ </div>
177
+
178
+ </div>
179
+
180
+ <?php
181
+ }elseif($question_type === 'image_answering'){
182
+ ?>
183
+ <div class="tutor-quiz-builder-form-cols-row">
184
+ <div class="quiz-form-field-col full-width">
185
+ <div class="quiz-form-field-col">
186
+ <label><?php _e('Upload Image', 'tutor'); ?></label>
187
+ <div class="tutor-media-upload-wrap">
188
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>">
189
+ <div class="tutor-media-preview">
190
+ <a href="javascript:;" class="tutor-media-upload-btn">
191
+ <?php
192
+ if ($image_id){
193
+ echo '<img src="'.wp_get_attachment_image_url($image_id).'" />';
194
+ }else{
195
+ echo '<i class="tutor-icon-image1"></i>';
196
+ }
197
+ ?>
198
+ </a>
199
+ </div>
200
+ <div class="tutor-media-upload-trash-wrap">
201
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
202
+ </div>
203
+ </div>
204
+ </div>
205
+ </div>
206
+
207
+ <div class="quiz-form-field-col full-width">
208
+ <label><?php _e('Answer input value', 'tutor'); ?></label>
209
+ <div class="quiz-modal-field-wrap">
210
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
211
+ <p class="quiz-modal-form-help"><?php _e('Student input text should be matched with this answer, write in <b>Small Caps</b>','tutor'); ?></p>
212
+ </div>
213
+ </div>
214
+
215
+ </div>
216
+ <?php
217
+ }
218
+ ?>
219
+
220
+ <div class="tutor-quiz-answers-form-footer tutor-quiz-builder-form-row">
221
+ <button type="button" id="quiz-answer-edit-btn" class="tutor-answer-edit-btn"><i class="tutor-icon-pencil"></i> <?php _e('Update Answer', 'tutor'); ?></button>
222
+ </div>
223
+
224
+ </div>
views/modal/question_answer_form.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ($question_type === 'open_ended' || $question_type === 'short_answer'){
3
+ echo '<p style="color: #ff0000;">No need any options</p>';
4
+ return '';
5
+ }
6
+
7
+
8
+ ?>
9
+
10
+ <div class="tutor-quiz-question-answers-form">
11
+
12
+ <?php
13
+ if ($question_type === 'true_false'){
14
+ ?>
15
+ <div class="tutor-quiz-builder-form-row">
16
+ <label><?php _e('Select option which is correct', 'tutor'); ?></label>
17
+ <div class="quiz-modal-field-wrap">
18
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][true_false]" value="true" checked="checked"> <?php _e('True', 'tutor');
19
+ ?> </label>
20
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][true_false]" value="false"> <?php _e('False', 'tutor'); ?>
21
+ </label>
22
+ </div>
23
+ </div>
24
+
25
+ <?php
26
+ }elseif($question_type === 'multiple_choice' || $question_type === 'single_choice' || $question_type === 'ordering' ){
27
+
28
+ if ($question_type === 'ordering'){
29
+ echo '<p class="quiz-modal-form-help">Make sure you are saving answer in right sorting in answers lists, student should ordering should match with this answer order.</p>';
30
+ echo '<p class="quiz-modal-form-help">You can re-order it from above answer list.</p>';
31
+ }
32
+
33
+ ?>
34
+ <div class="tutor-quiz-builder-form-row">
35
+ <label><?php _e('Answer title', 'tutor'); ?></label>
36
+ <div class="quiz-modal-field-wrap">
37
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
38
+ </div>
39
+ </div>
40
+
41
+ <div class="tutor-quiz-builder-form-cols-row">
42
+ <div class="quiz-form-field-col">
43
+ <label><?php _e('Upload Image', 'tutor'); ?></label>
44
+ <div class="tutor-media-upload-wrap">
45
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="">
46
+ <div class="tutor-media-preview">
47
+ <a href="javascript:;" class="tutor-media-upload-btn"><i class="tutor-icon-image1"></i></a>
48
+ </div>
49
+ <div class="tutor-media-upload-trash-wrap">
50
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="quiz-form-field-col">
56
+ <label><?php _e('Answer option view format', 'tutor'); ?></label>
57
+ <div class="quiz-modal-field-wrap label-inline">
58
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" checked="checked"> <?php _e('Only text', 'tutor'); ?> </label>
59
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image"> <?php _e('Only Image', 'tutor'); ?> </label>
60
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image"> <?php _e('Text &amp; Image both', 'tutor'); ?> </label>
61
+ </div>
62
+ </div>
63
+ </div>
64
+
65
+ <?php
66
+ }elseif($question_type === 'fill_in_the_blank'){
67
+ ?>
68
+ <div class="tutor-quiz-builder-form-cols-row">
69
+ <div class="quiz-form-field-col full-width">
70
+ <label><?php _e('Question Title', 'tutor'); ?></label>
71
+ <div class="quiz-modal-field-wrap">
72
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
73
+ <p class="quiz-modal-form-help"><?php _e( 'Please make sure that <b>{dash}</b> variable contains in your question title to show dash, You can use multiple variable', 'tutor' ); ?></p>
74
+ </div>
75
+ </div>
76
+
77
+ <div class="quiz-form-field-col full-width">
78
+ <label><?php _e('Gap Answer', 'tutor'); ?></label>
79
+ <div class="quiz-modal-field-wrap">
80
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_two_gap_match]" value="">
81
+ <p class="quiz-modal-form-help"><?php _e( 'Separate multiple answer by pipe <b>( | )</b> , 1 answer per variable assigned in question', 'tutor' ); ?></p>
82
+ </div>
83
+ </div>
84
+ </div>
85
+
86
+ <?php
87
+ }elseif ($question_type === 'answer_sorting'){
88
+ ?>
89
+ <div class="tutor-quiz-builder-form-cols-row">
90
+ <div class="quiz-form-field-col full-width">
91
+ <label><?php _e('Answer title', 'tutor'); ?></label>
92
+ <div class="quiz-modal-field-wrap">
93
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
94
+ </div>
95
+ </div>
96
+
97
+ <div class="quiz-form-field-col full-width">
98
+ <label><?php _e('Matched Answer title', 'tutor'); ?></label>
99
+ <div class="quiz-modal-field-wrap">
100
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][matched_answer_title]" value="">
101
+ </div>
102
+ </div>
103
+ </div>
104
+
105
+ <?php
106
+ }elseif($question_type === 'matching'){
107
+ ?>
108
+
109
+ <div class="tutor-quiz-builder-form-cols-row">
110
+ <div class="quiz-form-field-col full-width">
111
+ <label><?php _e('Answer title', 'tutor'); ?></label>
112
+ <div class="quiz-modal-field-wrap">
113
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
114
+ </div>
115
+ </div>
116
+
117
+ <div class="quiz-form-field-col full-width">
118
+ <label><?php _e('Matched Answer title', 'tutor'); ?></label>
119
+ <div class="quiz-modal-field-wrap">
120
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][matched_answer_title]" value="">
121
+ </div>
122
+ </div>
123
+ </div>
124
+
125
+ <div class="tutor-quiz-builder-form-cols-row">
126
+ <div class="quiz-form-field-col">
127
+ <label><?php _e('Upload Image', 'tutor'); ?></label>
128
+ <div class="tutor-media-upload-wrap">
129
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="">
130
+ <div class="tutor-media-preview">
131
+ <a href="javascript:;" class="tutor-media-upload-btn"><i class="tutor-icon-image1"></i></a>
132
+ </div>
133
+ <div class="tutor-media-upload-trash-wrap">
134
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
135
+ </div>
136
+ </div>
137
+ </div>
138
+
139
+ <div class="quiz-form-field-col">
140
+ <label><?php _e('Answer option view format', 'tutor'); ?></label>
141
+ <div class="quiz-modal-field-wrap label-inline">
142
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" checked="checked"> <?php _e('Only text', 'tutor'); ?> </label>
143
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image"> <?php _e('Only Image', 'tutor'); ?> </label>
144
+ <label> <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image"> <?php _e('Text &amp; Image both', 'tutor'); ?> </label>
145
+ </div>
146
+ </div>
147
+ </div>
148
+
149
+ <?php
150
+ }elseif ($question_type === 'image_matching'){
151
+ ?>
152
+ <div class="tutor-quiz-builder-form-cols-row">
153
+ <div class="quiz-form-field-col full-width">
154
+ <div class="quiz-form-field-col">
155
+ <label><?php _e('Upload Image', 'tutor'); ?></label>
156
+ <div class="tutor-media-upload-wrap">
157
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="">
158
+ <div class="tutor-media-preview">
159
+ <a href="javascript:;" class="tutor-media-upload-btn"><i class="tutor-icon-image1"></i></a>
160
+ </div>
161
+ <div class="tutor-media-upload-trash-wrap">
162
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
163
+ </div>
164
+ </div>
165
+ </div>
166
+ </div>
167
+
168
+
169
+ <div class="quiz-form-field-col full-width">
170
+ <label><?php _e('Image matched text', 'tutor'); ?></label>
171
+ <div class="quiz-modal-field-wrap">
172
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
173
+ </div>
174
+ </div>
175
+
176
+ </div>
177
+
178
+ <?php
179
+ }elseif($question_type === 'image_answering'){
180
+ ?>
181
+ <div class="tutor-quiz-builder-form-cols-row">
182
+ <div class="quiz-form-field-col full-width">
183
+ <div class="quiz-form-field-col">
184
+ <label><?php _e('Upload Image', 'tutor'); ?></label>
185
+ <div class="tutor-media-upload-wrap">
186
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="">
187
+ <div class="tutor-media-preview">
188
+ <a href="javascript:;" class="tutor-media-upload-btn"><i class="tutor-icon-image1"></i></a>
189
+ </div>
190
+ <div class="tutor-media-upload-trash-wrap">
191
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
192
+ </div>
193
+ </div>
194
+ </div>
195
+ </div>
196
+
197
+
198
+ <div class="quiz-form-field-col full-width">
199
+ <label><?php _e('Answer input value', 'tutor'); ?></label>
200
+ <div class="quiz-modal-field-wrap">
201
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
202
+ <p class="quiz-modal-form-help"><?php _e('Student input text should be matched with this answer, write in <b>Small Caps</b>','tutor'); ?></p>
203
+ </div>
204
+ </div>
205
+
206
+ </div>
207
+ <?php
208
+ }
209
+ ?>
210
+
211
+ <div class="tutor-quiz-answers-form-footer tutor-quiz-builder-form-row">
212
+ <button type="button" id="quiz-answer-save-btn" class="tutor-answer-save-btn"><i class="tutor-icon-add-line"></i> <?php _e('Save Answer', 'tutor'); ?></button>
213
+
214
+ </div>
215
+
216
+ </div>
views/modal/question_form.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $wpdb;
3
+ $settings = maybe_unserialize($question->question_settings);
4
+ ?>
5
+
6
+ <div class="quiz-questions-form">
7
+
8
+
9
+ <div class="question-form-header">
10
+ <a href="javascript:;" class="back-to-quiz-questions-btn open-tutor-quiz-modal" data-quiz-id="<?php echo $quiz_id; ?>"
11
+ data-back-to-tab="#quiz-builder-tab-questions"><i class="tutor-icon-next-2"></i> <?php _e('Back', 'tutor'); ?></a>
12
+ </div>
13
+
14
+
15
+ <div class="quiz-question-form-body">
16
+
17
+
18
+ <div class="quiz_question_form">
19
+
20
+ <div class="tutor-quiz-builder-form-row">
21
+ <label><?php _e('Write your question here', 'tutor'); ?></label>
22
+ <div class="quiz-modal-field-wrap">
23
+ <input type="text" name="tutor_quiz_question[<?php echo $question_id; ?>][question_title]" placeholder="<?php _e('Type your quiz title here',
24
+ 'tutor'); ?>" value="<?php echo $question->question_title; ?>">
25
+ </div>
26
+ </div>
27
+
28
+ <div class="tutor-quiz-builder-form-row">
29
+
30
+ <div class="tutor-quiz-builder-form-cols-row">
31
+ <div class="quiz-form-field-col">
32
+ <label><?php _e('Mark for this question', 'tutor'); ?></label>
33
+ <div class="quiz-modal-field-wrap">
34
+ <input type="text" name="tutor_quiz_question[<?php echo $question_id; ?>][question_mark]" placeholder="<?php _e('set the mark ex. 10', 'tutor'); ?>" value="<?php
35
+ echo $question->question_mark; ?>">
36
+ </div>
37
+ </div>
38
+
39
+ <div class="quiz-form-field-col">
40
+ <div class="quiz-modal-field-wrap">
41
+ <div class="quiz-modal-switch-field">
42
+ <label class="btn-switch">
43
+ <input type="checkbox" value="1" name="tutor_quiz_question[<?php echo $question_id; ?>][show_question_mark]" <?php checked('1', tutor_utils()->avalue_dot('show_question_mark', $settings)); ?> />
44
+ <div class="btn-slider btn-round"></div>
45
+ </label>
46
+ <label><?php _e('Show marks', 'tutor'); ?></label>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </div>
51
+
52
+ </div>
53
+
54
+ <div class="tutor-quiz-builder-form-row">
55
+ <label><?php _e('Description', 'tutor'); ?> <span>(<?php _e('Optional', 'tutor'); ?>)</span> </label>
56
+ <div class="quiz-modal-field-wrap">
57
+ <textarea name="tutor_quiz_question[<?php echo $question_id; ?>][question_description]"><?php echo $question->question_description;?></textarea>
58
+ </div>
59
+ </div>
60
+
61
+
62
+ <div class="tutor-quiz-builder-form-row">
63
+
64
+ <div class="tutor-quiz-builder-form-cols-row">
65
+ <div class="quiz-form-field-col">
66
+ <label><?php _e('Question Type', 'tutor'); ?></label>
67
+ <div class="quiz-modal-field-wrap">
68
+
69
+ <div class="tutor-select">
70
+ <div class="select-header">
71
+ <span class="lead-option"> <i class="tutor-icon-yes-no"></i> True or False </span>
72
+ <span class="select-dropdown"><i class="tutor-icon-light-down"></i> </span>
73
+ <input type="hidden" class="tutor_select_value_holder" name="tutor_quiz_question[<?php echo $question_id; ?>][question_type]" value="" >
74
+ </div>
75
+
76
+ <div class="tutor-select-options" style="display: none;">
77
+ <p class="tutor-select-option" data-value="true_false" <?php echo $question->question_type === 'true_false' ? ' data-selected="selected"' : ''; ?> >
78
+ <i class="tutor-icon-block tutor-icon-yes-no"></i> <?php _e('True False'); ?>
79
+ </p>
80
+ <p class="tutor-select-option" data-value="single_choice" <?php echo $question->question_type === 'single_choice' ? ' data-selected="selected"' : ''; ?>>
81
+ <i class="tutor-icon-block tutor-icon-mark"></i> <?php _e('Single Choice'); ?>
82
+ </p>
83
+ <p class="tutor-select-option" data-value="multiple_choice" <?php echo $question->question_type === 'multiple_choice' ? ' data-selected="selected"' : ''; ?>>
84
+ <i class="tutor-icon-block tutor-icon-multiple-choice"></i> <?php _e('Multiple Choice', 'tutor'); ?>
85
+ </p>
86
+ <p class="tutor-select-option" data-value="open_ended" <?php echo $question->question_type === 'open_ended' ? ' data-selected="selected"' : ''; ?>>
87
+ <i class="tutor-icon-block tutor-icon-open-ended"></i> <?php _e('Open Ended/Essay', 'tutor'); ?>
88
+ </p>
89
+ <p class="tutor-select-option" data-value="short_answer" <?php echo $question->question_type === 'short_answer' ? ' data-selected="selected"' : ''; ?>>
90
+ <i class="tutor-icon-block tutor-icon-short-ans"></i> <?php _e('Short Answer', 'tutor'); ?>
91
+ </p>
92
+ <p class="tutor-select-option" data-value="fill_in_the_blank" <?php echo $question->question_type === 'fill_in_the_blank' ? ' data-selected="selected"' : ''; ?>>
93
+ <i class="tutor-icon-block tutor-icon-fill-gaps"></i> <?php _e('Fill In The Gaps'); ?>
94
+ </p>
95
+
96
+ <!--
97
+ <p class="tutor-select-option" data-value="answer_sorting" <?php echo $question->question_type === 'answer_sorting' ? ' data-selected="selected"' : ''; ?>>
98
+ <i class="tutor-icon-block tutor-icon-answer-shorting"></i> <?php _e('Answer Sorting', 'tutor'); ?>
99
+ </p>
100
+ <p class="tutor-select-option" data-value="assessment" <?php /*echo $question->question_type === 'assessment' ? ' data-selected="selected"' : ''; */?>>
101
+ <i class="tutor-icon-block tutor-icon-assesment"></i> <?php /*_e('Assessment', 'tutor'); */?>
102
+ </p>-->
103
+
104
+ <p class="tutor-select-option" data-value="matching" <?php echo $question->question_type === 'matching' ? ' data-selected="selected"' : ''; ?>>
105
+ <i class="tutor-icon-block tutor-icon-matching"></i> <?php _e('Matching', 'tutor'); ?>
106
+ </p>
107
+ <p class="tutor-select-option" data-value="image_matching" <?php echo $question->question_type === 'image_matching' ? ' data-selected="selected"' : ''; ?>>
108
+ <i class="tutor-icon-block tutor-icon-image-matching"></i> <?php _e('Image Matching', 'tutor'); ?>
109
+ </p>
110
+
111
+ <p class="tutor-select-option" data-value="image_answering" <?php echo $question->question_type === 'image_answering' ? ' data-selected="selected"' : ''; ?>>
112
+ <i class="tutor-icon-block tutor-icon-image-ans"></i> <?php _e('Image Answering', 'tutor'); ?>
113
+ </p>
114
+
115
+ <p class="tutor-select-option" data-value="ordering" <?php echo $question->question_type === 'ordering' ? ' data-selected="selected"' : ''; ?>>
116
+ <i class="tutor-icon-block tutor-icon-ordering"></i> <?php _e('Ordering', 'tutor'); ?>
117
+ </p>
118
+ </div>
119
+ </div>
120
+
121
+ </div>
122
+ </div>
123
+
124
+
125
+ <div class="quiz-form-field-col">
126
+ <div class="quiz-modal-field-wrap">
127
+ <div class="quiz-modal-switch-field">
128
+ <label class="btn-switch">
129
+ <input type="checkbox" value="1" name="tutor_quiz_question[<?php echo $question_id; ?>][answer_required]" <?php checked('1', tutor_utils()->avalue_dot('answer_required', $settings)); ?> />
130
+ <div class="btn-slider btn-round"></div>
131
+ </label>
132
+ <label><?php _e('Answer Required', 'tutor'); ?></label>
133
+ </div>
134
+ </div>
135
+ </div>
136
+
137
+ <div class="quiz-form-field-col">
138
+ <div class="quiz-modal-field-wrap">
139
+ <div class="quiz-modal-switch-field">
140
+ <label class="btn-switch">
141
+ <input type="checkbox" value="1" name="tutor_quiz_question[<?php echo $question_id; ?>][randomize_question]" <?php checked('1', tutor_utils()->avalue_dot('randomize_question', $settings)); ?> />
142
+ <div class="btn-slider btn-round"></div>
143
+ </label>
144
+ <label><?php _e('Randomize', 'tutor'); ?></label>
145
+ </div>
146
+ </div>
147
+ </div>
148
+
149
+ </div>
150
+
151
+ </div>
152
+
153
+ <div class="tutor-quiz-builder-form-row">
154
+
155
+
156
+ <div id="tuotr_question_options_for_quiz" class="quiz-modal-field-wrap">
157
+ <div id="tutor_quiz_question_answers" data-question-id="<?php echo $question_id; ?>">
158
+ <?php
159
+ switch ($question->question_type){
160
+ case 'true_false':
161
+ echo '<label>'.__('Answer options &amp; mark correct', 'tutor').'</label>';
162
+ break;
163
+ case 'ordering':
164
+ echo '<label>'.__('Student should order below items exact this order, make sure your answer is in right order, you can re-order them', 'tutor').'</label>';
165
+ break;
166
+ }
167
+
168
+ $answers = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_question_answers where belongs_question_id = {$question_id} AND belongs_question_type = '{$question->question_type}' order by answer_order asc ;");
169
+ if (is_array($answers) && count($answers)){
170
+ foreach ($answers as $answer){
171
+ ?>
172
+ <div class="tutor-quiz-answer-wrap" data-answer-id="<?php echo $answer->answer_id; ?>">
173
+ <div class="tutor-quiz-answer">
174
+ <span class="tutor-quiz-answer-title">
175
+ <?php
176
+ echo $answer->answer_title;
177
+ if ($answer->belongs_question_type === 'fill_in_the_blank'){
178
+ echo ' ('.__('Answer', 'tutor').' : ';
179
+ echo "<strong>{$answer->answer_two_gap_match} </strong>)";
180
+ }
181
+ if ($answer->belongs_question_type === 'matching'){
182
+ echo " - {$answer->answer_two_gap_match}";
183
+ }
184
+ ?>
185
+ </span>
186
+
187
+ <?php
188
+ if ($answer->image_id){
189
+ echo '<span class="tutor-question-answer-image"><img src="'.wp_get_attachment_image_url($answer->image_id).'" /> </span>';
190
+ }
191
+ if ($question->question_type === 'true_false' || $question->question_type === 'single_choice'){
192
+ ?>
193
+ <span class="tutor-quiz-answers-mark-correct-wrap">
194
+ <input type="radio" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]"
195
+ value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> >
196
+ </span>
197
+ <?php
198
+ }elseif ($question->question_type === 'multiple_choice'){
199
+ ?>
200
+ <span class="tutor-quiz-answers-mark-correct-wrap">
201
+ <input type="checkbox" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]"
202
+ value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> >
203
+ </span>
204
+ <?php
205
+ }
206
+ ?>
207
+ <span class="tutor-quiz-answer-edit">
208
+ <a href="javascript:;"><i class="tutor-icon-pencil"></i> </a>
209
+ </span>
210
+ <span class="tutor-quiz-answer-sort-icon"><i class="tutor-icon-menu-2"></i> </span>
211
+ </div>
212
+
213
+ <div class="tutor-quiz-answer-trash-wrap">
214
+ <a href="javascript:;" class="answer-trash-btn" data-answer-id="<?php echo $answer->answer_id; ?>"><i class="tutor-icon-garbage"></i> </a>
215
+ </div>
216
+ </div>
217
+ <?php
218
+ }
219
+ }
220
+ ?>
221
+ </div>
222
+
223
+
224
+ <div id="tutor_quiz_question_answer_form"></div>
225
+
226
+
227
+ <a href="javascript:;" class="add_question_answers_option" data-question-id="<?php echo $question_id; ?>">
228
+ <i class="tutor-icon-block tutor-icon-plus"></i>
229
+ <?php _e('Add An Option', 'tutor'); ?>
230
+ </a>
231
+ </div>
232
+ </div>
233
+
234
+ </div>
235
+
236
+ </div>
237
+
238
+
239
+
240
+
241
+
242
+ <div class="tutor-quiz-builder-modal-control-btn-group">
243
+ <div class="quiz-builder-btn-group-left">
244
+ <a href="javascript:;" class="quiz-modal-tab-navigation-btn quiz-modal-question-save-btn"><?php _e('Save &amp; Continue', 'tutor');
245
+ ?></a>
246
+ </div>
247
+ <div class="quiz-builder-btn-group-right">
248
+ <a href="javascript:;" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a>
249
+ </div>
250
+ </div>
251
+
252
+
253
+
254
+
255
+ </div>
views/pages/view_attempt.php CHANGED
@@ -1,9 +1,18 @@
1
  <?php
2
  $attempt_id = (int) sanitize_text_field($_GET['attempt_id']);
3
  $attempt = tutor_utils()->get_attempt($attempt_id);
4
- $quiz_attempt_info = tutor_utils()->quiz_attempt_info($attempt_id);
5
- $answers = tutor_utils()->avalue_dot('answers', $quiz_attempt_info);
6
- $manual_reviewed = tutor_utils()->avalue_dot('manual_reviewed', $quiz_attempt_info);
 
 
 
 
 
 
 
 
 
7
  ?>
8
 
9
  <div class="wrap">
@@ -11,19 +20,18 @@ $manual_reviewed = tutor_utils()->avalue_dot('manual_reviewed', $quiz_attempt_in
11
 
12
  <div class="tutor-quiz-attempt-info-row">
13
  <div class="tutor-attempt-student-info">
14
- <?php
15
- $user_id = tutor_utils()->avalue_dot('user_id', $attempt);
16
- $user = get_userdata($user_id);
17
-
18
- $quiz_started_at = tutor_utils()->avalue_dot('quiz_started_at', $attempt);
19
- $quiz_attempt_status = tutor_utils()->avalue_dot('quiz_attempt_status', $attempt);
20
- $comment_post_ID = tutor_utils()->avalue_dot('comment_post_ID', $attempt);
21
-
22
- ?>
23
 
24
- <p class="quiz-attempt-info-row"> <?php echo '<span class="attempt-property-name">'.__('Attempt By', 'tutor').' </span><span> : '. $user->display_name.'</span>'; ?></p>
 
 
25
 
26
- <p class="quiz-attempt-info-row"> <?php echo '<span class="attempt-property-name">'.__('Attempt At', 'tutor').'</span> <span> : '. date_i18n(get_option('date_format', strtotime($quiz_started_at))).' '.date_i18n(get_option('time_format', strtotime($quiz_started_at))).'</span>'; ?></p>
 
 
27
 
28
  <p class="quiz-attempt-info-row">
29
  <span class="attempt-property-name">
@@ -31,79 +39,86 @@ $manual_reviewed = tutor_utils()->avalue_dot('manual_reviewed', $quiz_attempt_in
31
  </span>
32
 
33
  <span class="attempt-property-value"> :
34
- <?php
35
- $status = ucwords(str_replace('quiz_', '', $quiz_attempt_status));
36
- echo "<span class='tutor-status-context {$quiz_attempt_status}'>{$status}</span>";
37
- ?>
38
  </span>
39
  </p>
40
 
 
 
 
 
41
 
42
-
43
- <?php if ($manual_reviewed){
44
- ?>
45
- <p class="quiz-attempt-info-row text-notified">
46
- <span class="attempt-property-name">
47
- <?php _e('Manually reviewed at', 'tutor'); ?>
48
- </span>
49
-
50
- <span class="attempt-property-value"> :
51
- <?php echo date_i18n(get_option('date_format', strtotime($manual_reviewed))).' '.date_i18n(get_option('time_format', strtotime
52
- ($manual_reviewed))); ?>
53
- </span>
54
- </p>
55
- <?php
56
- } ?>
57
 
58
  </div>
59
 
60
  <div class="quiz-attempt-student-info">
61
  <p class="quiz-attempt-info-row">
62
- <?php
63
- echo '<span class="attempt-property-name">'. __('Quiz', 'tutor').' </span> <span class="attempt-property-value"> : '."<a href='".admin_url("post.php?post={$comment_post_ID}&action=edit")."'>".get_the_title($comment_post_ID)."</a> </span> ";
64
- ?>
65
  </p>
66
 
67
  <p class="quiz-attempt-info-row">
68
- <?php
69
- $quiz = tutor_utils()->get_course_by_quiz($comment_post_ID);
70
- if ($quiz) {
71
- echo '<span class="attempt-property-name">' . __( 'Course', 'tutor' ) . '</span> <span class="attempt-property-value"> : ' . "<a href='" . admin_url( "post.php?post={$quiz->ID}&action=edit" ) . "'>" . get_the_title( $quiz->ID ) . "</a> </span>";
72
- }
73
- ?>
74
  </p>
75
 
76
  <p class="quiz-attempt-info-row">
77
  <span class="attempt-property-name"><?php _e('Result', 'tutor'); ?></span>
78
 
79
  <span class="attempt-property-value"> :
80
- <?php
81
- $earned_marks = tutor_utils()->avalue_dot('marks_earned', $quiz_attempt_info);
82
- $total_marks = tutor_utils()->avalue_dot('total_marks', $quiz_attempt_info);
83
- $passing_grade = tutor_utils()->avalue_dot('pass_mark_percent', $quiz_attempt_info);
84
- $earned_percentage = $earned_marks > 0 ? ( number_format(($earned_marks * 100) / $total_marks)) : 0;
85
 
 
 
86
 
87
- echo __('Earned marks ', 'tutor').$earned_marks.__(' out of ', 'tutor').$total_marks." ({$earned_percentage}%) ";
 
 
 
 
88
 
89
- if ($earned_percentage >= $passing_grade){
90
- echo '<span class="result-pass">'.__('Pass', 'tutor').'</span>';
91
- }else{
92
- echo '<span class="result-fail">'.__('Fail', 'tutor').'</span>';
93
- }
94
- ?>
95
  </span>
96
  </p>
97
 
98
  <p class="quiz-attempt-info-row">
99
  <span class="attempt-property-name"><?php _e('Quiz Time', 'tutor'); ?></span>
100
  <span class="attempt-property-value"> :
101
- <?php
102
- $time_limit_seconds = tutor_utils()->avalue_dot('time_limit_seconds', $quiz_attempt_info);
103
- echo tutor_utils()->seconds_to_time_context($time_limit_seconds);
104
- ?>
 
 
 
 
 
 
 
 
 
 
 
105
  </span>
106
  </p>
 
107
  </div>
108
  </div>
109
 
@@ -112,22 +127,20 @@ $manual_reviewed = tutor_utils()->avalue_dot('manual_reviewed', $quiz_attempt_in
112
  ?>
113
  <table class="wp-list-table widefat striped">
114
  <tr>
115
- <th><?php _e('Question', 'tutor'); ?></th>
116
- <th><?php _e('Status', 'tutor'); ?></th>
117
  <th><?php _e('Correct', 'tutor'); ?></th>
118
  <th><?php _e('Given Answers', 'tutor'); ?></th>
119
  <th><?php _e('Review', 'tutor'); ?></th>
120
  </tr>
121
  <?php
122
- foreach ($answers as $answer_key => $answer){
123
  ?>
124
 
125
  <tr>
126
- <td><?php echo get_the_title($answer['questionID']) ?></td>
127
- <td><?php echo $answer['status']; ?></td>
128
  <td>
129
- <?php $correct = tutor_utils()->avalue_dot('has_correct', $answer);
130
- if ($correct){
131
  echo '<span class="tutor-status-approved-context"><i class="dashicons dashicons-yes"></i> </span>';
132
  }else{
133
  echo '<span class="tutor-status-blocked-context"><i class="dashicons dashicons-no-alt"></i> </span>';
@@ -137,28 +150,112 @@ $manual_reviewed = tutor_utils()->avalue_dot('manual_reviewed', $quiz_attempt_in
137
 
138
  <td>
139
  <?php
140
- $answers_lists_by_question = $answer['answers_list'];
141
- $answer_type = tutor_utils()->avalue_dot('answer_type', $answers_lists_by_question);
142
- $answer_ids = tutor_utils()->avalue_dot('answer_ids', $answers_lists_by_question);
143
- echo '<p><strong>'.tutor_utils()->get_question_types($answer_type).'</strong></p>';
144
-
145
- if ($answer_ids){
146
- $get_answers = tutor_utils()->get_quiz_answers_by_ids($answer_ids);
147
- if ($get_answers){
148
- echo '<hr />';
149
- foreach ($get_answers as $given_answer){
150
- $formatted_answer = json_decode($given_answer->comment_content);
151
- echo $formatted_answer->answer_option_text;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  }
 
 
 
 
 
 
 
 
153
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  }
 
155
  ?>
156
  </td>
157
 
158
  <td>
159
- <a href="<?php echo admin_url("admin.php?action=review_quiz_answer&attempt_id={$attempt_id}&answer_index={$answer_key}&mark_as=correct"); ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" class="tutor-button button button-success"><i class="dashicons dashicons-yes"></i> </a>
160
 
161
- <a href="<?php echo admin_url("admin.php?action=review_quiz_answer&attempt_id={$attempt_id}&answer_index={$answer_key}&mark_as=incorrect"); ?>" title="<?php _e('Mark as In correct', 'tutor'); ?>" class="tutor-button button button-danger"><i class="dashicons dashicons-no-alt"></i></a>
162
  </td>
163
  </tr>
164
  <?php
1
  <?php
2
  $attempt_id = (int) sanitize_text_field($_GET['attempt_id']);
3
  $attempt = tutor_utils()->get_attempt($attempt_id);
4
+
5
+ if ( ! $attempt){
6
+ ?>
7
+
8
+ <h1><?php _e('Attempt not found', 'tutor'); ?></h1>
9
+
10
+ <?php
11
+ return;
12
+ }
13
+
14
+ $quiz_attempt_info = tutor_utils()->quiz_attempt_info($attempt->attempt_info);
15
+ $answers = tutor_utils()->get_quiz_answers_by_attempt_id($attempt->attempt_id);
16
  ?>
17
 
18
  <div class="wrap">
20
 
21
  <div class="tutor-quiz-attempt-info-row">
22
  <div class="tutor-attempt-student-info">
23
+ <?php
24
+ $user_id = tutor_utils()->avalue_dot('user_id', $attempt);
25
+ $user = get_userdata($user_id);
26
+ ?>
 
 
 
 
 
27
 
28
+ <p class="quiz-attempt-info-row">
29
+ <?php echo '<span class="attempt-property-name">'.__('Attempt By', 'tutor').' </span><span> : '. $user->display_name.'</span>'; ?>
30
+ </p>
31
 
32
+ <p class="quiz-attempt-info-row">
33
+ <?php echo '<span class="attempt-property-name">'.__('Attempt At', 'tutor').'</span> <span> : '. date_i18n(get_option('date_format'), strtotime($attempt->attempt_started_at)).' '.date_i18n(get_option('time_format'), strtotime($attempt->attempt_started_at)).'</span>'; ?>
34
+ </p>
35
 
36
  <p class="quiz-attempt-info-row">
37
  <span class="attempt-property-name">
39
  </span>
40
 
41
  <span class="attempt-property-value"> :
42
+ <?php
43
+ $status = ucwords(str_replace('quiz_', '', $attempt->attempt_status));
44
+ echo "<span class='tutor-status-context {$attempt->attempt_status}'>{$status}</span>";
45
+ ?>
46
  </span>
47
  </p>
48
 
49
+ <?php if ((bool) $attempt->is_manually_reviewed ){
50
+ ?>
51
+ <p class="quiz-attempt-info-row text-notified">
52
+ <span class="attempt-property-name"><?php _e('Manually reviewed at', 'tutor'); ?></span>
53
 
54
+ <span class="attempt-property-value"> :
55
+ <?php echo date_i18n(get_option('date_format'), strtotime($attempt->manually_reviewed_at)).' '.date_i18n(get_option('time_format'), strtotime($attempt->manually_reviewed_at)); ?>
56
+ </span>
57
+ </p>
58
+ <?php
59
+ } ?>
 
 
 
 
 
 
 
 
 
60
 
61
  </div>
62
 
63
  <div class="quiz-attempt-student-info">
64
  <p class="quiz-attempt-info-row">
65
+ <?php
66
+ echo '<span class="attempt-property-name">'. __('Quiz', 'tutor').' </span> <span class="attempt-property-value"> : '."<a href='".admin_url("post.php?post={$attempt->quiz_id}&action=edit")."'>".get_the_title($attempt->quiz_id)."</a> </span> ";
67
+ ?>
68
  </p>
69
 
70
  <p class="quiz-attempt-info-row">
71
+ <?php
72
+ $quiz = tutor_utils()->get_course_by_quiz($attempt->quiz_id);
73
+ if ($quiz) {
74
+ echo '<span class="attempt-property-name">' . __( 'Course', 'tutor' ) . '</span> <span class="attempt-property-value"> : ' . "<a href='" . admin_url( "post.php?post={$quiz->ID}&action=edit" ) . "'>" . get_the_title( $quiz->ID ) . "</a> </span>";
75
+ }
76
+ ?>
77
  </p>
78
 
79
  <p class="quiz-attempt-info-row">
80
  <span class="attempt-property-name"><?php _e('Result', 'tutor'); ?></span>
81
 
82
  <span class="attempt-property-value"> :
83
+ <?php
84
+ $pass_mark_percent = tutor_utils()->get_quiz_option($attempt->quiz_id, 'passing_grade', 0);
85
+ $earned_percentage = $attempt->earned_marks > 0 ? ( number_format(($attempt->earned_marks * 100) / $attempt->total_marks)) : 0;
 
 
86
 
87
+ $output = $attempt->earned_marks." out of {$attempt->total_marks} <br />";
88
+ $output .= "Marks earned ({$earned_percentage}%)<br />";
89
 
90
+ if ($earned_percentage >= $pass_mark_percent){
91
+ $output .= '<span class="result-pass">'.__('Pass', 'tutor').'</span>';
92
+ }else{
93
+ $output .= '<span class="result-fail">'.__('Fail', 'tutor').'</span>';
94
+ }
95
 
96
+ echo $output;
97
+ ?>
 
 
 
 
98
  </span>
99
  </p>
100
 
101
  <p class="quiz-attempt-info-row">
102
  <span class="attempt-property-name"><?php _e('Quiz Time', 'tutor'); ?></span>
103
  <span class="attempt-property-value"> :
104
+ <?php
105
+ $time_limit_seconds = tutor_utils()->avalue_dot('time_limit.time_limit_seconds', $quiz_attempt_info);
106
+ echo tutor_utils()->seconds_to_time_context($time_limit_seconds);
107
+ ?>
108
+ </span>
109
+ </p>
110
+
111
+
112
+ <p class="quiz-attempt-info-row">
113
+ <span class="attempt-property-name"><?php _e('Attempt Time', 'tutor'); ?></span>
114
+ <span class="attempt-property-value"> :
115
+ <?php
116
+ $attempt_time_sec = strtotime($attempt->attempt_ended_at) - strtotime($attempt->attempt_started_at);
117
+ echo tutor_utils()->seconds_to_time_context($attempt_time_sec);
118
+ ?>
119
  </span>
120
  </p>
121
+
122
  </div>
123
  </div>
124
 
127
  ?>
128
  <table class="wp-list-table widefat striped">
129
  <tr>
130
+ <th width="200"><?php _e('Question', 'tutor'); ?></th>
 
131
  <th><?php _e('Correct', 'tutor'); ?></th>
132
  <th><?php _e('Given Answers', 'tutor'); ?></th>
133
  <th><?php _e('Review', 'tutor'); ?></th>
134
  </tr>
135
  <?php
136
+ foreach ($answers as $answer){
137
  ?>
138
 
139
  <tr>
140
+ <td><?php echo $answer->question_title; ?></td>
 
141
  <td>
142
+ <?php
143
+ if ((bool) $answer->is_correct) {
144
  echo '<span class="tutor-status-approved-context"><i class="dashicons dashicons-yes"></i> </span>';
145
  }else{
146
  echo '<span class="tutor-status-blocked-context"><i class="dashicons dashicons-no-alt"></i> </span>';
150
 
151
  <td>
152
  <?php
153
+ if ($answer->question_type === 'true_false' || $answer->question_type === 'single_choice' ){
154
+
155
+ $get_answers = tutor_utils()->get_answer_by_id($answer->given_answer);
156
+ $answer_titles = wp_list_pluck($get_answers, 'answer_title');
157
+ echo '<p>'.implode('</p><p>', $answer_titles).'</p>';
158
+
159
+ }elseif ($answer->question_type === 'multiple_choice'){
160
+
161
+ $get_answers = tutor_utils()->get_answer_by_id(maybe_unserialize($answer->given_answer));
162
+ $answer_titles = wp_list_pluck($get_answers, 'answer_title');
163
+ echo '<p>'.implode('</p><p>', $answer_titles).'</p>';
164
+
165
+ }elseif ($answer->question_type === 'fill_in_the_blank'){
166
+
167
+ $answer_titles = maybe_unserialize($answer->given_answer);
168
+
169
+ $get_db_answers_by_question = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
170
+ foreach ($get_db_answers_by_question as $db_answer);
171
+ $count_dash_fields = substr_count($db_answer->answer_title, '{dash}');
172
+ if ($count_dash_fields){
173
+ $dash_string = array();
174
+ $input_data = array();
175
+
176
+ for($i=0; $i<$count_dash_fields; $i++){
177
+ //$dash_string[] = '{dash}';
178
+ $input_data[] = isset($answer_titles[$i]) ? "<span class='filled_dash_unser'>{$answer_titles[$i]}</span>" : "______";
179
+ }
180
+
181
+ $answer_title = $db_answer->answer_title;
182
+ foreach($input_data as $replace){
183
+ $answer_title = preg_replace('/{dash}/i', $replace, $answer_title, 1);
184
  }
185
+
186
+ echo str_replace('{dash}', '_____', $answer_title);
187
+ }
188
+
189
+ }elseif ($answer->question_type === 'open_ended' || $answer->question_type === 'short_answer'){
190
+
191
+ if ($answer->given_answer){
192
+ echo wpautop(stripslashes($answer->given_answer));
193
  }
194
+
195
+ }elseif ($answer->question_type === 'ordering'){
196
+
197
+ $ordering_ids = maybe_unserialize($answer->given_answer);
198
+ foreach ($ordering_ids as $ordering_id){
199
+ $get_answers = tutor_utils()->get_answer_by_id($ordering_id);
200
+ $answer_titles = wp_list_pluck($get_answers, 'answer_title');
201
+ echo '<p>'.implode('</p><p>', $answer_titles).'</p>';
202
+ }
203
+
204
+ }elseif ($answer->question_type === 'matching'){
205
+
206
+ $ordering_ids = maybe_unserialize($answer->given_answer);
207
+ $original_saved_answers = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
208
+
209
+ foreach ($original_saved_answers as $key => $original_saved_answer){
210
+ $provided_answer_order_id = isset($ordering_ids[$key]) ? $ordering_ids[$key] : 0;
211
+ $provided_answer_order = tutor_utils()->get_answer_by_id($provided_answer_order_id);
212
+ foreach ($provided_answer_order as $provided_answer_order);
213
+ echo $original_saved_answer->answer_title ." - {$provided_answer_order->answer_two_gap_match} <br />";
214
+ }
215
+
216
+ }elseif ($answer->question_type === 'image_matching'){
217
+
218
+ $ordering_ids = maybe_unserialize($answer->given_answer);
219
+ $original_saved_answers = tutor_utils()->get_answers_by_quiz_question($answer->question_id);
220
+
221
+ echo '<div class="answer-image-matched-wrap">';
222
+ foreach ($original_saved_answers as $key => $original_saved_answer){
223
+ $provided_answer_order_id = isset($ordering_ids[$key]) ? $ordering_ids[$key] : 0;
224
+ $provided_answer_order = tutor_utils()->get_answer_by_id($provided_answer_order_id);
225
+ foreach ($provided_answer_order as $provided_answer_order);
226
+ ?>
227
+ <div class="image-matching-item">
228
+ <p class="dragged-img-rap"><img src="<?php echo wp_get_attachment_image_url( $original_saved_answer->image_id); ?>" /> </p>
229
+ <p class="dragged-caption"><?php echo $provided_answer_order->answer_title; ?></p>
230
+ </div>
231
+ <?php
232
+ }
233
+ echo '</div>';
234
+ }elseif ($answer->question_type === 'image_answering'){
235
+
236
+ $ordering_ids = maybe_unserialize($answer->given_answer);
237
+
238
+ echo '<div class="answer-image-matched-wrap">';
239
+ foreach ($ordering_ids as $answer_id => $answer){
240
+ $db_answers = tutor_utils()->get_answer_by_id($answer_id);
241
+ foreach ($db_answers as $db_answer);
242
+ ?>
243
+ <div class="image-matching-item">
244
+ <p class="dragged-img-rap"><img src="<?php echo wp_get_attachment_image_url( $db_answer->image_id); ?>" /> </p>
245
+ <p class="dragged-caption"><?php echo $answer; ?></p>
246
+ </div>
247
+ <?php
248
+ }
249
+ echo '</div>';
250
  }
251
+
252
  ?>
253
  </td>
254
 
255
  <td>
256
+ <a href="<?php echo admin_url("admin.php?action=review_quiz_answer&attempt_id={$attempt_id}&attempt_answer_id={$answer->attempt_answer_id}&mark_as=correct"); ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" class="tutor-button button button-success"><i class="dashicons dashicons-yes"></i> </a>
257
 
258
+ <a href="<?php echo admin_url("admin.php?action=review_quiz_answer&attempt_id={$attempt_id}&attempt_answer_id={$answer->attempt_answer_id}&mark_as=incorrect"); ?>" title="<?php _e('Mark as In correct', 'tutor'); ?>" class="tutor-button button button-danger"><i class="dashicons dashicons-no-alt"></i></a>
259
  </td>
260
  </tr>
261
  <?php