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

class Ainex_Search_Domain extends DSLC_Module {

    // Module Attributes
    var $module_id = 'Ainex_Search_Domain';
    var $module_title = 'Search Domain';
    var $module_icon = 'font';
    var $module_category = 'Ainex - Blocks';

    // Module Options
    function options() {
        // The options array
        $dslc_options = array(
            array(
                'label' => __( 'Search Domain - Text Placehoder', 'dslc_string' ),
                'id' => 'title_text',
                'std' => 'Enter your Domain Name here...',
                'type' => 'text',
            ),
            array(
                'label' => __( 'Title Button', 'dslc_string' ),
                'id' => 'title_button',
                'std' => 'Search',
                'type' => 'text',
            ),
            array(
                'label' => __( 'Link Action', 'dslc_string' ),
                'id' => 'link_action',
                'std' => 'http://swat.themestudio.net/ainex/whmcs-bridge/?ccce=domainchecker',
                'type' => 'text',
            ),
            array(
                'label' => 'Show/Hidden Price List',
                'id' => 'price_custom',
                'std' => '1',
                'type' => 'select',
                'choices' => array(
                    array(
                        'label' => 'Show',
                        'value' => '1'
                    ),
                    array(
                        'label' => 'Hidden',
                        'value' => '0'
                    ),
                ),
                'tab'   => 'Price List',
            ),
            array(
                'label' => __( 'Title', 'dslc_string' ),
                'id'    => 'price_title',
                'std'   => 'View Domain Price List',
                'type'  => 'text',
                'tab'   => 'Price List',
            ),
            array(
                'label' => __( 'Link', 'dslc_string' ),
                'id'    => 'price_link',
                'std'   => '#',
                'type'  => 'text',
                'tab'   => 'Price List',
            ),
            array(
                'label' => 'Show/Hidden Search',
                'id' => 'search_custom',
                'std' => '1',
                'type' => 'select',
                'choices' => array(
                    array(
                        'label' => 'Show',
                        'value' => '1'
                    ),
                    array(
                        'label' => 'Hidden',
                        'value' => '0'
                    ),
                ),
                'tab'   => 'Search',
            ),
            array(
                'label' => __( 'Title', 'dslc_string' ),
                'id'    => 'search_title',
                'std'   => 'Bulk Domain Search',
                'type'  => 'text',
                'tab'   => 'Search',
            ),
            array(
                'label' => __( 'Link', 'dslc_string' ),
                'id'    => 'search_link',
                'std'   => '#',
                'type'  => 'text',
                'tab'   => 'Search',
            ),
            array(
                'label' => 'Show/Hidden Transfer',
                'id' => 'transfer_custom',
                'std' => '1',
                'type' => 'select',
                'choices' => array(
                    array(
                        'label' => 'Show',
                        'value' => '1'
                    ),
                    array(
                        'label' => 'Hidden',
                        'value' => '0'
                    ),
                ),
                'tab'   => 'Transfer',
            ),
            array(
                'label' => __( 'Title', 'dslc_string' ),
                'id'    => 'transfer_title',
                'std'   => 'Transfer Domain',
                'type'  => 'text',
                'tab'   => 'Transfer',
            ),
            array(
                'label' => __( 'Link', 'dslc_string' ),
                'id'    => 'transfer_link',
                'std'   => '#',
                'type'  => 'text',
                'tab'   => 'Transfer',
            ),
            array(
                'label' => 'Show/Hidden Logo 1',
                'id' => 'logo_1_custom',
                'std' => '1',
                'type' => 'select',
                'choices' => array(
                    array(
                        'label' => 'Show',
                        'value' => '1'
                    ),
                    array(
                        'label' => 'Hidden',
                        'value' => '0'
                    ),
                ),
                'tab'   => 'Logo 1',
            ),
            array(
                'label' => __( 'Image', 'dslc_string' ),
                'id' => 'logo_1_image',
                'std' => get_template_directory_uri().'/assets/images/dot-com.png',
                'type' => 'image',
                'tab'   => 'Logo 1',
            ),
            array(
                'label' => __( 'Description', 'dslc_string' ),
                'id'    => 'logo_1_desc',
                'std'   => '<em>From</em> $4.99/year',
                'type'  => 'text',
                'tab'   => 'Logo 1',
            ),
            array(
                'label' => 'Show/Hidden Logo 2',
                'id' => 'logo_2_custom',
                'std' => '1',
                'type' => 'select',
                'choices' => array(
                    array(
                        'label' => 'Show',
                        'value' => '1'
                    ),
                    array(
                        'label' => 'Hidden',
                        'value' => '0'
                    ),
                ),
                'tab'   => 'Logo 2',
            ),
            array(
                'label' => __( 'Image', 'dslc_string' ),
                'id' => 'logo_2_image',
                'std' => get_template_directory_uri().'/assets/images/dot-org.png',
                'type' => 'image',
                'tab'   => 'Logo 2',
            ),
            array(
                'label' => __( 'Description', 'dslc_string' ),
                'id'    => 'logo_2_desc',
                'std'   => '<em>From</em> $4.99/year',
                'type'  => 'text',
                'tab'   => 'Logo 2',
            ),
            array(
                'label' => 'Show/Hidden Logo 3',
                'id' => 'logo_3_custom',
                'std' => '1',
                'type' => 'select',
                'choices' => array(
                    array(
                        'label' => 'Show',
                        'value' => '1'
                    ),
                    array(
                        'label' => 'Hidden',
                        'value' => '0'
                    ),
                ),
                'tab'   => 'Logo 3',
            ),
            array(
                'label' => __( 'Image', 'dslc_string' ),
                'id' => 'logo_3_image',
                'std' => get_template_directory_uri().'/assets/images/dot-co.png',
                'type' => 'image',
                'tab'   => 'Logo 3',
            ),
            array(
                'label' => __( 'Description', 'dslc_string' ),
                'id'    => 'logo_3_desc',
                'std'   => '<em>From</em> $4.99/year',
                'type'  => 'text',
                'tab'   => 'Logo 3',
            ),
            array(
                'label' => 'Show/Hidden Logo 4',
                'id' => 'logo_4_custom',
                'std' => '1',
                'type' => 'select',
                'choices' => array(
                    array(
                        'label' => 'Show',
                        'value' => '1'
                    ),
                    array(
                        'label' => 'Hidden',
                        'value' => '0'
                    ),
                ),
                'tab'   => 'Logo 4',
            ),
            array(
                'label' => __( 'Image', 'dslc_string' ),
                'id' => 'logo_4_image',
                'std' => get_template_directory_uri().'/assets/images/dot-net.png',
                'type' => 'image',
                'tab'   => 'Logo 4',
            ),
            array(
                'label' => __( 'Description', 'dslc_string' ),
                'id'    => 'logo_4_desc',
                'std'   => '<em>From</em> $4.99/year',
                'type'  => 'text',
                'tab'   => 'Logo 4',
            ),
        );

        $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="domain_search">
                <div class="left">
                    <div class="search_section">
                        <form id="domain-searchform" action="<?php echo $options['link_action']; ?>" method="post">
                            <div>
                                <input class="input-text" name="domain" id="s" value="<?php echo $options['title_text']; ?>" onFocus="if (this.value == '<?php echo $options['title_text']; ?>') {this.value = '';}" onBlur="if (this.value == '') {this.value = '<?php echo $options['title_text']; ?>';}" type="text" />
                                <select class="witch" name="tld">
                                    <option value=".com">.com</option>
                                    <option value=".co">.co</option>
                                    <option value=".net">.net</option>
                                    <option value=".org">.org</option>
                                </select>
                                <input id="searchsubmit" value="<?php echo $options['title_button']; ?>" type="submit" />
                            </div>
                        </form>
                    </div>
                    <div class="clearfix"></div>

                    <div class="sm_links">
                        <?php if ($options['price_custom']==1): ?>
                            <a href="<?php echo $options['price_link'] ?>"><?php echo $options['price_title']; ?></a>  | 
                        <?php endif ?>
                        <?php if ($options['search_custom']==1): ?>
                            <a href="<?php echo $options['search_link'] ?>"><?php echo $options['search_title']; ?></a>  | 
                        <?php endif ?>
                        <?php if ($options['transfer_custom']==1): ?>
                            <a href="<?php echo $options['transfer_link'] ?>"><?php echo $options['transfer_title']; ?></a>
                        <?php endif ?>
                    </div>
                </div>

                <div class="right">
                    <ul>
                        <?php if ($options['logo_1_custom']==1): ?>
                            <li>
                                <?php if ($options['logo_1_image']): ?>
                                    <img src="<?php echo $options['logo_1_image']; ?>" alt=""/>
                                <?php endif ?>
                                <?php echo $options['logo_1_desc']; ?>
                            </li>
                        <?php endif ?>
                        <?php if ($options['logo_2_custom']==1): ?>
                            <li>
                                <?php if ($options['logo_2_image']): ?>
                                    <img src="<?php echo $options['logo_2_image']; ?>" alt=""/>
                                <?php endif ?>
                                <?php echo $options['logo_2_desc']; ?>
                            </li>
                        <?php endif ?>
                        <?php if ($options['logo_3_custom']==1): ?>
                            <li>
                                <?php if ($options['logo_3_image']): ?>
                                    <img src="<?php echo $options['logo_3_image']; ?>" alt=""/>
                                <?php endif ?>
                                <?php echo $options['logo_3_desc']; ?>
                            </li>
                        <?php endif ?>
                        <?php if ($options['logo_4_custom']==1): ?>
                            <li>
                                <?php if ($options['logo_4_image']): ?>
                                    <img src="<?php echo $options['logo_4_image']; ?>" alt=""/>
                                <?php endif ?>
                                <?php echo $options['logo_4_desc']; ?>
                            </li>
                        <?php endif ?>
                    </ul>
                </div>
            </div>
        </div>

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

    }

}