캘린더(calendar) Sample

<?php
/**
 * Calenda Class
 *
 * Created on 2011. 11. 16.
 * @author 불의회상 <hoksi2k@hanmail.net>
 * @package library
 * @subpackage controllers
 * @version 1.0
 */
class Calendar_lib extends CI_Controller {
	function __construct() {
		parent::__construct();
		
		// application/lang 폴더에 한글팩 설치 후 사용 가능
		// URL1 : http://www.codeigniter-kr.org/free/view/6705
		// URL2 : http://www.cikorea.net/free/view/6705
		//
		// $this->config->set_item('language', 'korean');
		$this->load->library('calendar');
	}
	
	function index($year = NULL, $month = NULL) {
		$data['basic'] = $this->calendar->generate();
		$data['cal_2006_06'] = $this->calendar->generate(2006, 6);
		
		$diary = array(
			3  => 'http://example.com/news/article/2006/03/',
			7  => 'http://example.com/news/article/2006/07/',
			13 => 'http://example.com/news/article/2006/13/',
			26 => 'http://example.com/news/article/2006/26/'
		);

		$data['diary'] = $this->calendar->generate(2006, 6, $diary);
		
		$prefs = array (
			'start_day'    => 'monday',
			'month_type'   => 'long',
			'day_type'     => 'short'
		);

        // Library Load시 지정 가능 함
		// $this->load->library('calendar', $prefs);
		
        $this->calendar->initialize($prefs);
		$data['display'] = $this->calendar->generate();

		$prefs = array (
			'show_next_prev'  => TRUE,
			'next_prev_url'   => site_url('calendar_lib/index')
		);

        $this->calendar->initialize($prefs);
		$data['next_prev_link'] = $this->calendar->generate($year, $month);
		
		$prefs['template'] = '
		{table_open}<table class="tablesorter" border="0" cellpadding="0" cellspacing="1">{/table_open}
		{heading_row_start}<thead><tr>{/heading_row_start}
		{heading_previous_cell}<th style="text-align:left;"><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
		{heading_title_cell}<th colspan="{colspan}" style="text-align:center;">{heading}</th>{/heading_title_cell}
		{heading_next_cell}<th style="text-align:right;"><a href="{next_url}">>></a></th>{/heading_next_cell}
		{heading_row_end}</tr></thead>{/heading_row_end}
		{week_row_start}<tr>{/week_row_start}
		{week_day_cell}<td style="text-align:center;">{week_day}</td>{/week_day_cell}
		{week_row_end}</tr>{/week_row_end}
		{cal_row_start}<tr>{/cal_row_start}
		{cal_cell_start}<td style="text-align:center;">{/cal_cell_start}
		{cal_cell_content}<a href="{content}">{day}</a>{/cal_cell_content}
		{cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}
		{cal_cell_no_content}{day}{/cal_cell_no_content}
		{cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
		{cal_cell_blank} {/cal_cell_blank}
		{cal_cell_end}</td>{/cal_cell_end}
		{cal_row_end}</tr>{/cal_row_end}
		{table_close}</table>{/table_close}';

        $this->calendar->initialize($prefs);
		$data['template'] = $this->calendar->generate($year, $month);
		
		$this->load->view('calendar_lib_sample', $data);
	}
}
<?php $this->load->view('inc/header')?>

<table class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
  <th width="20%">종류</th>
  <th>Calenda</th>
  <th width="20%">종류</th>
  <th>Calenda</th>
</tr>
</thead>
<tr>
	<td>기본</td>
	<td><?php echo $basic?></td>
	<td>2006년 6월 지정</td>
	<td><?php echo $cal_2006_06?></td>
</tr>
<tr>
	<td>데이타 지정</td>
	<td><?php echo $diary?></td>
	<td>표시 설정</td>
	<td><?php echo $display?></td>
</tr>
<tr>
	<td>이전달,다음달 링크</td>
	<td><?php echo $next_prev_link?></td>
	<td>템플릿 지정</td>
	<td><?php echo $template?></td>
</tr>
</table>

<?php $this->load->view('inc/footer')?>

© Copyright by hoksi(Page rendered in 0.0070 seconds)