Tutor LMS – eLearning and online course solution - Version 1.2.12

Version Description

  • 25 April, 2019 =

  • Added: Synced role with tutor instructor role when changing it from WP User Edit page

  • Added: Flatpro theme compatibility

  • Fixed: Some design issue in quiz builder

  • Fixed: WooCommerce price error when WC is not exists

  • Removed: Edit Icon on true/false type question in the quiz builder

Download this release

Release Info

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

Code changes from version 1.2.11 to 1.2.12

assets/css/tutor-admin.css CHANGED
@@ -940,7 +940,7 @@ Quiz Modal
940
  padding: 20px;
941
  }
942
  .tutor-modal-wrap .modal-container p{
943
- margin: 5px 0;
944
  }
945
  .tutor-modal-wrap .modal-header {
946
  display: flex;
@@ -1041,14 +1041,16 @@ Quiz Modal
1041
  .tutor-quiz-builder-form-row .quiz-form-warning {
1042
  color: #e88e06;
1043
  }
1044
- #tutor_quiz_question_answer_form {
1045
- margin: 20px 0;
1046
- }
1047
  .tutor-quiz-question-answers-form {
1048
  background-color: #fff;
1049
  padding: 20px;
1050
- box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
1051
  transition: all 0.3s cubic-bezier(.25,.8,.25,1);
 
 
 
1052
  }
