Commit 405fcc14 by biao

1

parent 05c8023b
...@@ -5,16 +5,14 @@ ...@@ -5,16 +5,14 @@
* @author zongbiao * @author zongbiao
* @package jp.fishow.entity.definition * @package jp.fishow.entity.definition
*/ */
class AuthorityLevel class AcountModule
{ {
public $id; public $id;
public $level; public $module;
public $model;
function __construct($record) { function __construct($record) {
$this->id = $record["id"]; $this->id = $record["id"];
$this->level = $record["level"]; $this->module = $record["module"];
$this->model = $record["model"];
} }
/** /**
...@@ -27,33 +25,42 @@ class AuthorityLevel ...@@ -27,33 +25,42 @@ class AuthorityLevel
if ((!is_array($result)) || (count($result) < 1)) { if ((!is_array($result)) || (count($result) < 1)) {
$data = array(); $data = array();
//系统管理员 $tmp = array("id"=>1, "module"=>"账户管理");
$tmp = array("id"=>1, "level"=>"0", "model"=>"ACCOUNT|EVENT|CHECK");
array_push($data, $tmp); array_push($data, $tmp);
//省厅级权限 $tmp = array("id"=>2, "module"=>"领导机构管理");
$tmp = array("id"=>2, "level"=>"1", "model"=>"ACCOUNT|CHECK");
array_push($data, $tmp); array_push($data, $tmp);
//市级权限 $tmp = array("id"=>3, "module"=>"学校管理);
$tmp = array("id"=>3, "level"=>"2", "model"=>"ACCOUNT|CHECK");
array_push($data, $tmp); array_push($data, $tmp);
//区县管局权限 $tmp = array("id"=>4, "module"=>"班级管理");
$tmp = array("id"=>4, "level"=>"3", "model"=>"ACCOUNT|CHECK");
array_push($data, $tmp); array_push($data, $tmp);
//学校级别权限 $tmp = array("id"=>5, "module"=>"公益活动发布");
$tmp = array("id"=>5, "level"=>"4", "model"=>"ACCOUNT|CHECK");
array_push($data, $tmp); array_push($data, $tmp);
//班级级别权限 $tmp = array("id"=>6, "module"=>"公益活动审核");
$tmp = array("id"=>6, "level"=>"5", "model"=>"ACCOUNT|CHECK"); 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); array_push($data, $tmp);
$result = array(); $result = array();
foreach ($data as $row) { foreach ($data as $row) {
$tmp2 = new AuthorityLevel($row); $tmp2 = new AcountModule($row);
array_push($result, $tmp2); array_push($result, $tmp2);
} }
} }
...@@ -62,10 +69,10 @@ class AuthorityLevel ...@@ -62,10 +69,10 @@ class AuthorityLevel
/** /**
* IDから対応するインスタンスを返します。 * IDから対応するインスタンスを返します。
* @return AuthorityLevel 対応するインスタンス。ない場合null。 * @return AcountModule 対応するインスタンス。ない場合null。
*/ */
public static function getById($id) { public static function getById($id) {
$list = AuthorityLevel::getList(); $list = AcountModule::getList();
foreach ($list as $tmp) { foreach ($list as $tmp) {
if ($tmp->id == $id) { if ($tmp->id == $id) {
return $tmp; return $tmp;
...@@ -76,10 +83,10 @@ class AuthorityLevel ...@@ -76,10 +83,10 @@ class AuthorityLevel
/** /**
* 定義名から対応するインスタンスを返します。 * 定義名から対応するインスタンスを返します。
* @return AuthorityLevel 対応するインスタンス。ない場合null。 * @return AcountModule 対応するインスタンス。ない場合null。
*/ */
public static function getByName($name) { public static function getByName($name) {
$list = AuthorityLevel::getList(); $list = AcountModule::getList();
foreach ($list as $tmp) { foreach ($list as $tmp) {
if ($tmp->name == $name) { if ($tmp->name == $name) {
return $tmp; return $tmp;
...@@ -87,25 +94,4 @@ class AuthorityLevel ...@@ -87,25 +94,4 @@ class AuthorityLevel
} }
return null; return null;
} }
/**
* 通过定义名取得标题,用于显示
* @return
*/
public static function getTitlesByNames($names) {
if (empty($names)) {
return "拥有全部权限";
}
if (!is_array($names)) {
$names = explode(",", $names);
}
$list = AuthorityLevel::getList();
$result = array();
foreach ($list as $tmp) {
if (in_array($tmp->name, $names)) {
array_push($result, $tmp->title);
}
}
return implode(",", $result);
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment