File "admin-qrcode-edit.inc.php"

Full Path: /srv/www/www.cadoro.it/src/controllers/admin-qrcode-edit.inc.php
File size: 782 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
  $qrcode = models\Qrcode::get_by_id($id);
  if (!$qrcode) {
    not_found();
  }

  $error = null;

  if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $params = array(
      'title' => _post('title'),
      'landing' => _post('landing'),
      'published' => _post('published'),
      'date_begin' => _post_date('date_begin'),
      'date_end' => _post_date('date_end'),
    );
    if (!$params['title'] || !$params['landing']) {
      $error = 1;
    } else {
      $qrcode->update($params);
      header("Location: " . BASE_URL . "/admin/qrcode");
      exit;
    }
  }

  $smarty->assign("error", $error);
  $smarty->assign("qrcode", $qrcode);

  $smarty->assign("menu", "content");
  $smarty->assign("submenu", "qrcode");

  $smarty->display("admin-qrcode-edit.tmpl");
?>