<?php
$template = <<<END
<!-- block6: home5 記事2 -->
<section>
<!--{def item/maintitle}-->
<h2 class="c"><span class="hosoku">{val item/subtitle}</span><span class="fade-in-text">{val item/maintitle}</span></h2>
<!--{/def}-->
<div class="list-normal">
<!--{each item/list}-->
<div class="list {val item/list/view} {val item/list/pos}">
<!--{def item/list/image}-->
	<figure><img src="user_data/{val item/list/image}" alt=""></figure>
<!--{/def}-->
	<div>
<!--{def item/list/title}-->
	<h3>{val item/list/title}</h3>
<!--{/def}-->
	<p class="markdown-body">{rval item/list/text}</p>
	</div>
</div>
<!--{/each}-->
</div>
<!--/.list-normal-->
</section>
END;

$home5_kiji2 = array(
	"title" => "home5 記事2",
	"name" => "home5_kiji2",			// 名称、重複すると正しく動作しません
	"template" => $template,		// ブロックのテンプレートファイル
	"input" => array(
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=home5_kiji2",
			"class" => "notice",
		),
		"maintitle" => array(
			"title" => "タイトル",
			"type" => "text",
		),
		"subtitle" => array(
			"title" => "サブタイトル",
			"type" => "text",
		),
		"comment1" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title1" => array(
			"title" => "記事タイトル1",
			"type" => "text",
		),
		"text1" => array(
			"title" => "記事内容1",
			"type" => "textarea",
		),
		"image1" => array(
			"title" => "画像1",
			"type" => "image",
		),
		"pos1" => array(
			"title" => "位置1",
			"type" => "select",
			"list" => array(
				"" => "左画像",
				"reverse" => "右画像",
			),
		),
		"view1" => array(
			"title" => "出現1",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"comment2" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title2" => array(
			"title" => "記事タイトル2",
			"type" => "text",
		),
		"text2" => array(
			"title" => "記事内容2",
			"type" => "textarea",
		),
		"image2" => array(
			"title" => "画像2",
			"type" => "image",
		),
		"pos2" => array(
			"title" => "位置2",
			"type" => "select",
			"list" => array(
				"" => "左画像",
				"reverse" => "右画像",
			),
		),
		"view2" => array(
			"title" => "出現2",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"comment3" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title3" => array(
			"title" => "記事タイトル3",
			"type" => "text",
		),
		"text3" => array(
			"title" => "記事内容3",
			"type" => "textarea",
		),
		"image3" => array(
			"title" => "画像3",
			"type" => "image",
		),
		"pos3" => array(
			"title" => "位置3",
			"type" => "select",
			"list" => array(
				"" => "左画像",
				"reverse" => "右画像",
			),
		),
		"view3" => array(
			"title" => "出現3",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"comment4" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title4" => array(
			"title" => "記事タイトル4",
			"type" => "text",
		),
		"text4" => array(
			"title" => "記事内容4",
			"type" => "textarea",
		),
		"image4" => array(
			"title" => "画像4",
			"type" => "image",
		),
		"pos4" => array(
			"title" => "位置4",
			"type" => "select",
			"list" => array(
				"" => "左画像",
				"reverse" => "右画像",
			),
		),
		"view4" => array(
			"title" => "出現4",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"comment5" => array(
			"title" => " ",
			"type" => "comment",
		),
		"title5" => array(
			"title" => "記事タイトル5",
			"type" => "text",
		),
		"text5" => array(
			"title" => "記事内容5",
			"type" => "textarea",
		),
		"image5" => array(
			"title" => "画像5",
			"type" => "image",
		),
		"pos5" => array(
			"title" => "位置5",
			"type" => "select",
			"list" => array(
				"" => "左画像",
				"reverse" => "右画像",
			),
		),
		"view5" => array(
			"title" => "出現5",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
	),
	"repeat" => array("title", "text", "image", "pos", "view"),
//	"func" => "func_home5_kiji2",
);

block_add($home5_kiji2);

function func_home5_kiji2($def, $info)
{
	$list = array();
	for ($i = 1; $i <= 10; $i++) {
		$title = $info["title" . $i];
		$text = $info["text" . $i];
		$image = $info["image" . $i . "_file"];
		$pos = $info["pos" . $i];
		if ($title && $text) {
			unset($item);
			$item["title"] = $title;
			$item["text"] = $text;
			$item["image"] = $image;
			$item["pos"] = $pos;
			$list[] = $item;
		}
	}
	$info["list"] = $list;
	return $info;
}
