<?php
global $RS;
// category Setting
$RS->metabox(array(
	'name' => 'category_setting',
	'title' => 'Category Thumbnail',
	'rules' => array(
		'taxonomy' => 'category',
	),
	'controls' => array(
		array(
			'name' => 'rst_cat_thumbnail',
			'label'=> 'Thumbnail',
			'type' => 'image',
			'max_height' => 'auto',
			'value' => ''
		),
		
	)
));
// tab Setting
$RS->metabox(array(
	'name' => 'category_setting',
	'title' => 'Category Thumbnail',
	'rules' => array(
		'taxonomy' => 'post_tag',
	),
	'controls' => array(
		array(
			'name' => 'rst_tag_thumbnail',
			'label'=> 'Thumbnail',
			'type' => 'image',
			'max_height' => 'auto',
			'value' => ''
		),
	)
));
// Page Setting
$RS->metabox(array(
	'name' => 'page_setting',
	'title' => 'Page Setting',
	'rules' => array(
		'post_type' => 'page',
		'page_template:not' => 'template-home.php'
	),
	'controls' => array(
		array(
			'name' => 'rst_show_title',
			'label'=> 'Show Title',
			'type' => 'switch',
			'style' => 'default',
			'default_value' => true
		),
		array(
			'name' => 'rst_sub_title',
			'label'=> 'Sub Title',
			'type' => 'text'
		),
		array(
			'label' => 'Page Column Style',
			'type' => 'radio',
			'name' => 'rst_template_style',
			'description'	=> 'Choose your page column style to show on your page.',
			'items' => array(
				'0'	=> 'Default',
				'1' => 'Full Width',
				'2' => 'Sidebar Left',
				'3' => 'Sidebar Right'
			),
			'default_value' => '0'
		),
		
	)
));


// Post Setting
$RS->metabox(array(
	'name' => 'post_setting',
	'title' => 'Post Setting',
	'rules' => array(
		'post_type' => 'post',
	),
	'controls' => array(
		array(
			'name' => 'rst_show_title',
			'label'=> 'Show Title',
			'type' => 'switch',
			'style' => 'default',
			'default_value' => true
		),
		array(
			'name' => 'rst_sub_title',
			'label'=> 'Sub Title',
			'type' => 'text'
		),
		array(
			'label' => 'Post Column Style',
			'type' => 'radio',
			'name' => 'rst_template_style',
			'description'	=> 'Choose your page column style to show on your page.',
			'items' => array( 
				'0'	=> 'Default',
				'1' => 'Full Width', 
				'2' => 'Sidebar Left', 
				'3' => 'Sidebar Right'
			),
			'default_value' => '0'
		)
	)
));

//Get All Shortcode CTF7
$aray_ctf7 = array('post_type' => 'wpcf7_contact_form', 'posts_per_page' => -1);
$ctf7 = array(''=>'Select Contact Form');
if( $cf7Forms = get_posts( $aray_ctf7 ) ){
	foreach($cf7Forms as $cf7Form){
		$ctf7[$cf7Form->ID] = '[contact-form-7 id="'.$cf7Form->ID.'" title="'.($cf7Form->post_title).'"]';
	}
}


// Post Contact
$RS->metabox(array(
	'name' => 'page_contact_setting',
	'title' => 'Page Contact',
	'rules' => array(
		'page_template' => 'template-contact.php',
	),
	'controls' => array(
		
		array(
			'name' => 'rst_shortcode_form',
			'label'=> 'Shortcode Contact Form 7',
			'type' => 'select',
			'items'	=> $ctf7
		),
		array(
			'name' => 'rst_address',
			'label'=> 'Address',
			'type' => 'text',
			'description' => 'Go to http://www.latlong.net and put the name of a place, city, state, or address, or click the location on the map to get lat long coordinates<br>eg:<b>10.731688,122.5505356</b>'
		),		array(			'name' => 'rst_address_thumbnail',			'label'=> 'Image',			'type' => 'image',			'description' => ''		)
	)
));

// Post Home
$RS->metabox(array(
	'name' => 'page_home_setting',
	'title' => 'Slider Show',
	'rules' => array(
		'page_template' => 'template-home.php',
	),
	'controls' => array(
		array(
			'name' => 'rst_home_slider_hide',
			'label'=> 'Hidden Slider',
			'type' => 'switch',
			'default_value'	=> true
		),
		array(
			'name' => 'rst_home_slider_post',
			'label'=> 'Select Posts',
			'min_rows'	=> 0,
			'type' => 'repeater',
			'add_row_text' => 'Add Post',
			'controls' => array(
				array(
					'name' => 'post',
					'label' => 'Post',
					'type'  => 'postlist',
				)
			)
		),
		array(
			'label' 		=> 'Hidden Caption',
			'type' 			=> 'checkbox',
			'name' 			=> 'rst_home_slider_hide_caption',
			'value'    => array('yes'),
			'items' => array('yes' => 'Yes')
		),
	)
));
// Post Home
$RS->metabox(array(
	'name' => 'page_home_box_setting',
	'title' => 'Box Posts',
	'rules' => array(
		'page_template' => 'template-home.php',
	),
	'controls' => array(
		array(
			'name' => 'rst_home_extend_box_hide',
			'label'=> 'Hidden Extend Box',
			'type' => 'switch',
			'default_value'	=> true
		),
		array(
			'label' => 'Style Extend Box',
			'type' => 'radio',
			'display' 		=> 'inline',
			'name' => 'rst_extend_box_style',
			'description'	=> 'Choose your page column style to show on your page.',
			'items' => array(
				array(
					'image' => get_template_directory_uri() .'/inc/css/images/box_01.jpg',
					'value' => '1',
					'text'  => 'Style 1'
				),
				array(
					'image' => get_template_directory_uri() .'/inc/css/images/box_02.jpg',
					'value' => '2',
					'text'  => 'Style 2'
				),
			),
			'default_value' => '1'
		),
		array(
			'name' => 'rst_home_box_post',
			'label'=> 'Create Posts',
			'min_rows'	=> 1,
			'max_rows'	=> 3,
			'type' => 'repeater',
			'layout' => 'row',
			'add_row_text' => 'Add Box',
			'controls' => array(
				array(
					'name' => 'rst_image_box',
					'label' => 'Image',
					'type'  => 'image',
				),
				array(
					'name' => 'rst_title_box',
					'label' => 'Title',
					'type'  => 'textarea',
				),
				array(
					'name' => 'rst_link_box',
					'label' => 'Link',
					'type'  => 'text',
				),
			)
		)
	)
));