1053
  .advanced-options-tab-item{
1054
  float: right;
@@ -1083,6 +1085,7 @@ Quiz Modal
1083
  .tutor-quiz-builder-group > p.help{
1084
  color: #A4A4A4;
1085
  font-size: 12px;
 
1086
  }
1087
  .tutor-quiz-builder-group > h4{
1088
  font-size: 14px;
@@ -1265,35 +1268,47 @@ label.btn-switch input:checked + .btn-slider {
1265
  .tutor-select .select-header .lead-option {
1266
  flex: 1;
1267
  }
 
 
 
1268
  .tutor-select .select-header .lead-option .question-type-pro{
1269
  display: none;
1270
  }
1271
  .tutor-select .tutor-select-options {
1272
  border: 1px solid #DEDEDE;
1273
  background-color: #fff;
1274
- padding: 10px;
1275
- width: 400px;
1276
  position: absolute;
1277
  font-size: 0;
1278
  z-index: 9;
 
 
 
 
 
1279
  }
1280
  .tutor-select .tutor-select-options .tutor-select-option {
1281
- width: 46%;
1282
  display: inline-block;
1283
- padding: 2%;
1284
  cursor: pointer;
1285
  position: relative;
 
 
 
 
1286
  }
1287
  .tutor-select .tutor-select-options .tutor-select-option:hover {
1288
- background: #eee;
1289
  }
1290
  .question-type-pro {
1291
- background: #d64d4d;
1292
  color: #fff;
1293
  font-size: 9px;
1294
- padding: 3px 5px;
1295
- right: 0;
1296
  position: absolute;
 
 
1297
  }
1298
  i.tutor-icon-block {
1299
  padding: 0;
@@ -1349,7 +1364,7 @@ i.tutor-icon-block.tutor-icon-plus-square-button, i.tutor-icon-block.tutor-icon-
1349
  .create-lesson-in-topic-btn i.tutor-icon-block.tutor-icon-plus{
1350
  background-color: #3057d5;
1351
  }
1352
-
1353
  .quiz-modal-field-wrap .question_options_group_wrap {
1354
  margin: 20px 0;
1355
  display: block;
@@ -1358,11 +1373,11 @@ i.tutor-icon-block.tutor-icon-plus-square-button, i.tutor-icon-block.tutor-icon-
1358
  .quiz-modal-field-wrap .add_question_option {
1359
  display: block;
1360
  }
1361
- .quiz-modal-field-wrap.label-inline label{
1362
- display: inline-block;
1363
- font-weight: 300;
1364
- margin-right: 20px;
1365
- }
1366
  a.back-to-quiz-questions-btn {
1367
  font-size: 16px;
1368
  font-weight: 300;
@@ -1388,7 +1403,7 @@ a.back-to-quiz-questions-btn {
1388
  margin-bottom: 20px;
1389
  }
1390
  .quiz-question-form-body {
1391
- margin-bottom: 50px;
1392
  }
1393
  .quiz-builder-question-wrap {
1394
  display: flex;
@@ -1483,18 +1498,21 @@ a.back-to-quiz-questions-btn {
1483
  .tutor-quiz-answer {
1484
  background-color: #fff;
1485
  flex: 1;
1486
- margin-bottom: 10px;
1487
- padding: 10px;
1488
  border: 1px solid #DEDEDE;
1489
  display: flex;
 
 
 
1490
  }
1491
  .tutor-quiz-answer .tutor-quiz-answer-edit a {
1492
  display: block;
1493
  padding: 0px 9px;
1494
  }
1495
  .tutor-quiz-answer-trash-wrap a.answer-trash-btn {
1496
- padding: 10px;
1497
  display: inline-block;
 
1498
  }
1499
  span.tutor-quiz-answer-title {
1500
  flex: 1;
940
  padding: 20px;
941
  }
942
  .tutor-modal-wrap .modal-container p{
943
+ margin: 0 0 15px;
944
  }
945
  .tutor-modal-wrap .modal-header {
946
  display: flex;
1041
  .tutor-quiz-builder-form-row .quiz-form-warning {
1042
  color: #e88e06;
1043
  }
1044
+ /*#tutor_quiz_question_answer_form {*/
1045
+ /*margin: 20px 0;*/
1046
+ /*}*/
1047
  .tutor-quiz-question-answers-form {
1048
  background-color: #fff;
1049
  padding: 20px;
 
1050
  transition: all 0.3s cubic-bezier(.25,.8,.25,1);
1051
+ border: 1px solid #DEDEDE;
1052
+ border-radius: 3px;
1053
+ margin-bottom: 20px;
1054
  }
1055
  .advanced-options-tab-item{
1056
  float: right;
1085
  .tutor-quiz-builder-group > p.help{
1086
  color: #A4A4A4;
1087
  font-size: 12px;
1088
+ margin-top: 7px;
1089
  }
1090
  .tutor-quiz-builder-group > h4{
1091
  font-size: 14px;
1268
  .tutor-select .select-header .lead-option {
1269
  flex: 1;
1270
  }
1271
+ .tutor-select .select-header .select-dropdown{
1272
+ line-height: 22px;
1273
+ }
1274
  .tutor-select .select-header .lead-option .question-type-pro{
1275
  display: none;
1276
  }
1277
  .tutor-select .tutor-select-options {
1278
  border: 1px solid #DEDEDE;
1279
  background-color: #fff;
1280
+ padding: 22px 10px 8px;
1281
+ width: calc(100% - 22px);
1282
  position: absolute;
1283
  font-size: 0;
1284
  z-index: 9;
1285
+ display: flex;
1286
+ flex-wrap: wrap;
1287
+ box-shadow: 0px 2px 10px rgba(0,0,0,.08);
1288
+ top: 55px;
1289
+ border-radius: 3px;
1290
  }
1291
  .tutor-select .tutor-select-options .tutor-select-option {
1292
+ width: calc(33.3333% - 22px);
1293
  display: inline-block;
1294
+ padding: 9px;
1295
  cursor: pointer;
1296
  position: relative;
1297
+ box-sizing: border-box;
1298
+ margin: 0 11px 15px;
1299
+ border: 1px solid #E2E2E2;
1300
+ border-radius: 3px;
1301
  }
1302
  .tutor-select .tutor-select-options .tutor-select-option:hover {
1303
+ border-color: #3057D5;
1304
  }
1305
  .question-type-pro {
 
1306
  color: #fff;
1307
  font-size: 9px;
1308
+ right: 11px;
 
1309
  position: absolute;
1310
+ top: 50%;
1311
+ transform: translateY(-50%);
1312
  }
1313
  i.tutor-icon-block {
1314
  padding: 0;
1364
  .create-lesson-in-topic-btn i.tutor-icon-block.tutor-icon-plus{
1365
  background-color: #3057d5;
1366
  }
1367
+ /*
1368
  .quiz-modal-field-wrap .question_options_group_wrap {
1369
  margin: 20px 0;
1370
  display: block;
1373
  .quiz-modal-field-wrap .add_question_option {
1374
  display: block;
1375
  }
1376
+ .quiz-modal-field-wrap.label-inline label{*/
1377
+ /*display: inline-block;*/
1378
+ /*font-weight: 300;*/
1379
+ /*margin-right: 20px;*/
1380
+ /*}*/
1381
  a.back-to-quiz-questions-btn {
1382
  font-size: 16px;
1383
  font-weight: 300;
1403
  margin-bottom: 20px;
1404
  }
1405
  .quiz-question-form-body {
1406
+ margin-bottom: 25px;
1407
  }
1408
  .quiz-builder-question-wrap {
1409
  display: flex;
1498
  .tutor-quiz-answer {
1499
  background-color: #fff;
1500
  flex: 1;
1501
+ padding: 10px 15px;
 
1502
  border: 1px solid #DEDEDE;
1503
  display: flex;
1504
+ line-height: 22px;
1505
+ border-radius: 3px;
1506
+ margin-bottom: 15px;
1507
  }
1508
  .tutor-quiz-answer .tutor-quiz-answer-edit a {
1509
  display: block;
1510
  padding: 0px 9px;
1511
  }
1512
  .tutor-quiz-answer-trash-wrap a.answer-trash-btn {
1513
+ padding: 0 10px;
1514
  display: inline-block;
1515
+ line-height: 44px;
1516
  }
1517
  span.tutor-quiz-answer-title {
1518
  flex: 1;
assets/css/tutor-front.css CHANGED
@@ -3431,6 +3431,7 @@ Course question and answer
3431
  .prerequisites-course-lists{
3432
  padding: 0;
3433
  list-style: none;
 
3434
  }
3435
 
3436
 
@@ -3467,10 +3468,12 @@ Course question and answer
3467
  align-items: center;
3468
  }
3469
 
3470
- .prerequisites-course-feature-image{
3471
  width: 70px;
3472
- overflow: hidden;
3473
  border-radius: 2px;
 
 
 
3474
  }
3475
 
3476
  .prerequisites-course-lists li .prerequisites-course-title{
3431
  .prerequisites-course-lists{
3432
  padding: 0;
3433
  list-style: none;
3434
+ margin: 0;
3435
  }
3436
 
3437
 
3468
  align-items: center;
3469
  }
3470
 
3471
+ .prerequisites-course-feature-image img{
3472
  width: 70px;
 
3473
  border-radius: 2px;
3474
+ height: auto;
3475
+ margin: 0 !important;
3476
+ box-shadow: 0 0 1px rgba(0,0,0.08);
3477
  }
3478
 
3479
  .prerequisites-course-lists li .prerequisites-course-title{
classes/Options.php CHANGED
@@ -57,7 +57,6 @@ class Options {
57
  update_option('tutor_option', $option);
58
 
59
  do_action('tutor_option_save_after');
60
-
61
  //re-sync settings
62
  //init::tutor_activate();
63
 
@@ -69,9 +68,7 @@ class Options {
69
 
70
  //$course_base = tutor_utils()->course_archive_page_url();
71
  $lesson_url = site_url().'/course/'.'sample-course/<code>lessons</code>/sample-lesson/';
72
-
73
  $student_url = tutor_utils()->profile_url();
74
-
75
  $attempts_allowed = array();
76
  $attempts_allowed['unlimited'] = __('Unlimited' , 'tutor');
77
  $attempts_allowed = array_merge($attempts_allowed, array_combine(range(1,20), range(1,20)));
@@ -185,11 +182,8 @@ class Options {
185
  'default' => 'lessons',
186
  'desc' => $lesson_url,
187
  ),
188
-
189
  ),
190
-
191
  ),
192
-
193
  ),
194
  ),
195
  'quiz' => array(
@@ -222,7 +216,6 @@ class Options {
222
  ),
223
  ),
224
  ),
225
-
226
  'quiz_when_time_expires' => array(
227
  'type' => 'radio',
228
  'label' => __('When time expires', 'tutor'),
@@ -235,14 +228,12 @@ class Options {
235
  ),
236
  'desc' => __('What should happen by default if a student does not submit the quiz before time expires.', 'tutor'),
237
  ),
238
-
239
  'quiz_attempts_allowed' => array(
240
  'type' => 'number',
241
  'label' => __('Attempts allowed', 'tutor'),
242
  'default' => '10',
243
  'desc' => __('Restriction on the number of attempts students are allowed to take for a quiz. 0 for no limit', 'tutor'),
244
  ),
245
-
246
  'quiz_grade_method' => array(
247
  'type' => 'select',
248
  'label' => __('Grading method', 'tutor'),
@@ -284,7 +275,6 @@ class Options {
284
  ),
285
  ),
286
  ),
287
-
288
  'students' => array(
289
  'label' => __('Students', 'tutor'),
290
  'sections' => array(
@@ -312,12 +302,10 @@ class Options {
312
  'default' => '0',
313
  'desc' => __('Completed courses will be show on student profile', 'tutor')."<br />".$student_url,
314
  ),
315
-
316
  ),
317
  ),
318
  ),
319
  ),
320
-
321
  'tutor_earning' => array(
322
  'label' => __('Earning', 'tutor'),
323
  'sections' => array(
@@ -325,7 +313,6 @@ class Options {
325
  'label' => __('Earning and commission allocation', 'tutor'),
326
  'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
327
  'fields' => array(
328
-
329
  'enable_tutor_earning' => array(
330
  'type' => 'checkbox',
331
  'label' => __('Enable/Disable', 'tutor'),
@@ -333,7 +320,6 @@ class Options {
333
  'default' => '0',
334
  'desc' => __('You can set commission and generate earning for instructor who interested sell their course with this platform by enabling this feature', 'tutor'),
335
  ),
336
-
337
  'earning_admin_commission' => array(
338
  'type' => 'number',
339
  'label' => __('Admin / Platform Owner Commission', 'tutor'),
@@ -346,7 +332,6 @@ class Options {
346
  'default' => '80',
347
  'desc' => __('Define the sales commission for instructor from every course sell.', 'tutor'),
348
  ),
349
-
350
  'tutor_earning_fees' => array(
351
  'type' => 'group_fields',
352
  'label' => __('Others Fees', 'tutor'),
@@ -386,35 +371,22 @@ class Options {
386
  'default' => '20',
387
  'desc' => __('Define the number of statement should show.', 'tutor'),
388
  ),
389
-
390
  ),
391
  ),
392
-
393
-
394
  ),
395
  ),
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
  'tutor_withdraw' => array(
405
  'label' => __('Withdraw', 'tutor'),
406
  'sections' => array(
407
  'general' => array(
408
  'label' => __('Earning and commission allocation', 'tutor'),
409
  'fields' => array(
410
-
411
  'min_withdraw_amount' => array(
412
  'type' => 'number',
413
  'label' => __('Minimum Withdraw Amount', 'tutor'),
414
  'default' => '80',
415
  'desc' => __('Define the withdraw amount, anyone can make withdraw request if their earning above or equal this amount.', 'tutor'),
416
  ),
417
-
418
  ),
419
  ),
420
 
@@ -422,25 +394,13 @@ class Options {
422
  'label' => __('Withdraw Methods', 'tutor'),
423
  'desc' => __('Set withdraw settings', 'tutor'),
424
  ),
425
-
426
  ),
427
  ),
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
  );
439
 
440
  return apply_filters('tutor/options/attr', $attr);
441
  }
442
 
443
-
444
  /**
445
  * @param array $field
446
  *
@@ -466,6 +426,4 @@ class Options {
466
  return ob_get_clean();
467
  }
468
 
469
-
470
-
471
  }
57
  update_option('tutor_option', $option);
58
 
59
  do_action('tutor_option_save_after');
 
60
  //re-sync settings
61
  //init::tutor_activate();
62
 
68
 
69
  //$course_base = tutor_utils()->course_archive_page_url();
70
  $lesson_url = site_url().'/course/'.'sample-course/<code>lessons</code>/sample-lesson/';
 
71
  $student_url = tutor_utils()->profile_url();
 
72
  $attempts_allowed = array();
73
  $attempts_allowed['unlimited'] = __('Unlimited' , 'tutor');
74
  $attempts_allowed = array_merge($attempts_allowed, array_combine(range(1,20), range(1,20)));
182
  'default' => 'lessons',
183
  'desc' => $lesson_url,
184
  ),
 
185
  ),
 
186
  ),
 
187
  ),
188
  ),
189
  'quiz' => array(
216
  ),
217
  ),
218
  ),
 
219
  'quiz_when_time_expires' => array(
220
  'type' => 'radio',
221
  'label' => __('When time expires', 'tutor'),
228
  ),
229
  'desc' => __('What should happen by default if a student does not submit the quiz before time expires.', 'tutor'),
230
  ),
 
231
  'quiz_attempts_allowed' => array(
232
  'type' => 'number',
233
  'label' => __('Attempts allowed', 'tutor'),
234
  'default' => '10',
235
  'desc' => __('Restriction on the number of attempts students are allowed to take for a quiz. 0 for no limit', 'tutor'),
236
  ),
 
237
  'quiz_grade_method' => array(
238
  'type' => 'select',
239
  'label' => __('Grading method', 'tutor'),
275
  ),
276
  ),
277
  ),
 
278
  'students' => array(
279
  'label' => __('Students', 'tutor'),
280
  'sections' => array(
302
  'default' => '0',
303
  'desc' => __('Completed courses will be show on student profile', 'tutor')."<br />".$student_url,
304
  ),
 
305
  ),
306
  ),
307
  ),
308
  ),
 
309
  'tutor_earning' => array(
310
  'label' => __('Earning', 'tutor'),
311
  'sections' => array(
313
  'label' => __('Earning and commission allocation', 'tutor'),
314
  'desc' => __('Enable Disable Option to on/off notification on various event', 'tutor'),
315
  'fields' => array(
 
316
  'enable_tutor_earning' => array(
317
  'type' => 'checkbox',
318
  'label' => __('Enable/Disable', 'tutor'),
320
  'default' => '0',
321
  'desc' => __('You can set commission and generate earning for instructor who interested sell their course with this platform by enabling this feature', 'tutor'),
322
  ),
 
323
  'earning_admin_commission' => array(
324
  'type' => 'number',
325
  'label' => __('Admin / Platform Owner Commission', 'tutor'),
332
  'default' => '80',
333
  'desc' => __('Define the sales commission for instructor from every course sell.', 'tutor'),
334
  ),
 
335
  'tutor_earning_fees' => array(
336
  'type' => 'group_fields',
337
  'label' => __('Others Fees', 'tutor'),
371
  'default' => '20',
372
  'desc' => __('Define the number of statement should show.', 'tutor'),
373
  ),
 
374
  ),
375
  ),
 
 
376
  ),
377
  ),
 
 
 
 
 
 
 
 
378
  'tutor_withdraw' => array(
379
  'label' => __('Withdraw', 'tutor'),
380
  'sections' => array(
381
  'general' => array(
382
  'label' => __('Earning and commission allocation', 'tutor'),
383
  'fields' => array(
 
384
  'min_withdraw_amount' => array(
385
  'type' => 'number',
386
  'label' => __('Minimum Withdraw Amount', 'tutor'),
387
  'default' => '80',
388
  'desc' => __('Define the withdraw amount, anyone can make withdraw request if their earning above or equal this amount.', 'tutor'),
389
  ),
 
390
  ),
391
  ),
392
 
394
  'label' => __('Withdraw Methods', 'tutor'),
395
  'desc' => __('Set withdraw settings', 'tutor'),
396
  ),
 
397
  ),
398
  ),
 
 
 
 
 
 
 
 
 
 
399
  );
400
 
401
  return apply_filters('tutor/options/attr', $attr);
402
  }
403
 
 
404
  /**
405
  * @param array $field
406
  *
426
  return ob_get_clean();
427
  }
428
 
 
 
429
  }
classes/Quiz.php CHANGED
@@ -920,6 +920,12 @@ class Quiz {
920
 
921
  ob_start();
922
 
 
 
 
 
 
 
923
  switch ($question_type){
924
  case 'true_false':
925
  echo '<label>'.__('Answer options &amp; mark correct', 'tutor').'</label>';
920
 
921
  ob_start();
922
 
923
+ /*
924
+ * @TODO: Should We remove this text?
925
+ * Screenshot: http://prntscr.com/ngl2mb
926
+ * Screenshot: http://prntscr.com/ngl2ak
927
+ */
928
+
929
  switch ($question_type){
930
  case 'true_false':
931
  echo '<label>'.__('Answer options &amp; mark correct', 'tutor').'</label>';
classes/User.php CHANGED
@@ -10,6 +10,7 @@ class User {
10
  add_action('show_user_profile', array($this, 'edit_user_profile'), 10, 1);
11
 
12
  add_action('profile_update', array($this, 'profile_update'));
 
13
  }
14
 
15
  public function edit_user_profile($user){
@@ -26,4 +27,16 @@ class User {
26
  update_user_meta($user_id, '_tutor_profile_photo', $_tutor_profile_photo);
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
10
  add_action('show_user_profile', array($this, 'edit_user_profile'), 10, 1);
11
 
12
  add_action('profile_update', array($this, 'profile_update'));
13
+ add_action('set_user_role', array($this, 'set_user_role'), 10, 3);
14
  }
15
 
16
  public function edit_user_profile($user){
27
  update_user_meta($user_id, '_tutor_profile_photo', $_tutor_profile_photo);
28
  }
29
 
30
+ public function set_user_role($user_id, $role, $old_roles ){
31
+ $instructor_role = tutor()->instructor_role;
32
+
33
+ if (in_array($instructor_role, $old_roles)){
34
+ tutor_utils()->remove_instructor_role($user_id);
35
+ }
36
+
37
+ if ($role === $instructor_role){
38
+ tutor_utils()->add_instructor_role($user_id);
39
+ }
40
+ }
41
+
42
  }
classes/Utils.php CHANGED
@@ -3998,7 +3998,14 @@ class Utils {
3998
  return false;
3999
  }
4000
 
4001
-
 
 
 
 
 
 
 
4002
  public function get_withdrawals_history($user_id = 0, $filter = array()){
4003
  global $wpdb;
4004
 
@@ -4056,4 +4063,32 @@ class Utils {
4056
 
4057
  }
4058
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4059
  }
3998
  return false;
3999
  }
4000
 
4001
+ /**
4002
+ * @param int $user_id
4003
+ * @param array $filter
4004
+ *
4005
+ * get withdrawal history
4006
+ *
4007
+ * @return object
4008
+ */
4009
  public function get_withdrawals_history($user_id = 0, $filter = array()){
4010
  global $wpdb;
4011
 
4063
 
4064
  }
4065
 
4066
+ public function add_instructor_role($instructor_id = 0){
4067
+ if ( ! $instructor_id){
4068
+ return;
4069
+ }
4070
+ do_action('tutor_before_approved_instructor', $instructor_id);
4071
+
4072
+ update_user_meta($instructor_id, '_tutor_instructor_status', 'approved');
4073
+ update_user_meta($instructor_id, '_tutor_instructor_approved', time());
4074
+
4075
+ $instructor = new \WP_User($instructor_id);
4076
+ $instructor->add_role(tutor()->instructor_role);
4077
+
4078
+ do_action('tutor_after_approved_instructor', $instructor_id);
4079
+ }
4080
+
4081
+ public function remove_instructor_role($instructor_id = 0){
4082
+ if ( ! $instructor_id){
4083
+ return;
4084
+ }
4085
+
4086
+ do_action('tutor_before_blocked_instructor', $instructor_id);
4087
+ update_user_meta($instructor_id, '_tutor_instructor_status', 'blocked');
4088
+
4089
+ $instructor = new \WP_User($instructor_id);
4090
+ $instructor->remove_role(tutor()->instructor_role);
4091
+ do_action('tutor_after_blocked_instructor', $instructor_id);
4092
+ }
4093
+
4094
  }
classes/WooCommerce.php CHANGED
@@ -93,20 +93,26 @@ class WooCommerce extends Tutor_Base {
93
  }
94
 
95
  public function get_tutor_course_price($price, $course_id){
96
-
97
- $product_id = tutor_utils()->get_course_product_id($course_id);
98
- $product = wc_get_product( $product_id );
99
-
100
- if ($product) {
101
- ob_start();
102
- ?>
103
- <div class="price">
104
- <?php echo $product->get_price_html(); ?>
105
- </div>
106
- <?php
107
- return ob_get_clean();
 
 
 
 
 
108
  }
109
- return false;
 
110
  }
111
 
112
  public function tutor_course_sell_by(){
93
  }
94
 
95
  public function get_tutor_course_price($price, $course_id){
96
+ $price = null;
97
+
98
+ if (tutor_utils()->is_course_purchasable($course_id)) {
99
+ if (tutor_utils()->has_wc()){
100
+ $product_id = tutor_utils()->get_course_product_id($course_id);
101
+ $product = wc_get_product( $product_id );
102
+
103
+ if ($product) {
104
+ ob_start();
105
+ ?>
106
+ <div class="price">
107
+ <?php echo $product->get_price_html(); ?>
108
+ </div>
109
+ <?php
110
+ return ob_get_clean();
111
+ }
112
+ }
113
  }
114
+
115
+ return $price;
116
  }
117
 
118
  public function tutor_course_sell_by(){
includes/theme-compatibility/flatpro/assets/css/style.css ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .tutor-wrap{
2
+ padding-top: 80px;
3
+ padding-bottom: 80px;
4
+ }
5
+
6
+ .tutor-login-form-wrap #loginform {
7
+ width: auto;
8
+ padding: 0;
9
+ border: none;
10
+ }
11
+
12
+ .tutor-lesson-content-area{
13
+ margin-bottom: 60px;
14
+ }
15
+
16
+ .tutor-lesson-content-area,
17
+ .tutor-quiz-single-wrap {
18
+ margin: 0 100px 80px;
19
+ }
20
+
21
+ .tutor-course-loop .tutor-course-header a img{
22
+ width: 100%;
23
+ height: auto;
24
+ }
includes/theme-compatibility/flatpro/functions.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) )
3
+ exit;
4
+
5
+
6
+ add_action('wp_enqueue_scripts', 'tutor_flatpro_scripts');
7
+
8
+ if ( ! function_exists('tutor_flatpro_scripts')){
9
+ function tutor_flatpro_scripts(){
10
+ $dir_url = plugin_dir_url(__FILE__);
11
+ wp_enqueue_style('tutor_flatpro', $dir_url.'assets/css/style.css');
12
+ }
13
+ }
14
+
15
+
16
+
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: lms, course, elearning, education, quiz, training, sell courses, courses,
5
  Requires at least: 4.5
6
  Tested up to: 5.1
7
  Requires PHP: 5.4.0
8
- Stable tag: 1.2.11
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -206,6 +206,14 @@ Tutor enables you to use any third party plugins without facing any compatibilit
206
 
207
  == Changelog ==
208
 
 
 
 
 
 
 
 
 
209
  = 1.2.11 - 24 April, 2019 =
210
 
211
  * Added: few action hooks at the quiz
5
  Requires at least: 4.5
6
  Tested up to: 5.1
7
  Requires PHP: 5.4.0
8
+ Stable tag: 1.2.12
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
206
 
207
  == Changelog ==
208
 
209
+ = 1.2.12 - 25 April, 2019 =
210
+
211
+ * Added: Synced role with tutor instructor role when changing it from WP User Edit page
212
+ * Added: Flatpro theme compatibility
213
+ * Fixed: Some design issue in quiz builder
214
+ * Fixed: WooCommerce price error when WC is not exists
215
+ * Removed: Edit Icon on true/false type question in the quiz builder
216
+
217
  = 1.2.11 - 24 April, 2019 =
218
 
219
  * Added: few action hooks at the quiz
tutor.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Tutor LMS
4
  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 small to large scale online education site very conveniently. Power features like report, certificate, course preview, private file sharing make Tutor a robust plugin for any educational institutes.
6
  Author: Themeum
7
- Version: 1.2.11
8
  Author URI: http://themeum.com
9
  Requires at least: 4.5
10
  Tested up to: 5.1
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) )
17
  /**
18
  * Defined the tutor main file
19
  */
20
- define('TUTOR_VERSION', '1.2.11');
21
  define('TUTOR_FILE', __FILE__);
22
 
23
 
4
  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 small to large scale online education site very conveniently. Power features like report, certificate, course preview, private file sharing make Tutor a robust plugin for any educational institutes.
6
  Author: Themeum
7
+ Version: 1.2.12
8
  Author URI: http://themeum.com
9
  Requires at least: 4.5
10
  Tested up to: 5.1
17
  /**
18
  * Defined the tutor main file
19
  */
20
+ define('TUTOR_VERSION', '1.2.12');
21
  define('TUTOR_FILE', __FILE__);
22
 
23
 
views/modal/question_answer_edit_form.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  if ($question_type === 'open_ended'){
3
- echo '<p style="color: #ff0000;">No option is necessary for this answer type</p>';
4
  return '';
5
  }
6
 
@@ -19,124 +19,161 @@ $answer_two_gap_match = ! empty($old_answer->answer_two_gap_match) ? $old_answer
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>
@@ -144,21 +181,22 @@ $answer_two_gap_match = ! empty($old_answer->answer_two_gap_match) ? $old_answer
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">
@@ -167,34 +205,35 @@ $answer_two_gap_match = ! empty($old_answer->answer_two_gap_match) ? $old_answer
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">
@@ -203,16 +242,18 @@ $answer_two_gap_match = ! empty($old_answer->answer_two_gap_match) ? $old_answer
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
  ?>
1
  <?php
2
  if ($question_type === 'open_ended'){
3
+ echo '<p class="open-ended-notice" style="color: #ff0000;">No option is necessary for this answer type</p>';
4
  return '';
5
  }
6
 
19
  //No Need
20
  }elseif($question_type === 'multiple_choice' || $question_type === 'single_choice' || $question_type === 'ordering' ){
21
 
 
 
 
 
22
  ?>
23
 
24
+ <div class="tutor-quiz-builder-group">
25
+ <h4><?php _e('Answer title', 'tutor'); ?></h4>
26
+ <div class="tutor-quiz-builder-row">
27
+ <div class="tutor-quiz-builder-col">
28
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
29
+ </div>
30
  </div>
31
+ <?php
32
+ if ($question_type === 'ordering'){
33
+ printf(
34
+ '<p class="help">%s <b>%s</b></p>',
35
+ __('Make sure you are saving answer in right sorting in answers lists, student should ordering should match with this answer order.', 'tutor'),
36
+ __('You can re-order it from above answer list.', 'tutor')
37
+ );
38
+ }
39
+ ?>
40
  </div>
41
 
42
+ <div class="tutor-quiz-builder-group">
43
+ <h4><?php _e('Upload Image', 'tutor'); ?></h4>
44
+ <div class="tutor-quiz-builder-row">
45
+ <div class="tutor-quiz-builder-col">
46
+ <div class="tutor-media-upload-wrap">
47
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>">
48
+ <div class="tutor-media-preview">
49
+ <a href="javascript:;" class="tutor-media-upload-btn">
50
+ <?php
51
+ if ($image_id){
52
+ echo '<img src="'.wp_get_attachment_image_url($image_id).'" />';
53
+ }else{
54
+ echo '<i class="tutor-icon-image1"></i>';
55
+ }
56
+ ?>
57
+ </a>
58
+ </div>
59
+ <div class="tutor-media-upload-trash-wrap">
60
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
61
+ </div>
62
  </div>
63
  </div>
64
  </div>
65
+ </div>
66
+ <div class="tutor-quiz-builder-group">
67
+ <h4><?php _e('Answer option view format', 'tutor'); ?></h4>
68
+ <div class="tutor-quiz-builder-row">
69
+ <div class="tutor-quiz-builder-col auto-width">
70
+ <label>
71
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" <?php
72
+ echo $answer_view_format ? checked('text', $answer_view_format) : 'checked="checked"' ?>> <?php _e('Only text', 'tutor'); ?>
73
+ </label>
74
+ </div>
75
+ <div class="tutor-quiz-builder-col auto-width">
76
+ <label>
77
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image" <?php echo
78
+ checked('image', $answer_view_format) ?> > <?php _e('Only Image', 'tutor'); ?>
79
+ </label>
80
+ </div>
81
+ <div class="tutor-quiz-builder-col auto-width">
82
+ <label>
83
+ <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'); ?>
84
+ </label>
85
  </div>
86
  </div>
87
  </div>
 
88
  <?php
89
  }elseif($question_type === 'fill_in_the_blank'){
90
  ?>
91
+ <div class="tutor-quiz-builder-group">
92
+ <h4><?php _e('Question Title', 'tutor'); ?></h4>
93
+ <div class="tutor-quiz-builder-row">
94
+ <div class="tutor-quiz-builder-col">
95
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
 
96
  </div>
97
  </div>
98
+ <p class="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>
99
+ </div>
100
 
101
+ <div class="tutor-quiz-builder-group">
102
+ <h4><?php _e('Gap Answer', 'tutor'); ?></h4>
103
+ <div class="tutor-quiz-builder-row">
104
+ <div class="tutor-quiz-builder-col">
105
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_two_gap_match]" value="<?php echo $answer_two_gap_match; ?>">
 
106
  </div>
107
  </div>
108
+ <p class="help"><?php _e( 'Separate multiple answer by pipe <b>( | )</b> , 1 answer per variable assigned in question', 'tutor' ); ?></p>
109
  </div>
110
 
111
+
112
  <?php
113
  }elseif($question_type === 'matching'){
114
  ?>
115
+ <div class="tutor-quiz-builder-group">
116
+ <h4><?php _e('Answer title', 'tutor'); ?></h4>
117
+ <div class="tutor-quiz-builder-row">
118
+ <div class="tutor-quiz-builder-col">
 
119
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
120
  </div>
121
  </div>
122
+ </div>
123
+ <div class="tutor-quiz-builder-group">
124
+ <h4><?php _e('Matched Answer title', 'tutor'); ?></h4>
125
+ <div class="tutor-quiz-builder-row">
126
+ <div class="tutor-quiz-builder-col">
127
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][matched_answer_title]" value="<?php echo $answer_two_gap_match; ?>">
128
  </div>
129
  </div>
130
  </div>
131
 
132
+ <div class="tutor-quiz-builder-group">
133
+ <h4><?php _e('Upload Image', 'tutor'); ?></h4>
134
+ <div class="tutor-quiz-builder-row">
135
+ <div class="tutor-quiz-builder-col">
136
+ <div class="tutor-media-upload-wrap">
137
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>">
138
+ <div class="tutor-media-preview">
139
+ <a href="javascript:;" class="tutor-media-upload-btn">
140
+ <?php
141
+ if ($image_id){
142
+ echo '<img src="'.wp_get_attachment_image_url($image_id).'" />';
143
+ }else{
144
+ echo '<i class="tutor-icon-image1"></i>';
145
+ }
146
+ ?>
147
+ </a>
148
+ </div>
149
+ <div class="tutor-media-upload-trash-wrap">
150
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
151
+ </div>
152
  </div>
153
  </div>
154
  </div>
155
+ </div>
156
 
157
+ <div class="tutor-quiz-builder-group">
158
+ <h4><?php _e('Answer option view format', 'tutor'); ?></h4>
159
+ <div class="tutor-quiz-builder-row">
160
+ <div class="tutor-quiz-builder-col auto-width">
161
+ <label>
162
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" <?php echo $answer_view_format ? checked('text', $answer_view_format) : 'checked="checked"' ?>>
163
+ <?php _e('Only text', 'tutor'); ?>
164
+ </label>
165
+ </div>
166
+ <div class="tutor-quiz-builder-col auto-width">
167
+ <label>
168
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image" <?php echo checked('image', $answer_view_format) ?> >
169
+ <?php _e('Only Image', 'tutor'); ?>
170
+ </label>
171
+ </div>
172
+ <div class="tutor-quiz-builder-col auto-width">
173
+ <label>
174
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image" <?php echo checked('text_image', $answer_view_format) ?> >
175
+ <?php _e('Text &amp; Image both', 'tutor'); ?>
176
+ </label>
177
  </div>
178
  </div>
179
  </div>
181
  <?php
182
  }elseif ($question_type === 'image_matching'){
183
  ?>
184
+
185
+ <div class="tutor-quiz-builder-group">
186
+ <h4><?php _e('Upload Image', 'tutor'); ?></h4>
187
+ <div class="tutor-quiz-builder-row">
188
+ <div class="tutor-quiz-builder-col">
189
  <div class="tutor-media-upload-wrap">
190
  <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>">
191
  <div class="tutor-media-preview">
192
  <a href="javascript:;" class="tutor-media-upload-btn">
193
+ <?php
194
+ if ($image_id){
195
+ echo '<img src="'.wp_get_attachment_image_url($image_id).'" />';
196
+ }else{
197
+ echo '<i class="tutor-icon-image1"></i>';
198
+ }
199
+ ?>
200
  </a>
201
  </div>
202
  <div class="tutor-media-upload-trash-wrap">
205
  </div>
206
  </div>
207
  </div>
208
+ </div> <!-- /.tutor-quiz-builder-group -->
209
 
210
+ <div class="tutor-quiz-builder-group">
211
+ <h4><?php _e('Image matched text', 'tutor'); ?></h4>
212
+ <div class="tutor-quiz-builder-row">
213
+ <div class="tutor-quiz-builder-col">
214
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
215
  </div>
216
  </div>
217
+ </div> <!-- /.tutor-quiz-builder-group -->
 
218
 
219
  <?php
220
  }elseif($question_type === 'image_answering'){
221
  ?>
222
+ <div class="tutor-quiz-builder-group">
223
+ <h4><?php _e('Upload Image', 'tutor'); ?></h4>
224
+ <div class="tutor-quiz-builder-row">
225
+ <div class="tutor-quiz-builder-col">
226
  <div class="tutor-media-upload-wrap">
227
  <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>">
228
  <div class="tutor-media-preview">
229
  <a href="javascript:;" class="tutor-media-upload-btn">
230
+ <?php
231
+ if ($image_id){
232
+ echo '<img src="'.wp_get_attachment_image_url($image_id).'" />';
233
+ }else{
234
+ echo '<i class="tutor-icon-image1"></i>';
235
+ }
236
+ ?>
237
  </a>
238
  </div>
239
  <div class="tutor-media-upload-trash-wrap">
242
  </div>
243
  </div>
244
  </div>
245
+ </div> <!-- /.tutor-quiz-builder-group -->
246
 
247
+ <div class="tutor-quiz-builder-group">
248
+ <h4><?php _e('Answer input value', 'tutor'); ?></h4>
249
+ <div class="tutor-quiz-builder-row">
250
+ <div class="tutor-quiz-builder-col">
251
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>">
 
252
  </div>
253
  </div>
254
+ <p class="help"><?php _e('Student input text should be matched with this answer, write in <b>Small Caps</b>','tutor'); ?></p>
255
+ </div> <!-- /.tutor-quiz-builder-group -->
256
 
 
257
  <?php
258
  }
259
  ?>
views/modal/question_answer_form.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  if ($question_type === 'open_ended' || $question_type === 'short_answer'){
3
- echo '<p style="color: #ff0000;">No option is necessary for this answer type</p>';
4
  return '';
5
  }
6
 
@@ -12,147 +12,204 @@ if ($question_type === 'open_ended' || $question_type === 'short_answer'){
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">
@@ -164,24 +221,24 @@ if ($question_type === 'open_ended' || $question_type === 'short_answer'){
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">
@@ -193,17 +250,18 @@ if ($question_type === 'open_ended' || $question_type === 'short_answer'){
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
  ?>
1
  <?php
2
  if ($question_type === 'open_ended' || $question_type === 'short_answer'){
3
+ echo '<p class="open-ended-notice" style="color: #ff0000;">No option is necessary for this answer type</p>';
4
  return '';
5
  }
6
 
12
  <?php
13
  if ($question_type === 'true_false'){
14
  ?>
15
+ <div class="tutor-quiz-builder-group">
16
+ <h4><?php _e('Select option which is correct', 'tutor'); ?></h4>
17
+ <div class="tutor-quiz-builder-row">
18
+ <div class="tutor-quiz-builder-col auto-width">
19
+ <label>
20
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][true_false]" value="true" checked="checked">
21
+ <?php _e('True', 'tutor'); ?>
22
+ </label>
23
+ <label>
24
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][true_false]" value="false">
25
+ <?php _e('False', 'tutor'); ?>
26
+ </label>
27
+ </div>
28
  </div>
29
  </div>
30
 
31
  <?php
32
  }elseif($question_type === 'multiple_choice' || $question_type === 'single_choice' || $question_type === 'ordering' ){
 
 
 
 
 
 
33
  ?>
34
+
35
+ <div class="tutor-quiz-builder-group">
36
+ <h4><?php _e('Answer title', 'tutor'); ?></h4>
37
+ <div class="tutor-quiz-builder-row">
38
+ <div class="tutor-quiz-builder-col">
39
+ <div class="quiz-modal-field-wrap">
40
+ <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
41
+ </div>
42
+ </div>
43
  </div>
44
+ <?php
45
+ if ($question_type === 'ordering'){
46
+ printf(
47
+ '<p class="help">%s <b>%s</b></p>',
48
+ __('Make sure you are saving answer in right sorting in answers lists, student should ordering should match with this answer order.', 'tutor'),
49
+ __('You can re-order it from above answer list.', 'tutor')
50
+ );
51
+ }
52
+ ?>
53
  </div>
54
 
55
+
56
+ <div class="tutor-quiz-builder-group">
57
+ <h4><?php _e('Upload Image', 'tutor'); ?></h4>
58
+ <div class="tutor-quiz-builder-row">
59
+ <div class="tutor-quiz-builder-col">
60
+ <div class="tutor-media-upload-wrap">
61
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="">
62
+ <div class="tutor-media-preview">
63
+ <a href="javascript:;" class="tutor-media-upload-btn"><i class="tutor-icon-image1"></i></a>
64
+ </div>
65
+ <div class="tutor-media-upload-trash-wrap">
66
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
67
+ </div>
68
  </div>
69
  </div>
70
  </div>
71
+ </div>
72
 
73
+ <div class="tutor-quiz-builder-group">
74
+ <h4><?php _e('Answer option view format', 'tutor'); ?></h4>
75
+ <div class="tutor-quiz-builder-row">
76
+ <div class="tutor-quiz-builder-col auto-width">
77
+ <label>
78
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" checked="checked">
79
+ <?php _e('Only text', 'tutor'); ?>
80
+ </label>
81
+ </div>
82
+ <div class="tutor-quiz-builder-col auto-width">
83
+ <label>
84
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image">
85
+ <?php _e('Only Image', 'tutor'); ?>
86
+ </label>
87
+ </div>
88
+ <div class="tutor-quiz-builder-col auto-width">
89
+ <label>
90
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image">
91
+ <?php _e('Text &amp; Image both', 'tutor'); ?>
92
+ </label>
93
  </div>
94
  </div>
95
  </div>
96
 
97
  <?php
98
+ }elseif($question_type === 'fill_in_the_blank'){ ?>
99
+ <div class="tutor-quiz-builder-group">
100
+ <h4><?php _e('Question Title', 'tutor'); ?></h4>
101
+ <div class="tutor-quiz-builder-row">
102
+ <div class="tutor-quiz-builder-col">
 
103
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
 
104
  </div>
105
  </div>
106
+ <p class="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>
107
+ </div> <!-- /.tutor-quiz-builder-group -->
108
 
109
+ <div class="tutor-quiz-builder-group">
110
+ <h4><?php _e('Gap Answer', 'tutor'); ?></h4>
111
+ <div class="tutor-quiz-builder-row">
112
+ <div class="tutor-quiz-builder-col">
113
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_two_gap_match]" value="">
 
114
  </div>
115
  </div>
116
+ <p class="help"><?php _e( 'Separate multiple answer by pipe <b>( | )</b> , 1 answer per variable assigned in question', 'tutor' ); ?></p>
117
+ </div> <!-- /.tutor-quiz-builder-group -->
118
+
119
 
120
  <?php
121
+ }elseif ($question_type === 'answer_sorting'){ ?>
122
+
123
+ <div class="tutor-quiz-builder-group">
124
+ <h4><?php _e('Answer title', 'tutor'); ?></h4>
125
+ <div class="tutor-quiz-builder-row">
126
+ <div class="tutor-quiz-builder-col">
127
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
128
  </div>
129
  </div>
130
+ </div> <!-- /.tutor-quiz-builder-group -->
131
 
132
+ <div class="tutor-quiz-builder-group">
133
+ <h4><?php _e('Matched Answer title', 'tutor'); ?></h4>
134
+ <div class="tutor-quiz-builder-row">
135
+ <div class="tutor-quiz-builder-col">
136
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][matched_answer_title]" value="">
137
  </div>
138
  </div>
139
+ <p class="help"></p>
140
+ </div> <!-- /.tutor-quiz-builder-group -->
141
 
142
  <?php
143
  }elseif($question_type === 'matching'){
144
  ?>
145
 
146
+ <div class="tutor-quiz-builder-group">
147
+ <h4><?php _e('Answer title', 'tutor'); ?></h4>
148
+ <div class="tutor-quiz-builder-row">
149
+ <div class="tutor-quiz-builder-col">
150
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
151
  </div>
152
  </div>
153
+ <p class="help"></p>
154
+ </div> <!-- /.tutor-quiz-builder-group -->
155
+ <div class="tutor-quiz-builder-group">
156
+ <h4><?php _e('Matched Answer title', 'tutor'); ?></h4>
157
+ <div class="tutor-quiz-builder-row">
158
+ <div class="tutor-quiz-builder-col">
159
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][matched_answer_title]" value="">
160
  </div>
