<?php
$template = <<<END
<section class="hairsalon1_gallery">
<h3>{val item/title}</h3>
<p class="markdown-body">{rval item/text}</p>
<div class="list-square">
<!--{each item/list}-->
<div class="list">
<a href="user_data/{val item/list/image}" data-lightbox="group1" data-title="{val item/list/title}">
<img src="user_data/{val item/list/image}" alt="">
</a>
</div>
<!--{/each}-->
</div>
<!--/.list-square-->
</section>
END;

$hairsalon1_gallery = array(						// ブロック
		"title" => "hairsalon1 ギャラリー",	// ブロックの名称
		"name" => "hairsalon1_gallery",			// 名称、重複すると正しく動作しません
		"template" => $template,		// ブロックのテンプレート
		"input" => array(				// ブロックの入力定義
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=hairsalon1_gallery",
			"class" => "notice",
		),
			"title" => array(
				"title" => "先頭タイトル",
				"type" => "text",
				"info" => "不要の場合は空欄に",
			),
			"text" => array(
				"title" => "説明",
				"type" => "textarea",
				"info" => "不要の場合は空欄に",
			),
			"title1" => array(
				"title" => "タイトル1",
				"type" => "text",
			),
			"image1" => array(
				"title" => "画像1",
				"type" => "image",
			),
			"title2" => array(
				"title" => "タイトル2",
				"type" => "text",
			),
			"image2" => array(
				"title" => "画像2",
				"type" => "image",
			),
			"title3" => array(
				"title" => "タイトル3",
				"type" => "text",
			),
			"image3" => array(
				"title" => "画像3",
				"type" => "image",
			),
			"title4" => array(
				"title" => "タイトル4",
				"type" => "text",
			),
			"image4" => array(
				"title" => "画像4",
				"type" => "image",
			),
			"title5" => array(
				"title" => "タイトル5",
				"type" => "text",
			),
			"image5" => array(
				"title" => "画像5",
				"type" => "image",
			),
			"title6" => array(
				"title" => "タイトル6",
				"type" => "text",
			),
			"image6" => array(
				"title" => "画像6",
				"type" => "image",
			),
			"title7" => array(
				"title" => "タイトル7",
				"type" => "text",
			),
			"image7" => array(
				"title" => "画像7",
				"type" => "image",
			),
			"title8" => array(
				"title" => "タイトル8",
				"type" => "text",
			),
			"image8" => array(
				"title" => "画像8",
				"type" => "image",
			),
			"title9" => array(
				"title" => "タイトル9",
				"type" => "text",
			),
			"image9" => array(
				"title" => "画像9",
				"type" => "image",
			),
			"title10" => array(
				"title" => "タイトル10",
				"type" => "text",
			),
			"image10" => array(
				"title" => "画像10",
				"type" => "image",
			),
		),
		"func" => "func_hairsalon1_gallery",		// 処理プログラム（指定がない物は標準処理）
	);

block_add($hairsalon1_gallery);

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