<?php
$template = <<<END
<section class="wa2_kiji {val item/bg}">
<!--{def item/maintitle}-->
<h2 class="{val item/bg2}">{val item/maintitle}</h2>
<!--{/def}-->
<!--{each item/list}-->
<!--{def item/list/title}-->
<div class="list-free {val item/list/view}">
<h3 class="{val item/list/order/ord1}">{val item/list/title}</h3>
<div class="text {val item/list/order/ord2}">
<!--{def item/list/subtitle}-->
<h4>{val item/list/subtitle}</h4>
<!--{/def}-->
<!--{def item/list/text}-->
<p class="markdown">{rval item/list/text}</p>
<!--{/def}-->
</div>
<div class="image {val item/list/imgsize} {val item/list/order/ord3}">
<!--{def item/list/image}-->
<img src="user_data/{val item/list/image}" alt="">
<!--{/def}-->
<div>
<!--{def item/list/imgtext}-->
<p class="markdown">{rval item/list/imgtext}</p>
<!--{/def}-->
</div>
</div>
</div><!--/.list-free-->
<!--{/def}-->
<!--{/each}-->
</section>
END;

$wa2_kiji = array(
	"title" => "wa2記事",
	"name" => "wa2_kiji",			// 名称、重複すると正しく動作しません
	"template" => $template,		// ブロックのテンプレート
	"input" => array(
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=wa2_kiji",
			"class" => "notice",
		),
		"maintitle" => array(
			"title" => "メインタイトル",
			"type" => "text",
		),
		"bg2" => array(
			"title" => "タイトル背景",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg2" => "あり",
			),
		),
		"bg" => array(
			"title" => "全体背景",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg1" => "あり",
			),
		),
		"dummy1" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title1" => array(
			"title" => "タイトル1",
			"type" => "text",
		),
		"subtitle1" => array(
			"title" => "サブタイトル1",
			"type" => "text",
		),
		"text1" => array(
			"title" => "テキスト1",
			"type" => "textarea",
		),
		"layout1" => array(
			"title" => "レイアウト1",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"image1" => array(
			"title" => "画像1",
			"type" => "image",
		),
		"imgtext1" => array(
			"title" => "画像下テキスト1",
			"type" => "textarea",
		),
		"view1" => array(
			"title" => "出現1",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"imgsize1" => array(
			"title" => "画像サイズ1",
			"type" => "select",
			"list" => array(
				"w1" => "指定なし",
				"w1" => "画像30%",
				"w2" => "画像50%",
			),
		),
		"dummy2" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title2" => array(
			"title" => "タイトル2",
			"type" => "text",
		),
		"subtitle2" => array(
			"title" => "サブタイトル2",
			"type" => "text",
		),
		"text2" => array(
			"title" => "テキスト2",
			"type" => "textarea",
		),
		"layout2" => array(
			"title" => "レイアウト2",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"image2" => array(
			"title" => "画像2",
			"type" => "image",
		),
		"imgtext2" => array(
			"title" => "画像下テキスト2",
			"type" => "textarea",
		),
		"view2" => array(
			"title" => "出現2",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"imgsize2" => array(
			"title" => "画像サイズ2",
			"type" => "select",
			"list" => array(
				"w1" => "指定なし",
				"w1" => "画像30%",
				"w2" => "画像50%",
			),
		),
		"dummy3" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title3" => array(
			"title" => "タイトル3",
			"type" => "text",
		),
		"subtitle3" => array(
			"title" => "サブタイトル3",
			"type" => "text",
		),
		"text3" => array(
			"title" => "テキスト3",
			"type" => "textarea",
		),
		"layout3" => array(
			"title" => "レイアウト3",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"image3" => array(
			"title" => "画像3",
			"type" => "image",
		),
		"imgtext3" => array(
			"title" => "画像下テキスト3",
			"type" => "textarea",
		),
		"view3" => array(
			"title" => "出現3",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"imgsize3" => array(
			"title" => "画像サイズ3",
			"type" => "select",
			"list" => array(
				"w1" => "指定なし",
				"w1" => "画像30%",
				"w2" => "画像50%",
			),
		),
		"dummy4" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title4" => array(
			"title" => "タイトル4",
			"type" => "text",
		),
		"subtitle4" => array(
			"title" => "サブタイトル4",
			"type" => "text",
		),
		"text4" => array(
			"title" => "テキスト4",
			"type" => "textarea",
		),
		"layout4" => array(
			"title" => "レイアウト4",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"image4" => array(
			"title" => "画像4",
			"type" => "image",
		),
		"imgtext4" => array(
			"title" => "画像下テキスト4",
			"type" => "textarea",
		),
		"view4" => array(
			"title" => "出現4",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"imgsize4" => array(
			"title" => "画像サイズ4",
			"type" => "select",
			"list" => array(
				"w1" => "指定なし",
				"w1" => "画像30%",
				"w2" => "画像50%",
			),
		),
		"dummy5" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title5" => array(
			"title" => "タイトル5",
			"type" => "text",
		),
		"subtitle5" => array(
			"title" => "サブタイトル5",
			"type" => "text",
		),
		"text5" => array(
			"title" => "テキスト5",
			"type" => "textarea",
		),
		"layout5" => array(
			"title" => "レイアウト5",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"image5" => array(
			"title" => "画像5",
			"type" => "image",
		),
		"imgtext5" => array(
			"title" => "画像下テキスト5",
			"type" => "textarea",
		),
		"view5" => array(
			"title" => "出現5",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"imgsize5" => array(
			"title" => "画像サイズ5",
			"type" => "select",
			"list" => array(
				"w1" => "指定なし",
				"w1" => "画像30%",
				"w2" => "画像50%",
			),
		),
		"dummy6" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title6" => array(
			"title" => "タイトル6",
			"type" => "text",
		),
		"subtitle6" => array(
			"title" => "サブタイトル6",
			"type" => "text",
		),
		"text6" => array(
			"title" => "テキスト6",
			"type" => "textarea",
		),
		"layout6" => array(
			"title" => "レイアウト6",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"image6" => array(
			"title" => "画像6",
			"type" => "image",
		),
		"imgtext6" => array(
			"title" => "画像下テキスト6",
			"type" => "textarea",
		),
		"view6" => array(
			"title" => "出現6",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"imgsize6" => array(
			"title" => "画像サイズ6",
			"type" => "select",
			"list" => array(
				"w1" => "指定なし",
				"w1" => "画像30%",
				"w2" => "画像50%",
			),
		),
	),
	"repeat" => array(
		"title", "subtitle", "text", "layout", "image", "imgtext", "view", "imgsize", "order",
	),
	"func" => "func_wa2_kiji",		// 処理プログラム（指定がない物は標準処理）
);

block_add($wa2_kiji);

function func_wa2_kiji($def, $info)
{
/*
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
*/
	$layout = array(
		"" => array("ord1" => "order1", "ord2" => "order2", "ord3" => "order3"),
		"1" => array("ord1" => "order1", "ord2" => "order3", "ord3" => "order2"),
		"2" => array("ord1" => "order1", "ord2" => "order2", "ord3" => "order3"),
		"3" => array("ord1" => "order2", "ord2" => "order3", "ord3" => "order1"),
		"4" => array("ord1" => "order2", "ord2" => "order1", "ord3" => "order3"),
		"5" => array("ord1" => "order3", "ord2" => "order2", "ord3" => "order1"),
		"6" => array("ord1" => "order3", "ord2" => "order1", "ord3" => "order2"),
	);
	foreach($info["list"] as $key => $val) {
		if ($val["layout"]) {
			$info["list"][$key]["order"] = $layout[$val["layout"]];
		}
	}
	return $info;
}