161
  </div>
162
+ <p class="help"></p>
163
+ </div> <!-- /.tutor-quiz-builder-group -->
164
 
165
+ <div class="tutor-quiz-builder-group">
166
+ <h4><?php _e('Upload Image', 'tutor'); ?></h4>
167
+ <div class="tutor-quiz-builder-row">
168
+ <div class="tutor-quiz-builder-col">
169
+ <div class="tutor-media-upload-wrap">
170
+ <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="">
171
+ <div class="tutor-media-preview">
172
+ <a href="javascript:;" class="tutor-media-upload-btn"><i class="tutor-icon-image1"></i></a>
173
+ </div>
174
+ <div class="tutor-media-upload-trash-wrap">
175
+ <a href="javascript:;" class="tutor-media-upload-trash">&times;</a>
176
+ </div>
177
  </div>
178
  </div>
179
  </div>
180
+ </div> <!-- /.tutor-quiz-builder-group -->
181
+ <div class="tutor-quiz-builder-group">
182
+ <h4><?php _e('Answer option view format', 'tutor'); ?></h4>
183
+ <div class="tutor-quiz-builder-row">
184
+ <div class="tutor-quiz-builder-col auto-width">
185
+ <label>
186
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" checked="checked">
187
+ <?php _e('Only text', 'tutor'); ?>
188
+ </label>
189
+ </div>
190
+ <div class="tutor-quiz-builder-col auto-width">
191
+ <label>
192
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image">
193
+ <?php _e('Only Image', 'tutor'); ?>
194
+ </label>
195
+ </div>
196
+ <div class="tutor-quiz-builder-col auto-width">
197
+ <label>
198
+ <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image">
199
+ <?php _e('Text &amp; Image both', 'tutor'); ?>
200
+ </label>
201
  </div>
