<?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) {
    PA::showHeadline('h2',Text::get('INDEX_OFFERS_FEATURED'),'icn_featured_black.png');
    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) {
    PA::showHeadline('h2',Text::get('INDEX_USERS_FEATURED'),'icn_user_black.png');
    PA::showFeaturedUsers($featuredUsers);

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

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

if ($featuredOtherUsers['number'] > 0) {
    PA::showHeadline('h2',Text::get('INDEX_USERS_OTHER_FEATURED'),'icn_other_featured_black.png');
    PA::showFeaturedUsers($featuredOtherUsers);

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

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

if ($offers['number'] > 0) {
    PA::showHeadline('h2',Text::get('INDEX_NEWEST_OFFERS'),'icn_offer_black.png');
    PA::showOfferList($offers,'',true,true,false,true,false);

    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 DESC',
              'active'          => true,
              'userOrder'       => false,
              'type'            => 2);
$offers = PA::getOffers($args);

if ($offers['number'] > 0) {
    PA::showHeadline('h2',Text::get('INDEX_NEWEST_REQUESTS'),'icn_request_black.png');

    PA::showOfferList($offers,'',true,true,false,true,false);
    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();
