Ejemplo n.º 1
0
 public function assignteams(SS_HTTPRequest $request)
 {
     $params = $request->params();
     $game_id = $params['ID'];
     $teams = Team::get();
     $data = new ArrayData(array('Form' => $this->assignTeamsForm($game_id), 'ParentLink' => $this->Link()));
     return $data->renderWith(array('AssignTeams', 'Page'));
 }
Ejemplo n.º 2
0
 public function view(SS_HTTPRequest $request)
 {
     $params = $request->params();
     $player_id = $params['ID'];
     $player = Player::get()->filter('ID', $player_id)->first();
     $link = $this->Link();
     $data = new ArrayData(array('Player' => $player, 'ParentLink' => $link));
     return $data->renderWith(array('Player', 'Page'));
 }
Ejemplo n.º 3
0
 /**
  * Action - Get the latest deploy log
  *
  * @param SS_HTTPRequest $request
  *
  * @return string
  * @throws SS_HTTPResponse_Exception
  */
 public function transferlog(SS_HTTPRequest $request)
 {
     $this->setCurrentActionType(self::ACTION_SNAPSHOT);
     $params = $request->params();
     $transfer = DNDataTransfer::get()->byId($params['Identifier']);
     if (!$transfer || !$transfer->ID) {
         throw new SS_HTTPResponse_Exception('Transfer not found', 404);
     }
     if (!$transfer->canView()) {
         return Security::permissionFailure();
     }
     $environment = $transfer->Environment();
     $project = $environment->Project();
     if ($project->Name != $params['Project']) {
         throw new LogicException("Project in URL doesn't match this deploy");
     }
     $log = $transfer->log();
     if ($log->exists()) {
         $content = $log->content();
     } else {
         $content = 'Waiting for action to start';
     }
     return $this->sendResponse($transfer->ResqueStatus(), $content);
 }
Ejemplo n.º 4
0
 /**
  * Action - Get the latest deploy log
  *
  * @return string
  */
 public function transferlog(SS_HTTPRequest $request)
 {
     $params = $request->params();
     $transfer = DNDataTransfer::get()->byId($params['Identifier']);
     if (!$transfer || !$transfer->ID) {
         throw new SS_HTTPResponse_Exception('Transfer not found', 404);
     }
     if (!$transfer->canView()) {
         return Security::permissionFailure();
     }
     $environment = $transfer->Environment();
     $project = $environment->Project();
     if ($project->Name != $params['Project']) {
         throw new LogicException("Project in URL doesn't match this deploy");
     }
     $log = $transfer->log();
     if ($log->exists()) {
         $content = $log->content();
     } else {
         $content = 'Waiting for action to start';
     }
     $sendJSON = strpos($request->getHeader('Accept'), 'application/json') !== false || $request->getExtension() == 'json';
     $content = preg_replace('/(?:(?:\\r\\n|\\r|\\n)\\s*){2}/s', "\n", $content);
     if ($sendJSON) {
         $this->response->addHeader("Content-type", "application/json");
         return json_encode(array('status' => $transfer->ResqueStatus(), 'content' => $content));
     } else {
         $this->response->addHeader("Content-type", "text/plain");
         return $content;
     }
 }