<[include file="common/group_list.tpl"]>
<div id="contents">
<[include file="common/group_menu.tpl"]>
  <br />
  <div id="site-info">
    <h3><img src="<[$TEMPLATE_DIR]>/img/icon_large/view.jpg" align="absmiddle" style="margin-right:8px;">アクセス数</h3>
    <br />
    <fieldset style="width:500px;padding-left:30px;">
    <legend>表示したい形式と期間を指定して下さい。</legend>
    <table width="100%" border="0">
      <tr>
        <td>
        <form method="post" action="./index.php?mode=51&group_code=<[$current_group.group_code]>">
          <label><input name="view" type="radio" value="day" onclick="submit();"<[if $view == "day"]> checked<[/if]> />日別表示</label>
          <select name="period[day]" onchange="submit();">
            <option value="30"<[if $period.day == "30"]> selected<[/if]>>30日間</option>
            <option value="60"<[if $period.day == "60"]> selected<[/if]>>60日間</option>
            <option value="90"<[if $period.day == "90"]> selected<[/if]>>90日間</option>
          </select>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <label><input name="view" type="radio" value="mon" onclick="submit();"<[if $view == "mon"]> checked<[/if]> />月別表示</label>
          <select name="period[mon]" onchange="submit();">
            <option value="6"<[if $period.mon == "6"]> selected<[/if]>>6ヶ月間</option>
            <option value="12"<[if $period.mon == "12"]> selected<[/if]>>12ヶ月間</option>
            <option value="24"<[if $period.mon == "24"]> selected<[/if]>>24ヶ月間</option>
          </select>
        </form>
        </td>
      </tr>
    </table>
    </fieldset>
    <table id="view-table" cellpadding="2" cellspacing="0" width="100%" style="border-bottom:0px;">
      <tr>
        <th width="20%">日付</th>
        <th colspan="2" width="40%">ページビュー数</th>
        <th colspan="2" width="40%">ユーザー数</th>
      </tr>
    <[assign var=total_access value=0]>
    <[assign var=total_user value=0]>
    <[foreach from=$access_array key=date item=access name=access]>
      <tr class="<[cycle values="odd,even"]>">
        <[math equation="x + y" x=$total_access y=$access assign=total_access]>
        <[math equation="ceil((a / m) * 200)" m=$access_array|@max a=$access assign=access_glaph_width]>
        <td class="ac_date"><[if $view == "day"]><[$date|date_format:"%Y年%m月%d日"]><[/if]><[if $view == "mon"]><[$date|date_format:"%Y年%m月"]><[/if]></td>
        <td class="ac_count"><[$access|number_format]></td>
        <td class="ac_graph"><img src="<[$TEMPLATE_DIR]>/img/icon/red.gif" width="<[$access_glaph_width]>" height="5"></td>
        <[math equation="x + y" x=$total_user y=$user_array.$date assign=total_user]>
        <[math equation="(a / m) * 200" m=$user_array|@max a=$user_array.$date assign=user_glaph_width]>
        <td class="ac_count"><[$user_array.$date|number_format]></td>
        <td class="ac_graph"><img src="<[$TEMPLATE_DIR]>/img/icon/blue.gif" width="<[$user_glaph_width]>" height="5"></td>
      </tr>
      <[if $smarty.foreach.access.last]>
      <tr class="odd">
        <td class="ac_date" style="border-top:1px solid #999999;font-weight:bold;">合計</td>
        <td class="ac_count" style="border-top:1px solid #999999;font-weight:bold;"><[$total_access|number_format]></td>
        <td class="ac_graph" style="border-top:1px solid #999999;">&nbsp;</td>
        <td class="ac_count" style="border-top:1px solid #999999;font-weight:bold;"><[$total_user|number_format]></td>
        <td class="ac_graph" style="border-top:1px solid #999999;">&nbsp;</td>
      </tr>
      <[/if]>
    <[foreachelse]>
      <tr class="odd">
        <td colspan="5"style="border-bottom:1px solid #999999;">ログデータがありません。</td>
      </tr>
    <[/foreach]>
    </table>
    <div style="float:right;">※<[if $view == "day"]>1日に1回、翌日の未明に<[/if]><[if $view == "mon"]>1ヶ月に1回、翌月の月初めに<[/if]>更新されます。</div>
  </div>
</div>