<?php

//###### zugehörige Daten anhand des Page-Namens ermitteln
$currentPageNamespacePathArray = explode(':', $_GET["id"]);
array_pop($currentPageNamespacePathArray);
$currentPageFilePath = phpConvertNamespaceToFilesystemPath(implode(':', $currentPageNamespacePathArray) . ':gliederung');
$currentPageId = end(explode( ':', htmlspecialchars($_GET["id"]) ));

###### CSS-Datei inkludieren ##################################################################################

include($includeCss);
$bookStructure = recursiveScanBookStructure($currentPageFilePath);

//###### HTML-Tag öffnen
//##################################################################################
echo '<html>';

echo '

  <div class="parentbox"><!-- ###### parentbox umspannender Inhalts-Container (öffnen) -->
    <div class="sectionbox-row"><!-- ###### Sectionbox für Spalten im umspannenden Inhalts-Container (öffnen) -->
      <div class="contentbox-left"><!-- ###### Linke Spalte (öffnen) -->
        <div class="titlebox"><!-- ###### titlebox (Produktname) (öffnen)-->
          <div class="titlebox-top"></html>' . $bookStructure[$bookStructureArrayCounter]['title'] . '<html></div>
          <div class="titlebox-bottom">' . ( (strpos($blogPageData[$givenBlogArrayId]['blogPageTitle'],'||')) ? end(explode('||',$blogPageData[$givenBlogArrayId]['blogPageTitle'])) : '' ) . '</div>
        </div><!-- ###### titlebox (Produktname) (schließen)-->
        <div class="sectionbox-column"><!-- ###### sectionbox (Produktbild) (öffnen) -->
          <div class="coverbox-image-product-center"></html>{{' . $imageProduct . '?nolink}}<html></div>
        </div><!-- ###### sectionbox (Produktbild) (schließen) -->
        <div class="sectionbox-row"><!-- ###### sectionbox (Eyecatcher) (schließen) -->
          <div class="contentbox">' . $blogPageData[$givenBlogArrayId]['blogPageEyeCatcher'] . '</div>
        </div><!-- ###### sectionbox (Eyecatcher) (schließen) -->
        <div class="sectionbox-row"><!-- ###### sectionbox (Vorwort) (öffnen)-->
          <div class="contentbox">Vorwort
            <div class="contentbox-information"></html>' . $blogPageData[$givenBlogArrayId]['blogPagePreamble'] . '<html></div>
          </div>
        </div>
      </div>
    </div>
  </div>      

';

echo'

<!– ###### parentbox umspannender Inhalts-Container (öffnen) –>';

$bookCounter = 0;
$bookStructureArrayCounter=0;
while ($bookStructureArrayCounter < sizeof($bookStructure)) {
  if ($bookStructure[$bookStructureArrayCounter]['type'] == '0') {
    $bookCounter ++;
    echo'
    <div class="sectionbox-row">
      <div class="contentbox-left"><!-- ###### Linke Spalte (öffnen) -->
    <div class="tocBox">
      <div class="tocBoxFirstColumn">
        <div class="tocBoxBookNumber">' . $bookCounter . '</div>
      </div>
      <div class="tocBoxSecondColumn"></div>
      <div class="tocBoxThirdColumn"></div>
      <div class="tocBoxFourthColumn">
        <details' . (($bookStructureArrayCounter==0) ? ' open' : '') . '>
          <summary class="tocBoxHiddenBlock">
            <div class="tocBoxHiddenBlockTitle">' . $bookStructure[$bookStructureArrayCounter]['title'] . '</div>
          </summary>
          <div class="legendRow">
            <div class="legendColumnIcon">&#215;</div>
            <div class="legendColumnText" style="background: mistyrose;">Leer</div>
            <div class="legendColumnIcon">&#9998;</div>
            <div class="legendColumnText" style="background: sandybrown;">Entwurf</div>
            <div class="legendColumnIcon">&#9997;</div>
            <div class="legendColumnText" style="background: khaki;">Korrektur</div>
            <div class="legendColumnIcon">&#10004;</div>
            <div class="legendColumnText" style="background: ghostwhite;">Fertig</div>
          </div>
          <div class="tocBoxHiddenBlockChapterStructure">
            <div class="tocBoxHiddenBlockRowHeadline">
              <div class="tocBoxBookStructureFirstColumnChapter">Akt</div>
              <div class="tocBoxBookStructureSecondColumnChapter">Kapitel</div>
              <div class="tocBoxBookStructureThirdColumnChapter">Titel</div>
            </div>';
    $bookStructureArrayCounter++;
    while ( ($bookStructure[$bookStructureArrayCounter]['type'] == '1') || ($bookStructure[$bookStructureArrayCounter]['type'] == '2') ) {
      //###### Tabelle fuer Buchueberschrift
      echo '
            <div class="tocBoxHiddenBlockRow"">
              <div class="' . (($bookStructure[$bookStructureArrayCounter]['type'] == '1') ? 'tocBoxBookStructureFirstColumnAct' : 'tocBoxBookStructureFirstColumnChapter') . '">' . (($bookStructure[$bookStructureArrayCounter]['type'] == '1') ? $bookStructure[$bookStructureArrayCounter]['structureName'] : '&nbsp;') . '</div>
              <div class="' . (($bookStructure[$bookStructureArrayCounter]['type'] == '1') ? 'tocBoxBookStructureSecondColumnAct' : 'tocBoxBookStructureSecondColumnChapter') . '">' . (($bookStructure[$bookStructureArrayCounter]['type'] == '2') ? $bookStructure[$bookStructureArrayCounter]['structureName'] : '&nbsp;') . '</div>
              <div class="' . (($bookStructure[$bookStructureArrayCounter]['type'] == '1') ? 'tocBoxBookStructureThirdColumnAct' : 'tocBoxBookStructureThirdColumnChapter') . '"></html>[[' . $bookStructure[$bookStructureArrayCounter]['wikiPath'] . '|' . $bookStructure[$bookStructureArrayCounter]['title'] . ']]<html></div>
            </div>';
      $bookStructureArrayCounter++;
    }
    echo '      
          </div>
        </details>
      </div>
      <div class="tocBoxFifthColumn" style="width: 0.5vw; background-color: white; border-width: 0px 0px 1px 0px; border-color: darkgrey; border-style: solid;"></div>
    </div>
    </div>
    </div>';
  }
}

echo'

<!– ###### parentbox umspannender Inhalts-Container (schließen) –>';

//###### HTML-Tag schließen
//##################################################################################
echo '</html>';

?>