<?php

/**
 * Template Name: Home
 *
 * @package UIU_CSE
 */
get_header(); ?>

<!-- <div class="container full-width">
    <div class="row"> -->
<section id="banner" class="container-fluid">

    <div class="banner-slider" data-banner-slider>
        <button class="banner-slider-button prev" data-banner-slider-button="prev">
            <span class="material-symbols-outlined">
                arrow_back_ios
            </span>
        </button>
        <button class="banner-slider-button next" data-banner-slider-button="next">
            <span class="material-symbols-outlined">
                arrow_forward_ios
            </span>
        </button>

        <ul data-slides>

            <?php
            $i = 0;
            if (have_rows('home_slider_slides', 'option')) :
                while (have_rows('home_slider_slides', 'option')) : the_row();
                    $bg_image = get_sub_field('bg_image');
                    $sub_heading = get_sub_field('sub_heading');
                    $heading_main = get_sub_field('heading_main');
                    $text = get_sub_field('text'); ?>

                    <li class="slide" <?php if ($i == 0) {
                                            echo 'data-active';
                                        } ?>>
                        <div class="slider-single-div">
                            <img src="<?php echo $bg_image  ?>" alt="">
                            <div class="banner-overlay">
                                <h4><?php echo $sub_heading  ?></h4>
                                <h1><?php echo $heading_main  ?></h1>
                                <h3>
                                    <?php echo $text  ?>
                                </h3>
                            </div>
                        </div>
                    </li>
            <?php
                    $i = $i + 1;
                endwhile;
            else :
                echo '<div class="no-post-found">No faculty profile has found! </div>';
            endif; ?>

        </ul>
    </div>
</section>


