<?php
/**
 * 管理側トップ画面
 *
 * Copyright (c) 2010-2011 SetucoCMS Project.(http://sourceforge.jp/projects/setucocms)
 * All Rights Reserved.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @category   Setuco
 * @package    Admin
 * @subpackage View_Script_Index
 * @license    http://www.opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2
 * @copyright  Copyright (c) 2010 SetucoCMS Project.(http://sourceforge.jp/projects/setucocms)
 * @link
 * @version
 * @since      File available since Release 0.1.0
 * @param      string      $ambition               野望
 * @param      Setuco_Form $ambitionForm           野望を編集するフォーム
 * @param      string      $updateStatus           更新状況
 * @param      string      $lastUpdateDate         最終更新日
 * @param      int         $pastDaysFromLastUpdate 最終更新日からの経過日数
 * @param      int         $createdPageCount       今月の作成数
 * @param      string      $diffGoal               今月の作成数と目標作成ページ数との差分
 * @param      int         $totalPageCount         総ページ数
 * @param      int         $pastDaysFromOpen       経過日数
 * @param      string      $openDate               サイト開設日
 * @param      array       $lastCreatedPages       最近作成したページの一覧
 * @author     charlesvineyard
 */
?>

<!-- section"野望" START -->
<div class="section">
    <?php echo $this->partial('error-message.phtml', array('errorForm' => $this->ambitionForm)) ?>
    <form id="<?php echo $this->ambitionForm->getId() ?>" enctype="application/x-www-form-urlencoded" method="<?php echo $this->ambitionForm->getMethod() ?>" action="<?php echo $this->ambitionForm->getAction() ?>">
        <dl id="designs">
            <dt>
                <label for="ambition">野望</label>
            </dt>
            <dd>
                <span id="ambitionView">
                    <em>「<?php echo $this->escape($this->ambition) ?>」</em>
                    <a href="javascript:void(0)" onclick="showAmbitionEdit()">
                        <img src="<?php echo $this->baseUrl('/images/admin/index/btn_ambition_edit.gif') ?>" alt="野望を変更する" width="21" height="21" />
                    </a>
                </span>
                <span id="ambitionEdit">
                    <em><?php echo $this->ambitionForm->getElement('ambition') . "\n" ?></em>
                    <?php echo $this->ambitionForm->getElement('submit') ?>
                    <?php echo $this->ambitionForm->getElement('cancel') . "\n" ?>
                </span>
            </dd>
        </dl>
    </form>
</div>
<!-- section"野望" END -->

<!-- section"現在の状況" START -->
<div class="section nowData">
    <div class="hAreaL">
        <div class="hAreaR">
            <div class="hArea">
                <h3>
                    <img src="<?php echo $this->baseUrl('/images/admin/index/h_nowData.jpg') ?>" alt="現在の状況" width="112" height="22" />
                </h3>
                <p>
                    <a href="<?php echo $this->baseUrl('/admin/index/form-goal') ?>">更新目標の編集</a>
                </p>
            </div>
        </div>
    </div>
    <dl class="straight">
        <dt>更新状況</dt>
        <?php if ($this->updateStatus === Setuco_Data_Constant_UpdateStatus::GOOD): ?>
        <dd><img src="<?php echo $this->baseUrl('/images/admin/index/status_good.jpg') ?>" alt="すごい！最高！！！" width="270" height="140" /></dd>
        <?php elseif ($this->updateStatus === Setuco_Data_Constant_UpdateStatus::NORMAL): ?>
        <dd><img src="<?php echo $this->baseUrl('/images/admin/index/status_normal.jpg') ?>" alt="いい調子！" width="270" height="140" /></dd>
        <?php elseif ($this->updateStatus === Setuco_Data_Constant_UpdateStatus::BAD): ?>
        <dd><img src="<?php echo $this->baseUrl('/images/admin/index/status_bad.jpg') ?>" alt="がんばって！" width="270" height="140" /></dd>
        <?php else: ?>
        <dd><img src="<?php echo $this->baseUrl('/images/admin/index/status_first.jpg') ?>" alt="今月もがんばろう" width="270" height="140" /></dd>
        <?php endif ?>
    </dl>
    <dl class="straight check">
        <dt>今月の作成数</dt>
        <dd><?php echo $this->createdPageCount ?>ページ（<?php echo $this->diffGoal ?>）</dd>
    </dl>
    <dl class="straight">
        <dt>総ページ数</dt>
        <dd><?php echo $this->totalPageCount ?>ページ</dd>
    </dl>
    <dl class="straight check">
        <dt>最終更新日</dt>
        <dd><?php echo $this->lastUpdateDateString ?></dd>
    </dl>
    <dl class="straight">
        <dt>経過日数</dt>
        <dd><?php echo $this->pastDaysFromOpen ?>日目（<?php echo $this->openDate ?>開設）</dd>
    </dl>
</div>
<!-- section"現在の状況" END -->

<!-- section"最近作ったページ" START -->
<div class="section">
    <div class="hAreaL">
        <div class="hAreaR">
            <div class="hArea">
                <h3 id="recentry">
                    <img src="<?php echo $this->baseUrl('/images/admin/index/h_recentlyPage.jpg') ?>" alt="最近作ったページ" width="194" height="23" />
                </h3>
                <p>
                    <a href="<?php echo $this->baseUrl('/admin/page') ?>">ページの一覧（編集・削除）へ</a>
                </p>
            </div>
        </div>
    </div>
    <?php foreach ($this->lastCreatedPages as $page): ?>
        <dl class="contentsList<?php echo $this->cycle(array('', ' check'))->next() ?>">
            <dt class="pageDate"><?php echo $page['create_date'] ?></dt>
            <dd class="pageTitle">
                <a href="<?php echo $this->baseUrl('/admin/page/index/id/' . $page['id']) ?>"><?php echo $this->escape($page['title']) ?></a>
            </dd>
            <dt>カテゴリー</dt>
            <dd><?php echo ($this->escape($page['category_name']))?></dd>
            <dt>制作者</dt>
            <dd><?php echo ($this->escape($page['nickname']))?></dd>
            <dt>公開状態</dt>
            <dd><?php echo ($page['status'])?></dd>
        </dl>
    <?php endforeach ?>
</div>
<!-- section"最近作ったページ" END -->