<?php if(! defined('ABSPATH')){ return; }
/*
Name: STATIC CONTENT - Text and Video
Description: Create and display a STATIC CONTENT - Text and Video element
Class: TH_StaticContentTextAndVideo
Category: header
Level: 1
*/
/**
 * Class TH_StaticContentTextAndVideo
 *
 * Create and display a STATIC CONTENT - Text and Video element
 *
 * @package  Kallyas
 * @category Page Builder
 * @author   Team Hogash
 * @since    4.0.0
 */
class TH_StaticContentTextAndVideo extends ZnElements
{
    public static function getName(){
        return __( "STATIC CONTENT - Text and Video", 'zn_framework' );
    }

    /**
     * Load dependant resources
     */
    function scripts(){
        wp_enqueue_style( 'static_content', THEME_BASE_URI . '/sliders/static_content/sc_styles.css', '', THEME_VERSION );
    }

    /**
     * This method is used to display the output of the element.
     * @return void
     */
    function element()
    {
        $options = $this->data['options'];

        if( empty( $options ) ) { return; }

        $style = '';
        if ( isset ( $options['ww_header_style'] ) && ! empty ( $options['ww_header_style'] ) ) {
            $style = 'uh_' . $options['ww_header_style'];
        }

        $bottom_mask = $this->opt('hm_header_bmasks','none');
        $bm_class = $bottom_mask != 'none' ? 'maskcontainer--'.$bottom_mask : '';
        ?>
        <div class="kl-slideshow <?php echo $style; ?> <?php echo $bm_class ?>">

            <div class="bgback"></div>
            <div class="th-sparkles"></div>

            <div class="container kl-slideshow-inner kl-slideshow-safepadding">
                <div class="static-content default-style with-login">
                    <div class="row">
                        <div class="col-sm-7">
                            <?php
                            if ( ! empty( $options['ww_slide_title'] ) ) {
                                echo '<h2>' . do_shortcode( $options['ww_slide_title'] ) . '</h2>';
                            }

                            if ( ! empty( $options['ww_slide_subtitle'] ) ) {
                                echo '<h3>' . do_shortcode( $options['ww_slide_subtitle'] ) . '</h3>';
                            }

                            if ( ! empty( $options['ww_slide_m_button'] ) && ! empty ( $options['ww_slide_l_text'] ) && ! empty( $options['ww_slide_link']['url'] ) ) {
                                echo '<div class="info_pop animated fadeBoxIn left" data-arrow="top">';
                                echo '<a href="' . $options['ww_slide_link']['url'] . '" target="' .
                                     $options['ww_slide_link']['url'] . '" class="buyit">' . $options['ww_slide_l_text'] . '</a>';
                                echo '<h5 class="text">' . $options['ww_slide_m_button'] . '</h5>';
                                echo '<div class="clear"></div>';
                                echo '</div>';
                            }
                            ?>
                        </div>
                        <div class="col-sm-5">
                            <?php
                            // Text
                            if ( isset ( $options['sc_ec_vid_desc'] ) && ! empty ( $options['sc_ec_vid_desc'] ) ) {
                                echo '<h5 style="text-align:right;">' . $options['sc_ec_vid_desc'] . '</h5>';
                            }
                            // VIDEO
                            if ( isset ( $options['sc_ec_vime'] ) && ! empty ( $options['sc_ec_vime'] ) ) {
                                echo get_video_from_link( $options['sc_ec_vime'], 'black_border full_width', '520px', '270px' );
                            }
                            ?>
                        </div>
                    </div>
                    <!-- end row -->
                </div>
                <!-- end static content -->
            </div>
            <?php
                WpkPageHelper::zn_bottommask_markup($bottom_mask);
            ?>
            <!-- header bottom style -->
        </div><!-- end kl-slideshow -->
    <?php
    }

