mirror of
https://github.com/Karaka-Management/oms-Script.git
synced 2026-01-14 22:08:40 +00:00
remove some getter/setter
This commit is contained in:
parent
bc7c0912aa
commit
ad4a17b43a
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td><label for="iTemplate"><?= $this->getHtml('Template'); ?></label>
|
||||
<tr><td><select id="iTemplate" name="template">
|
||||
<?php foreach ($templateList as $key => $value) : ?>
|
||||
<option value="<?= $this->printHtml($key); ?>"><?= $this->printHtml($value->getName()); ?>
|
||||
<option value="<?= $this->printHtml($key); ?>"><?= $this->printHtml($value->name); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,231 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\Helper
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
$tabView = new \Web\Views\Divider\TabularView($this->l11nManager, $this->request, $this->response);
|
||||
$tabView->setTemplate('/Web/Templates/Divider/Tabular');
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<div class="b-7" id="i3-2-1">
|
||||
<div class="b b-5 c3-2 c3" id="i3-2-5">
|
||||
<div class="bc-1">
|
||||
<ul class="l-1">
|
||||
<li>
|
||||
<a tabindex="0" href="<?= \phpOMS\Uri\UriFactory::build('{/prefix}helper/single?{?}&id=' . $this->getData('name')); ?>"
|
||||
class="button"><?= $this->getHtml('Report'); ?></a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="b-6">
|
||||
<?php
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
$overviwPanel = new \Web\Views\Panel\PanelView($this->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');
|
||||
?>
|
||||
<?= $this->printHtml($tabView->render()); ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
jsOMS.ready(function () {
|
||||
assetManager.load(Url + '/Modules/Media/JS', 'MediaUpload.js', 'js');
|
||||
});
|
||||
</script>
|
||||
|
|
@ -68,26 +68,26 @@ echo $this->getData('nav')->render(); ?>
|
|||
<td><?= $this->getHtml('Updated'); ?>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($collections as $key => $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);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><i class="fa fa-folder-open"></i></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getName()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
||||
<td>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getCreatedBy()->getName1()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getCreatedAt()->format('Y-m-d')); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->createdBy->name1); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->createdAt->format('Y-m-d')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($templates as $key => $template) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}helper/report/view?{?}&id=' . $template->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->getName()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->name); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Tag'); ?>">
|
||||
<?php $tags = $template->getTags(); foreach ($tags as $tag) : ?>
|
||||
<span class="tag" style="background: <?= $this->printHtml($tag->getColor()); ?>"><?= $this->printHtml($tag->getTitle()); ?></span>
|
||||
<?php endforeach; ?>
|
||||
<td data-label="<?= $this->getHtml('Creator'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->getCreatedBy()->getName1()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Updated'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->getCreatedAt()->format('Y-m-d')); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Creator'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->createdBy->name1); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Updated'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->createdAt->format('Y-m-d')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr tabindex="0" class="empty">
|
||||
|
|
|
|||
|
|
@ -118,25 +118,25 @@ echo $this->getData('nav')->render(); ?>
|
|||
<th colspan="2"><?= $this->getHtml('Report'); ?>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Name'); ?>
|
||||
<td><?= $this->printHtml($report->getTitle()); ?>
|
||||
<td><?= $this->printHtml($report->title); ?>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Creator'); ?>
|
||||
<td><?= $this->printHtml($report->getCreatedBy()->getName1()); ?>
|
||||
<td><?= $this->printHtml($report->createdBy->name1); ?>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Created'); ?>
|
||||
<td><?= $report->getCreatedAt()->format('Y-m-d'); ?>
|
||||
<td><?= $report->createdAt->format('Y-m-d'); ?>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
<th colspan="2"><?= $this->getHtml('Template'); ?>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Name'); ?>
|
||||
<td><?= $this->printHtml($template->getName()); ?>
|
||||
<td><?= $this->printHtml($template->name); ?>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Creator'); ?>
|
||||
<td><a href="<?= UriFactory::build('{/prefix}profile/single?for=' . $template->getCreatedBy()->getId()); ?>"><?= $this->printHtml($template->getCreatedBy()->getName1()); ?></a>
|
||||
<td><a href="<?= UriFactory::build('{/prefix}profile/single?for=' . $template->createdBy->getId()); ?>"><?= $this->printHtml($template->createdBy->name1); ?></a>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Created'); ?>
|
||||
<td><?= $template->getCreatedAt()->format('Y-m-d'); ?>
|
||||
<td><?= $template->createdAt->format('Y-m-d'); ?>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Tags'); ?>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ require 'Worker.php';
|
|||
</ul>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="box">
|
||||
<table class="default">
|
||||
|
|
@ -195,7 +195,7 @@ require 'Worker.php';
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<section class="box">
|
||||
<table class="default">
|
||||
|
|
@ -270,7 +270,7 @@ require 'Worker.php';
|
|||
</table>
|
||||
</section>
|
||||
</div>
|
||||
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-3' ? ' checked' : ''; ?>>
|
||||
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<section class="box">
|
||||
<table class="default">
|
||||
|
|
@ -318,7 +318,7 @@ require 'Worker.php';
|
|||
</table>
|
||||
</section>
|
||||
</div>
|
||||
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-4' ? ' checked' : ''; ?>>
|
||||
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<section class="box">
|
||||
<table class="default">
|
||||
|
|
@ -389,7 +389,7 @@ require 'Worker.php';
|
|||
</table>
|
||||
</section>
|
||||
</div>
|
||||
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->getUri()->getFragment() === 'c-tab-5' ? ' checked' : ''; ?>>
|
||||
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<section class="box">
|
||||
<table class="default">
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user