|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 |
|
| 17 | +use Tutor\Components\Table; |
17 | 18 | use Tutor\Helpers\HttpHelper; |
18 | 19 | use Tutor\Helpers\QueryHelper; |
19 | 20 | use Tutor\Models\CourseModel; |
@@ -1451,4 +1452,65 @@ public function render_single_content( WP_Post $quiz ): void { |
1451 | 1452 | ) |
1452 | 1453 | ); |
1453 | 1454 | } |
| 1455 | + |
| 1456 | + /** |
| 1457 | + * Render quiz summary |
| 1458 | + * |
| 1459 | + * @since 4.0.0 |
| 1460 | + * |
| 1461 | + * @param int $total_questions Total questions. |
| 1462 | + * @param string $quiz_item_readable Readable time. |
| 1463 | + * @param string $passing_grade Passing grade. |
| 1464 | + * |
| 1465 | + * @return void |
| 1466 | + */ |
| 1467 | + public static function render_quiz_summary( $total_questions, $quiz_item_readable, $passing_grade ) { |
| 1468 | + $quiz_summary = array( |
| 1469 | + array( |
| 1470 | + 'columns' => array( |
| 1471 | + array( |
| 1472 | + 'content' => '<div class="tutor-flex tutor-gap-3 tutor-items-center"> |
| 1473 | + ' . tutor_utils()->get_svg_icon( Icon::QUESTION_CIRCLE ) . __( 'Questions', 'tutor' ) . ' |
| 1474 | + </div>', |
| 1475 | + ), |
| 1476 | + array( 'content' => $total_questions ), |
| 1477 | + ), |
| 1478 | + ), |
| 1479 | + array( |
| 1480 | + 'columns' => array( |
| 1481 | + array( |
| 1482 | + 'content' => '<div class="tutor-flex tutor-gap-3 tutor-items-center"> |
| 1483 | + ' . tutor_utils()->get_svg_icon( Icon::CLOCK ) . __( 'Quiz Time', 'tutor' ) . ' |
| 1484 | + </div>', |
| 1485 | + ), |
| 1486 | + array( 'content' => $quiz_item_readable ), |
| 1487 | + ), |
| 1488 | + ), |
| 1489 | + array( |
| 1490 | + 'columns' => array( |
| 1491 | + array( |
| 1492 | + 'content' => '<div class="tutor-flex tutor-gap-3 tutor-items-center"> |
| 1493 | + ' . tutor_utils()->get_svg_icon( Icon::PASSED ) . __( 'Passing Marks', 'tutor' ) . ' |
| 1494 | + </div>', |
| 1495 | + ), |
| 1496 | + array( 'content' => $passing_grade ), |
| 1497 | + ), |
| 1498 | + ), |
| 1499 | + ); |
| 1500 | + |
| 1501 | + Table::make()->contents( $quiz_summary )->render(); |
| 1502 | + } |
| 1503 | + |
| 1504 | + /** |
| 1505 | + * Render quiz attempts |
| 1506 | + * |
| 1507 | + * @since 4.0.0 |
| 1508 | + * |
| 1509 | + * @param int $quiz_id Quiz ID. |
| 1510 | + * |
| 1511 | + * @return void |
| 1512 | + */ |
| 1513 | + public static function render_quiz_attempts( $quiz_id ) { |
| 1514 | + // @TODO. |
| 1515 | + } |
1454 | 1516 | } |
0 commit comments