<?php
$template = <<<END
<!-- pop1_point2: 記事2 -->
<section class="pop1_point2">
<!--{def item/maintitle}-->
<h2 class="{val item/bg2}">{val item/maintitle}</h2>
<!--{/def}-->
<!--{each item/list}-->
<div class="list-free {val item/list/bg}">
<p class="point {val item/list/order/ord1} transform3 {val item/list/point_class}"><span>{val item/list/point/0}<span>{val item/list/point/1}</span></span></p>
<div class="text {val item/list/order/ord2}">
<h3><span class="fade-in-text">{val item/list/title}</span></h3>
<div class="markdown-body">{rval item/list/text}</div>
<!--{def item/list/link_type}-->
<!--{def item/list/link}-->
<p class="{val item/list/link_type}"><a href="{val item/list/link}">もっと見る</a></p>
<!--{/def}-->
<!--{/def}-->
</div>
<div class="image w2 {val item/list/order/ord3} {val item/list/view}">
<img src="user_data/{val item/list/image}" alt="">
</div>
</div><!--/.list-free-->
<!--{/each}-->
</section>
END;

$pop1_point2 = array(
	"title" => "POP1記事2",
	"name" => "pop1_point2",			// 名称、重複すると正しく動作しません
	"template" => $template,		// ブロックのテンプレートファイル
	"input" => array(
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=pop1_point2",
			"class" => "notice",
		),
		"maintitle" => array(
			"title" => "メインタイトル",
			"type" => "text",
		),
		"bg2" => array(
			"title" => "タイトル背景",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg2" => "あり",
			),
		),
		"dummy1" => array(
			"title" => "記事1",
			"type" => "comment",
		),
		"title1" => array(
			"title" => "タイトル1",
			"type" => "text",
		),
		"image1" => array(
			"title" => "画像1",
			"type" => "image",
		),
		"point1" => array(
			"title" => "Point1",
			"type" => "text",
			"info" => "空白を挟んで指定（例：特徴 1）",
		),
		"point_class1" => array(
			"title" => "Point表示1",
			"type" => "select",
			"list" => array(
				"" => "静止",
				"spin" => "回転",
			),
		),
		"text1" => array(
			"title" => "説明1",
			"type" => "textarea",
		),
		"layout1" => array(
			"title" => "配置1",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"view1" => array(
			"title" => "出現1",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"bg1" => array(
			"title" => "背景1",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg1" => "あり",
			),
		),
		"link1" => array(
			"title" => "リンク1",
			"type" => "text",
			"info" => "記入しないとリンクは表示されません",
		),
		"link_type1" => array(
			"title" => "リンク形状1",
			"type" => "select",
			"list" => array(
				"" => "リンクなし",
				"btn1" => "四角",
				"btn2" => "丸ボタン",
			)
		),
		"dummy2" => array(
			"title" => "記事2",
			"type" => "comment",
		),
		"title2" => array(
			"title" => "タイトル2",
			"type" => "text",
		),
		"image2" => array(
			"title" => "画像2",
			"type" => "image",
		),
		"point2" => array(
			"title" => "Point2",
			"type" => "text",
			"info" => "空白を挟んで指定（例：特徴 2）",
		),
		"point_class2" => array(
			"title" => "Point表示2",
			"type" => "select",
			"list" => array(
				"" => "静止",
				"spin" => "回転",
			),
		),
		"text2" => array(
			"title" => "説明2",
			"type" => "textarea",
		),
		"layout2" => array(
			"title" => "配置2",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"view2" => array(
			"title" => "出現2",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"bg2" => array(
			"title" => "背景2",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg1" => "あり",
			),
		),
		"link2" => array(
			"title" => "リンク2",
			"type" => "text",
			"info" => "記入しないとリンクは表示されません",
		),
		"link_type2" => array(
			"title" => "リンク形状2",
			"type" => "select",
			"list" => array(
				"" => "リンクなし",
				"btn1" => "四角",
				"btn2" => "丸ボタン",
			)
		),
		"dummy3" => array(
			"title" => "記事3",
			"type" => "comment",
		),
		"title3" => array(
			"title" => "タイトル3",
			"type" => "text",
		),
		"image3" => array(
			"title" => "画像3",
			"type" => "image",
		),
		"point3" => array(
			"title" => "Point3",
			"type" => "text",
			"info" => "空白を挟んで指定（例：特徴 3）",
		),
		"point_class3" => array(
			"title" => "Point表示3",
			"type" => "select",
			"list" => array(
				"" => "静止",
				"spin" => "回転",
			),
		),
		"text3" => array(
			"title" => "説明3",
			"type" => "textarea",
		),
		"layout3" => array(
			"title" => "配置3",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"view3" => array(
			"title" => "出現3",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"bg3" => array(
			"title" => "背景3",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg1" => "あり",
			),
		),
		"link3" => array(
			"title" => "リンク3",
			"type" => "text",
			"info" => "記入しないとリンクは表示されません",
		),
		"link_type3" => array(
			"title" => "リンク形状3",
			"type" => "select",
			"list" => array(
				"" => "リンクなし",
				"btn1" => "四角",
				"btn2" => "丸ボタン",
			)
		),
		"dummy4" => array(
			"title" => "記事4",
			"type" => "comment",
		),
		"title4" => array(
			"title" => "タイトル4",
			"type" => "text",
		),
		"image4" => array(
			"title" => "画像4",
			"type" => "image",
		),
		"point4" => array(
			"title" => "Point4",
			"type" => "text",
			"info" => "空白を挟んで指定（例：特徴 4）",
		),
		"point_class4" => array(
			"title" => "Point表示4",
			"type" => "select",
			"list" => array(
				"" => "静止",
				"spin" => "回転",
			),
		),
		"text4" => array(
			"title" => "説明4",
			"type" => "textarea",
		),
		"layout4" => array(
			"title" => "配置4",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"view4" => array(
			"title" => "出現4",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"bg4" => array(
			"title" => "背景4",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg1" => "あり",
			),
		),
		"link4" => array(
			"title" => "リンク4",
			"type" => "text",
			"info" => "記入しないとリンクは表示されません",
		),
		"link_type4" => array(
			"title" => "リンク形状4",
			"type" => "select",
			"list" => array(
				"" => "リンクなし",
				"btn1" => "四角",
				"btn2" => "丸ボタン",
			)
		),
		"dummy5" => array(
			"title" => "記事5",
			"type" => "comment",
		),
		"title5" => array(
			"title" => "タイトル5",
			"type" => "text",
		),
		"image5" => array(
			"title" => "画像5",
			"type" => "image",
		),
		"point5" => array(
			"title" => "Point5",
			"type" => "text",
			"info" => "空白を挟んで指定（例：特徴 5）",
		),
		"point_class5" => array(
			"title" => "Point表示5",
			"type" => "select",
			"list" => array(
				"" => "静止",
				"spin" => "回転",
			),
		),
		"text5" => array(
			"title" => "説明5",
			"type" => "textarea",
		),
		"layout5" => array(
			"title" => "配置5",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"view5" => array(
			"title" => "出現5",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"bg5" => array(
			"title" => "背景5",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg1" => "あり",
			),
		),
		"link5" => array(
			"title" => "リンク5",
			"type" => "text",
			"info" => "記入しないとリンクは表示されません",
		),
		"link_type5" => array(
			"title" => "リンク形状5",
			"type" => "select",
			"list" => array(
				"" => "リンクなし",
				"btn1" => "四角",
				"btn2" => "丸ボタン",
			)
		),
		"dummy6" => array(
			"title" => "記事6",
			"type" => "comment",
		),
		"title6" => array(
			"title" => "タイトル6",
			"type" => "text",
		),
		"image6" => array(
			"title" => "画像6",
			"type" => "image",
		),
		"point6" => array(
			"title" => "Point6",
			"type" => "text",
			"info" => "空白を挟んで指定（例：特徴 6）",
		),
		"point_class6" => array(
			"title" => "Point表示6",
			"type" => "select",
			"list" => array(
				"" => "静止",
				"spin" => "回転",
			),
		),
		"text6" => array(
			"title" => "説明6",
			"type" => "textarea",
		),
		"layout6" => array(
			"title" => "配置6",
			"type" => "select",
			"list" => array(
				"" => "指定なし",
				"1" => "見出し左、画像中",
				"2" => "見出し左、画像右",
				"3" => "見出し中、画像左",
				"4" => "見出し中、画像右",
				"5" => "見出し右、画像左",
				"6" => "見出し右、画像中",
			),
		),
		"view6" => array(
			"title" => "出現6",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"up" => "上から",
				"down" => "下から",
				"transform1" => "横回転",
				"transform2" => "縦回転",
				"blur" => "徐々に",
			),
		),
		"bg6" => array(
			"title" => "背景6",
			"type" => "select",
			"list" => array(
				"" => "なし",
				"bg1" => "あり",
			),
		),
		"link6" => array(
			"title" => "リンク6",
			"type" => "text",
			"info" => "記入しないとリンクは表示されません",
		),
		"link_type6" => array(
			"title" => "リンク形状6",
			"type" => "select",
			"list" => array(
				"" => "リンクなし",
				"btn1" => "四角",
				"btn2" => "丸ボタン",
			)
		),
	),
	"repeat" => array(
		"title", "image", "point", "point_class", "text", "link", "bg", "layout", "link_type", "view",
	),
	"func" => "func_pop1_point2",		// 処理プログラム（指定がない物は標準処理）
);

block_add($pop1_point2);


// 記事
function func_pop1_point2($def, $info)
{
	$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) {
		$ary = explode(" ", $val["point"]);
		$info["list"][$key]["point"] = $ary;
		if ($val["layout"]) {
			$info["list"][$key]["order"] = $layout[$val["layout"]];
		}
		if ($val["pos"]) {
			$info["list"][$key]["pos" . $val["pos"]] = $val["pos"];
		}
	}
	return $info;
}
