Files
dnssash/adm/survey_manage/survey_activate.php
T
2026-06-11 18:47:38 +09:00

32 lines
894 B
PHP

<?php
$sub_menu = '710100';
include_once('./_common.php');
$sv_id = isset($_GET['sv_id']) ? (int)$_GET['sv_id'] : 0;
if (!$sv_id) {
alert('설문 ID가 없습니다.', './survey_list.php');
}
$survey = get_survey($sv_id);
if (!$survey) {
alert('존재하지 않는 설문입니다.', './survey_list.php');
}
if ($survey['sv_status'] != 'draft') {
alert('임시저장 상태의 설문만 활성화할 수 있습니다.', './survey_list.php');
}
// 질문이 있는지 확인
$questions = get_survey_questions($sv_id);
if (empty($questions)) {
alert('질문이 없는 설문은 활성화할 수 없습니다.', './survey_form.php?sv_id='.$sv_id);
}
// 설문 활성화
if (update_survey_status($sv_id, 'active')) {
alert('설문이 활성화되었습니다.', './survey_list.php');
} else {
alert('설문 활성화에 실패했습니다.', './survey_list.php');
}
?>