<?php 

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

class Ainex_Pricing_Table_3 extends DSLC_Module {
 		
 	// Module Attributes
    var $module_id = 'Ainex_Pricing_Table_3';
    var $module_title = 'Pricing Table 3';
    var $module_icon = 'dollar';
    var $module_category = 'Ainex - Pricing Table';
 
 	// Module Options
    function options() { 
				
    	// The options array
    	$dslc_options = array(
			array(
				'label' => 'Columns - Pricing Table 3',
				'id' => 'columns',
				'std' => '4',
				'type' => 'select',
				'section' => 'styling',
				'choices' => array(
					array(
						'label' => '3 Columns',
						'value' => '3'
					),
					array(
						'label' => '4 Columns',
						'value' => '4'
					),
				)
			),

			/*
			 * Column 1
			*/
			array(
				'label' => 'Title',
				'id' => 'title1',
				'std' => 'Bronze',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 1',
			),
			array(
				'label' => 'Content',
				'id' => 'content1',
				'std' => '3 Days
				    2GB Storage
				    25 Users
				    Unlimited Pages
				    Enhanced Security',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 1',
			),
			array(
				'label' => 'Currency',
				'id' => 'currency1',
				'std' => '$',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 1',
			),
			array(
				'label' => 'Price',
				'id' => 'price1',
				'std' => '3',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 1',
			),
			array(
				'label' => 'Button Text',
				'id' => 'buttontext1',
				'std' => 'Select Plan',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 1',
			),
			array(
				'label' => 'Button Link URL',
				'id' => 'button_link1',
				'std' => '#',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 1',
			),
			array(
				'label' => 'Highlights',
				'id' => 'highlights1',
				'std' => '0',
				'type' => 'select',
				'section' => 'styling',
				'tab'		=> 'Column 1',
				'choices' => array(
					array(
						'label' => 'No',
						'value' => '0'
					),
					array(
						'label' => 'Yes',
						'value' => '1'
					),
				)
			),

			/*
			 * Column 2
			*/
			array(
				'label' => 'Title',
				'id' => 'title2',
				'std' => 'Silver',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 2',
			),
			array(
				'label' => 'Content',
				'id' => 'content2',
				'std' => '7 Days
				    2GB Storage
				    25 Users
				    Unlimited Pages
				    Enhanced Security',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 2',
			),
			array(
				'label' => 'Currency',
				'id' => 'currency2',
				'std' => '$',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 2',
			),
			array(
				'label' => 'Price',
				'id' => 'price2',
				'std' => '10',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 2',
			),
			array(
				'label' => 'Button Text',
				'id' => 'buttontext2',
				'std' => 'Select Plan',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 2',
			),
			array(
				'label' => 'Button Link URL',
				'id' => 'button_link2',
				'std' => '#',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 2',
			),
			array(
				'label' => 'Highlights',
				'id' => 'highlights2',
				'std' => '1',
				'type' => 'select',
				'section' => 'styling',
				'tab'		=> 'Column 2',
				'choices' => array(
					array(
						'label' => 'No',
						'value' => '0'
					),
					array(
						'label' => 'Yes',
						'value' => '1'
					),
				)
			),

			/*
			 * Column 3
			*/
			array(
				'label' => 'Title',
				'id' => 'title3',
				'std' => 'Gold',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 3',
			),
			array(
				'label' => 'Content',
				'id' => 'content3',
				'std' => '30 Days
				    2GB Storage
				    25 Users
				    Unlimited Pages
				    Enhanced Security',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 3',
			),
			array(
				'label' => 'Currency',
				'id' => 'currency3',
				'std' => '$',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 3',
			),
			array(
				'label' => 'Price',
				'id' => 'price3',
				'std' => '20',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 3',
			),
			array(
				'label' => 'Button Text',
				'id' => 'buttontext3',
				'std' => 'Select Plan',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 3',
			),
			array(
				'label' => 'Button Link URL',
				'id' => 'button_link3',
				'std' => '#',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 3',
			),
			array(
				'label' => 'Highlights',
				'id' => 'highlights3',
				'std' => '0',
				'type' => 'select',
				'section' => 'styling',
				'tab'		=> 'Column 3',
				'choices' => array(
					array(
						'label' => 'No',
						'value' => '0'
					),
					array(
						'label' => 'Yes',
						'value' => '1'
					),
				)
			),

			/*
			 * Column 4
			*/
			array(
				'label' => 'Title',
				'id' => 'title4',
				'std' => 'Diamond',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 4',
			),
			array(
				'label' => 'Content',
				'id' => 'content4',
				'std' => '365 Days
				    5GB Storage
				    50 Users
				    Unlimited Pages
				    Enhanced Security',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 4',
			),
			array(
				'label' => 'Currency',
				'id' => 'currency4',
				'std' => '$',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 4',
			),
			array(
				'label' => 'Price',
				'id' => 'price4',
				'std' => '200',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 4',
			),
			array(
				'label' => 'Button Text',
				'id' => 'buttontext4',
				'std' => 'Select Plan',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 4',
			),
			array(
				'label' => 'Button Link URL',
				'id' => 'button_link4',
				'std' => '#',
				'type' => 'textarea',
				'section' => 'styling',
				'tab'		=> 'Column 4',
			),
			array(
				'label' => 'Highlights',
				'id' => 'highlights4',
				'std' => '0',
				'type' => 'select',
				'section' => 'styling',
				'tab'		=> 'Column 4',
				'choices' => array(
					array(
						'label' => 'No',
						'value' => '0'
					),
					array(
						'label' => 'Yes',
						'value' => '1'
					),
				)
			),
		);

		$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="one_full">
		<?php if($options['columns']==4){ ?>
			<?php for($i=1; $i<5; $i++){ ?>
				<div class="pricing plan one_fourth<?php if($i==4){ echo ' last'; } ?><?php if($options['highlights'.$i]==1){ echo ' plan_hilight'; } ?>">
					<h3><?php echo $options['title'.$i]; ?></h3>
					<h4>
						<span class="amount"><?php echo $options['currency'.$i]; ?><?php echo $options['price'.$i]; ?><span>/per month</span></span>
					</h4>
					<div class="features">
						<ul>
							<?php 
								$content = stripcslashes( $options['content'.$i] );
								$content = trim($content);
								$items   = preg_split( '/\r\n|\r|\n/', $content );

								$output = '';
								foreach($items as $item){
									$output .= '<li>' . htmlspecialchars_decode( $item ) . '</li>';
								}

								echo $output;
							?>
						</ul>
					</div>
					<div class="select">
						<a class="btn inverse" href="<?php echo $options['button_link'.$i]; ?>"><?php echo $options['buttontext'.$i] ?></a>
					</div>
				</div>
		    <?php } ?>
		<?php } else { ?>
			<?php for($i=1; $i<4; $i++){ ?>
				<div class="pricing plan one_third<?php if($i==3){ echo ' last'; } ?><?php if($options['highlights'.$i]==1){ echo ' plan_hilight'; } ?>">
	            	<h3><?php echo $options['title'.$i]; ?></h3>
					<h4>
						<span class="amount"><?php echo $options['currency'.$i]; ?><?php echo $options['price'.$i]; ?><span>/per month</span></span>
					</h4>
					<div class="features">
						<ul>
							<?php 
								$content = stripcslashes( $options['content'.$i] );
								$content = trim($content);
								$items   = preg_split( '/\r\n|\r|\n/', $content );

								$output = '';
								foreach($items as $item){
									$output .= '<li>' . htmlspecialchars_decode( $item ) . '</li>';
								}

								echo $output;
							?>
						</ul>
					</div>
					<div class="select">
						<a class="btn inverse" href="<?php echo $options['button_link'.$i]; ?>"><?php echo $options['buttontext'.$i] ?></a>
					</div>
	            </div>
		    <?php } ?>
		<?php } ?>
	</div>
	<div class="clearfix"></div>
	<?php
    	// REQUIRED
    	$this->module_end( $options );

    }
 
}