function TestHasChannel($cid,$channelid,$issend=-1,$carr='') { global $_Cs; if(!is_array($_Cs) && !is_array($carr)){ include_once(dirname(__FILE__)."/../data/cache/inc_catalog_base.php"); } if($channelid==0) return 1; if(!isset($_Cs[$cid])) return 0; if($issend==-1){ if($_Cs[$cid][1]==$channelid||$channelid==0) return 1; else{ foreach($_Cs as $k=>$vs){ if($vs[0]==$cid) return TestHasChannel($k,$channelid,$issend,$_Cs); } } }else { if($_Cs[$cid][2]==$issend && ($_Cs[$cid][1]==$channelid||$channelid==0)) return 1; else{ foreach($_Cs as $k=>$vs){ if($vs[0]==$cid) return TestHasChannel($k,$channelid,$issend,$_Cs); } } } return 0; }
function LogicListAllSunType($ID,$step,$opall,$issend,$channelid,$nums=0) { $fid = $ID; if($nums){ $step = ' '.$step; } $nums = 1; $this->dsql->SetQuery("Select ID,reID,typedir,typename,ispart,channeltype,issend From #@__arctype where reID='".$ID."' order by sortrank"); $this->dsql->Execute($fid); if($this->dsql->GetTotalRow($fid)>0) { while($row=$this->dsql->GetObject($fid)) { $typeDir = $row->typedir; $typeName = $row->typename; $reID = $row->reID; $ID = $row->ID; $ispart = $row->ispart; $dcid = $row->channeltype; $dissend = $row->issend; if($ispart>=2||TestHasChannel($ID,$channelid,$issend)==0) continue; //普通列表 if(($ispart==0 || ($ispart==1 && $opall)) && ($issend!=1 || $dissend==1)) { if($channelid==0 || $channelid==$dcid) $smenu = " <input type='checkbox' name='selid' id='selid$ID' class='np' onClick=\"ReSel($ID,'$typeName')\"> "; else $smenu = "[×]"; $timg = " <img src='img/tree_list.gif'> "; } //带封面的频道 else if($ispart==1){ $timg = " <img src='img/tree_part.gif'> "; $smenu = "[封面]"; } echo '<dl class="topcc">'."\n"; echo '<dd>'.$step.$typeName."{$smenu}</dd>\n"; echo "</dl>\n"; $this->LogicListAllSunType($ID,$step,$opall,$issend,$channelid, $nums); } } }
function LogicListAllSunType($ID,$step,$opall,$channelid,$needcheck=true) { $fid = $ID; $this->dsql->SetQuery("Select ID,reID,typedir,typename,ispart,channeltype From #@__arctype where reID='".$ID."' order by sortrank"); $this->dsql->Execute($fid); if($this->dsql->GetTotalRow($fid)>0) { while($row=$this->dsql->GetObject($fid)) { $typeDir = $row->typedir; $typeName = $row->typename; $reID = $row->reID; $ID = $row->ID; $ispart = $row->ispart; if($step==" ") $stepdd = 2; else $stepdd = 3; $dcid = $row->channeltype; if(TestHasChannel($ID,$channelid)==0) continue; //if($ispart==2) continue; //有权限栏目 if(in_array($ID,$this->aChannels) || $needcheck===false || $this->isAdminAll===true) { //普通列表 if($ispart==0||($ispart==1 && $opall)) { if($channelid==0 || $channelid==$dcid) $smenu = " <input type='checkbox' name='selid' id='selid$ID' class='np' onClick=\"ReSel($ID,'$typeName')\"> "; else $smenu = "[×]"; $timg = " <img src='img/tree_list.gif'> "; } //带封面的频道 else if($ispart==1) { $timg = " <img src='img/tree_part.gif'> "; $smenu = "[封面]"; } //带封面的频道 else if($ispart==2) { $timg = " <img src='img/tree_part.gif'> "; $smenu = "[单页]"; } //跳转 else if($ispart==3) { $timg = " <img src='img/tree_part.gif'> "; $smenu = "[跳转]"; } echo " <table class='sunlist'>\r\n"; echo " <tr>\r\n"; echo " <td>".$step.$timg.$typeName."{$smenu}</td>\r\n"; echo " </tr>\r\n"; echo " </table>\r\n"; $this->LogicListAllSunType($ID,$step." ",$opall,$channelid,false); } }//循环结束 }//查询记录大于0 }
function GetOptionList($selid=0,$userCatalog=0,$channeltype=0) { global $OptionArrayList,$channels,$adminCats,$adminCatstrs,$suserCatalog; $suserCatalog = $userCatalog; $dsql = new DedeSql(false); //读取频道模型信息 $dsql->SetQuery("Select ID,typename From #@__channeltype "); $dsql->Execute(); $channels = Array(); while($row = $dsql->GetObject()) $channels[$row->ID] = $row->typename; $OptionArrayList = ""; $adminCats = array(); if(!empty($userCatalog) && $userCatalog!='-1') { $adminCats = explode(',',$userCatalog); $adminCatstrs = $userCatalog; } if($selid==0) { $query = "Select ID,typename,ispart,channeltype From #@__arctype where ispart<2 And reID=0 order by sortrank asc "; $dsql->SetQuery($query); $dsql->Execute(); while($row=$dsql->GetObject()) { if(TestHasChannel($row->ID,$channeltype)==0) continue; if( TestAdmin() || $userCatalog==-1 ) { if($row->ispart==1) $OptionArrayList .= "<option value='".$row->ID."' class='option1'>".$row->typename."(封面频道)</option>\r\n"; else if($row->ispart==2) $OptionArrayList .= ""; else if($row->channeltype!=$channeltype) $OptionArrayList .= "<option value='".$row->ID."' class='option2'>".$row->typename."(".$channels[$row->channeltype].")</option>\r\n"; else $OptionArrayList .= "<option value='".$row->ID."' class='option3'>".$row->typename."</option>\r\n"; LogicGetOptionArray($row->ID,"─",$channeltype,$dsql); }else { if(in_array($row->ID,$adminCats)) { if($row->ispart==1) $OptionArrayList .= "<option value='".$row->ID."' class='option1'>".$row->typename."(封面频道)</option>\r\n"; else if($row->ispart==2) $OptionArrayList .= ""; else if($row->channeltype!=$channeltype) $OptionArrayList .= "<option value='".$row->ID."' class='option2'>".$row->typename."(".$channels[$row->channeltype].")</option>\r\n"; else $OptionArrayList .= "<option value='".$row->ID."' class='option3'>".$row->typename."</option>\r\n"; LogicGetOptionArray($row->ID,"─",$channeltype,$dsql,false); }else { $haspurcat = false; $query = "Select ID From #@__arctype where ispart<2 And reID={$row->ID} order by sortrank asc "; $dsql->Execute('sel'.$row->ID,$query); while($nrow = $dsql->GetObject('sel'.$row->ID)){ if(in_array($nrow->ID,$adminCats)){ $haspurcat=true; break; } } if($haspurcat){ $OptionArrayList .= "<option value='".$row->ID."' class='option1'>".$row->typename."(没权限)</option>\r\n"; LogicGetOptionArray($row->ID,"─",$channeltype,$dsql); } } } } }else { $row = $dsql->GetOne("Select ID,typename,ispart,channeltype From #@__arctype where ID='$selid'"); $channeltype = $row['channeltype']; if($row['ispart']==1) $OptionArrayList .= "<option value='$selid' class='option1' selected>".$row['typename']."(封面频道)</option>\r\n"; else $OptionArrayList .= "<option value='$selid' class='option3' selected>".$row['typename']."</option>\r\n"; LogicGetOptionArray($selid,"─",$channeltype,$dsql,false); } return $OptionArrayList; }