<?php
	require("__include-common.php");
define("LOGINCHECK_SESSION_URL", "NO");		// URLをSESSION変数にセットしない。
	require("../account/__logincheck.php");
	$con = my_mysqli_connect(_DB_SCHEMA);

	$sql = 'select * from m_todo where id_account = ' . $_SESSION['current_id'];
	$sql .= ' and c_delete = 0 order by c_priority desc, id_todo asc';
	$rs = my_mysqli_query($sql);
	$row = mysqli_num_rows($rs);
	if ($row == 0) {
		exit;
	}
	if ($_GET['cn'].'' <> '') {
		$view_cnt = $_GET['cn'];
	} else {
		$view_cnt = 1000000;
	}
?>
	<ul id="todo_item_area">
<?php
	$GLOBALS['URL_2_ATAG_SHORT_LEN'] = 24;
	$ix=0;
	while ($rec=mysqli_fetch_array($rs)) {
		if ($ix >= $view_cnt) {
			$display = ' class="todo_onoff"';
			if ($_GET['v'].'' <> 'all') {
				$display .= 'style="display: none;"';
			}
		}
?>
	<li<?= $display ?>>
		<span<? if ($rec['c_color'] <> '') echo ' style=" color:'.$rec['c_color'].';"' ?>><?= ins_atag_br_short($rec['c_todo']) ?></span>
	</li>
<?php
		$ix++;
	}
?>
	</ul>
<?php
	mysqli_close($con);
?>
