1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* 公益课堂一级分类
* $Id$
* @author huangliang
* @package cn.compass.entity.definition
*/
class CourseParentCategory
{
public $id;
public $title;
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;
}
}