function IsParent($myid,$topid,$dsql) { $row = $dsql->GetOne("select ID,reID from #@__arctype where ID='$myid'"); if($row['reID']==$topid) return true; else if($row['reID']==0) return false; else return IsParent($row['reID'],$topid,$dsql); }
function IsParent($myid, $topid, $dsql) { $row = $dsql->GetOne("select id,reid,topid from #@__arctype where topid='{$myid}' or id='{$myid}'"); if ($row['reid'] == $topid) { return true; } else { if ($row['reid'] == 0) { return false; } else { return IsParent($row['reid'], $topid, $dsql); } } }
$win->AddHidden('typeid', $typeid); $win->AddHidden('channelid', $channelid); $win->AddHidden('nextjob', 'unitok'); $win->AddTitle("移动目录时不会删除原来已创建的列表,移动后需重新对栏目创建HTML。"); $win->AddItem('你选择的栏目是:', "{$typename}({$typeid})"); $win->AddItem('你希望移动到那个栏目?', "<select name='movetype'>\r\n<option value='0'>移动为顶级栏目</option>\r\n{$typeOptions}\r\n</select>"); $win->AddItem('注意事项:', '不允许从父级移动到子级目录,只允许子级到更高级或同级或不同父级的情况。'); $winform = $win->GetWindow('ok'); $win->Display(); exit; } else { if ($typeid == $movetype) { ShowMsg('移对对象和目标位置相同!', 'catalog_main.php'); exit; } if (IsParent($movetype, $typeid)) { ShowMsg('不能从父类移动到子类!', 'catalog_main.php'); exit; } $dsql->ExecuteNoneQuery(" UPDATE `#@__arctype` SET reid='{$movetype}' WHERE id='{$typeid}' "); UpDateCatCache(); ShowMsg('成功移动目录!', 'catalog_main.php'); exit; } } } } } } } }