<?php
namespace app\components;

use Yii;
use app\models\Specialty;

class SpecialtyHelper{

	//获取院系专业列表
	public static function getCollegelistall(){
		$colleges = Specialty::find()->select("id,parentid,name,sortid")->where("parentid=0")->orderby("spelling asc")->all();
		foreach($colleges as $onecollege){
			$onecollege->children = Specialty::find()->select("id,parentid,name,sortid")->where("parentid=". $onecollege->id)->orderby("spelling asc")->all();
			foreach($onecollege->children as $onedepart){
				$onedepart->children = Specialty::find()->select("id,parentid,name,sortid")->where("parentid=". $onedepart->id)->orderby("spelling asc")->all();
			}
		}
		return $colleges;
	}
		
}
?>