Skip to content

Commit 075be39

Browse files
author
Chris Gårdenberg
committed
fix: Get OnDemand info if the coursetemplate is OnDemand
1 parent 7d12662 commit 075be39

4 files changed

Lines changed: 24 additions & 5 deletions

File tree

PLUGIN-CHECKSUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8ab46165d0e4146e8c403435d720151d
1+
eb2eb5520db5a002e3bced39960938df

content/template/detailTemplate/course-info.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
$name = ( ! empty( $selected_course['CourseName'] ) ? $selected_course['CourseName'] : $selected_course['InternalCourseName'] );
2424
}
2525

26+
$is_ondemand = $selected_course['OnDemand'];
27+
28+
if ( $is_ondemand ) {
29+
$selected_course = json_decode( EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city ), true );
30+
}
31+
2632
$surl = get_home_url();
2733
$cat = EDU()->get_option( 'eduadmin-rewriteBaseUrl' );
2834
$base_url = $surl . '/' . $cat;

includes/edu-ajax-functions.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,14 @@ function edu_api_eventlist() {
531531
$fetch_months = 6;
532532
}
533533

534-
$edo = EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city );
534+
$ondemand = $_POST['ondemand'];
535+
536+
if(!$ondemand) {
537+
$edo = EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city );
538+
} else {
539+
$edo = EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city );
540+
}
541+
535542

536543
$selected_course = false;
537544
$name = '';

includes/edu-shortcodes.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ function eduadmin_get_detailinfo( $attributes ) {
269269
'courseinquiryurl' => null,
270270
'order' => null,
271271
'orderby' => null,
272+
'ondemand' => false,
272273
//'coursesubject' => null
273274
),
274275
normalize_empty_atts( $attributes ),
@@ -312,7 +313,11 @@ function eduadmin_get_detailinfo( $attributes ) {
312313
$fetch_months = 6;
313314
}
314315

315-
$edo = EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city );
316+
if ( ! $attributes['ondemand'] ) {
317+
$edo = EDUAPIHelper()->GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city );
318+
} else {
319+
$edo = EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city );
320+
}
316321

317322
$selected_course = false;
318323

@@ -440,7 +445,7 @@ function eduadmin_get_detailinfo( $attributes ) {
440445
$prices = array();
441446

442447
foreach ( $selected_course['PriceNames'] as $pn ) {
443-
$prices[ (string)$pn['PriceNameId'] ] = $pn;
448+
$prices[ (string) $pn['PriceNameId'] ] = $pn;
444449
}
445450

446451
if ( 1 === count( $prices ) ) {
@@ -458,7 +463,7 @@ function eduadmin_get_detailinfo( $attributes ) {
458463

459464
foreach ( $events as $e ) {
460465
foreach ( $e['PriceNames'] as $pn ) {
461-
$prices[ (string)$pn['PriceNameId'] ] = $pn;
466+
$prices[ (string) $pn['PriceNameId'] ] = $pn;
462467
}
463468
}
464469

@@ -576,6 +581,7 @@ function eduadmin_get_detailinfo( $attributes ) {
576581
$ret_str .= ' data-orderby="' . esc_attr( $custom_order_by_order ) . '"';
577582
$ret_str .= ' data-showvenue="' . esc_attr( EDU()->is_checked( 'eduadmin-showEventVenueName', false ) ) . '"';
578583
$ret_str .= ' data-eventinquiry="' . esc_attr( EDU()->is_checked( 'eduadmin-allowInterestRegEvent', false ) ) . '"';
584+
$ret_str .= ' data-ondemand="' . esc_attr( $attributes['ondemand'] ) . '"';
579585
$ret_str .= '>';
580586

581587
$i = 0;

0 commit comments

Comments
 (0)