<?php
namespace app\components;

use Yii;
use app\models\Resour_tree;

class ResourTreeHelper{

	//获取章节知识点
	public static function getChapterSectionlist($courseid){
		$chapters = Resour_tree::find()->where("courseid=". $courseid ." and parentid=0")->orderby("sortid asc,id asc")->all();
		foreach ($chapters as $onechapter) {
			$onechapter->sections = Resour_tree::find()->where("courseid=". $courseid ." and parentid=". $onechapter->id)->orderby("sortid asc,id asc")->all();
			foreach ($onechapter->sections as $onesection) {
				$onesection->knowledges = Resour_tree::find()->where("courseid=". $courseid ." and parentid=". $onesection->id)->orderby("sortid asc,id asc")->all();
			}
		}
		return $chapters;
	}
		
}
?>