Пример #1
0
function insert_city_id_select($param = array())
{
    if (intval($param['city_id']) > 0) {
        $city_id = intval($param['city_id']);
    }
    $city_tree = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_city where is_delete = 0");
    if ($city_id > 0) {
        foreach ($city_tree as $k => $v) {
            if ($city_id == $v['id']) {
                $city_tree[$k]['selected'] = 1;
            }
        }
    }
    $city_tree = toTree($city_tree);
    $GLOBALS['tmpl']->assign("city_id", $city_id);
    $GLOBALS['tmpl']->assign("city_tree", $city_tree);
    $html = $GLOBALS['tmpl']->fetch("inc/city_id_select.html");
    return $html;
}
Пример #2
0
function toFormatTree($list, $title = 'title')
{
    $list = toTree($list);
    $formatTree = array();
    _toFormatTree($list, 0, $title, $formatTree);
    return $formatTree;
}