/** * handleRequest * * @return void */ public function handleRequest() { $apiClient = ServiceApiClient::getInstance(); $apiClient->requestSecretKey(); Config::updateInstance(); $secretKey = Config::getInstance()->QSL->CloudSearch->secret_key; $this->redirect($apiClient->getDashboardIframeUrl($secretKey)); }
/** * Register CloudSearch if it has been scheduled * * @return void */ public function registerIfScheduled() { if ($this->isScheduled() && !\XLite::isCacheBuilding()) { $apiClient = ServiceApiClient::getInstance(); $this->unschedule(); $apiClient->register(); } }
/** * Search $cnd using the CloudSearch service * * @param \XLite\Core\CommonCell $cnd Search conditions object * @param boolean $countOnly Count only flag * * @return mixed */ public function searchViaCloudSearch($cnd, $countOnly = false) { $ids = \XLite\Module\QSL\CloudSearch\Core\ServiceApiClient::getInstance()->search($cnd->{static::P_SUBSTRING}); if ($countOnly) { $result = count($ids); } else { $limit = $cnd->{static::P_LIMIT}; if ($limit) { $ids = array_slice($ids, $limit[0], $limit[1]); } $self = $this; $result = array_map(function ($id) use($self) { return $self->find($id); }, $ids); } return $result; }