    /**
     * This method is used to retrieve the configurable options of the element.
     * @return array The list of options that compose the element and then passed as the argument for the render() function
     */
    function options()
    {
        return array (
                array (
                    "name"        => __( "Background Style", 'zn_framework' ),
                    "description" => __( "Select the background style you want to use. Please note that styles can be created
                                from the unlimited headers options in the theme admin's page.", 'zn_framework' ),
                    "id"          => "ww_header_style",
                    "std"         => "",
                    "type"        => "select",
                    "options"     => WpkZn::getThemeHeaders(),
                    "class"       => ""
                ),
                array (
                    "name"        => __( "Main title", 'zn_framework' ),
                    "description" => __( "Please enter a main title.", 'zn_framework' ),
                    "id"          => "ww_slide_title",
                    "std"         => "",
                    "type"        => "textarea"
                ),
                array (
                    "name"        => __( "Subtitle", 'zn_framework' ),
                    "description" => __( "Please enter a subtitle", 'zn_framework' ),
                    "id"          => "ww_slide_subtitle",
                    "std"         => "",
                    "type"        => "textarea"
                ),
                array (
                    "name"        => __( "Button Main Text", 'zn_framework' ),
                    "description" => __( "Please enter a main text for this button", 'zn_framework' ),
                    "id"          => "ww_slide_m_button",
                    "std"         => "",
                    "type"        => "text"
                ),
                array (
                    "name"        => __( "Button Link Text", 'zn_framework' ),
                    "description" => __( "Please enter a text that will appear on the right side of the button", 'zn_framework' ),
                    "id"          => "ww_slide_l_text",
                    "std"         => "",
                    "type"        => "text"
                ),
                array (
                    "name"        => __( "Button link", 'zn_framework' ),
                    "description" => __( "Please enter a link that will appear on the right side of the button", 'zn_framework' ),
                    "id"          => "ww_slide_link",
                    "std"         => "",
                    "type"        => "link",
                    "options"     => array (
                        '_self'  => __( "Same window", 'zn_framework' ),
                        '_blank' => __( "New window", 'zn_framework' )
                    )
                ),
                array (
                    "name"        => __( "Video", 'zn_framework' ),
                    "description" => __( "Please enter the link for your desired video ( youtube or vimeo ).", 'zn_framework' ),
                    "id"          => "sc_ec_vime",
                    "std"         => "",
                    "type"        => "text"
                ),
                array (
                    "name"        => __( "Video Description", 'zn_framework' ),
                    "description" => __( "Please enter a description for this video that will appear above the video.", 'zn_framework' ),
                    "id"          => "sc_ec_vid_desc",
                    "std"         => "",
                    "type"        => "textarea"
                ),

                // Bottom masks overrides
                array (
                    "name"        => __( "Bottom masks override", 'zn_framework' ),
                    "description" => __( "The new masks are svg based, vectorial and color adapted.", 'zn_framework' ),
                    "id"          => "hm_header_bmasks",
                    "std"         => "none",
                    "type"        => "select",
                    "options"     => array (
                        'none' => __( 'None, just rely on Background style.', 'zn_framework' ),
                        'shadow' => __( 'Shadow Up', 'zn_framework' ),
                        'shadow_ud' => __( 'Shadow Up and down', 'zn_framework' ),
                        'mask1' => __( 'Raster Mask 1 (Old, not recommended)', 'zn_framework' ),
                        'mask2' => __( 'Raster Mask 2 (Old, not recommended)', 'zn_framework' ),
                        'mask3' => __( 'Vector Mask 3 CENTER (New! From v4.0)', 'zn_framework' ),
                        'mask3 mask3l' => __( 'Vector Mask 3 LEFT (New! From v4.0)', 'zn_framework' ),
                        'mask3 mask3r' => __( 'Vector Mask 3 RIGHT (New! From v4.0)', 'zn_framework' ),
                        'mask4' => __( 'Vector Mask 4 CENTER (New! From v4.0)', 'zn_framework' ),
                        'mask4 mask4l' => __( 'Vector Mask 4 LEFT (New! From v4.0)', 'zn_framework' ),
                        'mask4 mask4r' => __( 'Vector Mask 4 RIGHT (New! From v4.0)', 'zn_framework' ),
                        'mask5' => __( 'Vector Mask 5 (New! From v4.0)', 'zn_framework' ),
                        'mask6' => __( 'Vector Mask 6 (New! From v4.0)', 'zn_framework' ),
                    ),
                ),
        );
    }
}
