list.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <script src="/js/xsgl.js"></script>
  2. <script>
  3. $(function(){
  4. //全选
  5. $(".selectAll").click(function(){
  6. if ($(this).prop("checked")) {
  7. $(".myselect").prop("checked",true);
  8. } else {
  9. $(".myselect").prop("checked",false);
  10. }
  11. });
  12. //删除
  13. $(".delClass").click(function(){
  14. // 判断是否有选中
  15. var n_id;
  16. n_id=$(this).attr('id');
  17. layer.msg('删除后未收到通知的用户将不会再收到该通知,\n' +
  18. '\n' +
  19. '确定删除吗?', {
  20. time: 0,
  21. btn: ['确定', '取消'],
  22. yes: function(index){
  23. layer.close(index);
  24. n_id
  25. var data={id:n_id};
  26. $.post("<?php echo Yii::app()->createUrl('notification/deleteNo') ?>", data, function(flags) {
  27. var m = JSON.parse(flags);
  28. if(m.status)
  29. {
  30. layer.msg('操作成功',{time:2000,icon:1},function(){
  31. window.location.reload()
  32. });
  33. }else
  34. {
  35. layer.msg('删除失败');
  36. }
  37. });
  38. }
  39. });
  40. });
  41. $("#btnClose").click(function(){
  42. $(this).parents(".ttd").fadeOut();
  43. location.reload();
  44. });
  45. $(".info").click(function () {
  46. var data={
  47. id:$(this).attr('id'),
  48. };
  49. $.post("<?php echo Yii::app()->createUrl('notification/ajaxGetData') ?>", data, function(flags) {
  50. var m = JSON.parse(flags);
  51. if(m)
  52. {
  53. if(m.status==1){
  54. $('.title').html(m.data.title);
  55. $('.content').html(m.data.content+'<br>'+m.data.files);
  56. $(".ttd").fadeIn();
  57. }
  58. }else
  59. {
  60. layer.msg('数据有误');
  61. }
  62. });
  63. });
  64. $(".push").click(function () {
  65. obj=$(this);
  66. var data={
  67. id:$(this).attr('id'),
  68. };
  69. layer.msg('发布后通知内容将在所有用户登录后展示,\n' +
  70. '\n' +
  71. '确定发布吗?', {
  72. time: 0,
  73. btn: ['确定', '取消'],
  74. yes: function(index){
  75. layer.close(index);
  76. $.post("<?php echo Yii::app()->createUrl('notification/push') ?>", data, function(flags) {
  77. var m = JSON.parse(flags);
  78. if(m)
  79. {
  80. if(m.status==1){
  81. layer.msg('操作成功',{time:2000,icon:1},function(){
  82. window.location.reload()
  83. });
  84. }
  85. }else
  86. {
  87. layer.msg('数据有误');
  88. }
  89. });
  90. }
  91. });
  92. });
  93. $('#addNew').click(function(){
  94. window.location.href='<?php echo $this->createUrl('notification/edit')?>';
  95. });
  96. $('.edit').click(function(){
  97. var id=$(this).attr('id');
  98. window.location.href='<?php echo $this->createUrl('notification/edit')?>?id='+id;
  99. });
  100. $('.close-tips').click(function () {
  101. $(this).parents(".ttd").fadeOut();
  102. location.reload();
  103. })
  104. $('.content').on('click','.atta',function(){
  105. url=$(this).attr('href');
  106. title=$(this).attr('title');
  107. window.location.href='<?php echo $this->createUrl('notification/download')?>?url='+url+'&title='+title;
  108. })
  109. });
  110. </script>
  111. <style>
  112. a.atta{color:#2977ff}
  113. a{color: #ffffff}
  114. a:hover a:active{color: #ffffff}
  115. *{padding:0px;margin:0px;font-family:微软雅黑}
  116. ul,li,ol{list-style-type:none;}
  117. .clearfix:after{clear:both;overflow:hidden;content:"";display:block;}
  118. input ,button{outline:none;}
  119. .position-r{position:relative}
  120. .fl{float:left;}
  121. .fr{float:right;}
  122. .mt5{margin-top:5px;}
  123. .mt10{margin-top:10px;}
  124. .mt20{margin-top:20px;}
  125. .ml15{margin-left:15px;}
  126. .mr15{margin-right:15px;}
  127. .font_bold{font-weight:bold;}
  128. .choseImg{cursor:pointer;}
  129. .ttd{background:url(/images/back-d.png) center repeat;width:100%;height:100%;position:fixed;top:0px;z-index:999}
  130. .s-state{width:780px;background:#fff;height:500px;margin-top: 100px;}
  131. .hint_size{height:45px;width:100%;color:#fff;line-height:45px;margin:0px auto;border-bottom:1px solid #ccc;background-color:#2977ff;}
  132. .mistake_character{text-align:left;color:#606060;font-size:14px;padding:0px 0px 28px 0px;width:90%;margin-bottom:-20px;}
  133. .roger{width:100px;height:35px;border:1px solid #2977ff;background:#2977ff;color:#fff;font-size:16px;cursor:pointer;margin-top: 15px;}
  134. .rogergb{background:#ccc;border:1px solid #ccc;text-align: center}
  135. .allTeacher{width:164px;height:30px;border:1px solid #ccc;border-radius:6px;margin-top:10px;}
  136. button.wordBtn{background:#2977ff;color:#fff;width:120px;height:30px;border:1px solid #2977ff;cursor:pointer;border-radius:4px;margin-left: 15px;}
  137. .gray{
  138. background-color: #999;
  139. color:#fff;
  140. width:60px;
  141. line-height:25px;
  142. text-align: center;
  143. display: inline-block;
  144. }
  145. .green_status{
  146. background-color: #2977ff;
  147. color:#fff;
  148. width:60px;
  149. line-height:25px;
  150. text-align: center;
  151. display: inline-block;
  152. }
  153. .pushed{
  154. background-color: #f0ad4e;
  155. color:#fff;
  156. width:60px;
  157. line-height:25px;
  158. text-align: center;
  159. display: inline-block;
  160. }
  161. .content{
  162. width:100%;
  163. height:390px;
  164. overflow: auto;
  165. padding:15px;
  166. word-wrap:break-word;
  167. }
  168. .close-tips{
  169. margin-right: 15px;
  170. cursor: pointer;
  171. }
  172. .atta_list p{padding: 0;margin:0;line-height: 20px;}
  173. .atta{display: inline-block;margin-left:20px;cursor: pointer}
  174. .red-tips{
  175. color: red;
  176. }
  177. </style>
  178. <div class="main-content-inner">
  179. <div class="page-content">
  180. <div class="row" style="margin:0px;">
  181. <div class="col-xs-12">
  182. <!-- PAGE CONTENT BEGINS -->
  183. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  184. <div class="col-xs-7">
  185. <form method="get" id="form1" action="<?php echo $this->createUrl("notification/list");?>">
  186. <div class="col-xs-12 fl">
  187. <div class="dataTables_length margin-zy">
  188. <input type="text" class="form-control input-sm" placeholder="请输入标题" name="title" >
  189. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  190. </div>
  191. </div>
  192. </form>
  193. </div>
  194. <?php if(isset(Yii::app()->session['testFlag']) && (Yii::app()->session['testFlag']==1)){?>
  195. <div class="col-xs-3 fl" style="margin: 10px;text-align: right;width:40%"> <button id="addNew" class="label-primary-s bth-s" style="padding:4px 12px;">新建通知</button></div>
  196. <?php }?>
  197. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  198. <thead>
  199. <tr>
  200. <th>序号</th>
  201. <th>标题</th>
  202. <th>发布时间</th>
  203. <th>状态</th>
  204. <th>操作</th>
  205. </tr>
  206. </thead>
  207. <tbody>
  208. <?php
  209. if(isset($list) && !empty($list)){
  210. foreach ($list as $k=>$v){
  211. ?>
  212. <tr>
  213. <td><?php echo ($_page*10)-(10-$k-1)?></td>
  214. <td><?php echo $v->title?></td>
  215. <td><?php
  216. if($v->status==2){
  217. echo date('Y-m-d H:i:s',$v->create_time);
  218. }else{
  219. echo '-';
  220. }
  221. ?></td>
  222. <td class="status">
  223. <?php
  224. if($v->status==0){
  225. echo '<span class="gray">已删除</span>';
  226. }elseif($v->status==1){
  227. echo '<span class="green_status">已保存</span>';
  228. }elseif($v->status==2){
  229. echo '<span class="pushed">已发布</span>';
  230. }
  231. ?>
  232. </td>
  233. <td>
  234. <span class="iconfont click-sc addbx info" id="<?php echo $v->id?>" aria-hidden="true" title="查看"><img src="/images/view.png" width="24" ></span>
  235. <?php if(isset(Yii::app()->session['testFlag']) && (Yii::app()->session['testFlag']==1)){?>
  236. <?php if($v->status==1):?>
  237. <span class="iconfont click-sc addbx edit" id="<?php echo $v->id?>" aria-hidden="true" title="编辑">&#xe77d;</span>
  238. <span class="iconfont click-sc addbx push" id="<?php echo $v->id?>" aria-hidden="true" title="发布"><img src="/images/send.png" width="24" ></span>
  239. <?php endif;?>
  240. <?php if($v->status!=0):?>
  241. <span class="iconfont addbx click-delete delClass" id="<?php echo $v->id?>" aria-hidden="true" title="删除">&#xe616;</span>
  242. <?php endif;?>
  243. <?php }?>
  244. </td>
  245. </tr>
  246. <?php
  247. }}else{?>
  248. <tr><td colspan="7">暂无数据!</td></tr>
  249. <?php }?>
  250. </tbody>
  251. </table>
  252. <?php if(isset($page)&&!empty($page)):?>
  253. <div class="row">
  254. <div class="col-xs-7">
  255. <!-- <div class="dataTables_info" id="dynamic-table_info" role="status" aria-live="polite">Showing 1 to 10 of 23 entries</div> -->
  256. </div>
  257. <div class="col-xs-5">
  258. <div class="dataTables_paginate paging_simple_numbers">
  259. <?php
  260. $this->widget('CLinkPager', array(
  261. 'header' => '',
  262. //'selectedPageCssClass' => 'active2', //当前页的class
  263. //'hiddenPageCssClass' => 'disabled2', //禁用页的class
  264. 'firstPageLabel' => '首页',
  265. 'lastPageLabel' => '末页',
  266. 'prevPageLabel' => '上一页',
  267. 'nextPageLabel' => '下一页',
  268. 'pages' => $page,
  269. 'maxButtonCount'=> 5,
  270. ));
  271. ?><?php echo '共:'.$page_total.'条';?>
  272. </div>
  273. </div>
  274. </div>
  275. <?php endif;?>
  276. </div>
  277. <!-- PAGE CONTENT ENDS -->
  278. </div>
  279. </div>
  280. </div>
  281. </div>
  282. <div class="ttd" style="display: none;">
  283. <div class="s-state clearfix posirela">
  284. <div class="hint_size clearfix">
  285. <span class="fl ml15 title" >系统通知</span>
  286. <span class="fr close-tips">X</span>
  287. </div>
  288. <div class="mistake_character clearfix content" style="padding-top: 10px; padding-bottom: 0;">
  289. </div>
  290. <div class="mistake_character clearfix">
  291. <div class="clearfix" style="width:300px;margin:0px auto;text-align: center">
  292. <button class="roger shut" id="btnClose">知道了</button>
  293. </div>
  294. </div>
  295. </div>
  296. </div>