<!--// XE ver.1.2.x 게시판을 이용한 플래너/음력달력  (Skin Planner123-Standard)-----------------------
## [author]
##  - Keysung Chung, 2009, 07, 28
##  - http://chungfamily.woweb.net/
## [function]
##  - 24절기 일자를 구하기 위해 Chilbong Kim님의 class.calendar.php와 class.solar.php를 사용
##  - 기타 펑션은 인터넷에서 구하거나 직접 코딩함.
## [changes]
##  - PlannerXE123 ver. 2.1.0 : Keysung Chung, 2010, 09, 13
##  - PlannerXE123 ver. 2.0.0 : Keysung Chung, 2010, 09, 01
##  - PlannerXE123 ver. 1.7.0 : Keysung Chung, 2010, 08, 01
##  - PlannerXE123 ver. 1.6.0 : Keysung Chung, 2010, 07, 01
##  - PlannerXE123 ver. 1.5.0 : Keysung Chung, 2010, 06, 15
##  - PlannerXE123 ver. 1.4.0 : Keysung Chung, 2010, 06, 01
##  - PlannerXE123 ver. 1.3.0 : Keysung Chung, 2010, 05, 15
##  - PlannerXE123 ver. 1.2.0 : Keysung Chung, 2010, 05, 01
##  - PlannerXE123 ver. 1.1.0 : Keysung Chung, 2010, 04, 14
##  - PlannerXE123 ver. 1.0.0 : Keysung Chung, 2010, 04, 01
##  - PlannerXE123 ver. 0.3 : Keysung Chung, 2010, 02, 28
##  - PlannerXE123 ver. 0.2 : Keysung Chung, 2009, 11, 09
##  - PlannerXE123 ver. 0.1 : Keysung Chung, 2009, 07, 28
----------------------------------------------------------------------- -->
{@ $var_version = "PlannerXE123: Skin Ver 2.1.0"}
<!--// 모바일에서 쓰기가 정상 작동이 안되어 추가함: 모바일 스킨의 쓰기 앞부분임-->
<!--@if($_COOKIE["mobile"])-->
{@ Context::addJsFile("./common/js/jquery.js", true, '', -100000) }
{@ Context::addJsFile("./common/js/js_app.js", true, '', -100000) }
{@ Context::addJsFile("./common/js/x.js", true, '', -100000) }
{@ Context::addJsFile("./common/js/common.js", true, '', -100000) }
{@ Context::addJsFile("./common/js/xml_handler.js", true, '', -100000) }
{@ Context::addJsFile("./common/js/xml_js_filter.js", true, '', -100000) }
<!--%import("../default/js/mboard.js")-->
<!--%import("../default/css/mboard.css")-->
<!--@endif-->
<!--// 모바일에서 쓰기가 정상 작동이 안되어 추가함 -->

<?php 
$GLOBALS['pOption'] = Context::get('pOption');	// XE변수 넘겨받기 위해서.
$pOption=$GLOBALS['pOption']; 					// XE변수 넘겨받기 위해서.
$GLOBALS['pYear'] = Context::get('pYear');	// XE변수 넘겨받기 위해서.
$pYear=$GLOBALS['pYear']; 					// XE변수 넘겨받기 위해서.
$GLOBALS['pMonth'] = Context::get('pMonth');	// XE변수 넘겨받기 위해서.
$pMonth=$GLOBALS['pMonth']; 					// XE변수 넘겨받기 위해서.
$GLOBALS['pDay'] = Context::get('pDay');	// XE변수 넘겨받기 위해서.
$pDay=$GLOBALS['pDay'];						// XE변수 넘겨받기 위해서.
?>

{@ $link_path = getUrl('','mid',$mid,'listStyle',planner_weekly,'offset',$offset)}
{@ $XE_path = getUrl('')}

{@ $today_bgcolor="#CDE6AC"}   <!--// 달력의 당일 칸 배경색 -->
{@ $today_bodercolor="#58792E"}   <!--// 달력의 당일 칸 border 색 -->
{@ $mouseover_bgcolor="#ddfffa"}   <!--// 달력의 칸에 마우스오버시 배경색 -->

<!--@if($module_info->calendar_bgcolor == null )-->
	{@ $day_bgcolor="white"}      <!--// 달력의 평일 칸 배경색 -->
<!--@else-->
	{@ $day_bgcolor=$module_info->calendar_bgcolor}      <!--// 달력의 평일 칸 배경색 -->
<!--@end-->
	{@ $day_bgcolor2="#fffacd"}      <!--// 달력의 평일 칸 배경색 2 주별 다른 배경색을 위하여-->

<!--//  CSS 인쿨르드 -->
<!--%import("./css/planner123_list.css")-->

<?php 
$linkpath = $__Context->link_path;
$xepath = $__Context->XE_path;
$skinpath = $tpl_path; // 스킨 설치 경로지정
//echo $linkpath;
//echo $skinpath;
?>

<!--//  function 인쿨르드: 파일 확장자가 "html" 이어야만 정상작동(php는 안됨), 또 class함수는 작동안됨-->
<!--//  아래 require 함수로 대체함 아울러 휴일,기념일함수를 별도 분리함-->
<!--//#include("function/function_simple.html")-->
<!--//  인쿨르드 끝 -->
<?php
require_once($skinpath.'function/function_simple.php');
require_once($skinpath.'function/function_holimemday_kor.php');  // 한국 휴일, 기념일
?>

<!--// 날자 설정 ---------------------------------- -->
<?php
// Daylight saving time을 위해 Time zone을 지정할 수 있음 ( php4.대에서는 에러 발생, php5.1 이상에서 정상작동)
// date_default_timezone_set('America/Toronto'); // 타임존목록 http://kr.php.net/manual/kr/timezones.php )예: America/Toronto
$server_timestamp = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$server_offset = date("Z");
$xe_timestamp = fn_xetimestamp();
$xe_offset = date("Z")+zgap();
$client_offset = Context::get('offset');        // url 변수로 받은 client offset  
$__Context->client_timestamp = $client_timestamp = mktime(date("H"), date("i"), date("s")-date("Z")+$client_offset, date("m"), date("d"), date("Y"));

// 화면에 보여줄 서버시간: 기본 XE시간으로 설정, 만약 default_timezone을 사용할 경우는 $server_timestamp, $server_offset 로 변경
$__Context->display_timestamp = $display_timestamp = $xe_timestamp;  
$__Context->display_offset = $xe_offset;	    
//$__Context->display_timestamp = $display_timestamp = $server_timestamp;  
//$__Context->display_offset = $server_offset;	    

if ($client_offset == null ) {
	$wrk_timestamp = $display_timestamp;
} else {
	$wrk_timestamp = $client_timestamp;
}

if ($pYear == null ) {
	$pYear = date("Y", $wrk_timestamp);
}

if ($pMonth == null ) {
	$pMonth = date("n", $wrk_timestamp);
}

if ($pMon == null ) {
	$pMon = date("F", $wrk_timestamp);
}

if ($pDay == null ) {
	$pDay = date("j", $wrk_timestamp);
}

if ($pOption < 1 || $pOption > 3 ) {
	$pOption=1;		// 간지옵션
}

$tmp_timestamp_01 = mktime(0, 0, 0, $pMonth, $pDay, $pYear); 
$__Context->pYear = $pYear =date("Y", $tmp_timestamp_01); 
$__Context->pMonth = $pMonth =date("n", $tmp_timestamp_01);
$__Context->pDay = $pDay =date("j", $tmp_timestamp_01);
$__Context->pMon = $pMon =date("F", $tmp_timestamp_01);
$__Context->pMon_short = $pMon_short =date("M", $tmp_timestamp_01);
$__Context->pWeekday = $pWeekday =date("D", $tmp_timestamp_01);
$__Context->week_count = $week_count = week_of_year($pMonth, $pDay, $pYear);

