<?php
$template = <<<END
<!--clinic6:スライドショー-->
<aside id="mainimg" class="clinic6_slide<!--{def item/top_button3}--> button3<!--{/def}-->">
<!--{each item/slide}-->
<div class="slide {val item/slide/text_pos}">
<div>
<p>{val item/slide/text}</p>
</div>
<img src="user_data/{val item/slide/image}" alt="">
</div>
<!--{/each}-->

<!--{def item/top_button1}-->
<ul class="mainimg-btn">
<!--{def item/top_button1}-->
<li><a href="{val item/top_link1}">{val item/top_icon1}{val item/top_button1}</a></li>
<!--{/def}-->
<!--{def item/top_button2}-->
<li><a href="{val item/top_link2}">{val item/top_icon2}{val item/top_button2}</a></li>
<!--{/def}-->
<!--{def item/top_button3}-->
<li><a href="{val item/top_link3}">{val item/top_icon3}{val item/top_button3}</a></li>
<!--{/def}-->
</ul>
<!--{/def}-->
</aside>
END;

$clinic6_slide = array(						// ブロック
		"title" => "clinic6スライドショー",	// ブロックの名称
		"name" => "clinic6_slide",			// 名称、重複すると正しく動作しません
		"template" => $template,		// ブロックのテンプレート
		"input" => array(				// ブロックの入力定義
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=clinic6_slide",
			"class" => "notice",
		),
			"notice1" => array(
				"title" => "このブロックはトップページにしか使えません",
				"type" => "comment",
				"class"=> "notice",
			),
			"image1" => array(
				"title" => "画像1",
				"type" => "image",
			),
			"text1" => array(
				"title" => "文字1",
				"type" => "textarea2",
			),
			"text_pos1" => array(
				"title" => "文字位置1",
				"type" => "select",
				"list" => array(
					"slide1 slide0" => "左",
					"slide3 slide0" => "中央",
					"slide2 slide0" => "右",
				),
			),
			"dummy1" => array(
				"title" => " ",
				"type" => "comment",
			),
			"image2" => array(
				"title" => "画像2",
				"type" => "image",
			),
			"text2" => array(
				"title" => "文字表示2",
				"type" => "textarea2",
			),
			"text_pos2" => array(
				"title" => "文字位置2",
				"type" => "select",
				"list" => array(
					"slide1" => "左",
					"slide3" => "中央",
					"slide2" => "右",
				),
			),
			"dummy2" => array(
				"title" => " ",
				"type" => "comment",
			),
			"image3" => array(
				"title" => "画像3",
				"type" => "image",
			),
			"text3" => array(
				"title" => "文字表示3",
				"type" => "textarea2",
			),
			"text_pos3" => array(
				"title" => "文字位置3",
				"type" => "select",
				"list" => array(
					"slide1" => "左",
					"slide3" => "中央",
					"slide2" => "右",
				),
			),
			"comment_clinic6_1" => array(
				"title" => "リンクボタン",
				"type" => "comment",
			),
			"top_button1" => array(
				"title" => "ボタン表記1",
				"type" => "text",
			),
			"top_link1" => array(
				"title" => "リンク先1",
				"type" => "text",
			),
			"top_icon1" => array(
				"title" => "アイコン1",
				"type" => "text",
			),
			"comment_clinic6_2" => array(
 				"title" => " ",
				"type" => "comment",
			),
			"top_button2" => array(
				"title" => "ボタン表記2",
				"type" => "text",
			),
			"top_link2" => array(
				"title" => "リンク先2",
				"type" => "text",
			),
			"top_icon2" => array(
				"title" => "アイコン2",
				"type" => "text",
			),
			"comment_clinic6_3" => array(
 				"title" => " ",
				"type" => "comment",
			),
			"top_button3" => array(
				"title" => "ボタン表記3",
				"type" => "text",
			),
			"top_link3" => array(
				"title" => "リンク先3",
				"type" => "text",
			),
			"top_icon3" => array(
				"title" => "アイコン3",
				"type" => "text",
			),
		),
		"func" => "func_clinic6_slide",		// 処理プログラム（指定がない物は標準処理）
		"output" => "slide",		// 出力位置
	);

block_add($clinic6_slide);

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