<?php
PA::showSearchbar();
?>

<div id="about_plattform_box">
    <?php
    PA::showContact(/* LinkText (leave empty for backend customizability)*/'',
                    /* Link (leave empty for backend customizability)*/'',
                    'left onethird');
    PA::showAbout(/* LinkText (leave empty for backend customizability)*/'',
                  /* Link (leave empty for backend customizability)*/'',
                  'right twothird');
    ?>
    <div class="clear"></div>
</div>

<?php
//GENERATE FEATURED OFFERS
$args = array('page' => 1,
              'howMany' => 11,
              'orderBy' => 'random',
              'active' => true,
              'adminFeatured' => true,
              'userFeatured' => false,
              'type' => 1);
$featuredOffers = PA::getOffers($args);

if ($featuredOffers['number'] > 0) {
    echo '<h2 class="headline">'.Text::get('INDEX_OFFERS_FEATURED').'</h2>';
    PA::showOffersWithPictures($featuredOffers,true);
}


//GENERATE FEATURED USERS
$args = array('page' => 1,
              'howMany' => 5,
              'adminFeatured' => true,
              'orderBy' => 'random');
$featuredUsers = PA::getProfiles($args);

if ($featuredUsers['number'] > 0) {
    echo '<h2 class="headline">'.Text::get('INDEX_USERS_FEATURED').'</h2>';
    PA::showFeaturedUsers($featuredUsers);
}

//GENERATE OTHER FEATURED USERS
$args = array('page' => 1,
              'howMany' => 5,
              'otherFeatured' => true,
              'orderBy' => 'random');
$featuredUsers2 = PA::getProfiles($args);

if ($featuredUsers2['number'] > 0) {
    echo '<h2 class="headline">'.Text::get('INDEX_USERS_OTHER_FEATURED').'</h2>';
    PA::showFeaturedUsers($featuredUsers2);
}

//GENERATE OFFERLIST
$args = array('page'            => 1,
              'howMany'         => 10,
              'orderBy'         => 'created',
              'order'           => 'DESC',
              'active'          => true,
              'type'            => 1);
$offers = PA::getOffers($args);

if ($offers['number'] > 0) {
    echo '<h2 class="headline">'.Text::get('INDEX_NEWEST_OFFERS').'</h2>';

    PA::showOfferList($offers);

    echo '
        <div class="pagination_box">
            <a href="'.PA::getLink('offers').'">
                <div class="pagination_next">
                    <div class="pagination_next_icon"></div>
                    <div class="pagination_next_text">'.Text::get('INDEX_SHOW_ALL_OFFERS').'</div>
                </div>
            </a>
        </div>
        <div class="clear"></div>';
}

//GENERATE REQUESTLIST
$args = array('page'            => 1,
              'howMany'         => 10,
              'orderBy'         => 'created',
              'order'           => 'DESC',
              'active'          => true,
              'type'            => 2);
$offers = PA::getOffers($args);

if ($offers['number'] > 0) {
    echo '<h2 class="headline">'.Text::get('INDEX_NEWEST_REQUESTS').'</h2>';

    PA::showOfferList($offers);

    echo '
        <div class="pagination_box">
            <a href="'.PA::getLink('requests').'">
                <div class="pagination_next">
                    <div class="pagination_next_icon"></div>
                    <div class="pagination_next_text">'.Text::get('INDEX_SHOW_ALL_REQUESTS').'</div>
                </div>
            </a>
        </div>
        <div class="clear"></div>';
}
PA::showFooter();
