12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- /**
- *
- * Menu(菜单管理)
- *
- */
- if(!defined("Ainaphp")) exit("Access Denied");
- class MenuAction extends AdminbaseAction
- {
- public $dao;
- function _initialize()
- {
- parent::_initialize();
- $this->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'] = '<a href="'.U('Menu/add',array( 'parentid' => $r['id'])).'">'.L('menu_add_submenu').'</a> | <a href="'.U('Menu/edit',array( 'id' => $r['id'])).'">'.L('edit').'</a> | <a href="javascript:confirm_delete(\''.U('Menu/delete',array( 'id' => $r['id'])).'\')">'.L('delete').'</a> ';
- $r['status'] ? $r['status']='<font color="green">'.L('enable').'</font>' : $r['status']='<font color="red">'.L(' disable').'</font>' ;
- $array[] = $r;
- }
- $str = "<tr>
- <td width='40' align='center'><input name='listorders[\$id]' type='text' size='3' value='\$listorder' class='input-text-c'></td>
- <td align='center'>\$id</td>
- <td >\$spacer\$name</td>
- <td align='center'>\$status</td>
- <td align='center'>\$str_manage</td>
- </tr>";
- import ( '@.ORG.Tree' );
- $tree = new Tree ($array);
- $tree->icon = array(' <span>'.L('tree_1').'</span>',' <span>'.L('tree_2').'</span>',' <span>'.L('tree_3').'</span>');
- $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 = "<option value='\$id' \$selected>\$spacer \$name</option>";
- $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 = "<option value='\$id' \$selected>\$spacer \$name</option>";
- $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 ();
- }
- }
- ?>
|