<?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_Category
 * @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      Zend_Paginator   $paginator    ページャークラス 
 * @param      Setuco_Form      $createForm   カテゴリーを新規作成するフォームクラス
 * @param      Setuco_Form      $updateForm   カテゴリーを編集するフォームクラス
 * @param      array            $categories   一覧ページで表示するカテゴリーデータ
 * @param      array[option]   $flashMessage 新規作成、編集、削除の実行結果のメッセージ
 * @param      Setuco_Form[option] $errorForm バリデートに失敗したフォーム エラーメッセージ表示に使用する
 * @author     suzuki-mar
 */
?>

<!-- topicPath START -->
<div id="topicPath">
    <p>
        <a href="<?php echo $this->baseUrl('/admin') ?>">トップ</a>
        <img src="<?php echo $this->baseUrl('/images/admin/share/topicPath.gif') ?>" width="6" height="11" alt="の中の" />
    </p>
    <p>カテゴリーの追加・編集・削除</p>
</div>
<!-- topicpath END -->

<!-- section START -->
<div class="section">

    <div class="hAreaL">
        <div class="hAreaR">
            <div class="hArea">
                <h3><img src="<?php echo $this->baseUrl('/images/admin/category/h_catAll.jpg') ?>" width="208" height="18" alt="カテゴリーの追加・編集・削除" /></h3>
            </div>
        </div>
    </div>

    <?php echo $this->partial('action-message.phtml', array('flashMessages' => $this->flashMessages)) ?>

    <?php if (isset($this->errorForm)) {
            echo $this->partial('error-message.phtml', array('errorForm' => $this->errorForm));
          }
    ?>


    <form action="<?php echo $this->baseUrl('/admin/category/create') ?>" method="post">
        <p class="default">
            <input type="text" name="cat_name" id="cat_name" class="defaultInput" value="<?php echo $this->escape($this->inputCreateCategoryName) ?>" />
            <input type="submit" class="sub" value="追加" />
        </p>
    </form>

    <table summary="カテゴリー一覧の表です。カテゴリーの追加・編集・削除ができます。" cellpadding="0" cellspacing="0">
        <colgroup>
            <col width="80%" />
            <col width="10%" />
            <col width="10%" />
        </colgroup>
        <thead>
            <tr>
                <th scope="col" id="tableFirst">カテゴリー名
                    <a href="<?php echo $this->baseUrl('/admin/category/index/sort/desc') ?>"><img src="<?php echo $this->baseUrl('/images/admin/share/btn_sort_descending.gif') ?>" width="15" height="15" alt="降順に並び替え" /></a>
                    <a href="<?php echo $this->baseUrl('/admin/category/index/sort/asc') ?>"><img src="<?php echo $this->baseUrl('/images/admin/share/btn_sort_ascending.gif') ?>" width="15" height="15" alt="昇順に並び替え" /></a>
                </th>
                <th scope="col">編集</th>
                <th scope="col">削除</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($this->categories as $key => $category): ?>
                <?php if ($key % 2 === 0): //配列のループが偶数か ?>
            <tr>
                <?php else: ?>
            <tr class='check'>
                <?php endif; ?>

                <?php echo $this->partial('category-row.phtml', array('category' => $category, 'page' => $this->page, 'sort' => $this->sort, 'editId' => $this->editId)) ?>

            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>

    <?php echo $this->paginator; ?>

</div>
<!-- section END -->

