hasRequestParameter('serviceCallId')) { throw new common_exception_Error('No serviceCallId on service call'); } return $this->getRequestParameter('serviceCallId'); } /** * Returns the state stored or NULL ifs none was found * * @return string */ protected function getState() { $serviceService = $this->getServiceLocator()->get(StateStorage::SERVICE_ID); $userUri = $this->getSession()->getUserUri(); return is_null($userUri) ? null : $serviceService->get($userUri, $this->getServiceCallId()); } /** * Stores the state of the current service call * * @param string $state * @return boolean */ protected function setState($state) { $serviceService = $this->getServiceLocator()->get(StateStorage::SERVICE_ID); $userUri = $this->getSession()->getUserUri(); return is_null($userUri) ? false : $serviceService->set($userUri, $this->getServiceCallId(), $state); } public function submitState() { $success = $this->setState($_POST['state']); $this->returnJson([ 'success' => $success ]); } public function getUserPropertyValues() { if (!$this->hasRequestParameter('property')) { throw new common_exception_MissingParameter('property'); } $property = $this->getRequestParameter('property'); $values = $this->getSession()->getUserPropertyValues($property); $this->returnJson([ 'success' => true, 'data' => [ $property => $values ] ]); } /** * Returns a directory from the service file storage * * @param string $id * @return tao_models_classes_service_StorageDirectory */ protected function getDirectory($id) { return $this->getServiceLocator()->get(tao_models_classes_service_FileStorage::SERVICE_ID)->getDirectoryById($id); } }