<main id="main" class="site-main" role="main">

    <div class="sections">

        <section class="container-fluid white-bg">
            <div class="container">
                <h1>We evolve with technology</h1>
                <p>
                    The CSE Department of UIU has been involved in several projects in last five years including projects under Thrust/Emerging Areas, Modernization and Removal of Obsolescence, Industry-Institution Interaction.
                </p>
                <button class="primary-c">Learn more</button>
                <div class="grid">
                    <div class="program">
                        <div class="img-cont-2">
                            <img src="<?php echo (get_template_directory_uri()) ?>/img/student_03.jpg" alt="">
                        </div>
                        <div class="program-details">
                            <h2>Graduate Program</h2>
                            <p>
                                <b>UIU</b> has been running its M.Sc. in Computer Science and Engineering program since its inception and has attracted not only fresh undergraduates but also a handful number of ICT professionals from the industry.
                            </p>
                            <button class="primary-c"> View All Programs </button>
                        </div>
                    </div>

                    <div class="program">
                        <div class="img-cont-2">
                            <img src="<?php echo (get_template_directory_uri()) ?>/img/undergrad.jpg" alt="">
                        </div>

                        <div class="program-details">
                            <h2>Undergraduate Program</h2>
                            <p>
                                Bachelor of Science in Computer Science and Engineering primarily involves the study of a number of core courses, which every CSE graduate should know, and a significant number of courses from specialized areas.
                            </p>
                            <button class="primary-c"> View All Programs </button>
                        </div>


                    </div>

                </div>

            </div>
        </section>


        <section id="faculty-section" class="container-fluid white-bg">
            <div class="container">
                <h1>World Class Faculty</h1>
                <p>
                    The Department of Computer Science and Engineering at UIU boasts one of the biggest faculty bodies
                    amongst all private universities in the country and is bolstered by a rich and diverse battery of published research work.
                </p>
            </div>

            <div class="container">

                <div id="faculty-img">
                    <img src="<?php echo (get_template_directory_uri()) ?>/img/faculty-grp.jpg" alt="">
                </div>
                <p>
                    The Department of Computer Science and Engineering faculty members are an impressive group, bearing the academic tradition of higher excellence. World renowned, they are engaged in ground-breaking research. Further, they are so attuned to what’s happening in business that they are shaping its future.
                </p>
                <a href="/faculty/">
                    <button class="primary-c">
                        View complete faculty list
                    </button>
                </a>
            </div>

        </section>

        <section class="container-fluid car" id="faculty-carousel">
            <div class="car-buttons">
                <button class="car-control primary-c" id="prev-car" onclick="scrollToPrev()">
                    >
                </button>
                <button class="car-control primary-c" id="next-car" onclick="scrollToNext()">
                    >
                </button>
            </div>


            <div class="profile-carousel">

                <?php
                $args = array(
                    'post_type'      => 'faculty',
                    'posts_per_page' => 10,
                    //'post__not_in' => array(get_the_ID()),
                    'orderby'        => 'date',
                    'order'          => 'DESC',
                );

                $query = new WP_Query($args);

                if ($query->have_posts()) :
                    while ($query->have_posts()) : $query->the_post();

                        $login_id_e = "";
                        $auth_token = get_field('auth_token', 'option');
                        $client_id = get_field('client_id', 'option');
                        $employee_info_api = get_field('employee_info_api', 'option');

                        if (function_exists('get_field')) {
                            $pid_content = get_post();
                            if (has_blocks($pid_content)) {
                                $blocks = parse_blocks($pid_content->post_content);
                                foreach ($blocks as $block) {
                                    if ($block["blockName"] == "acf/faculty-member") {
                                        // $FullName = $block['login_id_e'];
                                        $login_id_e = $block["attrs"]["data"]["login_id"];
                                        // $Designation = $block["attrs"]["data"];
                                    }
                                }
                            }
                        };

                        $response_employeeInfo = wp_remote_post(
                            $employee_info_api,
                            array(
                                'body' => array(
                                    'user_login_id' => $client_id,
                                    'login_id' => $login_id_e,
                                    'auth_token' => $auth_token
                                )
                            )
                        );
                        $employeeInfo = json_decode(wp_remote_retrieve_body($response_employeeInfo), true);
                        $Title = $employeeInfo[0]['Title'];
                        $FullName = $Title . ' ' . $employeeInfo[0]['FullName'];
                        $Designation = $employeeInfo[0]['Designation'] . ', ' . $employeeInfo[0]['Office'];
                ?>

                        <div class="car-item">

                            <div class="car-item-holder">
                                <div class="car-img-holder">
                                    <img src="<?php the_field('profile_photo') ?>" alt="">
                                </div>
                                <a class="faculty-name" href="<?php echo get_the_permalink(); ?>">
                                    <div class="faculty-details">
                                        <h2><?php echo $FullName; ?>
                                            <!-- <span class="degree"><?php //if ($Title == "Dr.") {echo ', PhD';}
                                                                        ?>
                                        </span> -->
                                        </h2>
                                        <h3><span class="degree"><?php echo $Designation; ?></span></h3>

                                    </div>
                                </a>
                            </div>

                        </div>
                <?php
                    endwhile;
                else :
                    echo '<div class="no-post-found">No faculty profile has found! </div>';
                endif; ?>

            </div>
        </section>

        <section id="Success-section" class="container-fluid white-bg">
            <div class="container">
                <h1>Success Stories</h1>
                <p>
                    Our students inspire us by their courage and perseverance, and are a reminder that obstacles can be overcome when you have just one person cheering you on to the finish line.
                </p>
            </div>

            <div class="container">

                <div id="us-imgs" class="grid student-stories">

                    <?php
                    $args = array(
                        'post_type'      => 'success_story',
                        'posts_per_page' => 3,
                        //'post__not_in' => array(get_the_ID()),
                        'orderby'        => 'date',
                        'order'          => 'DESC',
                    );

                    $query = new WP_Query($args);

                    if ($query->have_posts()) :
                        while ($query->have_posts()) :
                            $query->the_post(); ?>
                            <div>
                                <div class="img-cont">
                                    <img src="<?php the_field('profile_image'); ?>" alt="">
                                </div>
                                <div>
                                    <h2><?php echo get_the_title() ?></h2>
                                    <h5><?php the_field('student_designation'); ?></h5>
                                    <p>
                                        <?php the_excerpt(); ?>
                                    </p>

                                    <a href="<?php echo get_the_permalink() ?>">Learn more</a>
                                </div>
                            </div>
                    <?php
                        endwhile;
                    else :
                        echo '<div class="no-post-found">No success story has found! </div>';
                    endif; ?>

                </div>

                <div>
                    <h1>Notable Alumni</h1>
                    <p>
                        Pellentesque est est, luctus non iaculis sed, congue non diam. In efficitur gravida ipsum vitae finibus. Etiam sollicitudin placerat leo.
                    </p>
                </div>

                <a href="/alumni/">
                    <button class="primary-c">
                        View complete Alumni list
                    </button>
                </a>
            </div>
        </section>

        <section class="container-fluid car" id="alumni-carousel">
            <div class="car-buttons">
                <button class="car-control primary-c" onclick="scrollToPrevAl()">
                    < </button>

                        <button class="car-control primary-c" onclick="scrollToNextAl()">
                            >
                        </button>
            </div>


            <div class="profile-carousel">

                <?php
                $args = array(
                    'post_type'      => 'alumni',
                    'posts_per_page' => 10,
                    //'post__not_in' => array(get_the_ID()),
                    'orderby'        => 'date',
                    'order'          => 'DESC',
                );

                $query = new WP_Query($args);

                if ($query->have_posts()) :
                    while ($query->have_posts()) :
                        $query->the_post(); ?>

                        <div class="car-item">
                            <div class="car-item-holder">
                                <div class="car-img-holder">
                                    <img src="<?php the_field('profile_photo'); ?>" alt="">
                                </div>
                                <a class="faculty-name" href="<?php echo get_the_permalink(); ?>">
                                    <div class="faculty-details">
                                        <h2><?php echo get_the_title(); ?></h2>
                                        <h3><span class="degree"><?php the_field('alumni_designation'); ?></span></h3>
                                    </div>
                                </a>
                            </div>
                        </div>
                <?php
                    endwhile;
                else :
                    echo '<div class="no-post-found">No alumni has found! </div>';
                endif; ?>

            </div>
        </section>

        <section id="dept-notices" class="container-fluid mid-roll">

            <div class="bg-tint">
                <div class="container">
                    <h1>Department Notices</h1>
                    <div class="notice-main">


                        <?php
                        $args = array(
                            'post_type'      => 'notice',
                            'posts_per_page' => 5,
                            'orderby'        => 'date',
                            'order'          => 'DESC',
                        );

                        $query = new WP_Query($args);

                        if ($query->have_posts()) :
                            while ($query->have_posts()) :
                                $query->the_post();
                                $custom_date_full = get_the_date('M jS, Y');
                                $custom_date_min = explode(', ', $custom_date_full);
                                $custom_date_array = explode(' ', $custom_date_min[0]);
                        ?>
                                <a href="<?php echo get_the_permalink(); ?>">
                                    <div class="notice-container">
                                        <div class="event-date">
                                            <h3><?php echo $custom_date_array[0] ?></h3>
                                            <h3><?php echo $custom_date_array[1] ?></h3>
                                        </div>
                                        <div>
                                            <h6><span class="subtitle"><?php echo get_the_date(); ?></span></h6>
                                            <h4><?php echo get_the_title(); ?></h4>
                                            <p>Maecenas sed enim ut sem viverra aliquet. Neque laoreet suspendisse interdum consectetur.</p>
                                        </div>
                                    </div>
                                </a>

                        <?php
                            endwhile;
                        else :
                            echo '<div class="no-post-found">No event has found! </div>';
                        endif; ?>


                        <a href="/notice/">

                            <button>View All Notices</button>
                        </a>

                    </div>

                </div>
            </div>
        </section>

        <section id="dept-news" class="container-fluid white-bg">

            <div class="container">



                <h1>Department News</h1>

                <p>
                    Catch up with what's happening at the Department of CSE
                </p>

                <div class="news-row">

                    <!-- <div class="news-big-img">
                        <div class="news-big-img-holder">
                            <img src="<?php //echo (get_template_directory_uri())
                                        ?>/img/campus_05.jpg" alt="">
                        </div>

                        <div class="news-big-img-text">
                            <h5>28th March, 2016</h5>
                            <h4> <a href=""> Seminar</a></h4>
                            <a href="">
                                <p>Development and Mining of a Volatile Organic Compound Database</p>
                            </a>
                        </div>
                    </div>
