/** * url GET /v2/groups * @api * @return string * @throws ApiException */ public function groupsAction() { $allowFilters = ['offset' => true, 'limit' => true]; $allowSearch = ['query' => true]; $params = $this->_fc->getParams(); $filter = $this->_fc->getFilter(); $search = $this->_fc->getSearch(); // check filter if ($filter != null) { Utilities::checkFilters($filter, $allowFilters); } if ($search != null) { Utilities::checkFilters($search, $allowSearch); } if (isset($params[0])) { if ($search == null) { $this->data = GroupModel::getByNameOrId($params[0]); } } else { if ($search == null) { $data = GroupModel::getAll($filter['offset'], $filter['limit']); $this->data = $data['data']; $this->meta = $data['meta']; } else { $search['query'] = str_replace('%', '', $search['query']); $search['query'] = urldecode($search['query']); $this->data = GroupModel::searchByName($search['query']); } } return $this->send(200); }
private function searchGroups($searchValue) { $group_name = urldecode($searchValue); $this->data = GroupModel::searchByName($group_name); return $this->send(200); }
/** * url GET /v2/groups * @api * @return string * @throws ApiException */ public function groupsAction() { $allowFilters = ['offset' => true, 'limit' => true, 'showAll' => true, 'showProperties' => true, 'simpleResult' => true]; $allowSearch = ['query' => true]; $params = $this->_fc->getParams(); $filter = $this->_fc->getFilter(); $search = $this->_fc->getSearch(); // check filters Utilities::checkFilters($filter, $allowFilters); Utilities::checkFilters($search, $allowSearch); if (isset($params[0])) { if ($search == null) { $this->data = GroupModel::getByNameOrId($params[0]); } } else { if ($search == null) { $showProperties = null; $hideProperties = null; $hidePropertyNames = false; if (isset($filter["showAll"])) { $offset = null; $limit = null; //$showProperties = ['group_full_name'=>true]; $showProperties = is_array($filter["showProperties"]) ? $filter["showProperties"] : []; $hidePropertyNames = isset($filter["simpleResult"]) ? $filter["simpleResult"] : false; } else { $offset = isset($filter['offset']) ? abs(intval($filter['offset'])) : 0; $limit = isset($filter['limit']) ? abs(intval($filter['limit'])) : 100; if ($limit < 1) { $limit = 1; } if ($limit > 100) { $limit = 100; } } $data = GroupModel::getAll($offset, $limit, $showProperties, $hideProperties, $hidePropertyNames); $this->data = $data['data']; $this->meta = $data['meta']; } else { $search['query'] = str_replace('%', '', $search['query']); $search['query'] = urldecode($search['query']); $this->data = GroupModel::searchByName($search['query']); } } return $this->send(200); }