<?php include_once( "../../../spider.inc.php" ); ?>
{charset:UTF-8}
{template:admin_default.tpl}
{module:member.member.Load}
{module:member.mail.LoadList}
{preset:page_title MEMBER_PERSONAL_LABEL . '管理 > 配信メール一覧'}
		
	<h1>{write:MEMBER_PERSONAL_LABEL}管理 &gt; {write:member.member.memberObject->getUserViewName()} &gt; 配信メール一覧</h1>
		
	{if:IS_ERROR}
		<h2 style="padding-left:2em;color:#FF6666;">エラーです</h2>
		<ul class="error">
		{foreach:errors error}
			<li>{write:error}</li>
		{/foreach}
		</ul>
	{/if}
	<form name="sform" action="./mail.php" method="get">
	<input type="hidden" name="pn" value="{write:member.mail.page_number}" />
	<input type="hidden" name="mi" value="{write:member.mail.target_member_id}" />
	<table style="width:100%;border-style:none;">
	<tbody>
	<tr style="border-style:none;">
		<td style="border-style:none;">
			<select name="tsy">
			<?php for($year=date('Y')+2;$year>date('Y')-10;$year--) { $request_object->setAttribute('page.year',$year); ?>
				<option value="{write:page.year}"
					{if:member.mail.target_start_year=page.year} selected{/if}
					>{write:page.year}</option>
			<?php } ?>
			</select>年<select name="tsm">
			<?php for($month=1;$month<=12;$month++) { $request_object->setAttribute('page.month',sprintf('%02d',$month)); ?>
				<option value="{write:page.month}"
					{if:member.mail.target_start_month=page.month} selected{/if}
					>{write:page.month}</option>
			<?php } ?>
			</select>月<select name="tsd">
			<?php for($day=1;$day<=31;$day++) { $request_object->setAttribute('page.day',sprintf('%02d',$day)); ?>
				<option value="{write:page.day}"
					{if:member.mail.target_start_day=page.day} selected{/if}
					>{write:page.day}</option>
			<?php } ?>
			</select>日～<select name="tey">
			<?php for($year=date('Y')+2;$year>date('Y')-10;$year--) { $request_object->setAttribute('page.year',$year); ?>
				<option value="{write:page.year}"
					{if:member.mail.target_end_year=page.year} selected{/if}
					>{write:page.year}</option>
			<?php } ?>
			</select>年<select name="tem">
			<?php for($month=1;$month<=12;$month++) { $request_object->setAttribute('page.month',sprintf('%02d',$month)); ?>
				<option value="{write:page.month}"
					{if:member.mail.target_end_month=page.month} selected{/if}
					>{write:page.month}</option>
			<?php } ?>
			</select>月<select name="ted">
			<?php for($day=1;$day<=31;$day++) { $request_object->setAttribute('page.day',sprintf('%02d',$day)); ?>
				<option value="{write:page.day}"
					{if:member.mail.target_end_day=page.day} selected{/if}
					>{write:page.day}</option>
			<?php } ?>
			</select>日<input type="submit" value="期間変更" />
		</td>
		<td style="text-align:right;border-style:none;">
			ページ表示数：<select name="pr" onchange="document.sform.submit();">
			<option value="1"{if:member.mail.page_rows=1} selected{/if}>1</option>
			<option value="5"{if:member.mail.page_rows=5} selected{/if}>5</option>
			<option value="10"{if:member.mail.page_rows=10} selected{/if}>10</option>
			<option value="20"{if:member.mail.page_rows=20} selected{/if}>20</option>
			<option value="50"{if:member.mail.page_rows=50} selected{/if}>50</option>
			<option value="100"{if:member.mail.page_rows=100} selected{/if}>100</option>
			</select>
		</td>
	</tr>
	<tr>
		<td colspan="2" style="text-align:right;">
			<input type="button" value="新規メール作成" onclick="memberMemberMailForm('{write:member.member.memberObject->getUniqueId()}')" />
		</td>
	</tr>
	</tbody>
	</table>
	</form>

	<form name="listform">
	<table class="paging" style="margin:0 auto;width:100%;border-style:none;">
	<tr>
		<td style="width:6em;border-style:none;">
			{if:member.mail.has_prev_page}
				<input type="button" value="前のページ" onclick="FormerCommon.prevPage()" onkeypress="FormerCommon.prevPage()" />
			{else}
				<span style="color:#D0D0D0;">前のページ</span>
			{/if}
		</td>
		<td style="text-align:center;border-style:none;">
			{write:member.mail.total_count}件  {write:member.mail.page_number} / {write:member.mail.total_page}ページ
		</td>
		<td style="width:6em;border-style:none;">
			{if:member.mail.has_next_page}
				<input type="button" value="次のページ" onclick="FormerCommon.nextPage()" onkeypress="FormerCommon.nextPage()" />
			{else}
				<span style="color:#D0D0D0;">次のページ</span>
			{/if}
		</td>
	</tr>
	</table>
	<table class="list" style="margin:0 auto;width:100%;">
	<tr>
		<th style="white-space:nowrap;">タイトル</th>
		<th>本文(略)</th>
		<th>情報</th>
	</tr>
	{foreach:member.mail.data_array mail_object}
	<tr>
		<td style="white-space:nowrap;">{write-mpic:mail_object::subject}</td>
		<td style="font-size:x-small;">
			{write:substr(mail_object->'body',0,100)}...
		</td>
		<td><table>
			<tbody>
			<tr>
				<td style="font-size:x-small;white-space:nowrap;">配信日時</td>
				<td style="font-size:x-small;white-space:nowrap;">:</td>
				<td style="font-size:x-small;white-space:nowrap;">{write:mail_object::reserve_date}</td>
			</tr>
			<tr>
				<td style="font-size:x-small;white-space:nowrap;">作成日時</td>
				<td style="font-size:x-small;white-space:nowrap;">:</td>
				<td style="font-size:x-small;white-space:nowrap;">{write:mail_object::registered_date}</td>
			</tr>
			</tbody>
			</table>
		</td>
	</tr>
	{/foreach}
	</table>
	</form>

	<form name="member_mail_delform" action="./delete.php" method="post">
	<input type="hidden" name="mail_id" value="" />
	</form>

<script language="JavaScript" type="text/javascript"><!--
function member_mail_deleteMail(mailId) {
	if( confirm('この操作は取り消せません!\n本当に削除しますか？') ) {
		document.member_mail_delform.mail_id.value	= mailId;
		document.member_mail_delform.submit();
	}
}
//--></script>