Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mevdschee committed Aug 18, 2020
1 parent 4c62593 commit 02dba87
Showing 1 changed file with 49 additions and 35 deletions.
84 changes: 49 additions & 35 deletions ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<html lang="en">

<head>
<title>PHP-CRUD-UI</title>
<title>{{info.title}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="{{base}}/css/style.css">
<!--<link rel="stylesheet" type="text/css" href="{{base}}/css/music.css">-->
Expand All @@ -56,7 +56,7 @@
<body>
<div class="content">
<div class="navigation">
<a href="{{base}}/" class="title"><span>Projectnaam</span>Subtitel</a>
<a href="{{base}}/" class="title"><span>{{info.title}}</span>{{info.x-subtitle}}</a>
<a class="hamburger" href="{{base}}/">☰</a>
</div>
<div class="body">
Expand Down Expand Up @@ -219,16 +219,15 @@
<li><a href="{{base}}/">Home</a></li>
</ul>

<h1>Projectnaam</h1>
<h1>{{info.title}}</h1>
<br />
<ul class="home">
{{for:item:menu}}
<li>
<a href="{{base}}/{{item}}/list">{{item|humanize}}</a>
</li>
<li>
<a href="{{base}}/{{item}}/list">{{item|humanize}}</a>
</li>
{{endfor}}
</ul>

END_OF_HTML;
}

Expand Down Expand Up @@ -2205,7 +2204,7 @@ public function withBody(StreamInterface $body): self
return $new;
}

