<?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');
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/chk.auth.php');

$db                           = new Database();
$sql                          = 'SELECT * FROM vvt_themenblock ORDER BY id ASC';
$db->query($sql);
$rows                         = $db->resultset();

foreach ($rows as $row) {
  $sql                        = 'UPDATE vvt_kunden SET themenblock_id = :themenblock_id WHERE name LIKE :name';
  $db->query($sql);
  $db->bind(':themenblock_id', 7);
  $db->bind(':name', 'Verwaltung:%');
  $db->execute();
}

/*
foreach ($rows as $row) {
  $updateArray                    = array(
      'name'                      => makeHtmlEntities($row['name']),
      'zweck'                     => makeHtmlEntities($row['zweck']),
      'beschr_warum_erlaubt'      => makeHtmlEntities($row['beschr_warum_erlaubt']),
      'betr_personen'             => makeHtmlEntities($row['betr_personen']),
      'betr_daten_der_pers'       => makeHtmlEntities($row['betr_daten_der_pers']),
      'weitergabe'                => makeHtmlEntities($row['weitergabe']),
      'uebermittlung_laender'     => makeHtmlEntities($row['uebermittlung_laender']),
      'aufbewahrungsfrist'        => makeHtmlEntities($row['aufbewahrungsfrist']),
      'tom'                       => makeHtmlEntities($row['tom']),
      'risiko_quellen_schaden'    => makeHtmlEntities($row['risiko_quellen_schaden']),
      'verantwortliche_fachabteilung' => makeHtmlEntities($row['verantwortliche_fachabteilung']),
      'risiko_ergebnis'           => makeHtmlEntities($row['risiko_ergebnis']),
    );
    $whereCause                             = 'id = :id';
    $whereVal                               = $row['id'];
    pdoDbUpdate("vvt_kunden", $updateArray, $whereCause, $whereVal);
}

/*
foreach ($rows as $row) {
  $updateArray                      = array(
        'frage'                       => makeHtmlEntities($row['frage']),
        'empfehlung'                  => makeHtmlEntities($row['empfehlung']),
        'bemerkung_begruendung'       => makeHtmlEntities($row['bemerkung_begruendung']),
    );
    $whereCause                             = 'id = :id';
    $whereVal                               = $row['id'];
    pdoDbUpdate("tom_kunden", $updateArray, $whereCause, $whereVal);
}
 * 
 */