User management list.

@since 2.0.0
@access public
@param mixed $Keywords Term or array of terms to filter list of users.
@param int $Page Page number.
@param string $Order Sort order for list.
776904
public function Index($Keywords = '', $Page = '', $Order = '') {
      $this->Permission(
         array(
            'Garden.Users.Add',
            'Garden.Users.Edit',
            'Garden.Users.Delete'
         ),
         '',
         FALSE
      );
      
      // Page setup
      $this->AddJsFile('jquery.gardenmorepager.js');
      $this->AddJsFile('user.js');
      $this->Title(T('Users'));
      $this->AddSideMenu('dashboard/user');
      
      // Form setup
      $this->Form->Method = 'get';

      // Input Validation.
      list($Offset, $Limit) = OffsetLimit($Page, PagerModule::$DefaultPageSize);
      if (!$Keywords) {
         $Keywords = $this->Form->GetFormValue('Keywords');
         if ($Keywords)
            $Offset = 0;
      }

      // Put the Keyword back in the form
      if ($Keywords)
         $this->Form->SetFormValue('Keywords', $Keywords);

      $UserModel = new UserModel();
      //$Like = trim($Keywords) == '' ? FALSE : array('u.Name' => $Keywords, 'u.Email' => $Keywords);
      list($Offset, $Limit) = OffsetLimit($Page, 30);
      
      $Filter = $this->_GetFilter();
      if ($Filter)
         $Filter['Keywords'] = $Keywords;
      else
         $Filter = $Keywords;

      $this->SetData('RecordCount', $UserModel->SearchCount($Filter));
      
      // Sorting
      if (in_array($Order, array('DateInserted','DateFirstVisit', 'DateLastActive'))) {
         $Order = 'u.'.$Order;
         $OrderDir = 'desc';
      } else {
         $Order = 'u.Name';
         $OrderDir = 'asc';
      }

      // Get user list
      $this->UserData = $UserModel->Search($Filter, $Order, $OrderDir, $Limit, $Offset);
      $this->SetData('Users', $this->UserData);
      RoleModel::SetUserRoles($this->UserData->Result());
      
      // Deliver json data if necessary
      if ($this->_DeliveryType != DELIVERY_TYPE_ALL && $this->_DeliveryMethod == DELIVERY_METHOD_XHTML) {
         $this->SetJson('LessRow', $this->Pager->ToString('less'));
         $this->SetJson('MoreRow', $this->Pager->ToString('more'));
         $this->View = 'users';
      }

      $this->Render();
   }
412515
public function index()
    {
        $this->paginate['order'] = ['name' => 'ASC'];

        $groups = $this->paginate($this->UsersGroups->find());

        $this->set(compact('groups'));
    }
739455
public function getAllUsersBySearch($page, $search, $max = 20)
    {
        $users = $this->userRepo->findAllUserBySearch($search);
        return $this->pagerFactory->createPagerFromArray($users, $page, $max);
    }
380067
static public function search($keyword, $models = ['App\User'], $perPage = 15, $currentPage = null, array $options = [])
    {
        $query = null;

        if (empty($options)) {
            $options = [
                'path' => Paginator::resolveCurrentPath()
            ];
        }

        foreach ($models as $model) {

            if ($model === reset($models)) {

                $query = self::searchModel(new $model, $keyword);

            }

            $query = $query->merge(self::searchModel(new $model, $keyword));
        }

        return new LengthAwarePaginator($query->forPage(null, $perPage), $query->count(), $perPage, $currentPage, $options);
    }
957959
public function indexAction($page = 1)
    {
        // When the user inserts a numeric value, assume they want to find the entity by ID.
        $session = $this->get('session');
        $search  = $this->request->get('search', $session->get('mautic.'.$this->getSessionBase().'.filter', ''));
        if (isset($search) && is_numeric(trim($search))) {
            $search          = '%'.trim($search).'% OR ids:'.trim($search);
            $query           = $this->request->query->all();
            $query['search'] = $search;
            $this->request   = $this->request->duplicate($query);
            $session->set('mautic.'.$this->getSessionBase().'.filter', $search);
        } elseif (false === strpos($search, '%') && strlen($search) > 0 && false === strpos($search, 'OR ids:')) {
            $search          = '%'.trim($search, ' \t\n\r\0\x0B"%').'%';
            $search          = strpos($search, ' ') ? '"'.$search.'"' : $search;
            $query           = $this->request->query->all();
            $query['search'] = $search;
            $this->request   = $this->request->duplicate($query);
            $session->set('mautic.'.$this->getSessionBase().'.filter', $search);
        }

        return parent::indexStandard($page);
    }
