prepare($sql); $stmh->execute(); while($row = $stmh->fetch(PDO::FETCH_ASSOC)) { if($row["division"] =='경동' || $row["division"] =='주일') { array_push($name_arr, $row["name"]); array_push($id_arr, $row["id"]); array_push($eworks_lv_arr, $row["eworks_lv"]); array_push($part_arr, $row["division"]); array_push($position_arr, $row["position"]); } } } catch (PDOException $Exception) { print "오류: ".$Exception->getMessage(); } // var_dump($eworks_lv_arr); // 결재권자 배열 넣기 $firstStep = array(); $firstStepID = array(); for($i=0;$i 0 AND status != 'send')" . ") " . "AND is_deleted IS NULL AND status != 'end' AND status != 'reject' AND status != 'wait'" . $viewcon; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'ing': // 진행중인 경우 $all = "(author_id = '$user_id' OR CONCAT('!', e_line_id, '!') LIKE '%!{$user_id}!%') " . "AND CONCAT('!', e_confirm_id, '!') LIKE '%!{$user_id}!%' " . "AND is_deleted IS NULL AND status != 'end' AND status != 'reject' AND status != 'wait' AND status != 'noend'" . $viewcon; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'end': // 결재완료인 경우 $all = "CONCAT('!', e_line_id, '!') LIKE '%!{$user_id}!%' AND CONCAT('!', e_confirm_id, '!') LIKE '%!{$user_id}!%' AND is_deleted IS NULL AND status = 'end'" . $viewcon ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'reject': // 반려인 경우 $all = "CONCAT('!', e_line_id, '!') LIKE '%!{$user_id}!%' AND status = 'reject' AND is_deleted IS NULL" . $viewcon ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'wait': // 보류인 경우 $all = "CONCAT('!', e_line_id, '!') LIKE '%!{$user_id}!%' AND status = 'wait' AND is_deleted IS NULL" . $viewcon ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'refer': // 참조인 경우 $all = "CONCAT('!', e_line_id, '!') LIKE '%!{$user_id}!%' AND status = 'refer' AND is_deleted IS NULL" . $viewcon ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'trash': // trash $all = " is_deleted IS NULL" . $viewconNone ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; // 기타 다른 상태들을 여기에 추가할 수 있습니다. } } else { // 결재권자가 아닌경우 // 상태별 조건 설정 switch($eworksel) { case 'draft': $where = "WHERE author_id = '$user_id' AND status = '$eworksel' AND is_deleted IS NULL" . $viewcon ; $andwhere = "AND author_id = '$user_id' AND status = '$eworksel' AND is_deleted IS NULL" . $viewcon ; break; case 'send': // 첫 번째 결재권자이며, 문서 상태가 '상신'인 경우 $all = "CONCAT('!', author_id, '!') LIKE '%!{$user_id}!%' " . "AND status = 'send' " . // 문서 상태가 '상신' send인 경우 수정 "AND is_deleted IS NULL " . $viewcon; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'noend': // 미결인 경우 // 첫 번째 결재권자에 대해 '상신' 상태를 '미결'로 처리 // 그리고 나머지 결재권자에 대해서는 다음 결재자가 되는 경우를 처리 $all = "CONCAT('!', author_id, '!') LIKE '%!{$user_id}!%' " . "AND ( " . " (CONCAT('!', e_confirm_id, '!') = '!!' AND LOCATE('{$user_id}', author_id) = 1 AND status = 'send') " . " OR " . " (CONCAT('!', e_confirm_id, '!') NOT LIKE '%!{$user_id}!%' AND INSTR(CONCAT('!', author_id, '!'), CONCAT('!', SUBSTRING_INDEX(e_confirm_id, '!', -1), '!', '{$user_id}', '!')) > 0 AND status != 'send')" . ") " . "AND is_deleted IS NULL AND status != 'end' AND status != 'reject' AND status != 'wait'" . $viewcon; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'ing': // 진행중인 경우 $all = "(author_id = '$user_id' OR CONCAT('!', author_id, '!') LIKE '%!{$user_id}!%') " . "AND is_deleted IS NULL AND status != 'end' AND status != 'reject' AND status != 'wait' AND status != 'noend'" . $viewcon; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'end': // 결재완료인 경우 $all = "CONCAT('!', author_id, '!') LIKE '%!{$user_id}!%' AND is_deleted IS NULL AND status = 'end'" . $viewcon ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'reject': // 반려인 경우 $all = "CONCAT('!', author_id, '!') LIKE '%!{$user_id}!%' AND status = 'reject' AND is_deleted IS NULL" . $viewcon ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'wait': // 보류인 경우 $all = "CONCAT('!', author_id, '!') LIKE '%!{$user_id}!%' AND status = 'wait' AND is_deleted IS NULL" . $viewcon ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'refer': // 참조인 경우 $all = "CONCAT('!', author_id, '!') LIKE '%!{$user_id}!%' AND status = 'refer' AND is_deleted IS NULL" . $viewcon ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; case 'trash': // trash $all = " is_deleted IS NULL" . $viewconNone ; $where = "WHERE " . $all; $andwhere = "AND " . $all; break; // 기타 다른 상태들을 여기에 추가할 수 있습니다. } } // 결재자인 경우는 결재가 진행된 것 완료된 것등 구분해서 표시해야 한다. $orderby=" order by registdate desc "; $a= " " . $orderby . " limit $first_num, $scale"; $b= " " . $orderby ; // $total_row 계산 if ($EworksSearch == "") { $sqlcon = "select * from $DB.eworks " . $where; } elseif ($EworksSearch != "") { $sqlcon = "select * from $DB.eworks where ((e_title like '%$EworksSearch%') or (contents like '%$EworksSearch%') or (e_line like '%$EworksSearch%') or (r_line like '%$EworksSearch%')) " . $andwhere; } try { $allstmh = $pdo->query($sqlcon); $total_row = $allstmh->rowCount(); } catch (PDOException $Exception) { print "오류: " . $Exception->getMessage(); } // 페이지 계산 로직 if ($total_row <= $scale) { $eworksPage = 1; } else { if ($total_row < ($eworksPage - 1) * $scale) { $eworksPage = 1; } } $first_num = ($eworksPage - 1) * $scale; // SQL 쿼리 문장 구성 $a= " " . $orderby . " limit $first_num, $scale"; if ($EworksSearch == "") { $sql = "select * from $DB.eworks " . $where . $a; } elseif ($EworksSearch != "") { $sql = "select * from $DB.eworks where ((e_title like '%$EworksSearch%') or (contents like '%$EworksSearch%') or (e_line like '%$EworksSearch%') or (r_line like '%$EworksSearch%')) " . $andwhere . $a; } try{ $allstmh = $pdo->query($sqlcon); // 검색 조건에 맞는 쿼리 전체 개수 $temp2=$allstmh->rowCount(); $stmh = $pdo->query($sql); // 검색조건에 맞는글 stmh $total_row = $temp2; // 전체 글수 // 페이지가 넘어간 경우는 1페이지로 만들어주는 로직 if($total_row < ($eworksPage-1) * $scale) $eworksPage = 1; $total_page = ceil($total_row / $scale); // 검색 전체 페이지 블록 수 $current_page = ceil($eworksPage/$page_scale); //현재 페이지 블록 위치계산 if ($eworksPage<1) $start_num=$total_row; // 페이지당 표시되는 첫번째 글순번 else $start_num=$total_row-($eworksPage-1) * $scale; $count = $stmh->rowCount(); if($count<1){ print '
자료가 없습니다.
'; } else { $start_num = 0; while($row = $stmh->fetch(PDO::FETCH_ASSOC)) { include $_SERVER['DOCUMENT_ROOT'] . "/eworks/_row.php"; switch ($status) { case 'draft' : $statusStr = "작성"; break; case 'send' : $statusStr = "상신"; break; case 'noend' : $statusStr = "미결"; break; case 'ing' : $statusStr = "진행"; break; case 'end' : $statusStr = "결재완료"; break; case 'reject' : $statusStr = "반려"; break; case 'wait' : $statusStr = "보류"; break; case 'refer' : $statusStr = "참조"; break; } $prograssStr = ''; //print $e_line; $arr = explode("!",$e_line_id); $arr_str = explode("!",$e_line); // 결재시간 추출해서 조합하기 $approval_time = explode("!",$e_confirm_id); $approval_str = explode("!",$e_confirm); for($i=0;$i'; else $prograssStr .= $arr_str[$i] . " " . '
'; // print count($approval_time); $e_viewexcept_id_value = explode("!",$e_viewexcept_id); $e_viewexcept_exist = 0; if (in_array($user_id, $e_viewexcept_id_value)) $e_viewexcept_exist = 1; // print $sql; if($start_num<1) { $Eworks_record_num = 0; ?>
10 ? mb_substr($r_line, 0, 8) . '...' : $r_line; ?> getMessage(); } // 페이지 구분 블럭의 첫 페이지 수 계산 ($start_page) $start_page = ($current_page - 1) * $page_scale + 1; // 페이지 구분 블럭의 마지막 페이지 수 계산 ($end_page) $end_page = $start_page + $page_scale - 1; ?>
구분 작성일시 기간 작성자 현재상태 결재진행 참조자 제목 복구
: ~
(일)
$page_scale){ $prev_page = $eworksPage - $page_scale; // 이전 페이지값은 해당 페이지 수에서 리스트에 표시될 페이지수 만큼 감소 if($prev_page <= 0) $prev_page = 1; // 만약 감소한 값이 0보다 작거나 같으면 1로 고정 print '  ' ; } for($i=$start_page; $i<=$end_page && $i<= $total_page; $i++) { // [1][2][3] 페이지 번호 목록 출력 if($eworksPage==$i) // 현재 위치한 페이지는 링크 출력을 하지 않도록 설정. print ' ' . $i . ' '; else print '  ' ; } if($eworksPage<$total_page){ $next_page = $eworksPage + $page_scale; if($next_page > $total_page) $next_page = $total_page; print '  ' ; } ?>