<?php /** * 用户角色 * $Id$ * @author huangliang * @package cn.compass.entity.definition */ class CourseParentCategory { public $id; public $title; public $subCategorys; function __construct($record) { $this->id = $record["id"]; $this->title = $record["title"]; } /** * * @return array CourseParentCategory */ 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); $result = array(); foreach ($data as $row) { $tmp2 = new CourseParentCategory($row); array_push($result, $tmp2); } } return $result; } /** * * @return CourseParentCategory */ public static function getById($id) { $list = CourseParentCategory::getList(); foreach ($list as $tmp) { if ($tmp->id == $id) { return $tmp; } } return null; } /** * * @return CourseParentCategory */ public static function getTitleById($id) { $list = CourseParentCategory::getList(); foreach ($list as $tmp) { if ($tmp->id == $id) { return $tmp->title; } } return null; } }