Returns objects created by a user

@param int   $userId  The user's ID
@param int   $page    The page of results to return
@param int   $perPage The number of results per page
@param array $data    Data to pass to getCountCommon()

@return array
553680
public function getObjectsForUser($userId, $page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->where('o.created_by', $userId);
        return $this->getObjects($page, $perPage, $data);
    }
1158047
public function getVisibleUsers($page)
    {
        $roleSuperAdmin = 'ROLE_SUPER_ADMIN';

        if ($this->securityContext->isGranted($roleSuperAdmin)) {
            $entities = $this->userManager->findPaginateUsers($page);
        } else {
            $entities = $this->userManager->findPaginateUsersExcludingRole($roleSuperAdmin, $page);
        }

        return $entities;
    }
224202
public static function listHistorics($user, $page = 1, $per_page = 20)
    {
        try {
            $res = $user->post(
                'historics/get',
                array(
                    'page' => $page,
                    'max' => $page,
                )
            );

            $retval = array('count' => $res['count'], 'historics' => array());

            foreach ($res['data'] as $historic) {
                $retval['historics'][] = new self($user, $historic);
            }

            return $retval;
        } catch (DataSift_Exception_APIError $e) {
            switch ($e->getCode()) {
                case 400:
                    // Missing or invalid parameters
                    throw new DataSift_Exception_InvalidData($e->getMessage());

                default:
                    throw new DataSift_Exception_APIError(
                        'Unexpected APIError code: ' . $e->getCode() . ' [' . $e->getMessage() . ']'
                    );
            }
        }
    }
712729
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $page = $page ?: Paginator::resolveCurrentPage($pageName);

        $perPage = $perPage ?: $this->model->getPerPage();

        $results = ($total = $this->toBase()->getCountForPagination())
                                    ? $this->forPage($page, $perPage)->get($columns)
                                    : $this->model->newCollection();

        return $this->paginator($results, $total, $perPage, $page, [
            'path' => Paginator::resolveCurrentPath(),
            'pageName' => $pageName,
        ]);
    }
1034126
public function paginate($per_page = 10, $page_name = "page", $page = null)
    {

        $this->take($per_page);

        $page = $page ?: Request::get($page_name, 1);

        $this->skip(($page * $per_page) - $per_page);

        $objects = $this->get();

        return new Pagination($objects, $objects->total, $per_page, $page, ['path' => Request::url(), 'query' => Request::query()]);
    }
1008383
public function page ($page, $per_page = null)
	{
		$model = $this->model;

		if($per_page === null) { $per_page = $model::$per_page; }

		$this->offset($page * $per_page)->limit($per_page);

		return $this;
	}
975321
public function getActivityKudos($id, $page = null, $per_page = null)
    {
        try {
            return $this->service->getActivityKudos($id, $page, $per_page);
        } catch (ServiceException $e) {
            throw new ClientException('[SERVICE] ' . $e->getMessage());
        }
    }
112254
public function noteListAction($resourceId, $page, User $user)
    {
        $notesQB = $this->getNoteActionManager()->getNotesForPagination($resourceId, $user);
        $pager = $this->paginateQuery($notesQB, $page);

        return array('pager' => $pager, 'resourceId' => $resourceId);
    }
471921
public function paginate($perPage = null, $columns = array('*'), $pageName = 'page', $page = null)
    {
        if (is_null($page)) {
            $page = Paginator::resolveCurrentPage($pageName);
        }

        $path = Paginator::resolveCurrentPath($pageName);

        if (is_null($perPage)) {
            $perPage = $this->model->getPerPage();
        }

        $total = $this->query->getPaginationCount();

        if ($total > 0) {
            $results = $this->forPage($page, $perPage)->get($columns);
        } else {
            $results = $this->model->newCollection();
        }

        return new Paginator($results, $total, $perPage, $page, compact('path', 'pageName'));
    }
729327
public function paginate($page = 1, $itemsPerPage = 20)
    {
        $query = $this->createAndFilterQueryBuilder($this->getEntityAlias());
        $query->setFirstResult(($page - 1) * $itemsPerPage);
        $query->setMaxResults($itemsPerPage);
        return new Paginator($query);
    }
618851
public function aggregate($uuid, $page = 1, $maxPerPage = 25)
    {
        return $this->dataTransformer->transform(
            $this->paginateAggregate($this->eventQuery->fromAggregate($uuid), $page, $maxPerPage),
            $this->eventQuery->streamCount($uuid),
            $page,
            $maxPerPage
        );
    }
80182
public function findPages($type, $page, $numberPerPage)
    {
        $offset = (($page - 1) * $numberPerPage);

        return $this
            ->createQueryBuilder('p')
            ->where('p.enabled = :enabled')
            ->andWhere('p.type = :type')
            ->orderBy('p.publicationDate', 'DESC')
            ->setParameters([
                'enabled' => true,
                'type' => $type,
            ])
            ->setFirstResult($offset)
            ->setMaxResults($numberPerPage)
            ->getQuery()
            ->getArrayResult();
    }
535253
public function getLogsByUserId($id, $page = 0, $pagesize = 100, $sort = 'id', $direction = 'asc')
    {
        if(is_null($id)) {
            throw new \Exception('User ID is required.');
        }

        $result = (Object)array(
            "logs" =>  array(),
            "total" => 0
        );

        $repo = $this->getRepository('\erdiko\users\entities\user\event\Log');

        $offset = 0;
        if ($page > 0) {
            $offset = ($page - 1) * $pagesize;
        }

        $result->logs = $repo->findBy(
            array("user_id" => $id),
            array(
                $sort => $direction
            ),
            $pagesize,
            $offset
        );

        // get total log count
        $result->total = (int)$repo->createQueryBuilder('u')
            ->select('count(u.id)')
            ->where('u.user_id = :user_id')
            ->setParameter("user_id", $id)
            ->getQuery()
            ->getSingleScalarResult();

        return $result;
    }
1260110
public function paginate($perPage, $page = null)
    {
        if (empty($page)) {
            $page = request('page', 1);
        }
        $offset = ($page * $perPage) - $perPage;

        $collection = $this->all();
        $newItems = array_slice($collection, $offset, $perPage, true);
        return $this->createChildCollection($newItems);
    }
563633
public function getByUser($userId, $paginate = null)
    {
        $query = $this->model->where('user_id', $userId);

        if (!is_null($paginate)) {
            return $query->paginate($paginate);
        }

        return $query->get();
    }
485098
public function paginate($page, $perPage = null)
    {
        $this->queryDefaults['paged'] = $page;
        $this->queryDefaults['posts_per_page'] = $perPage ?: get_option('posts_per_page');

        return $this;
    }
1068930
public function getBucketsFlat($page = null, $perPage = null, $data = [])
    {
        $aBuckets = $this->getBuckets($page, $perPage, $data);
        $aOut     = [];

        foreach ($aBuckets as $oBucket) {
            $aOut[$oBucket->id] = $oBucket->label;
        }

        return $aOut;
    }