1088052
public function actionList($sort = '', $page = 1, $limit = 20)
    {
        $link_id = \Yii::$app->request->get('link_id');
        $menu_id = \Yii::$app->request->get('menu_id');
        $url_id = \Yii::$app->request->get('url_id');
        $status = \Yii::$app->request->post('status');
        $limit = intval($limit);
        $order = ExtHelpers::getOrder($sort, [
            'link_id',
            'url_id',
        ], [], 'link_id DESC');
        $condition = '1';
        $params = [];
        $tabName = DpAdminMenuUrlRelation::tableName();
        $order = join(',', array_map(function ($value) use ($tabName) {
            return $tabName . '.' . $value;
        }, explode(',', $order)));
        if ($link_id) {
            $condition .= ' and ' . $tabName . '.link_id=:link_id';
            $params[':link_id'] = $link_id;
        }
        if ($menu_id) {
            $condition .= ' and ' . $tabName . '.menu_id=:menu_id';
            $params[':menu_id'] = $menu_id;
        }
        if ($url_id) {
            $condition .= ' and ' . $tabName . '.url_id=:url_id';
            $params[':url_id'] = $url_id;
        }
        if (is_numeric($status)) {
            $condition .= ' and ' . $tabName . '.status=:status';
            $params[':status'] = $status;
        }
        $data = DpAdminMenuUrlRelation::getListByCondition($condition, $params, $order, $page, $limit);
        if ($data['list']) {
            foreach ($data['list'] as &$item) {
                foreach ($item['menuUrl'] as $k => $v) {
                    $item['url.' . $k] = $v;
                }
                unset($item['menuUrl']);
            }
        }

        return [
            'total' => $data['pagination']['totalCount'],
            'list' => $data['list'],
        ];
    }
78756
public function orders($page = 1, $perPage = 30, $saleSystem = null, array $statuses = [])
    {
        $filters = [];

        if (!is_null($saleSystem)) {
            $filters['sale_system'] = (string) $saleSystem;
        }

        if (!is_null($statuses)) {
            $filters['statuses'] = (array) $statuses;
        }

        $query = [
            'page'     => (int)   $page,
            'per_page' => (int)   $perPage,
            'filters'  => (array) $filters,
        ];

        /** @var \SkyHub\Api\Handler\Response\HandlerInterface $responseHandler */
        $responseHandler = $this->service()->get($this->baseUrlPath(null, $query));
        return $responseHandler;
    }
566804
public function findAll(
        $page = 1,
        $per_page = 20,
        $order_by = self::ORDERBY_CREATED_AT,
        $order_dir = self::ORDERDIR_ASC
    ) {
        $results = self::getAll($this->_user, $page, $per_page, $order_by, $order_dir);

        if (isset($results['subscriptions'])) { // Cope with pagination
            $results = $results['subscriptions'];
        }

        $retval = array();

        foreach ($results as $pylon) {
            $retval[] = new self($this->_user, $pylon);
        }

        return $retval;
    }
