first commit 2

This commit is contained in:
hmw1001
2026-06-11 18:47:38 +09:00
parent c768729ce6
commit 6f534e33a6
11095 changed files with 1595758 additions and 0 deletions
@@ -0,0 +1,155 @@
<?php
if (!defined('_GNUBOARD_')) exit;
// 설문 관리 라이브러리 로드
include_once(G5_ADMIN_PATH.'/survey_manage/lib/survey.lib.php');
// 설문 데이터 가져오기
$limit = 6; // 표시할 설문 수
$where = " WHERE sv_status = 'active' ";
$where .= " AND DATE(sv_start_date) <= CURDATE() ";
$where .= " AND DATE(sv_end_date) >= CURDATE() ";
$sql = " SELECT * FROM survey_master $where ORDER BY sv_created_at DESC LIMIT $limit ";
$result = sql_query($sql);
$survey_data = array();
while ($row = sql_fetch_array($result)) {
$questions_count = sql_fetch("SELECT COUNT(*) as cnt FROM survey_questions WHERE sv_id = '{$row['sv_id']}'")['cnt'];
$response_count = get_survey_response_count($row['sv_id'], 'completed');
$max_responses = $row['sv_max_responses'];
$progress = $max_responses ? ($response_count / $max_responses) * 100 : 0;
$days_left = ceil((strtotime($row['sv_end_date']) - time()) / (60 * 60 * 24));
$survey_data[] = array(
'id' => $row['sv_id'],
'title' => get_text($row['sv_title']),
'description' => get_text(cut_str(strip_tags($row['sv_description']), 100)),
'questions_count' => $questions_count,
'response_count' => $response_count,
'max_responses' => $max_responses,
'progress' => min($progress, 100),
'days_left' => $days_left,
'theme_color' => $row['sv_theme_color'] ?: '#AA20FF',
'created_by' => $row['sv_created_by']
);
}
$survey_json = json_encode($survey_data, JSON_UNESCAPED_UNICODE);
// CSS와 JS 파일의 버전을 파일 수정 시간으로 자동 갱신
$module_css_path = G5_THEME_PATH.'/rb.custom/survey_list/module.css';
$module_js_path = G5_THEME_PATH.'/rb.custom/survey_list/module.js';
$module_css_ver = file_exists($module_css_path) ? filemtime($module_css_path) : G5_CSS_VER;
$module_js_ver = file_exists($module_js_path) ? filemtime($module_js_path) : G5_JS_VER;
// 이 모듈만의 고유 ID를 생성합니다.
$module_id = 'survey_list_module_'.uniqid();
?>
<!-- 모듈의 가장 바깥 요소에 고유 ID를 부여합니다. -->
<div id="<?php echo $module_id; ?>" class="survey-list-module">
<section class="survey-section" data-surveys='<?php echo htmlspecialchars($survey_json, ENT_QUOTES, 'UTF-8'); ?>'>
<div class="container">
<div class="section-header">
<span class="subtitle">Survey</span>
<h2>설문조사</h2>
<p>다양한 설문에 참여하고 소중한 의견을 나눠주세요</p>
</div>
<?php if (!empty($survey_data)): ?>
<div class="survey-grid">
<!-- JS로 설문 카드가 생성될 영역 -->
</div>
<div class="section-footer">
<a href="<?php echo G5_THEME_URL; ?>/rb.custom/survey_list/survey_list_page.php" class="btn-more">
<span>모든 설문 보기</span>
<i class="fa fa-arrow-right"></i>
</a>
</div>
<?php else: ?>
<div class="empty-state">
<i class="fa fa-poll"></i>
<h3>진행중인 설문이 없습니다</h3>
<p>새로운 설문이 등록되면 알려드리겠습니다.</p>
</div>
<?php endif; ?>
</div>
</section>
<!-- 설문 상세 모달 -->
<div class="survey-modal">
<div class="modal-overlay"></div>
<div class="modal-content">
<button type="button" class="modal-close">&times;</button>
<div class="modal-header">
<h3 class="modal-title"></h3>
<div class="modal-meta">
<span class="modal-author"></span>
<span class="modal-deadline"></span>
</div>
</div>
<div class="modal-body">
<p class="modal-description"></p>
<div class="modal-stats">
<div class="stat-item">
<i class="fa fa-question-circle"></i>
<span class="stat-label">질문 수</span>
<span class="stat-value questions-count"></span>
</div>
<div class="stat-item">
<i class="fa fa-users"></i>
<span class="stat-label">참여자</span>
<span class="stat-value participants-count"></span>
</div>
<div class="stat-item">
<i class="fa fa-clock"></i>
<span class="stat-label">예상 시간</span>
<span class="stat-value estimated-time"></span>
</div>
</div>
<div class="progress-section">
<div class="progress-bar">
<div class="progress-fill"></div>
</div>
<div class="progress-text"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn-cancel">취소</button>
<a href="#" class="btn-participate">참여하기</a>
</div>
</div>
</div>
</div>
<!-- 이 모듈에 필요한 CSS 파일을 불러옵니다. -->
<link rel="stylesheet" href="<?php echo G5_THEME_URL; ?>/rb.custom/survey_list/module.css?ver=<?php echo $module_css_ver; ?>">
<script>
(function() {
const currentModuleId = '<?php echo $module_id; ?>';
const initFunctionName = 'initSurveyListModule';
const scriptId = 'survey-list-module-script';
if (document.getElementById(scriptId)) {
if (typeof window[initFunctionName] === 'function') {
window[initFunctionName](currentModuleId);
}
return;
}
const script = document.createElement('script');
script.id = scriptId;
script.src = '<?php echo G5_THEME_URL; ?>/rb.custom/survey_list/module.js?ver=<?php echo $module_js_ver; ?>';
script.async = true;
script.onload = () => {
if (typeof window[initFunctionName] === 'function') {
window[initFunctionName](currentModuleId);
}
};
document.head.appendChild(script);
})();
</script>