<?php
# Startseite GHBS 0.1 14.02.2013



if(!isset($_REQUEST['nsect'])) {
	$_REQUEST['nsect'] = '';
}
else {
	if(!preg_match('/^[a-z]{3}$/', $_REQUEST['nsect'])) {
		die("Parameter nsect ist ungültig!\n");
	}

	$nsect = $_REQUEST['nsect'];
	$nsect = substr($nsect, 0,3);
}
 
if(!isset($_REQUEST['hnota'])) {
    $_REQUEST['hnota'] = '';
}
else {
    if(!preg_match('/^[a-z,A-Z]{3,4}\-[a-z,A-Z]{3,4}$/', $_REQUEST['hnota'])) {
        die("Parameter hnota  ist ungültig!\n");
    }

}


if(!isset($hnota)) {
	$hnota = $_REQUEST['hnota'];
	$hnota = substr($hnota, 0,9);
}

if(isset($_REQUEST['target'])) {
    if(!preg_match('/^[a-z,A-Z]{3,4}/', $_REQUEST['target'])) {
        die("Parameter target ist ungültig!\n");
    }


	$vtarget = $_REQUEST['target'];
	$vtarget = substr($vtarget, 0,9);
}
else {
	$vtarget ='';
}

# MyHTML-Klasse laden
include('./myHtml.inc.php');

# footer Class inculden
include('./footer.inc.php');

#Datenbankzugriff
$user ='ghbsadm';
$pw = '467-ghbs';

$dbh = new PDO('mysql:unix_socket=/var/run/mysql/mysql.sock;dbname=ghbs', $user, $pw);

# Katalogzugriff
#$katurl = '\'http://obelix.ub.uni-siegen.de/F?func=find-b&request=';
#$katparams = '&find_code=PLN&local_base=sie01\' target=\'aleph\'';
#OpenURL soll nicht mehr genutzt werden ##  $katurl = '\'https://www.digibib.net/opensearch?LOCATION=467&S.SEARCH_UBSI-x=on&QUERY_CN=';
$katurl = '\'https://ub-siegen.digibib.net/search/katalog/list?start=1&be-katalog-sort=date_desc&q-cn=';


$katparams = '\' target=\'KatalogPlus\'';
#$katparams = '\'';

# Authentifizierung
require('./auth.inc.php');
$flogin = auth_decode();
if($flogin == 1) {
	#$authlink = '&lf='.rawurlencode($_REQUEST['lf']).'&fachref='.$_REQUEST['fachref'];
	$authlink = create_authlink();
	# Wenn Fachref. grundsätzlich angemeldet, auf Berchtigung checken
	$fsect = array(); 
	$fsect = check_fsect(); 
}
else {
	$authlink = '';
}

## $authlinktop u. authlinktarget bilden
$authlinktop = preg_replace('/^&lf=/','lf=', $authlink);
$authlinktarget = $authlinktop.'&';

## $page anlegen

if(empty($_REQUEST['page'])) {
	$qstring = $_SERVER['QUERY_STRING'];
	$qstring = preg_replace('/&lf=[^&]+/','',$qstring);
	$qstring = preg_replace('/&fachref=\d+/','',$qstring);
	#$qstring = preg_replace('/\?nsect/','&nsect',$qstring);
	$page = $_SERVER['SCRIPT_NAME'].'?'. $qstring;
	$page = urlencode($page);

}
else {
	$page = $_REQUEST['page'];
	$page = preg_replace('/\?nsect/','&nsect',$page);
	$page = urlencode($page);
}

