AcountModule.inc 2.43 KB
<?php
/**
 * 管理员权限分配用静态类
 * $Id$
 * @author zongbiao
 * @package jp.fishow.entity.definition
 */
class AcountModule
{
	public $id;
	public $module;
	
	function __construct($record) {
		$this->id = $record["id"];
		$this->module = $record["module"];
	}
	
	/**
	 * このクラスのインスタンスのリストを返します。
	 * @return array ImageType一覧
	 */
	public static function getList() {
		static $result;
			
		if ((!is_array($result)) || (count($result) < 1)) {
			
			$data = array();
			$tmp = array("id"=>1, "module"=>"账户管理");
			array_push($data, $tmp);
			
			$tmp = array("id"=>2, "module"=>"领导机构管理");
			array_push($data, $tmp);
			
			$tmp = array("id"=>3, "module"=>"学校管理");
			array_push($data, $tmp);
			
			$tmp = array("id"=>4, "module"=>"班级管理");
			array_push($data, $tmp);
			
			$tmp = array("id"=>5, "module"=>"公益活动发布");
			array_push($data, $tmp);
			
			$tmp = array("id"=>6, "module"=>"公益活动审核");
			array_push($data, $tmp);
			
			$tmp = array("id"=>7, "module"=>"社会实践发布");
			array_push($data, $tmp);
			
			$tmp = array("id"=>8, "module"=>"社会实践审核");
			array_push($data, $tmp);
			
			$tmp = array("id"=>9, "module"=>"亲子活动发布");
			array_push($data, $tmp);
			
			$tmp = array("id"=>10, "module"=>"亲子活动审核");
			array_push($data, $tmp);
			
			$tmp = array("id"=>11, "module"=>"公益课堂管理");
			array_push($data, $tmp);
			
			$tmp = array("id"=>12, "module"=>"用户管理");
			array_push($data, $tmp);
			
			$tmp = array("id"=>13, "module"=>"机构用户管理");
			array_push($data, $tmp);
			
			$result = array();
			foreach ($data as $row) {
				$tmp2 = new AcountModule($row);
				array_push($result, $tmp2);
			}
		}
		return $result;
	}
	
	/**
	 * IDから対応するインスタンスを返します。
	 * @return AcountModule 対応するインスタンス。ない場合null。
	 */
	public static function getById($id) {
		$list = AcountModule::getList();
		foreach ($list as $tmp) {
			if ($tmp->id == $id) {
				return $tmp;
			}
		}
		return null;
	}
	
	/**
	 * 定義名から対応するインスタンスを返します。
	 * @return AcountModule 対応するインスタンス。ない場合null。
	 */
	public static function getByName($name) {
		$list = AcountModule::getList();
		foreach ($list as $tmp) {
			if ($tmp->name == $name) {
				return $tmp;
			}
		}
		return null;
	}
}