Skip to content

Commit ec5d995

Browse files
committed
Work in progress: use ported getResourceTags.
1 parent ae7c6b6 commit ec5d995

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

module/VuFindAdmin/src/VuFindAdmin/Controller/TagsController.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,13 @@ public function listAction()
130130
$view->uniqueTags = $this->getUniqueTags();
131131
$view->uniqueUsers = $this->getUniqueUsers();
132132
$view->uniqueResources = $this->getUniqueResources();
133-
$view->results = $this->getResourceTags();
133+
$view->results = new \Laminas\Paginator\Paginator(
134+
new \DoctrineORMModule\Paginator\Adapter\DoctrinePaginator(
135+
$this->getResourceTags()
136+
)
137+
);
138+
$view->results->setCurrentPageNumber($this->params['page'] ?? "1");
139+
$view->results->setItemCountPerPage(20);
134140
$view->params = $this->params;
135141
return $view;
136142
}
@@ -143,7 +149,6 @@ public function listAction()
143149
public function deleteAction()
144150
{
145151
$this->params = $this->params()->fromPost();
146-
$tags = $this->getTable('ResourceTags');
147152

148153
$origin = $this->params()
149154
->fromPost('origin', $this->params()->fromQuery('origin'));
@@ -171,7 +176,7 @@ public function deleteAction()
171176
|| null !== $this->getRequest()->getQuery('deleteFilter')
172177
) {
173178
if (false === $confirm) {
174-
return $this->confirmTagsDeleteByFilter($tags, $originUrl, $newUrl);
179+
return $this->confirmTagsDeleteByFilter($originUrl, $newUrl);
175180
}
176181
$delete = $this->deleteResourceTagsByFilter();
177182
} else {
@@ -288,19 +293,18 @@ protected function confirmTagsDelete($ids, $originUrl, $newUrl)
288293
/**
289294
* Confirm Tag Delete by Filter
290295
*
291-
* @param object $tagModel A Tag object
292296
* @param string $originUrl An origin url
293297
* @param string $newUrl The url of the desired action
294298
*
295299
* @return mixed
296300
*/
297-
protected function confirmTagsDeleteByFilter($tagModel, $originUrl, $newUrl)
301+
protected function confirmTagsDeleteByFilter($originUrl, $newUrl)
298302
{
299-
$count = $tagModel->getResourceTags(
303+
$count = $this->tagService->getResourceTags(
300304
$this->convertFilter($this->getParam('user_id')),
301305
$this->convertFilter($this->getParam('resource_id')),
302306
$this->convertFilter($this->getParam('tag_id'))
303-
)->getTotalItemCount();
307+
)->count();
304308

305309
$data = [
306310
'data' => [
@@ -385,8 +389,7 @@ protected function convertFilter($value)
385389
protected function getResourceTags()
386390
{
387391
$currentPage = $this->params['page'] ?? "1";
388-
$resourceTags = $this->getTable('ResourceTags');
389-
$tags = $resourceTags->getResourceTags(
392+
$tags = $this->tagService->getResourceTags(
390393
$this->convertFilter($this->getParam('user_id')),
391394
$this->convertFilter($this->getParam('resource_id')),
392395
$this->convertFilter($this->getParam('tag_id')),

0 commit comments

Comments
 (0)