<?php

// 获取分类
require_once ("../user_include.inc");

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

//根据常量获取定义的值
$parentCategorys = CourseParentCategory::getList();

$result = array();
//获取对应的二级分类
foreach($parentCategorys as $parentCategory) {
	//检索数据库
	$param['parent_id'] = $parentCategory->id;
	$param['delete_flg'] = false;
	$subCategoryList = CourseCategoryDat::getList($param,'id','desc');
	$parentCategory->subCategorys = $subCategoryList;
	$result[] = $parentCategory;
}


ErrorLogger::doOutput("Compass...ajax_get_course_category.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;
}
?>