Use global namespace

This commit is contained in:
Dennis Eichhorn 2019-04-27 00:13:26 +02:00
parent bbb90428fc
commit 3c118c7f5a
5 changed files with 22 additions and 15 deletions

View File

@ -135,7 +135,7 @@ final class ApiController extends Controller
default: default:
$response->getHeader()->set('Content-Type', 'text/html; charset=utf-8'); $response->getHeader()->set('Content-Type', 'text/html; charset=utf-8');
// todo: use html template here instead which uses the tcoll/template!!! // todo: use html template here instead which uses the tcoll/template!!!
$view->setTemplate(\substr($view->getData('tcoll')['template']->getPath(), 0, -8)); $view->setTemplate('/' . \substr($view->getData('tcoll')['template']->getPath(), 0, -8));
} }
} }
@ -161,12 +161,19 @@ final class ApiController extends Controller
$lowerPath = \strtolower($tMedia->getPath()); $lowerPath = \strtolower($tMedia->getPath());
if (StringUtils::endsWith($lowerPath, '.lang.php')) { if (StringUtils::endsWith($lowerPath, '.lang.php')) {
$tcoll['lang'][$tMedia->getName()] = $tMedia; $language = \explode('.', $lowerPath)[0];
} elseif (StringUtils::endsWith($lowerPath, '.xlsx.php') || StringUtils::endsWith($lowerPath, '.xls.php')) { $tcoll['lang'][$language] = $tMedia;
} elseif (StringUtils::endsWith($lowerPath, '.xlsx.php')
|| StringUtils::endsWith($lowerPath, '.xls.php')
) {
$tcoll['excel'][$tMedia->getName()] = $tMedia; $tcoll['excel'][$tMedia->getName()] = $tMedia;
} elseif (StringUtils::endsWith($lowerPath, '.docx.php') || StringUtils::endsWith($lowerPath, '.doc.php')) { } elseif (StringUtils::endsWith($lowerPath, '.docx.php')
|| StringUtils::endsWith($lowerPath, '.doc.php')
) {
$tcoll['word'][$tMedia->getName()] = $tMedia; $tcoll['word'][$tMedia->getName()] = $tMedia;
} elseif (StringUtils::endsWith($lowerPath, '.pptx.php') || StringUtils::endsWith($lowerPath, '.ppt.php')) { } elseif (StringUtils::endsWith($lowerPath, '.pptx.php')
|| StringUtils::endsWith($lowerPath, '.ppt.php')
) {
$tcoll['powerpoint'][$tMedia->getName()] = $tMedia; $tcoll['powerpoint'][$tMedia->getName()] = $tMedia;
} elseif (StringUtils::endsWith($lowerPath, '.pdf.php')) { } elseif (StringUtils::endsWith($lowerPath, '.pdf.php')) {
$tcoll['pdf'][$tMedia->getName()] = $tMedia; $tcoll['pdf'][$tMedia->getName()] = $tMedia;
@ -194,7 +201,7 @@ final class ApiController extends Controller
); );
$rcoll = []; $rcoll = [];
$report = end($report); $report = \end($report);
$report = $report === false ? new NullReport() : $report; $report = $report === false ? new NullReport() : $report;
if (!($report instanceof NullReport)) { if (!($report instanceof NullReport)) {

View File

@ -149,7 +149,7 @@ final class BackendController extends Controller
$files = $template->getSource()->getSources(); $files = $template->getSource()->getSources();
foreach ($files as $tMedia) { foreach ($files as $tMedia) {
$lowerPath = strtolower($tMedia->getPath()); $lowerPath = \strtolower($tMedia->getPath());
if (StringUtils::endsWith($lowerPath, '.lang.php')) { if (StringUtils::endsWith($lowerPath, '.lang.php')) {
$tcoll['lang'] = $tMedia; $tcoll['lang'] = $tMedia;
@ -192,7 +192,7 @@ final class BackendController extends Controller
); );
$rcoll = []; $rcoll = [];
$report = end($report); $report = \end($report);
$report = $report === false ? new NullReport() : $report; $report = $report === false ? new NullReport() : $report;
if (!($report instanceof NullReport)) { if (!($report instanceof NullReport)) {

View File

@ -144,7 +144,7 @@ class Template implements \JsonSerializable
public function getNewestReport() : Report public function getNewestReport() : Report
{ {
if (!empty($this->reports)) { if (!empty($this->reports)) {
return end($this->reports()); return \end($this->reports());
} }
return new NullReport(); return new NullReport();

View File

@ -19,9 +19,9 @@ $templates = $this->getData('reports');
$footerView = new \phpOMS\Views\PaginationView($this->app, $this->request, $this->response); $footerView = new \phpOMS\Views\PaginationView($this->app, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig'); $footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$footerView->setPages(count($templates) / 25); $footerView->setPages(\count($templates) / 25);
$footerView->setPage(1); $footerView->setPage(1);
$footerView->setResults(count($templates)); $footerView->setResults(\count($templates));
echo $this->getData('nav')->render(); ?> echo $this->getData('nav')->render(); ?>
@ -40,7 +40,7 @@ echo $this->getData('nav')->render(); ?>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<tbody> <tbody>
<?php if (count($templates) == 0) : ?> <?php if (\count($templates) == 0) : ?>
<tr class="empty"> <tr class="empty">
<td colspan="4"><?= $this->getHtml('Empty', 0, 0); ?> <td colspan="4"><?= $this->getHtml('Empty', 0, 0); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -28,12 +28,12 @@ echo $this->getData('nav')->render(); ?>
<div class="row" style="height: calc(100% - 85px);"> <div class="row" style="height: calc(100% - 85px);">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="box wf-100" style="height: 100%;"> <div class="box wf-100" style="height: 100%;">
<iframe src="<?= \phpOMS\Uri\UriFactory::build('{/prefix}helper/report/export/?id=' . $template->getId()); ?>" allowfullscreen></iframe> <iframe src="<?= \phpOMS\Uri\UriFactory::build('{/api}helper/report/export/?id=' . $template->getId()); ?>" allowfullscreen></iframe>
</div> </div>
</div> </div>
<!-- <!--
<div class="col-xs-12 col-md-3"> <div class="col-xs-12 col-md-3">
<?php if (count($reportLanguage) > 1) : ?> <?php if (\count($reportLanguage) > 1) : ?>
<section class="box wf-100"> <section class="box wf-100">
<header><h1><?= $this->getHtml('Reports') ?></h1></header> <header><h1><?= $this->getHtml('Reports') ?></h1></header>
@ -41,7 +41,7 @@ echo $this->getData('nav')->render(); ?>
<form action="<?= \phpOMS\Uri\UriFactory::build('{/api}helper/template'); ?>" method="post"> <form action="<?= \phpOMS\Uri\UriFactory::build('{/api}helper/template'); ?>" method="post">
<table class="layout wf-100"> <table class="layout wf-100">
<tbody> <tbody>
<?php if (count($reportLanguage) > 1) : ?> <?php if (\count($reportLanguage) > 1) : ?>
<tr> <tr>
<td><label for="iLang"><?= $this->getHtml('Language'); ?></label> <td><label for="iLang"><?= $this->getHtml('Language'); ?></label>
<tr> <tr>