mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-02-05 19:18:40 +00:00
add list pagination
This commit is contained in:
parent
3195fe3a82
commit
2c921ed342
|
|
@ -54,7 +54,11 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Organization/Theme/Backend/unit-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004703001, $request, $response));
|
||||
|
||||
$view->addData('list:elements', UnitMapper::getAll());
|
||||
if ($request->getData('ptype') === '-') {
|
||||
$view->setData('units', UnitMapper::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||
} else {
|
||||
$view->setData('units', UnitMapper::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -212,7 +216,11 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Organization/Theme/Backend/department-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004704001, $request, $response));
|
||||
|
||||
$view->addData('list:elements', DepartmentMapper::getAll());
|
||||
if ($request->getData('ptype') === '-') {
|
||||
$view->setData('departments', DepartmentMapper::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||
} else {
|
||||
$view->setData('departments', DepartmentMapper::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -300,7 +308,11 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Organization/Theme/Backend/position-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004705001, $request, $response));
|
||||
|
||||
$view->addData('list:elements', PositionMapper::getAll());
|
||||
if ($request->getData('ptype') === '-') {
|
||||
$view->setData('positions', PositionMapper::getBeforePivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||
} else {
|
||||
$view->setData('positions', PositionMapper::getAfterPivot((int) ($request->getData('id') ?? 0), null, 25));
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,16 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Organization\Models\Department[] $departments
|
||||
*/
|
||||
$departments = $this->getData('list:elements') ?? [];
|
||||
$departments = $this->getData('departments') ?? [];
|
||||
|
||||
$previous = empty($departments) ? '{/prefix}organization/department/list' : '{/prefix}organization/department/list?{?}&id=' . \reset($departments)->getId() . '&ptype=-';
|
||||
$next = empty($departments) ? '{/prefix}organization/department/list' : '{/prefix}organization/department/list?{?}&id=' . \end($departments)->getId() . '&ptype=+';
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
|
|
@ -45,7 +50,10 @@ echo $this->getData('nav')->render(); ?>
|
|||
<td colspan="4" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<div class="portlet-foot"></div>
|
||||
<div class="portlet-foot">
|
||||
<a class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -12,11 +12,17 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Organization\Models\Position[] $positions
|
||||
*/
|
||||
$positions = $this->getData('list:elements') ?? [];
|
||||
$positions = $this->getData('positions') ?? [];
|
||||
|
||||
$previous = empty($positions) ? '{/prefix}organization/position/list' : '{/prefix}organization/position/list?{?}&id=' . \reset($positions)->getId() . '&ptype=-';
|
||||
$next = empty($positions) ? '{/prefix}organization/position/list' : '{/prefix}organization/position/list?{?}&id=' . \end($positions)->getId() . '&ptype=+';
|
||||
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
|
|
@ -44,7 +50,10 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<div class="portlet-foot"></div>
|
||||
<div class="portlet-foot">
|
||||
<a class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,11 +12,16 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Organization\Models\Unit[] $units
|
||||
*/
|
||||
$units = $this->getData('list:elements') ?? [];
|
||||
$units = $this->getData('units') ?? [];
|
||||
|
||||
$previous = empty($units) ? '{/prefix}organization/unit/list' : '{/prefix}organization/unit/list?{?}&id=' . \reset($units)->getId() . '&ptype=-';
|
||||
$next = empty($units) ? '{/prefix}organization/unit/list' : '{/prefix}organization/unit/list?{?}&id=' . \end($units)->getId() . '&ptype=+';
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
|
|
@ -39,7 +44,10 @@ echo $this->getData('nav')->render(); ?>
|
|||
<td data-label="<?= $this->getHtml('Parent') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getParent()->getName()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="portlet-foot"></div>
|
||||
<div class="portlet-foot">
|
||||
<a class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user