Files
pathfinder/app/Controller/Api/System.php
Mark Friedrich a5f29ee2eb - NEW "Thera connections" UI module, closed #829
- Upgraded "[_pathfinder_esi_](https://github.com/exodus4d/pathfinder_esi)" Web API client`v1.3.2` → `v2.0.0`
- Fixed a js bug where current active(selected) system becomes deselected after system was dragged on map
- Fixed a js bug where new auto mapped systems (e.g. after jump) were positioned outside current map scroll viewport
- Fixed a js bug where map sync failed after map tabs switch
- Fixed blurry map when map zoom was changed
- Fixed multiple minor JS bugs where map render/update failed
2020-03-02 16:42:36 +01:00

95 lines
2.8 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: exodus4d
* Date: 08.02.15
* Time: 20:23
*/
namespace Exodus4D\Pathfinder\Controller\Api;
use Exodus4D\Pathfinder\Lib\Config;
use Exodus4D\Pathfinder\Controller;
use Exodus4D\Pathfinder\Model\Pathfinder;
class System extends Controller\AccessController {
/**
* set destination for system, station or structure
* @param \Base $f3
* @throws \Exception
*/
public function setDestination(\Base $f3){
$postData = (array)$f3->get('POST');
$return = (object) [];
$return->error = [];
$return->destData = [];
if(!empty($destData = (array)$postData['destData'])){
$activeCharacter = $this->getCharacter();
$return->clearOtherWaypoints = (bool)$postData['clearOtherWaypoints'];
$return->first = (bool)$postData['first'];
if($accessToken = $activeCharacter->getAccessToken()){
$options = [
'clearOtherWaypoints' => $return->clearOtherWaypoints,
'addToBeginning' => $return->first,
];
foreach($destData as $data){
$response = $f3->ccpClient()->send('setWaypoint', (int)$data['id'], $accessToken, $options);
if(empty($response)){
$return->destData[] = $data;
}else{
$error = (object) [];
$error->type = 'error';
$error->message = $response['error'];
$return->error[] = $error;
}
}
}
}
echo json_encode($return);
}
/**
* send Rally Point poke
* @param \Base $f3
* @throws \Exception
*/
public function pokeRally(\Base $f3){
$rallyData = (array)$f3->get('POST');
$systemId = (int)$rallyData['systemId'];
$return = (object) [];
if($systemId){
$activeCharacter = $this->getCharacter();
/**
* @var $system Pathfinder\SystemModel
*/
$system = Pathfinder\AbstractPathfinderModel::getNew('SystemModel');
$system->getById($systemId);
if($system->hasAccess($activeCharacter)){
$rallyData['pokeDesktop'] = $rallyData['pokeDesktop'] === '1';
$rallyData['pokeMail'] = $rallyData['pokeMail'] === '1';
$rallyData['pokeSlack'] = $rallyData['pokeSlack'] === '1';
$rallyData['pokeDiscord'] = $rallyData['pokeDiscord'] === '1';
$rallyData['message'] = trim($rallyData['message']);
$system->sendRallyPoke($rallyData, $activeCharacter);
}
}
echo json_encode($return);
}
}