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