<?php
	require("__include-common.php");
define("LOGINCHECK_SESSION_URL", "NO");		// URLをSESSION変数にセットしない。
	require("../account/__logincheck.php");
	$con = my_mysql_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_mysql_query($sql);
	$row = mysql_num_rows($rs);
	if ($row == 0) {
		exit;
	}
?>
	<table id="todo_view_table" cellspacing=0>
<?php
	while ($rec=mysql_fetch_array($rs)) {
?>
		<tr>
	<?php	if (is_write_permit() == True) {	?>
		<td class="todo_view_button" nowrap>
			<input type="button" value="削除" OnClick="del_id(<?= $rec['id_todo'] ?>)">
			<input type="button" value="修正" OnClick="update_view_id(<?= $rec['id_todo'] ?>)">
		</td>
	<?	}	?>
		<td class="todo_view_todo"<? if ($rec['c_color'] <> '') echo ' style=" color:'.$rec['c_color'].';"' ?>>
			<?= ins_br(my_htmlspecialchars($rec['c_todo'])) ?>
		</td>
	<?php	if (is_write_permit() == True) {	?>
		<td class="todo_view_time" nowrap>
			<?= date_from_mysql("y/m/d", $rec['c_registtime']) ?>
			<input type="button" value="↑" OnClick="up_id(<?= $rec['id_todo'] ?>)">
			<input type="button" value="↓" OnClick="down_id(<?= $rec['id_todo'] ?>)">
		</td>
	<?	}	?>
		</tr>
	<?php	if (is_write_permit() == True) {	?>
		<tr id="todo_update_inp<?= $rec['id_todo'] ?>" style="display: none;">
		<td colspan=3 nowrap>
			<input class="text" type="text" id="edit_todo<?= $rec['id_todo'] ?>" size=30 value="<?= $rec['c_todo'] ?>"<? if ($rec['c_color'] <> '') echo ' style="color: '.$rec['c_color'].';"'; ?>">
		<?php
			todo_select_color($rec['c_color'], $rec['id_todo']);
		?>
			<input type="button" value="修正" OnClick="update_done_id(<?= $rec['id_todo'] ?>)">
			<input type="button" value="ｷｬﾝｾﾙ" OnClick="update_cancel_id(<?= $rec['id_todo'] ?>)">
		</td>
		</tr>
	<?	}	?>
<?php
	}
?>
	</table>
<?php
	$con = mysql_close($con);
?>
