function importone($id, $upid, $level) { if (!updata) { return; } $thislevel = $level; foreach (C::t('#sanree_brand#common_district')->fetch_all_by_upid($id) as $data) { $data[upid] = $upid; $nid = $data[id]; unset($data[id]); $data[level] = $thislevel; $data[enabled] = 1; $data[usetype] = 3; $inid = C::t('#sanree_brand#sanree_brand_district')->insert($data, TRUE); importone($nid, $inid, $thislevel + 1); } }
$upid = $p2[id]; $p3 = C::t('#sanree_brand#common_district')->fetch_first_by_name($setarr['birthdist'], $upid); if ($p3) { $upid = $p3[id]; $p4 = C::t('#sanree_brand#common_district')->fetch_first_by_name($setarr['birthcommunity'], $upid); if ($p4) { $upid = $p4[id]; } } } } } } $result = C::t('#sanree_brand#common_district')->fetch_first_by_id($upid); if ($result['level'] > 0 && $result['level'] < 4) { importone($result[id], 0, 1); } cpmsg($langs['succeed'], "action=" . $thisurl, 'succeed'); } else { cpmsg_error($langs['error_emptydis']); } } else { include template('common/header'); include_once libfile('function/profile'); $districthtml = profile_setting('birthcity'); showformheader($thisurl . '&do=ajax&page=' . $page . '&upid=' . $upid); showtableheader('', 'nobottom'); echo '<div style="height:170px;width:530px;"><h3 class="flb mn"><span><a href="javascript:;" class="flbc" onclick="hideWindow(\'showarea\',1,0);" title="{lang close}">{lang close}</a></span>' . $langs['pleaseinputdis'] . '</h3><div style="margin-left:10px;">' . $districthtml . '<p style="padding:10px; color:#3333CC; line-height:20px;">' . $langs['pleaseinputdistip'] . '</p></div></div>'; showsubmit('submit', 'import'); showtablefooter(); showformfooter();