$todayYY = date("Y", $wrk_timestamp);	// 당일년도
$todayMM = date("n", $wrk_timestamp);	// 당일월
$todayDD = date("j", $wrk_timestamp);	// 당일일
$__Context->wrk_timestamp = $wrk_timestamp;

// 당일의 년초부터 일요일 기준 주간 갯수구하기 : 1월 1일 금요일인 경우 1일-2일 =1주, 3일-9일=2주)
function week_of_year($month, $day, $year) { // week count(일요일 부터)
	$day_of_year = date('z', mktime(0, 0, 0, $month, $day, $year)); 
	/* Days in the week before Jan 1. If you want weeks to start on Monday make this (x + 6) % 7 */ 
	$days_before_year = date('w', mktime(0, 0, 0, 1, 1, $year)); 
	$days_left_in_week = 7 - date('w', mktime(0, 0, 0, $month, $day, $year)); 
	/* find the number of weeks by adding the days in the week before the start of the year, days up to $day, and the days left in this week, then divide by 7 */ 
	return ($days_before_year + $day_of_year + $days_left_in_week) / 7; 
} 

// 경구 출력을 위하여...
function get_text_file($skin_path, $num = 2){
	$file_path = $skin_path."text/epigrams.txt";
	if(!file_exists($file_path)) return 'error1 '.$skin_path;
	$fp = fopen($file_path, "r");	// 파일 열기
	if(!$fp) return 'error2';
	while(!feof($fp)) $array[] = fgets($fp, 1024);	// 파일 읽기
	fclose($fp);	// 파일 닫기
	shuffle($array);	// 배열 섞기

	if(count($array) < $num) $num = count($array);
	for($i=0; $i<$num; $i++){	// 배열에서 2개글 뽑기
		$tmp = trim($array[$i]);
		if($tmp){
		$tmp_arr = explode('||', $tmp);
		$list[$i] = $tmp_arr[1];
		}
	}
	return $list;
}
?>

<?php 
$Calmain = fn_CalMain($pYear,$pMonth);		// 달력일자
$Holiday = fn_HolidayChk($pYear, $pMonth);		// 휴일(달력일자 붉은색표시를 위해..)
?>
<!--@if($module_info->display_holiday == 'Y')-->
<?php 
//$Holiday = fn_HolidayChk($pYear, $pMonth);	// 휴일
$ind_holiday = "Y";
?>
<!--@end-->
<!--@if($module_info->display_memday == 'Y')-->
<?php 
$Memday = fn_MemdayChk($pYear, $pMonth);      // 기념일  
$ind_memday = "Y";
?>
<!--@end-->
<!--@if($module_info->display_lunar == 'Y')-->
<?php 
$Lunarday = fn_sol2lun_ary($pYear,$pMonth);   // 음력일자 
$ind_lunar = "Y";
?>
<!--@end-->
<!--@if($module_info->display_lunar == 'Y_all')-->
<?php 
$Lunarday = fn_sol2lun_ary($pYear,$pMonth);   // 음력일자 - 모든날자
$ind_lunar_all = "Y";
?>
<!--@end-->

<?php 
$ind_use_category = $__Context->module_info->use_category;				// 분류(카테고리) 사용여부
$ind_bgcolor_option = $__Context->module_info->use_category_bgcolor;	// 일정 배경색상 옵션
$ind_image_diary = $__Context->module_info->image_diary;				// 그림일기 사용여부
$ind_complete_doc = $__Context->module_info->display_complete_doc;		// 완료일정 표시여부
$ind_duplicated_schedule = $__Context->module_info->duplicated_schedule; // 중복일정 허용여부
?>

<!--// planner123 문서목록 얻기---------------------------------- -->
<!--// 검색년월 및 목록수 설정------ -->
<?php
$__Context->pYear = $pYear;					
$tempmonth = substr("0".$pMonth, -2);				//월 을 "7" 에서 "07"로
$__Context->tempMonth = $tempmonth;
$list_count = $__Context->module_info->list_count;  //목록수
$page_count = $__Context->module_info->page_count;  //목록수
?>

<!--// 검색필드 설정------ -->
<?php
$search_target = $__Context->search_target;
$search_keyword = $__Context->search_keyword;

// 검색 Target에 따른 검색필드 설정.
if ($search_keyword != null) {
	switch ($search_target) {
      case (title):
		$obj->var_search_title = $search_keyword;
        break;
      case (content):
		$obj->var_search_content = $search_keyword;
        break;
      case (title_content):
		$obj->var_search_title = $search_keyword;
		$obj->var_search_content = $search_keyword;
        break;
//      case (comment):   // 댓글 검색하지 않음
//        $obj->var_search_comment = $search_keyword;
//        break;
      case (user_name):
        $obj->var_search_user_name = $search_keyword;
        break;
      case (nick_name):
        $obj->var_search_nick_name = $search_keyword;
        break;
      case (user_id):
        $obj->var_search_user_id = $search_keyword;
        break;
      case (tag):
        $obj->var_search_tags = $search_keyword;
        break;
      default :
         if(strpos($search_target,'extra_vars')!==false) {
            $obj->var_search_extra_idx = substr($search_target, strlen('extra_vars'));
            $obj->var_search_extra_value = str_replace(' ','%',$search_keyword);
         }
         break;
    }
}
?>

<!--// 분류필드 설정--- -->
<!--@if($module_info->use_category == "Y")-->
<?php
$tmp_category = Context::get('category_list');  // 분류srl 얻기 (1단계만 지원, 그룹제한 고려 않음)
if (!$tmp_category) {
	$tmp_category = array();
}
$wrk_var_category_srl = "0";					// 디폴트
foreach ($tmp_category as $val) {
	$wrk_var_category_srl .= ",".$val->category_srl;
    if ($val->selected) {
	    $obj->var_category_srl = $val->category_srl;
	}
}
if (!$obj->var_category_srl) {
$obj->var_category_srl = $wrk_var_category_srl;
}
?>
<!--@end-->

<!--// loged member --- -->
<?php
$member_temp_name = $__Context->logged_info->nick_name; // 공개그룹 user에 nick_name 이용
// $member_temp_name = $__Context->logged_info->user_name; //  공개그룹 user에 user_name 이용
$member_srl = $__Context->logged_info->member_srl;
$group_list = $__Context->logged_info->group_list;
$usergroup_arr = array();

if ($member_srl != null) {
    foreach($group_list as $key => $val) {
       $group_titles .= ",".$val;
	}
    $group_titles=substr($group_titles,1);    // 사용자가 소속된 그룹명칭
	$usergroup_arr = explode(",",$group_titles);

	// 멤버의 주간 계획 데이터얻기
	$obj->module_srl = $__Context->module_info->module_srl;
	$obj->var_member_srl = $member_srl;		// user srl
	$obj->extra_vars_serial = serialize("X");	// 주간 계획 데이터: status = X
	$obj->title = "weekplan_".$member_srl."_".$pYear;
	$query_path = $__Context->module_info->module."/skins/".$__Context->module_info->skin;	// 쿼리경로
	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_weekplan', $obj);		// 주간계획 찾기

	if(!count($output->data)) {		// 주간계획 없으면 레코드 만들고...
		// 0=sun, 1=mon, 2=tue, 3=wed, 4=thu, 5=fri, 6=sat 7=sharpen, 8=role, 9=remark, 
		For ($j = 0; $j <= 53; $j++ ) {
			$tmp_myplan_fld .= "|@||@||@||@||@||@||@||@||@||=@=|";
		}
		$obj->content = $tmp_myplan_fld;
		$obj->extra_vars = "X";
		$obj->is_secret = "Y";

        $oDocumentModel = &getModel('document');
        $oDocumentController = &getController('document');

        $output = $oDocumentController->insertDocument($obj);
        $msg_code = 'success_registed';
	}

	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_weekplan', $obj);  // 주간계획 다시 찾기
	if(count($output->data)) {
		foreach($output->data as $key => $attribute_myplan) {
			if($attribute_myplan->title == $obj->title) {
				$__Context->myplan_module_srl = $myplan_module_srl = $attribute_myplan->module_srl;
				$__Context->myplan_srl = $myplan_srl = $attribute_myplan->document_srl;
				$__Context->myplan_title = $myplan_title = $attribute_myplan->title;
				$__Context->myplan_content = $myplan_content = $attribute_myplan->content;
			}
		}
				$myplan_arr = explode('|=@=|',$attribute_myplan->content);
				$__Context->myplan_arr_week = $myplan_arr_week = explode('|@|',$myplan_arr[$week_count]);
	}
//	$myplan = $attribute_myplan;
//	print_r($myplan_arr[$week_count]);
//	print_r($myplan_srl);
} 
?>