# $vtarget ggfs Ueberordnung finden u. zu $hnota ueberfuehren 
if(!empty($vtarget) ) {
	trim($vtarget);
	$stvt = $dbh->query("SELECT SUBSTR(nsect,1,3) AS nsect FROM nota WHERE nnota='$vtarget' ");
	if (!$stvt) {
		print_r($dbh->errorInfo());
	}	
	$nsectres = $stvt->fetch();

	$nsect = $nsectres['nsect'];

## Naechste hoehere Ueberschrift finden
### Pruefen ob es sich bei $vtarget um Überschrift handelt, dann
### ist $vtarget bereits die gesuchte Überschrift
	if(preg_match('/-/', $vtarget)) {
		$hnota = $vtarget;
	}	

### wenn normale Notation, dann einfache SQL-Abfrage nach passender
### Ueberschrift mit dem höchsten hier-Wert
	else {
		if($nsect != 'sie') {
			$stvt2=$dbh->query("SELECT nnota FROM nota WHERE ntype='h' AND SUBSTR(nnota,1,3) < '$vtarget' AND SUBSTR(nnota,5,3) > '$vtarget' ORDER BY hier DESC LIMIT 1");
		}
		else {
			$stvt2=$dbh->query("SELECT  nnota, nname, hier FROM `nota` WHERE SUBSTR(nnota,1,4) < '$vtarget' AND SUBSTR(nnota,6,4) > '$vtarget' AND ntype= 'h' AND nsect LIKE 'sie%' ORDER BY hier DESC LIMIT 1");
		}
		if (!$stvt2) {
            print_r($dbh->errorInfo());
        }
        $vhnotares = $stvt2->fetch();
        $hnota = $vhnotares['nnota'];

	}

}
# Abfrage Mainheadings f. Schnellnavigation
$sthm = $dbh->query("SELECT nnota, nname, SUBSTR(nsect,1,3) AS nsect FROM nota WHERE nname !='' AND hier=0 AND ntype='h' AND pstatus='y' ORDER BY nnota");
if (!$sthm) {
	print_r($dbh->errorInfo());
}
$headingsm = $sthm->fetchAll(PDO::FETCH_ASSOC);


# Abfrage f. linke GHBS-Navi
$sth0 = $dbh->query("SELECT nnota, nname FROM nota WHERE nname !='' AND hier=1 AND ntype='h' AND pstatus !='n' AND nsect LIKE '$nsect%' ORDER BY nnota");
if (!$sth0) {
	print_r($dbh->errorInfo());
}
$headings0 = $sth0->fetchAll();



## Notation der Überschrift links abfragen
$sth2 = $dbh->query("SELECT nnota, nname FROM nota WHERE hier = 0 AND nsect LIKE '$nsect%' AND ntype= 'h'");
if (!$sth2) {
	print_r($dbh->errorInfo());
}
$leftheading = $sth2->fetch();


## Notation der Überschrift der Hauptseite abfragen
$sth1 = $dbh->query("SELECT nnota, nname, hier FROM nota WHERE nnota = '$hnota'");
if (!$sth1) {
	print_r($dbh->errorInfo());
}

$superheading = $sth1->fetch();

## Hierarchie f. Hauptanzeige festlegen
if(isset($superheading['hier'])) {
	$hhier = $superheading['hier']; 
}

## Notationen f. Hauptanzeige abfragen
# Überschrift ($hnota) Splitten
$snotas = explode('-', $hnota);
$snota0 = trim($snotas[0]);
if(!empty($snotas[1])) {
	$snota1 = trim($snotas[1]).'z';
}
else {
	$snota1=$snota0;
}

// Siegerlandsammlung anders behandeln im SELECT
if($nsect != 'sie')
{
	$sthn = $dbh->query("SELECT UPPER(nnota) AS nnota, nname, ntype, hier, target, nid, SUBSTRING(nsect,1,3) AS nsect, pstatus, nnotice, ckey, keydesc FROM nota WHERE nnota BETWEEN '$snota0' AND '$snota1' AND nsect LIKE '$nsect%' AND hier < 10 AND ntype !='s' ORDER BY SUBSTRING(nnota,1,3) ASC, hier, ntype, SUBSTRING(nnota,4,1) ASC");
}
else
{
	$sthn = $dbh->query("SELECT UPPER(nnota) AS nnota, nname, ntype, hier, target, nid, SUBSTRING(nsect,1,3) AS nsect, pstatus, nnotice, ckey, keydesc FROM nota WHERE nnota BETWEEN '$snota0' AND '$snota1' AND nsect LIKE '$nsect%' AND hier < 10 AND ntype !='s' ORDER BY SUBSTRING(nnota,1,4) ASC, hier, ntype, SUBSTRING(nnota,4,1) ASC");

}