202
  </div>
203
+ <p class="help"></p>
204
+ </div> <!-- /.tutor-quiz-builder-group -->
205
 
206
  <?php
207
+ }elseif ($question_type === 'image_matching'){ ?>
208
+
209
+ <div class="tutor-quiz-builder-group">
210
+ <h4><?php _e('Upload Image', 'tutor'); ?></h4>
211
+ <div class="tutor-quiz-builder-row">
212
+ <div class="tutor-quiz-builder-col">
213
  <div class="tutor-media-upload-wrap">
214
  <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="">
215
  <div class="tutor-media-preview">
221
  </div>
222
  </div>
223
  </div>
224
+ </div> <!-- /.tutor-quiz-builder-group -->
225
+ <div class="tutor-quiz-builder-group">
226
+ <h4><?php _e('Image matched text', 'tutor'); ?></h4>
227
+ <div class="tutor-quiz-builder-row">
228
+ <div class="tutor-quiz-builder-col">
229
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
230
  </div>
231
  </div>
232
+ </div> <!-- /.tutor-quiz-builder-group -->
233
 
 
234
 
235
  <?php
236
+ }elseif($question_type === 'image_answering'){ ?>
237
+
238
+ <div class="tutor-quiz-builder-group">
239
+ <h4><?php _e('Upload Image', 'tutor'); ?></h4>
240
+ <div class="tutor-quiz-builder-row">
241
+ <div class="tutor-quiz-builder-col">
242
  <div class="tutor-media-upload-wrap">
243
  <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="">
244
  <div class="tutor-media-preview">
250
  </div>
251
  </div>
252
  </div>
253
+ <p class="help"></p>
254
+ </div> <!-- /.tutor-quiz-builder-group -->
255
+ <div class="tutor-quiz-builder-group">
256
+ <h4><?php _e('Answer input value', 'tutor'); ?></h4>
257
+ <div class="tutor-quiz-builder-row">
258
+ <div class="tutor-quiz-builder-col">
259
  <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="">
 
260
  </div>
261
  </div>
262
+ <p class="help"><?php _e('Student input text should be matched with this answer, write in <b>Small Caps</b>','tutor'); ?></p>
263
+ </div> <!-- /.tutor-quiz-builder-group -->
264
 
 
265
  <?php
266
  }