<!--// 쿼리 설정/실행/list만들기--- -->
<?php
$obj->site_srl = '';  // 0을 넣으면 이상해짐
$obj->module_srl = $__Context->module_info->module_srl;
$obj->sort_index_1 = 'extra_value_end';	// (일정시작 일) start를 end로(2010-08-01)
$obj->order_type_1 = 'desc';
$obj->sort_index_default_1 = 'extra_value_start';	
$obj->sort_index_2 = 'extra_value_time';	// (시작종료 시간)
$obj->order_type_2 = 'asc';
$obj->sort_index_default_2 = 'extra_value_time';
$obj->sort_index = $__Context->module_info->order_target;	// (게시판 문서 정렬 번호)
$obj->order_type = $__Context->module_info->order_type;
$obj->sort_index_default = 'list_order';	// 게시판설정 선택값이 null 일때
$obj->list_count = $list_count*10;  // 게시판 설정값 10배의 일정표시 (예:기본 20일때 200개까지)
$obj->page_count = $page_count;  // 게시판 설정값
$obj->var_idx1 = '1';    // 확장변수1번: sort target(일정시작)- 통상 값이 있음
$obj->var_idx2 = '2';	 // 확장변수2번: sort targer(일정종료)- 대부분의 경우 null 값임
$obj->var_idx7 = '7';	 // 확장변수7번: 시작종료시간
$obj->var_idx8 = '8';	 // 확장변수8번: 공개그룹
$obj->var_period_start = $pYear.$tempmonth."01";	 // 선택 범위시작 - 당월 01일 >=
$obj->var_period_end = $pYear.$tempmonth."31";	 // 선택 범위  끝 - 당월 31일 <=
$obj->var_fld_null = "0";	 // null 대신값 (null이면 이상해짐)

$query_path = $__Context->module_info->module."/skins/".$__Context->module_info->skin;       // 쿼리경로
$view_group = $__Context->module_info->default_document_group;    // 스킨에서 정해준 일반사용자가 볼수있는 문서그룹

if ($__Context->grant->manager) {
	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_all', $obj);    // 관리자 (모든문서)
} else if ($__Context->module_info->consultation == "Y") {
	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_own', $obj);    // 상담기능 (자신 + 공지)
} else if ($view_group == "owner") {
	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_own', $obj);    // 자신 + 공지
} else if ($view_group == "usergroup") {
	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_group', $obj);  // 자신 + 공지 + 공개그룹소속
} else if ($view_group == "nonsecured") {
	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_nonSec', $obj); // 타인 비밀글및 비멤버쉽 문서 제외
} else if ($view_group == "alldocument") {
	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_all', $obj);    // 모든문서
} else {
	$output = executeQueryArray($query_path.'.getDocumentsForPlanner_all', $obj);    // 모든문서
}

// ---문서 목록 생성 --
	if(count($output->data)) {
		foreach($output->data as $key => $attribute) {
			$tmp_document_srl = $attribute->document_srl;
			$tmp_Document = null;
			$tmp_Document = new documentItem();
			$tmp_Document->setAttribute($attribute, false);
			$tmp_Document->category_srl = $attribute->category_srl;
            $tmp_opengroup_arr = explode("|@|",$attribute->extra_value_group);

		  if($module_info->consultation == 'Y'){   // 상담기능 일때
			if ( $__Context->grant->manager) {
			    $tmp_document_list[$key] = $tmp_Document;       //상담기능-관리자이면 전체 문서를 처리,
			} else {
				if ($attribute->is_notice == "Y" || $attribute->member_srl == $member_srl) {
 			        $tmp_document_list[$key] = $tmp_Document;   //상담기능-관리자 아니면 공지문서나 자신의 문서이면 처리.
                }
			}
          } else {  // 상담기능 아닐때

			if ( $__Context->grant->manager || $view_group == "alldocument") {
			    $tmp_document_list[$key] = $tmp_Document;       // 관리자또는 문서그룹이 alldocument 이면 전체 문서를 처리,
			} else if ($view_group != "usergroup" && $attribute->extra_value_group == null) {
			    $tmp_document_list[$key] = $tmp_Document;       // 문서그룹이 usergroup이 아니면서 공개그룹을 선택하지 않은 문서 처리,
			} else {											// 문서그룹이 usergroup 또는 공개그룹 선택된 문서
				if ($attribute->is_notice == "Y" || $attribute->member_srl == $member_srl) {
 			        $tmp_document_list[$key] = $tmp_Document;       //공지문서나 자신의 문서이면 처리.
                } else {
                    $tmp_flag = "";
                    foreach($usergroup_arr as $tmp_key => $val_tmp) {
			    	    if (in_array($val_tmp, $tmp_opengroup_arr)){   
 			               $tmp_flag = "*";                        //공개그룹 소속.
						}
				    }
			    	if ($member_temp_name != null && in_array($member_temp_name, $tmp_opengroup_arr)){   //공개 user_name.
 						$tmp_flag = "*";                        
					}
				    if ($tmp_flag == "*") {
 			        $tmp_document_list[$key] = $tmp_Document;       //공개그룹 소속이면 처리.
                    }
			    }
			}  

		  }  //상담기능 아닐때 끝

		//echo $tmp_document_srl." ";  //디버깅용
		}  //foreeach 끝
	} else {
		$tmp_document_list = array();          
	}
$__Context->planner123_document_list = $tmp_document_list;
// ---문서 목록 생성 끝--
?>
<!--// planner123 문서목록 얻기 끝---------------------------------- -->

<!--// 공지사항과 일반문서 합치기 ($planner123_document_list로 대체함:만일을위해 살려둠) -->
<!--//(공지사항을 리스트 앞으로 가져오기 위해 합침)  -->
<!--@if($notice_list != null)-->
	{@ $planner_document_list = $notice_list}
	<!--@if($document_list != null)-->
		{@ $planner_document_list = $planner_document_list + $document_list}	
	<!--@end-->
<!--@else-->
	{@ $planner_document_list = $document_list}	
<!--@end-->
<!--// 공지사항과 일반문서 합치기 ** 사용하지 않음 끝 ** -->

