You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.0 KiB
PHTML
59 lines
2.0 KiB
PHTML
2 years ago
|
<?php
|
||
|
namespace Admin\Widget;
|
||
|
use Think\Controller;
|
||
|
|
||
|
class IndexWidget extends Controller{
|
||
|
|
||
|
public function navigation($value='',$compare='')
|
||
|
{
|
||
|
$mainID = M('Menu')->where("pid !=0 AND url like '%".$value."%'")->getField('id');
|
||
|
$MainMenu = M('Menu')->field("id,pid,title,url,status,hide")->where(array('pid'=>$mainID,'hide'=>0))->order("sort asc")->select();
|
||
|
$this->assign("data",$MainMenu);
|
||
|
$compare = empty($compare)?CONTROLLER_NAME."/".ACTION_NAME:$compare;
|
||
|
$this->assign('currentUrl',$compare);
|
||
|
$this->display('Widget:navigation');
|
||
|
}
|
||
|
|
||
|
public function CateGroupTree($cate_id=0){
|
||
|
//$tree = D('Category')->getTree($cate_id,'id,name,title,sort,pid,allow_publish,status');
|
||
|
$map['sys_category.id'] = $cate_id;
|
||
|
$map['tab.status'] = 1;
|
||
|
$list = D('category')
|
||
|
->field("tab.id,tab.title,tab.pid,tab.sort")
|
||
|
->join("sys_category AS tab ON sys_category.pid = tab.pid")
|
||
|
->where($map)
|
||
|
->order('tab.sort asc')
|
||
|
->select();
|
||
|
foreach ($list as $key => $value) {
|
||
|
if($cate_id == $value['id']){
|
||
|
$title = $value['title'];
|
||
|
define('TABTITLE',$value['title']);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
$sup = D('category')->field('title,name')->where(['id'=>$list[0]['pid']])->find();
|
||
|
if ($cate_id){
|
||
|
$url = 'Article/index/cate_id/'.$list[0]['id'];
|
||
|
$name = $sup['name'];
|
||
|
if (stripos($name,'pc')!== false) {$surfix='PC官网';}elseif (stripos($name,'wap')!==false) {$surfix='WAP站';}
|
||
|
elseif (stripos($name,'app')!==false) {$surfix='游戏盒子APP';}elseif (stripos($name,'promote')!==false){$surfix='推广员后台';}
|
||
|
elseif (stripos($name,'open')!==false){$surfix='开发者平台';}
|
||
|
|
||
|
define('M_TITLE',$sup['title'].'('.$surfix.')');
|
||
|
} else {
|
||
|
$url = 'Article/index';
|
||
|
define('M_TITLE','文档列表');
|
||
|
}
|
||
|
define('M_URL',$url);
|
||
|
define('COMMONSET',M('Kuaijieicon')->where(['url'=>$url,'status'=>1])->find());
|
||
|
|
||
|
|
||
|
|
||
|
$this->assign('cateID',$_REQUEST['cate_id']);
|
||
|
$this->assign('title',$title);
|
||
|
$this->assign('tree', $list);
|
||
|
$this->display('Widget:CateGroupTree');
|
||
|
}
|
||
|
}
|