<?php

// 根据课程id获取课程详细信息
require_once ("../user_include.inc");

ErrorLogger::doOutput("Compass...ajax_get_course_detail.php....Start.", 0);

//获取参数
$courseId = ParamUtil::getRequestNumber("courseId", 0);


//参数检查
if(empty($courseId)) {
	$result["message"] = "参数错误！";
	responseNG($result);
}

$result = array();

//每页显示条数
$courseMst = CourseMst::getById($courseId);
if(empty($courseMst)) {
	$result["message"] = "参数错误！";
	responseNG($result);
}

//获取对应的媒体列表
$param = array();
$param['course_id'] = $courseId;
$param['delete_flg'] = false;
$courseMediaList = CourseMediaDat::getList($param,'id','asc');

//接口返回数据
$result["teacherName"] = $courseMst->teacher_name;
$result["teacherProfile"] = $courseMst->teacher_profile;
$result["mediaCount"] = $courseMst->media_count;
$result["list"] = $courseMediaList;

ErrorLogger::doOutput("Compass...ajax_get_course_detail.php....End.", 0);


//返回结果
responseOK($result);

function responseNG($result) {
	$result = array("status"=>"NG", "result"=>$result);
	print json_encode($result);
	exit;
}
function responseOK($result) {
	$result = array("status"=>"OK", "result"=>$result);
	print json_encode($result);
	exit;
}
?>