if (!$sthn) {
print_r($dbh->errorInfo());
}
$notas = $sthn->fetchAll();

	# Verweisungen abfragen
	$sthv = $dbh->query("SELECT vnid, vtxt, stxt, vtarget, vtargettxt, vintern FROM verw WHERE vsect LIKE '$nsect%'");

    if (!$sthv) {
        print_r($dbh->errorInfo());
    }
    $verws = $sthv->fetchAll(PDO::FETCH_ASSOC);	

	$verwids = array();
	foreach($verws as $v => $verw) {
		
		$verwids[] = $verw['vnid'];

	}


	#Ausgabe erstellen
	## Schriftausz. f. Überschriften
	/*
	$fs = array(0 => 'font-size: 140%; font-weight: 900;',
                1 => 'font-size: 130%; font-weight: 900;',
				2 => 'font-size: 120%; font-weight: 700;',
				3 => 'font-size: 110%; font-weight: 500;',
				4 => 'font-size: 105%; font-weight: 400;',
				5 => 'font-size: 100%; font-weight: 300; font-style: italic;',
				6 => 'font-size: 100%; font-weight: normal; font-style: italic;',	
				7 => 'font-size: 100%; font-weight: normal; font-style: italic;',
				8 => 'font-size: 100%; font-weight: normal; font-style: italic;');
*/

	$fs = array(0 => 'h140',
                1 => 'h130',
                2 => 'h120',
                3 => 'h110',
                4 => 'h105',
                5 => 'h100_300',
                6 => 'h100',
                7 => 'h100i',
                8 => 'h100i');


/*
	$fc = array(0 => 'background-color: silver; margin-bottom: 1.0ex;',
				1 => 'background-color: transparent; margin-top: 1.5ex;',
				2 => 'background-color: transparent;',
				3 => 'background-color: transparent; margin-top: 0.7ex;',
				4 => 'background-color: transparent; margin-top: 0.5ex;',
				5 => 'background-color: transparent;',
				6 => 'background-color: transparent;',
				7 => 'background-color: transparent;',
				8 => 'background-color: transparent;');
*/
	$fc = array(0 => '',
                1 => '',
                2 => '',
                3 => '',
                4 => '',
                5 => '',
                6 => '',
                7 => '',
                8 => '');
				