267
  ?>
views/modal/question_form.php CHANGED
@@ -37,61 +37,31 @@ $settings = maybe_unserialize($question->question_settings);
37
  <input type="hidden" class="tutor_select_value_holder" name="tutor_quiz_question[<?php echo $question_id; ?>][question_type]" value="" >
38
  </div>
39
 
40
- <?php $question_types = tutor_utils()->get_question_types();
41
 
42
 
43
- ?>
44
 
45
  <div class="tutor-select-options" style="display: none;">
46
- <?php
47
- $has_tutor_pro = tutor()->has_pro;
48
 
49
- foreach ($question_types as $type => $question_type){
50
- ?>
51
  <p class="tutor-select-option" data-value="<?php echo $type; ?>" <?php echo $question->question_type===$type ? ' data-selected="selected"' : ''; ?> data-is-pro="<?php echo (! $has_tutor_pro && $question_type['is_pro']) ? 'true' : 'false' ?>" >
52
- <?php echo $question_type['icon'].' '.$question_type['name']; ?>
53
-
54
- <?php
55
- if (! $has_tutor_pro && $question_type['is_pro']){
56
- echo '<span class="question-type-pro">PRO</span>';
57
- }
58
- ?>
 
59
  </p>
60
- <?php
61
- }
62
- ?>
63
- <!--<p class="tutor-select-option" data-value="true_false" <?php /*echo $question->question_type === 'true_false' ? ' data-selected="selected"' : ''; */?> >
64
- <i class="tutor-icon-block tutor-icon-yes-no"></i> <?php /*_e('True False'); */?>
65
- </p>-->
66
-
67
 
