File "admin-events-edit.inc.php"
Full Path: /srv/www/www.cadoro.it/src/controllers/admin-events-edit.inc.php
File size: 987 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
$event = models\Event::get_by_id($event_id);
if (!$event) {
not_found();
}
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$params = array(
'lang' => _post('lang'),
'slug' => _post('slug'),
'title' => _post('title'),
'image' => _image('image', 'events'),
'description' => _post('description'),
'stores' => _post('stores'),
);
if (!$params['lang']) {
$errors['lang'] = 1;
}
if (!$params['slug']) {
$errors['slug'] = 1;
}
if (!$params['title']) {
$errors['title'] = 1;
}
if (!$errors) {
$event->update($params);
header("Location: " . BASE_URL . "/admin/events");
exit;
}
}
$smarty->assign("event", $event);
$smarty->assign("errors", $errors);
$smarty->assign("stores", models\Store::get_vocabulary());
$smarty->assign("menu", "content");
$smarty->assign("submenu", "events");
$smarty->display("admin-events-edit.tmpl");
?>