/**
  * Datenbank pruefen
  *
  * *Description* Pruefe bei Systemstart ob alle notwendigen Tabellen und Spalten angelegt sind 
  * 
  * @param string
  *
  * @return array
  */
 public function checkDB($setting = 'complete')
 {
     $missing = array('error' => FALSE, 'message' => NULL);
     $tableCols = parent::dbStrukture('cols');
     // Prüfe ob Tabellen existieren
     $stmt = $this->db->query("SHOW TABLES");
     $tables = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     if (!empty($tables)) {
         foreach (parent::dbStrukture('tables') as $table) {
             if (in_array_r(TBL_PRFX . $table, $tables)) {
                 // Prüfe ob alle Spalten existieren bei complete
                 if ($setting != 'short') {
                     $stmt = $this->db->query("SHOW COLUMNS FROM " . TBL_PRFX . $table);
                     $columns = $stmt->fetchAll(\PDO::FETCH_COLUMN);
                     if (!empty($columns)) {
                         foreach ($tableCols[$table] as $column) {
                             if (!in_array_r($column, $columns)) {
                                 $missing['message'][] = 'missing column ' . $column . ' in table ' . $table;
                             }
                         }
                     } else {
                         $missing['message'][] = 'missing all cols in table ' . $table;
                     }
                 }
             } else {
                 $missing['message'][] = 'missing table ' . $table;
             }
         }
     } else {
         $missing['message'][] = 'missing all tables';
     }
     if (!empty($missing['message'])) {
         $missing['error'] = TRUE;
     }
     return $missing;
 }
 /**
  * Konstruktor 
  *
  * *Description* 
  * 
  * @param
  *
  * @return 
  */
 public function __construct()
 {
     $this->db = parent::connect();
 }
 /**
  * Seiteninhalte aus XML laden
  *
  * *Description* Lädt die Daten aus einer XML Datei und wandelt diese in einen Execute-Array um.
  * 
  * @param 
  *
  * @return array
  */
 private function loadInsertDatabase()
 {
     $error = FALSE;
     $values = array();
     if (file_exists(SYSTEM_FILES . 'system-pages.xml')) {
         $objectXML = simplexml_load_file(SYSTEM_FILES . 'system-pages.xml', 'SimpleXMLElement', LIBXML_NOCDATA);
         if ($objectXML !== FALSE) {
             /** Importing Content Into Array */
             $arrXML = objectToArray($objectXML);
             foreach (parent::dbStrukture('tables') as $table) {
                 $i = 0;
                 if (!empty($arrXML[$table]['insert'])) {
                     foreach ($arrXML[$table]['insert'] as $key => $value) {
                         if (is_array($value)) {
                             foreach ($value as $row => $content) {
                                 $values[$table][$i][':' . $row] = !empty($content) ? $this->compileData(trim($content)) : '';
                             }
                         } else {
                             $values[$table][0][':' . $key] = !empty($value) ? $this->compileData(trim($value)) : '';
                         }
                         $i++;
                     }
                 } else {
                     $error = TRUE;
                 }
             }
         }
     }
     if (!$error) {
         return $values;
     } else {
         exit('XML Data is missing');
     }
 }