Exemplo n.º 1
0
 /**
  * Moves the current position to the provided scoped reference: item, section, part
  */
 public function move()
 {
     $code = 200;
     $ref = $this->getRequestParameter('ref');
     $direction = $this->getRequestParameter('direction');
     $scope = $this->getRequestParameter('scope');
     try {
         $serviceContext = $this->getServiceContext();
         $serviceContext->getTestSession()->initItemTimer();
         $result = $this->runnerService->move($serviceContext, $direction, $scope, $ref);
         $response = ['success' => $result];
         if ($result) {
             $response['testContext'] = $this->runnerService->getTestContext($serviceContext);
         }
         $this->runnerService->persist($serviceContext);
     } catch (common_Exception $e) {
         $response = $this->getErrorResponse($e);
         $code = $this->getErrorCode($e);
     }
     $this->returnJson($response, $code);
 }