405639
private function _get_collection($keyword, $start, $max, $sort) {
        global $SESSION;

        // The new API doesn't use "page" numbers for browsing through results.
        // It uses a prev and next token in each set that you need to use to
        // request the next page of results.
        $sesspagetoken = 'youtube_'.$this->id.'_nextpagetoken';
        $pagetoken = '';
        if ($start > 1 && isset($SESSION->{$sesspagetoken})) {
            $pagetoken = $SESSION->{$sesspagetoken};
        }

        $list = array();
        $error = null;
        try {
            $this->init_youtube_service(); // About to use the service, ensure it's loaded.
            $response = $this->service->search->listSearch('id,snippet', array(
                'q' => $keyword,
                'maxResults' => $max,
                'order' => $sort,
                'pageToken' => $pagetoken,
                'type' => 'video',
                'videoEmbeddable' => 'true',
            ));

            // Track the next page token for the next request (when a user
            // scrolls down in the file picker for more videos).
            $SESSION->{$sesspagetoken} = $response['nextPageToken'];

            foreach ($response['items'] as $result) {
                $title = $result->snippet->title;
                $source = 'http://www.youtube.com/v/' . $result->id->videoId . '#' . $title;
                $thumb = $result->snippet->getThumbnails()->getDefault();

                $list[] = array(
                    'shorttitle' => $title,
                    'thumbnail_title' => $result->snippet->description,
                    'title' => $title.'.avi', // This is a hack so we accept this file by extension.
                    'thumbnail' => $thumb->url,
                    'thumbnail_width' => (int)$thumb->width,
                    'thumbnail_height' => (int)$thumb->height,
                    'size' => '',
                    'date' => '',
                    'source' => $source,
                );
            }
        } catch (Google_Service_Exception $e) {
            // If we throw the google exception as-is, we may expose the apikey
            // to end users. The full message in the google exception includes
            // the apikey param, so we take just the part pertaining to the
            // actual error.
            $error = $e->getErrors()[0]['message'];
            throw new moodle_exception('apierror', 'repository_youtube', '', $error);
        }

        return $list;
    }
909533
def prepare_list
      page_info
      @list = user_scoped.where(@page_info.record.conditions).
          page(@page_info.page).
          per(@page_info.lines)
      if !@page_info.order_by.blank?
        @list = @list.order(@page_info.order_by + ' ' + @page_info.dir)
      end

      @count = user_scoped.where(@page_info.record.conditions).count
    end
1149619
protected function sortPages()
    {
        // sort pages
        $order = strtolower($this->getConfig('pages_order'));
        $orderBy = strtolower($this->getConfig('pages_order_by'));

        if (($orderBy !== 'alpha') && ($orderBy !== 'date') && ($orderBy !== 'meta')) {
            return;
        }

        $alphaSortClosure = function ($a, $b) use ($order) {
            if (!empty($a['hidden']) xor !empty($b['hidden'])) {
                return (!empty($a['hidden']) - !empty($b['hidden'])) * (($order === 'desc') ? -1 : 1);
            }

            $aSortKey = (basename($a['id']) === 'index') ? dirname($a['id']) : $a['id'];
            $bSortKey = (basename($b['id']) === 'index') ? dirname($b['id']) : $b['id'];

            $cmp = strcmp($aSortKey, $bSortKey);
            return $cmp * (($order === 'desc') ? -1 : 1);
        };

        if ($orderBy === 'meta') {
            // sort by arbitrary meta value
            $orderByMeta = $this->getConfig('pages_order_by_meta');
            uasort($this->pages, function ($a, $b) use ($alphaSortClosure, $order, $orderByMeta) {
                $aSortValue = isset($a['meta'][$orderByMeta]) ? $a['meta'][$orderByMeta] : null;
                $aSortValueNull = ($aSortValue === null);

                $bSortValue = isset($b['meta'][$orderByMeta]) ? $b['meta'][$orderByMeta] : null;
                $bSortValueNull = ($bSortValue === null);

                $cmp = 0;
                if ($aSortValueNull || $bSortValueNull) {
                    $cmp = ($aSortValueNull - $bSortValueNull);
                } elseif ($aSortValue != $bSortValue) {
                    $cmp = ($aSortValue > $bSortValue) ? 1 : -1;
                }

                if ($cmp === 0) {
                    // never assume equality; fallback to alphabetical order
                    return $alphaSortClosure($a, $b);
                }

                return $cmp * (($order === 'desc') ? -1 : 1);
            });
        } elseif ($orderBy === 'date') {
            // sort by date
            uasort($this->pages, function ($a, $b) use ($alphaSortClosure, $order) {
                if (!empty($a['hidden']) xor !empty($b['hidden'])) {
                    return $alphaSortClosure($a, $b);
                }

                if (!$a['time'] || !$b['time']) {
                    $cmp = (!$a['time'] - !$b['time']);
                } else {
                    $cmp = ($b['time'] - $a['time']);
                }

                if ($cmp === 0) {
                    // never assume equality; fallback to alphabetical order
                    return $alphaSortClosure($a, $b);
                }

                return $cmp * (($order === 'desc') ? 1 : -1);
            });
        } else {
            // sort alphabetically
            uasort($this->pages, $alphaSortClosure);
        }
    }
