PageRenderTime 49ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/notice_list.php

https://gitlab.com/dev.essetel/sjnuri
PHP | 242 lines | 191 code | 45 blank | 6 comment | 42 complexity | a19a6be3a23033f929b36a44b86bff5b MD5 | raw file
  1. <?php
  2. include_once("./_common.php");
  3. //$g5['title'] = '';
  4. $sub_menu = '300101';
  5. include_once("./admin.head.php");
  6. ?>
  7. <div id="container">
  8. <h1 id="container_title">공지사항</h1>
  9. <div id="container_wr">
  10. <?php
  11. $sql_common = " from app5iu_notice ";
  12. $sql_search = " where (1) ";
  13. if ($stx) {
  14. $sql_search .= " and ( ";
  15. switch ($sfl) {
  16. default:
  17. $sql_search .= " ({$sfl} like '{$stx}%') ";
  18. break;
  19. }
  20. $sql_search .= " ) ";
  21. }
  22. if (!$sst) {
  23. $sst = "n_id";
  24. $sod = "desc";
  25. }
  26. $sql_order = " order by {$sst} {$sod} ";
  27. $sql = " select count(*) as cnt {$sql_common} {$sql_search} {$sql_order} ";
  28. $row = sql_fetch($sql);
  29. $total_count = $row['cnt'];
  30. $rows = $config['cf_page_rows'];
  31. $total_page = ceil($total_count / $rows); // 전체 페이지 계산
  32. if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
  33. $from_record = ($page - 1) * $rows; // 시작 열을 구함
  34. $listall = '<a href="' . $_SERVER['SCRIPT_NAME'] . '" class="ov_listall">전체목록</a>';
  35. $sql = " select * {$sql_common} {$sql_search} {$sql_order} limit {$from_record}, {$rows} ";
  36. $result = sql_query($sql);
  37. // echo $sql;
  38. $colspan = 16;
  39. //전체
  40. $sql = " select count(*) as cnt from app5iu_notice ";
  41. $to_cnt = sql_fetch($sql);
  42. ?>
  43. <style>
  44. .td_mbid,
  45. .td_name,
  46. .td_mbname {
  47. text-align: center !important;
  48. }
  49. </style>
  50. <div class="local_ov01 local_ov">
  51. <?php echo $listall ?>
  52. <a href="./notice_list.php">
  53. <span class="btn_ov01"><span class="ov_txt">전체 </span><span class="ov_num"> <?php echo number_format($to_cnt['cnt']) ?> </span></span>
  54. </a>
  55. </div>
  56. <form id="fsearch" name="fsearch" class="local_sch01 local_sch" method="get">
  57. <label for="sfl" class="sound_only">검색대상</label>
  58. <select name="sfl" id="sfl">
  59. <!-- <option value="mb_id"<?php echo get_selected($sfl, "mb_id"); ?>>회원아이디</option> -->
  60. <option value="n_subject" <?php echo get_selected($sfl, "n_subject"); ?>>제목</option>
  61. <!-- <option value="mb_name"<?php echo get_selected($sfl, "mb_name"); ?>>이름</option> -->
  62. </select>
  63. <label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
  64. <input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input">
  65. <input type="submit" class="btn_submit" value="검색">
  66. <!-- <a href="./notice_list.php" class="reset_url">초기화</a> -->
  67. </form>
  68. <form name="fmemberlist" id="fmemberlist" action="./notice_list_update.php" onsubmit="return fmemberlist_submit(this);" method="post" enctype="multipart/form-data">
  69. <input type="hidden" name="sst" value="<?php echo $sst ?>">
  70. <input type="hidden" name="sod" value="<?php echo $sod ?>">
  71. <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
  72. <input type="hidden" name="stx" value="<?php echo $stx ?>">
  73. <input type="hidden" name="page" value="<?php echo $page ?>">
  74. <input type="hidden" name="token" value="">
  75. <div class="tbl_head01 tbl_wrap">
  76. <h2>
  77. <!--반려된 신청은 다시 승인되지 않습니다.-->
  78. </h2>
  79. <table>
  80. <caption><?php echo $g5['title']; ?> 목록</caption>
  81. <thead>
  82. <tr>
  83. <th scope="col" id="mb_list_chk" rowspan="2">
  84. <label for="chkall" class="sound_only">회원 전체</label>
  85. <input type="checkbox" name="chkall" value"1" id="chkall" onclick="check_all(this.form)">
  86. </th>
  87. <th scope="col" id="" style="width:300px">제목</th>
  88. <!-- <th scope="col" id="" style="width:300px">내용</th> -->
  89. <th scope="col" id="" style="width:200px">파일</th>
  90. <th scope="col" id="">작성일</th>
  91. <th scope="col" id="">조회수</th>
  92. <th scope="col" id="" style="width:100px">수정</th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. <?php
  97. for ($i = 0; $row = sql_fetch_array($result); $i++) {
  98. $bg = 'bg' . ($i % 2);
  99. ?>
  100. <tr class="<?php echo $bg; ?>">
  101. <td headers="mb_list_chk" class="td_chk">
  102. <input type="hidden" name="me_id[<?php echo $i ?>]" value="<?php echo $row['n_id'] ?>" id="me_id_<?php echo $i ?>">
  103. <label for="chk_<?php echo $i; ?>" class="sound_only"><?php echo get_text($row['mb_name']); ?> </label>
  104. <input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>" <?php echo $ch_checkbox ?>>
  105. </td>
  106. <td headers="mb_list_id" class="td_name sv_use">
  107. <?php echo $row['n_subject'] ?>
  108. </td>
  109. <!-- <td headers="mb_list_id" class="td_name sv_use">
  110. <?php echo $row['n_content'] ?>
  111. </td> -->
  112. <td headers="mb_list_id" class="td_name sv_use" style="text-align:center;">
  113. <!-- <?php echo $row['n_file'] ? $row['n_file'] : '-' ?> -->
  114. <?php
  115. //$up_file = $row['n_file'];
  116. // echo $up_file;
  117. $n_id = $row['n_id'];
  118. $sql_get_files = "select * from app5iu_notice_file where mf_id = {$n_id};";
  119. $result2 = sql_query($sql_get_files);
  120. for ($j = 0; $row2 = sql_fetch_array($result2); $j++) {
  121. $origin_name = $row2['origin_name'];
  122. $file_name = $row2['file_name'];
  123. $file_type = substr($origin_name, -3);
  124. $icon_type = "";
  125. if ($file_type == 'jpg' || $file_type == 'png' || $file_type == 'gif' || $file_type == 'peg') {
  126. $icon_type = "img";
  127. } else if ($file_type == 'xls' || $file_type == 'lsx') {
  128. $icon_type = "xsl";
  129. } else if ($file_type == 'pdf') {
  130. $icon_type = "pdf";
  131. } else if ($file_type == 'doc') {
  132. $icon_type = "doc";
  133. } else if ($file_type == 'hwp') {
  134. $icon_type = "hwp";
  135. } else if ($file_type == 'ppt' || $file_type == 'ptx') {
  136. $icon_type = "ppt";
  137. } else {
  138. $icon_type = "etc";
  139. }
  140. // echo "<a href='iium/file_download.php?path=iu_notice&original={$origin_name}&name={$file_name}'><img src='./img/{$icon_type}.png' width='28px' height='32px' alt='{$origin_name}' /></a>";
  141. echo "<a href='/iium/file_download.php?path=iu_notice&original={$origin_name}&name={$file_name}'><img src='./img/{$icon_type}.png' width='28px' height='32px' alt='{$origin_name}' /></a>";
  142. }
  143. ?>
  144. </td>
  145. <td headers="mb_list_join" class="td_date"><?php echo substr($row['n_wdate'], 0, 10); ?></td>
  146. <td headers="mb_list_id" class="td_name sv_use">
  147. <?php echo $row['n_count'] ?>
  148. </td>
  149. <td>
  150. <a href="./notice_write.php?me_id=<?php echo $row['n_id'] ?>&sfl=<?php echo $sfl ?>&stx=<?php echo $stx ?>&page=<?php echo $page ?>">
  151. <button type="button" class="btn btn_02"> 수정 </button>
  152. </a>
  153. </td>
  154. </tr>
  155. <?php
  156. }
  157. if ($i == 0)
  158. echo "<tr><td colspan=\"" . $colspan . "\" class=\"empty_table\">자료가 없습니다.</td></tr>";
  159. ?>
  160. </tbody>
  161. </table>
  162. </div>
  163. <div class="btn_fixed_top">
  164. <input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_03">
  165. <a href="notice_write.php?me_id=&sfl=<?php echo $sfl ?>&stx=<?php echo $stx ?>&page=<?php echo $page ?>">
  166. <input type="button" name="act_button" value="등록" onclick="document.pressed=this.value" class="btn btn_01">
  167. </a>
  168. <!--
  169. <input type="submit" name="act_button" value="선택취소" onclick="document.pressed=this.value" class="btn btn_02">
  170. <input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value" class="btn btn_01">
  171. -->
  172. </div>
  173. </form>
  174. <?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, '?' . $qstr . '&amp;page='); ?>
  175. <script>
  176. function fmemberlist_submit(f) {
  177. if (!is_checked("chk[]")) {
  178. alert(document.pressed + " 하실 항목을 하나 이상 선택하세요.");
  179. return false;
  180. }
  181. if (document.pressed == "선택삭제") {
  182. if (!confirm("선택한 신청을 정말 삭제 하시겠습니까?")) {
  183. return false;
  184. }
  185. }
  186. return true;
  187. }
  188. $('.btn_submit').click(function() {
  189. if ($('#stx').val() == '') {
  190. location.href = './notice_list.php';
  191. }
  192. })
  193. </script>
  194. </div>
  195. </div>
  196. <?php
  197. include_once("./admin.tail.php");