@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//插件信息
|
||||
return array(
|
||||
'hook'=>'home_index_left', //钩子
|
||||
'name' => '推荐话题列表',
|
||||
'version' => '1.0',
|
||||
'desc' => '推荐话题列表',
|
||||
'url' => 'http://www.thinksaas.cn',
|
||||
'email' => 'thinksaas@qq.com',
|
||||
'author' => '邱君',
|
||||
'author_url' => 'http://www.thinksaas.cn',
|
||||
'isedit' => '1',
|
||||
);
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
//插件编辑
|
||||
switch($ts){
|
||||
case "set":
|
||||
|
||||
$strAbout = fileRead('plugins/home/recommendtopic/about.php');
|
||||
|
||||
$strData = fileRead('data/plugins_home_recommendtopic.php');
|
||||
if($strData==''){
|
||||
$strData = $GLOBALS['tsMySqlCache']->get('plugins_home_recommendtopic');
|
||||
}
|
||||
|
||||
include template('edit_set','recommendtopic');
|
||||
break;
|
||||
|
||||
case "do":
|
||||
$isrecommend = intval($_POST['isrecommend']);
|
||||
|
||||
$strData = array(
|
||||
'isrecommend'=>$isrecommend,
|
||||
);
|
||||
|
||||
fileWrite('plugins_home_recommendtopic.php','data',$strData);
|
||||
$tsMySqlCache->set('plugins_home_recommendtopic',$strData);
|
||||
|
||||
header('Location: '.SITE_URL.'index.php?app=home&ac=plugin&plugin=recommendtopic&in=edit&ts=set');
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
|
||||
<div class="midder">
|
||||
|
||||
{php include pubTemplate("plugin_menu")}
|
||||
|
||||
<form method="POST" action="{SITE_URL}index.php?app=home&ac=plugin&plugin=recommendtopic&in=edit&ts=do">
|
||||
<table class="table table-hover">
|
||||
|
||||
<tr><td>内容获取方式:</td><td>
|
||||
|
||||
<input type="radio" name="isrecommend" value="0" {if $strData['isrecommend']==0}checked{/if}> 最新内容
|
||||
<input type="radio" name="isrecommend" value="1" {if $strData['isrecommend']==1}checked{/if}> 推荐内容
|
||||
|
||||
</td></tr>
|
||||
|
||||
<tr><td></td><td><input type="submit" value="提交修改" /></td></tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,86 @@
|
||||
<div class="card">
|
||||
<div class="card-header">推荐话题</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
{if $arrTopic}
|
||||
|
||||
<div class="topic_list">
|
||||
<ul>
|
||||
{loop $arrTopic $key $item}
|
||||
<li>
|
||||
<div class="userimg"><a href="{tsUrl('user','space',array('id'=>$item['user']['userid']))}"><img class="rounded-circle" src="{$item['user']['face']}" width="32" height="32" alt="{$item['user']['username']}" title="{$item['user']['username']}" /></a></div>
|
||||
|
||||
<div class="topic_title">
|
||||
<div class="title">
|
||||
|
||||
{if $item['label']}<span class="badge badge-danger fw300">{tsTitle($item['label'])}</span>{/if}
|
||||
|
||||
<a href="{tsUrl('topic','show',array('id'=>$item['topicid']))}">{$item[title]}</a>
|
||||
|
||||
{if $item['istop']=='1'}
|
||||
<img src="{SITE_URL}public/images/ding.png" width="24" height="24" title="[置顶]" alt="[置顶]" />
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
{if $item['group']['isopen']==0 && $item['score']==0 && $item['iscommentshow']==0}
|
||||
<div class="gaiyao mt-2">
|
||||
{$item['gaiyao']}
|
||||
</div>
|
||||
|
||||
<!--图片-->
|
||||
{if $item['ptable']=='' && $item['pjson']}
|
||||
<div class="photo mt-2">
|
||||
{loop $item['pjson'] $pkey $pitem}
|
||||
<a href="{tsUrl('topic','show',array('id'=>$item['topicid']))}"><img src="{$pitem}" /></a>
|
||||
{/loop}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!--视频-->
|
||||
{if $item['ptable']=='video' && $item['pjson']['siteid']==0}
|
||||
<div>
|
||||
{if $item['pjson']['photo']}
|
||||
<a href="{tsUrl('topic','show',array('id'=>$item['topicid']))}"><img class="mw-100" src="{$item['pjson']['photo']}"></a>
|
||||
{else}
|
||||
<video class="mw-100" controls="controls" src="{$item['pjson']['video']}"></video>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{/if}
|
||||
|
||||
|
||||
<div class="d-flex flex-row justify-content-between mt-2">
|
||||
<div class="d-flex fs12 c9">
|
||||
<a href="{tsUrl('user','space',array('id'=>$item['userid']))}">{$item['user']['username']}</a>
|
||||
<span class="ml-1">{php echo getTime($item['uptime'],time())}</span>
|
||||
<span class="ml-1 ts-hide">发表于</span>
|
||||
<a class="ml-1 ts-hide" href="{tsUrl('group','show',array('id'=>$item['groupid']))}">[{$item['group']['groupname']}]</a>
|
||||
</div>
|
||||
<div class="d-flex c9 fs12">
|
||||
<div><i class="bi-chat-text"></i> {$item['count_comment']}</div>
|
||||
<div class="ml-3"><i class="bi bi-eye"></i> {$item['count_view']}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{else}
|
||||
|
||||
<div class="c9">暂无推荐话题</div>
|
||||
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
function recommendtopic(){
|
||||
|
||||
$strData = fileRead('data/plugins_home_recommendtopic.php');
|
||||
if($strData==''){
|
||||
$strData = $GLOBALS['tsMySqlCache']->get('plugins_home_recommendtopic');
|
||||
}
|
||||
|
||||
if($strData['isrecommend']==1){
|
||||
$where = array(
|
||||
'isrecommend'=>1,
|
||||
'isaudit'=>0
|
||||
);
|
||||
}else{
|
||||
$where = array(
|
||||
'isaudit'=>0
|
||||
);
|
||||
}
|
||||
|
||||
//推荐帖子
|
||||
$arrTopic = aac('group')->findAll('topic',$where,'istop desc,uptime desc','topicid,ptable,pkey,pid,pjson,userid,groupid,title,gaiyao,score,label,count_comment,count_view,iscommentshow,istop,uptime',35);
|
||||
|
||||
foreach($arrTopic as $key=>$item){
|
||||
$arrTopic[$key]['title']=tsTitle($item['title']);
|
||||
$arrTopic[$key]['gaiyao']=tsTitle($item['gaiyao']);
|
||||
$arrTopic[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
|
||||
$arrTopic[$key]['group'] = aac('group')->getOneGroup($item['groupid']);
|
||||
#应用扩展
|
||||
if($item['pjson']){
|
||||
$arrTopic[$key]['pjson'] = json_decode($item['pjson'],true);
|
||||
}
|
||||
}
|
||||
|
||||
include template('recommendtopic','recommendtopic');
|
||||
|
||||
}
|
||||
|
||||
function recommendtopic_css(){
|
||||
|
||||
echo '<link href="'.SITE_URL.'plugins/home/recommendtopic/style.css?v=201812251839" rel="stylesheet" type="text/css" />';
|
||||
|
||||
}
|
||||
|
||||
addAction('home_index_left','recommendtopic');
|
||||
addAction('pub_header_top','recommendtopic_css');
|
||||
@@ -0,0 +1,34 @@
|
||||
/*帖子列表*/
|
||||
.topic_list{overflow:hidden;}
|
||||
.topic_list ul, .topic_list ul li{list-style: none;margin:0;padding:0;}
|
||||
.topic_list ul{overflow:hidden;}
|
||||
.topic_list ul li{overflow:hidden;padding:15px 0;display: block;border-bottom: 1px dashed #999999;}
|
||||
|
||||
.topic_list ul li .other{background: none repeat scroll 0 0 #F8F8F8;
|
||||
border-left: 3px solid #EEEEEE;
|
||||
margin-left: 38px;
|
||||
margin-top: 5px;
|
||||
padding: 5px;}
|
||||
.topic_list ul li .other p{margin:0px;padding:5px 0;}
|
||||
|
||||
.topic_list .userimg{float:left;width:38px;overflow:hidden;}
|
||||
|
||||
.topic_list .topic_title{margin-left:40px;overflow:hidden;}
|
||||
|
||||
.topic_list .topic_title .title a{font-size:18px;font-weight: bold;}
|
||||
|
||||
.topic_list .topic_title .gaiyao{color:#999999;}
|
||||
|
||||
.topic_list .topic_title .photo{}
|
||||
.topic_list .topic_title .photo img{max-width: 25%;margin-right: 10px;}
|
||||
|
||||
.topic_list .topic_info{overflow: hidden;font-size:12px;color:#999999;}
|
||||
|
||||
.rank {
|
||||
background: none repeat scroll 0 0 #BBBBBB;
|
||||
height: 15px;
|
||||
line-height: 15px;
|
||||
margin: 0 0 0 5px;
|
||||
padding: 0 3px;
|
||||
border-radius:5px 5px 5px 5px;
|
||||
}
|
||||
Reference in New Issue
Block a user