이전의 설문조사는 어쩔 수 없으나 신규 설문조사 부터는 문서/댓글의 위치를 trigger을 이용하여 제대로 연결되도록 하고 관리자 페이지에서 문서 또는 댓글에서의 등록 유무를 체크하여 원본을 잘 찾도록 기능 변경

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4127 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-04-22 03:07:06 +00:00
parent 0e38dea1d0
commit a69193bc50
13 changed files with 153 additions and 13 deletions

View file

@ -17,13 +17,6 @@
* @brief 팝업창에서 설문 작성 완료후 저장을 누를때 설문 등록
**/
function procInsert() {
// 기본적으로 필요한 변수 설정
$editor_sequence = Context::get('editor_sequence');
// upload_target_srl 구함
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
if(!$upload_target_srl) $upload_target_srl = getNextSequence();
$stop_date = Context::get('stop_date');
if($stop_date < date("Ymd")) $stop_date = date("YmdHis", time()+60*60*24*365);
@ -67,7 +60,6 @@
$poll_args->list_order = $poll_srl*-1;
$poll_args->stop_date = $args->stop_date;
$poll_args->poll_count = 0;
$poll_args->upload_target_srl = $upload_target_srl;
$output = executeQuery('poll.insertPoll', $poll_args);
if(!$output->toBool()) {
$oDB->rollback();
@ -197,6 +189,38 @@
$this->add('tpl',$tpl);
}
/**
* @brief 게시글 등록시 poll 연결하는 trigger
**/
function triggerInsertDocumentPoll(&$obj) {
$this->syncPoll($obj->document_srl, $obj->content);
return new Object();
}
/**
* @brief 댓글 등록시 poll 연결하는 trigger
**/
function triggerInsertCommentPoll(&$obj) {
$this->syncPoll($obj->comment_srl, $obj->content);
return new Object();
}
/**
* @brief 게시글 수정시 poll 연결하는 trigger
**/
function triggerUpdateDocumentPoll(&$obj) {
$this->syncPoll($obj->document_srl, $obj->content);
return new Object();
}
/**
* @brief 댓글 등록시 poll 연결하는 trigger
**/
function triggerUpdateCommentPoll(&$obj) {
$this->syncPoll($obj->comment_srl, $obj->content);
return new Object();
}
/**
* @brief 게시글 삭제시 poll 삭제하는 trigger
**/
@ -260,5 +284,27 @@
return new Object();
}
/**
* @brief 게시글 내용의 설문조사를 구해와서 문서 번호와 연결
**/
function syncPoll($upload_target_srl, $content) {
$match_cnt = preg_match_all('!<img([^\>]*)poll_srl=(["\']?)([0-9]*)(["\']?)([^\>]*?)\>!is',$content, $matches);
for($i=0;$i<$match_cnt;$i++) {
$poll_srl = $matches[3][$i];
$args = null;
$args->poll_srl = $poll_srl;
$output = executeQuery('poll.getPoll', $args);
$poll = $output->data;
if($poll->upload_target_srl) continue;
$args->upload_target_srl = $upload_target_srl;
$output = executeQuery('poll.updatePollTarget', $args);
$output = executeQuery('poll.updatePollTitleTarget', $args);
$output = executeQuery('poll.updatePollItemTarget', $args);
}
}
}
?>