투표에 사용, 미사용 기능 추가 (크레이티브님,210910) merge

This commit is contained in:
thisgun
2022-07-28 11:51:33 +09:00
parent 463ca06a21
commit 1e6710a55b
6 changed files with 21 additions and 7 deletions

View File

@ -447,6 +447,7 @@ tfoot th {}
.td_delino {width:130px}
.td_device {width:70px;text-align:center}
.td_etc {width:80px;text-align:center}
.td_use {width:80px;text-align:center}
.td_extra label {display:inline-block;width:100px}
.td_extra input {margin-right:5px;width:130px}
.td_grid {width:60px;text-align:center}

View File

@ -23,6 +23,10 @@ if ($w == '') {
alert('w 값이 제대로 넘어오지 않았습니다.');
}
if (!isset($po['po_use'])) {
sql_query(" alter table `{$g5['poll_table']}` add `po_use` tinyint not null default '0' after `mb_ids` ", false);
}
$g5['title'] = $html_title;
require_once './admin.head.php';
?>
@ -94,6 +98,10 @@ require_once './admin.head.php';
</tr>
<?php if ($w == 'u') { ?>
<tr>
<th scope="row">투표사용</th>
<td><input type="checkbox" name="po_use" id="po_use" value="1" <?php if ($po['po_use']) { echo 'checked="checked"'; } ?>> <label for="po_use">사용</label></td>
</tr>
<tr>
<th scope="row">투표등록일</th>
<td><?php echo $po['po_date']; ?></td>

View File

@ -51,8 +51,8 @@ $po_id = isset($_POST['po_id']) ? $_POST['po_id'] : '';
if ($w == '') {
$sql = " insert {$g5['poll_table']}
( po_subject, po_poll1, po_poll2, po_poll3, po_poll4, po_poll5, po_poll6, po_poll7, po_poll8, po_poll9, po_cnt1, po_cnt2, po_cnt3, po_cnt4, po_cnt5, po_cnt6, po_cnt7, po_cnt8, po_cnt9, po_etc, po_level, po_point, po_date )
values ( '{$_POST['po_subject']}', '{$_POST['po_poll1']}', '{$_POST['po_poll2']}', '{$_POST['po_poll3']}', '{$_POST['po_poll4']}', '{$_POST['po_poll5']}', '{$_POST['po_poll6']}', '{$_POST['po_poll7']}', '{$_POST['po_poll8']}', '{$_POST['po_poll9']}', '{$_POST['po_cnt1']}', '{$_POST['po_cnt2']}', '{$_POST['po_cnt3']}', '{$_POST['po_cnt4']}', '{$_POST['po_cnt5']}', '{$_POST['po_cnt6']}', '{$_POST['po_cnt7']}', '{$_POST['po_cnt8']}', '{$_POST['po_cnt9']}', '{$_POST['po_etc']}', '{$_POST['po_level']}', '{$_POST['po_point']}', '" . G5_TIME_YMD . "' ) ";
( po_subject, po_poll1, po_poll2, po_poll3, po_poll4, po_poll5, po_poll6, po_poll7, po_poll8, po_poll9, po_cnt1, po_cnt2, po_cnt3, po_cnt4, po_cnt5, po_cnt6, po_cnt7, po_cnt8, po_cnt9, po_etc, po_level, po_point, po_date, po_use )
values ( '{$_POST['po_subject']}', '{$_POST['po_poll1']}', '{$_POST['po_poll2']}', '{$_POST['po_poll3']}', '{$_POST['po_poll4']}', '{$_POST['po_poll5']}', '{$_POST['po_poll6']}', '{$_POST['po_poll7']}', '{$_POST['po_poll8']}', '{$_POST['po_poll9']}', '{$_POST['po_cnt1']}', '{$_POST['po_cnt2']}', '{$_POST['po_cnt3']}', '{$_POST['po_cnt4']}', '{$_POST['po_cnt5']}', '{$_POST['po_cnt6']}', '{$_POST['po_cnt7']}', '{$_POST['po_cnt8']}', '{$_POST['po_cnt9']}', '{$_POST['po_etc']}', '{$_POST['po_level']}', '{$_POST['po_point']}', '" . G5_TIME_YMD . "', 1 ) ";
sql_query($sql);
$po_id = sql_insert_id();
@ -79,7 +79,8 @@ if ($w == '') {
po_cnt9 = '{$_POST['po_cnt9']}',
po_etc = '{$_POST['po_etc']}',
po_level = '{$_POST['po_level']}',
po_point = '{$_POST['po_point']}'
po_point = '{$_POST['po_point']}',
po_use = '{$_POST['po_use']}'
where po_id = '{$_POST['po_id']}' ";
sql_query($sql);
} elseif ($w == 'd') {

View File

@ -49,7 +49,7 @@ $listall = '<a href="' . $_SERVER['SCRIPT_NAME'] . '" class="ov_listall">전체
$g5['title'] = '투표관리';
require_once './admin.head.php';
$colspan = 7;
$colspan = 8;
?>
<div class="local_ov01 local_ov">
@ -92,6 +92,7 @@ $colspan = 7;
<th scope="col">투표권한</th>
<th scope="col">투표수</th>
<th scope="col">기타의견</th>
<th scope="col">사용</th>
<th scope="col">관리</th>
</tr>
</thead>
@ -101,6 +102,7 @@ $colspan = 7;
$sql2 = " select sum(po_cnt1+po_cnt2+po_cnt3+po_cnt4+po_cnt5+po_cnt6+po_cnt7+po_cnt8+po_cnt9) as sum_po_cnt from {$g5['poll_table']} where po_id = '{$row['po_id']}' ";
$row2 = sql_fetch($sql2);
$po_etc = ($row['po_etc']) ? "사용" : "미사용";
$po_use = ($row['po_use']) ? "사용" : "미사용";
$s_mod = '<a href="./poll_form.php?' . $qstr . '&amp;w=u&amp;po_id=' . $row['po_id'] . '" class="btn btn_03">수정</a>';
@ -117,6 +119,7 @@ $colspan = 7;
<td class="td_num"><?php echo $row['po_level'] ?></td>
<td class="td_num"><?php echo $row2['sum_po_cnt'] ?></td>
<td class="td_etc"><?php echo $po_etc ?></td>
<td class="td_use"><?php echo $po_use ?></td>
<td class="td_mng td_mng_s"><?php echo $s_mod ?></td>
</tr>

View File

@ -617,6 +617,7 @@ CREATE TABLE IF NOT EXISTS `g5_poll` (
`po_date` date NOT NULL default '0000-00-00',
`po_ips` mediumtext NOT NULL,
`mb_ids` text NOT NULL,
`po_use` tinyint(4) NOT NULL default '0',
PRIMARY KEY (`po_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@ -8,8 +8,8 @@ function poll($skin_dir='basic', $po_id=false)
// 투표번호가 넘어오지 않았다면 가장 큰(최근에 등록한) 투표번호를 얻는다
if (!$po_id) {
$row = sql_fetch(" select MAX(po_id) as max_po_id from {$g5['poll_table']} ");
$po_id = $row['max_po_id'];
$row = sql_fetch(" select MAX(po_id) as max_po_id from {$g5['poll_table']} where po_use = 1 ", false);
$po_id = isset($row['max_po_id']) ? $row['max_po_id'] : 0;
}
if(!$po_id)
@ -36,7 +36,7 @@ function poll($skin_dir='basic', $po_id=false)
}
}
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '$po_id' ");
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '$po_id' and po_use = 1 ");
ob_start();
include_once ($poll_skin_path.'/poll.skin.php');