68
- <!--<p class="tutor-select-option" data-value="single_choice" <?php /*echo $question->question_type === 'single_choice' ? ' data-selected="selected"' : ''; */?>>
69
- <i class="tutor-icon-block tutor-icon-mark"></i> <?php /*_e('Single Choice'); */?>
70
- </p>
71
- <p class="tutor-select-option" data-value="multiple_choice" <?php /*echo $question->question_type === 'multiple_choice' ? ' data-selected="selected"' : ''; */?>>
72
- <i class="tutor-icon-block tutor-icon-multiple-choice"></i> <?php /*_e('Multiple Choice', 'tutor'); */?>
73
- </p>
74
- <p class="tutor-select-option" data-value="open_ended" <?php /*echo $question->question_type === 'open_ended' ? ' data-selected="selected"' : ''; */?>>
75
- <i class="tutor-icon-block tutor-icon-open-ended"></i> <?php /*_e('Open Ended/Essay', 'tutor'); */?>
76
- </p>
77
- <p class="tutor-select-option" data-value="short_answer" <?php /*echo $question->question_type === 'short_answer' ? ' data-selected="selected"' : ''; */?>>
78
- <i class="tutor-icon-block tutor-icon-short-ans"></i> <?php /*_e('Short Answer', 'tutor'); */?>
79
- </p>
80
- <p class="tutor-select-option" data-value="fill_in_the_blank" <?php /*echo $question->question_type === 'fill_in_the_blank' ? ' data-selected="selected"' : ''; */?>>
81
- <i class="tutor-icon-block tutor-icon-fill-gaps"></i> <?php /*_e('Fill In The Gaps'); */?>
82
- </p>
83
- <p class="tutor-select-option" data-value="matching" <?php /*echo $question->question_type === 'matching' ? ' data-selected="selected"' : ''; */?>>
84
- <i class="tutor-icon-block tutor-icon-matching"></i> <?php /*_e('Matching', 'tutor'); */?>
85
- </p>
86
- <p class="tutor-select-option" data-value="image_matching" <?php /*echo $question->question_type === 'image_matching' ? ' data-selected="selected"' : ''; */?>>
87
- <i class="tutor-icon-block tutor-icon-image-matching"></i> <?php /*_e('Image Matching', 'tutor'); */?>
88
- </p>
89
- <p class="tutor-select-option" data-value="image_answering" <?php /*echo $question->question_type === 'image_answering' ? ' data-selected="selected"' : ''; */?>>
90
- <i class="tutor-icon-block tutor-icon-image-ans"></i> <?php /*_e('Image Answering', 'tutor'); */?>
91
- </p>
92
- <p class="tutor-select-option" data-value="ordering" <?php /*echo $question->question_type === 'ordering' ? ' data-selected="selected"' : ''; */?>>
93
- <i class="tutor-icon-block tutor-icon-ordering"></i> <?php /*_e('Ordering', 'tutor'); */?>
94
- </p>-->
95
  </div>
