public function GetAllByTree() { $list = M($this->dbname)->select(); $bta = new BuildTreeArray($list, 'id', 'pid', 0); $data = $bta->getTreeArray(); echo json_encode($data); }
public function GetAllOrg() { // import("Home.Library.TreeLib.BuildTreeArray"); // import('Common/ORG/Util/BuildTreeArray'); $list = M($this->dbname)->select(); // $bta = new \Common\ORG\Util\BuildTreeArray($list,'orgid','orgpid',0); $bta = new BuildTreeArray($list, 'orgid', 'orgpid', 0); $data = $bta->getTreeArray(); echo json_encode($data); // $this->ajaxReturn(json_encode($data),'JSON'); }
public function AjaxGetAllDevices() { $meetingid = $_REQUEST["id"]; // 关键词首层 $demo = M("Meetingdevice"); $keyslist = $demo->table(C('DB_PREFIX') . "meetingdevice a")->join("left join " . C('DB_PREFIX') . "meetinganddevice b ON (a.id=b.meetingdeviceid and b.meetingid='" . $meetingid . "')")->field("a.id,0 pid,a.name, case when ifnull(b.meetingid,'') != '' then 'true' else 'false' end as checked")->where("a.status=1")->order("a.sort asc")->select(); $bta = new BuildTreeArray($keyslist, 'id', 'pid', 0); $data = $bta->getTreeArray(); //var_dump(json_encode($data)); echo json_encode($data); // $this->ajaxReturn(json_encode($data),'JSON'); }
public function GetMenu() { //权限 $menu = M($this->dbname); if (!in_array(session('uid'), C('ADMINISTRATOR'))) { //getChildLst(31) 系统应用的ID 不能修改 if (session('uid') == '') { $list = M($this->dbname)->where("FIND_IN_SET(id,getChildLst(31)) and status=1")->order("sort asc")->select(); } else { $list = M($this->dbname)->where(" status=1")->order("sort asc")->select(); } } else { //如果管理员权限可以访问所有的 $list = M($this->dbname)->where(" status=1")->order("sort asc")->select(); } //echo $menu->getLastSql(); //var_dump(M($this->dbname)->getLastSql()); $bta = new BuildTreeArray($list, 'id', 'pid', 0); $data = $bta->getTreeArray(); echo json_encode($data); }
public function AjaxGetAllOrgs_index() { $orgsid = $_REQUEST["id"]; // 关键词首层 $demo = M("Org"); $keyslist = $demo->table(C('DB_PREFIX') . "org a")->field("a.id,a.pid,a.name, case when FIND_IN_SET(ifnull(a.id,''),'" . $orgsid . "')>0 then 'true' else 'false' end as checked")->where("a.status=1")->order("a.sort asc")->select(); //var_dump($demo->getLastSql()); // $this->assign('keyslist',$keyslist); $bta = new BuildTreeArray($keyslist, 'id', 'pid', 0); $data = $bta->getTreeArray(); //var_dump(json_encode($data)); echo json_encode($data); // $this->ajaxReturn(json_encode($data),'JSON'); }