/**
  * 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);
 }
 /**
  * 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);
 }
 public function groupsAction()
 {
     $params = $this->_fc->getParams();
     $group_name = isset($params[0]) ? $params[0] : "";
     $group_name = urldecode($group_name);
     $lessons = isset($params[1]) ? $params[1] : "";
     $methodName = "groups" . ucfirst($lessons);
     if (method_exists($this, $methodName)) {
         return $this->{$methodName}($group_name);
     }
     if (isset($_GET["q"])) {
         return $this->searchGroups(urldecode($_GET["q"]));
     }
     if (isset($_GET["offset"]) && isset($_GET['limit']) || !$group_name) {
         $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
         $limit = isset($_GET['limit']) ? $_GET['limit'] : 100;
         return $this->getAllGroups($offset, $limit);
     }
     $groupModel = GroupModel::getByNameOrId($group_name);
     if ($groupModel != null) {
         $this->data = $groupModel;
     }
     return $this->send(200, Cache::NoCache);
 }
 public function __construct($group_name)
 {
     $this->group = GroupModel::getByNameOrId($group_name);
     $this->initialize();
 }