96
  </div>
97
  </div>
@@ -122,7 +92,7 @@ $settings = maybe_unserialize($question->question_settings);
122
  <div class="tutor-quiz-builder-row">
123
  <div class="tutor-quiz-builder-col">
124
  <input type="text" name="tutor_quiz_question[<?php echo $question_id; ?>][question_mark]" placeholder="<?php _e('set the mark ex. 10', 'tutor'); ?>" value="<?php
125
- echo $question->question_mark; ?>">
126
  </div>
127
  </div>
128
  </div>
@@ -150,65 +120,67 @@ $settings = maybe_unserialize($question->question_settings);
150
 
151
  <div class="tutor-quiz-builder-group">
152
  <h4>
153
- <?php
154
- switch ($question->question_type){
155
- case 'true_false':
156
- echo __('Answer options &amp; mark correct', 'tutor');
157
- break;
158
- case 'ordering':
159
- echo __('Student should order below items exact this order, make sure your answer is in right order, you can re-order them', 'tutor');
160
- break;
161
- }
162
- ?>
163
  </h4>
164
  <div class="tutor-quiz-builder-row">
165
  <div class="tutor-quiz-builder-col">
166
  <div id="tuotr_question_options_for_quiz" class="quiz-modal-field-wrap">
167
  <div id="tutor_quiz_question_answers" data-question-id="<?php echo $question_id; ?>">
168
- <?php
169
 
170
- $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 ;");
171
- if (is_array($answers) && count($answers)){
172
- foreach ($answers as $answer){
173
- ?>
174
  <div class="tutor-quiz-answer-wrap" data-answer-id="<?php echo $answer->answer_id; ?>">
175
  <div class="tutor-quiz-answer">
176
  <span class="tutor-quiz-answer-title">
177
  <?php
178
  echo $answer->answer_title;
179
  if ($answer->belongs_question_type === 'fill_in_the_blank'){
180
- echo ' ('.__('Answer', 'tutor').' : ';
181
- echo "<strong>{$answer->answer_two_gap_match} </strong>)";
182
  }
183
  if ($answer->belongs_question_type === 'matching'){
184
- echo " - {$answer->answer_two_gap_match}";
185
  }
186
  ?>
187
  </span>
188
 
189
- <?php
190
- if ($answer->image_id){
191
- echo '<span class="tutor-question-answer-image"><img src="'.wp_get_attachment_image_url($answer->image_id).'" /> </span>';
192
- }
193
- if ($question->question_type === 'true_false' || $question->question_type === 'single_choice'){
194
- ?>
195
  <span class="tutor-quiz-answers-mark-correct-wrap">
196
  <input type="radio" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]"
197
  value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> >
198
  </span>
199
- <?php
200
- }elseif ($question->question_type === 'multiple_choice'){
201
- ?>
202
  <span class="tutor-quiz-answers-mark-correct-wrap">
203
  <input type="checkbox" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]"
204
  value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> >
205
  </span>
206
- <?php
207
- }
208
- ?>
209
  <span class="tutor-quiz-answer-edit">
210
- <a href="javascript:;"><i class="tutor-icon-pencil"></i> </a>
211
- </span>
 
 
212
  <span class="tutor-quiz-answer-sort-icon"><i class="tutor-icon-menu-2"></i> </span>
