File "admin-stores-edit.inc.php"
Full Path: /srv/www/www.cadoro.it/src/controllers/admin-stores-edit.inc.php
File size: 1.61 KB
MIME-type: text/x-php
Charset: utf-8
<?php
$store = models\Store::get_by_id($store_id);
if (!$store) {
not_found();
}
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$params = array(
'slug' => _post('slug'),
'title' => _post('title'),
'type' => _post('type'),
'address' => _post('address'),
'zipcode' => _post('zipcode'),
'city' => _post('city'),
'province' => _post('province'),
'lat' => _post('lat'),
'lng' => _post('lng'),
'phone' => _post('phone'),
'email' => _post('email'),
'services' => _post('services'),
'openings_1' => _post('openings_1'),
'openings_2' => _post('openings_2'),
'openings_3' => _post('openings_3'),
'openings_4' => _post('openings_4'),
'openings_5' => _post('openings_5'),
'openings_6' => _post('openings_6'),
'openings_7' => _post('openings_7'),
'image_1' => _image('image_1', 'stores'),
'image_2' => _image('image_2', 'stores'),
'image_3' => _image('image_3', 'stores'),
'image_4' => _image('image_4', 'stores'),
'image_5' => _image('image_5', 'stores'),
);
if (!$params['slug']) {
$errors['slug'] = 1;
}
if (!$params['title']) {
$errors['title'] = 1;
}
if (!$params['type']) {
$errors['type'] = 1;
}
if (!$errors) {
$store->update($params);
header("Location: " . BASE_URL . "/admin/stores");
exit;
}
}
$smarty->assign("store", $store);
$smarty->assign("errors", $errors);
$smarty->assign("menu", "content");
$smarty->assign("submenu", "stores");
$smarty->display("admin-stores-edit.tmpl");
?>