|
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; |
@@ -1388,4 +1389,65 @@ public function render_single_content( WP_Post $quiz ): void { |
1388 | 1389 | ) |
1389 | 1390 | ); |
1390 | 1391 | } |
| 1392 | + |
| 1393 | + /** |
| 1394 | + * Render quiz summary |
| 1395 | + * |
| 1396 | + * @since 4.0.0 |
| 1397 | + * |
| 1398 | + * @param int $total_questions Total questions. |
| 1399 | + * @param string $quiz_item_readable Readable time. |
| 1400 | + * @param string $passing_grade Passing grade. |
| 1401 | + * |
| 1402 | + * @return void |
| 1403 | + */ |
| 1404 | + public static function render_quiz_summary( $total_questions, $quiz_item_readable, $passing_grade ) { |
| 1405 | + $quiz_summary = array( |
| 1406 | + array( |
| 1407 | + 'columns' => array( |
| 1408 | + array( |
| 1409 | + 'content' => '<div class="tutor-flex tutor-gap-3 tutor-items-center"> |
| 1410 | + ' . tutor_utils()->get_svg_icon( Icon::QUESTION_CIRCLE ) . __( 'Questions', 'tutor' ) . ' |
| 1411 | + </div>', |
| 1412 | + ), |
| 1413 | + array( 'content' => $total_questions ), |
| 1414 | + ), |
| 1415 | + ), |
| 1416 | + array( |
| 1417 | + 'columns' => array( |
| 1418 | + array( |
| 1419 | + 'content' => '<div class="tutor-flex tutor-gap-3 tutor-items-center"> |
| 1420 | + ' . tutor_utils()->get_svg_icon( Icon::CLOCK ) . __( 'Quiz Time', 'tutor' ) . ' |
| 1421 | + </div>', |
| 1422 | + ), |
| 1423 | + array( 'content' => $quiz_item_readable ), |
| 1424 | + ), |
| 1425 | + ), |
| 1426 | + array( |
| 1427 | + 'columns' => array( |
| 1428 | + array( |
| 1429 | + 'content' => '<div class="tutor-flex tutor-gap-3 tutor-items-center"> |
| 1430 | + ' . tutor_utils()->get_svg_icon( Icon::PASSED ) . __( 'Passing Marks', 'tutor' ) . ' |
| 1431 | + </div>', |
| 1432 | + ), |
| 1433 | + array( 'content' => $passing_grade ), |
| 1434 | + ), |
| 1435 | + ), |
| 1436 | + ); |
| 1437 | + |
| 1438 | + Table::make()->contents( $quiz_summary )->render(); |
| 1439 | + } |
| 1440 | + |
| 1441 | + /** |
| 1442 | + * Render quiz attempts |
| 1443 | + * |
| 1444 | + * @since 4.0.0 |
| 1445 | + * |
| 1446 | + * @param int $quiz_id Quiz ID. |
| 1447 | + * |
| 1448 | + * @return void |
| 1449 | + */ |
| 1450 | + public static function render_quiz_attempts( $quiz_id ) { |
| 1451 | + // @TODO. |
| 1452 | + } |
1391 | 1453 | } |
0 commit comments