dao = D('Admin/menu');
$this->assign('actionname',$this->getActionName());
}
/**
* 列表
*
*/
public function index()
{
$result = $this->menudata;
foreach($result as $r) {
if($r['type']!=1) continue;
$r['str_manage'] = ''.L('menu_add_submenu').' | '.L('edit').' | '.L('delete').' ';
$r['status'] ? $r['status']=''.L('enable').'' : $r['status']=''.L(' disable').'' ;
$array[] = $r;
}
$str = "
|
\$id |
\$spacer\$name |
\$status |
\$str_manage |
";
import ( '@.ORG.Tree' );
$tree = new Tree ($array);
$tree->icon = array(' '.L('tree_1').'',' '.L('tree_2').'',' '.L('tree_3').'');
$tree->nbsp = ' ';
$select_categorys = $tree->get_tree(0, $str);
$this->assign('select_categorys', $select_categorys);
$this->display();
}
/**
* 提交
*
*/
public function _before_add()
{
$parentid = intval($_GET['parentid']);
import ( '@.ORG.Tree' );
$result = $this->menudata;
foreach($result as $r) {
if($r['type']!=1) continue;
$r['selected'] = $r['id'] == $parentid ? 'selected' : '';
$array[] = $r;
}
$str = "";
$tree = new Tree ($array);
$tree->icon = array(L('tree_1'),L('tree_2'),L('tree_3'));
$select_categorys = $tree->get_tree(0, $str,$parentid);
$this->assign('select_categorys', $select_categorys);
}
function edit() {
$id = intval($_GET['id']);;
$vo = $this->menudata[$id];
$parentid = intval($vo['parentid']);
import ( '@.ORG.Tree' );
$result = $this->menudata;
foreach($result as $r) {
if($r['type']!=1) continue;
$r['selected'] = $r['id'] == $parentid ? 'selected' : '';
$array[] = $r;
}
$str = "";
$tree = new Tree ($array);
$tree->icon = array(L('tree_1'),L('tree_2'),L('tree_3'));
$select_categorys = $tree->get_tree(0, $str,$parentid);
$this->assign('select_categorys', $select_categorys);
$this->assign ( 'vo', $vo );
$this->display ();
}
}
?>