<?php

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

class Ainex_Parallax extends DSLC_Module {

 	// Module Attributes
    var $module_id = 'Ainex_Parallax';
    var $module_title = 'Special Offers';
    var $module_icon = 'font';
    var $module_category = 'Ainex - Blocks';

 	// Module Options
    function options() {
    	// The options array
    	$dslc_options = array(
			array(
				'label' => __('Special Offers - Title Left', 'themestudio'),
				'id' => 'title_left',
				'std' => 'Special Introductory Offers!',
				'type' => 'text',
				'section' => 'functionality',
			),
			array(
				'label' => __('Text Right', 'themestudio'),
				'id' => 'text_right',
				'std' => "What's Hot",
				'type' => 'text',
				'section' => 'functionality',
			),

			/* Right */
			array(
				'label' => __( 'Right Bg image', 'dslc_string' ),
				'id' => 'right_bg_image',
				'std' => '',
				'type' => 'image',
				'refresh_on_change' => true,
				'affect_on_change_el' => '.hostplan_offers .one_half .right',
				'affect_on_change_rule' => 'background-image',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __( 'Right image', 'dslc_string' ),
				'id' => 'right_image',
				'std' => get_template_directory_uri().'/assets/images/site-img02.png',
				'type' => 'image',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __('Right Title', 'themestudio'),
				'id' => 'right_title',
				'std' => 'save big on hosting',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __('Right Sub Title', 'themestudio'),
				'id' => 'right_sub_title',
				'std' => 'Get up to 25% Discount on all hosting orders',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __('Right Extra info', 'themestudio'),
				'id' => 'right_extra_info',
				'std' => 'VPS Web Servers
					Reseller WebHosting
					Cloud Computing
					Marketing Services
					Dedicated Hosting',
				'type' => 'textarea',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __('Right Currency ($|%)', 'themestudio'),
				'id' => 'right_currency',
				'std' => '%',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __('Right Price', 'themestudio'),
				'id' => 'right_price',
				'std' => '25',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __('Right Time (per month|discount)', 'themestudio'),
				'id' => 'right_time',
				'std' => 'discount',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __('Right Button Text', 'themestudio'),
				'id' => 'right_button_text',
				'std' => 'sign up now!',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Right',
			),
			array(
				'label' => __('Right Button Link', 'themestudio'),
				'id' => 'right_button_link',
				'std' => '#',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Right',
			),

			/* Left */
			array(
				'label' => __( 'Left Bg image', 'dslc_string' ),
				'id' => 'left_bg_image',
				'std' => '',
				'type' => 'image',
				'refresh_on_change' => true,
				'affect_on_change_el' => '.hostplan_offers .one_half .left',
				'affect_on_change_rule' => 'background-image',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __( 'Left image', 'dslc_string' ),
				'id' => 'left_image',
				'std' => get_template_directory_uri().'/assets/images/site-img01.png',
				'type' => 'image',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __('Left Title', 'themestudio'),
				'id' => 'left_title',
				'std' => 'Host Your webSite',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __('Left Sub Title', 'themestudio'),
				'id' => 'left_sub_title',
				'std' => 'Makings of this first generator on internet',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __('Left Extra info', 'themestudio'),
				'id' => 'left_extra_info',
				'std' => 'Free Website Builde
					Free Domain Registration
					Free Instant Setup!
					Money Back Guarantee
					24/7 Quality Suppor',
				'type' => 'textarea',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __('Left Currency ($|%)', 'themestudio'),
				'id' => 'left_currency',
				'std' => '$',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __('Left Price', 'themestudio'),
				'id' => 'left_price',
				'std' => '4.99',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __('Left Time (per month|discount)', 'themestudio'),
				'id' => 'left_time',
				'std' => 'per month',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __('Left Button Text', 'themestudio'),
				'id' => 'left_button_text',
				'std' => 'Read more',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __('Left Button Link', 'themestudio'),
				'id' => 'left_button_link',
				'std' => '#',
				'type' => 'text',
				'section' => 'functionality',
				'tab'  => 'Left',
			),
			array(
				'label' => __( 'Margin Bottom', 'dslc_string' ),
				'id' => 'css_margin_bottom',
				'std' => '0',
				'type' => 'slider',
				'refresh_on_change' => false,
				'affect_on_change_el' => '.hostplan_offers',
				'affect_on_change_rule' => 'margin-bottom',
				'section' => 'styling',
				'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="container">
			<div class="hostplan_offers">
		    	<div class="title"><?php echo $options['title_left']; ?></div>
		        <div class="box"><strong><?php echo stripslashes($options['text_right']); ?></strong></div>
		        <div class="clearfix"></div>

		    	<div class="one_half"> 
		        	<?php if ($options['left_image']): ?>
		        		<div class="left"><img src="<?php echo $options['left_image']; ?>" alt="" /></div>
		        	<?php endif ?>
		            <div class="right">
		            	<h2><?php echo $options['left_title']; ?></h2>
		                <h6><?php echo $options['left_sub_title']; ?></h6>
		                <ul>
		                    <?php 
								$content = stripcslashes( $options['left_extra_info'] );
								$items = preg_split( '/\r\n|\r|\n/', $content );
								$output = '';
								foreach($items as $item){ 
									$output .= '<li><i class="fa fa-check"></i> ' . htmlspecialchars_decode( $item ) . '</li>';
								}

								echo $output;
							?>
		                </ul>
		                <?php if ($options['left_currency']=='%'): ?>
		                	<div class="price"><strong><?php echo $options['left_price']; ?></strong><em><?php echo $options['left_currency']; ?></em> <br /> <?php echo $options['left_time']; ?></div>
		                <?php else: ?>
		                	<div class="price"><strong><?php echo $options['left_currency']; ?></strong><em><?php echo $options['left_price']; ?></em> <br /> <?php echo $options['left_time']; ?></div>
		                <?php endif ?>
		            	<a href="<?php echo $options['left_button_link']; ?>" class="readmore_but"><?php echo $options['left_button_text']; ?></a>
		            </div>
		        </div><!-- end section -->

		        <div class="one_half last">
		        	<?php if ($options['right_image']): ?>
		        		<div class="left"><img src="<?php echo $options['right_image']; ?>" alt="" /></div>
		        	<?php endif ?>
		            <div class="right">
		            	<h2><?php echo $options['right_title']; ?></h2>
		                <h6><?php echo $options['right_sub_title']; ?></h6>
		                <ul>
		                    <?php 
								$content = stripcslashes( $options['right_extra_info'] );
								$items = preg_split( '/\r\n|\r|\n/', $content );
								$output = '';
								foreach($items as $item){
									$output .= '<li><i class="fa fa-check"></i> ' . htmlspecialchars_decode( $item ) . '</li>';
								}

								echo $output;
							?>
		                </ul>
		                <?php if ($options['right_currency']=='%'): ?>
		                	<div class="price"><strong><?php echo $options['right_price']; ?></strong><em><?php echo $options['right_currency']; ?></em> <br /> <?php echo $options['right_time']; ?></div>
		                <?php else: ?>
		                	<div class="price"><strong><?php echo $options['right_currency']; ?></strong><em><?php echo $options['right_price']; ?></em> <br /> <?php echo $options['right_time']; ?></div>
		                <?php endif ?>
		            	<a href="<?php echo $options['right_button_link']; ?>" class="readmore_but"><?php echo $options['right_button_text']; ?></a>
		            </div>
		        </div><!-- end section -->
			</div><!-- end hosting offers section -->
		</div>
		<div class="clearfix"></div>

	<?php
    	// REQUIRED
    	$this->module_end( $options );

    }

}