private function setHeaders(array $headers): void
private function setHeaders(array $headers) /*:void*/
{
foreach ($headers as $header => $value) {
if (\is_int($header)) {
Expand Down Expand Up @@ -2410,7 +2409,7 @@ public function withUri(UriInterface $uri, $preserveHost = false): self
return $new;
}

private function updateHostFromUri(): void
private function updateHostFromUri() /*:void*/
{
if ('' === $host = $this->uri->getHost()) {
return;
Expand Down Expand Up @@ -2448,7 +2447,7 @@ final class Response implements ResponseInterface
use MessageTrait;

/** @var array Map of standard HTTP status code/reason phrases */
private const PHRASES = [
/*private*/ const PHRASES = [
100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing',
200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported',
300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect',
Expand Down Expand Up @@ -2714,7 +2713,7 @@ final class Stream implements StreamInterface
private $size;

/** @var array Hash of readable and writable stream types */
private const READ_WRITE_HASH = [
/*private*/ const READ_WRITE_HASH = [
'read' => [
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
Expand Down Expand Up @@ -2804,7 +2803,7 @@ public function __toString()
}
}

public function close(): void
public function close() /*:void*/
{
if (isset($this->stream)) {
if (\is_resource($this->stream)) {
Expand All @@ -2828,7 +2827,7 @@ public function detach()
return $result;
}

public function getSize(): ?int
public function getSize() /*:?int*/
{
if (null !== $this->size) {
return $this->size;
Expand Down Expand Up @@ -2872,7 +2871,7 @@ public function isSeekable(): bool
return $this->seekable;
}

public function seek($offset, $whence = \SEEK_SET): void
public function seek($offset, $whence = \SEEK_SET) /*:void*/
{
if (!$this->seekable) {
throw new \RuntimeException('Stream is not seekable');
Expand All @@ -2883,7 +2882,7 @@ public function seek($offset, $whence = \SEEK_SET): void
}
}

public function rewind(): void
public function rewind() /*:void*/
{
$this->seek(0);
}
Expand Down Expand Up @@ -2966,7 +2965,7 @@ public function getMetadata($key = null)
final class UploadedFile implements UploadedFileInterface
{
/** @var array */
private const ERRORS = [
/*private*/ const ERRORS = [
\UPLOAD_ERR_OK => 1,
\UPLOAD_ERR_INI_SIZE => 1,
\UPLOAD_ERR_FORM_SIZE => 1,
Expand Down Expand Up @@ -3045,7 +3044,7 @@ public function __construct($streamOrFile, $size, $errorStatus, $clientFilename
/**
* @throws \RuntimeException if is moved or not ok
*/
private function validateActive(): void
private function validateActive() /*:void*/
{
if (\UPLOAD_ERR_OK !== $this->error) {
throw new \RuntimeException('Cannot retrieve stream due to upload error');
Expand All @@ -3069,7 +3068,7 @@ public function getStream(): StreamInterface
return Stream::create($resource);
}

public function moveTo($targetPath): void
public function moveTo($targetPath) /*:void*/
{
$this->validateActive();

Expand Down Expand Up @@ -3111,12 +3110,12 @@ public function getError(): int
return $this->error;
}

public function getClientFilename(): ?string
public function getClientFilename() /*:?string*/
{
return $this->clientFilename;
}

public function getClientMediaType(): ?string
public function getClientMediaType() /*:?string*/
{
return $this->clientMediaType;
}
Expand All @@ -3141,11 +3140,11 @@ final class Uri implements UriInterface
{
use LowercaseTrait;

private const SCHEMES = ['http' => 80, 'https' => 443];
/*private*/ const SCHEMES = ['http' => 80, 'https' => 443];

private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
/*private*/ const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';

private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
/*private*/ const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';

/** @var string Uri scheme. */
private $scheme = '';
Expand Down Expand Up @@ -3227,7 +3226,7 @@ public function getHost(): string
return $this->host;
}

public function getPort(): ?int
public function getPort() /*:?int*/
{
return $this->port;
}
Expand Down Expand Up @@ -3395,7 +3394,7 @@ private static function isNonStandardPort(string $scheme, int $port): bool
return !isset(self::SCHEMES[$scheme]) || $port !== self::SCHEMES[$scheme];
}

private function filterPort($port): ?int
private function filterPort($port) /*:?int*/
{
if (null === $port) {
return null;
Expand Down Expand Up @@ -3507,7 +3506,7 @@ public function fromGlobals(): ServerRequestInterface
/**
* {@inheritdoc}
*/
public function fromArrays(array $server, array $headers = [], array $cookie = [], array $get = [], ?array $post = null, array $files = [], $body = null): ServerRequestInterface
public function fromArrays(array $server, array $headers = [], array $cookie = [], array $get = [], /*?array*/ $post = null, array $files = [], $body = null): ServerRequestInterface
{
$method = $this->getMethodFromEnv($server);
$uri = $this->getUriFromEnvWithHTTP($server);
Expand Down Expand Up @@ -3772,8 +3771,7 @@ public function fromArrays(
array $server,
array $headers = [],
array $cookie = [],
array $get = [],
?array $post = null,
array $get = [], /*?array*/ $post = null,
array $files = [],
$body = null
): ServerRequestInterface;
Expand Down Expand Up @@ -12174,6 +12172,21 @@ public function getColumns(string $table, string $action): array
return array_keys($properties);
}

public function getInfo()
{
$info = array();
if (isset($this->definition['info'])) {
$info = $this->definition['info'];
if (!isset($info['title'])) {
$info['title'] = 'PHP-CRUD-UI';
}
if (!isset($info['x-subtitle'])) {
$info['x-subtitle'] = 'by TQdev.com';
}
}
return $info;
}

public function getMenu()
{
$items = array();
Expand Down Expand Up @@ -13669,13 +13682,13 @@ public function getPolygonColumnName(): string
use Tqdev\PhpCrudApi\Record\ErrorCode;
use Tqdev\PhpCrudApi\ResponseUtils;
use Tqdev\PhpCrudUi\Client\CrudApi;
use Tqdev\PhpCrudUi\Client\CurlCaller;
use Tqdev\PhpCrudUi\Client\LocalCaller;
use Tqdev\PhpCrudUi\Column\SpecificationService;
use Tqdev\PhpCrudUi\Controller\RecordController;
use Tqdev\PhpCrudUi\Controller\MultiResponder;
use Tqdev\PhpCrudUi\Record\RecordService;
use Tqdev\PhpCrudUi\Client\LocalCaller;
use Tqdev\PhpCrudUi\Client\CurlCaller;
use Tqdev\PhpCrudUi\Controller\RecordController;
use Tqdev\PhpCrudUi\Middleware\StaticFileMiddleware;
use Tqdev\PhpCrudUi\Record\RecordService;

class Ui implements RequestHandlerInterface
{
Expand All @@ -13702,6 +13715,7 @@ public function __construct(Config $config)
break;
}
}
$responder->setVariable('info', $definition->getInfo());
$responder->setVariable('base', $router->getBasePath());
$responder->setVariable('menu', $definition->getMenu());
$responder->setVariable('table', '');
Expand Down Expand Up @@ -13816,9 +13830,9 @@ public function handle(ServerRequestInterface $request): ResponseInterface

$config = new Config([
'api' => [
'username' => 'masterlist',
'password' => 'masterlist',
'database' => 'masterlist',
'username' => 'php-crud-api',
'password' => 'php-crud-api',
'database' => 'php-crud-api',
],
'templatePath' => '../templates',
]);
Expand Down

0 comments on commit 02dba87

Please sign in to comment.