PHP Class CategoryTreeModel, thinksns

Author: zivss ([email protected])
Inheritance: extends Model
Show file Open project: medz/thinksns-4 Class Usage Examples

Public Methods

Method Description
addTreeCategory ( integer $pid, string $title, array $extra = [] ) : boolean 添加子分类操作
doSetCategoryConf ( integer $cid, $ext ) : boolean 存储分类配置项操作
getApp ( ) : string 获取分类应用名称
getCategoryAllHash ( integer $pid, $order = 'sort ASC' ) : array 获取详细的分类Hash数组 - 主要为了显示ext中的内容
getCategoryById ( integer $id ) : array 获取指定分类ID下的分类信息
getCategoryHash ( integer $pid ) : array 获取全部分类Hash数组
getCategoryInfo ( integer $cid ) : array 获取指定分类的信息
getCategoryList ( integer $pid, string $field = '' ) : array 当指定pid时,查询该父分类的所有子分类;否则查询所有分类
getCatgoryConf ( integer $cid ) : array 获取指定分类的相关配置信息
getMessage ( ) : string 获取提示信息
getNetworkList ( $pid ) : array 获取指定父分类的树形结构
getTable ( ) : string 获取分类表名
isTitleExist ( string $title ) : boolean 判断分类名称是否重复
moveTreeCategory ( integer $id, string $type ) : boolean 移动分类操作
remakeTreeCache ( ) 清除分类数据PHP文件
rmRfCate ( $cid ) s删除分类下的子分类信息
rmTreeCategory ( integer $cid, string $_module = null, string $_method = null ) : boolean 删除分类信息操作
setApp ( string $app ) 设置分类应用名称
setMessage ( $msg ) 设置提示信息
setTable ( string $table ) 设置分类表名
upTreeCategory ( integer $cid, string $title, array $extra = [] ) : boolean 更新分类信息操作
updateSort ( ) 更新排序字段,仅仅用于刷新历史数据

Private Methods

Method Description
_MakeTree ( integer $pid, integer $level ) : array 递归形成树形结构

Method Details

addTreeCategory() public method

添加子分类操作
public addTreeCategory ( integer $pid, string $title, array $extra = [] ) : boolean
$pid integer 父级分类ID
$title string 分类名称
$extra array 插入数据时,带入的相关信息
return boolean 添加分类是否成功

doSetCategoryConf() public method

存储分类配置项操作
public doSetCategoryConf ( integer $cid, $ext ) : boolean
$cid integer 分类ID
return boolean 是否存储成功

getApp() public method

获取分类应用名称
public getApp ( ) : string
return string 分类应用名称

getCategoryAllHash() public method

获取详细的分类Hash数组 - 主要为了显示ext中的内容
public getCategoryAllHash ( integer $pid, $order = 'sort ASC' ) : array
$pid integer 父级分类ID
return array 详细的分类Hash数组 - 主要为了显示ext中的内容

getCategoryById() public method

获取指定分类ID下的分类信息
public getCategoryById ( integer $id ) : array
$id integer 分类ID
return array 指定分类ID下的分类信息

getCategoryHash() public method

获取全部分类Hash数组
public getCategoryHash ( integer $pid ) : array
$pid integer 父级分类ID
return array 全部分类Hash数组

getCategoryInfo() public method

获取指定分类的信息
public getCategoryInfo ( integer $cid ) : array
$cid integer 分类ID
return array 分类信息

getCategoryList() public method

当指定pid时,查询该父分类的所有子分类;否则查询所有分类
public getCategoryList ( integer $pid, string $field = '' ) : array
$pid integer 父分类ID
$field string 显示的字段,默认为空
return array 相应的分类列表

getCatgoryConf() public method

获取指定分类的相关配置信息
public getCatgoryConf ( integer $cid ) : array
$cid integer 分类ID
return array 指定分类的相关配置信息

getMessage() public method

获取提示信息
public getMessage ( ) : string
return string 提示信息

getNetworkList() public method

获取指定父分类的树形结构
public getNetworkList ( $pid ) : array
return array $pid 父分类ID

getTable() public method

获取分类表名
public getTable ( ) : string
return string 分类表名

isTitleExist() public method

判断分类名称是否重复
public isTitleExist ( string $title ) : boolean
$title string 分类名称
return boolean 分类名称是否重复

moveTreeCategory() public method

移动分类操作
public moveTreeCategory ( integer $id, string $type ) : boolean
$id integer 移动分类ID
$type string 移动类型:上移(up),下移(down)
return boolean 是否移动成功

remakeTreeCache() public method

清除分类数据PHP文件
public remakeTreeCache ( )

rmRfCate() public method

s删除分类下的子分类信息
Author: Medz Seven ([email protected])
public rmRfCate ( $cid )

rmTreeCategory() public method

删除分类信息操作
public rmTreeCategory ( integer $cid, string $_module = null, string $_method = null ) : boolean
$cid integer 分类ID
$_module string 模型名称,默认为null
$_method string 方法名称,默认为null
return boolean 删除分类信息是否成功

setApp() public method

设置分类应用名称
public setApp ( string $app )
$app string 分类应用名称

setMessage() public method

设置提示信息
public setMessage ( $msg )

setTable() public method

设置分类表名
public setTable ( string $table )
$table string 分类数据表名

upTreeCategory() public method

更新分类信息操作
public upTreeCategory ( integer $cid, string $title, array $extra = [] ) : boolean
$cid integer 分类ID
$title string 分类名称
$extra array 插入数据时,带入的相关信息
return boolean 更新分类是否成功

updateSort() public method

更新排序字段,仅仅用于刷新历史数据
public updateSort ( )