/*
	$fp =  array(0 => 'padding-top: 0px;',
               	 1 => 'padding-top: 15px;',
				 2 => 'padding-top: 10px;',
				 3 => 'padding-top: 5px;',
				 4 => 'padding-top: 0;',
				 5 => 'padding-top: 0;',
				 6 => 'padding-top: 0;',
				 7 => 'padding-top: 0;',
				 8 => 'padding-top: 0;');
*/

	    $fp = array(0 => '',
                1 => '',
                2 => '',
                3 => '',
                4 => '',
                5 => '',
                6 => '',
                7 => '',
                8 => '');
				


	$notaout ="   <ul class='notaout'>\n";
	 // Vorbereitung f. Personenschluesselanpassung bei aut
	$initialspace = '0';

	$autkey_d_h = array('d', 'e', 'f', 'g', 'h');
	$autkey_u_y = array('u', 'v', 'w', 'x', 'y');
	$autkey_nota = array();
	$seckey_nota = array();
	foreach ($notas as $a => $autnota) {
        if($autnota['nsect'] == 'aut' || $autnota['nsect'] == 'ger')
		{
			if( preg_match('/^\w{3}$/', $autnota['nnota']))
			{
                $autkey = $autnota['nnota'];
				$autkey_nota[$autkey] = array();

            }
			elseif( preg_match('/^\w{4}$/', $autnota['nnota']) && in_array(substr($autnota['nnota'],-1),  $autkey_d_h) )
			{
				$autkey_nota[$autkey][] = $autnota['nnota'];
			}
            elseif( preg_match('/^\w{4}$/', $autnota['nnota']) && in_array(substr($autnota['nnota'],-1),  $autkey_u_y) )
            {
                $seckey_nota[$autkey][] = $autnota['nnota'];
            }


        }


	}


 	foreach ($notas as $n => $nota) {

		if($nota['ntype'] == 'h') {
			$fg = $nota['hier'];
	        $fx = $fs[$fg];
			$fcx = $fc[$fg];
			$fpx = $fp[$fg];
		}
		else {
			if($nota['pstatus'] =='s') {
				#$fx = 'font-size: 105%; font-weight: 900; letter-spacing: 0.1em;'; 
				$fx = 'verw105';

				$ft = '';
				
				// hier die Notation ablegen, um sie f. folgende 4B-Notationen
				// weiterzuverwenden	
				$pstatnota = $nota['nnota'];
				
				
			}
			else {
				$pstatnota = $nota['nnota'];
				$fx = 'nota95';
				$ft = '';
				if(preg_match("#^$pstatnota\w#i", $nota['nnota']) ) // Hier Delimeter # da / bei manchen 
																	// Notationen Probleme macht
				{
					$initialspace = '';
				}
				else {
					$initialspace = 'in10';

					if(!empty($pstatnota) ) {
						$pstatnota = '';
						
					}
					$pstatnota = '';
				}

			}
	
			# Notation für Anzeige erstellend
            $displaynota = $nota['nnota'];

		
			# Schluessel abfragen, wenn vorh.
    		if(!empty ($nota['ckey']))
			{

				# Grundnotation nachträglich mit Trunkierungszeichen versehen!
				$trunc = '*';	# Digibib
				$nota['nnota'] = $nota['nnota'].$trunc;


				if($nota['ckey'] != 'k4b') {
					$keytable = 'key_'.$nota['ckey'];
					$sthckey = $dbh->query("SELECT knota, knname, kntype, shownota FROM $keytable ORDER BY substr(knota,0,1)");
			    	if (!$sthckey) {
        				print_r($dbh->errorInfo());
    				}
    				$ckeys = $sthckey->fetchAll(PDO::FETCH_ASSOC);


        			$keyout = "<span class='ckey'>\n";
					# $keyout .= " <img src='icons/ghbskey.png' border='0' height='16' width='16' alt='neu' />\n";
					$keyout .= "  <ul class='keyout'>\n";
	
					$wnotice=0;
					$snotice=0;
					foreach ($ckeys as $c => $ckey)
					{
						if($ckey['shownota'] == 1)
						{
							// Sonderbedingung f. Personenschluessel

							if(($keytable == 'key_aut' || $keytable == 'key_lit') && in_array($ckey['knota'], $autkey_d_h)) 
							{
								$nkey = $nota['nnota'];
								if(!empty($autkey_nota[$nkey]) && $wnotice < 1)
								{
									// Pruefen ob mehre od. nur 1 Werk vorh. ist.
									if(count($autkey_nota[$nkey]) > 1)
									{
										$autkey1 = strtoupper($autkey_nota[$nkey][0]).' - '.strtoupper(end($autkey_nota[$nkey]));
								 	
										$keyout .= "   <li><div class='inkey1'>".strtoupper($autkey_nota[$nkey][0])."</div><div class='inkey2'> - ".strtoupper(end($autkey_nota[$nkey])).": Einzelne Werke s. Hauptteil</div></li>\n";
									}
									else
									{	
										 $autkey1 = strtoupper($autkey_nota[$nkey][0]);
										 $keyout .= "   <li><div class='inkey1'>".strtoupper($autkey_nota[$nkey][0])."</div><div class='inkey2'>: Einzelnes Werk s. Hauptteil</div></li>\n";
									}
								}
								$wnotice++;
							}

							elseif(($keytable == 'key_lit' || $keytable == 'key_aut') && in_array($ckey['knota'], $autkey_u_y))
                        	{
								$skey = $nota['nnota'];
								if(!empty($autkey_nota[$skey]) && $snotice < 1)

                           		{

									if(count($seckey_nota[$skey]) >  1)
                            		{
										if($nota['nsect'] == 'aut')
										{
											$sec_lit ="<i>. Nur Altbestand, neuere Sekundärliteratur s. ".$autkey1."</i>\n";
										}
										else
										{
											$sec_lit ="s.  Hauptteil";
										}

										if(count($seckey_nota[$skey]) == 1) 
										{
											$keyout .=  "   <li><div class='inkey1'>".strtoupper($seckey_nota[$skey][0])."</div><div class='inkey2'>: Sekundärliteratur zum einzelnen Werk $sec_lit</div></li>\n";
										}
										else {
											$keyout .= "   <li><div class='inkey1'>".strtoupper($seckey_nota[$skey][0])."</div><div class='inkey2'> - ".strtoupper(end($seckey_nota[$skey])).": Sekundärliteratur zu einzelnen Werken $sec_lit</div></li>\n";
										}
									}
									$snotice++;
								}
							
					


							}
				
							else
							{

								$nkey = '';
								// wenn gar kein Werk vorh., dann auch sonst. Werke
								// = i weg
								if ($ckey['knota'] == 'i' && empty($autkey_nota[$nkey]) && $keytable == 'key_aut')
								{
                           	    	$keyout .='';
								
                           		 }
								// sonst alle Schluesselnotas normal anzeigen
								else
								{
					 				# $keyout .= "   <li><div class='inkey1'><a href=$katurl{$nota['nnota']}".strtoupper($ckey['knota'])."$katparams>".strtoupper($nota['nnota']).strtoupper($ckey['knota'])."</a></div><div class='inkey2'>{$ckey['knname']}</div></li>\n";	

									# Für Grundsignatur $displaynota nutzen, sonst unerwuenschtes xxx*x-Notation!!
									$keyout .= "   <li><div class='inkey1'><a href=$katurl$displaynota".strtoupper($ckey['knota'])."$katparams>$displaynota".strtoupper($ckey['knota'])."</a></div><div class='inkey2'>{$ckey['knname']}</div></li>\n";
								}
							}
							

						}

					
					}
					if(empty($nota['keydesc']))
					{
						 $keyoutinfo = $ckeys[0]['knname'];
					}
					else {
						 $keyoutinfo = $nota['keydesc'];
					}

					$keyout .= "  </ul>\n";
					$keyout .= " <span class='inkey3'>(4. Buchstabe: $keyoutinfo)</span></span>\n";

					#$keyoutinfo ='';
    			}	
    			else
				{
					# $diplaynota an Skript f. Darstellung d. 4. Buchstabens übergeben, da sonst Trunkierungszeichen
					# mit übergeben wird. Dann funktioniert krb.php nicht!
        			$keyout = "<a href='./k4b.php?n3b=$displaynota'  onclick=\"ghbsWindowOpen(this.href); return false\" target='k4b' title='Übersicht der Stichwörter zu ".strtoupper($nota['nnota'])." + 4. Buchstabe'>(4. Buchstabe: {$nota['keydesc']})</a>";

    			}

			}

			else
			{
				if(empty($nota['ckey']))
				{
					$keyout ='';
				}

			}
		}
		// Ende Schlüsselausgabe

		# Pruefen ob Verweisung vorhanden
		 $verwout='';
		if(in_array($nota['nid'], $verwids)) {
			foreach($verws as $k => $vo) { 

				if($nota['nid'] == $vo['vnid']) {
					# vtargettxt soll vtarget ueberschreiben
					if(!empty($vo['vtargettxt'])) {
						$vtargettxt = $vo['vtargettxt'];
					}
					else {
						$vtargettxt = $vo['vtarget'];
                    }
					


					if($vo['vintern'] == 'i') {
						if($flogin == 1) {
							$verwstyle='verwintern';
							#$font = "color: green; font-style: italic; font-size: 1em; font-weight: normal;";
							;$verwout.="\n    <p class='verwintern'>{$vo['vtxt']} {$vo['stxt']} <a href='{$_SERVER['PHP_SELF']}?".$authlinktarget."target={$vo['vtarget']}#{$vo['vtarget']}'> $vtargettxt</a></p>";
						}

						else {
							$verwout.='';
						}

					}
					else {	
						#$font ="font-style: italic; font-size: 1em; font-weight: normal;";	
					

						## Andere css-Klasse bei Ueberschriften d. hoechsten Ebene
						if($nota['hier'] == 0) {
							$verwclass = 'verwhier0';
						}
						else {
							$verwclass = 'verwnormal';
						}



						$verwout.="\n    <br /><span class='$verwclass'>{$vo['vtxt']} {$vo['stxt']} <a href='{$_SERVER['PHP_SELF']}?".$authlinktarget."target={$vo['vtarget']}#{$vo['vtarget']}'> $vtargettxt</a></span>";
					}
				}

			}

		}
		else {
			$verwout='';
		}

		// Highlighten
		if(strtoupper($nota['nnota']) == $vtarget) {
			$bb='style=\'border-bottom: dashed red 1px;\'';
		}
		else {
			$bb='';
		}

		$nsect = substr($nota['nsect'],0,3);

		if($flogin == 1) {
			if($nota['pstatus'] == 'n') {
				$stealth = "<img src='icons/mask_s.png' border='0' height='16' width='16' alt='*'/>";
			}
			else {
				 $stealth = '';
			}
			$showhier = "[{$nota['hier']}]";
			if(in_array($nota['nsect'], $fsect)) {
				$edit ="<a href='notaedit.php?$authlinktop&nid={$nota['nid']}&page=$page'><img src='/esem/img/medit.gif' border='0' height='16' width='16' /></a>";
				$newnota ="<a href='notanew.php?$authlinktop&nid={$nota['nid']}&page=$page&new=decide&nsect=$nsect'><img src='icons/newnota.png' border='0' height='16' width='16' alt='neu' /></a>";
				$delnota ="<a href='notadel.php?$authlinktop&nid={$nota['nid']}&page=$page'><img src='/esem/img/dustbin.gif' border='0'  height='16' width='16' alt='Loeschen' /></a>";
			}
			else {
			    // Wenn angemeldet, aber in nicht-berechtigter Teilsys,  Hierarchieanzeige und icons auf '' setzen
	            $showhier = "";
    	        $edit = '';
        	    $newnota = '';
           		$delnota = '';
           	 	$info = '';


			}


			if(!empty($nota['nnotice'])) {
				$info = "<span class='ibox'><a href='#'><img src='./icons/icon_hilfe.gif' border='0' height='16' width='16' alt='Info' /><span>{$nota['nnotice']}</span></a></span>";
			}
			else {
				$info ='';
			}
		}
		else {
			// Wenn nicht angemeldet hierarchieanzeige und icons auf '' setzen
			$showhier = "";
            $edit = '';
            $newnota = '';
            $delnota = '';
            $info = '';
			// Versteckte auf ''
			$stealth = '';


		}

		// formatierte Ausgabe der Klassen

		# Bei normalen Notationen f. Id-Anker u. Anzeige $dsplaynota verwenden, sonst Trunkierungszeichen vorhanden! 
		if($nota['ntype']!='h' )
		{	
			if($nota['pstatus'] == 'a' || ($nota['pstatus'] == 'n' && $flogin !=1) )
            {
				$notaout .='';
			}
			else {
				$notaout .= "    <li class='$fx' $bb><div class='nnotaout'  id='$displaynota'>$stealth<a href=$katurl".strtoupper($nota['nnota'])."$katparams>$displaynota</a></div><div class='nnameout'><img src='./icons/spacer.gif' height='16' width='1' /> {$nota['nname']} $keyout $showhier $edit $newnota $delnota $info $verwout</div></li>\n";
			}
		}
		else
		{			
			$notaout .= "    <li class='$fx' $bb><div class='hnotaout' id='".strtoupper($nota['nnota'])."'>".strtoupper($nota['nnota'])."</div><div class='hnotaname'> {$nota['nname']} $showhier $edit $newnota $delnota $info $verwout</div></li>\n";
		}

		# $displaynota erneut mit notation besetzen, da sonst beim nächsten Schleifendruchlauf falsche Notation
		if($nota['ntype'] != 'h') {
			$displaynota = $nota['nnota'];
		}

		# Verweisungen löschen, bevor Schleife neu beginnt!
		$verwout = '';
	}

	$notaout .="   </ul>\n";
	// Ende formatierte Ausgabe der Klassen



