-
-
-
- public function getGroupTree(){
- $data = $this->select();
- $arrOptions = array();
- $this->getOptions($data, 0, $arrOptions, 0);
- $strOptions = implode('', $arrOptions);
- return '<select name="user_role">'.$strOptions.'</select>';
- }
-
- private function getOptions($data, $pid, &$arrOptions, $level){
- foreach ($data as $v){
- if($v['pid']==$pid){
- $arrOptions[] = $this->getHtmlOption($v['name'], $v['id'], $level);
- $this->getOptions($data, $v['id'], $arrOptions, $level+1);
- }
- }
- }
-
-
- private function getHtmlOption($name, $id, $level){
- $pxValue = 10*$level;
- $option = '<option value="'.$id.'" style="padding-left: '.$pxValue.'px">' . $name . '</option>';
- return $option;
- }