mirror of
https://github.com/Karaka-Management/oms-ContractManagement.git
synced 2026-01-28 17:38:43 +00:00
Continue with getter/setter cleanup
This commit is contained in:
parent
9fcee2e25a
commit
1f0e082b70
|
|
@ -52,24 +52,18 @@ final class BackendController extends Controller
|
|||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response));
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$mapper = ContractMapper::getAll()
|
||||
->with('account')
|
||||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->setData('contracts',
|
||||
$mapper->where('id', $request->getDataInt('id') ?? 0, '<')->execute()
|
||||
);
|
||||
$view->data['contracts'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<')->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->setData('contracts',
|
||||
$mapper->where('id', $request->getDataInt('id') ?? 0, '>')->execute()
|
||||
);
|
||||
$view->data['contracts'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>')->execute();
|
||||
} else {
|
||||
$view->setData('contracts',
|
||||
$mapper->where('id', 0, '>')->execute()
|
||||
);
|
||||
$view->data['contracts'] = $mapper->where('id', 0, '>')->execute();
|
||||
}
|
||||
|
||||
return $view;
|
||||
|
|
@ -92,7 +86,7 @@ final class BackendController extends Controller
|
|||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-single');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response));
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$contract = ContractMapper::get()
|
||||
->with('account')
|
||||
|
|
@ -100,20 +94,20 @@ final class BackendController extends Controller
|
|||
->where('id', (int) $request->getData('id'))
|
||||
->sort('files/id', 'DESC')
|
||||
->execute();
|
||||
$view->addData('contract', $contract);
|
||||
$view->data['contract'] = $contract;
|
||||
|
||||
$contractTypes = ContractTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
$view->setData('contractTypes', $contractTypes);
|
||||
$view->data['contractTypes'] = $contractTypes;
|
||||
|
||||
$units = UnitMapper::getAll()
|
||||
->execute();
|
||||
$view->setData('units', $units);
|
||||
$view->data['units'] = $units;
|
||||
|
||||
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response);
|
||||
$view->addData('editor', $editor);
|
||||
$view->data['editor'] = $editor;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ use phpOMS\Uri\UriFactory;
|
|||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\ContractManagement\Models\Contract[] $contracts
|
||||
*/
|
||||
$contracts = $this->getData('contracts') ?? [];
|
||||
$contracts = $this->data['contracts'] ?? [];
|
||||
|
||||
$previous = empty($contracts) ? '{/base}/contract/list' : '{/base}/contract/list?{?}&id=' . \reset($contracts)->id . '&ptype=p';
|
||||
$next = empty($contracts) ? '{/base}/contract/list' : '{/base}/contract/list?{?}&id=' . \end($contracts)->id . '&ptype=n';
|
||||
|
||||
$now = new \DateTime('now');
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ use phpOMS\Uri\UriFactory;
|
|||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\ContractManagement\Models\Contract $contract
|
||||
*/
|
||||
$contract = $this->getData('contract');
|
||||
$contract = $this->data['contract'];
|
||||
$contractFile = $contract->files;
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="tabview tab-2 col-simple">
|
||||
<div class="box">
|
||||
|
|
@ -52,7 +52,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<label for="iType"><?= $this->getHtml('Type'); ?></label>
|
||||
<select id="iType" name="type" data-tpl-text="/type" data-tpl-value="/type">
|
||||
<?php
|
||||
$types = $this->getData('contractTypes') ?? [];
|
||||
$types = $this->data['contractTypes'] ?? [];
|
||||
foreach ($types as $type) : ?>
|
||||
<option value="<?= $type->id; ?>" <?= $type->id === $contract->type->id ? ' selected' : ''; ?>><?= $this->printHtml($type->getL11n()); ?>
|
||||
<?php endforeach; ?>
|
||||
|
|
@ -95,7 +95,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<select id="iUnit" name="unit">
|
||||
<option value="">
|
||||
<?php
|
||||
$units = $this->getData('units') ?? [];
|
||||
$units = $this->data['units'] ?? [];
|
||||
foreach ($units as $unit) : ?>
|
||||
<option value="<?= $unit->id; ?>"<?= $contract->unit->id === $unit->id ? ' selected' : ''; ?>><?= $this->printHtml($unit->name); ?>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user