<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
include_once ($_SERVER['DOCUMENT_ROOT'] . '/_config/functions.php');
spl_autoload_register('my_autoload');


$avv                                = new avv();
$site                               = $_SERVER["HTTP_REFERER"];
$sitePrevious                       = $_SERVER["HTTP_REFERER"];

if($_SERVER["REQUEST_METHOD"]       == "POST") {
  $avv->saveUpdateAvvText($_POST);
  echo '<meta http-equiv="refresh" content="0; URL=' . $_POST['site'] . '">';
} else {
  $belongToUser                     = 1;
  include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/chk.auth.php');
  
  $row                              = $avv->showAvvByAvvId($_GET['avv_id']);
  $rowsDropdownLegalBasis           = $avv->dropdownAvvLegalBasis();
  $rowsDropdownContract             = $avv->dropdownAvvContract();
  include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/report/avv/edit.php');
}

