mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
|
<?php
|
||
|
namespace Framadate\Services;
|
||
|
|
||
|
use Framadate\Repositories\RepositoryFactory;
|
||
|
|
||
|
/**
|
||
|
* The class provides action for application administrators.
|
||
|
*
|
||
|
* @package Framadate\Services
|
||
|
*/
|
||
|
class SuperAdminService {
|
||
|
private $pollRepository;
|
||
|
|
||
|
function __construct() {
|
||
|
$this->pollRepository = RepositoryFactory::pollRepository();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Return the list of all polls.
|
||
|
*
|
||
|
* @param array $search Array of search : ['id'=>..., 'title'=>..., 'name'=>..., 'mail'=>...]
|
||
|
* @param int $page The page index (O = first page)
|
||
|
* @param int $limit The limit size
|
||
|
* @return array ['polls' => The {$limit} polls, 'count' => Entries found by the query, 'total' => Total count]
|
||
|
*/
|
||
|
public function findAllPolls($search, $page, $limit) {
|
||
|
$start = $page * $limit;
|
||
|
$polls = $this->pollRepository->findAll($search, $start, $limit);
|
||
|
$count = $this->pollRepository->count($search);
|
||
|
$total = $this->pollRepository->count();
|
||
|
|
||
|
return ['polls' => $polls, 'count' => $count, 'total' => $total];
|
||
|
}
|
||
|
}
|
||
|
|