<?php if (!is_null(vget('recent'))) { ?> <div class="content"> <headline>Recent Listings</headline> <?php } ?> <div class="list"> <?php if (isset($_GET['delay'])) { vecho('delay', '<div style="text-align: center;"><i>Results returned in {var} ms</div><br />'); } foreach ($sublets as $sublet) { echo subletBlock($sublet); } if (count($sublets) == 0) { echo "No sublets matching your query. But don't fret! New sublets are being added regularly."; } ?> </div> <?php if (!is_null(vget('recent'))) { ?> <a href="?showMore">Show More</a> <?php if (vget('showMore')) { ?> <script>scrollTo('.subletblock', <?php vecho('showMore');
function subletBlock($sublet) { $title = $sublet['title']; $location = $sublet['address']; if ($sublet['city'] != '') { $location .= $sublet['city']; } if ($sublet['state'] != '') { $location .= $sublet['state']; } $summary = strmax($sublet['summary'], 300); $price = $sublet['price']; $pricetype = $sublet['pricetype']; $publish = $sublet['publish']; if ($publish) { $published = '<green>Public</green>'; } else { $published = '<red>Private (Publish to have listing show up in search results)</red>'; } return "\n <div class=\"subletblock\">\n <div class=\"title\">{$title} | {$location}</div>\n <div class=\"summary\">{$summary}</div>\n <div class=\"info\">Price: {$price} /{$pricetype} | {$published}</div>\n </div>\n "; } $sublets = vget('sublets'); foreach ($sublets as $sublet) { echo vlinkto(subletBlock($sublet), 'editsublet', array('id' => $sublet['_id']->{'$id'})); } if ($sublets->count() == 0) { echo "<b style=\"font-size: 1.5em;\">Congratulations! You have completed your profile and are on your way to finding tenants for the summer. Just take a moment to complete your sublet listing(s) by clicking the button below and you'll be all set!</b><br /><br />" . vlinkto('<input type="button" value="List Sublet" />', 'addsublet'); } ?> </div> </panel>