<!--// Xe 확장변수 변수를 작업 ($key 등은 board설정시 목록에 포함되어야 들어옴)  -->
<!--@foreach($planner123_document_list as $no => $document)-->

	<!--// Category title & color값 얻기  -->
	<!--@if($module_info->use_category == "Y" && $document->get('category_srl'))-->
		<!--@if($category_list[$document->get('category_srl')]->color)-->
		{@ $category_color = $category_list[$document->get('category_srl')]->color}
		<!--@end-->
		{@ $category_title = $category_list[$document->get('category_srl')]->title}
	<!--@else-->
		{@ $category_color = null}
		{@ $category_title = null}
    <!--@end-->
	<?php
		$category_title = $__Context->category_title;
		$category_color = $__Context->category_color;
	?>

	<!--// 댓글 숫자 얻기  -->
    <!--@if($document->getCommentCount())-->
        {@ $plan_reply = $document->getCommentCount()}
	<!--@else-->
        {@ $plan_reply = null}
	<!--@end-->
	<?php
		$plan_reply = $__Context->plan_reply;
	?>

	<!--// 확장변수값 얻기  -->
	<!--@foreach($list_config as $key => $val)-->
		<!--@if($val->idx == -1)-->
		<!--@else-->
			<!--@if($val->idx == 1)-->
			{@ $plan_start = $document->getExtraValue($val->idx)}	
			{@ $startYY = substr($plan_start,0,4)}
			{@ $startMM = substr($plan_start,4,2)} 
			{@ $startDD = substr($plan_start,6,2)}
			{@ $plan_title = $document->getTitle($module_info->subject_cut_size)}
			{@ $plan_detail = $document->getSummary($module_info->content_cut_size)}

			<!--@if($_COOKIE["mobile"])--> <!--// 모바일일때 그림 사이즈작게 mobile::isFromMobilePhone() 함수를 쿠키로 대체-->
	            {@ $plan_img = null}
		         <!--// {@ $plan_img = $document->getThumbnail(45, 45, $module_info->thumbnail_type)} -->
			<!--@else-->
			    {@ $plan_img = $document->getThumbnail($module_info->thumbnail_width, $module_info->thumbnail_height, $module_info->thumbnail_type)}
			<!--@endif-->

			{@ $plan_doc_extra_vars = $document->get('extra_vars')}    <!--// 취소일정을 위해 추가 -->
			{@ $plan_docurl = $document->document_srl}
			{@ $plan_url = getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','','offset',$offset)}
				<!--//@if($startYY == $pYear && $startMM == $tempMonth)-->
				<?php
				$plan_title = $__Context->plan_title;
				$plan_detail = $__Context->plan_detail;
                $plan_img = $__Context->plan_img;
                $plan_doc_extra_vars = $__Context->plan_doc_extra_vars;    <!--// 취소일정을 위해 추가 -->
				$plan_url = $__Context->plan_url;
				$plan_start = $__Context->plan_start;			// 일정시작
				$plnstartYY = $__Context->startYY;			
				$plnstartMM = $__Context->startMM;
				$plnstartDD = $__Context->startDD;
				$plnstartMM = ltrim( $plnstartMM, "0" );	//  앞의 "0" 제거
				$plnstartDD = ltrim( $plnstartDD, "0" );	//  앞의 "0" 제거
				?>
				<!--//@end-->
			<!--@end-->
			<!--@if($val->idx == 2 )-->
			{@ $plan_end = $document->getExtraValue($val->idx)}		
				<!--@if($plan_end == null )-->
				{@ $plan_end = $plan_start}
				<!--@end-->
			{@ $endYY = substr($plan_end,0,4)}
			{@ $endMM = substr($plan_end,4,2)} 
			{@ $endDD = substr($plan_end,6,2)}
				<!--//@if($endYY >= $pYear && $endMM >= $tempMonth)-->
				<?php
				$plan_end = $__Context->plan_end;			// 일정종료
				$plnendYY = $__Context->endYY;			
				$plnendMM = $__Context->endMM;
				$plnendDD = $__Context->endDD;
				$plnendMM = ltrim( $plnendMM, "0" );	// 일자 앞의 "0" 제거
				$plnendDD = ltrim( $plnendDD, "0" );	// 일자 앞의 "0" 제거
				?>
				<!--//@end-->
			<!--@end-->
			<!--@if($val->idx == 3 )-->
			{@ $plan_bgcolor = $document->getExtraValueHTML($val->idx)}		
				<?php
				$plan_bgcolor = $__Context->plan_bgcolor;		// 배경색상
				?>
			<!--@end-->
			<!--@if($val->idx == 4 )-->
			{@ $plan_flagicon = $document->getExtraValueHTML($val->idx)}	
				<?php
				$plan_flagicon = $__Context->plan_flagicon;		// 일정확인
				?>
			<!--@end-->
			<!--@if($val->idx == 5 )-->
			{@ $plan_repeat_cycle = $document->getExtraValueHTML($val->idx)}	
				<?php
				$plan_repeat_cycle = $__Context->plan_repeat_cycle;		// 반복일정 cycle
				?>
			<!--@end-->
			<!--@if($val->idx == 6 )-->
			{@ $plan_repeat_unit = $document->getExtraValueHTML($val->idx)}	
				<?php
				$plan_repeat_unit = $__Context->plan_repeat_unit;		// 반복일정 unit
				?>
			<!--@end-->
            <!--@if($val->idx == 7 )-->
            {@ $plan_time = $document->getExtraValueHTML($val->idx)}
                <?php
                $plan_time = $__Context->plan_time;						// 시간대 (09:00, 09:30, 10:00,.. 형식)
                ?>
            <!--@end-->
		<!--@end-->
	<!--@end-->

    <!--// 새글 이미지값 얻기  -->
    {@ $plan_new = $document->printExtraImages(60*60*$module_info->duration_new)}
    <?php $plan_new = $__Context->plan_new; ?>

<?php 
if ($plnstartYY != null ) {
	if ($plnstartYY == $pYear && $plnstartMM == $pMonth) {		// 당월 시작 이면서 당월 이후 종료
		if (($plnendYY > $pYear) || (($plnendYY == $pYear) && ($plnendMM > $pMonth))) {
					$plnendYY = $pYear;
					$plnendMM = $pMonth;
					$plnendDD = 31;
		}
	}
	elseif (($plnstartYY < $pYear) || (($plnstartYY == $pYear) && ($plnstartMM < $pMonth))) {	// 당월 이전 시작 이면서 당월 종료
		if ($plnendYY == $pYear && $plnendMM == $pMonth) {
					$plnstartYY = $pYear;
					$plnstartMM = $pMonth;
					$plnstartDD = 1;
		}
		if (($plnendYY > $pYear) || (($plnendYY == $pYear) && ($plnendMM > $pMonth))) { // 당월 이전시작 이면서 당월 이후 종료
					$plnstartYY = $pYear;
					$plnstartMM = $pMonth;
					$plnstartDD = 1;
					$plnendYY = $pYear;
					$plnendMM = $pMonth;
					$plnendDD = 31;
		}
	}

// qtip 미사용으로 인해 아래 3째줄 주석처리
	$plan_detail = str_replace("'", "`", $plan_detail);			// '을 `로 대체 textbox보이기위해
	$plan_detail = str_replace("\"", "&quot;", $plan_detail);	// "를 &quot;로 대체 textbox보이기위해
//	$plan_detail = str_replace(chr(012), "<br />", $plan_detail); // FF를 제거 textbox보이기위해
	$plan_detail = str_replace(chr(015), "", $plan_detail);		// SI을 제거 textbox보이기위해 -줄바꿈

	// 취소일정위해 추가
	// ('A'=>'기본', 'F'=>'완료', 'R'=>'취소', 'X'=>'PLN');  // 기본: 최초는 null, 수정하면 A
	$_doc_extra_vars = explode(";", $plan_doc_extra_vars);
	$_doc_extra_vars1 = explode(":", $_doc_extra_vars[0]);
	$_doc_status = str_replace("\"", "", $_doc_extra_vars1[2]);

	if($_doc_status == "F" && $ind_complete_doc == "L") { $plan_title = "<span class='complete'>".$plan_title."</span>"; }  // 완료일정 제목에 취소선 긋기
	if($_doc_status != "R" && ($ind_complete_doc == "N" && $_doc_status != "F" || $ind_complete_doc != "N") ) {	// 취소일정이 아닐때 처리

	if( $plnstartYY == $pYear && $plnstartMM == $pMonth) {	// 일정관련자료 어레이에 출력
	  $arr_repeat = fn_repeat_schedule($pYear, $pMonth, $plan_start, $plan_end, $plan_repeat_cycle, $plan_repeat_unit);
	  For ($i = $plnstartMM; $i <= $plnendMM; $i++) {
		For ($j = $plnstartDD; $j <= $plnendDD; $j++ ) {
			if ( $arr_repeat[$i][$j] == "*") {
                $arr_plan[$i][$j] = $arr_plan[$i][$j].$plan_title."|&Oslash;|".$plan_url."|&Oslash;|".$plan_detail."|&Oslash;|".$plan_bgcolor."|&Oslash;|".$plan_flagicon."|&Oslash;|".$category_title."|&Oslash;|".$category_color."|&Oslash;|".$plan_reply."|&Oslash;|".$plan_time."|&Oslash;|".$plan_new."|&Oslash;|".$plan_img."|#&Oslash;#|";   // 어레이에 추가 1차분리자= "|#&Oslash;#|", 2차 분리자 "|&Oslash;|"
			}
		}
	  }
	}	// 일정관련자료 어레이에 출력 끝

	}   // 취소일정이 아닐때 처리 끝

}	
?>
<!--@end-->

<!--// -----달력작성 ----------------------- -->
<style type="text/css">
/* {$var_version} */
.planner_calendar thead th { border:1px solid #ccc; height:27px; background: url(<?php echo $skinpath?>images/calendar/tablehd_bg.png) repeat-x; }
.planner_calendar tbody .today_bg { background:{$today_bgcolor}; border:medium solid; border-color:{$today_bodercolor}; }
.planner_calendar tbody .day_bgcolor { background:{$day_bgcolor};  }
.planner_calendar tbody .day_bgcolor2 { background:{$day_bgcolor2};  }
.planner_calendar tbody .today_bgcolor { background:{$today_bgcolor};  }
.planner_calendar tbody .brd_left { border-left: medium solid {$today_bodercolor}; }
.planner_calendar tbody .brd_bottom { border-bottom: medium solid {$today_bodercolor}; }
.planner_calendar tbody .brd_top { border-top: medium solid {$today_bodercolor}; }
.planner_calendar tbody .brd_right { border-right: medium solid {$today_bodercolor}; }
.planner_calendar tbody .brd_all { border:medium solid; border-color:{$today_bodercolor}; }
</style>

<!--@if($device == big_size )--> <!--// for big_calendar -->
<style type="text/css">
#columnLeft, .columnLeft, .bloozLeft, .bread-left, .bread-crumb {display:none;}
#columnRight, .columnRight, #bloozLayout .bloozRight {background:none; width:100%;}
</style>
<!--@end-->

<!--@if($device == printer )--> <!--// for print -->
<style type="text/css">
body, #contentBody {color : #000000; background : #FFFFFF;}
#header, #footer, #columnLeft, .boardInformation {display:none;}

#top, #menu, .columnLeft, .bloozLeft, .bread-crumb, .bread-left, .boardInformation {display:none;}
#columnRight, .columnRight, #bloozLayout .bloozRight {background: #FFFFFF; width:100%; padding:0px; border:none;}

.planner_navigation {display:none;}
.planner_calendar tbody .today_bg { background:{$day_bgcolor}; border:1px solid #ccc;}
.planner_calendar tbody .today_date_bg { background:{$day_bgcolor};}
.planner_calendar tbody .brd_all { border:none;}
.planner_calendar tbody .today_bgcolor { background:{$day_bgcolor};  }
</style>
<!--@end-->

<!--// 주간 계획 -->
<!--@if($is_logged && $logged_info->member_srl)-->
<style type="text/css">
.weekPlan{float:left; background :{$today_bgcolor};}
.weekPlanNavigation{ position:relative;  width:95%; height:15px; margin-left:3%; margin-bottom:-15px; z-index:10;}
.weekPlanNavigation button{ position:absolute; top:0; font-size:10px; font-family:Tahoma; background:none; border:1; padding:0; cursor:pointer;}
.weekPlanNavigation button.prevWeek{ left:0; width:25px;}
.weekPlanNavigation button.prevDay{ left:30px; width:20px;}
.weekPlanNavigation button.nextWeek{ right:0; width:25px;}
.weekPlanNavigation button.nextDay{ right:30px; width:20px;}
</style>

<!--@if($_COOKIE["mobile"])-->
	<style type="text/css">
	.planner123{ width:100%; float:left;}
	.weekPlan{ width:100%; float:left;}
	</style>
<!--@else-->
	<style type="text/css">
	.planner123{ width:53%; float:right;}
	.weekPlan{ width:44%; float:left;}
	</style>
<!--@endif-->


{@$plan_weekday = date("w", mktime(0,0,0,$pMonth, $pDay, $pYear))}
{@$tmp_desc_sharpen = "건강:&#x0A;&#x0A;&#x0A;감정:&#x0A;&#x0A;&#x0A;정신:&#x0A;&#x0A;&#x0A;지식:&#x0A;&#x0A;"}
{@$tmp_desc_role = "개인:&#x0A;&#x0A;&#x0A;가정:&#x0A;&#x0A;&#x0A;직장:&#x0A;&#x0A;&#x0A;종교:&#x0A;&#x0A;&#x0A;기타:&#x0A;&#x0A;"}
{@$tmp_desc_task = "--꼭 해야할일--&#x0A;&#x0A;&#x0A;&#x0A;--하면 좋은일--&#x0A;&#x0A;&#x0A;&#x0A;--관심 사항---&#x0A;&#x0A;"}
{@$tmp_desc_remark = "금주 관심사항:&#x0A;&#x0A;"}
<div class="weekPlan">
    <div class="weekPlanNavigation">
        <button type="button" class="prevWeek" title="prevWeek" onclick="location.href='<?php echo $linkpath?>&listStyle=planner_weekly&pYear=<?php echo $pYear?>&pMonth=<?php echo $pMonth?>&pDay=<?php echo $pDay-7?>'">&lt;&lt;</button> 
		<button type="button" class="prevDay" title="prevDay" onclick="location.href='<?php echo $linkpath?>&listStyle=planner_weekly&pYear=<?php echo $pYear?>&pMonth=<?php echo $pMonth?>&pDay=<?php echo $pDay-1?>'">&lt;</button>
		<button type="button" class="nextDay" title="nextDay" onclick="location.href='<?php echo $linkpath?>&listStyle=planner_weekly&pYear=<?php echo $pYear?>&pMonth=<?php echo $pMonth?>&pDay=<?php echo $pDay+1?>'">&gt;</button> 
		<button type="button" class="nextWeek" title="nextWeek" onclick="location.href='<?php echo $linkpath?>&listStyle=planner_weekly&pYear=<?php echo $pYear?>&pMonth=<?php echo $pMonth?>&pDay=<?php echo $pDay+7?>'">&gt;&gt;</button>

		<div style="clear:both; color:brown; font: bold 15px verdana; padding-left:20%;"><?php echo $pWeekday?>,&nbsp;&nbsp;<?php echo $pMon_short?>&nbsp;&nbsp;<?php echo $pDay?>,&nbsp;&nbsp;<?php echo $pYear?><br/><br/></div>
		<input type="hidden" id="myplan_content" value='{$myplan_content}'></input>
		<input type="hidden" id="myplan_title" value='{$myplan_title}'></input>
    </div>

	<div style="clear:both; height:30px; "></div>

	<div style="float:left;  width:46%; margin-left:3%;"><span style="">-Today task(오늘업무)-<br/></span>
		<textarea id="task" style="width:97%; font-size:12px;" rows="29" name="sharpen"><!--@if($myplan_arr_week[$plan_weekday]==null)-->{$tmp_desc_task}<!--@else-->{$myplan_arr_week[$plan_weekday]}<!--@endif--></textarea>
	</div>

	<div style="float:left; width:46%; margin-left:2%;">
		<div>-Sharpen(다듬기)-<br/>
			<textarea id="sharpen" style="width:97%; font-size:12px;" rows="12" name="task"><!--@if($myplan_arr_week[7]==null)-->{$tmp_desc_sharpen}<!--@else-->{$myplan_arr_week[7]}<!--@endif--></textarea>
		</div>
		<div style="margin-top:6px;">-Role/Goal(역활/목표)-<br/>
			<textarea id="role" style="width:97%; font-size:12px;" rows="15" name="goal"><!--@if($myplan_arr_week[8]==null)-->{$tmp_desc_role}<!--@else-->{$myplan_arr_week[8]}<!--@endif--></textarea>
		</div>
	</div>
	<div style="clear:both; margin-left:3%; " ><br/>-Remark(관심사항)-<br/>
		<textarea id="remark" style="width:95%; font-size:12px; " rows="7" name="remark"><!--@if($myplan_arr_week[9]==null)-->{$tmp_desc_remark}<!--@else-->{$myplan_arr_week[9]}<!--@endif--></textarea>
	</div><br/>
	<div style="padding-left:45%;" >
		<span class="buttonOfficial"><button type="button" onclick="doUpdateMyplan('{$module_info->module}','{$myplan_module_srl}','{$myplan_srl}', '{$week_count}', '{$plan_weekday}')">{$lang->cmd_registration}</button></span><br/><br/>
	</div>
	<div style="width:94%; padding-left:3%;"> <!--// 경구출력 -->
		<?php $epigrams_arr = get_text_file($skinpath, '20'); ?>
		<span style="color:brown"><?php echo $epigrams_arr[0]; ?></span><br/><br/>
	</div>
</div>
<!--@else-->
<div class="weekPlan">
	<span style="color:brown; font: bold 12px verdana;"><br/><br/><br/>&nbsp;로그인을 하시면 주간계획을 볼 수 있습니다. <br/><br/><br/><br/></span>
</div>
<!--@endif-->
<!--// 주간 계획 끝-->

<!--@if($_COOKIE["mobile"])-->
<div style="clear:both; height:5px;"></div>
<!--@endif-->

<!--// 달력 시작-->
<div class="planner123">
    <!--//  버튼 -->
    <div class="planner_control">
        <div class="planner_this" style="float:left;">
            <!--//숫자형식으로 년월 표시-->
            <!--//    <font size="4" COLOR=green><b><?php echo $pYear?>年 <?php echo $pMonth?>月&nbsp;&nbsp;(<?php echo $pYear+2333?>)</b></font>-->
            <!--//영문형식으로 년월 표시-->
            <?php echo $pMon?>&nbsp;<?php echo $pYear?>
		</div>
        <div class="planner_navigation">
			<form style="float:left; width:65px;" name = "fm_select_year">
			<select style ="height:17px; margin:0; padding:0; font-size:11px;" name="selectyear" onchange="document.location.href='<?php echo $linkpath?>&amp;pOption=<?php echo $pOption?>&amp;pYear=' + this.options[this.selectedIndex].value +'&amp;pMonth=<?php echo $pMonth?>'+'&amp;pDay=<?php echo $pDay?>'">
			<option value='<?php echo $pYear?>'><?php echo $pYear?></option>
			<?php for ($j=$todayYY+10; $j>=$todayYY-5; $j-- ) { echo ("<option value='".$j."'>".$j."</option>"); } ?>
			</select></form>
			<!--@if(!$_COOKIE["mobile"])-->
            <img  style="float:left;" src="images/calendar/month_t.gif" width="39" height="15" />
			<a href="<?php echo $linkpath?>&amp;pOption=<?php echo $pOption?>&amp;pYear=<?php echo $pYear?>&amp;pMonth=<?php echo $pMonth-1?>&amp;pDay="><img  style="float:left;" src="images/calendar/btn_prev_year.gif" width="17" height="15" alt="전월" /></a>
            <?php
            for ($i=1; $i < 13; $i++) {
            ?>
            <a style="float:left;" href="<?php echo $linkpath?>&amp;pOption=<?php echo $pOption?>&amp;pYear=<?php echo $pYear?>&amp;pMonth=<?php echo $i?>&amp;pDay="><img src="images/calendar/month_<?php echo $i?><?php IF($pMonth == $i){ ?>_on<?php }?>.gif" width="17" height="15" alt="<?php echo $i?>월" /></a>
            <?php
            }
            ?>
			<!--@else-->
			<a href="<?php echo $linkpath?>&amp;pOption=<?php echo $pOption?>&amp;pYear=<?php echo $pYear?>&amp;pMonth=<?php echo $pMonth-1?>&amp;pDay="><img  style="float:left;" src="images/calendar/btn_prev_year.gif" width="17" height="15" alt="전월" /></a>
            <span  style="float:left;"><a href="<?php echo $linkpath?>&amp;pOption=<?php echo $pOption?>&amp;pYear=<?php echo $todayYY?>&amp;pMonth=<?php echo $todayMM?>&amp;pDay=">T-Mon</a></span>
			<!--@endif-->
            <a style="float:left;" href="<?php echo $linkpath?>&amp;pOption=<?php echo $pOption?>&amp;pYear=<?php echo $pYear?>&amp;pMonth=<?php echo $pMonth+1?>"><img src="images/calendar/btn_next_year.gif" width="17" height="15" alt="익월" /></a>
        </div>
    </div>
	<!-- 카테고리 탭 출력 -->
	<!--@if($module_info->use_category == "Y")-->
	<div style="clear:both;">
		<!--@if(!$category)-->
			<button type="button" id="btn_all" onclick="doChgCategory({$val->category_srl}); return false;" class="button" style='font-size:12px; padding:0; cursor:pointer; color:{$val->color};'><span class="strong">분류전체</span></button>
		<!--@else-->
			<button type="button" id="btn_all" onclick="doChgCategory({$val->category_srl}); return false;" class="button" style='font-size:12px; padding:0; cursor:pointer; color:{$val->color};'>분류전체</button>
		<!--@end-->    
		<!--@foreach($category_list as $val)-->
			<!--@if($category==$val->category_srl)-->
				<button type="button" id={$val->title} onclick="doChgCategory({$val->category_srl}); return false;" class="button" style='font-size:12px; padding:0; cursor:pointer; color:{$val->color};'><span class="strong" >{$val->title}</span></button>
			<!--@else-->
				<button type="submit" id={$val->title} onclick="doChgCategory({$val->category_srl}); return false;" class="button" style='font-size:12px; padding:0; cursor:pointer; color:{$val->color};'>{$val->title}</button>
			<!--@end-->
		<!--@end-->                           
	</div>
	<!--@end-->
	<!--//  달력 -->
    <table class="planner_calendar" summary="플래너123">
        <thead>
            <tr>
                <th scope="col" width="23%" colspan="2">Date</th>
                <th scope="col" width="*">Schedule</th>
                <th scope="col" width="17%">Note</th>
            </tr>
        </thead>
        <tbody>

        <?php
        $weekcount = count($Calmain);
        for($i=0; $i<$weekcount; $i++) {
            for ($j=0; $j<7; $j++) {
                if ($Calmain[$i][$j] != "*") {   //  달력상의 빈날제거

				if($pYear == $todayYY && $pMonth == $todayMM && $Calmain[$i][$j] == $todayDD) {
					$tr_bgcolor = "class='today_bgcolor'";
					$td_left = "";
					$td_middle = "class = 'plan brd_all'";
					$td_right = "";
				} else {
					if($i%2) {
						$tr_bgcolor = "class='day_bgcolor'";
						$td_left =   "";
						$td_middle = "class = 'plan'";
						$td_right =  "";
					} else {
						$tr_bgcolor = "class='day_bgcolor2'";  // 주별 배경색 변경을 위해..
						$td_left =   "";
						$td_middle = "class = 'plan'";
						$td_right =  "";
					}
				}
        ?>

                <tr <?php echo $tr_bgcolor ?> onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='{$mouseover_bgcolor}'">

                    <?php
                    $tmpfld_1 = null;
                    $outtext = null;
                    $k = $Calmain[$i][$j];

                    if ($Calmain[$i][$j]== "*")
                    {
                        $Calmain[$i][$j]=null;
                    }
                    else
                    {
                        $tempday=$Calmain[$i][$j];

                        // --해당일의 음력일자,절기,합삭,망,12궁,휴일,기념일 얻기---
                        $tmparr=explode("-",$Lunarday[$pMonth][$Calmain[$i][$j]]);  //음력날자
                        if ($tmparr[3] == "윤달") {
                            $youndal = "윤";
                        }
                        else {
                            $youndal = null;
                        }

                        $tmpfld1 ="".$youndal.$tmparr[1]."-".$tmparr[2]."";
                        $tmparr2=explode("-",$GanjiJeolki[$pMonth][$Calmain[$i][$j]]);  //24절기
                        $tmparr4=explode("-",$Holiday[$pMonth][$Calmain[$i][$j]]);  // 공휴일
                        $tmparr5=explode("-",$Memday[$pMonth][$Calmain[$i][$j]]);   // 기념일
                        $tmparr6=explode("|#&Oslash;#|",$arr_plan[$pMonth][$Calmain[$i][$j]]);  // 일정/플랜  1차 "|#&Oslash;#|",로 분리

                    echo "<td width=5% ".$td_left.">";
                        // 첫칸 왼쪽1 --일자---
                        $outtext = "";

                        if ($j==0 || $tmparr4[0] != null) {
                            $tmpfld = "<span class='holiday strong'>".$Calmain[$i][$j]."</span>";    // 일요일 및 휴일
                        }
                        elseif ($j==6) {
                            $tmpfld = "<span class='saturday strong'>".$Calmain[$i][$j]."</span>";    // 토요일
                        }
                        else {
                            $tmpfld = "<span class='weekday strong'>".$Calmain[$i][$j]."</span>";    // 평일
                        }

					if ($ind_duplicated_schedule == 'N' && mktime(0,0,0,$pMonth,$Calmain[$i][$j],$pYear) < mktime(0,0,0,$todayMM,$todayDD,$todayYY) ) {  // 중복일정금지 및 과거일자 는 링크없이.
		               $templink = "<a href='#' style='cursor:no-drop;'>".$tmpfld."</a>";		
		 			 } else {
                        $templink = getUrl('act','dispBoardWrite','document_srl','') ;  // 일자 클릭시 쓰기로 이동
                        $templink .= "&amp;extra_vars1=$pYear-$tempmonth-".substr("0".$tempday,-2);    // 확장변수에 값 넣는것은 잘 안됨
                        $templink = "<a href=".$templink.">".$tmpfld."</a>";   // 일자
					 }
                        $outtext = "<li>".$templink."</li>";

                        // 첫칸 왼쪽2 --요일---
                        switch(true)
                        {
                            case ($j==0): $tmpfldw = "<span class='holiday'>Sun</span>";  break; // 일요일
                            case ($j==1): $tmpfldw = "<span class='weekday'>Mon</span>";  break; // 월요일
                            case ($j==2): $tmpfldw = "<span class='weekday'>Tue</span>";  break; // 화요일
                            case ($j==3): $tmpfldw = "<span class='weekday'>Wed</span>";  break; // 수요일
                            case ($j==4): $tmpfldw = "<span class='weekday'>Thu</span>";  break; // 목요일
                            case ($j==5): $tmpfldw = "<span class='weekday'>Fri</span>";  break; // 금요일
                            default: $tmpfldw = "<span class='saturday'>Sat</span>"; break; // 토요일
                        }
                        $outtext .= "<li>".$tmpfldw."</li>";
                        $outtext = "<ul>".$outtext."</ul>";
                        echo $outtext; // 요일
						$outtext = null;
                    echo "</td >";
                    echo "<td >";
                       // 첫칸 오른쪽1 --공휴일---
                        if ($ind_holiday == 'Y' && $tmparr4[0] != null) {
                            $outtext .= "<li class='holiday'>".$tmparr4[0]."</li>"; // 공휴일
                        }
                        // 첫칸 오른쪽2 --음력/절기---
                        if ($ind_lunar_all == 'Y' && $Calmain[$i][$j] != null) {	
                            $outtext .= "&nbsp;"."<span class='lunar'>".$tmpfld1."</span>";    // 음력 - 모든날자 표시
                        }
						if ($ind_lunar == 'Y' && ($tmparr[2] == 1 || $tmparr[2] == 10 || $tmparr[2] == 15 || $tmparr[2] == 20)) {  
							$outtext .= "&nbsp;"."<span class='lunar'>".$tmpfld1."</span>";    // 음력 - 1,10,15,20일 표시
						}
						if ($ind_iljin == 'Y') {  // 일진 표시
							$outtext .= "&nbsp;"."<span class='lunar'>".substr($tmparr2[2], 0, 6)."</span>";   // 일진
						}
                        if ($ind_24term == 'Y') {  // 절기 표시
                            $outtext .= "&nbsp;<li><span class='seasons24'>".$tmparr2[4]."</span></li>";  // 절기
						}
                       $outtext = "<ul >".$outtext."</ul>";
                       echo $outtext; // 음력, 절기
					   $outtext = null;
                    echo "</td>";
                    echo "<td ".$td_middle.">";
                        // 두째칸 --일정/플랜---
                        if (!empty($tmparr6[0]))
                        {
                            foreach ($tmparr6 as $val)
                            {
                              if (!$val = trim($val)) continue; // 빈어레이는 무시하고 빠진다.
                                $tmparr7=explode("|&Oslash;|",$val);  // 일정/플랜  2차 "|&Oslash;|",로 분리
                                if (!empty($tmparr7[0]))
                                {
                                    $lplan_cat = (!empty($tmparr7[5]))?"<span style='color:".$tmparr7[6].";'>[".$tmparr7[5]."] </span>":""; // 분류
								    $lplan_state = null;
								    if (!empty($tmparr7[4]))
								    {
								    	$arr_icon = explode(",",$tmparr7[4]);
										foreach ($arr_icon as $icon)
										{
											if ($icon = trim($icon))
											{
											if (file_exists($skinpath."images/icon/".$icon)) {
											    $icon_folder = "";
											} else if (file_exists($skinpath."images/icon/client/".$icon)) {
											    $icon_folder = "client/";
											} else if (file_exists($skinpath."images/icon/manager/".$icon)) {
											    $icon_folder = "manager/";
											}
			                                $lplan_state .= "<img src='images/icon/".$icon_folder.$icon."'/>"; //일정확인
											}
										}
									}
									$lplan_reply = (!empty($tmparr7[7]))?"<span class='small'>[".$tmparr7[7]."]</span>":""; //댓글숫자

 								if ($ind_duplicated_schedule == "N") { // 중복금지 
									$time_disply_fld = "[".$tmparr7[8]."]&#x0A;";   //선택내용 전부
								} else {
									$tmp_time = explode(",",$tmparr7[8]);		
									if ($tmparr7[8]){ 
										if ($tmp_time[1]){
											$time_disply_fld = "[".$tmp_time[0]."-".trim($tmp_time[count($tmp_time)-1])."] ";  // 일정 시간
										} else {
											$time_disply_fld = "[".$tmp_time[0]."- ] ";  // 일정 시작시간
										}
									} else { 
										$time_disply_fld = null; 
									} //시간표시
								}

								// 배경색상 적용 옵션 반영 (단, 작성시 제목에 색상을 적용한 경우는 글자색이 그대로 유지됨)
								if ($ind_bgcolor_option == "picker_bg"){	// 선택색상을->배경색
									$tmp_style = "style='clear:both; background-color:".$tmparr7[3]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_0 = "style='float:left; background-color:".$tmparr7[3]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_1 = "style='padding:5px 0 0 5px; background-color:".$tmparr7[3]."; border:medium double  #FFFFFF;'";
									$tmp_style2 = "style='background-color:".$tmparr7[3].";'";
								} else if ($ind_bgcolor_option == "picker_text"){	// 선택색상을->글자색
									$tmp_style = "style='clear:both; color:".$tmparr7[3]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_0 = "style='float:left; color:".$tmparr7[3]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_1 = "style='padding:5px 0 0 5px; color:".$tmparr7[3]."; border:medium double ".$tmparr7[3].";'";
									$tmp_style2 = "style='color:".$tmparr7[3].";'";
								} else if ($ind_bgcolor_option == "category_bg" && $ind_use_category == "Y"){	// 분류색상을->배경색
									$tmp_style = "style='clear:both; color:whitesmoke; background-color:".$tmparr7[6]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_0 = "style='float:left; color:whitesmoke; background-color:".$tmparr7[6]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_1 = "style='padding:5px 0 0 5px; color:whitesmoke; background-color:".$tmparr7[6]."; border:medium double #FFFFFF;'";
									$tmp_style2 = "style='color:whitesmoke; background-color:".$tmparr7[6].";'";
								} else if ($ind_bgcolor_option == "category_text" && $ind_use_category == "Y"){	// 분류색상을->글자색
									$tmp_style = "style='clear:both; color:".$tmparr7[6]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_0 = "style='float:left; color:".$tmparr7[6]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_1 = "style='padding:5px 0 0 5px; color:".$tmparr7[6]."; border:medium double ".$tmparr7[6].";'";
									$tmp_style2 = "style='color:".$tmparr7[6].";'";
								}else {	// 기본은 선택색상->배경색
									$tmp_style = "style='clear:both; background-color:".$tmparr7[3]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_0 = "style='float:left; background-color:".$tmparr7[3]."; border-bottom:1px solid #FFFFFF;'";
									$tmp_style1_1 = "style='padding:5px 0 0 5px; background-color:".$tmparr7[3]."; border:medium double  #FFFFFF;'";
									$tmp_style2 = "style='background-color:".$tmparr7[3].";'";
								}

									//시간+일정제목
									if ($ind_image_diary == "Y" && !empty($tmparr7[10])){
										echo "<a ".$tmp_style2." href=".$tmparr7[1]." title='".$tmparr7[2]."'><img style='clear:both; float:left; border-bottom:1px solid #FFFFFF;' src='".$tmparr7[10]."'/>&nbsp;" .$time_disply_fld.$tmparr7[0]."</a>&nbsp;".$lplan_cat.$lplan_state.$lplan_reply.$tmparr7[9]."<br/><div style='clear:both; border-bottom:1px solid #FFFFFF;'></div>";
									} else if ($ind_image_diary == "F" && !empty($tmparr7[10])){
										echo "<a ".$tmp_style2." href=".$tmparr7[1]." title='".$tmparr7[2]."'><img style='clear:both; float:left; border-bottom:1px solid #FFFFFF;' src='".$tmparr7[10]."'/>&nbsp;" .$time_disply_fld.$tmparr7[0]."</a>&nbsp;".$lplan_cat.$lplan_state.$lplan_reply.$tmparr7[9]."<br/><div style='clear:both;border-bottom:1px solid #FFFFFF;'></div>";
									} else {
										echo "<a ".$tmp_style2." href=".$tmparr7[1]." title='".$time_disply_fld.$tmparr7[2]."'>&nbsp;" .$time_disply_fld.$tmparr7[0]."</a>&nbsp;".$lplan_cat.$lplan_state.$lplan_reply.$tmparr7[9]."<br/><div style='clear:both; border-bottom:1px solid #FFFFFF;'></div>";
									}
								}
                            }
                       }
                     echo "</td>";
                     echo "<td ".$td_right.">";
                        // 셋째칸 두째줄 --기념일---
						if ($ind_memday == 'Y' && !empty($tmparr5[0])) { // 기념일만 체크
							echo "<li><span class='memorial'>".$tmparr5[0]."</span></li>"; // 기념일
						}
                     echo ("</td></tr>");
                    }
                }  //  달력상의 빈날제거
            }
        }
        ?>

        </tbody>
    </table>
<!--@if($display_offset != $offset && $offset != null && $device != printer )-->
	Server time is <font color='blue'>{date("l, F j, Y, g:i a", $display_timestamp)}</font>
	and your time is <font color='blue'>{date("l, F j, Y, g:i a", $client_timestamp)}</font> : {($display_timestamp-$client_timestamp)*(-1)/3600}Hrs difference.
<!--@end-->
</div>
<div style='clear:both;'></div>
<!--// 관리자로 로그인 했을경우 리스트 출력 -->
<!--@if($grant->manager)-->
	<!--@if($module_info->display_doc_list != "N")-->
		<!--#include("./_style.list_planner.html")-->
	<!--@endif-->
<!--@else-->
	{@$write_ymd = date('Y',$wrk_timestamp)."-".date('m',$wrk_timestamp)."-".date('d',$wrk_timestamp)}
    <div class="buttonRight" style="clear:both; float:right;">
        <a href="{getUrl('act','dispBoardWrite','document_srl','','extra_vars1',$write_ymd)}" class="buttonOfficial"><span>{$lang->cmd_write}</span></a>
    </div>
<!--@end-->

<!--// 툴팁  XE V1.4.1.0에서 Qtip 문제 발생으로 아래를 주석 처리함 -->
<!--//%load_js_plugin("qtip")-->
<!--//
<script type="text/javascript">//<![CDATA[
var $j = jQuery.noConflict();
$j(document).ready(function()
{
    // qtip
    $j('a[title]').qtip({
      position: {
         corner: {        //bottomLeft, bottomRight, bottomMiddle, topRight, topLeft, topMiddle,
                        //leftMiddle, leftTop, leftBottom, rightMiddle, rightBottom, rightTop
            target: 'topMiddle',                                  
            tooltip: 'bottomMiddle'
         }
      },
      style: {
         name: 'green', //defaults,cream,light,dark,red,green,blue
         padding: '7px 13px',
         width: {
            max: 250,
            min: 0
         },
      border: {
         width:  3,  //border 굵기 지정
         radius: 0   //coner round 반경 지정(색을 지정하려면 끝에 "0,"처럼 끝에,를 붙일것)
         //color: '#A9DB66' //border color
         },
         tip: true
      }
    });
});
//]]></script>
-->

<!--%import("js/php.weekplan.min.js")--> <!--// php함수를 js로 => 사이트: http://phpjs.org/ -->
<script type="text/javascript">
var $j2 = jQuery.noConflict();
function doUpdateMyplan(module_name, module_srl, document_srl, week_count, weekday) { 
	//alert(module_name +"-"+ module_srl +"-"+ document_srl +"-"+ week_count +"-"+ weekday);
	var content = $j2('#myplan_content').val();
	var title = $j2('#myplan_title').val();
	var content_arr = new Array();
	content_arr = explode('|=@=|',$j2('#myplan_content').val());
	var content_arr_week = explode('|@|',content_arr[week_count]);
	var sharpen = str_replace("'","`", $j2('#sharpen').val());
	var role = str_replace("'","`", $j2('#role').val());
	var remark = str_replace("'","`", $j2('#remark').val());
	var task = str_replace("'","`", $j2('#task').val());
	content_arr_week[7] = sharpen;
	content_arr_week[8] = role;
	content_arr_week[9] = remark;
	content_arr_week[weekday] = task;
	var new_content_week = implode('|@|',content_arr_week);
	content_arr[week_count] = new_content_week;
	var new_content = implode('|=@=|',content_arr);

	var new_doc = new Array();
	new_doc['module_srl'] = module_srl;
	new_doc['document_srl'] = document_srl;
	new_doc['title'] = title;
	new_doc['content'] = new_content;
	new_doc['is_secret'] = "Y";
	new_doc['extra_vars'] = "X";
    switch (module_name){
        case 'board':
			exec_xml('board', 'procBoardInsertDocument', new_doc, completeCallModuleAction);
        break;
        case 'bodex':
			exec_xml('bodex', 'procBoardInsertDocument', new_doc, completeCallModuleAction);
        break;
        default:
			exec_xml('board', 'procBoardInsertDocument', new_doc, completeCallModuleAction);
        break;
    }
}

/* 카테고리 이동 */
function doChgCategory(category_srl) {
	if (!category_srl) {
    location.href = decodeURI(current_url).setQuery('category','');
	} else {
    location.href = decodeURI(current_url).setQuery('category',category_srl);
	}
}

</script>