<?php
PA::showSearchbar('',$data['searchterm'],true);

$searchresults          = $data['results'];
$searchresults_profile  = $data['results_profile'];

$searchtext             = Text::get('SEARCH_RESULT_HEADLINE');
$replace_search         = array('[no_results]', '[no_profiles]');
$replace_replace        = array($searchresults['number'], $searchresults_profile['number']);
$searchtext             = PA::replace($searchtext,$replace_search,$replace_replace);

PA::showHeadline('h1',$searchtext,'','search_headline');

$headlines = array(
    'offers' => Text::get('OFFERLIST_OFFERS'),
    'requests' => Text::get('OFFERLIST_REQUESTS')
);
PA::showOfferList($searchresults,$headlines,true);

if ($searchresults_profile['number'] > 0) {
    PA::showHeadline('h2',Text::get('SEARCH_PROFILE_HEADLINE'),'icn_user_black.png','');
    PA::generateUserList($searchresults_profile['data'], false, true);
}

if ($searchresults['number'] < $searchresults_profile['number']) {
    $results_no = $searchresults_profile['number'];
    $ppp = $searchresults_profile['howMany'];
} else {
    $results_no = $searchresults['number'];
    $ppp = $searchresults['howMany'];
}
PA::showPagination($results_no,$ppp,'',Text::get('OFFERS_MORE'),true);

PA::showFooter();
