74 lines
3.3 KiB
PHP
74 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
use Illuminate\Routing\Controller as BaseController;
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
use Illuminate\Support\Facades\Session;
|
|
use \Model\NewsItem;
|
|
|
|
class SpecialController extends Controller
|
|
{
|
|
public function luisterlijst_stem(Request $request)
|
|
{
|
|
$data = [];
|
|
if($request->isMethod('post')) {
|
|
$data['message'] = "Je lijst is bewaard, maar nog niet ingediend. Zolang je cookies bewaard blijven, kan je terugkomen op deze pagina om de lijst verder in te vullen.";
|
|
setcookie('luisterlijst', json_encode($_POST));
|
|
if(isset($_POST['insturen'])) {
|
|
$data['message'] = "<b>Je keuze is doorgegeven. Dank je wel voor het stemmen!</b><br/>Luister op 21 december naar de Vroeger of Later Luisterlijst om te kijken of en waar je lievelingsnummers erin staan. ";
|
|
$data['submitted'] = true;
|
|
|
|
$msgbody = "<p>Iemand heeft gestemd op de Vroeger of Later Luisterlijst!</p>\n" .
|
|
"<p>Naam: " . strip_tags($_POST['voornaam']) . "</p>\n" .
|
|
"<p>Woonplaats: " . strip_tags($_POST['woonplaats']) . "</p>\n" .
|
|
"<p>E-mail: " . strip_tags($_POST['mailadres']) . "</p>\n" .
|
|
"<p>Telefoonnummer: " . strip_tags($_POST['telefoonnummer']) . "</p>\n" .
|
|
"<p>Gestemd vanaf IP: " . $_SERVER['REMOTE_ADDR'] . "</p>\n";
|
|
if(isset($_POST['checkbox'])) foreach($_POST['checkbox'] as $key => $val)
|
|
{
|
|
$msgbody .= "<p>" . strip_tags($key) . ": " . strip_tags($val) . "</p>";
|
|
}
|
|
$msgbody .= "<hr/>\n<p>Hier is de keuze van " . strip_tags($_POST['voornaam']) . ":</p>\n<table>\n<thead>\n<tr>\n<th>Type</th><th>Positie</th><th>Titel</th><th>Artiest</th></tr>\n</thead>\n<tbody>";
|
|
foreach($_POST['keuzes'] as $type => $keuzes)
|
|
foreach($keuzes as $ix => $velden)
|
|
{
|
|
$msgbody .= "<tr><td>$type</td><td>$ix</td>";
|
|
foreach($velden as $veld) $msgbody .= "<td>" . strip_tags($veld) . "</td>";
|
|
$msgbody .= "</tr>";
|
|
}
|
|
$msgbody .= "</tbody>\n</table>";
|
|
|
|
$headers = "From: \"" . strip_tags($_POST['voornaam']) . "\" <" . strip_tags($_POST['mailadres'] ? $_POST['mailadres'] : 'website-noreply@nhgooi.nl') . ">\r\n";
|
|
$headers .= "MIME-Version: 1.0\r\n";
|
|
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
|
|
mail('vroegeroflater@nhgooi.nl', 'Er is gestemd op de luisterlijst', $msgbody, $headers);
|
|
} else {
|
|
if(isset($_COOKIE['luisterlijst'])) {
|
|
foreach(json_decode($_COOKIE['luisterlijst'], true) as $k => $v) {
|
|
$_POST[$k] = $v;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return view('luisterlijst', $data);
|
|
}
|
|
|
|
public function bart(Request $request)
|
|
{
|
|
$page = (int)$request->get('pagina', 1);
|
|
$apiResult = $this->API('blog/overzicht/2019-07-01/2019-07-10?pagina=' . (int)max(1, $page));
|
|
$blog = [];
|
|
foreach($apiResult->items as $blogItem)
|
|
{
|
|
$blog[] = new \Model\NewsItem($blogItem);
|
|
}
|
|
|
|
return view($request->ajax() ? 'bloglistitems' : 'bloglist', ['title' => 'De Nacht van Bart - 6 juli 2019', 'items' => $blog]);
|
|
}
|
|
}
|