includes/eduapi-helper-functions.php
public function GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city ) {
		return EDU()->get_transient( 'eduadmin-object', function() use ( $course_id, $fetch_months, $group_by_city ) {
			$expands = array();
			$selects = array();

			$selects[] = 'CourseTemplateId';
			$selects[] = 'CourseName';
			$selects[] = 'InternalCourseName';
			$selects[] = 'ImageUrl';
			$selects[] = 'CourseDescription';
			$selects[] = 'CourseDescriptionShort';
			$selects[] = 'CourseGoal';
			$selects[] = 'TargetGroup';
			$selects[] = 'Prerequisites';
			$selects[] = 'CourseAfter';
			$selects[] = 'Quote';
			$selects[] = 'Days';
			$selects[] = 'StartTime';
			$selects[] = 'EndTime';
			$selects[] = 'RequireCivicRegistrationNumber';

			$expands['Subjects']   = '$select=SubjectName;';
			$expands['Categories'] = '$select=CategoryName;';
			$expands['PriceNames'] = '$filter=PublicPriceName;';
			$expands['Events']     =
				'$filter=' .
				'HasPublicPriceName' .
				' and StatusId eq 1' .
				' and CustomerId eq null' .
				' and CompanySpecific eq false' .
				' and LastApplicationDate ge ' . date( 'c', strtotime('now 23:59:59') ) .
				' and StartDate le ' . date( 'c', strtotime( 'now 23:59:59 +' . $fetch_months . ' months' ) ) .
				' and EndDate ge ' . date( 'c', strtotime( 'now' ) ) .
				';' .
				'$expand=PriceNames($filter=PublicPriceName;$select=PriceNameId,PriceNameDescription,Price,MaxParticipantNumber,NumberOfParticipants,DiscountPercent;),EventDates($orderby=StartDate;$select=StartDate,EndDate;),Sessions($expand=PriceNames($filter=PublicPriceName;);$filter=HasPublicPriceName;),PaymentMethods' .
				';' .
				'$orderby=StartDate asc' . ( $group_by_city ? ', City asc' : '' ) .
				';' .
				'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,LocationId';

			$expands['CustomFields'] = '$filter=ShowOnWeb;$select=CustomFieldId,CustomFieldName,CustomFieldType,CustomFieldValue,CustomFieldChecked,CustomFieldDate,CustomFieldAlternativeId,CustomFieldAlternativeValue;';

			$expand_arr = array();
			foreach ( $expands as $key => $value ) {
				if ( empty( $value ) ) {
					$expand_arr[] = $key;
				} else {
					$expand_arr[] = $key . '(' . $value . ')';
				}
			}

			return wp_json_encode( EDUAPI()->OData->CourseTemplates->GetItem(
				$course_id,
				join( ',', $selects ),
				join( ',', $expand_arr )
			) );
		}, 10, $course_id, $fetch_months, $group_by_city );
	}
public function GetCourseDetailInfo( $course_id, $fetch_months, $group_by_city ) {
		return EDU()->get_transient( 'eduadmin-object', function() use ( $course_id, $fetch_months, $group_by_city ) {
			$expands = array();
			$selects = array();

			$selects[] = 'CourseTemplateId';
			$selects[] = 'CourseName';
			$selects[] = 'InternalCourseName';
			$selects[] = 'ImageUrl';
			$selects[] = 'CourseDescription';
			$selects[] = 'CourseDescriptionShort';
			$selects[] = 'CourseGoal';
			$selects[] = 'TargetGroup';
			$selects[] = 'Prerequisites';
			$selects[] = 'CourseAfter';
			$selects[] = 'Quote';
			$selects[] = 'Days';
			$selects[] = 'StartTime';
			$selects[] = 'EndTime';
			$selects[] = 'RequireCivicRegistrationNumber';

			$expands['Subjects']   = '$select=SubjectName;';
			$expands['Categories'] = '$select=CategoryName;';
			$expands['PriceNames'] = '$filter=PublicPriceName;';
			$expands['Events']     =
				'$filter=' .
				'HasPublicPriceName' .
				' and StatusId eq 1' .
				' and CustomerId eq null' .
				' and CompanySpecific eq false' .
				' and LastApplicationDate ge ' . date( 'c', strtotime('now 23:59:59') ) .
				' and StartDate le ' . date( 'c', strtotime( 'now 23:59:59 +' . $fetch_months . ' months' ) ) .
				' and EndDate ge ' . date( 'c', strtotime( 'now' ) ) .
				';' .
				'$expand=PriceNames($filter=PublicPriceName;$select=PriceNameId,PriceNameDescription,Price,MaxParticipantNumber,NumberOfParticipants,DiscountPercent;),EventDates($orderby=StartDate;$select=StartDate,EndDate;),Sessions($expand=PriceNames($filter=PublicPriceName;);$filter=HasPublicPriceName;),PaymentMethods' .
				';' .
				'$orderby=StartDate asc' . ( $group_by_city ? ', City asc' : '' ) .
				';' .
				'$select=EventId,City,ParticipantNumberLeft,MaxParticipantNumber,StartDate,EndDate,AddressName,LocationId';

			$expands['CustomFields'] = '$filter=ShowOnWeb;$select=CustomFieldId,CustomFieldName,CustomFieldType,CustomFieldValue,CustomFieldChecked,CustomFieldDate,CustomFieldAlternativeId,CustomFieldAlternativeValue;';

			$expand_arr = array();
			foreach ( $expands as $key => $value ) {
				if ( empty( $value ) ) {
					$expand_arr[] = $key;
				} else {
					$expand_arr[] = $key . '(' . $value . ')';
				}
			}

			return wp_json_encode( EDUAPI()->OData->CourseTemplates->GetItem(
				$course_id,
				join( ',', $selects ),
				join( ',', $expand_arr )
			) );
		}, 10, $course_id, $fetch_months, $group_by_city );
	}
@param $course_id
@param $fetch_months
@param $group_by_city

@return string