<?php
add_action('dslc_hook_register_modules',
    create_function('', 'return dslc_register_module( "Ainex_Custom_Tabs" );')
);

class Ainex_Custom_Tabs extends DSLC_Module {

 	// Module Attributes
    var $module_id = 'Ainex_Custom_Tabs';
    var $module_title = 'Custom Tabs';
    var $module_icon = 'list';
    var $module_category = 'Ainex - Elements';

 	// Module Options
    function options() {

    	// The options array
    	$dslc_options = array(
			array(
				'label' => 'Custom Tabs-Type',
				'id' => 'tab_type',
				'std' => 'horizontal',
				'type' => 'select',
				'section' => 'styling',
				'choices' => array(
					array(
						'label' => 'Horizontal',
						'value' => 'horizontal'
					),
					array(
						'label' => 'Vertical',
						'value' => 'vertical'
					),
				)
			),
			array(
				'label' => 'Show/Hidden Number',
				'id' => 'tab_number',
				'std' => '0',
				'type' => 'select',
				'section' => 'styling',
				'choices' => array(
					array(
						'label' => 'Hidden',
						'value' => '0'
					),
					array(
						'label' => 'Show',
						'value' => '1'
					),
				)
			),

			/*
			 * Tab 1
			*/
			array(
				'label' => 'Title',
				'id' => 'title1',
				'std' => 'Web Hosting',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 1',
			),
			array(
				'label' => 'Content',
				'id' => 'content1',
				'std' => '<h4>Web Hosting</h4><p>Lorem ipsum dolor sit amet, consectetur adipiscursus felis vel lacus cursus ullamcorper. Maecenas sed enim neque, quis rutrum arcu. Meceasa justo enim. Suspendisse suscipit malesuada magna, at sagittis augue varius ut. Donec vitae libero magna. Duis at ipsum ac mi tempor pulvinar.</p>
				<p>Pelltesque blandit suscipit molestie. Phasellus porta lorem ac ipsum cursus congue. Ut lobortis pellentesque nare. Pellentesque tincidunt aliquet condimentum. Nunc rhoncus porta erat, in ornare dolor facilisis in. Aliquam aeque nulla, vitae convallis mauris. Duis tristique, lectus sit amet pharetra vehicula. Pellentesque tincidunt aliquet condimentum. Nunc rhoncus porta erat, in ornare dolor facilisis in. Aliquam a neque nulla, vitae convallis mauris. Duis tristique, lectus sit amet pharetra vehicula, velit lectus hendrerit lorem, eu rutrum velit mi vitae augue. Mauris congue, leo nec ullamcorper vestibulum, orci augue tristique mi, eget bibendum mauris turpis sed metus. Vestibulum quam risu volutpat quis aliquam eu, dictum id massa.</p>
                <p>It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non words etc.</p>',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 1',
			),
			array(
				'label' => __( 'Image', 'dslc_string' ),
				'id' => 'image1',
				'std' => get_template_directory_uri().'/assets/images/blog/site-img05.jpg',
				'type' => 'image',
				'section' => 'styling',
				'tab'		=> 'Tab 1',
			),

			/*
			 * Tab 2
			*/
			array(
				'label' => 'Title',
				'id' => 'title2',
				'std' => 'Reseller Hosting',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 2',
			),
			array(
				'label' => 'Content',
				'id' => 'content2',
				'std' => '<h4>Reseller Hosting</h4><p><strong>Lorem ipsum dolor sit amet, consectetur adipiscursus felis</strong> vel lacus cursus ullamcorper. Maecenas sed enim neque, quis rutrum arcu. Meceasa justo enim. Suspendisse suscipit malesuada magna, at sagittis augue varius ut. Donec vitae libero magna. Duis at ipsum ac mi tempor pulvinar. Vimus ut tincdunt assa. Quisque pulvinar neque eu lorem tincidunt imperdiet porta mauris molesie. Pelltesque blandit suscipit molestie. Phasellus porta lorc ipsum cursus conguet lobortis pellentesque ornare aliquet condimentum.</p>
				<p>Pelltesque blandit suscipit molestie. Phasellus porta lorem ac ipsum cursus congue. Ut lobortis pellentesque nare. Pellentesque tincidunt aliquet condimentum. Nunc rhoncus porta erat, in ornare dolor facilisis in. Aliquam aeque nulla, vitae convallis mauris. Duis tristique, lectus sit amet pharetra vehicula. Pellentesque tincidunt aliquet condimentum. Nunc rhoncus porta erat, <strong>in ornare dolor facilisis</strong> in. Aliquam a neque nulla, vitae convallis mauris. Duis tristique, lectus sit amet pharetra vehicula, velit lectus hendrerit lorem, eu rutrum velit mi vitae augue. Mauris congue, leo nec ullamcorper vestibulum, orci augue tristique mi, eget bibendum mauris turpis sed metus. Vestibulum quam risu volutpat quis aliquam eu, dictum id massa.</p>
                <p>It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 2',
			),
			array(
				'label' => __( 'Image', 'dslc_string' ),
				'id' => 'image2',
				'std' => '',
				'type' => 'image',
				'section' => 'styling',
				'tab'		=> 'Tab 2',
			),

			/*
			 * Tab 3
			*/
			array(
				'label' => 'Title',
				'id' => 'title3',
				'std' => 'VPS Hosting',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 3',
			),
			array(
				'label' => 'Content',
				'id' => 'content3',
				'std' => '<h4>VPS Hosting</h4><p>Lorem ipsum dolor sit amet, consectetur adipiscursus felis vel lacus cursus ullamcorper. Maecenas sed enim neque, quis rutrum arcu. Meceasa justo enim. Suspendisse suscipit malesuada magna, at sagittis augue varius ut. Donec vitae libero magna. Duis at ipsum ac mi tempor pulvinar. Vimus ut tincdunt assa. Quisque pulvinar neque eu lorem tincidunt imperdiet porta mauris molesie. Pelltesque blandit suscipit molestie. Phasellus porta lorc ipsum cursus conguet lobortis pellentesque ornare aliquet condimentum.</p>
				<p>Pelltesque blandit suscipit molestie. Phasellus porta lorem ac ipsum cursus congue. Ut lobortis pellentesque nare. Pellentesque tincidunt aliquet condimentum. Nunc rhoncus porta erat, in ornare dolor facilisis in. Aliquam aeque nulla, vitae convallis mauris. Duis tristique, lectus sit amet pharetra vehicula. Pellentesque tincidunt aliquet condimentum. Nunc rhoncus porta erat, in ornare dolor facilisis in. Aliquam a neque nulla, vitae convallis mauris. Duis tristique, lectus sit amet pharetra vehicula, velit lectus hendrerit lorem, eu rutrum velit mi vitae augue. Mauris congue, leo nec ullamcorper vestibulum, orci augue tristique mi, eget bibendum mauris turpis sed metus. Vestibulum quam risu volutpat quis aliquam eu, dictum id massa.</p>
                <p>It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 3',
			),
			array(
				'label' => __( 'Image', 'dslc_string' ),
				'id' => 'image3',
				'std' => get_template_directory_uri().'/assets/images/blog/site-img09.jpg',
				'type' => 'image',
				'section' => 'styling',
				'tab'		=> 'Tab 3',
			),

			/*
			 * Tab 4
			*/
			array(
				'label' => 'Title',
				'id' => 'title4',
				'std' => 'Domain Names',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 4',
			),
			array(
				'label' => 'Content',
				'id' => 'content4',
				'std' => '<h4>Domain Names</h4><p><strong>Lorem ipsum dolor sit amet, consectetur adipiscursus felis</strong> vel lacus cursus ullamcorper. Maecenas sed enim neque, quis rutrum arcu. Meceasa justo enim. Suspendisse suscipit malesuada magna, at sagittis augue varius ut. Donec vitae libero magna. Duis at ipsum ac mi tempor pulvinar. Vimus ut tincdunt assa. Quisque pulvinar neque eu lorem tincidunt imperdiet porta mauris molesie. Pelltesque blandit suscipit molestie. Phasellus porta lorc ipsum cursus conguet lobortis pellentesque ornare aliquet condimentum.</p>
				<p>Pelltesque blandit suscipit molestie. Phasellus porta lorem ac ipsum cursus congue. Ut lobortis pellentesque nare. Pellentesque tincidunt aliquet condimentum. Nunc rhoncus porta erat, in ornare dolor facilisis in. Aliquam aeque nulla, vitae convallis mauris. Duis tristique, lectus sit amet pharetra vehicula. Pellentesque tincidunt aliquet condimentum. Nunc rhoncus porta erat, <strong>in ornare dolor facilisis</strong> in. Aliquam a neque nulla, vitae convallis mauris. Duis tristique, lectus sit amet pharetra vehicula, velit lectus hendrerit lorem, eu rutrum velit mi vitae augue. Mauris congue, leo nec ullamcorper vestibulum, orci augue tristique mi, eget bibendum mauris turpis sed metus. Vestibulum quam risu volutpat quis aliquam eu, dictum id massa.</p>
                <p>It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.</p>',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 4',
			),
			array(
				'label' => __( 'Image', 'dslc_string' ),
				'id' => 'image4',
				'std' => get_template_directory_uri().'/assets/images/blog/site-img04.jpg',
				'type' => 'image',
				'section' => 'styling',
				'tab'		=> 'Tab 4',
			),

			/*
			 * Tab 5
			*/
			array(
				'label' => 'Title',
				'id' => 'title5',
				'std' => '',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 5',
			),
			array(
				'label' => 'Content',
				'id' => 'content5',
				'std' => '',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Tab 5',
			),
			array(
				'label' => __( 'Image', 'dslc_string' ),
				'id' => 'image5',
				'std' => '',
				'type' => 'image',
				'section' => 'styling',
				'tab'		=> 'Tab 5',
			),
		);

		$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 );

