<?php 

add_action('dslc_hook_register_modules',
     create_function('', 'return dslc_register_module( "Ainex_Title_Block" );')
);

class Ainex_Title_Block extends DSLC_Module {
 		
 	// Module Attributes
    var $module_id = 'Ainex_Title_Block';
    var $module_title = 'Title';
    var $module_icon = 'font';
    var $module_category = 'Ainex - Blocks';
 
 	// Module Options
    function options() { 
    	// The options array
    	$dslc_options = array(
			array(
				'label' => 'Title',
				'id' => 'title',
				'std' => 'Section <strong>title</strong>',
				'type' => 'textarea',
				'section' => 'functionality'
			),
			array(
				'label' => 'Sub Title',
				'id' => 'sub_title',
				'std' => '',
				'type' => 'textarea',
				'section' => 'functionality'
			),

			/**
			 * Heading 3
			 */
			array(
				'label' => __( ' BG Color', 'themestudio' ),
				'id' => 'css_h3_bg_color',
				'std' => '',
				'type' => 'color',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'background-color',
				'section' => 'styling',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Border Color', 'themestudio' ),
				'id' => 'css_h3_border_color',
				'std' => '',
				'type' => 'color',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'border-color',
				'section' => 'styling',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Border Width', 'themestudio' ),
				'id' => 'css_h3_border_width',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'border-width',
				'section' => 'styling',
				'ext' => 'px',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Borders', 'themestudio' ),
				'id' => 'css_h3_border_trbl',
				'std' => 'top right bottom left',
				'type' => 'checkbox',
				'choices' => array(
					array(
						'label' => __( 'Top', 'themestudio' ),
						'value' => 'top'
					),
					array(
						'label' => __( 'Right', 'themestudio' ),
						'value' => 'right'
					),
					array(
						'label' => __( 'Bottom', 'themestudio' ),
						'value' => 'bottom'
					),
					array(
						'label' => __( 'Left', 'themestudio' ),
						'value' => 'left'
					),
				),
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'border-style',
				'section' => 'styling',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Border Radius - Top', 'themestudio' ),
				'id' => 'css_h3_border_radius_top',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'border-top-left-radius,border-top-right-radius',
				'section' => 'styling',
				'ext' => 'px',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Border Radius - Bottom', 'themestudio' ),
				'id' => 'css_h3_border_radius_bottom',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'border-bottom-left-radius,border-bottom-right-radius',
				'section' => 'styling',
				'ext' => 'px',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Color', 'themestudio' ),
				'id' => 'css_h3_color',
				'std' => '',
				'type' => 'color',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'color',
				'section' => 'styling',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Font Size', 'themestudio' ),
				'id' => 'css_h3_font_size',
				'std' => '27',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'font-size',
				'section' => 'styling',
				'tab' => 'h3',
				'ext' => 'px'
			),
			array(
				'label' => __( 'Font Weight', 'themestudio' ),
				'id' => 'css_h3_font_weight',
				'std' => '300',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'font-weight',
				'section' => 'styling',
				'tab' => 'h3',
				'ext' => '',
				'min' => 100,
				'max' => 900,
				'increment' => 100
			),
			array(
				'label' => __( 'Font Family', 'themestudio' ),
				'id' => 'css_h3_font_family',
				'std' => 'Open Sans',
				'type' => 'font',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'font-family',
				'section' => 'styling',
				'tab' => 'h3',
			),
			array(
				'label' => __( 'Line Height', 'themestudio' ),
				'id' => 'css_h3_line_height',
				'std' => '27',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'line-height',
				'section' => 'styling',
				'tab' => 'h3',
				'ext' => 'px'
			),
			array(
				'label' => __( 'Margin Bottom', 'themestudio' ),
				'id' => 'css_h3_margin_bottom',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'margin-bottom',
				'section' => 'styling',
				'tab' => 'h3',
				'ext' => 'px'
			),
			array(
				'label' => __( 'Padding Vertical', 'themestudio' ),
				'id' => 'css_h3_padding_vertical',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'padding-top,padding-bottom',
				'section' => 'styling',
				'ext' => 'px',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Padding Horizontal', 'themestudio' ),
				'id' => 'css_h3_padding_horizontal',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'padding-left,padding-right',
				'section' => 'styling',
				'ext' => 'px',
				'tab' => 'h3'
			),
			array(
				'label' => __( 'Text Align', 'themestudio' ),
				'id' => 'css_h3_text_align',
				'std' => 'left',
				'type' => 'select',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title h3',
				'affect_on_change_rule' => 'text-align',
				'section' => 'styling',
				'tab' => 'h3',
				'choices' => array(
					array(
						'label' => __( 'Left', 'themestudio' ),
						'value' => 'left',
					),
					array(
						'label' => __( 'Center', 'themestudio' ),
						'value' => 'center',
					),
					array(
						'label' => __( 'Right', 'themestudio' ),
						'value' => 'right',
					),
				)
			),

			/*
			 * Sub title
			*/
			array(
				'label' => __( 'Text Align', 'themestudio' ),
				'id' => 'css_h6_text_align',
				'std' => 'center',
				'type' => 'select',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title p',
				'affect_on_change_rule' => 'text-align',
				'section' => 'styling',
				'tab' => 'Sub Title',
				'choices' => array(
					array(
						'label' => __( 'Left', 'themestudio' ),
						'value' => 'left',
					),
					array(
						'label' => __( 'Center', 'themestudio' ),
						'value' => 'center',
					),
					array(
						'label' => __( 'Right', 'themestudio' ),
						'value' => 'right',
					),
				)
			),
			array(
				'label' => __( 'Margin Bottom', 'themestudio' ),
				'id' => 'css_h6_margin_bottom',
				'std' => '15',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title p',
				'affect_on_change_rule' => 'margin-bottom',
				'section' => 'styling',
				'tab' => 'Sub Title',
				'ext' => 'px'
			),
			array(
				'label' => __( ' Margin Left', 'dslc_string' ),
				'id' => 'css_icon_margin_left',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'margin-left',
				'section' => 'styling',
				'ext' => 'px',
			),
			array(
				'label' => __( '  Margin Right', 'dslc_string' ),
				'id' => 'css_icon_margin_right',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'margin-right',
				'section' => 'styling',
				'ext' => 'px',
			),
			array(
				'label' => __( '  Margin Top', 'dslc_string' ),
				'id' => 'css_icon_margin_top',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'margin-top',
				'section' => 'styling',
				'ext' => 'px',
			),
			array(
				'label' => __( '  Margin Bottom', 'dslc_string' ),
				'id' => 'css_icon_margin_bottom',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'margin-bottom',
				'section' => 'styling',
				'ext' => 'px',
			),
			array(
				'label' => __( 'Padding Vertical', 'dslc_string' ),
				'id' => 'css_padding_vertical',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'padding-top,padding-bottom',
				'section' => 'styling',
				'ext' => 'px'
			),
			array(
				'label' => __( 'Padding Horizontal', 'dslc_string' ),
				'id' => 'css_padding_horizontal',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'padding-left,padding-right',
				'section' => 'styling',
				'ext' => 'px'
			),

			/**
			 * Responsive Tablet
			 */
			array(
				'label' => __( 'Responsive', 'dslc_string' ),
				'id' => 'css_res_t',
				'std' => 'disabled',
				'type' => 'select',
				'choices' => array(
					array(
						'label' => __( 'Disabled', 'dslc_string' ),
						'value' => 'disabled'
					),
					array(
						'label' => __( 'Enabled', 'dslc_string' ),
						'value' => 'enabled'
					),
				),
				'section' => 'responsive',
				'tab' => 'tablet',
			),
			array(
				'label' => __( 'Margin Top', 'dslc_string' ),
				'id' => 'css_res_t_margin_top',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'margin-top',
				'section' => 'responsive',
				'tab' => 'tablet',
				'ext' => 'px',
			),
			array(
				'label' => __( 'Margin Bottom', 'dslc_string' ),
				'id' => 'css_res_t_margin_bottom',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'margin-bottom',
				'section' => 'responsive',
				'tab' => 'tablet',
				'ext' => 'px',
			),

			/**
			 * Responsive phone
			 */
			array(
				'label' => __( 'Responsive', 'dslc_string' ),
				'id' => 'css_res_p',
				'std' => 'disabled',
				'type' => 'select',
				'choices' => array(
					array(
						'label' => __( 'Disabled', 'dslc_string' ),
						'value' => 'disabled'
					),
					array(
						'label' => __( 'Enabled', 'dslc_string' ),
						'value' => 'enabled'
					),
				),
				'section' => 'responsive',
				'tab' => 'phone',
			),
			array(
				'label' => __( 'Margin Top', 'dslc_string' ),
				'id' => 'css_res_p_margin_top',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'margin-top',
				'section' => 'responsive',
				'tab' => 'phone',
				'ext' => 'px',
			),
			array(
				'label' => __( 'Margin Bottom', 'dslc_string' ),
				'id' => 'css_res_p_margin_bottom',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.ainex-title',
				'affect_on_change_rule' => 'margin-bottom',
				'section' => 'responsive',
				'tab' => 'phone',
				'ext' => 'px',
			),
		);

		$dslc_options = array_merge( $dslc_options, $this->shared_options('animation_options') );
		
    	// Return the array
    	return apply_filters( 'dslc_module_options', $dslc_options, $this->module_id );

    }
 
 	// Module Output
    function output( $options ) {

    	global $dslc_active;
    	
		if ( $dslc_active && is_user_logged_in() && current_user_can( DS_LIVE_COMPOSER_CAPABILITY ) )
			$dslc_is_admin = true;
		else
			$dslc_is_admin = false;
		
		//REQUIRED
		$this->module_start( $options );
	?>
		
		<div class="ainex-title">
			<?php if($options['title']): ?>
				<h3><?php echo stripslashes($options['title']); ?></h3>
			<?php endif; ?>
			<?php if ($options['sub_title']): ?>
				<p><?php echo stripslashes($options['sub_title']); ?></p>
			<?php endif; ?>
		</div>
	
	<?php
    	// REQUIRED
    	$this->module_end( $options );

    }
 
}