| @@ -1,12 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Admin View: Question assigned Meta box |
| 4 | + * | |
| 5 | + * @version 1.0.1 | |
| 4 | 6 | */ |
| 5 | 7 | |
| 6 | -/** | |
| 7 | - * Prevent loading this file directly | |
| 8 | - */ | |
| 8 | +use LearnPress\Models\CourseModel; | |
| 9 | + | |
| 9 | 10 | defined( 'ABSPATH' ) || exit(); |
| 10 | 11 | |
| 11 | 12 | global $post; |
| 12 | 13 | $curd = new LP_Question_CURD(); |
| @@ -18,9 +19,15 @@ | ||
| 18 | 19 | <?php $courses = learn_press_get_item_courses( $quiz->ID ); ?> |
| 19 | 20 | |
| 20 | 21 | <?php if ( $courses ) : ?> |
| 21 | 22 | <ul class="parent-courses"> |
| 22 | - <?php foreach ( $courses as $course ) : ?> | |
| 23 | + <?php | |
| 24 | + foreach ( $courses as $course ) : | |
| 25 | + $courseModel = CourseModel::find( $course->ID, true ); | |
| 26 | + if ( ! $courseModel ) { | |
| 27 | + continue; | |
| 28 | + } | |
| 29 | + ?> | |
| 23 | 30 | <li> |
| 24 | 31 | <strong> |
| 25 | 32 | <a href="<?php echo get_edit_post_link( $course->ID ); ?>" target="_blank"><?php echo get_the_title( $course->ID ); ?></a> |
| 26 | 33 | </strong> |
| @@ -33,9 +40,9 @@ | ||
| 33 | 40 | — — |
| 34 | 41 | <?php echo get_the_title( $quiz->ID ); ?></a> |
| 35 | 42 | </strong> |
| 36 | 43 | — |
| 37 | - <a href="<?php echo learn_press_get_course_item_permalink( $course->ID, $quiz->ID ); ?>" target="_blank"><?php esc_html_e( 'View', 'learnpress' ); ?></a> | |
| 44 | + <a href="<?php echo $courseModel->get_item_link( $quiz->ID ); ?>" target="_blank"><?php esc_html_e( 'View', 'learnpress' ); ?></a> | |
| 38 | 45 | </li> |
| 39 | 46 | </ul> |
| 40 | 47 | </li> |
| 41 | 48 | <?php endforeach; ?> |