$pagetitle ='Systematik der Universitätsbibliothek Siegen';

$html = new MyHtml();

echo "$html->doctype";
$html->addTitel("$pagetitle");
$html->addMeta('http-equiv="content-type" content="text/html; charset=utf-8" |name="author" content="Dirk Czukta" |name="viewport" content="width=device-width, initial-scale=1.0"');
$html->addLink('link rel="stylesheet" type="text/css" href="./ghbs.css" media="all"'); 

echo "$html->head";
?>


<script type="text/javascript">
function ghbsWindowOpen (url) {
  var w = screen.width-580;
  ghbsWindow = window.open(url, 'Notationsuebersicht', 'width=580, height=730, scrollbars=yes, top=screen.height, screenX='+ w +'');

  ghbsWindow.focus();
}

</script>


<?php

#$html->bodyAttrib("style='background-color: #ffffff; margin: 0; padding: 0;'");
$html->bodyAttrib("");
echo "$html->body";

# header
include('./header.inc.php');

#$html->tagEd('h1', 'Universitätsbibliothek Siegen', "class='headpagetop'",2,'n');
#echo "$html->tag";

#$html->tagEd('h2', $pagetitle, "class='pagetitle'",2,'n');
#echo "$html->tag";

# Ghbsnav links entwerfen

#$html->tagEd('p', "<a href='index.php?$authlinktop'><span style='font-family: Arial;'>&#x25b2;</span> Übersicht</a>", "style='text-align: left;font-size: 85%;'",3,n);
/** Nota links ausgeben **/



# Seitenmenu GHBS-Headings
echo "<aside id='ghbsheadernav'>\n";

$back = $html->tag;

//Ausklappmenu vorbereiten
$back =  "  <ul id='mainnota'>\n";
$back .= "   <li>\n";
$back .= "    <a href='index.php?$authlinktop'><span class='summarytop'>&#x25b2;</span> Übersicht</a>\n";
$back .= "    <ul>\n";
// Hauptueberschriften aus $headingsm ausgeben
foreach ($headingsm as $m => $mnota) {
	 $back .= "     <li><div class='mndiv1'><a href='sys1.php?nsect={$mnota['nsect']}&hnota={$mnota['nnota']}$authlink'>".strtoupper($mnota['nnota'])."</a></div><div class='mndiv2'>{$mnota['nname']}</div></li>\n";
}
// sys1.php?nsect={$mainheading['nsect']}&hnota={$mainheading['nnota']}$authlink'
$back .= "    </ul>\n";
$back .= "   </li>\n";
$back .= "  </ul>\n";


$leftheading['nnota']="<a href='sys1.php?nsect=$nsect&amp;hnota={$leftheading['nnota']}$authlink'>".strtoupper($leftheading['nnota']).'</a>';
$html->tagEd('div', "{$leftheading['nnota']}","class='leftheadnota'",4);
$leftheadnota = $html->tag;

