Blame view

framework/model/frame.mod.php 1.22 KB
4d84a934   曹明   初始代码提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');

function frame_lists(){
	$data = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = 0 ORDER BY is_system ASC, displayorder ASC, id ASC');
	if(!empty($data)) {
		foreach($data as &$da) {
			$childs = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = :pid ORDER BY is_system ASC, displayorder ASC, id ASC', array(':pid' => $da['id']));
			if(!empty($childs)) {
				foreach($childs as &$child) {
					$grandchilds = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = :pid ORDER BY is_system ASC, displayorder ASC, id ASC', array(':pid' => $child['id']));
					if(!empty($grandchilds)) {
						foreach($grandchilds as &$grandchild) {
							$greatsons = pdo_fetchall('SELECT * FROM ' . tablename('core_menu') . ' WHERE pid = :pid ORDER BY is_system ASC, displayorder ASC, id ASC', array(':pid' => $grandchild['id']));
							$grandchild['greatsons'] = $greatsons;
						}
					}
					$child['grandchild'] = $grandchilds;
				}
				$da['child'] = $childs;
			}
		}
	}
	return $data;
}