<?php
/**
 * 学校类型
 * $Id$
 * @author huangliang
 * @package cn.compass.entity.definition
 */
class SchoolType
{
	public $id;
	public $title;
	
	function __construct($record) {
		$this->id = $record["id"];
		$this->title = $record["title"];
	}
	
	/**
	 * 
	 * @return array SchoolType
	 */
	public static function getList() {
		static $result;
			
		if ((!is_array($result)) || (count($result) < 1)) {
			
			$data = array();

			$tmp = array("id"=>1, "title"=>"幼儿");
			array_push($data, $tmp);
			
			$tmp = array("id"=>2, "title"=>"小初高");
			array_push($data, $tmp);
			
			$tmp = array("id"=>3, "title"=>"职高");
			array_push($data, $tmp);
			
			$result = array();
			foreach ($data as $row) {
				$tmp2 = new SchoolType($row);
				array_push($result, $tmp2);
			}
		}
		return $result;
	}
	
	/**
	 * 
	 * @return SchoolType 
	 */
	public static function getById($id) {
		$list = SchoolType::getList();
		foreach ($list as $tmp) {
			if ($tmp->id == $id) {
				return $tmp;
			}
		}
		return null;
	}
	
	/**
	 * 
	 * @return SchoolType 
	 */
	public static function getTitleById($id) {
		$list = SchoolType::getList();
		foreach ($list as $tmp) {
			if ($tmp->id == $id) {
				return $tmp->title;
			}
		}
		return null;
	}
	

}