| @@ -8,8 +8,9 @@ | ||
| 8 | 8 | * @version 1.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | use LearnPress\Models\CourseModel; |
| 12 | +use LearnPress\Models\CourseSectionItemModel; | |
| 12 | 13 | use LearnPress\Models\UserModel; |
| 13 | 14 | use LearnPress\TemplateHooks\UserTemplate; |
| 14 | 15 | |
| 15 | 16 | defined( 'ABSPATH' ) || exit(); |
| @@ -519,9 +520,9 @@ | ||
| 519 | 520 | |
| 520 | 521 | public function get_post_type() { |
| 521 | 522 | $post_type = get_post_type(); |
| 522 | 523 | if ( ! $post_type ) { |
| 523 | - $post_type = LP_Request::get_string( 'post_type' ); | |
| 524 | + $post_type = LP_Request::get_param( 'post_type' ); | |
| 524 | 525 | } |
| 525 | 526 | |
| 526 | 527 | return $post_type; |
| 527 | 528 | } |
| @@ -991,17 +992,20 @@ | ||
| 991 | 992 | * Get course that the items is contained. |
| 992 | 993 | * |
| 993 | 994 | * @param $post_id |
| 994 | 995 | */ |
| 995 | - protected function _get_item_course( $post_id ) { | |
| 996 | - $courses = learn_press_get_item_courses( $post_id ); | |
| 996 | + protected function get_courses_of_item( $post_id ) { | |
| 997 | + $courses = CourseSectionItemModel::get_courses_from_item_id( | |
| 998 | + $post_id, get_post_type( $post_id ) | |
| 999 | + ); | |
| 997 | 1000 | if ( $courses ) { |
| 998 | 1001 | foreach ( $courses as $course ) { |
| 999 | - echo '<div><a href="' . esc_url_raw( remove_query_arg( 'orderby', add_query_arg( array( 'course' => $course->ID ) ) ) ) . '">' . get_the_title( $course->ID ) . '</a>'; | |
| 1002 | + $course_id = $course->section_course_id; | |
| 1003 | + echo '<div><a href="' . esc_url_raw( remove_query_arg( 'orderby', add_query_arg( array( 'course' => $course_id ) ) ) ) . '">' . get_the_title( $course_id ) . '</a>'; | |
| 1000 | 1004 | echo '<div class="row-actions">'; |
| 1001 | - printf( '<a href="%s">%s</a>', admin_url( sprintf( 'post.php?post=%d&action=edit', $course->ID ) ), __( 'Edit', 'learnpress' ) ); | |
| 1005 | + printf( '<a href="%s">%s</a>', admin_url( sprintf( 'post.php?post=%d&action=edit', $course_id ) ), __( 'Edit', 'learnpress' ) ); | |
| 1002 | 1006 | echo ' | '; |
| 1003 | - printf( '<a href="%s">%s</a>', get_the_permalink( $course->ID ), __( 'View', 'learnpress' ) ); | |
| 1007 | + printf( '<a href="%s">%s</a>', get_the_permalink( $course_id ), __( 'View', 'learnpress' ) ); | |
| 1004 | 1008 | |
| 1005 | 1009 | if ( $this->_filter_items_by_course() ) { |
| 1006 | 1010 | echo ' | '; |
| 1007 | 1011 | printf( |