mirror of
https://github.com/ZeJMaN/LBCAlerte_ynh.git
synced 2025-07-17 09:00:50 +02:00
Initial commit
Functional, without SSO
This commit is contained in:
14
sources/app/mail/views/form-delete.phtml
Normal file
14
sources/app/mail/views/form-delete.phtml
Normal file
@ -0,0 +1,14 @@
|
||||
<form action="" method="post">
|
||||
<fieldset>
|
||||
<legend>Supprimer cette alerte ?</legend>
|
||||
<ul>
|
||||
<li>Titre : <?php echo htmlspecialchars($alert->title); ?></li>
|
||||
<li>Url : <?php echo htmlspecialchars($alert->url); ?></li>
|
||||
</ul>
|
||||
<p>
|
||||
<input type="hidden" name="id" value="<?php echo $_GET["id"]; ?>" />
|
||||
<input type="submit" value="Oui" style="font-weight: bold;" />
|
||||
| <a href="?mod=mail">Non</a>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
211
sources/app/mail/views/form.phtml
Normal file
211
sources/app/mail/views/form.phtml
Normal file
@ -0,0 +1,211 @@
|
||||
<?php
|
||||
$alertCategories = $alert->getCategories();
|
||||
?>
|
||||
<h2>Création d'une nouvelle alerte</h2>
|
||||
<form action="" method="post">
|
||||
<h2>Options obligatoires</h2>
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="url">URL de recherche</label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="url" name="url" value="<?php
|
||||
echo htmlspecialchars($alert->url);
|
||||
?>" size="75" placeholder="Ex: <?php
|
||||
echo htmlspecialchars("https://www.leboncoin.fr/ventes_immobilieres/offres/champagne_ardenne/?f=a&th=1&pe=7&ret=1");
|
||||
?>" />
|
||||
<?php if (isset($errors["url"])) : ?>
|
||||
<p class="error"><?php echo $errors["url"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt>
|
||||
<label for="title">Indiquez un titre pour l'alerte</label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="title" name="title" value="<?php
|
||||
echo htmlspecialchars($alert->title);
|
||||
?>" size="50" placeholder="Ex: Achat de maison" />
|
||||
<?php if (isset($errors["title"])) : ?>
|
||||
<p class="error"><?php echo $errors["title"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<?php if ($userAuthed->hasSMSFreeMobile() || $userAuthed->hasSMSOvh() || $userAuthed->hasPushbullet()) : ?>
|
||||
<dt>
|
||||
<label>Comment souhaitez-vous recevoir les alertes</label>
|
||||
</dt>
|
||||
<dd class="notification-list">
|
||||
<input type="hidden" name="send_mail" value="0" />
|
||||
<input type="hidden" name="send_sms_free_mobile" value="0" />
|
||||
<input type="hidden" name="send_sms_ovh" value="0" />
|
||||
<input type="hidden" name="send_pushbullet" value="0" />
|
||||
<input type="hidden" name="send_notifymyandroid" value="0" />
|
||||
<input type="hidden" name="send_pushover" value="0" />
|
||||
<label for="alert_mail">
|
||||
<input id="alert_mail" type="checkbox" name="send_mail" value="1"<?php
|
||||
echo $alert->send_mail?' checked="checked"':''
|
||||
?> />
|
||||
par email
|
||||
</label>
|
||||
<?php if ($userAuthed->hasSMSFreeMobile()) : ?>
|
||||
<label for="alert_sms_free">
|
||||
<input id="alert_sms_free" type="checkbox" name="send_sms_free_mobile" value="1"<?php
|
||||
echo $alert->send_sms_free_mobile?' checked="checked"':''
|
||||
?> />
|
||||
par SMS Free Mobile
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
<?php if ($userAuthed->hasSMSOvh()) : ?>
|
||||
<label for="alert_sms_ovh">
|
||||
<input id="alert_sms_ovh" type="checkbox" name="send_sms_ovh" value="1"<?php
|
||||
echo $alert->send_sms_ovh?' checked="checked"':''
|
||||
?> />
|
||||
par SMS OVH
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
<?php if ($userAuthed->hasPushbullet()) : ?>
|
||||
<label for="alert_pushbullet">
|
||||
<input id="alert_pushbullet" type="checkbox" name="send_pushbullet" value="1"<?php
|
||||
echo $alert->send_pushbullet?' checked="checked"':''
|
||||
?> />
|
||||
par Pushbullet
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
<?php if ($userAuthed->hasNotifyMyAndroid()) : ?>
|
||||
<label for="alert_notifymyandroid">
|
||||
<input id="alert_notifymyandroid" type="checkbox" name="send_notifymyandroid" value="1"<?php
|
||||
echo $alert->send_notifymyandroid?' checked="checked"':''
|
||||
?> />
|
||||
par NotityMyAndroid
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
<?php if ($userAuthed->hasPushover()) : ?>
|
||||
<label for="alert_pushover">
|
||||
<input id="alert_pushover" type="checkbox" name="send_pushover" value="1"<?php
|
||||
echo $alert->send_pushover?' checked="checked"':''
|
||||
?> />
|
||||
par Pushover
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($errors["send_type"])) : ?>
|
||||
<p class="error"><?php echo $errors["send_type"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<?php else: ?>
|
||||
<dt><input type="hidden" name="send_mail" value="1" /></dt>
|
||||
<?php endif; ?>
|
||||
<dt>
|
||||
<label for="email">Entrez une adresse email valide</label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="email" name="email" value="<?php
|
||||
echo htmlspecialchars($alert->email);
|
||||
?>" placeholder="Ex: toto@exemple.fr" />
|
||||
<p class="form-more">Vous pouvez indiquer plusieurs adresses en les séparant par une virgule.</p>
|
||||
<?php if (isset($errors["email"])) : ?>
|
||||
<p class="error"><?php echo $errors["email"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<?php $isOpen = !$alert->group_ads || $alert->interval != 30 || $alert->group; ?>
|
||||
<h2 id="moreoptions" class="formbox">Plus d'options <span>(cliquez pour <?php echo $isOpen ? "fermer" : "ouvrir"; ?>)</span></h2>
|
||||
<dl id="moreoptions-content" style="display: <?php echo $isOpen ? "block" : "none"; ?>;">
|
||||
<dt style="margin-bottom: 10px;">
|
||||
<input type="hidden" name="group_ads" value="0" />
|
||||
<label for="group_ads">
|
||||
<input type="checkbox" id="group_ads" name="group_ads" value="1"<?php
|
||||
echo $alert->group_ads?' checked="checked"':''
|
||||
?> style="margin-left: 0;" />
|
||||
Cochez la case pour grouper les annonces dans un unique mail.
|
||||
</label>
|
||||
</dt>
|
||||
<dt>
|
||||
<label for="interval">Nombre de minutes avant la prochaine
|
||||
vérification de nouvelles annonces</label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input type="text" id="interval" name="interval" value="<?php
|
||||
echo $alert->interval;
|
||||
?>" size="10" />
|
||||
<?php if (isset($errors["interval"])) : ?>
|
||||
<p class="error"><?php echo $errors["interval"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt><label for="group">Nom du groupe</label></dt>
|
||||
<dd>
|
||||
<input type="text" id="group" name="group" value="<?php echo htmlspecialchars($alert->group); ?>" />
|
||||
<p class="form-more">Les alertes seront affichées par groupe sur la page de vos alertes.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<?php $isOpen = $alert->price_min != -1 || $alert->price_max != -1
|
||||
|| $alert->price_strict || !empty($alert->cities) || $alertCategories; ?>
|
||||
<h2 id="morefilters" class="formbox">Filtres supplémentaires <span>(cliquez pour <?php echo $isOpen ? "fermer" : "ouvrir"; ?>)</span></h2>
|
||||
<dl id="morefilters-content" style="display: <?php echo $isOpen ? "block" : "none"; ?>;">
|
||||
<dt>
|
||||
<label>Filtre sur le prix</label>
|
||||
<dt>
|
||||
<dd>
|
||||
<label for="price_min">
|
||||
Prix min :
|
||||
<input type="text" id="price_min" name="price_min" value="<?php
|
||||
echo $alert->price_min != -1?(int)$alert->price_min:"";
|
||||
?>" size="6" />
|
||||
</label>
|
||||
<label for="price_max">
|
||||
Prix max :
|
||||
<input type="text" id="price_max" name="price_max" value="<?php
|
||||
echo $alert->price_max != -1?(int)$alert->price_max:"";
|
||||
?>" size="6" />
|
||||
</label>
|
||||
<?php if (isset($errors["price"])) : ?>
|
||||
<p class="error"><?php echo $errors["price"]; ?></p>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt style="margin-bottom: 10px;">
|
||||
<input type="hidden" name="price_strict" value="0" />
|
||||
<label for="price_strict">
|
||||
<input type="checkbox" id="price_strict" name="price_strict" value="1"<?php
|
||||
echo $alert->price_strict?' checked="checked"':''
|
||||
?> style="margin-left: 0;" />
|
||||
cochez cette case pour exclure les annonces sans prix d'indiqué de votre recherche.
|
||||
</label>
|
||||
</dt>
|
||||
<dt><label for="cities">Filtre sur les villes ou départements (un par ligne)</label></dt>
|
||||
<dd>
|
||||
<textarea id="cities" name="cities" cols="30" rows="10"><?php
|
||||
echo htmlspecialchars($alert->cities) ?></textarea>
|
||||
</dd>
|
||||
<dt><label>Filtre multi-catégorie</label></dt>
|
||||
<dd class="categories">
|
||||
<p class="warning"><span>Attention : </span>
|
||||
ce filtre ne doit être utilisé que pour les recherches sur "toutes les catégories".</p>
|
||||
<?php $i = 1; ?>
|
||||
<?php foreach ($categoryCollection->fetchAll() AS $group => $categories) : ?>
|
||||
<div class="categories-list categories-list-<?php echo $i++; ?>">
|
||||
<h3><?php echo htmlspecialchars($group); ?></h3>
|
||||
<?php foreach ($categories AS $id => $category) : ?>
|
||||
<label for="category-<?php echo $id; ?>"><input id="category-<?php
|
||||
echo $id; ?>" type="checkbox" name="categories[]" value="<?php
|
||||
echo htmlspecialchars($category); ?>"<?php
|
||||
echo in_array($category, $alertCategories)?' checked="checked"':'';
|
||||
?> /><?php
|
||||
echo htmlspecialchars($category); ?></label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</dd>
|
||||
</dl>
|
||||
<p><input type="submit" value="Enregistrer" />
|
||||
| <a href="?mod=mail">annuler</a></p>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
153
sources/app/mail/views/index.phtml
Normal file
153
sources/app/mail/views/index.phtml
Normal file
@ -0,0 +1,153 @@
|
||||
<p>
|
||||
<?php if (0 < $nbAlertes = count($alerts)) : ?>
|
||||
<strong><?php echo $nbAlertes ?> <?php
|
||||
echo $nbAlertes > 1?"alertes enregistrées":"alerte enregistrée"; ?></strong> |
|
||||
<?php endif; ?>
|
||||
<a href="?mod=mail&a=form" class="link-create-alert">Ajouter une alerte</a> |
|
||||
<a href="?mod=mail&a=reset">Tout renvoyer</a>
|
||||
</p>
|
||||
|
||||
<?php if ($groups) : ?>
|
||||
<?php foreach ($groups AS $group) : ?>
|
||||
<?php if (count($groups) > 1 || $group != "Sans groupe") : ?>
|
||||
<h2><?php echo $group != "Sans groupe"?"Groupe : ":""; ?><?php echo htmlspecialchars($group); ?></h2>
|
||||
<?php endif; ?>
|
||||
<?php $alerts = $alertsByGroup[$group]; ?>
|
||||
<table style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 20px"></th>
|
||||
<th style="width: 250px"><?php if ($sort == "email") :
|
||||
?><img src="static/images/sort-<?php echo $order; ?>.png" alt="" /> <?php
|
||||
endif; ?><a href="?mod=mail&sort=email">Envoyer à</a></th>
|
||||
<th><?php if ($sort == "title") :
|
||||
?><img src="static/images/sort-<?php echo $order; ?>.png" alt="" /> <?php
|
||||
endif; ?><a href="?mod=mail&sort=title">Titre</a></th>
|
||||
<th style="width: 100px">Intervalle</th>
|
||||
<?php if ($showPrice) : ?>
|
||||
<th style="width: 100px">Prix</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($showCities) : ?>
|
||||
<th style="width: 200px">Villes</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["freeMobile"]
|
||||
|| $notification["ovh"]
|
||||
|| $notification["pushbullet"]
|
||||
|| $notification["notifymyandroid"]
|
||||
|| $notification["pushover"]
|
||||
) : ?>
|
||||
<th style="width: 140px">Envoyer par email</th>
|
||||
<?php if ($notification["freeMobile"]) : ?>
|
||||
<th style="width: 140px">SMS Free Mobile</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["ovh"]) : ?>
|
||||
<th style="width: 140px">SMS OVH</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["pushbullet"]) : ?>
|
||||
<th style="width: 140px">Pushbullet</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["notifymyandroid"]) : ?>
|
||||
<th style="width: 140px">NotityMyAndroid</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["pushover"]) : ?>
|
||||
<th style="width: 140px">Pushover</th>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<th style="width: 70px">Actif</th>
|
||||
<th style="width: 170px"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $i = 1; foreach ($alerts AS $alert) : ?>
|
||||
<tr>
|
||||
<td><?php echo $i++; ?></td>
|
||||
<td><?php echo str_replace(",", "<br />", htmlspecialchars($alert->email)); ?></td>
|
||||
<td class="title"><a href="<?php echo htmlspecialchars($alert->url); ?>" target="_blank"><?php
|
||||
echo $alert->title?htmlspecialchars($alert->title):"-"; ?></a></td>
|
||||
<td class="intervalle"><?php echo (int)$alert->interval; ?> mins</td>
|
||||
<?php if ($showPrice) : ?>
|
||||
<td>
|
||||
<?php if ($alert->price_min != -1 && $alert->price_max != -1) : ?>
|
||||
entre <?php echo $alert->price_min; ?>€ et <?php echo $alert->price_max; ?>€
|
||||
<?php elseif ($alert->price_min != -1) : ?>
|
||||
à partir de <?php echo $alert->price_min; ?>€
|
||||
<?php elseif ($alert->price_max != -1) : ?>
|
||||
jusque <?php echo $alert->price_max; ?>€
|
||||
<?php else: ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($showCities) : ?>
|
||||
<td>
|
||||
<?php if ($alert->cities) : ?>
|
||||
<ul style="margin: 0; padding: 0 0 0 15px;"><li>
|
||||
<?php echo str_replace("\n", "</li><li>", htmlspecialchars($alert->cities)); ?>
|
||||
</li></ul>
|
||||
<?php else: ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["freeMobile"]
|
||||
|| $notification["ovh"]
|
||||
|| $notification["pushbullet"]
|
||||
|| $notification["notifymyandroid"]
|
||||
|| $notification["pushover"]
|
||||
) : ?>
|
||||
<td>
|
||||
<a href="?mod=mail&a=toggle_status&s=send_mail&id=<?php echo $alert->id;
|
||||
?>"><img src="static/images/<?php
|
||||
echo !$alert->send_mail?"disable":"enable"; ?>.png" alt="" /></a>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["freeMobile"]) : ?>
|
||||
<td>
|
||||
<a href="?mod=mail&a=toggle_status&s=send_sms_free_mobile&id=<?php echo $alert->id;
|
||||
?>"><img src="static/images/<?php
|
||||
echo !$alert->send_sms_free_mobile?"disable":"enable"; ?>.png" alt="" /></a>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["ovh"]) : ?>
|
||||
<td>
|
||||
<a href="?mod=mail&a=toggle_status&s=send_sms_ovh&id=<?php echo $alert->id;
|
||||
?>"><img src="static/images/<?php
|
||||
echo !$alert->send_sms_ovh?"disable":"enable"; ?>.png" alt="" /></a>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["pushbullet"]) : ?>
|
||||
<td>
|
||||
<a href="?mod=mail&a=toggle_status&s=send_pushbullet&id=<?php echo $alert->id;
|
||||
?>"><img src="static/images/<?php
|
||||
echo !$alert->send_pushbullet?"disable":"enable"; ?>.png" alt="" /></a>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["notifymyandroid"]) : ?>
|
||||
<td>
|
||||
<a href="?mod=mail&a=toggle_status&s=send_notifymyandroid&id=<?php echo $alert->id;
|
||||
?>"><img src="static/images/<?php
|
||||
echo !$alert->send_notifymyandroid?"disable":"enable"; ?>.png" alt="" /></a>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($notification["pushover"]) : ?>
|
||||
<td>
|
||||
<a href="?mod=mail&a=toggle_status&s=send_pushover&id=<?php echo $alert->id;
|
||||
?>"><img src="static/images/<?php
|
||||
echo !$alert->send_pushover?"disable":"enable"; ?>.png" alt="" /></a>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td>
|
||||
<a href="?mod=mail&a=toggle_status&s=suspend&id=<?php echo $alert->id;
|
||||
?>"><img src="static/images/<?php
|
||||
echo $alert->suspend?"disable":"enable"; ?>.png" alt="" /></a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="?mod=mail&a=form&id=<?php echo $alert->id; ?>">modifier</a> |
|
||||
<a href="?mod=mail&a=form-delete&id=<?php echo $alert->id; ?>">supprimer</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
46
sources/app/mail/views/mail-ad.phtml
Normal file
46
sources/app/mail/views/mail-ad.phtml
Normal file
@ -0,0 +1,46 @@
|
||||
<?php ob_start(); ?>
|
||||
<div>
|
||||
<?php if ($ad->getDate()) : ?>
|
||||
<strong>Publié le <?php echo date("d/m/Y à H:i", $ad->getDate()); ?></strong>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
|
||||
<strong>Nom</strong> :
|
||||
<a href="<?php echo $ad->getLink(); ?>"><?php echo $ad->getTitle(); ?></a>
|
||||
<?php if ($link_mobile = $ad->getLinkMobile()) : ?>
|
||||
(<a href="<?php echo $link_mobile; ?>">Version Mobile</a>)
|
||||
<?php endif; ?>
|
||||
<?php if ($ad->getPrice()) : ?>
|
||||
<strong>Prix</strong> : <?php echo number_format($ad->getPrice(), 0, ',', ' '); ?> <?php echo $ad->getCurrency(); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($ad->getCategory()) : ?>
|
||||
<br />
|
||||
<strong>Catégorie</strong> : <?php echo $ad->getCategory(); ?>
|
||||
<?php endif; ?>
|
||||
<br />
|
||||
<?php if ($ad->getCountry()) : ?>
|
||||
<strong>Département</strong> : <?php echo $ad->getCountry(); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php if ($ad->getCity()) : ?>
|
||||
<strong>Ville</strong> : <a href="https://maps.google.fr/?z=9&q=<?php
|
||||
echo htmlspecialchars($ad->getCountry().' '.$ad->getCity());
|
||||
?>" title="Localiser sur Google Map"><?php echo $ad->getCity(); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if ($siteConfig->getOption("pro_visible")) : ?>
|
||||
<br />Annonce de <?php echo $ad->getProfessional()?'professionnel':'particulier.'; ?>
|
||||
<?php endif; ?>
|
||||
<br />
|
||||
<?php if ($ad->getUrgent()) : ?>
|
||||
<strong style="color: #FF8900;">urgent</strong>
|
||||
<?php endif; ?>
|
||||
<?php if ($ad->getThumbnailLink()) : ?>
|
||||
<br /><img src="<?php echo str_replace('/thumbs/', '/images/', $ad->getThumbnailLink()); ?>" alt=""
|
||||
style="max-width: 100%; overflow:hidden;" />
|
||||
<?php else : ?>
|
||||
<br />Pas de photo disponible.
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php
|
||||
return ob_get_clean();
|
13
sources/app/mail/views/reset.phtml
Normal file
13
sources/app/mail/views/reset.phtml
Normal file
@ -0,0 +1,13 @@
|
||||
<form action="" method="post">
|
||||
<fieldset>
|
||||
<legend>Renvoyer toutes les alertes ?</legend>
|
||||
<p>
|
||||
En confirmant, vous recevrez toutes les annonces pour chaque alerte
|
||||
lors du prochain contrôle de nouvelle annonce.
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Confirmer" style="font-weight: bold;" />
|
||||
| <a href="?mod=mail">Annuler</a>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
Reference in New Issue
Block a user