-->


                    <?php
                    $args = array(
                        'post_type'      => 'news',
                        'posts_per_page' => 4,
                        'post__not_in' => array(get_the_ID()),
                        'orderby'        => 'date',
                        'order'          => 'DESC',
                    );

                    $query = new WP_Query($args);

                    if ($query->have_posts()) :
                        while ($query->have_posts()) :
                            $query->the_post(); ?>
                            <div class="news-small-img">
                                <div class="news-sm-img-holder">
                                    <img src="<?php echo get_the_post_thumbnail_url() ?>" alt="">
                                </div>
                                <div class="news-sm-img-text">
                                    <h5><?php the_field('news_date'); ?></h5>
                                    <!-- <h4> <a href=""> Seminar</a></h4> -->
                                    <a href="<?php echo get_permalink(); ?>">
                                        <p><?php echo get_the_title(); ?></p>
                                    </a>
                                </div>
                            </div>


                    <?php
                        endwhile;
                    else :
                        echo '<div class="no-post-found">No related news has found! </div>';
                    endif; ?>
                </div>

                <a href="/news/">
                    <button class="primary-c">View All News</button> </a>
            </div>

        </section>

        <section id="events" class="container-fluid mid-roll">
            <div class="bg-tint">

                <div class="container">
                    <h1>Upcoming Events</h1>
                    <div class="grid">

                        <?php
                        $args = array(
                            'post_type'      => 'event',
                            'posts_per_page' => 5,
                            //'post__not_in' => array(get_the_ID()),
                            'orderby'        => 'date',
                            'order'          => 'DESC',
                        );

                        $query = new WP_Query($args);

                        if ($query->have_posts()) :
                            while ($query->have_posts()) :
                                $query->the_post(); ?>

                                <div class="event-holder">
                                    <div class="event-img-holder">
                                        <img src="<?php echo get_the_post_thumbnail_url(); ?>" alt="">
                                    </div>

                                    <div class="event-date primary-c">
                                        <h3><?php the_field('event_date_start'); ?></h3>
                                    </div>

                                    <div class="event-details">
                                        <a href="<?php echo get_permalink(); ?>">
                                            <h3><?php echo get_the_title(); ?></h3>
                                            <h2><?php the_field('event_venue'); ?></h2>
                                        </a>
                                    </div>
                                </div>

                        <?php
                            endwhile;
                        else :
                            echo '<div class="no-post-found">No event has found! </div>';
                        endif; ?>

                    </div>
                    <a href="/event/">
                        <button class="primary-c">View all events</button>
                    </a>
                </div>
            </div>
        </section>


        <section id="research-grants" class="white-bg">
            <div class="container">
                <h1>Research &amp; Grants</h1>
                <p>Maecenas sed enim ut sem viverra aliquet. Neque laoreet suspendisse interdum consectetur.
                    Mus mauris vitae ultricies leo integer malesuada nunc vel. Mus mauris vitae ultricies leo integer malesuada nunc vel.
                </p>

                <div id="research-pointers" class="grid">

                    <div>
                        <h3>32 Research Projects</h3>
                        <p>Spread across Undergraduate and Graduate Programs</p>
                    </div>

                    <div>
                        <h3>Tk 5 Crores in grants</h3>
                        <p>Spread across Undergraduate and Graduate Programs</p>
                    </div>


                    <div>
                        <h3>32 Research Projects</h3>
                        <p>Spread across Undergraduate and Graduate Programs</p>
                    </div>
                </div>


            </div>
        </section>

    </div>

</main><!-- #main -->


<!-- </div> .row -->
<!-- </div>.container -->


<?php get_footer(); ?>