<?php /** * 用户角色 * $Id$ * @author huangliang * @package cn.compass.entity.definition */ class AccountRole { public $id; public $title; function __construct($record) { $this->id = $record["id"]; $this->title = $record["title"]; } /** * * @return array AccountRole */ 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); $tmp = array("id"=>4, "title"=>"市局运营"); array_push($data, $tmp); $tmp = array("id"=>5, "title"=>"区县局管理员"); array_push($data, $tmp); $tmp = array("id"=>6, "title"=>"区县局运营"); array_push($data, $tmp); $tmp = array("id"=>7, "title"=>"学校管理员"); array_push($data, $tmp); $tmp = array("id"=>8, "title"=>"学校运营"); array_push($data, $tmp); $tmp = array("id"=>9, "title"=>"机构账户"); array_push($data, $tmp); $tmp = array("id"=>10, "title"=>"系统运营"); array_push($data, $tmp); $tmp = array("id"=>99, "title"=>"系统管理");//可创建各层级管理员账户 array_push($data, $tmp); $result = array(); foreach ($data as $row) { $tmp2 = new AccountRole($row); array_push($result, $tmp2); } } return $result; } /** * * @return AccountRole */ public static function getById($id) { $list = AccountRole::getList(); foreach ($list as $tmp) { if ($tmp->id == $id) { return $tmp; } } return null; } /** * * @return AccountRole */ public static function getTitleById($id) { $list = AccountRole::getList(); foreach ($list as $tmp) { if ($tmp->id == $id) { return $tmp->title; } } return null; } }