/**
* [getParent 找到一级节点]
* @Author:wty
* @DateTime:2016-05-01T17:14:10+0800
* @return [type] [description]
*/
private function _getParent($arr,$son)
{
$first=array();
foreach ($arr as $key => $value) {
if($value['id']==$son&&$value['parentid']!=0){
$first=$this->_getParent($arr,$value['parentid']);
}
if($value['id']==$son&&$value['parentid']==0){
$first=$value;
}
}
return $first;
}
/**
* [getSons 子孙查找]
* @Author:wty
* @DateTime:2016-05-01T17:14:48+0800
* @return [type] [description]
*/
private function _getSons($arr,$parentid)
{
$first=array();
foreach ($arr as $key => $value) {
if($value['parentid']==$parentid&&$value['parentid']!=0){
$first[]=$value;
}
}
return $first;
}
/**
* [_getSons 子孙树查找]
* @param [type] $arr [description]
* @param [type] $parent [description]
* @return [type] [description]
*/
private function _getNavSons($arr,$parent)
{
$temp=array();
foreach ($arr as $key => $value) {
if($value['parentid']==$parent){
$temp[]=$value['id'];
$temp=array_merge($temp,$this->_getSons($arr,$value['id']));
}
}
return $temp;
}