웹마스터 팁

안드로이드 푸시 앱 연동 모듈을 개발하면서 몇가지 직면한 문제들을 해결한 팁을 공개하고자 합니다.

제가 잘 몰라서 우회적으로 해결한 경우인데,

문제는 function triggerAfterInsertDocument(&$obj) 안에서

$oDocumentModel = getModel('document');      
$oDocument = $oDocumentModel->getDocument($document_srl);

이렇게 해서 현재 document 핸들러를 가져온 뒤, 이것으로 작업을 할 때 아래와 같은 첨부파일과 관련된 메소드가 전혀 작동하지 않는다는 것입니다.

 

$file_list =  $oDocument->getUploadedFiles();

 

이런 경우 저는 이렇게 해결했습니다. 바로 triggerBeforeInsertDocument(&$obj) 글이 등록되기 전 트리거를 가져와서 거기서 첨부파일을 받아놓고 그 다음에 triggerAfterInsertDocument(&$obj)으로 첨부파일 관련 변수를 넘겨줌으로 해결했습니다.

 

function triggerBeforeInsertDocument(&$obj)
 {
  $document_srl = $obj->document_srl;

  if($GLOBALS['__androidpushapp__'][$document_srl]) unset($GLOBALS['__androidpushapp__'][$document_srl]);

  $sortIndex = 'file_srl';  
  $args = new stdClass();
  $args->upload_target_srl = $document_srl;
  $args->isvalid = "N";
  $args->sort_index = $sortIndex;

  $output = executeQueryArray("file.getFiles", $args);

  $file_list = $output->data;

  if($file_list && !is_array($file_list)) $file_list = array($file_list);

  $file_count = count($file_list);
  for($i=0;$i<$file_count;$i++)
  {
   $file = $file_list[$i];
   $file->source_filename = stripslashes($file->source_filename);
   $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl);
   $file_list[$i] = $file;
  }

  $GLOBALS['__androidpushapp__'][$document_srl] = $file_list;
 } 
 

 function triggerAfterInsertDocument(&$obj)
 { 

...

    $arr_file=$GLOBALS['__androidpushapp__'][$document_srl];

...

}

 

저처럼 트리거에서 첨부파일을 가져올 수 없어서 애먹는 분이 계실까봐 도움이 되었으면 하는 바램으로 허접한 팁을 적었습니다.

 

제목 글쓴이 날짜
아이디/비번 찾기 메일 깨지는 현상 해결 [3] 짱돌의세상 2007.11.06
UTF-8과 Euc-kr 동시에 사용하기 [10] 써니a 2007.11.05
도메인 연결시에 화면 깨짐/스크롤시 화면 깨짐 간단해결법. [4] file YdoubleU 2007.11.05
제로보드xe 연동 프리하드2 설치방법 [8] hoaopoyoy 2007.11.03
IE6 메인화면 밀리는 문제...우연히 해결...^^ 김태상473 2007.11.03
메뉴에 "회원 정보 보기" 걸기. [4] font 2007.11.03
백지화면이 뜰때는~ 하나로45 2007.11.02
apmsetup5를 이용한 zbxe 설치 및 복구 [2] 무도사 2007.11.02
랜덤으로 (최근) 게시물 추출하기.. [13] 지허 2007.11.02
설치확인 후 빈오류창뒤 다시 처음화면으로 넘어갈때... [1] file 지연아빠 2007.11.01
댓글 입력폼이 너무 무겁게 느껴질때 [2] 비지니스 2007.10.31
로그인/로그아웃 화면 첨부합니다. 이미지 변경법좀 ... [1] file 홍제헌 2007.10.30
게시판 상단의 css 옆의 마크 안나오게 하는방법좀 알려주세여! [4] file 홍제헌 2007.10.30
IIS 5.x 6.0 에서 PHP 성능을 높여보자... 핑크플로이드 2007.10.30
ZBXE용 도쿠위키 연동소스 코드 [7] 베니 2007.10.29
게시판 정렬순서 오름차순 내림차순 옵션 만들기 [1] 지허 2007.10.29
달력으로 게시판 글 검색하기(블로그 말고) [4] file 핑크플로이드 2007.10.27
(글) 서명 높이 줄이고 스크롤바 생성 [4] Simulz 2007.10.26
(글) 등록 시간을 변경해 봅시다. [4] file Simulz 2007.10.26
게시물 작성시 날짜 지정하기 [14] file JAMSUN2 2007.10.24