@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//插件信息
|
||||
return array(
|
||||
'hook'=>'home_index_header', //钩子
|
||||
'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,126 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$strAbout = fileRead('plugins/home/slide/about.php');
|
||||
|
||||
//插件编辑
|
||||
switch($ts){
|
||||
case "set":
|
||||
|
||||
|
||||
|
||||
$arrSlide = $new[$app]->findAll('slide',null,'slideid asc');
|
||||
|
||||
foreach($arrSlide as $key=>$item){
|
||||
if($GLOBALS['TS_SITE']['file_upload_type']==1){
|
||||
$arrSlide[$key]['photo_url'] = $GLOBALS['TS_SITE']['alioss_bucket_url'].'/uploadfile/slide/'.$item['photo'].'?v='.$item['addtime'];
|
||||
}else{
|
||||
$arrSlide[$key]['photo_url'] = SITE_URL.'uploadfile/slide/'.$item['photo'].'?v='.$item['addtime'];
|
||||
}
|
||||
}
|
||||
|
||||
include template('edit_set','slide');
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
|
||||
$typeid = intval($_POST['typeid']);
|
||||
$title = tsTrim($_POST['title']);
|
||||
$info = tsTrim($_POST['info']);
|
||||
$url = tsTrim($_POST['url']);
|
||||
|
||||
$slideid = $new[$app]->create('slide',array(
|
||||
'typeid'=>$typeid,
|
||||
'title'=>$title,
|
||||
'info'=>$info,
|
||||
'url'=>$url,
|
||||
'addtime'=>time(),
|
||||
));
|
||||
|
||||
|
||||
//上传
|
||||
$arrUpload = tsUpload($_FILES['photo'],$slideid,'slide',array('jpg','gif','png','jpeg'));
|
||||
|
||||
if($arrUpload){
|
||||
|
||||
$new[$app]->update('slide',array(
|
||||
'slideid'=>$slideid,
|
||||
),array(
|
||||
'path'=>$arrUpload['path'],
|
||||
'photo'=>$arrUpload['url'],
|
||||
));
|
||||
}
|
||||
|
||||
header('Location: '.SITE_URL.'index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=set');
|
||||
break;
|
||||
|
||||
case "edit":
|
||||
|
||||
$slideid = intval($_GET['slideid']);
|
||||
|
||||
$strSlide = $new[$app]->find('slide',array(
|
||||
'slideid'=>$slideid,
|
||||
));
|
||||
|
||||
|
||||
include template('edit_edit','slide');
|
||||
break;
|
||||
|
||||
case "editdo":
|
||||
|
||||
$slideid = intval($_POST['slideid']);
|
||||
$typeid = intval($_POST['typeid']);
|
||||
$title = tsTrim($_POST['title']);
|
||||
$info = tsTrim($_POST['info']);
|
||||
$url = tsTrim($_POST['url']);
|
||||
|
||||
$new[$app]->update('slide',array(
|
||||
'slideid'=>$slideid,
|
||||
),array(
|
||||
'typeid'=>$typeid,
|
||||
'title'=>$title,
|
||||
'info'=>$info,
|
||||
'url'=>$url,
|
||||
));
|
||||
|
||||
|
||||
//上传
|
||||
$arrUpload = tsUpload($_FILES['photo'],$slideid,'slide',array('jpg','gif','png','jpeg'));
|
||||
|
||||
if($arrUpload){
|
||||
|
||||
$new[$app]->update('slide',array(
|
||||
'slideid'=>$slideid,
|
||||
),array(
|
||||
'path'=>$arrUpload['path'],
|
||||
'photo'=>$arrUpload['url'],
|
||||
'addtime'=>time(),
|
||||
));
|
||||
|
||||
tsDimg($arrUpload['url'],'slide','748','210',$arrUpload['path']);
|
||||
|
||||
}
|
||||
|
||||
header('Location: '.SITE_URL.'index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=set');
|
||||
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
|
||||
$slideid = intval($_GET['slideid']);
|
||||
|
||||
$strSlide = $new[$app]->find('slide',array(
|
||||
'slideid'=>$slideid,
|
||||
));
|
||||
|
||||
unlink('uploadfile/slide/'.$strSlide['photo']);
|
||||
|
||||
$new[$app]->delete('slide',array(
|
||||
'slideid'=>$slideid,
|
||||
));
|
||||
|
||||
header('Location: '.SITE_URL.'index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=set');
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
<div class="midder">
|
||||
|
||||
|
||||
{include pubTemplate("plugin_menu")}
|
||||
|
||||
<div>
|
||||
|
||||
|
||||
<form enctype="multipart/form-data" method="POST" action="{SITE_URL}index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=editdo">
|
||||
|
||||
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
<tr><td>类型:</td><td>
|
||||
|
||||
<select name="typeid">
|
||||
<option value="0" {if $strSlide['typeid']==0}selected{/if}>PC端-首页</option>
|
||||
<option value="1" {if $strSlide['typeid']==1}selected{/if}>手机端-首页</option>
|
||||
<option value="2" {if $strSlide['typeid']==2}selected{/if}>手机端-商品首页</option>
|
||||
</select>
|
||||
|
||||
</td></tr>
|
||||
|
||||
<tr><td>标题:</td><td><input name="title" style="width:300px" value="{$strSlide['title']}" /></td></tr>
|
||||
<tr><td>内容:</td><td><input name="info" style="width:300px" value="{$strSlide['info']}" /></td></tr>
|
||||
|
||||
</td></tr>
|
||||
<tr><td>URL:</td><td><input name="url" style="width:300px" value="{$strSlide['url']}" /></td></tr>
|
||||
<tr><td>图片:</td><td>
|
||||
|
||||
{if $strSlide['photo']}
|
||||
<img src="{SITE_URL}uploadfile/slide/{$strSlide['photo']}?v={$strSlide['addtime']}" width="200" />
|
||||
<br />
|
||||
{/if}
|
||||
|
||||
<input type="file" name="photo" /></td></tr>
|
||||
<tr><td></td><td>
|
||||
|
||||
<input type="hidden" name="slideid" value="{$strSlide['slideid']}" />
|
||||
<input type="submit" value="提交" /></td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,63 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
<div class="midder">
|
||||
|
||||
|
||||
{php include pubTemplate("plugin_menu")}
|
||||
|
||||
<div>
|
||||
<form enctype="multipart/form-data" method="POST" action="{SITE_URL}index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=do">
|
||||
<table>
|
||||
<tr><td>类型:</td><td>
|
||||
|
||||
<select name="typeid">
|
||||
<option value="0">PC端-首页</option>
|
||||
<option value="1">手机端-首页</option>
|
||||
<option value="2">手机端-商品首页</option>
|
||||
</select>
|
||||
|
||||
</td></tr>
|
||||
<tr><td>标题:</td><td><input name="title" style="width:600px" /></td></tr>
|
||||
<tr><td>内容:</td><td><input name="info" style="width:600px" /></td></tr>
|
||||
|
||||
<tr><td>URL:</td><td><input name="url" style="width:600px" /></td></tr>
|
||||
|
||||
<tr><td>图片:</td><td><input type="file" name="photo" /><br />
|
||||
(PC端图1110*300;手机端图640*320)</td></tr>
|
||||
<tr><td></td><td><input type="submit" value="提交" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
<thead class="thead-light">
|
||||
<tr><th>ID</th><th>类型</th><th>标题</th><th>URL</th><th>图片</th><th>操作</th></tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
{loop $arrSlide $key $item}
|
||||
<tr class="odd">
|
||||
<td>{$item['slideid']}</td>
|
||||
<td>{$item['typeid']}</td>
|
||||
<td>{$item['title']}</td>
|
||||
<td>{$item['url']}</td>
|
||||
<td><img src="{$item['photo_url']}" width="200" /></td>
|
||||
|
||||
<td>
|
||||
|
||||
<a class="btn btn-sm btn-outline-secondary" href="{SITE_URL}index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=edit&slideid={$item['slideid']}">修改</a>
|
||||
|
||||
|
||||
<a class="btn btn-sm btn-outline-secondary" href="{SITE_URL}index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=delete&slideid={$item['slideid']}">删除</a></td></tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,34 @@
|
||||
<!--幻灯片-->
|
||||
<div id="carouselExampleIndicators" class="carousel slide mb-3" data-ride="carousel">
|
||||
<!-- Indicators -->
|
||||
<ol class="carousel-indicators">
|
||||
{loop $arrSlide $key $item}
|
||||
<li data-target="#carousel-example-generic" data-slide-to="{$key}"{if $key==0} class="active"{/if}></li>
|
||||
{/loop}
|
||||
</ol>
|
||||
|
||||
<!-- Wrapper for slides -->
|
||||
<div class="carousel-inner">
|
||||
{loop $arrSlide $key $item}
|
||||
<div class="carousel-item{if $key==0} active{/if}">
|
||||
<a href="{$item['url']}" title="{$item['title']}">
|
||||
<img class="d-block w-100" src="{$item['photo_url']}" alt="{$item['title']}">
|
||||
<div class="carousel-caption d-none d-md-block text-left" style="top:80px;">
|
||||
<div class="fs36 fw400">{$item['title']}</div>
|
||||
<div class="fs24 fw400">{$item['info']}</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
<!-- Controls -->
|
||||
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
|
||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
|
||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//首页幻灯片插件
|
||||
function slide(){
|
||||
|
||||
$arrSlide = aac('home')->findAll('slide',array(
|
||||
'typeid'=>0,
|
||||
),'addtime desc');
|
||||
|
||||
foreach($arrSlide as $key=>$item){
|
||||
if($GLOBALS['TS_SITE']['file_upload_type']==1){
|
||||
$arrSlide[$key]['photo_url'] = $GLOBALS['TS_SITE']['alioss_bucket_url'].'/uploadfile/slide/'.$item['photo'].'?v='.$item['addtime'];
|
||||
}else{
|
||||
$arrSlide[$key]['photo_url'] = SITE_URL.'uploadfile/slide/'.$item['photo'].'?v='.$item['addtime'];
|
||||
}
|
||||
}
|
||||
|
||||
include template('slide','slide');
|
||||
}
|
||||
|
||||
addAction('home_index_header','slide');
|
||||
Reference in New Issue
Block a user