	?>
		<?php
			$dem = 0;
			if ($options['title1']) { $dem++; }
			if ($options['title2']) { $dem++; }
			if ($options['title3']) { $dem++; }
			if ($options['title4']) { $dem++; }
			if ($options['title5']) { $dem++; }
		?>
		<div class="one_full">
			<?php if ($options['tab_type']=='horizontal'): ?>
				<div id="tabs">
					<?php for($i=1; $i<=$dem; $i++){ ?>
						<ul class="tabs">
		    				<?php for($i=1; $i<=$dem; $i++){ ?>
		                		<li class="<?php if($i==1){ echo 'active'; } ?><?php if($i==$dem){ echo ' last'; } ?>">
		                			<a href="#tab<?php echo $i; ?>">
			                			<?php if ($options['tab_number']==1): ?>
			                				<b><?php echo $i; ?></b>
			                			<?php endif ?>
			                			<?php echo stripslashes($options['title'.$i]); ?>
			                		</a>
		                		</li>
							<?php } ?>
		    			</ul>

		        		<div class="tab-container">
							<?php for($i=1; $i<=$dem; $i++){ ?>
			        			<div id="tab<?php echo $i; ?>" class="tab-content">
			        				<?php if ($options['image'.$i]): ?>
			        					<img src="<?php echo $options['image'.$i]; ?>" class="image_left1" alt="<?php echo $options['title'.$i]; ?>" />
			        				<?php endif ?>
			        				<?php
			        					$output_content = stripslashes( $options['content'.$i] );
										$output_content = do_shortcode( $output_content );
										echo $output_content;
			        				?>
			        			</div>
			        		<?php } ?>
		        		</div>
				    <?php } ?>
				</div>
			<?php else: ?>
				<div id="tabs-two">
					<?php for($i=1; $i<=$dem; $i++){ ?>
						<ul class="tabs-two fullpage">
		    				<?php for($i=1; $i<=$dem; $i++){ ?>
		                		<li class="<?php if($i==1){ echo 'active-two'; } ?><?php if($i==$dem){ echo ' last'; } ?>">
		                			<a href="#tab-two<?php echo $i; ?>">
			                			<?php if ($options['tab_number']==1): ?>
			                				<b><?php echo $i; ?></b>
			                			<?php endif ?>
			                			<?php echo stripslashes($options['title'.$i]); ?>
			                		</a>
		                		</li>
							<?php } ?>
		    			</ul>

		        		<div class="tab-container-two fullpage">
							<?php for($i=1; $i<=$dem; $i++){ ?>
			        			<div id="tab-two<?php echo $i; ?>" class="tab-content-two fullpage">
			        				<?php if ($options['image'.$i]): ?>
			        					<img src="<?php echo $options['image'.$i]; ?>" class="image_left1" alt="<?php echo $options['title'.$i]; ?>" />
			        				<?php endif ?>
			        				<?php
			        					$output_content = stripslashes( $options['content'.$i] );
										$output_content = do_shortcode( $output_content );
										echo $output_content;
			        				?>
			        			</div>
			        		<?php } ?>
		        		</div>
				    <?php } ?>
				</div>
			<?php endif ?>
		</div>
		<div class="clearfix"></div>
	<?php
    	// REQUIRED
    	$this->module_end( $options );

    }
}