Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Compass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zong
Compass
Commits
c5266ab9
Commit
c5266ab9
authored
Feb 13, 2020
by
biao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
3d03e845
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
188 additions
and
0 deletions
+188
-0
AuthorityLevel.inc
src/cn/compass/entity/definition/AuthorityLevel.inc
+112
-0
CourseParentCategory.inc
src/cn/compass/entity/definition/CourseParentCategory.inc
+76
-0
No files found.
src/cn/compass/entity/definition/AuthorityLevel.inc
0 → 100644
View file @
c5266ab9
<?php
/**
* 管理员权限分配用静态类
* $Id$
* @author zongbiao
* @package jp.fishow.entity.definition
*/
class
AuthorityLevel
{
public
$id
;
public
$level
;
public
$model
;
function
__construct
(
$record
)
{
$this
->
id
=
$record
[
"id"
];
$this
->
level
=
$record
[
"level"
];
$this
->
model
=
$record
[
"model"
];
}
/**
* このクラスのインスタンスのリストを返します。
* @return array ImageType一覧
*/
public
static
function
getList
()
{
static
$result
;
if
((
!
is_array
(
$result
))
||
(
count
(
$result
)
<
1
))
{
$data
=
array
();
//系统管理员
$tmp
=
array
(
"id"
=>
1
,
"level"
=>
"0"
,
"model"
=>
"ACCOUNT|EVENT|CHECK"
);
array_push
(
$data
,
$tmp
);
//省厅级权限
$tmp
=
array
(
"id"
=>
2
,
"level"
=>
"1"
,
"model"
=>
"ACCOUNT|CHECK"
);
array_push
(
$data
,
$tmp
);
//市级权限
$tmp
=
array
(
"id"
=>
3
,
"level"
=>
"2"
,
"model"
=>
"ACCOUNT|CHECK"
);
array_push
(
$data
,
$tmp
);
//区县管局权限
$tmp
=
array
(
"id"
=>
4
,
"level"
=>
"3"
,
"model"
=>
"ACCOUNT|CHECK"
);
array_push
(
$data
,
$tmp
);
//学校级别权限
$tmp
=
array
(
"id"
=>
5
,
"level"
=>
"4"
,
"model"
=>
"ACCOUNT|CHECK"
);
array_push
(
$data
,
$tmp
);
//班级级别权限
$tmp
=
array
(
"id"
=>
6
,
"level"
=>
"5"
,
"model"
=>
"ACCOUNT|CHECK"
);
array_push
(
$data
,
$tmp
);
$result
=
array
();
foreach
(
$data
as
$row
)
{
$tmp2
=
new
AuthorityLevel
(
$row
);
array_push
(
$result
,
$tmp2
);
}
}
return
$result
;
}
/**
* IDから対応するインスタンスを返します。
* @return AuthorityLevel 対応するインスタンス。ない場合null。
*/
public
static
function
getById
(
$id
)
{
$list
=
AuthorityLevel
::
getList
();
foreach
(
$list
as
$tmp
)
{
if
(
$tmp
->
id
==
$id
)
{
return
$tmp
;
}
}
return
null
;
}
/**
* 定義名から対応するインスタンスを返します。
* @return AuthorityLevel 対応するインスタンス。ない場合null。
*/
public
static
function
getByName
(
$name
)
{
$list
=
AuthorityLevel
::
getList
();
foreach
(
$list
as
$tmp
)
{
if
(
$tmp
->
name
==
$name
)
{
return
$tmp
;
}
}
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
src/cn/compass/entity/definition/CourseParentCategory.inc
0 → 100644
View file @
c5266ab9
<?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
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment