'.$Title.'';
}
function Table(array $Table): string
{
$Result = '
';
$Result .= '';
foreach ($Table['Header'] as $Item)
$Result .= ''.$Item.' | ';
$Result .= '
';
foreach ($Table['Rows'] as $Row)
{
$Result .= '';
foreach ($Row as $Item)
$Result .= ''.$Item.' | ';
$Result .= '
';
}
$Result .= '
';
return $Result;
}
function ShowEditTable(string $ClassName, array $Values): string
{
global $Classes, $Types;
$Class = $Classes[$ClassName];
$Table = array(
'Header' => array('Položka', 'Hodnota'),
'Rows' => array(),
);
foreach ($Class as $Index => $Item)
{
if (!array_key_exists($Index, $Values)) $Values[$Index] = $Item['Default'];
switch ($Item['Type'])
{
case 'Boolean':
if ($Values[$Index] == 0) $Checked = ''; else $Checked = ' checked="yes"';
$Edit = '';
break;
case 'String':
$Edit = '';
break;
case 'Integer':
$Edit = '';
break;
default:
$Edit = 'Neznámý typ';
}
array_push($Table['Rows'], array($Item['Caption'], $Edit));
}
$Output = 'Tabulka '.$ClassName.'
'.Table($Table).MakeLink('?Operation=Add2', 'Přidat');
return $Output;
}
function ProcessURL(): array
{
if (array_key_exists('REDIRECT_QUERY_STRING', $_SERVER))
$PathString = $_SERVER['REDIRECT_QUERY_STRING'];
else $PathString = '';
if (substr($PathString, -1, 1) == '/') $PathString = substr($PathString, 0, -1);
$PathItems = explode('/', $PathString);
if (array_key_exists('REQUEST_URI', $_SERVER) and (strpos($_SERVER['REQUEST_URI'], '?') !== false))
$_SERVER['QUERY_STRING'] = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?') + 1);
else $_SERVER['QUERY_STRING'] = '';
parse_str($_SERVER['QUERY_STRING'], $_GET);
return $PathItems;
}
function GetQueryStringArray(string $QueryString): array
{
$Result = array();
$Parts = explode('&', $QueryString);
foreach ($Parts as $Part)
{
if ($Part != '')
{
if (!strpos($Part, '=')) $Part .= '=';
$Item = explode('=', $Part);
$Result[$Item[0]] = $Item[1];
}
}
return $Result;
}
function SetQueryStringArray(array $QueryStringArray): string
{
$Parts = array();
foreach ($QueryStringArray as $Index => $Item)
{
$Parts[] = $Index.'='.$Item;
}
return implode('&', $Parts);
}