<?php /* Template Name: Contact SC */ ?>
<?php
/**
 * The template for displaying all pages
 *
 * TODO REFACTORING HARD
 * MODEL -> VIEW -> SCENE
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package o66FsWp
 */

//$addMe = get_post(8);
//$addMe2 = get_post(12);
//$addMe3 = get_post(15);
$page_root_model = o66TheModel::getTheRootModel();
//$oneSub = o66TheModel::createOneModelFromWpPostObject($addMe);
//$twoSub = o66TheModel::createOneModelFromWpPostObject($addMe2);
//$threeSub = o66TheModel::createOneModelFromWpPostObject($addMe3);
$primaryMenu = o66TheModel::createOneModelFromWpMenu('primary');
o66TheModel::appendOneModelToTheModel($primaryMenu);
$tree = o66TheModel::getTheTreeModelArray();
$flat = o66TheModel::getTheModelFlatArray();
$children = o66TheModel::getTheChildrenArray();
$fields = o66TheModel::getTheModelFieldsArray();

o66TheViewClass::assignModelToView($page_root_model);
//o66TheViewClass::assignModelToView($primaryMenu, 'feat_text');
$view = o66TheViewClass::getView('page');

$view_model = o66TheViewClass::getModelViewArray();
get_header();
echo $view;

?>
<div class="section-form-contatti">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="blok">
                    <?php include (get_stylesheet_directory().'/applications/contact_form/contact_form-view.php');?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php if (have_rows('sezioni_verticali')) : ?>
    <div class="blok verticale">

    <?php
    $conta = 0;
    while (have_rows('sezioni_verticali')) : the_row();
        $conta++;
        if ($conta % 2 == 0) {
            ?>
            <div class="blok pari">
                <div class="container ">
                    <div class="row">
                        <div class="col-md-8">
                            <div class="blok content-verticale">
                                <div class="titolo-verticale"><h2><?php the_sub_field('titolo'); ?></h2></div>
                                <div class="blok"><?php the_sub_field('testo'); ?></div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <?php $immagine = get_sub_field('immagine'); ?>
                            <?php if ($immagine) { ?><div class="blok">
                                <img src="<?php echo $immagine['url']; ?>" alt="<?php echo $immagine['alt']; ?>"
                                     class="img-responsive"/></div>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
            <?php
        } else { ?>
            <div class="blok dispari">
                <div class="container ">
                    <div class="row">
                        <div class="col-md-4">
                            <?php $immagine = get_sub_field('immagine'); ?>
                            <?php if ($immagine) { ?>
                                <div class="blok">
                                    <img src="<?php echo $immagine['url']; ?>" alt="<?php echo $immagine['alt']; ?>"
                                         class="img-responsive"/></div>
                            <?php } ?>
                        </div>
                        <div class="col-md-8">
                            <div class="blok content-verticale">
                                <div class="titolo-verticale"><h2><?php the_sub_field('titolo'); ?></h2></div>
                                <div class="blok"><?php the_sub_field('testo'); ?></div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <?php

        }
    endwhile; ?>
<?php else : ?>
    <?php // no rows found ?>

    </div>
<?php endif; ?>
<?php get_footer();

