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

class Ainex_Search_Form extends DSLC_Module {

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

    // Module Options
    function options() {
        // The options array
        $dslc_options = array(
            array(
                'label' => __( 'Search Form - 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',
            ),
        );

        $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="domain_search">
        <div class="container">
            <div class="left_form">
                <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>
    </div>

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

    }

}