Skip to content

Commit

Permalink
[FEATURE] Add selector for items per page in module
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardfuehricht committed Jun 1, 2016
1 parent bd0f35f commit 52fce55
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Classes/Controller/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,15 @@ public function indexAction(\Typoheads\Formhandler\Domain\Model\Demand $demand =
$demand->setPid($this->id);
}
}

$logDataRows = $this->logDataRepository->findDemanded($demand);
$this->view->assign('demand', $demand);
$this->view->assign('logDataRows', $logDataRows);
$this->view->assign('settings', $this->settings);
if(!$this->gp['show']) {
$this->gp['show'] = 10;
}
$this->view->assign('showItems', $this->gp['show']);
$permissions = [];
if ($GLOBALS['BE_USER']->user['admin'] || intval($this->settings['enableClearLogs']) === 1) {
$permissions['delete'] = TRUE;
Expand Down
6 changes: 4 additions & 2 deletions Classes/ViewHelpers/Widget/UriViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ protected function getWidgetUri()
}

$queryParameters = [$argumentPrefix => $arguments];

//@TODO: HOW TO DO THIS BETTER?
$additionalParams = [
'tx_formhandler_web_formhandlertxformhandler' => [
'demand' => $_POST['tx_formhandler_web_formhandlertxformhandler']['demand']
'tx_formhandler_web_formhandlerlog' => [
'demand' => $_POST['tx_formhandler_web_formhandlerlog']['demand'],
'show' => $_POST['tx_formhandler_web_formhandlerlog']['show']
]
];
$queryParameters = array_merge($queryParameters, $additionalParams);
Expand Down
1 change: 1 addition & 0 deletions Resources/Private/Language/locallang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<label index="label.ip">IP</label>
<label index="label.detailView">View</label>
<label index="label.export">Export as</label>
<label index="label.show">Items per page</label>
<label index="label.submit">Filter</label>
<label index="label.select-all">Select all pages</label>
<label index="label.select-page-from-tree">Please select the page using the page tree.</label>
Expand Down
7 changes: 5 additions & 2 deletions Resources/Private/Templates/Module/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ <h1><f:translate key="headline.index" /></h1>
</span>
</div>
</div>

<div class="form-group">
<label for="tx_formhandler_logdata_show"><f:translate key="label.show" /></label>
<f:form.select id="tx_formhandler_logdata_show" class="form-control" name="show" value="{showItems}" options="{10:10, 50:50, 100:100, 1000:1000, 999999:'All'}"/>
</div>
<div class="form-group">
<f:form.submit value="{f:translate(key: 'label.submit')}" class="btn btn-default btn-sm" />
</div>
Expand All @@ -63,7 +66,7 @@ <h1><f:translate key="headline.index" /></h1>
<div class="col-xs-12">
<f:if condition="{logDataRows -> f:count()} > 0">
<f:then>
<f:be.widget.paginate objects="{logDataRows}" as="paginatedLogDataRows" configuration="{itemsPerPage: 5, insertBelow: 1}">
<f:be.widget.paginate objects="{logDataRows}" as="paginatedLogDataRows" configuration="{itemsPerPage: showItems, insertBelow: 1}">
<div class="table-fit">
<table class="table table-striped table-hover">
<thead>
Expand Down

0 comments on commit 52fce55

Please sign in to comment.