?> '); }) </script> </head> <body> <div class="topToolbar"> <span class="title">商品信息管理</span> <span class="alltype"> <a href="javascript:;" onclick="GetType('','查看全部',$(this))" class="btn">查看全部</a> <span class="drop"> <?php GetMgrAjaxType('#@__infoclass', 4); ?> </span> </span> <span class="alltype" style="margin-left:0;"> <a href="javascript:;" onclick="GetType2('','查看全部',$(this))" class="btn">查看全部</a> <span class="drop"> <?php GetMgrAjaxType('#@__goodstype'); ?> </span> </span> <a href="javascript:location.reload();" class="reload">刷新</a></div> <form name="form" id="form" method="post"> <div id="list"> <div class="loading">读取列表中...</div> </div> </form> </body> </html>
function GetMgrAjaxType($tbname = '', $type = '', $id = 0, $i = 0) { global $dosql, $cfg_siteid, $cfg_adminlevel; //权限验证 if ($cfg_adminlevel != 1) { $catgoryPriv = array(); $dosql->Execute("SELECT * FROM `#@__adminprivacy` WHERE `groupid`=" . $cfg_adminlevel . " AND `model`='category' AND `action`='list'"); while ($row2 = $dosql->GetArray()) { $catgoryPriv[] = $row2['classid']; } } //商品类别暂时不区分站点 if ($tbname != '#@__goodstype') { $sql = "SELECT * FROM `{$tbname}` WHERE `siteid`='{$cfg_siteid}' AND `parentid`={$id} ORDER BY `orderid` ASC"; } else { $sql = "SELECT * FROM `{$tbname}` WHERE `parentid`={$id} ORDER BY `orderid` ASC"; } $dosql->Execute($sql, $id); $i++; while ($row = $dosql->GetArray($id)) { //如果$type为空,则不是栏目的类型 //如前只有商品分类选择使用$type为空 if (!empty($type)) { if ($row['infotype'] == $type) { //判断是否存在查看权限 if ($cfg_adminlevel != 1) { if (in_array($row['id'], $catgoryPriv)) { echo '<a href="javascript:;" onclick="GetType(\'' . $row['id'] . '\',\'' . $row['classname'] . '\',$(this))">'; } else { echo '<a href="javascript:;" onclick="alert(\'亲,您还没有操作本栏目的权限!\');" style="color:#999;">'; } } else { echo '<a href="javascript:;" onclick="GetType(\'' . $row['id'] . '\',\'' . $row['classname'] . '\',$(this))">'; } for ($p = 1; $p < $i; $p++) { echo ' '; } if ($row['parentid'] != 0) { echo '|- '; } echo $row['classname'] . '</a>'; } } else { echo '<a href="javascript:;" onclick="GetType2(\'' . $row['id'] . '\',\'' . $row["classname"] . '\',$(this))">'; for ($p = 1; $p < $i; $p++) { echo ' '; } if ($row['parentid'] != 0) { echo '|- '; } echo $row['classname'] . '</a>'; } GetMgrAjaxType($tbname, $type, $row['id'], $i); } }
<script type="text/javascript" src="templates/js/jquery.min.js"></script> <script type="text/javascript" src="templates/js/forms.func.js"></script> <script type="text/javascript" src="templates/js/listajax.js"></script> <script type="text/javascript" src="templates/js/loadimage.js"></script> <script type="text/javascript"> $(function(){ GetList('infoimg','<?php echo $cid = isset($cid) ? $cid : ''; ?> '); }) </script> </head> <body> <div class="topToolbar"> <span class="title">图片信息管理</span> <span class="alltype"> <a href="javascript:;" onclick="GetType('','查看全部',$(this))" class="btn">查看全部</a> <span class="drop"> <?php GetMgrAjaxType('#@__infoclass', 2); ?> </span> </span> <a href="javascript:location.reload();" class="reload">刷新</a></div> <form name="form" id="form" method="post"> <div id="list"> <div class="loading">读取列表中...</div> </div> </form> </body> </html>