人人商城

news.tpl.php 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 0) ? (include $this->template('common/header', TEMPLATE_INCLUDEPATH)) : (include template('common/header', TEMPLATE_INCLUDEPATH));?>
  2. <?php (!empty($this) && $this instanceof WeModuleSite || 0) ? (include $this->template('article/common', TEMPLATE_INCLUDEPATH)) : (include template('article/common', TEMPLATE_INCLUDEPATH));?>
  3. <?php if($do == 'list') { ?>
  4. <div class="clearfix">
  5. <form action="" method="get" class="we7-form" role="form">
  6. <input type="hidden" name="c" value="article">
  7. <input type="hidden" name="a" value="news">
  8. <input type="hidden" name="do" value="list">
  9. <input type="hidden" name="cateid" value="<?php echo $_GPC['cateid'];?>">
  10. <input type="hidden" name="createtime" value="<?php echo $_GPC['createtime'];?>">
  11. <div class="form-group">
  12. <label class="col-sm-2 control-label">新闻分类</label>
  13. <div class="form-controls col-sm-8">
  14. <div class="btn-group we7-btn-group">
  15. <a href="<?php echo filter_url('cateid:0');?>" class="btn <?php if($_GPC['cateid'] == 0) { ?>btn-primary<?php } else { ?>btn-default<?php } ?>">不限</a>
  16. <?php if(is_array($categorys)) { foreach($categorys as $category) { ?>
  17. <a href="<?php echo filter_url('cateid:' . $category['id']);?>" class="btn <?php if($_GPC['cateid'] == $category['id']) { ?>btn-primary<?php } else { ?>btn-default<?php } ?>"><?php echo $category['title'];?></a>
  18. <?php } } ?>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="form-group">
  23. <label class="col-sm-2 control-label">添加时间</label>
  24. <div class="form-controls col-sm-8">
  25. <div class="btn-group we7-btn-group">
  26. <a href="<?php echo filter_url('createtime:0');?>" class="btn <?php if($_GPC['createtime'] == 0) { ?>btn-primary<?php } else { ?>btn-default<?php } ?>">不限</a>
  27. <a href="<?php echo filter_url('createtime:3');?>" class="btn <?php if($_GPC['createtime'] == 3) { ?>btn-primary<?php } else { ?>btn-default<?php } ?>">三天内</a>
  28. <a href="<?php echo filter_url('createtime:7');?>" class="btn <?php if($_GPC['createtime'] == 7) { ?>btn-primary<?php } else { ?>btn-default<?php } ?>">一周内</a>
  29. <a href="<?php echo filter_url('createtime:30');?>" class="btn <?php if($_GPC['createtime'] == 30) { ?>btn-primary<?php } else { ?>btn-default<?php } ?>">一月内</a>
  30. <a href="<?php echo filter_url('createtime:90');?>" class="btn <?php if($_GPC['createtime'] == 90) { ?>btn-primary<?php } else { ?>btn-default<?php } ?>">三月内</a>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="form-group">
  35. <label class="col-sm-2 control-label">标题</label>
  36. <div class="input-group col-sm-4 pull-left">
  37. <input class="form-control" name="title" id="" type="text" value="<?php echo $_GPC['title'];?>">
  38. <div class="input-group-btn">
  39. <button class="btn btn-default"><i class="fa fa-search"></i> </button>
  40. </div>
  41. </div>
  42. <div class="pull-right">
  43. <a href="javascript:;" data-toggle="modal" data-target="#displaysetting" class="btn btn-primary">排序设置</a>
  44. <a href="<?php echo url('article/news/post');?>" class="btn btn-primary">添加新闻</a>
  45. </div>
  46. </div>
  47. </form>
  48. <table class="table we7-table table-hover">
  49. <col width="80px"/>
  50. <col width="90px"/>
  51. <col width="150px"/>
  52. <col width="100px"/>
  53. <col width="90px"/>
  54. <col width="80px"/>
  55. <col width="140px"/>
  56. <col width="120px"/>
  57. <tr>
  58. <th>排序</th>
  59. <th>阅读次数</th>
  60. <th>标题</th>
  61. <th>所属分类</th>
  62. <th>在首页显示</th>
  63. <th>是否显示</th>
  64. <th>添加时间</th>
  65. <th class="text-right">操作</th>
  66. </tr>
  67. <?php if(is_array($news)) { foreach($news as $new) { ?>
  68. <tr>
  69. <td>
  70. <span><?php echo $new['displayorder'];?></span>
  71. </td>
  72. <td>
  73. <span><?php echo $new['click'];?></span>
  74. </td>
  75. <td>
  76. <span><?php echo $new['title'];?></span>
  77. </td>
  78. <td><?php echo $categorys[$new['cateid']]['title'];?></td>
  79. <td>
  80. <?php if($new['is_show_home'] == 1) { ?>
  81. <span class="label label-success">是</span>
  82. <?php } else { ?>
  83. <span class="label label-danger">否</span>
  84. <?php } ?>
  85. </td>
  86. <td>
  87. <?php if($new['is_display'] == 1) { ?>
  88. <span class="label label-success">显示中</span>
  89. <?php } else { ?>
  90. <span class="label label-danger">已隐藏</span>
  91. <?php } ?>
  92. </td>
  93. <td class=""><?php echo date('Y-m-d H:i', $new['createtime']);?></td>
  94. <td>
  95. <div class="link-group">
  96. <a href="<?php echo url('article/news/post', array('id' => $new['id']));?>">编辑</a>
  97. <a href="<?php echo url('article/news/del', array('id' => $new['id']));?>" class="del" onclick="if(!confirm('确定删除吗')) return false;">删除</a>
  98. </div>
  99. </td>
  100. </tr>
  101. <?php } } ?>
  102. </table>
  103. <div class="modal fade" id="displaysetting" tabindex="-1" role="dialog" aria-hidden="true">
  104. <div class="we7-modal-dialog modal-dialog we7-form">
  105. <div class="modal-content">
  106. <div class="modal-header">
  107. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  108. <div class="modal-title">修改新闻排序设置</div>
  109. </div>
  110. <form action="" method="get">
  111. <input type="hidden" name="c" value="article">
  112. <input type="hidden" name="a" value="news">
  113. <input type="hidden" name="do" value="displaysetting">
  114. <div class="modal-body">
  115. <div class="form-group">
  116. <select name="setting" class="we7-select">
  117. <option value="order">按排序数字大小倒序</option>
  118. <option value="createtime">按添加时间倒序</option>
  119. </select>
  120. <span class="help-block"></span>
  121. </div>
  122. </div>
  123. <div class="modal-footer">
  124. <button name="submit" class="btn btn-primary" value="submit">确定</button>
  125. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  126. </div>
  127. </form>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="text-right">
  132. <?php echo $pager;?>
  133. </div>
  134. </div>
  135. <?php } else if($do == 'post') { ?>
  136. <div class="clearfix">
  137. <form action="<?php echo url('article/news/post');?>" method="post" class="we7-form" role="form" id="form1">
  138. <input type="hidden" name="id" value="<?php echo $new['id'];?>"/>
  139. <div class="form-group">
  140. <label class="col-sm-2 control-label">新闻标题</label>
  141. <div class="col-sm-8">
  142. <input type="text" class="form-control" name="title" value="<?php echo $new['title'];?>" placeholder="新闻标题"/>
  143. <div class="help-block">请填写新闻标题</div>
  144. </div>
  145. </div>
  146. <div class="form-group">
  147. <label class="col-sm-2 control-label">新闻分类</label>
  148. <div class="col-sm-8">
  149. <select name="cateid" id="cateid" class="form-control">
  150. <option value="">==请选择新闻分类==</option>
  151. <?php if(is_array($categorys)) { foreach($categorys as $category) { ?>
  152. <option value="<?php echo $category['id'];?>" <?php if($new['cateid'] == $category['id']) { ?>selected<?php } ?>><?php echo $category['title'];?></option>
  153. <?php } } ?>
  154. </select>
  155. <div class="help-block">还没有分类,点我 <a href="<?php echo url('article/news/category_post');?>" target="_blank"><i class="fa fa-plus-circle"></i> 添加分类</a></div>
  156. </div>
  157. </div>
  158. <div class="form-group">
  159. <label class="col-sm-2 control-label">缩略图</label>
  160. <div class="col-sm-8">
  161. <?php echo tpl_form_field_image('thumb', $new['thumb'], '', array('dest_dir' => 'articles'));?>
  162. </div>
  163. </div>
  164. <div class="form-group">
  165. <label class="col-sm-2 control-label"></label>
  166. <div class="col-sm-8">
  167. <div class="help-block"><input type="checkbox" id="autolitpic" name="autolitpic" value="1"<?php if(empty($item['thumb'])) { ?> checked="true"<?php } ?>><><label for="autolitpic">提取内容的第一个图片为缩略图</label></div>
  168. </div>
  169. </div>
  170. <div class="form-group">
  171. <label class="col-sm-2 control-label">内容</label>
  172. <div class="col-sm-8">
  173. <?php echo tpl_ueditor('content', $new['content']);?>
  174. </div>
  175. </div>
  176. <div class="form-group">
  177. <label class="col-sm-2 control-label">新闻来源</label>
  178. <div class="col-sm-8">
  179. <input type="text" class="form-control" name="source" value="<?php echo $new['source'];?>" placeholder="新闻来源"/>
  180. </div>
  181. </div>
  182. <div class="form-group">
  183. <label class="col-sm-2 control-label">新闻作者</label>
  184. <div class="col-sm-8">
  185. <input type="text" class="form-control" name="author" value="<?php echo $new['author'];?>" placeholder="新闻作者"/>
  186. </div>
  187. </div>
  188. <div class="form-group">
  189. <label class="col-sm-2 control-label">阅读次数</label>
  190. <div class="col-sm-8">
  191. <input type="text" class="form-control" name="click" value="<?php echo $new['click'];?>" placeholder="阅读次数"/>
  192. <div class="help-block">默认为0。您可以设置一个初始值,阅读次数会在该初始值上增加。</div>
  193. </div>
  194. </div>
  195. <div class="form-group">
  196. <label class="col-sm-2 control-label">排序</label>
  197. <div class="col-sm-8">
  198. <input type="text" class="form-control" name="displayorder" value="<?php echo $new['displayorder'];?>" placeholder="阅读次数"/>
  199. <div class="help-block">数字越大,越靠前。</div>
  200. </div>
  201. </div>
  202. <div class="form-group">
  203. <label class="col-sm-2 control-label">是否显示</label>
  204. <div class="col-sm-8">
  205. <input id="is_display-1" type="radio" name="is_display" value="1" <?php if($new['is_display'] == 1) { ?> checked<?php } ?>> <label for="is_display-1">显示</label>
  206. <input id="is_display-2" type="radio" name="is_display" value="0" <?php if($new['is_display'] == 0) { ?> checked<?php } ?>> <label for="is_display-2">不显示</label>
  207. </div>
  208. </div>
  209. <div class="form-group">
  210. <label class="col-sm-2 control-label">显示在首页</label>
  211. <div class="col-sm-8">
  212. <input type="radio" id="is_show_home-1" name="is_show_home" value="1" <?php if($new['is_show_home'] == 1) { ?> checked<?php } ?>><label class="radio-inline" for="is_show_home-1"> 是</label>
  213. <input type="radio" id="is_show_home-2" name="is_show_home" value="0" <?php if($new['is_show_home'] == 0) { ?> checked<?php } ?>><label class="radio-inline" for="is_show_home-1"> 否</label>
  214. </div>
  215. </div>
  216. <div class="form-group">
  217. <div class="">
  218. <input type="submit" class="btn btn-primary" name="submit" value="提交" />
  219. <input type="hidden" name="token" value="<?php echo $_W['token'];?>" />
  220. </div>
  221. </div>
  222. </form>
  223. </div>
  224. <?php } ?>
  225. <script>
  226. $(function(){
  227. $('#form1').submit(function(){
  228. if(!$.trim($(':text[name="title"]').val())) {
  229. util.message('请填写新闻标题', '', 'error');
  230. return false;
  231. }
  232. if(!$.trim($('#cateid').val())) {
  233. util.message('请选择新闻分类', '', 'error');
  234. return false;
  235. }
  236. if(!$.trim($('textarea[name="content"]').val())) {
  237. util.message('请填写新闻内容', '', 'error');
  238. return false;
  239. }
  240. return true;
  241. });
  242. });
  243. </script>
  244. <?php (!empty($this) && $this instanceof WeModuleSite || 0) ? (include $this->template('common/footer', TEMPLATE_INCLUDEPATH)) : (include template('common/footer', TEMPLATE_INCLUDEPATH));?>