<?php
$template = <<<END
<section class="hairsalon1_grid">
<div class="list-grid">
<!--{each item/list}-->
<div class="list {val item/list/view}">
<!--{def item/list/image}-->
<figure><img src="user_data/{val item/list/image}" alt="{val item/list/name}"></figure>
<!--{/def}-->
<div class="text">
<h4>{val item/list/name}</h4>
<p class="markdown-body">{rval item/list/text}</p>
</div>
</div>
<!--{/each}-->
</div>
<!--/.list-grid-->
</section>
END;

$hairsalon1_grid = array(						// ブロック
		"title" => "hairsalon1 グリッド",	// ブロックの名称
		"name" => "hairsalon1_grid",			// 名称、重複すると正しく動作しません
		"template" => $template,		// ブロックのテンプレート
		"input" => array(				// ブロックの入力定義
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=hairsalon1_grid",
			"class" => "notice",
		),
		"name1" => array(
			"title" => "名前1",
			"type" => "text",
		),
		"text1" => array(
			"title" => "コメント1",
			"type" => "textarea",
		),
		"image1" => array(
			"title" => "画像1",
			"type" => "image",
		),
		"view1" => array(
			"title" => "出現1",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy1" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name2" => array(
			"title" => "名前2",
			"type" => "text",
		),
		"text2" => array(
			"title" => "コメント2",
			"type" => "textarea",
		),
		"image2" => array(
			"title" => "画像2",
			"type" => "image",
		),
		"view2" => array(
			"title" => "出現2",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy2" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name3" => array(
			"title" => "名前3",
			"type" => "text",
		),
		"text3" => array(
			"title" => "コメント3",
			"type" => "textarea",
		),
		"image3" => array(
			"title" => "画像3",
			"type" => "image",
		),
		"view3" => array(
			"title" => "出現3",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy3" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name4" => array(
			"title" => "名前4",
			"type" => "text",
		),
		"text4" => array(
			"title" => "コメント4",
			"type" => "textarea",
		),
		"image4" => array(
			"title" => "画像4",
			"type" => "image",
		),
		"view4" => array(
			"title" => "出現4",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy4" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name5" => array(
			"title" => "名前5",
			"type" => "text",
		),
		"text5" => array(
			"title" => "コメント5",
			"type" => "textarea",
		),
		"image5" => array(
			"title" => "画像5",
			"type" => "image",
		),
		"view5" => array(
			"title" => "出現5",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy5" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name6" => array(
			"title" => "名前6",
			"type" => "text",
		),
		"text6" => array(
			"title" => "コメント6",
			"type" => "textarea",
		),
		"image6" => array(
			"title" => "画像6",
			"type" => "image",
		),
		"view6" => array(
			"title" => "出現6",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy6" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name7" => array(
			"title" => "名前7",
			"type" => "text",
		),
		"text7" => array(
			"title" => "コメント7",
			"type" => "textarea",
		),
		"image7" => array(
			"title" => "画像7",
			"type" => "image",
		),
		"view7" => array(
			"title" => "出現7",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy7" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name8" => array(
			"title" => "名前8",
			"type" => "text",
		),
		"text8" => array(
			"title" => "コメント8",
			"type" => "textarea",
		),
		"image8" => array(
			"title" => "画像8",
			"type" => "image",
		),
		"view8" => array(
			"title" => "出現8",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy8" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name9" => array(
			"title" => "名前9",
			"type" => "text",
		),
		"text9" => array(
			"title" => "コメント9",
			"type" => "textarea",
		),
		"image9" => array(
			"title" => "画像9",
			"type" => "image",
		),
		"view9" => array(
			"title" => "出現9",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"dummy9" => array(
			"title" => " ",
			"type" => "comment",
		),
		"name10" => array(
			"title" => "名前10",
			"type" => "text",
		),
		"text10" => array(
			"title" => "コメント10",
			"type" => "textarea",
		),
		"image10" => array(
			"title" => "画像10",
			"type" => "image",
		),
		"view10" => array(
			"title" => "出現10",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
	),
	"repeat" => array("name", "text", "image", "view",),
//	"func" => "func_hairsalon1_grid",		// 処理プログラム（指定がない物は標準処理）
);

block_add($hairsalon1_grid);

// スライドの設定
function func_hairsalon1_grid($def, $info)
{
	$list = array();
	for ($i = 1; $i <= 10; $i++) {
		if ($info["name" . $i]) {
			unset($item);
			$item["name"] = $info["name" . $i];
			$item["text"] = $info["text" . $i];
			$item["image"] = $info["image" . $i . "_file"];
			$list[] = $item;
		}
	}
	$info["list"] = $list;
	return $info;
}