$html->tagEd('div', "{$leftheading['nname']}","class='leftheadname'",0,'n');
$leftheadname = $html->tag;

$html->tagEd('div', "$leftheadnota $leftheadname","class='lefthead'",3,'m');
$leftheaddiv = $html->tag;

$html->tagEd('h3', "Teilsystematik: $nsect", "class='leftheadnsect'",3,'n');
$ghbsnav = $html->tag;

$mainheadings_li = '';
foreach ($headings0 as $h => $mainheading) {
	// $mainheading['nname'] kann zu lange Wörter enthalten,
    // deshalb muss mit HTML-Mitteln manuelle Trenntung vorgesehen werden.
#	if(mb_strlen($mainheading['nname']) > 30 && !preg_match('/\s/', substr($mainheading['nname'], 0,30))) {
		 $mainheading['nname'] = $html->addHyphen ($mainheading['nname']);
#	}


	$mainheadings_li .= "    <li><div class='leftnsectheadnota'><a href='sys1.php?nsect=$nsect&hnota={$mainheading['nnota']}$authlink'>".strtoupper($mainheading['nnota'])."</a></div><div class='leftnectheadname'> {$mainheading['nname']}</div></li>\n";
}

$html->tagEd('ul',"$mainheadings_li", "class='leftnsectheadlist'",3,'m');
$navul = $html->tag;

