gMaville/index.php

113 lines
2.1 KiB
PHP

<?php
require_once('lib/Gchange.class.php');
include('header.php');
if (!isset($_POST['city'])) {
echo '
<h2>Ça se passe près de chez vous&#8239;!</h2>
<form method="get" action="mytown.php">
<p>
<label>Ville ou code postal&nbsp;:
<input type="text" name="location" />
</label>
</p>
<p>
<input type="submit" value="Voir les annonces près de chez moi" />
</p>
</form>';
}
$gchange = new Gchange();
$offers = $gchange->getShippable();
echo '<h2>Livré à votre domicile</h2>';
echo '<p>Retrouvez ici toutes les annonces pour lesquelles le vendeur a mentionné "envoi possible" dans son annonce.</p>';
echo '<ol>';
foreach ($offers as $offer) {
$description = isset($offer->_source->description) ? ' title="'. substr($offer->_source->description, 0, 30) . '"' : '';
echo '
<li>
<a href="https://www.gchange.fr/#/app/market/view/'. $offer->_id . '/"'. $description .'>
' . $offer->_source->title . '
</a>
</li>
';
}
echo '</ol>';
$offers = $gchange->getImmaterialOffers();
echo '<h2>Productions immatérielles</h2>';
echo '<p>Retrouvez ici formations à distance, coaching, cours, prestations... bref, tout ce qui ressemble plus à de l\'information qu\'à de la matière.</p>';
echo '<ol>';
foreach ($offers as $offer) {
$description = isset($offer->_source->description) ? ' title="'. substr($offer->_source->description, 0, 30) . '"' : '';
echo '
<li>
<a href="https://www.gchange.fr/#/app/market/view/'. $offer->_id . '/"'. $description .'>
' . $offer->_source->title . '
</a>
</li>
';
}
echo '</ol>';
echo '<h2>Prochains événements monnaie libre</h2>';
echo '
<p>
Ces événements sont importés automatiquement depuis
<a href="'. htmlspecialchars(CALENDAR_URL) .'">
l\'Agenda du libre
</a>
</p>';
$content = file_get_contents(CALENDAR_RSS);
$x = new SimpleXmlElement($content);
echo '<ul>';
foreach($x->item as $entry) {
echo '
<li>
<a href="'. $entry->link .'"
title="'. substr(strip_tags($entry->description), 0, 30) . '">
'. $entry->title . '
</a>
</li>';
}
echo '</ul>';
include('footer.php');