1307992
public function getByPage(
        int $page = 1,
        int $limit = 10,
        array $where = [],
        array $with = [],
        string $orderBy = null,
        string $order = 'desc'
    ) {
        $query = $this->make($with);

        $query = $this->applyWhere($query, $where);

        if ($orderBy) {
            $query = $query->orderBy($orderBy, $order);
        }

        return $query->skip($limit * ($page - 1))
            ->take($limit)
            ->get();
    }
1269099
public function admin_enqueue_scripts($page){
		if( 'tools_page_wpametu-batch' == $page ){
			wp_enqueue_script('wpametu-batch-helper');
			wp_localize_script('wpametu-batch-helper', 'WpametuBatch', [
				'confirm' => $this->__('Are you sure to execute this?'),
				'alert' => $this->__('No Batch is selected.'),
				'done' => $this->__('[DONE] Batch process done.')
			]);
			wp_enqueue_style('wpametu-batch-screen');
		}
	}
1079437
public static Result list(int page, String sortBy, String order, String filter) {
        return ok(
            list.render(
                Computer.page(page, 10, sortBy, order, filter),
                sortBy, order, filter
            )
        );
    }
217691
public function getGroupsByName($search, $page, $max = 50, $orderedBy = 'id')
    {
        $query = $this->groupRepo->findByName($search, false, $orderedBy);

        return $this->pagerFactory->createPager($query, $page, $max);
    }
211557
public function filterByKeywords($keywords)
    {
        $expressions = [
            $this->query->expr()->like('psi.cName', ':keywords'),
            $this->query->expr()->like('psi.cDescription', ':keywords'),
            $this->query->expr()->like('psi.content', ':keywords'),
        ];

        $keys = \CollectionAttributeKey::getSearchableIndexedList();
        foreach ($keys as $ak) {
            $cnt = $ak->getController();
            $expressions[] = $cnt->searchKeywords($keywords, $this->query);
        }
        $expr = $this->query->expr();
        $this->query->andWhere(call_user_func_array([$expr, 'orX'], $expressions));
        $this->query->setParameter('keywords', '%' . $keywords . '%');
    }
1057677
public function search($search_text, $page = 0) {
        global $SESSION;
        $sort = optional_param('youtube_sort', '', PARAM_TEXT);
        $sess_keyword = 'youtube_'.$this->id.'_keyword';
        $sess_sort = 'youtube_'.$this->id.'_sort';

        // This is the request of another page for the last search, retrieve the cached keyword and sort
        if ($page && !$search_text && isset($SESSION->{$sess_keyword})) {
            $search_text = $SESSION->{$sess_keyword};
        }
        if ($page && !$sort && isset($SESSION->{$sess_sort})) {
            $sort = $SESSION->{$sess_sort};
        }
        if (!$sort) {
            $sort = 'relevance'; // default
        }

        // Save this search in session
        $SESSION->{$sess_keyword} = $search_text;
        $SESSION->{$sess_sort} = $sort;

        $this->keyword = $search_text;
        $ret  = array();
        $ret['nologin'] = true;
        $ret['page'] = (int)$page;
        if ($ret['page'] < 1) {
            $ret['page'] = 1;
        }
        $start = ($ret['page'] - 1) * self::YOUTUBE_THUMBS_PER_PAGE + 1;
        $max = self::YOUTUBE_THUMBS_PER_PAGE;
        $ret['list'] = $this->_get_collection($search_text, $start, $max, $sort);
        $ret['norefresh'] = true;
        $ret['nosearch'] = true;
        // If the number of results is smaller than $max, it means we reached the last page.
        $ret['pages'] = (count($ret['list']) < $max) ? $ret['page'] : -1;
        return $ret;
    }