if(!isset($superheading['nnota'])) {
	        $superheading['nnota'] = '';
}
$superheading['nnota']=strtoupper($superheading['nnota']);
$html->tagEd('div', "{$superheading['nnota']}","class='superheadnota'",4);
$superheadnota = $html->tag;

if(!isset($superheading['nname'])) {
	$superheading['nname'] = '';
}
$html->tagEd('div', "{$superheading['nname']}","class='superheadname'",0,'n');
$superheadname = $html->tag;

$html->tagEd('div', "$superheadnota $superheadname","class='superhead'",3,'m');
$superheaddiv = $html->tag;

/** Ausgabe der vorbereiteten GHBS-Navi **/

$html->tagEd('div', $back.$ghbsnav.$leftheaddiv.$navul, "class='ghbsleft'",2,'m');
echo "$html->tag";

echo "</aside>\n";
/* Ende aside */

/* Inhalt */

echo "<main>\n";

require('./breadcrump.inc.php');
require('./suche.inc.php');

echo "<div class='ghbsall'>\n";

#$html->tagEd('div', $back.$ghbsnav.$leftheaddiv.$navul, "class='ghbsleft'",2,'m');
#echo "$html->tag";

$html->tagEd('div', "$superheadnota$superheadname","class='superheadelement'",3,'m');
$superheaddivmain = $html->tag;

$html->tagEd('div',"$notaout", "class='ghbsright'",2,'m');
echo "$html->tag";

echo "</div>\n";
echo "<div class='up'><a href='#top' title='Nach oben'>&#x25b2;</a></div>\n";
echo "</main>\n";


$footer = new footer;
$footer->footerLang('de');
$footer->impressLink('http://www.ub.uni-siegen.de/cms/index.php?id=147');
$footer->privpolLink('http://www.ub.uni-siegen.de/cms/index.php?id=1224');
$footer->upLink('#top');
$footer->showCtime("class='footctime'");

echo "$footer->footout";

/* Ende Hauptteil */


## Testausgaben
/*

print "<div style='clear: both; background-color: #feeeee; margin-top: 0; margin-left: 1em;'>\n";

print_r($vhnotares);

foreach ($_REQUEST as $p => $val) {

    print "<p>$p:: $val</p>\n";

}
print "<p style='clear: both;'>pstatnota: $pstatnota</p>\n";
print "<p>nnota::  {$nota['nnota']}</p>\n";
print "<p>page: ".urldecode($page)."</p>\n";
print "<p>Request page:  {$_REQUEST['page']}</p>\n";
print "<p>qstring: ".urldecode($qstring)."</p>\n";

print "<p style='clear: both;'>keyoutinfo: $keyoutinfo : {$nota['keydesc']}</p>\n";
print "<p>vtarget: $vtarget</p>\n";
print "<p>nsect: {$_REQUEST['nsect']} :". substr($nota['nsect'],0,3).": $nsect </p>\n";
print "<p>snota0: $snota0</p>\n";
print "<p>snota1: $snota1</p>\n";

print "<p>hnota: {$_REQUEST['hnota']} : $hnota</p>\n";

print "<p>Superheading: {$superheading['nnota']}</p>\n";
print "<p>Superheading: {$superheading['nname']}</p>\n";


print_r($superheading);


print "<br />$autkey:\n";
print_r($verwids);
print "<br />VERWDATA:\n";
print_r($verwdata);
print "</div>\n";
*/

echo  "$html->endhtml";


?>
