public function index() { $node = M("Duty"); $menu = array(); $menu = $node->field('id,name')->order('sort asc')->select(); $tree = list_to_tree($menu); $this->assign('menu', sub_tree_menu($tree)); $this->display(); }
function popup() { $model = M("SystemTag"); $module = $_GET['module']; $where['module'] = array('eq', $module); $list = array(); $list = $model->where($where)->field('id,pid,name')->order('sort asc')->select(); $list = list_to_tree($list); $this->assign('list_popup', sub_tree_menu($list)); $this->display(); return; }
public function index() { $node = M("MaterialClass"); $where['is_del'] = 0; $menu = $node->where($where)->field('id,pid,name')->order('sort asc')->select(); $tree = list_to_tree($menu); $this->assign('menu', sub_tree_menu($tree)); $model = M("MaterialClass"); $list = $model->where($where)->getField('id,name'); $this->assign('folder_list', $list); $this->display(); }
protected function _index() { $node = M("SystemFolder"); $menu = array(); $where['folder'] = MODULE_NAME; $menu = $node->where($where)->field('id,pid,name')->order('sort asc')->select(); $tree = list_to_tree($menu); $this->assign('menu', sub_tree_menu($tree)); $model = M("SystemFolder"); $list = $model->where($where)->getField('id,name'); $this->assign('folder_list', $list); $this->assign('js_file', "SystemFolder:js/index"); $this->display("SystemFolder:index"); }
public function personal() { $node = M("Folder"); $menu = array(); $user_id = get_user_id(); $where['folder'] = $this->get_folder(); $where['user_id'] = $user_id; $menu = $node->where($where)->field('id,pid,name')->order('sort asc')->select(); $tree = list_to_tree($menu); $model = M("Folder"); $list = $model->where($where)->getField('id,name'); $this->assign('folder_list', $list); $this->assign('menu', sub_tree_menu($tree)); $this->display("Folder:personal"); }
function field() { if ($_POST) { $opmode = $_POST["opmode"]; $model = D("ProductField"); if (false === $model->create()) { $this->error($model->getError()); } if ($opmode == "add") { $list = $model->add(); if ($list !== false) { //保存成功 $this->assign('jumpUrl', get_return_url()); $this->success('新增成功!'); } else { $this->error('新增失败!'); //失败提示 } } if ($opmode == "edit") { $list = $model->save(); if ($list !== false) { //保存成功 $this->assign('jumpUrl', get_return_url()); $this->success('保存成功!'); } else { $this->error('保存失败!'); //失败提示 } } if ($opmode == "del") { $id = $_REQUEST['id']; $list = $model->where("id={$id}")->delete(); if ($list !== false) { //保存成功 $this->assign('jumpUrl', get_return_url()); $this->success('删除成功!'); } else { $this->error('删除失败!'); //失败提示 } } } $widget['date'] = true; $this->assign("widget", $widget); $model = D("ProductField"); $type_id = $_REQUEST['type_id']; $this->assign('type_id', $type_id); $where['type_id'] = array('eq', $type_id); $where['is_del'] = 0; $field_list = $model->where($where)->order('sort asc')->select(); $tree = list_to_tree($field_list); $this->assign('menu', sub_tree_menu($tree)); $this->assign("field_list", $field_list); $this->display(); }
function sub_tree_menu($tree, $level = 0) { $level++; $html = ""; if (is_array($tree)) { $html = "<ul class=\"tree_menu\">\r\n"; foreach ($tree as $val) { if (isset($val["name"])) { $title = $val["name"]; $id = $val["id"]; if (empty($val["id"])) { $id = $val["name"]; } if (isset($val['_child'])) { $html = $html . "<li>\r\n<a node=\"{$id}\"><i class=\"icon-angle-right level{$level}\"></i><span>{$title}</span></a>\r\n"; $html = $html . sub_tree_menu($val['_child'], $level); $html = $html . "</li>\r\n"; } else { $html = $html . "<li>\r\n<a node=\"{$id}\" ><i class=\"icon-angle-right level{$level}\"></i><span>{$title}</span></a>\r\n</li>\r\n"; } } } $html = $html . "</ul>\r\n"; } return $html; }
function position() { $widget['jquery-ui'] = true; $this->assign("widget", $widget); $model = M("Position"); $list = array(); $list = $model->field('id,name')->order('sort asc')->select(); $list = list_to_tree($list); $this->assign('list_position', sub_tree_menu($list)); $this->display(); return; }
function popup_position() { $model = M("Position"); $list = array(); $list = $model->field('id,name')->order('sort asc')->select(); $list = list_to_tree($list); $this->assign('list_position', sub_tree_menu($list)); $this->display(); return; }