213
  </div>
214
 
@@ -216,10 +188,10 @@ $settings = maybe_unserialize($question->question_settings);
216
  <a href="javascript:;" class="answer-trash-btn" data-answer-id="<?php echo $answer->answer_id; ?>"><i class="tutor-icon-garbage"></i> </a>
217
  </div>
218
  </div>
219
- <?php
220
- }
221
- }
222
- ?>
223
  </div>
224
 
225
 
@@ -228,7 +200,7 @@ $settings = maybe_unserialize($question->question_settings);
228
 
229
  <a href="javascript:;" class="add_question_answers_option" data-question-id="<?php echo $question_id; ?>">
230
  <i class="tutor-icon-block tutor-icon-plus"></i>
231
- <?php _e('Add An Option', 'tutor'); ?>
232
  </a>
233
  </div>
234
  </div>
@@ -238,23 +210,23 @@ $settings = maybe_unserialize($question->question_settings);
238
  </div>
239
 
240
 
241
- </div>
242
-
243
  </div>
244
 
 
245
 
246
 
247
 
248
 
249
- <div class="tutor-quiz-builder-modal-control-btn-group question_form_inner">
250
- <div class="quiz-builder-btn-group-left">
251
- <a href="javascript:;" class="quiz-modal-tab-navigation-btn quiz-modal-question-save-btn"><?php _e('Save &amp; Continue', 'tutor');
252
- ?></a>
253
- </div>
254
- <div class="quiz-builder-btn-group-right">
255
- <a href="javascript:;" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a>
256
- </div>
257
  </div>
 
258
 
259
 
260
 
37
  <input type="hidden" class="tutor_select_value_holder" name="tutor_quiz_question[<?php echo $question_id; ?>][question_type]" value="" >
38
  </div>
39
 
40
+ <?php $question_types = tutor_utils()->get_question_types();
41
 
42
 
43
+ ?>
44
 
45
  <div class="tutor-select-options" style="display: none;">
46
+ <?php
47
+ $has_tutor_pro = tutor()->has_pro;
48
 
49
+ foreach ($question_types as $type => $question_type){
50
+ ?>
51
  <p class="tutor-select-option" data-value="<?php echo $type; ?>" <?php echo $question->question_type===$type ? ' data-selected="selected"' : ''; ?> data-is-pro="<?php echo (! $has_tutor_pro && $question_type['is_pro']) ? 'true' : 'false' ?>" >
52
+ <?php echo $question_type['icon'].' '.$question_type['name']; ?>
53
+
54
+ <?php
55
+ if (! $has_tutor_pro && $question_type['is_pro']){
56
+ $svg_lock = '<svg width="12" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M11.667 6h-1V4.667A4.672 4.672 0 0 0 6 0a4.672 4.672 0 0 0-4.667 4.667V6h-1A.333.333 0 0 0 0 6.333v8.334C0 15.402.598 16 1.333 16h9.334c.735 0 1.333-.598 1.333-1.333V6.333A.333.333 0 0 0 11.667 6zm-4.669 6.963a.334.334 0 0 1-.331.37H5.333a.333.333 0 0 1-.331-.37l.21-1.89A1.319 1.319 0 0 1 4.667 10c0-.735.598-1.333 1.333-1.333S7.333 9.265 7.333 10c0 .431-.204.824-.545 1.072l.21 1.891zM8.667 6H3.333V4.667A2.67 2.67 0 0 1 6 2a2.67 2.67 0 0 1 2.667 2.667V6z" fill="#E2E2E2" fill-rule="nonzero"/></svg>';
57
+ printf("<span class='question-type-pro' title='%s'>%s</span>",__('Pro version required', 'tutor'), $svg_lock );
58
+ }
59
+ ?>
60
  </p>
61
+ <?php
62
+ }
63
+ ?>
 
 
 
 
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  </div>
66
  </div>
67
  </div>
92
  <div class="tutor-quiz-builder-row">
93
  <div class="tutor-quiz-builder-col">
94
  <input type="text" name="tutor_quiz_question[<?php echo $question_id; ?>][question_mark]" placeholder="<?php _e('set the mark ex. 10', 'tutor'); ?>" value="<?php
95
+ echo $question->question_mark; ?>">
96
  </div>
97
  </div>
98
  </div>
120
 
121
  <div class="tutor-quiz-builder-group">
122
  <h4>
123
+ <?php
124
+ switch ($question->question_type){
125
+ case 'true_false':
126
+ echo __('Answer options &amp; mark correct', 'tutor');
127
+ break;
128
+ case 'ordering':
129
+ echo __('Student should order below items exact this order, make sure your answer is in right order, you can re-order them', 'tutor');
130
+ break;
131
+ }
132
+ ?>
133
  </h4>
134
  <div class="tutor-quiz-builder-row">
135
  <div class="tutor-quiz-builder-col">
136
  <div id="tuotr_question_options_for_quiz" class="quiz-modal-field-wrap">
137
  <div id="tutor_quiz_question_answers" data-question-id="<?php echo $question_id; ?>">
138
+ <?php
139
 
140
+ $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 ;");
141
+ if (is_array($answers) && count($answers)){
142
+ foreach ($answers as $answer){
143
+ ?>
144
  <div class="tutor-quiz-answer-wrap" data-answer-id="<?php echo $answer->answer_id; ?>">
145
  <div class="tutor-quiz-answer">
146
  <span class="tutor-quiz-answer-title">
147
  <?php
148
  echo $answer->answer_title;
149
  if ($answer->belongs_question_type === 'fill_in_the_blank'){
150
+ echo ' ('.__('Answer', 'tutor').' : ';
151
+ echo "<strong>{$answer->answer_two_gap_match} </strong>)";
152
  }
153
  if ($answer->belongs_question_type === 'matching'){
154
+ echo " - {$answer->answer_two_gap_match}";
155
  }
156
  ?>
157
  </span>
158
 
159
+ <?php
160
+ if ($answer->image_id){
161
+ echo '<span class="tutor-question-answer-image"><img src="'.wp_get_attachment_image_url($answer->image_id).'" /> </span>';
162
+ }
163
+ if ($question->question_type === 'true_false' || $question->question_type === 'single_choice'){
164
+ ?>
165
  <span class="tutor-quiz-answers-mark-correct-wrap">
166
  <input type="radio" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]"
167
  value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> >
168
  </span>
169
+ <?php
170
+ }elseif ($question->question_type === 'multiple_choice'){
171
+ ?>
172
  <span class="tutor-quiz-answers-mark-correct-wrap">
173
  <input type="checkbox" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]"
174
  value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> >
175
  </span>
176
+ <?php
177
+ }
178
+ ?>
179
  <span class="tutor-quiz-answer-edit">
180
+ <?php if ( $question->question_type !== 'true_false' ){ ?>
181
+ <a href="javascript:;"><i class="tutor-icon-pencil"></i> </a>
182
+ <?php } ?>
183
+ </span>
184
  <span class="tutor-quiz-answer-sort-icon"><i class="tutor-icon-menu-2"></i> </span>
185
  </div>
186
 
188
  <a href="javascript:;" class="answer-trash-btn" data-answer-id="<?php echo $answer->answer_id; ?>"><i class="tutor-icon-garbage"></i> </a>
189
  </div>
190
  </div>
191
+ <?php
192
+ }
193
+ }
194
+ ?>
195
  </div>
196
 
197
 
200
 
201
  <a href="javascript:;" class="add_question_answers_option" data-question-id="<?php echo $question_id; ?>">
202
  <i class="tutor-icon-block tutor-icon-plus"></i>
203
+ <?php _e('Add An Option', 'tutor'); ?>
204
  </a>
205
  </div>
206
  </div>
210
  </div>
211
 
212
 
 
 
213
  </div>
214
 
215
+ </div>
216
 
217
 
218
 
219
 
220
+
221
+ <div class="tutor-quiz-builder-modal-control-btn-group question_form_inner">
222
+ <div class="quiz-builder-btn-group-left">
223
+ <a href="javascript:;" class="quiz-modal-tab-navigation-btn quiz-modal-question-save-btn"><?php _e('Save &amp; Continue', 'tutor');
224
+ ?></a>
225
+ </div>
226
+ <div class="quiz-builder-btn-group-right">
227
+ <a href="javascript:;" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a>
228
  </div>
229
+ </div>
230
 
231
 
232