From ad4a17b43a1406ff4ec1ce8e044c9abcba20bd45 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 24 Nov 2020 17:31:20 +0100 Subject: [PATCH] remove some getter/setter --- Controller/ApiController.php | 82 ++++----- Controller/BackendController.php | 2 +- Models/Report.php | 126 +------------- Models/Template.php | 154 ++--------------- Theme/Backend/helper-create.tpl.php | 2 +- Theme/Backend/helper-edit.tpl.php | 231 ------------------------- Theme/Backend/helper-list.tpl.php | 14 +- Theme/Backend/helper-single.tpl.php | 12 +- tests/EventCourse/EventCourse.tpl.php | 10 +- tests/EventCourse/EventCourse.xlsx.php | 2 +- tests/Models/ReportMapperTest.php | 42 ++--- tests/Models/ReportTest.php | 38 ++-- tests/Models/TemplateMapperTest.php | 28 +-- tests/Models/TemplateTest.php | 38 ++-- 14 files changed, 159 insertions(+), 622 deletions(-) delete mode 100755 Theme/Backend/helper-edit.tpl.php diff --git a/Controller/ApiController.php b/Controller/ApiController.php index a3b32d6..6a73e59 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -70,13 +70,13 @@ final class ApiController extends Controller { /** @var Template $template */ $template = TemplateMapper::get((int) $request->getData('id')); - $accountId = $request->getHeader()->getAccount(); + $accountId = $request->header->account; // is allowed to read if (!$this->app->accountManager->get($accountId)->hasPermission( PermissionType::READ, $this->app->orgId, null, self::MODULE_NAME, PermissionState::REPORT, $template->getId()) ) { - $response->getHeader()->setStatusCode(RequestStatusCode::R_403); + $response->header->status = RequestStatusCode::R_403; return; } @@ -86,17 +86,17 @@ final class ApiController extends Controller if (!$this->app->accountManager->get($accountId)->hasPermission( PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::EXPORT )) { - $response->getHeader()->setStatusCode(RequestStatusCode::R_403); + $response->header->status = RequestStatusCode::R_403; return; } Autoloader::addPath(__DIR__ . '/../../../Resources/'); - $response->getHeader()->setDownloadable($template->getName(), (string) $request->getData('type')); + $response->header->setDownloadable($template->name, (string) $request->getData('type')); } $view = $this->createView($template, $request, $response); - $this->setHelperResponseHeader($view, $template->getName(), $request, $response); + $this->setHelperResponseHeader($view, $template->name, $request, $response); $view->setData('path', __DIR__ . '/../../../'); $response->set('export', $view); @@ -120,64 +120,64 @@ final class ApiController extends Controller { switch ($request->getData('type')) { case 'pdf': - $response->getHeader()->set( + $response->header->set( 'Content-disposition', 'attachment; filename="' . $name . '.' . ((string) $request->getData('type')) . '"' , true); - $response->getHeader()->set('Content-Type', MimeType::M_PDF, true); + $response->header->set('Content-Type', MimeType::M_PDF, true); $view->setTemplate('/' . \substr($view->getData('tcoll')['pdf']->getPath(), 0, -8), 'pdf.php'); break; case 'csv': - $response->getHeader()->set( + $response->header->set( 'Content-disposition', 'attachment; filename="' . $name . '.' . ((string) $request->getData('type')) . '"' , true); - $response->getHeader()->set('Content-Type', MimeType::M_CONF, true); + $response->header->set('Content-Type', MimeType::M_CONF, true); $view->setTemplate('/' . \substr($view->getData('tcoll')['csv']->getPath(), 0, -8), 'csv.php'); break; case 'xls': case 'xlsx': - $response->getHeader()->set( + $response->header->set( 'Content-disposition', 'attachment; filename="' . $name . '.' . ((string) $request->getData('type')) . '"' , true); - $response->getHeader()->set('Content-Type', MimeType::M_XLSX, true); + $response->header->set('Content-Type', MimeType::M_XLSX, true); $view->setTemplate('/' . \substr($view->getData('tcoll')['excel']->getPath(), 0, -8), 'xls.php'); break; case 'doc': case 'docx': - $response->getHeader()->set( + $response->header->set( 'Content-disposition', 'attachment; filename="' . $name . '.' . ((string) $request->getData('type')) . '"' , true); - $response->getHeader()->set('Content-Type', MimeType::M_XLSX, true); + $response->header->set('Content-Type', MimeType::M_XLSX, true); $view->setTemplate('/' . \substr($view->getData('tcoll')['word']->getPath(), 0, -8), 'doc.php'); break; case 'ppt': case 'pptx': - $response->getHeader()->set( + $response->header->set( 'Content-disposition', 'attachment; filename="' . $name . '.' . ((string) $request->getData('type')) . '"' , true); - $response->getHeader()->set('Content-Type', MimeType::M_XLSX, true); + $response->header->set('Content-Type', MimeType::M_XLSX, true); $view->setTemplate('/' . \substr($view->getData('tcoll')['powerpoint']->getPath(), 0, -8), 'ppt.php'); break; case 'json': - $response->getHeader()->set('Content-Type', MimeType::M_JSON, true); + $response->header->set('Content-Type', MimeType::M_JSON, true); $view->setTemplate('/' . \substr($view->getData('tcoll')['json']->getPath(), 0, -9), 'json.php'); break; default: - $response->getHeader()->set('Content-Type', 'text/html; charset=utf-8'); + $response->header->set('Content-Type', 'text/html; charset=utf-8'); $view->setTemplate('/' . \substr($view->getData('tcoll')['template']->getPath(), 0, -8)); } } @@ -235,17 +235,17 @@ final class ApiController extends Controller $tcoll['template'] = $tMedia; break; case StringUtils::endsWith($lowerPath, '.css'): - $tcoll['css'][$tMedia->getName()] = $tMedia; + $tcoll['css'][$tMedia->name] = $tMedia; break; case StringUtils::endsWith($lowerPath, '.js'): - $tcoll['js'][$tMedia->getName()] = $tMedia; + $tcoll['js'][$tMedia->name] = $tMedia; break; case StringUtils::endsWith($lowerPath, '.sqlite'): case StringUtils::endsWith($lowerPath, '.db'): - $tcoll['db'][$tMedia->getName()] = $tMedia; + $tcoll['db'][$tMedia->name] = $tMedia; break; default: - $tcoll['other'][$tMedia->getName()] = $tMedia; + $tcoll['other'][$tMedia->name] = $tMedia; } } @@ -264,7 +264,7 @@ final class ApiController extends Controller $files = $report->getSource()->getSources(); foreach ($files as $media) { - $rcoll[$media->getName() . '.' . $media->getExtension()] = $media; + $rcoll[$media->name . '.' . $media->extension] = $media; } } @@ -303,7 +303,7 @@ final class ApiController extends Controller $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( $request->getData('name') ?? '', $uploadedFiles, - $request->getHeader()->getAccount(), + $request->header->account, __DIR__ . '/../../../Modules/Media/Files' ); @@ -321,14 +321,14 @@ final class ApiController extends Controller (string) ($request->getData('name') ?? ''), (string) ($request->getData('description') ?? ''), $files, - $request->getHeader()->getAccount() + $request->header->account ); $collection->setPath('/Modules/Media/Files/Modules/Helper/' . ((string) ($request->getData('name') ?? ''))); $collection->setVirtualPath('/Modules/Helper'); if ($collection instanceof NullCollection) { - $response->getHeader()->setStatusCode(RequestStatusCode::R_403); + $response->header->status = RequestStatusCode::R_403; $this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Template', 'Couldn\'t create collection for template', null); return; @@ -340,7 +340,7 @@ final class ApiController extends Controller $this->app->moduleManager->get('Admin')->createAccountModelPermission( new AccountPermission( - $request->getHeader()->getAccount(), + $request->header->account, $this->app->orgId, $this->app->appName, self::MODULE_NAME, @@ -349,11 +349,11 @@ final class ApiController extends Controller null, PermissionType::READ | PermissionType::MODIFY | PermissionType::DELETE | PermissionType::PERMISSION, ), - $request->getHeader()->getAccount(), + $request->header->account, $request->getOrigin() ); - $this->createModel($request->getHeader()->getAccount(), $template, TemplateMapper::class, 'template', $request->getOrigin()); + $this->createModel($request->header->account, $template, TemplateMapper::class, 'template', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Template', 'Template successfully created', $template); } @@ -371,9 +371,9 @@ final class ApiController extends Controller $expected = $request->getData('expected'); $helperTemplate = new Template(); - $helperTemplate->setName($request->getData('name') ?? 'Empty'); - $helperTemplate->setDescription(Markdown::parse((string) ($request->getData('description') ?? ''))); - $helperTemplate->setDescriptionRaw((string) ($request->getData('description') ?? '')); + $helperTemplate->name = $request->getData('name') ?? 'Empty'; + $helperTemplate->description = Markdown::parse((string) ($request->getData('description') ?? '')); + $helperTemplate->descriptionRaw = (string) ($request->getData('description') ?? ''); if ($collectionId > 0) { $helperTemplate->setSource(new NullCollection($collectionId)); @@ -381,7 +381,7 @@ final class ApiController extends Controller $helperTemplate->setStandalone((bool) ($request->getData('standalone') ?? false)); $helperTemplate->setExpected(!empty($expected) ? \json_decode($expected, true) : []); - $helperTemplate->setCreatedBy(new NullAccount($request->getHeader()->getAccount())); + $helperTemplate->createdBy = new NullAccount($request->header->account); $helperTemplate->setDatatype((int) ($request->getData('datatype') ?? TemplateDataType::OTHER)); $helperTemplate->setVirtualPath((string) ($request->getData('virtualpath') ?? '/')); @@ -394,7 +394,7 @@ final class ApiController extends Controller $internalResponse = new HttpResponse(); $this->app->moduleManager->get('Tag')->apiTagCreate($request, $internalResponse, null); - $helperTemplate->addTag($internalResponse->get($request->getUri()->__toString())['response']); + $helperTemplate->addTag($internalResponse->get($request->uri->__toString())['response']); } else { $helperTemplate->addTag(new NullTag((int) $tag['id'])); } @@ -422,7 +422,7 @@ final class ApiController extends Controller $files = $this->app->moduleManager->get('Media')->uploadFiles( $request->getData('name') ?? '', $request->getFiles(), - $request->getHeader()->getAccount(), + $request->header->account, __DIR__ . '/../../../Modules/Media/Files' ); @@ -430,14 +430,14 @@ final class ApiController extends Controller (string) ($request->getData('name') ?? ''), (string) ($request->getData('description') ?? ''), $files, - $request->getHeader()->getAccount() + $request->header->account ); $collection->setPath('/Modules/Media/Files/Modules/Helper/' . ((string) ($request->getData('name') ?? ''))); $collection->setVirtualPath('/Modules/Helper'); if ($collection instanceof NullCollection) { - $response->getHeader()->setStatusCode(RequestStatusCode::R_403); + $response->header->status = RequestStatusCode::R_403; $this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Report', 'Couldn\'t create collection for report', null); return; @@ -449,7 +449,7 @@ final class ApiController extends Controller $this->app->moduleManager->get('Admin')->createAccountModelPermission( new AccountPermission( - $request->getHeader()->getAccount(), + $request->header->account, $this->app->orgId, $this->app->appName, self::MODULE_NAME, @@ -458,11 +458,11 @@ final class ApiController extends Controller null, PermissionType::READ | PermissionType::MODIFY | PermissionType::DELETE | PermissionType::PERMISSION, ), - $request->getHeader()->getAccount(), + $request->header->account, $request->getOrigin() ); - $this->createModel($request->getHeader()->getAccount(), $report, ReportMapper::class, 'report', $request->getOrigin()); + $this->createModel($request->header->account, $report, ReportMapper::class, 'report', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Report', 'Report successfully created', $report); } @@ -480,10 +480,10 @@ final class ApiController extends Controller private function createReportFromRequest(RequestAbstract $request, ResponseAbstract $response, int $collectionId) : Report { $helperReport = new Report(); - $helperReport->setTitle((string) ($request->getData('name'))); + $helperReport->title = (string) ($request->getData('name')); $helperReport->setSource(new NullCollection($collectionId)); $helperReport->setTemplate(new NullTemplate((int) $request->getData('template'))); - $helperReport->setCreatedBy(new NullAccount($request->getHeader()->getAccount())); + $helperReport->createdBy = new NullAccount($request->header->account); return $helperReport; } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 0c34e6e..3e4564f 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -202,7 +202,7 @@ final class BackendController extends Controller $files = $report->getSource()->getSources(); foreach ($files as $media) { - $rcoll[$media->getName() . '.' . $media->getExtension()] = $media; + $rcoll[$media->name . '.' . $media->extension] = $media; } } diff --git a/Models/Report.php b/Models/Report.php index 081ae16..b6c31ed 100755 --- a/Models/Report.php +++ b/Models/Report.php @@ -52,7 +52,7 @@ class Report implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $title = ''; + public string $title = ''; /** * Report description. @@ -60,7 +60,7 @@ class Report implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Report description. @@ -68,7 +68,7 @@ class Report implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; /** * Report created at. @@ -76,7 +76,7 @@ class Report implements \JsonSerializable * @var \DateTimeImmutable * @since 1.0.0 */ - protected \DateTimeImmutable $createdAt; + public \DateTimeImmutable $createdAt; /** * Report created by. @@ -84,7 +84,7 @@ class Report implements \JsonSerializable * @var Account * @since 1.0.0 */ - private Account $createdBy; + public Account $createdBy; /** * Report template. @@ -153,122 +153,6 @@ class Report implements \JsonSerializable $this->status = $status; } - /** - * Get title, - * - * @return string - * - * @since 1.0.0 - */ - public function getTitle() : string - { - return $this->title; - } - - /** - * Set the title - * - * @param string $title Title - * - * @return void - * - * @since 1.0.0 - */ - public function setTitle(string $title) : void - { - $this->title = $title; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set the description - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription(string $description) : void - { - $this->description = $description; - } - - /** - * Get raw description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - - /** - * Set raw description - * - * @param string $descriptionRaw Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $descriptionRaw) : void - { - $this->descriptionRaw = $descriptionRaw; - } - - /** - * Get created datetime - * - * @return \DateTimeImmutable - * - * @since 1.0.0 - */ - public function getCreatedAt() : \DateTimeImmutable - { - return $this->createdAt; - } - - /** - * Get creator - * - * @return Account - * - * @since 1.0.0 - */ - public function getCreatedBy() : Account - { - return $this->createdBy; - } - - /** - * Set creator - * - * @param Account $creator Created by - * - * @return void - * - * @since 1.0.0 - */ - public function setCreatedBy(Account $creator) : void - { - $this->createdBy = $creator; - } - /** * Get template this report belongs to * diff --git a/Models/Template.php b/Models/Template.php index 4842f14..2a4aaa8 100755 --- a/Models/Template.php +++ b/Models/Template.php @@ -78,7 +78,7 @@ class Template implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; /** * Template description. @@ -86,7 +86,7 @@ class Template implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; /** * Template description. @@ -94,7 +94,7 @@ class Template implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $descriptionRaw = ''; + public string $descriptionRaw = ''; /** * Template created at. @@ -102,7 +102,7 @@ class Template implements \JsonSerializable * @var \DateTimeImmutable * @since 1.0.0 */ - protected \DateTimeImmutable $createdAt; + public \DateTimeImmutable $createdAt; /** * Template created by. @@ -110,7 +110,7 @@ class Template implements \JsonSerializable * @var Account * @since 1.0.0 */ - private Account $createdBy; + public Account $createdBy; /** * Template source. @@ -221,32 +221,6 @@ class Template implements \JsonSerializable return new NullReport(); } - /** - * Set template name - * - * @param string $name Template name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - - /** - * Get template name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - /** * Get the path * @@ -273,58 +247,6 @@ class Template implements \JsonSerializable $this->virtualPath = $path; } - /** - * Set description - * - * @param string $description Template description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription(string $description) : void - { - $this->description = $description; - } - - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set raw description - * - * @param string $description Template description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescriptionRaw(string $description) : void - { - $this->descriptionRaw = $description; - } - - /** - * Get raw description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescriptionRaw() : string - { - return $this->descriptionRaw; - } - /** * Set source media * @@ -351,58 +273,6 @@ class Template implements \JsonSerializable return $this->source; } - /** - * Set creator - * - * @param Account $createdBy Creator - * - * @return void - * - * @since 1.0.0 - */ - public function setCreatedBy(Account $createdBy) : void - { - $this->createdBy = $createdBy; - } - - /** - * Get creator - * - * @return Account - * - * @since 1.0.0 - */ - public function getCreatedBy() : Account - { - return $this->createdBy; - } - - /** - * Get created date - * - * @return \DateTimeImmutable - * - * @since 1.0.0 - */ - public function getCreatedAt() : \DateTimeImmutable - { - return $this->createdAt; - } - - /** - * Set expected files from reports - * - * @param array $expected Expected files - * - * @return void - * - * @since 1.0.0 - */ - public function setExpected(array $expected) : void - { - $this->expected = $expected; - } - /** * Get expected files from report * @@ -429,6 +299,20 @@ class Template implements \JsonSerializable $this->expected[] = $expected; } + /** + * Set expected file from report + * + * @param string $expected Expected file + * + * @return void + * + * @since 1.0.0 + */ + public function setExpected(array $expected) : void + { + $this->expected = $expected; + } + /** * Set activity satuus * diff --git a/Theme/Backend/helper-create.tpl.php b/Theme/Backend/helper-create.tpl.php index f221abb..b743485 100755 --- a/Theme/Backend/helper-create.tpl.php +++ b/Theme/Backend/helper-create.tpl.php @@ -34,7 +34,7 @@ echo $this->getData('nav')->render(); ?> diff --git a/Theme/Backend/helper-edit.tpl.php b/Theme/Backend/helper-edit.tpl.php deleted file mode 100755 index 19b1db4..0000000 --- a/Theme/Backend/helper-edit.tpl.php +++ /dev/null @@ -1,231 +0,0 @@ -l11nManager, $this->request, $this->response); -$tabView->setTemplate('/Web/Templates/Divider/Tabular'); - -echo $this->getData('nav')->render(); ?> - -
-
- -
-
-
- l11nManager, $this->request, $this->response); - $permissionPanel = clone $overviwPanel; - - $overviwPanel->setTitle($this->getHtml('Create')); - $permissionPanel->setTitle($this->getHtml('Permission')); - - $this->addView('createFormPanel', $overviwPanel); - $this->getView('createFormPanel')->setTemplate('/Web/Templates/Panel/BoxHalf'); - - $this->addView('permissionFormPanel', $permissionPanel); - $this->getView('permissionFormPanel')->setTemplate('/Web/Templates/Panel/BoxHalf'); - - /* - * Overview - */ - - $formOverview = new \Web\Views\Form\FormView($this->l11nManager, $this->request, $this->response); - $formOverview->setTemplate('/Web/Templates/Forms/FormFull'); - $formOverview->setSubmit('submit1', $this->getHtml('Edit')); - $formOverview->setSubmit('submit2', $this->getHtml('Delete')); - $formOverview->setAction($this->request->getUri()->getScheme() . '://' . $this->request->getUri()->getHost()); - $formOverview->setMethod(\phpOMS\Message\Http\RequestMethod::POST); - - $formOverview->setElement(0, 0, [ - 'type' => \phpOMS\Html\TagType::INPUT, - 'subtype' => 'text', - 'name' => 'rname', - 'label' => $this->getHtml('Name'), - ]); - - $formOverview->setElement(1, 0, [ - 'type' => \phpOMS\Html\TagType::INPUT, - 'subtype' => 'text', - 'name' => 'mdirectory', - 'label' => $this->getHtml('MediaDirectory'), - 'active' => false, - ]); - - $formOverview->setElement(1, 1, [ - 'type' => \phpOMS\Html\TagType::BUTTON, - 'content' => $this->getHtml('Select'), - ]); - - $formOverview->setElement(2, 0, [ - 'type' => \phpOMS\Html\TagType::INPUT, - 'subtype' => 'text', - 'name' => 'template', - 'label' => $this->getHtml('Template'), - 'active' => false, - ]); - - $formOverview->setElement(2, 1, [ - 'type' => \phpOMS\Html\TagType::BUTTON, - 'content' => $this->getHtml('Select'), - ]); - - $this->getView('createFormPanel')->addView('form', $formOverview); - - /* - * Permission Add - */ - - $formPermissionAdd = new \Web\Views\Form\FormView($this->l11nManager, $this->request, $this->response); - $formPermissionAdd->setTemplate('/Web/Templates/Forms/FormFull'); - $formPermissionAdd->setSubmit('submit1', $this->getHtml('Add', '0', '0')); - $formPermissionAdd->setAction($this->request->getUri()->getScheme() . '://' . $this->request->getUri()->getHost()); - $formPermissionAdd->setMethod(\phpOMS\Message\Http\RequestMethod::POST); - - $formPermissionAdd->setElement(0, 0, [ - 'type' => \phpOMS\Html\TagType::SELECT, - 'options' => [ - [ - 'value' => 0, - 'content' => 'Group', - ], - [ - 'value' => 1, - 'content' => 'Account', - ], - ], - 'selected' => '', - 'label' => $this->getHtml('Type'), - 'name' => 'type', - ]); - - $formPermissionAdd->setElement(1, 0, [ - 'type' => \phpOMS\Html\TagType::INPUT, - 'subtype' => 'text', - 'name' => 'id', - 'label' => $this->getHtml('ID'), - ]); - - $formPermissionAdd->setElement(2, 0, [ - 'type' => \phpOMS\Html\TagType::INPUT, - 'subtype' => 'text', - 'name' => 'perm', - 'label' => $this->getHtml('Permission'), - ]); - - $this->getView('permissionFormPanel')->addView('form', $formPermissionAdd); - - /* - * Permission List - */ - $permissionListView = new \Web\Views\Lists\ListView($this->l11nManager, $this->request, $this->response); - $headerView = new \Web\Views\Lists\HeaderView($this->l11nManager, $this->request, $this->response); - - $permissionListView->setTemplate('/Web/Templates/Lists/ListFull'); - $headerView->setTemplate('/Web/Templates/Lists/Header/HeaderTable'); - - /* - * Header - */ - $headerView->setTitle($this->getHtml('Permission')); - $headerView->setHeader([ - ['title' => $this->getHtml('Type'), 'sortable' => true], - ['title' => $this->getHtml('Name'), 'sortable' => true, 'full' => true], - ['title' => $this->getHtml('Permission'), 'sortable' => true], - ]); - - $permissionListView->addView('header', $headerView); - $this->addView('permissionList', $permissionListView); - - $tabView->addTab($this->getHtml('Overview'), $overviwPanel->render() . $permissionPanel->render() . $permissionListView->render(), 'Backend', 'overview'); - - /* - * UI Logic - */ - $sourceList = new \Web\Views\Lists\ListView($this->l11nManager, $this->request, $this->response); - $sourceListHeaderView = new \Web\Views\Lists\HeaderView($this->l11nManager, $this->request, $this->response); - - $sourceList->setTemplate('/Web/Templates/Lists/ListFull'); - $sourceListHeaderView->setTemplate('/Web/Templates/Lists/Header/HeaderTable'); - - /* - * Header - */ - $sourceListHeaderView->setTitle($this->getHtml('Sources')); - $sourceListHeaderView->setHeader([ - ['title' => $this->getHtml('ID'), 'sortable' => true], - ['title' => $this->getHtml('Name'), 'sortable' => true, 'full' => true], - ['title' => $this->getHtml('Created'), 'sortable' => true], - ['title' => $this->getHtml('CreatedBy'), 'sortable' => true], - ]); - - $sourceList->setFreeze(3, 2); - $sourceList->addView('header', $sourceListHeaderView); - - $tabView->addTab($this->getHtml('Helper', 'Sources'), $sourceList->render(), 'Backend', 'sources'); - - /* - * Create - */ - $createPanel = new \Web\Views\Panel\PanelView($this->l11nManager, $this->request, $this->response); - $mediaPanel = clone $createPanel; - - $createPanel->setTitle($this->getHtml('Create')); - $mediaPanel->setTitle($this->getHtml('Media')); - - $this->addView('createFormPanel', $createPanel); - $this->getView('createFormPanel')->setTemplate('/Web/Templates/Panel/BoxHalf'); - - $this->addView('permissionFormPanel', $mediaPanel); - $this->getView('permissionFormPanel')->setTemplate('/Web/Templates/Panel/BoxHalf'); - - $formCreateForm = new \Web\Views\Form\FormView($this->l11nManager, $this->request, $this->response); - $formCreateForm->setTemplate('/Web/Templates/Forms/FormFull'); - $formCreateForm->setSubmit('submit1', $this->getHtml('Submit')); - $formCreateForm->setAction($this->request->getUri()->getScheme() . '://' . $this->request->getUri()->getHost()); - $formCreateForm->setMethod(\phpOMS\Message\Http\RequestMethod::POST); - - $formCreateForm->setElement(0, 0, [ - 'type' => \phpOMS\Html\TagType::INPUT, - 'subtype' => 'text', - 'name' => 'rname', - 'label' => $this->getHtml('Name'), - ]); - - $createPanel->addView('createform', $formCreateForm); - - /* - * Media Add - */ - $tabView->addTab($this->getHtml('Helper', 'New'), $createPanel->render() . $mediaPanel->render(), 'Backend', 'new'); - ?> - printHtml($tabView->render()); ?> -
- - diff --git a/Theme/Backend/helper-list.tpl.php b/Theme/Backend/helper-list.tpl.php index d33f233..0895f77 100755 --- a/Theme/Backend/helper-list.tpl.php +++ b/Theme/Backend/helper-list.tpl.php @@ -68,26 +68,26 @@ echo $this->getData('nav')->render(); ?> getHtml('Updated'); ?> $value) : ++$count; - $url = UriFactory::build('{/prefix}helper/list?path=' . \rtrim($value->getVirtualPath(), '/') . '/' . $value->getName()); + $url = UriFactory::build('{/prefix}helper/list?path=' . \rtrim($value->getVirtualPath(), '/') . '/' . $value->name); ?> - printHtml($value->getName()); ?> + printHtml($value->name); ?> - printHtml($value->getCreatedBy()->getName1()); ?> - printHtml($value->getCreatedAt()->format('Y-m-d')); ?> + printHtml($value->createdBy->name1); ?> + printHtml($value->createdAt->format('Y-m-d')); ?> $template) : ++$count; $url = UriFactory::build('{/prefix}helper/report/view?{?}&id=' . $template->getId()); ?> - printHtml($template->getName()); ?> + printHtml($template->name); ?> getTags(); foreach ($tags as $tag) : ?> printHtml($tag->getTitle()); ?> - printHtml($template->getCreatedBy()->getName1()); ?> - printHtml($template->getCreatedAt()->format('Y-m-d')); ?> + printHtml($template->createdBy->name1); ?> + printHtml($template->createdAt->format('Y-m-d')); ?> diff --git a/Theme/Backend/helper-single.tpl.php b/Theme/Backend/helper-single.tpl.php index cde9e38..f83e1d4 100755 --- a/Theme/Backend/helper-single.tpl.php +++ b/Theme/Backend/helper-single.tpl.php @@ -118,25 +118,25 @@ echo $this->getData('nav')->render(); ?> getHtml('Report'); ?> getHtml('Name'); ?> - printHtml($report->getTitle()); ?> + printHtml($report->title); ?> getHtml('Creator'); ?> - printHtml($report->getCreatedBy()->getName1()); ?> + printHtml($report->createdBy->name1); ?> getHtml('Created'); ?> - getCreatedAt()->format('Y-m-d'); ?> + createdAt->format('Y-m-d'); ?> getHtml('Template'); ?> getHtml('Name'); ?> - printHtml($template->getName()); ?> + printHtml($template->name); ?> getHtml('Creator'); ?> - printHtml($template->getCreatedBy()->getName1()); ?> + printHtml($template->createdBy->name1); ?> getHtml('Created'); ?> - getCreatedAt()->format('Y-m-d'); ?> + createdAt->format('Y-m-d'); ?> getHtml('Tags'); ?> diff --git a/tests/EventCourse/EventCourse.tpl.php b/tests/EventCourse/EventCourse.tpl.php index fd8a064..59aa3a7 100755 --- a/tests/EventCourse/EventCourse.tpl.php +++ b/tests/EventCourse/EventCourse.tpl.php @@ -26,7 +26,7 @@ require 'Worker.php';
- request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
@@ -195,7 +195,7 @@ require 'Worker.php';
- request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
@@ -270,7 +270,7 @@ require 'Worker.php';
- request->getUri()->getFragment() === 'c-tab-3' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
@@ -318,7 +318,7 @@ require 'Worker.php';
- request->getUri()->getFragment() === 'c-tab-4' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
@@ -389,7 +389,7 @@ require 'Worker.php';
- request->getUri()->getFragment() === 'c-tab-5' ? ' checked' : ''; ?>> + request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
diff --git a/tests/EventCourse/EventCourse.xlsx.php b/tests/EventCourse/EventCourse.xlsx.php index e735dbf..fab90be 100755 --- a/tests/EventCourse/EventCourse.xlsx.php +++ b/tests/EventCourse/EventCourse.xlsx.php @@ -183,7 +183,7 @@ $excel->getProperties()->setCreator('Orange Management Solutions') ->setLastModifiedBy('Dennis Eichhorn') ->setTitle('Event & Course Budget') ->setSubject('Budget Evaluation') - ->setDescription('Document used in order to evaluate the event & course expenses.') + ->description = 'Document used in order to evaluate the event & course expenses.') ->setKeywords('OMS Budget Event Course') ->setCategory('Controlling'); diff --git a/tests/Models/ReportMapperTest.php b/tests/Models/ReportMapperTest.php index 29326b9..00e97a5 100755 --- a/tests/Models/ReportMapperTest.php +++ b/tests/Models/ReportMapperTest.php @@ -34,16 +34,16 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase { $template = new Template(); - $template->setCreatedBy(new NullAccount(1)); - $template->setName('Report Template'); + $template->createdBy = new NullAccount(1); + $template->name = 'Report Template'; $template->setStatus(HelperStatus::ACTIVE); - $template->setDescription('Description'); + $template->description = 'Description'; $template->setDatatype(TemplateDataType::OTHER); $template->setStandalone(false); $template->setExpected(['source1.csv', 'source2.csv']); $collection = new Collection(); - $collection->setCreatedBy(new NullAccount(1)); + $collection->createdBy = new NullAccount(1); $templateFiles = [ [ @@ -85,11 +85,11 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase foreach ($templateFiles as $file) { $media = new Media(); - $media->setCreatedBy(new NullAccount(1)); - $media->setExtension($file['extension']); + $media->createdBy = new NullAccount(1); + $media->extension = $file['extension']; $media->setPath(\trim($file['path'], '/') . '/' . $file['filename']); - $media->setName($file['name']); - $media->setSize($file['size']); + $media->name = $file['name']; + $media->size = $file['size']; $collection->addSource($media); } @@ -108,14 +108,14 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase { $report = new Report(); - $report->setCreatedBy(new NullAccount(1)); - $report->setTitle('Title'); + $report->createdBy = new NullAccount(1); + $report->title = 'Title'; $report->setStatus(HelperStatus::ACTIVE); - $report->setDescription('Description'); + $report->description = 'Description'; $report->setTemplate($this->createTemplate()); $collection = new Collection(); - $collection->setCreatedBy(new NullAccount(1)); + $collection->createdBy = new NullAccount(1); $reportFiles = [ [ @@ -157,11 +157,11 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase foreach ($reportFiles as $file) { $media = new Media(); - $media->setCreatedBy(new NullAccount(1)); - $media->setExtension($file['extension']); + $media->createdBy = new NullAccount(1); + $media->extension = $file['extension']; $media->setPath(\trim($file['path'], '/') . '/' . $file['filename']); - $media->setName($file['name']); - $media->setSize($file['size']); + $media->name = $file['name']; + $media->size = $file['size']; $collection->addSource($media); } @@ -173,11 +173,11 @@ class ReportMapperTest extends \PHPUnit\Framework\TestCase self::assertEquals($id, $report->getId()); $reportR = ReportMapper::get($report->getId()); - self::assertEquals($report->getCreatedAt()->format('Y-m-d'), $reportR->getCreatedAt()->format('Y-m-d')); - self::assertEquals($report->getCreatedBy()->getId(), $reportR->getCreatedBy()->getId()); - self::assertEquals($report->getDescription(), $reportR->getDescription()); - self::assertEquals($report->getTitle(), $reportR->getTitle()); + self::assertEquals($report->createdAt->format('Y-m-d'), $reportR->createdAt->format('Y-m-d')); + self::assertEquals($report->createdBy->getId(), $reportR->createdBy->getId()); + self::assertEquals($report->description, $reportR->description); + self::assertEquals($report->title, $reportR->title); self::assertEquals($report->getStatus(), $reportR->getStatus()); - self::assertEquals($report->getTemplate()->getName(), $reportR->getTemplate()->getName()); + self::assertEquals($report->getTemplate()->name, $reportR->getTemplate()->name); } } diff --git a/tests/Models/ReportTest.php b/tests/Models/ReportTest.php index 0b00b93..b343c10 100755 --- a/tests/Models/ReportTest.php +++ b/tests/Models/ReportTest.php @@ -42,12 +42,12 @@ class ReportTest extends \PHPUnit\Framework\TestCase public function testDefault() : void { self::assertEquals(0, $this->report->getId()); - self::assertEquals(0, $this->report->getCreatedBy()->getId()); - self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->report->getCreatedAt()->format('Y-m-d')); - self::assertEquals('', $this->report->getTitle()); + self::assertEquals(0, $this->report->createdBy->getId()); + self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->report->createdAt->format('Y-m-d')); + self::assertEquals('', $this->report->title); self::assertEquals(HelperStatus::INACTIVE, $this->report->getStatus()); - self::assertEquals('', $this->report->getDescription()); - self::assertEquals('', $this->report->getDescriptionRaw()); + self::assertEquals('', $this->report->description); + self::assertEquals('', $this->report->descriptionRaw); self::assertEquals(0, $this->report->getTemplate()->getId()); self::assertEquals(0, $this->report->getSource()->getId()); } @@ -59,8 +59,8 @@ class ReportTest extends \PHPUnit\Framework\TestCase */ public function testCreatedByInputOutput() : void { - $this->report->setCreatedBy(new NullAccount(1)); - self::assertEquals(1, $this->report->getCreatedBy()->getId()); + $this->report->createdBy = new NullAccount(1); + self::assertEquals(1, $this->report->createdBy->getId()); } /** @@ -70,8 +70,8 @@ class ReportTest extends \PHPUnit\Framework\TestCase */ public function testTitleInputOutput() : void { - $this->report->setTitle('Title'); - self::assertEquals('Title', $this->report->getTitle()); + $this->report->title = 'Title'; + self::assertEquals('Title', $this->report->title); } /** @@ -92,8 +92,8 @@ class ReportTest extends \PHPUnit\Framework\TestCase */ public function testDescriptionInputOutput() : void { - $this->report->setDescription('Description'); - self::assertEquals('Description', $this->report->getDescription()); + $this->report->description = 'Description'; + self::assertEquals('Description', $this->report->description); } /** @@ -103,8 +103,8 @@ class ReportTest extends \PHPUnit\Framework\TestCase */ public function testDescriptionRawInputOutput() : void { - $this->report->setDescriptionRaw('DescriptionRaw'); - self::assertEquals('DescriptionRaw', $this->report->getDescriptionRaw()); + $this->report->descriptionRaw = 'DescriptionRaw'; + self::assertEquals('DescriptionRaw', $this->report->descriptionRaw); } /** @@ -137,9 +137,9 @@ class ReportTest extends \PHPUnit\Framework\TestCase public function testToArray() : void { $this->report->setTemplate(new NullTemplate(11)); - $this->report->setTitle('testTitle'); - $this->report->setDescription('testDescription'); - $this->report->setDescriptionRaw('testDescriptionRaw'); + $this->report->title = 'testTitle'; + $this->report->description = 'testDescription'; + $this->report->descriptionRaw = 'testDescriptionRaw'; $array = $this->report->toArray(); $expected = [ @@ -167,9 +167,9 @@ class ReportTest extends \PHPUnit\Framework\TestCase public function testJsonSerialize() : void { $this->report->setTemplate(new NullTemplate(11)); - $this->report->setTitle('testTitle'); - $this->report->setDescription('testDescription'); - $this->report->setDescriptionRaw('testDescriptionRaw'); + $this->report->title = 'testTitle'; + $this->report->description = 'testDescription'; + $this->report->descriptionRaw = 'testDescriptionRaw'; $array = $this->report->jsonSerialize(); $expected = [ diff --git a/tests/Models/TemplateMapperTest.php b/tests/Models/TemplateMapperTest.php index 0d10589..c120492 100755 --- a/tests/Models/TemplateMapperTest.php +++ b/tests/Models/TemplateMapperTest.php @@ -38,17 +38,17 @@ class TemplateMapperTest extends \PHPUnit\Framework\TestCase { $template = new Template(); - $template->setCreatedBy(new NullAccount(1)); - $template->setName('Title'); + $template->createdBy = new NullAccount(1); + $template->name = 'Title'; $template->setStatus(HelperStatus::ACTIVE); - $template->setDescription('Description'); - $template->setDescriptionRaw('DescriptionRaw'); + $template->description = 'Description'; + $template->descriptionRaw = 'DescriptionRaw'; $template->setDatatype(TemplateDataType::OTHER); $template->setStandalone(false); $template->setExpected(['source1.csv', 'source2.csv']); $collection = new Collection(); - $collection->setCreatedBy(new NullAccount(1)); + $collection->createdBy = new NullAccount(1); $templateFiles = [ [ @@ -90,11 +90,11 @@ class TemplateMapperTest extends \PHPUnit\Framework\TestCase foreach ($templateFiles as $file) { $media = new Media(); - $media->setCreatedBy(new NullAccount(1)); - $media->setExtension($file['extension']); + $media->createdBy = new NullAccount(1); + $media->extension = $file['extension']; $media->setPath(\trim($file['path'], '/') . '/' . $file['filename']); - $media->setName($file['name']); - $media->setSize($file['size']); + $media->name = $file['name']; + $media->size = $file['size']; $collection->addSource($media); } @@ -106,11 +106,11 @@ class TemplateMapperTest extends \PHPUnit\Framework\TestCase self::assertEquals($id, $template->getId()); $templateR = TemplateMapper::get($template->getId()); - self::assertEquals($template->getCreatedAt()->format('Y-m-d'), $templateR->getCreatedAt()->format('Y-m-d')); - self::assertEquals($template->getCreatedBy()->getId(), $templateR->getCreatedBy()->getId()); - self::assertEquals($template->getDescription(), $templateR->getDescription()); - self::assertEquals($template->getDescriptionRaw(), $templateR->getDescriptionRaw()); - self::assertEquals($template->getName(), $templateR->getName()); + self::assertEquals($template->createdAt->format('Y-m-d'), $templateR->createdAt->format('Y-m-d')); + self::assertEquals($template->createdBy->getId(), $templateR->createdBy->getId()); + self::assertEquals($template->description, $templateR->description); + self::assertEquals($template->descriptionRaw, $templateR->descriptionRaw); + self::assertEquals($template->name, $templateR->name); self::assertEquals($template->getStatus(), $templateR->getStatus()); self::assertEquals($template->isStandalone(), $templateR->isStandalone()); self::assertEquals($template->getDatatype(), $templateR->getDatatype()); diff --git a/tests/Models/TemplateTest.php b/tests/Models/TemplateTest.php index c9ee2b0..3ce22a0 100755 --- a/tests/Models/TemplateTest.php +++ b/tests/Models/TemplateTest.php @@ -45,12 +45,12 @@ class TemplateTest extends \PHPUnit\Framework\TestCase { self::assertEquals(0, $this->template->getId()); self::assertEquals(0, $this->template->getUnit()->getId()); - self::assertEquals(0, $this->template->getCreatedBy()->getId()); - self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->template->getCreatedAt()->format('Y-m-d')); - self::assertEquals('', $this->template->getName()); + self::assertEquals(0, $this->template->createdBy->getId()); + self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->template->createdAt->format('Y-m-d')); + self::assertEquals('', $this->template->name); self::assertEquals(HelperStatus::INACTIVE, $this->template->getStatus()); - self::assertEquals('', $this->template->getDescription()); - self::assertEquals('', $this->template->getDescriptionRaw()); + self::assertEquals('', $this->template->description); + self::assertEquals('', $this->template->descriptionRaw); self::assertEquals([], $this->template->getExpected()); self::assertEquals(0, $this->template->getSource()->getId()); self::assertFalse($this->template->isStandalone()); @@ -76,8 +76,8 @@ class TemplateTest extends \PHPUnit\Framework\TestCase */ public function testCreatedByInputOutput() : void { - $this->template->setCreatedBy(new NullAccount(1)); - self::assertEquals(1, $this->template->getCreatedBy()->getId()); + $this->template->createdBy = new NullAccount(1); + self::assertEquals(1, $this->template->createdBy->getId()); } /** @@ -87,8 +87,8 @@ class TemplateTest extends \PHPUnit\Framework\TestCase */ public function testNameInputOutput() : void { - $this->template->setName('Title'); - self::assertEquals('Title', $this->template->getName()); + $this->template->name = 'Title'; + self::assertEquals('Title', $this->template->name); } /** @@ -120,8 +120,8 @@ class TemplateTest extends \PHPUnit\Framework\TestCase */ public function testDescriptionInputOutput() : void { - $this->template->setDescription('Description'); - self::assertEquals('Description', $this->template->getDescription()); + $this->template->description = 'Description'; + self::assertEquals('Description', $this->template->description); } /** @@ -131,8 +131,8 @@ class TemplateTest extends \PHPUnit\Framework\TestCase */ public function testDescriptionRawInputOutput() : void { - $this->template->setDescriptionRaw('DescriptionRaw'); - self::assertEquals('DescriptionRaw', $this->template->getDescriptionRaw()); + $this->template->descriptionRaw = 'DescriptionRaw'; + self::assertEquals('DescriptionRaw', $this->template->descriptionRaw); } /** @@ -176,9 +176,9 @@ class TemplateTest extends \PHPUnit\Framework\TestCase */ public function testToArray() : void { - $this->template->setName('testName'); - $this->template->setDescription('testDescription'); - $this->template->setDescriptionRaw('testDescriptionRaw'); + $this->template->name = 'testName'; + $this->template->description = 'testDescription'; + $this->template->descriptionRaw = 'testDescriptionRaw'; $this->template->setStandalone(true); $array = $this->template->toArray(); @@ -208,9 +208,9 @@ class TemplateTest extends \PHPUnit\Framework\TestCase */ public function testJsonSerialize() : void { - $this->template->setName('testName'); - $this->template->setDescription('testDescription'); - $this->template->setDescriptionRaw('testDescriptionRaw'); + $this->template->name = 'testName'; + $this->template->description = 'testDescription'; + $this->template->descriptionRaw = 'testDescriptionRaw'; $this->template->setStandalone(true); $array = $this->template->jsonSerialize();