// Page Setting
$RS->metabox(array(
	'name' => 'headline_setting',
	'title' => 'Headline Background',
	'rules' => array(
		'page_template' => 'template-about.php|template-contact.php'
	),
	'controls' => array(
		array(
			'name' => 'rst_background_headline',
			'label'=> 'Background',
			'type' => 'image',
		),
	)
));
// Page Setting
$RS->metabox(array(
	'name' => 'contact_link',
	'title' => 'Contact Link',
	'rules' => array(
		'page_template' => 'template-about.php'
	),
	'controls' => array(
		array(
			'label' => 'Style Link',
			'type' => 'radio',
			'display' 		=> 'inline',
			'name' => 'rst_link_style',
			'items' => array(
				array(
					'value' => '0',
					'text'  => 'Email'
				),
				array(
					'value' => '1',
					'text'  => 'Link'
				),
			),
			'default_value' => '0'
		),
		array(
			'name' => 'rst_link_contact',
			'label' => 'Link',
			'type'  => 'text',
		),
	)
));
// Page Setting
$RS->metabox(array(
	'name' => 'home_setting',
	'title' => 'Home Setting',
	'rules' => array(
		'page_template' => 'template-home.php'
	),
	'controls' => array(
		array(
			'label' => 'Home Column Style',
			'type' => 'radio',
			'display' 		=> 'inline',
			'name' => 'rst_page_home_style',
			'description'	=> 'Choose your page column style to show on your page.',
			'items' => array(
				array(
					'image' => get_template_directory_uri() .'/inc/css/images/home-default.jpg',
					'value' => '0',
					'text'  => 'Default'
				),
				array(
					'image' => get_template_directory_uri() .'/inc/css/images/fullwidth.jpg',
					'value' => '1',
					'text'  => 'Full Width'
				),
				array(
					'image' => get_template_directory_uri() .'/inc/css/images/sidebar_left.jpg',
					'value' => '2',
					'text'  => 'Sidebar Left'
				),
				array(
					'image' => get_template_directory_uri() .'/inc/css/images/sidebar_right.jpg',
					'value' => '3',
					'text'  => 'Sidebar Right'
				),
			),
			'default_value' => '0'
		),
		array(
			'label' 		=> 'Template Style',
			'type' 			=> 'radio',
			'display' 		=> 'inline',
			'name' 			=> 'rst_page_home_template',
			'default_value'	=> 'none',
			'items'        	=> array(
				array(
					'image' => get_template_directory_uri() .'/inc/css/images/home-default.jpg',
					'value' => 'none',
					'text'  => 'Default'
				),
				array(
					'image' => get_template_directory_uri() .'/inc/css/images/large.jpg',
					'value' => 'large',
					'text'  => 'Large'
				),
				array(
					'image' =>  get_template_directory_uri() .'/inc/css/images/Grid.jpg',
					'value' => 'grid',
					'text'  => 'Grid'
				)				
			)
		),
		array(
			'label' 		=> 'Number Columns',
			'type' 			=> 'select',
			'default_value'	=> 2,
			'name'			=> 'rst_page_home_column',
			'items'			=> array(
				'2' => '2 Columns',
				'3' => '3 Columns',
			),
			'description'	=> 'Number columns for template grid &amp; box',
			'conditional_logic' => array(
				'items' => array(
					'rst_page_home_template' => 'grid'
				)
			)
		),
	)
));
// Popular Post Home
/*
$RS->metabox(array(
	'name' => 'page_home_popular_setting',
	'title' => 'Popular Posts',
	'rules' => array(
		'page_template' => 'template-home.php',
	),
	'controls' => array(
		array(
			'name' => 'rst_home_popular_post',
			'label'=> 'Show Popular Posts',
			'type' => 'switch',
			'default_value' => false
		),
		array(
			'name' => 'rst_home_popular_post_hide_mobi',
			'label'=> 'Hidden on Mobile',
			'type' => 'switch',
			'default_value'	=> true
		),
		array(
			'name' => 'rst_home_popular_post_title',
			'label'=> 'Popular Posts Title',
			'type' => 'text'
		),
		array(
			'name' => 'rst_home_popular_post_order',
			'label'=> 'Popular By',
			'type' => 'select',
			'items' => array(
				'week' => 'Week',
				'month' => 'Month'
			)
		),
		array(
			'name' => 'rst_home_popular_post_number',
			'label'=> 'Number Posts Show',
			'type' => 'text',
			'default_value'	=> 10
		)
	)
));
*/